yxk-20260507-发起督办时,选择督办部门,默认是责任部门
This commit is contained in:
@@ -15,6 +15,18 @@
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item v-if="deptOptions.length" label="被督办部门">
|
||||
<a-select
|
||||
v-model:value="formData.deptIds"
|
||||
mode="multiple"
|
||||
:options="deptOptions"
|
||||
placeholder="请选择被督办部门"
|
||||
allow-clear
|
||||
style="width: 100%"
|
||||
:getPopupContainer="(node) => node?.parentNode"
|
||||
/>
|
||||
</a-form-item>
|
||||
|
||||
<template v-if="formData.triggerMode === 'recurring'">
|
||||
<a-form-item label="重复周期">
|
||||
<JDictSelectTag
|
||||
@@ -64,6 +76,12 @@
|
||||
interface ModalPayload {
|
||||
title?: string;
|
||||
payload?: Record<string, any>;
|
||||
deptOptions?: DeptOption[];
|
||||
}
|
||||
|
||||
interface DeptOption {
|
||||
label: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
const emit = defineEmits(['confirm']);
|
||||
@@ -72,11 +90,13 @@
|
||||
const title = ref('发起流程');
|
||||
const visible = ref(false);
|
||||
const contextData = ref<Record<string, any>>({});
|
||||
const deptOptions = ref<DeptOption[]>([]);
|
||||
const formData = reactive({
|
||||
triggerMode: 'immediate',
|
||||
intervalType: undefined as number | string | undefined,
|
||||
startCount: undefined as number | undefined,
|
||||
intervalStartTime: undefined as string | undefined,
|
||||
deptIds: [] as string[],
|
||||
});
|
||||
|
||||
function resetForm() {
|
||||
@@ -84,12 +104,31 @@
|
||||
formData.intervalType = undefined;
|
||||
formData.startCount = undefined;
|
||||
formData.intervalStartTime = undefined;
|
||||
formData.deptIds = [];
|
||||
deptOptions.value = [];
|
||||
}
|
||||
|
||||
function normalizeDeptOptions(options: DeptOption[] = []) {
|
||||
const optionMap = new Map<string, DeptOption>();
|
||||
options.forEach((item) => {
|
||||
const value = String(item?.value || '').trim();
|
||||
if (!value || optionMap.has(value)) {
|
||||
return;
|
||||
}
|
||||
optionMap.set(value, {
|
||||
value,
|
||||
label: item?.label || value,
|
||||
});
|
||||
});
|
||||
return Array.from(optionMap.values());
|
||||
}
|
||||
|
||||
function open(data: ModalPayload = {}) {
|
||||
resetForm();
|
||||
title.value = data.title || '发起流程';
|
||||
contextData.value = data.payload || {};
|
||||
deptOptions.value = normalizeDeptOptions(data.deptOptions || []);
|
||||
formData.deptIds = deptOptions.value.map((item) => item.value);
|
||||
visible.value = true;
|
||||
}
|
||||
|
||||
@@ -112,6 +151,10 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (deptOptions.value.length && !formData.deptIds.length) {
|
||||
createMessage.warning('请选择责任部门');
|
||||
return;
|
||||
}
|
||||
|
||||
emit('confirm', {
|
||||
payload: contextData.value,
|
||||
@@ -120,6 +163,8 @@
|
||||
intervalType: formData.triggerMode === 'recurring' ? Number(formData.intervalType) : undefined,
|
||||
startCount: formData.triggerMode === 'recurring' ? Number(formData.startCount) : undefined,
|
||||
intervalStartTime: formData.triggerMode === 'recurring' ? formData.intervalStartTime : undefined,
|
||||
deptId: formData.deptIds.join(','),
|
||||
deptIds: [...formData.deptIds],
|
||||
},
|
||||
});
|
||||
handleCancel();
|
||||
|
||||
@@ -84,6 +84,11 @@
|
||||
const businessProcessListModalRef = ref();
|
||||
const queryParam = reactive<any>({});
|
||||
const processColumns = taskTaskColumns;
|
||||
|
||||
interface DeptOption {
|
||||
label: string;
|
||||
value: string;
|
||||
}
|
||||
//注册table数据
|
||||
const { tableContext, onExportXls, onImportXls } = useListPage({
|
||||
tableProps:{
|
||||
@@ -236,9 +241,29 @@
|
||||
flowScheduleModalRef.value?.open({
|
||||
title: '发起流程',
|
||||
payload: { record },
|
||||
deptOptions: getResponsibleDeptOptions(record),
|
||||
});
|
||||
}
|
||||
|
||||
function splitDeptValue(value) {
|
||||
if (Array.isArray(value)) {
|
||||
return value.map((item) => String(item || '').trim()).filter(Boolean);
|
||||
}
|
||||
return String(value || '')
|
||||
.split(/[,\uFF0C]/)
|
||||
.map((item) => item.trim())
|
||||
.filter(Boolean);
|
||||
}
|
||||
|
||||
function getResponsibleDeptOptions(record): DeptOption[] {
|
||||
const deptIds = splitDeptValue(record?.responDeptid);
|
||||
const deptNames = splitDeptValue(record?.responDeptid_dictText || record?.responDeptname);
|
||||
return deptIds.map((deptId, index) => ({
|
||||
value: deptId,
|
||||
label: deptNames[index] || deptId,
|
||||
}));
|
||||
}
|
||||
|
||||
function handleQueryProcess(record) {
|
||||
businessProcessListModalRef.value?.open({
|
||||
title: '流程列表',
|
||||
@@ -272,7 +297,7 @@
|
||||
title: record.title,
|
||||
content: record.content,
|
||||
urgencyLevel: record.urgencyLevel,
|
||||
deptId: record.responDeptid,
|
||||
deptId: options.deptId || record.responDeptid,
|
||||
deptLeaderId: record.responDeptid,
|
||||
requireFinishDate: formatDate(record.deadline, 'YYYY-MM-DD'),
|
||||
deadline: formatDate(record.deadline, 'YYYY-MM-DD HH:mm:ss'),
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
>
|
||||
<a-tabs v-model="activeKey" tabPosition="left">
|
||||
<a-tab-pane key="1">
|
||||
<template #tab> <file-text-outlined /><span>附加单据</span> </template>
|
||||
<template #tab> <file-text-outlined /><span>任务处理</span> </template>
|
||||
<BpmDynamicForm
|
||||
:path="taskFormUrl"
|
||||
:form-data="taskFormData"
|
||||
|
||||
Reference in New Issue
Block a user