yxk-20260526-党委会查询督办流程:写一个通用的删除流程方法
This commit is contained in:
+13
-6
@@ -17,6 +17,7 @@ enum Api {
|
|||||||
startProcess = '/act/process/extActProcess/startMutilProcess',
|
startProcess = '/act/process/extActProcess/startMutilProcess',
|
||||||
startProcessSchedules = '/tasktask/taskTask/flow-schedules',
|
startProcessSchedules = '/tasktask/taskTask/flow-schedules',
|
||||||
queryByBusinessId = '/tasktask/taskTask/queryByBusinessId',
|
queryByBusinessId = '/tasktask/taskTask/queryByBusinessId',
|
||||||
|
deleteSingleProcess = '/tasktask/taskTask/deleteSingleProcess',
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -115,8 +116,8 @@ export const downloadFile = (url, fileName?, parameter?) => {
|
|||||||
if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
||||||
window.navigator.msSaveBlob(new Blob([data]), fileName);
|
window.navigator.msSaveBlob(new Blob([data]), fileName);
|
||||||
} else {
|
} else {
|
||||||
let url = window.URL.createObjectURL(new Blob([data]));
|
const url = window.URL.createObjectURL(new Blob([data]));
|
||||||
let link = document.createElement('a');
|
const link = document.createElement('a');
|
||||||
link.style.display = 'none';
|
link.style.display = 'none';
|
||||||
link.href = url;
|
link.href = url;
|
||||||
link.setAttribute('download', fileName);
|
link.setAttribute('download', fileName);
|
||||||
@@ -154,8 +155,8 @@ export const startProcessSchedules = (params) => {
|
|||||||
return defHttp.post({
|
return defHttp.post({
|
||||||
url: Api.startProcessSchedules,
|
url: Api.startProcessSchedules,
|
||||||
params,
|
params,
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发起流程
|
* 发起流程
|
||||||
@@ -173,9 +174,15 @@ export const startProcess = (params) => {
|
|||||||
* 根据业务ID查询流程列表
|
* 根据业务ID查询流程列表
|
||||||
* @param params
|
* @param params
|
||||||
*/
|
*/
|
||||||
export const queryByBusinessId = (params) =>
|
export const queryByBusinessId = (params) => defHttp.get({ url: Api.queryByBusinessId, params }, { isTransformResponse: false });
|
||||||
defHttp.get({ url: Api.queryByBusinessId, params }, { isTransformResponse: false });
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除单个流程实例
|
||||||
|
* @param params { processInstId: string }
|
||||||
|
*/
|
||||||
|
export const deleteSingleProcess = (params) => {
|
||||||
|
return defHttp.post({ url: Api.deleteSingleProcess, params }, { joinParamsToUrl: true, isTransformResponse: false });
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 【用于评论功能】自定义文件上传-方法
|
* 【用于评论功能】自定义文件上传-方法
|
||||||
|
|||||||
@@ -8,6 +8,16 @@
|
|||||||
</BasicTable>
|
</BasicTable>
|
||||||
</div>
|
</div>
|
||||||
<BpmPictureModal @register="registerBpmModal" />
|
<BpmPictureModal @register="registerBpmModal" />
|
||||||
|
<j-modal
|
||||||
|
title="审批历史"
|
||||||
|
:width="approvalHistoryModalWidth"
|
||||||
|
:visible="approvalHistoryVisible"
|
||||||
|
:footer="null"
|
||||||
|
@cancel="handleApprovalHistoryCancel"
|
||||||
|
cancelText="关闭"
|
||||||
|
>
|
||||||
|
<TaskApprovalHistoryContent ref="approvalHistoryRef" :form-data="approvalHistoryFormData" />
|
||||||
|
</j-modal>
|
||||||
</j-modal>
|
</j-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -17,14 +27,14 @@
|
|||||||
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
|
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
|
||||||
import { useModal } from '/@/components/Modal';
|
import { useModal } from '/@/components/Modal';
|
||||||
import { columns } from './QueryProcessList.data';
|
import { columns } from './QueryProcessList.data';
|
||||||
import { queryByBusinessId } from '/@/api/common/api';
|
import { deleteSingleProcess, queryByBusinessId } from '/@/api/common/api';
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
import TaskApprovalHistoryContent from '/@/views/super/bpm/process/personalOffice/myHandleTask/content/TaskApprovalHistoryContent.vue';
|
||||||
|
|
||||||
interface OpenParams {
|
interface OpenParams {
|
||||||
businessId?: string;
|
businessId?: string;
|
||||||
title?: string;
|
title?: string;
|
||||||
columns?: BasicColumn[];
|
columns?: BasicColumn[];
|
||||||
onDeleteProcess?: (record: Recordable, reload: () => Promise<void>) => Promise<void>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const title = ref('流程列表');
|
const title = ref('流程列表');
|
||||||
@@ -32,12 +42,15 @@
|
|||||||
const currentBusinessId = ref('');
|
const currentBusinessId = ref('');
|
||||||
const defaultColumns = columns;
|
const defaultColumns = columns;
|
||||||
const modalWidth = 'min(1280px, calc(100vw - 64px))';
|
const modalWidth = 'min(1280px, calc(100vw - 64px))';
|
||||||
|
const approvalHistoryModalWidth = 'min(1100px, calc(100vw - 96px))';
|
||||||
// 按当前列宽合计收敛横向滚动距离,避免少量列被默认宽度撑得过大。
|
// 按当前列宽合计收敛横向滚动距离,避免少量列被默认宽度撑得过大。
|
||||||
const tableScrollX = 1680;
|
const tableScrollX = 1680;
|
||||||
// 固定表体高度,让横向滚动条停留在弹窗底部,而不是跟随少量数据行出现在中间。
|
// 固定表体高度,让横向滚动条停留在弹窗底部,而不是跟随少量数据行出现在中间。
|
||||||
const tableBodyHeight = 500;
|
const tableBodyHeight = 500;
|
||||||
const { createMessage } = useMessage();
|
const { createMessage } = useMessage();
|
||||||
const onDeleteProcessRef = ref<OpenParams['onDeleteProcess']>();
|
const approvalHistoryVisible = ref(false);
|
||||||
|
const approvalHistoryFormData = ref<Recordable>({});
|
||||||
|
const approvalHistoryRef = ref();
|
||||||
const [registerBpmModal, { openModal: bpmPicModal }] = useModal();
|
const [registerBpmModal, { openModal: bpmPicModal }] = useModal();
|
||||||
|
|
||||||
const [registerTable, { setColumns, setTableData, setLoading, clearSelectedRowKeys }] = useTable({
|
const [registerTable, { setColumns, setTableData, setLoading, clearSelectedRowKeys }] = useTable({
|
||||||
@@ -51,7 +64,7 @@
|
|||||||
actionColumn: {
|
actionColumn: {
|
||||||
title: '操作',
|
title: '操作',
|
||||||
dataIndex: 'action',
|
dataIndex: 'action',
|
||||||
width: 120,
|
width: 240,
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
slots: { customRender: 'action' },
|
slots: { customRender: 'action' },
|
||||||
},
|
},
|
||||||
@@ -86,7 +99,6 @@
|
|||||||
async function open(params: OpenParams = {}) {
|
async function open(params: OpenParams = {}) {
|
||||||
currentBusinessId.value = params.businessId || '';
|
currentBusinessId.value = params.businessId || '';
|
||||||
title.value = params.title || '流程列表';
|
title.value = params.title || '流程列表';
|
||||||
onDeleteProcessRef.value = params.onDeleteProcess;
|
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
await nextTick();
|
await nextTick();
|
||||||
setColumns(params.columns?.length ? params.columns : defaultColumns);
|
setColumns(params.columns?.length ? params.columns : defaultColumns);
|
||||||
@@ -96,9 +108,9 @@
|
|||||||
function handleCancel() {
|
function handleCancel() {
|
||||||
visible.value = false;
|
visible.value = false;
|
||||||
currentBusinessId.value = '';
|
currentBusinessId.value = '';
|
||||||
onDeleteProcessRef.value = undefined;
|
|
||||||
setColumns(defaultColumns);
|
setColumns(defaultColumns);
|
||||||
setTableData([]);
|
setTableData([]);
|
||||||
|
handleApprovalHistoryCancel();
|
||||||
clearSelectedRowKeys();
|
clearSelectedRowKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,34 +121,66 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function handlePreviewApprovalHistory(record) {
|
||||||
|
const processInstId = record?.processInstId;
|
||||||
|
if (!processInstId) {
|
||||||
|
createMessage.error('流程实例ID不能为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
approvalHistoryFormData.value = {
|
||||||
|
procInstId: processInstId,
|
||||||
|
processInstId,
|
||||||
|
};
|
||||||
|
approvalHistoryVisible.value = true;
|
||||||
|
await nextTick();
|
||||||
|
approvalHistoryRef.value?.reload?.();
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleApprovalHistoryCancel() {
|
||||||
|
approvalHistoryVisible.value = false;
|
||||||
|
approvalHistoryFormData.value = {};
|
||||||
|
}
|
||||||
|
|
||||||
async function handleDeleteProcess(record) {
|
async function handleDeleteProcess(record) {
|
||||||
if (typeof onDeleteProcessRef.value === 'function') {
|
const processInstId = record?.processInstId;
|
||||||
await onDeleteProcessRef.value(record, loadData);
|
if (!processInstId) {
|
||||||
|
createMessage.error('流程实例ID不能为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const res = await deleteSingleProcess({ processInstId });
|
||||||
|
if (res?.success) {
|
||||||
|
createMessage.success(res.message || '删除流程成功');
|
||||||
|
await loadData();
|
||||||
} else {
|
} else {
|
||||||
createMessage.warning('未配置删除流程回调');
|
createMessage.error(res?.message || '删除流程失败');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
createMessage.error('删除流程失败');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTableAction(record) {
|
function getTableAction(record) {
|
||||||
const actions: any[] = [
|
return [
|
||||||
{
|
{
|
||||||
label: '审批历史',
|
label: '流程图',
|
||||||
onClick: handlePreviewPic.bind(null, record),
|
onClick: handlePreviewPic.bind(null, record),
|
||||||
},
|
},
|
||||||
];
|
{
|
||||||
|
label: '审批历史',
|
||||||
if (typeof onDeleteProcessRef.value === 'function') {
|
onClick: handlePreviewApprovalHistory.bind(null, record),
|
||||||
actions.push({
|
},
|
||||||
|
{
|
||||||
label: '删除流程',
|
label: '删除流程',
|
||||||
popConfirm: {
|
popConfirm: {
|
||||||
title: '确定删除该流程吗?',
|
title: '确定删除该流程吗?',
|
||||||
confirm: handleDeleteProcess.bind(null, record),
|
confirm: handleDeleteProcess.bind(null, record),
|
||||||
placement: 'topLeft',
|
placement: 'topLeft',
|
||||||
},
|
},
|
||||||
});
|
},
|
||||||
}
|
];
|
||||||
|
|
||||||
return actions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { defHttp } from "/@/utils/http/axios";
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
import { useMessage } from "/@/hooks/web/useMessage";
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
|
||||||
const { createConfirm } = useMessage();
|
const { createConfirm } = useMessage();
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ export const deleteBgXiSpeak = (params,handleSuccess) => {
|
|||||||
return defHttp.delete({ url: Api.deleteBgXiSpeak, params }, { joinParamsToUrl: true }).then(() => {
|
return defHttp.delete({ url: Api.deleteBgXiSpeak, params }, { joinParamsToUrl: true }).then(() => {
|
||||||
handleSuccess();
|
handleSuccess();
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除
|
* 批量删除
|
||||||
@@ -63,9 +63,9 @@ export const batchDeleteBgXiSpeak = (params, handleSuccess) => {
|
|||||||
return defHttp.delete({ url: Api.deleteBgXiSpeak, data: params }, { joinParamsToUrl: true }).then(() => {
|
return defHttp.delete({ url: Api.deleteBgXiSpeak, data: params }, { joinParamsToUrl: true }).then(() => {
|
||||||
handleSuccess();
|
handleSuccess();
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存或者更新
|
* 保存或者更新
|
||||||
@@ -73,9 +73,9 @@ export const batchDeleteBgXiSpeak = (params, handleSuccess) => {
|
|||||||
* @param isUpdate
|
* @param isUpdate
|
||||||
*/
|
*/
|
||||||
export const saveOrUpdateDict = (params, isUpdate) => {
|
export const saveOrUpdateDict = (params, isUpdate) => {
|
||||||
let url = isUpdate ? Api.edit : Api.save;
|
const url = isUpdate ? Api.edit : Api.save;
|
||||||
return defHttp.post({ url: url, params }, { isTransformResponse: false });
|
return defHttp.post({ url: url, params }, { isTransformResponse: false });
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询全部树形节点数据
|
* 查询全部树形节点数据
|
||||||
@@ -153,7 +153,7 @@ export const bgXiSpeakFeedbackDeleteBatch = (params, handleSuccess) => {
|
|||||||
* @param isUpdate
|
* @param isUpdate
|
||||||
*/
|
*/
|
||||||
export const bgXiSpeakFeedbackSaveOrUpdate = (params, isUpdate) => {
|
export const bgXiSpeakFeedbackSaveOrUpdate = (params, isUpdate) => {
|
||||||
let url = isUpdate ? '/bg/xispeak/bgXiSpeak/editBgXiSpeakFeedback' : '/bg/xispeak/bgXiSpeak/addBgXiSpeakFeedback';
|
const url = isUpdate ? '/bg/xispeak/bgXiSpeak/editBgXiSpeakFeedback' : '/bg/xispeak/bgXiSpeak/addBgXiSpeakFeedback';
|
||||||
return defHttp.post({ url: url, params }, { isTransformResponse: false });
|
return defHttp.post({ url: url, params }, { isTransformResponse: false });
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -185,10 +185,6 @@ export const withDrawXiSpeak = (params) => {
|
|||||||
return defHttp.post({ url: '/bg/xispeak/bgXiSpeak/withDrawXiSpeak', params }, { joinParamsToUrl: true, isTransformResponse: false });
|
return defHttp.post({ url: '/bg/xispeak/bgXiSpeak/withDrawXiSpeak', params }, { joinParamsToUrl: true, isTransformResponse: false });
|
||||||
};
|
};
|
||||||
|
|
||||||
export const deleteSingleProcess = (params) => {
|
|
||||||
return defHttp.post({ url: '/tasktask/taskTask/deleteSingleProcess', params }, { joinParamsToUrl: true, isTransformResponse: false });
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量查询反馈统计数量(每个 xispeak 下的 feedback 总条数和已闭环数)
|
* 批量查询反馈统计数量(每个 xispeak 下的 feedback 总条数和已闭环数)
|
||||||
* @param params { ids: "id1,id2,id3" }
|
* @param params { ids: "id1,id2,id3" }
|
||||||
|
|||||||
@@ -83,7 +83,6 @@
|
|||||||
updateLaunchType,
|
updateLaunchType,
|
||||||
saveOrUpdateDict,
|
saveOrUpdateDict,
|
||||||
withDrawXiSpeak,
|
withDrawXiSpeak,
|
||||||
deleteSingleProcess,
|
|
||||||
getRootListWithDept,
|
getRootListWithDept,
|
||||||
bgXiSpeakFeedbackList,
|
bgXiSpeakFeedbackList,
|
||||||
} from './BgXiSpeak.api';
|
} from './BgXiSpeak.api';
|
||||||
@@ -137,8 +136,11 @@
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource, setTableData }, { rowSelection, selectedRowKeys }] =
|
const [
|
||||||
tableContext;
|
registerTable,
|
||||||
|
{ reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource, setTableData },
|
||||||
|
{ rowSelection, selectedRowKeys },
|
||||||
|
] = tableContext;
|
||||||
const mainId = computed(() => (unref(selectedRowKeys).length > 0 ? unref(selectedRowKeys)[0] : ''));
|
const mainId = computed(() => (unref(selectedRowKeys).length > 0 ? unref(selectedRowKeys)[0] : ''));
|
||||||
provide('mainId', mainId);
|
provide('mainId', mainId);
|
||||||
|
|
||||||
@@ -593,20 +595,9 @@
|
|||||||
title: '流程列表',
|
title: '流程列表',
|
||||||
businessId: record.id,
|
businessId: record.id,
|
||||||
columns: '',
|
columns: '',
|
||||||
onDeleteProcess: handleDeleteProcess,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleDeleteProcess(processRecord, reload) {
|
|
||||||
const res = await deleteSingleProcess({ processInstId: processRecord.processInstId });
|
|
||||||
if (res.success) {
|
|
||||||
createMessage.success(res.message || '删除流程成功');
|
|
||||||
await reload();
|
|
||||||
} else {
|
|
||||||
createMessage.error(res.message || '删除流程失败');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleFlowScheduleConfirm({ payload, options }) {
|
async function handleFlowScheduleConfirm({ payload, options }) {
|
||||||
const record = payload?.record || {};
|
const record = payload?.record || {};
|
||||||
const flowCode = payload?.flowCode || FLOW_CODE;
|
const flowCode = payload?.flowCode || FLOW_CODE;
|
||||||
|
|||||||
Reference in New Issue
Block a user