update 优化接口请求路径

This commit is contained in:
疯狂的狮子Li 2024-12-09 23:30:05 +08:00
parent d67cc4ded3
commit a9fcce2413
17 changed files with 163 additions and 174 deletions

View File

@ -1,5 +1,5 @@
import request from '@/utils/request';
import { FlowDefinitionQuery, FlowDefinitionVo, definitionXmlVO, FlowDefinitionForm } from '@/api/workflow/definition/types';
import { FlowDefinitionQuery, definitionXmlVO, FlowDefinitionForm } from '@/api/workflow/definition/types';
import { AxiosPromise } from 'axios';
/**
@ -55,10 +55,13 @@ export const deleteDefinition = (id: string | string[]) => {
* @param definitionId id
* @returns
*/
export const updateDefinitionState = (definitionId: string, activityStatus: boolean) => {
export const active = (definitionId: string, activityStatus: boolean) => {
return request({
url: `/workflow/definition/updateDefinitionState/${definitionId}/${activityStatus}`,
method: 'put'
url: `/workflow/definition/active/${definitionId}`,
method: 'put',
params: {
activityStatus: activityStatus
}
});
};
@ -66,9 +69,9 @@ export const updateDefinitionState = (definitionId: string, activityStatus: bool
* zip或xml部署流程定义
* @returns
*/
export function importDefinition(data: any) {
export function importDef(data: any) {
return request({
url: '/workflow/definition/importDefinition',
url: '/workflow/definition/importDef',
method: 'post',
data: data,
headers: {
@ -131,9 +134,9 @@ export const add = (data: FlowDefinitionForm) => {
* @param id id
* @returns
*/
export const copyDef = (id: string) => {
export const copy = (id: string) => {
return request({
url: `/workflow/definition/copyDef/${id}`,
url: `/workflow/definition/copy/${id}`,
method: 'post'
});
};

View File

@ -8,7 +8,7 @@ import { DefinitionConfigVO, DefinitionConfigForm } from '@/api/workflow/definit
*/
export const getByDefId = (definitionId: string | number): AxiosPromise<DefinitionConfigVO> => {
return request({
url: '/workflow/definitionConfig/getByDefId/' + definitionId,
url: '/workflow/defConfig/getByDefId/' + definitionId,
method: 'get'
});
};
@ -19,7 +19,7 @@ export const getByDefId = (definitionId: string | number): AxiosPromise<Definiti
*/
export const saveOrUpdate = (data: DefinitionConfigForm) => {
return request({
url: '/workflow/definitionConfig/saveOrUpdate',
url: '/workflow/defConfig/saveOrUpdate',
method: 'post',
data: data
});
@ -31,7 +31,7 @@ export const saveOrUpdate = (data: DefinitionConfigForm) => {
*/
export const deldefinitionConfig = (id: string | number | Array<string | number>) => {
return request({
url: '/workflow/definitionConfig/' + id,
url: '/workflow/defConfig/' + id,
method: 'delete'
});
};
@ -43,7 +43,11 @@ export const deldefinitionConfig = (id: string | number | Array<string | number>
*/
export const getByTableNameNotDefId = (tableName: string, definitionId: string | number) => {
return request({
url: `/workflow/definitionConfig/getByTableNameNotDefId/${tableName}/${definitionId}`,
method: 'get'
url: `/workflow/defConfig/getByTableNameNotDefId`,
method: 'get',
params: {
tableName: tableName,
definitionId: definitionId
}
});
};

View File

@ -0,0 +1,101 @@
import request from '@/utils/request';
import { FlowInstanceQuery, FlowInstanceVO } from '@/api/workflow/instance/types';
import { AxiosPromise } from 'axios';
/**
*
* @param query
* @returns {*}
*/
export const pageByRunning = (query: FlowInstanceQuery): AxiosPromise<FlowInstanceVO[]> => {
return request({
url: '/workflow/instance/pageByRunning',
method: 'get',
params: query
});
};
/**
*
* @param query
* @returns {*}
*/
export const pageByFinish = (query: FlowInstanceQuery): AxiosPromise<FlowInstanceVO[]> => {
return request({
url: '/workflow/instance/pageByFinish',
method: 'get',
params: query
});
};
/**
* id获取历史流程图
*/
export const flowImage = (businessKey: string | number) => {
return request({
url: `/workflow/instance/flowImage/${businessKey}` + '?t' + Math.random(),
method: 'get'
});
};
/**
*
* @param query
* @returns {*}
*/
export const pageByCurrent = (query: FlowInstanceQuery): AxiosPromise<FlowInstanceVO[]> => {
return request({
url: '/workflow/instance/pageByCurrent',
method: 'get',
params: query
});
};
/**
*
* @param data
* @returns
*/
export const cancelProcessApply = (data: any) => {
return request({
url: `/workflow/instance/cancelProcessApply`,
method: 'put',
data: data
});
};
/**
*
* @param instanceId id
* @returns
*/
export const instanceVariable = (instanceId: string | number) => {
return request({
url: `/workflow/instance/instanceVariable/${instanceId}`,
method: 'get'
});
};
/**
*
* @param instanceIds id
* @returns
*/
export const deleteByInstanceIds = (instanceIds: Array<string | number> | string | number) => {
return request({
url: `/workflow/instance/deleteByInstanceIds/${instanceIds}`,
method: 'delete'
});
};
/**
*
* @param data
* @returns
*/
export const invalid = (data: any) => {
return request({
url: `/workflow/instance/invalid`,
method: 'post',
data: data
});
};

View File

@ -1,109 +0,0 @@
import request from '@/utils/request';
import { ProcessInstanceQuery, ProcessInstanceVO } from '@/api/workflow/processInstance/types';
import { AxiosPromise } from 'axios';
/**
*
* @param query
* @returns {*}
*/
export const getPageByRunning = (query: ProcessInstanceQuery): AxiosPromise<ProcessInstanceVO[]> => {
return request({
url: '/workflow/processInstance/getPageByRunning',
method: 'get',
params: query
});
};
/**
*
* @param query
* @returns {*}
*/
export const getPageByFinish = (query: ProcessInstanceQuery): AxiosPromise<ProcessInstanceVO[]> => {
return request({
url: '/workflow/processInstance/getPageByFinish',
method: 'get',
params: query
});
};
/**
* id获取历史流程图
*/
export const getFlowImage = (businessKey: string | number) => {
return request({
url: `/workflow/processInstance/getFlowImage/${businessKey}` + '?t' + Math.random(),
method: 'get'
});
};
/**
*
* @param query
* @returns {*}
*/
export const getPageByCurrent = (query: ProcessInstanceQuery): AxiosPromise<ProcessInstanceVO[]> => {
return request({
url: '/workflow/processInstance/getPageByCurrent',
method: 'get',
params: query
});
};
/**
*
* @param data
* @returns
*/
export const cancelProcessApply = (data: any) => {
return request({
url: `/workflow/processInstance/cancelProcessApply`,
method: 'put',
data: data
});
};
/**
*
* @param businessKey id
* @returns
*/
export const getInstanceVariable = (instanceId: string) => {
return request({
url: `/workflow/processInstance/getInstanceVariable/${instanceId}`,
method: 'get'
});
};
/**
*
* @param instanceIds id
* @returns
*/
export const deleteByInstanceIds = (instanceIds: Array<string | number> | string | number) => {
return request({
url: `/workflow/processInstance/deleteByInstanceIds/${instanceIds}`,
method: 'delete'
});
};
/**
*
* @param data
* @returns
*/
export const processInvalid = (data: any) => {
return request({
url: `/workflow/processInstance/processInvalid`,
method: 'post',
data: data
});
};
export default {
getPageByRunning,
getPageByFinish,
getFlowImage,
getPageByCurrent,
cancelProcessApply
};

View File

@ -7,9 +7,9 @@ import { TaskQuery, FlowTaskVO, TaskOperationBo } from '@/api/workflow/task/type
* @param query
* @returns {*}
*/
export const getPageByTaskWait = (query: TaskQuery): AxiosPromise<FlowTaskVO[]> => {
export const pageByTaskWait = (query: TaskQuery): AxiosPromise<FlowTaskVO[]> => {
return request({
url: '/workflow/task/getPageByTaskWait',
url: '/workflow/task/pageByTaskWait',
method: 'get',
params: query
});
@ -20,9 +20,9 @@ export const getPageByTaskWait = (query: TaskQuery): AxiosPromise<FlowTaskVO[]>
* @param query
* @returns {*}
*/
export const getPageByTaskFinish = (query: TaskQuery): AxiosPromise<FlowTaskVO[]> => {
export const pageByTaskFinish = (query: TaskQuery): AxiosPromise<FlowTaskVO[]> => {
return request({
url: '/workflow/task/getPageByTaskFinish',
url: '/workflow/task/pageByTaskFinish',
method: 'get',
params: query
});
@ -33,9 +33,9 @@ export const getPageByTaskFinish = (query: TaskQuery): AxiosPromise<FlowTaskVO[]
* @param query
* @returns {*}
*/
export const getPageByTaskCopy = (query: TaskQuery): AxiosPromise<FlowTaskVO[]> => {
export const pageByTaskCopy = (query: TaskQuery): AxiosPromise<FlowTaskVO[]> => {
return request({
url: '/workflow/task/getPageByTaskCopy',
url: '/workflow/task/pageByTaskCopy',
method: 'get',
params: query
});
@ -111,16 +111,16 @@ export const backProcess = (data: any): any => {
* @param taskId
* @returns
*/
export const getTaskById = (taskId: string) => {
export const getTask = (taskId: string) => {
return request({
url: '/workflow/task/getTaskById/' + taskId,
url: '/workflow/task/getTask/' + taskId,
method: 'get'
});
};
/**
*
* @param taskIds
* @param taskIdList
* @param userId
* @returns
*/
@ -219,9 +219,9 @@ export const taskOperation = (data: TaskOperationBo, operation: string) => {
* @param taskId id
* @returns
*/
export const getUserListTaskId = (taskId: string | number) => {
export const currentTaskAllUser = (taskId: string | number) => {
return request({
url: `/workflow/task/getUserListTaskId/${taskId}`,
url: `/workflow/task/currentTaskAllUser/${taskId}`,
method: 'get'
});
};

View File

@ -40,7 +40,7 @@ import { ModuleDeclaration } from 'didi';
import type { Canvas, ModdleElement } from 'bpmn';
import EventBus from 'diagram-js/lib/core/EventBus';
import Overlays from 'diagram-js/lib/features/overlays/Overlays';
import processApi from '@/api/workflow/processInstance/index';
import processApi from '@/api/workflow/instance/index';
const canvas = ref<HTMLElement>();
const modeler = ref<BpmnViewer>();

View File

@ -56,7 +56,7 @@
</div>
</template>
<script lang="ts" setup>
import processApi from '@/api/workflow/processInstance';
import processApi from 'src/api/workflow/instance';
import { propTypes } from '@/utils/propTypes';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;

View File

@ -57,7 +57,7 @@ import { propTypes } from '@/utils/propTypes';
import { FlowTaskVO, TaskOperationBo } from '@/api/workflow/task/types';
import UserSelect from '@/components/UserSelect';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
import { getTaskById, taskOperation, getUserListTaskId, terminationTask } from '@/api/workflow/task';
import { getTask, taskOperation, currentTaskAllUser, terminationTask } from '@/api/workflow/task';
const props = defineProps({
width: propTypes.string.def('50%'),
height: propTypes.string.def('100%')
@ -96,7 +96,7 @@ const task = ref<FlowTaskVO>({
const open = (taskId: string) => {
visible.value = true;
getTaskById(taskId).then((response) => {
getTask(taskId).then((response) => {
loading.value = false;
buttonDisabled.value = false;
task.value = response.data;
@ -201,7 +201,7 @@ const deleteMultiInstanceUser = async (row) => {
};
//
const handleTaskUser = async () => {
let data = await getUserListTaskId(task.value.id);
let data = await currentTaskAllUser(task.value.id);
deleteUserList.value = data.data;
if (deleteUserList.value && deleteUserList.value.length > 0) {
deleteUserList.value.forEach((e) => {

View File

@ -103,7 +103,7 @@
import { ref } from 'vue';
import { ComponentInternalInstance } from 'vue';
import { ElForm } from 'element-plus';
import { completeTask, backProcess, getTaskById, taskOperation, terminationTask, getBackTaskNode, getUserListTaskId } from '@/api/workflow/task';
import { completeTask, backProcess, getTask, taskOperation, terminationTask, getBackTaskNode, currentTaskAllUser } from '@/api/workflow/task';
import UserSelect from '@/components/UserSelect';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
import { UserVO } from '@/api/system/user/types';
@ -187,7 +187,7 @@ const openDialog = (id?: string) => {
loading.value = true;
buttonDisabled.value = true;
nextTick(() => {
getTaskById(taskId.value).then((response) => {
getTask(taskId.value).then((response) => {
task.value = response.data;
loading.value = false;
buttonDisabled.value = false;
@ -397,7 +397,7 @@ const handleTerminationTask = async () => {
proxy?.$modal.msgSuccess('操作成功');
};
const handleTaskUser = async () => {
let data = await getUserListTaskId(taskId.value);
let data = await currentTaskAllUser(taskId.value);
deleteUserList.value = data.data;
if (deleteUserList.value && deleteUserList.value.length > 0) {
deleteUserList.value.forEach((e) => {

View File

@ -89,7 +89,7 @@
<script setup name="Leave" lang="ts">
import { delLeave, listLeave } from '@/api/workflow/leave';
import { cancelProcessApply } from '@/api/workflow/processInstance';
import { cancelProcessApply } from 'src/api/workflow/instance';
import { LeaveForm, LeaveQuery, LeaveVO } from '@/api/workflow/leave/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;

View File

@ -296,24 +296,14 @@
</template>
<script lang="ts" setup name="processDefinition">
import {
listDefinition,
definitionXml,
deleteDefinition,
updateDefinitionState,
importDefinition,
getHisListByKey,
publish,
add,
copyDef
} from '@/api/workflow/definition';
import { listDefinition, definitionXml, deleteDefinition, active, importDef, getHisListByKey, publish, add, copy } from '@/api/workflow/definition';
import { getByTableNameNotDefId, getByDefId, saveOrUpdate } from '@/api/workflow/definitionConfig';
import ProcessPreview from './components/processPreview.vue';
import { listCategory } from '@/api/workflow/category';
import { CategoryVO } from '@/api/workflow/category/types';
import { FlowDefinitionQuery, FlowDefinitionVo, FlowDefinitionForm } from '@/api/workflow/definition/types';
import { DefinitionConfigForm } from '@/api/workflow/definitionConfig/types';
import { UploadRequestOptions, ElMessage, ElMessageBox } from 'element-plus';
import { UploadRequestOptions } from 'element-plus';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -337,7 +327,7 @@ const multiple = ref(true);
const showSearch = ref(true);
const total = ref(0);
const uploadDialogLoading = ref(false);
const processDefinitionList = ref<FlowDefinitionVo[]>([]);
const processDefinitionList = ref<FlowDefinitionQuery[]>([]);
const processDefinitionHistoryList = ref<FlowDefinitionVo[]>([]);
const categoryOptions = ref<CategoryOption[]>([]);
const categoryName = ref('');
@ -505,7 +495,7 @@ const handleProcessDefState = async (row: FlowDefinitionVo) => {
}
await proxy?.$modal.confirm(msg);
loading.value = true;
await updateDefinitionState(row.id, row.activityStatus).finally(() => (loading.value = false));
await active(row.id, row.activityStatus).finally(() => (loading.value = false));
await getList();
proxy?.$modal.msgSuccess('操作成功');
};
@ -527,7 +517,7 @@ const handlerImportDefinition = (data: UploadRequestOptions): XMLHttpRequest =>
uploadDialogLoading.value = true;
formData.append('file', data.file);
formData.append('categoryCode', selectCategory.value);
importDefinition(formData)
importDef(formData)
.then(() => {
uploadDialog.visible = false;
proxy?.$modal.msgSuccess('部署成功');
@ -634,7 +624,7 @@ const handleCopyDef = async (row: FlowDefinitionVo) => {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
copyDef(row.id).then((resp) => {
copy(row.id).then((resp) => {
if (resp.code === 200) {
proxy?.$modal.msgSuccess('操作成功');
getList();

View File

@ -158,10 +158,10 @@
</template>
<script lang="ts" setup>
import { getPageByRunning, getPageByFinish, deleteByInstanceIds, getInstanceVariable, processInvalid } from '@/api/workflow/processInstance';
import { pageByRunning, pageByFinish, deleteByInstanceIds, instanceVariable, invalid } from 'src/api/workflow/instance';
import { listCategory } from '@/api/workflow/category';
import { CategoryVO } from '@/api/workflow/category/types';
import { FlowInstanceQuery, FlowInstanceVO } from '@/api/workflow/processInstance/types';
import { FlowInstanceQuery, FlowInstanceVO } from '@/api/workflow/instance/types';
import workflowCommon from '@/api/workflow/workflowCommon';
import { RouterJumpVo } from '@/api/workflow/workflowCommon/types';
import VueJsonPretty from 'vue-json-pretty';
@ -280,7 +280,7 @@ const handleSelectionChange = (selection: FlowInstanceVO[]) => {
//
const getProcessInstanceRunningList = () => {
loading.value = true;
getPageByRunning(queryParams.value).then((resp) => {
pageByRunning(queryParams.value).then((resp) => {
processInstanceList.value = resp.rows;
total.value = resp.total;
loading.value = false;
@ -289,7 +289,7 @@ const getProcessInstanceRunningList = () => {
//
const getProcessInstanceFinishList = () => {
loading.value = true;
getPageByFinish(queryParams.value).then((resp) => {
pageByFinish(queryParams.value).then((resp) => {
processInstanceList.value = resp.rows;
total.value = resp.total;
loading.value = false;
@ -328,7 +328,7 @@ const handleInvalid = async (row: FlowInstanceVO) => {
id: row.id,
comment: deleteReason.value
};
await processInvalid(param).finally(() => (loading.value = false));
await invalid(param).finally(() => (loading.value = false));
getProcessInstanceRunningList();
proxy?.$modal.msgSuccess('操作成功');
}
@ -353,7 +353,7 @@ const handleInstanceVariable = async (row: FlowInstanceVO) => {
variableLoading.value = true;
variableVisible.value = true;
processDefinitionName.value = row.flowName;
let data = await getInstanceVariable(row.id);
let data = await instanceVariable(row.id);
variables.value = data.data.variable;
variableLoading.value = false;
};

View File

@ -102,10 +102,10 @@
</template>
<script lang="ts" setup>
import { getPageByCurrent, deleteByInstanceIds, cancelProcessApply } from '@/api/workflow/processInstance';
import { pageByCurrent, deleteByInstanceIds, cancelProcessApply } from 'src/api/workflow/instance';
import { listCategory } from '@/api/workflow/category';
import { CategoryVO } from '@/api/workflow/category/types';
import { ProcessInstanceQuery, FlowInstanceVO } from '@/api/workflow/processInstance/types';
import { FlowInstanceQuery, FlowInstanceVO } from '@/api/workflow/instance/types';
import workflowCommon from '@/api/workflow/workflowCommon';
import { RouterJumpVo } from '@/api/workflow/workflowCommon/types';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -140,7 +140,7 @@ interface CategoryOption {
const tab = ref('running');
//
const queryParams = ref<ProcessInstanceQuery>({
const queryParams = ref<FlowInstanceQuery>({
pageNum: 1,
pageSize: 10,
flowCode: undefined,
@ -206,7 +206,7 @@ const handleSelectionChange = (selection: FlowInstanceVO[]) => {
//
const getList = () => {
loading.value = true;
getPageByCurrent(queryParams.value).then((resp) => {
pageByCurrent(queryParams.value).then((resp) => {
processInstanceList.value = resp.rows;
total.value = resp.total;
loading.value = false;

View File

@ -60,7 +60,7 @@
</template>
<script lang="ts" setup>
import { getPageByTaskCopy } from '@/api/workflow/task';
import { pageByTaskCopy } from '@/api/workflow/task';
import { TaskQuery } from '@/api/workflow/task/types';
import workflowCommon from '@/api/workflow/workflowCommon';
import { RouterJumpVo } from '@/api/workflow/workflowCommon/types';
@ -110,7 +110,7 @@ const handleSelectionChange = (selection: any) => {
//
const getTaskCopyList = () => {
loading.value = true;
getPageByTaskCopy(queryParams.value).then((resp) => {
pageByTaskCopy(queryParams.value).then((resp) => {
taskList.value = resp.rows;
total.value = resp.total;
loading.value = false;

View File

@ -73,7 +73,7 @@
</template>
<script lang="ts" setup>
import { getPageByTaskFinish } from '@/api/workflow/task';
import { pageByTaskFinish } from '@/api/workflow/task';
import { TaskQuery, FlowTaskVO } from '@/api/workflow/task/types';
import workflowCommon from '@/api/workflow/workflowCommon';
import { RouterJumpVo } from '@/api/workflow/workflowCommon/types';
@ -123,7 +123,7 @@ const handleSelectionChange = (selection: any) => {
};
const getFinishList = () => {
loading.value = true;
getPageByTaskFinish(queryParams.value).then((resp) => {
pageByTaskFinish(queryParams.value).then((resp) => {
taskList.value = resp.rows;
total.value = resp.total;
loading.value = false;

View File

@ -70,7 +70,7 @@
</template>
<script lang="ts" setup>
import { getPageByTaskWait } from '@/api/workflow/task';
import { pageByTaskWait } from '@/api/workflow/task';
import { TaskQuery, FlowTaskVO } from '@/api/workflow/task/types';
import workflowCommon from '@/api/workflow/workflowCommon';
import { RouterJumpVo } from '@/api/workflow/workflowCommon/types';
@ -123,7 +123,7 @@ const handleSelectionChange = (selection: any) => {
//
const getWaitingList = () => {
loading.value = true;
getPageByTaskWait(queryParams.value).then((resp) => {
pageByTaskWait(queryParams.value).then((resp) => {
taskList.value = resp.rows;
total.value = resp.total;
loading.value = false;