|
@@ -188,7 +188,7 @@
|
|
|
<el-cascader
|
|
<el-cascader
|
|
|
v-model="issueForm.rectificationDepartmentId"
|
|
v-model="issueForm.rectificationDepartmentId"
|
|
|
:options="issueDeptTree"
|
|
:options="issueDeptTree"
|
|
|
- :props="cascaderDeptProp"
|
|
|
|
|
|
|
+ :props="cascaderDeptMultipleProp"
|
|
|
:show-all-levels="false"
|
|
:show-all-levels="false"
|
|
|
placeholder="请选择整改责任部门"
|
|
placeholder="请选择整改责任部门"
|
|
|
filterable
|
|
filterable
|
|
@@ -458,7 +458,8 @@
|
|
|
const issueDangerId = ref<number>(0);
|
|
const issueDangerId = ref<number>(0);
|
|
|
const issueFormRef = ref();
|
|
const issueFormRef = ref();
|
|
|
const issueForm = ref({
|
|
const issueForm = ref({
|
|
|
- rectificationDepartmentId: undefined as number | undefined,
|
|
|
|
|
|
|
+ /** 多选部门 id 数组,提交时拼为 rectification_department_ids */
|
|
|
|
|
+ rectificationDepartmentId: [] as number[],
|
|
|
rectificationResponsibleUserId: undefined as number | undefined,
|
|
rectificationResponsibleUserId: undefined as number | undefined,
|
|
|
rectificationResponsiblePersonName: '' as string,
|
|
rectificationResponsiblePersonName: '' as string,
|
|
|
});
|
|
});
|
|
@@ -474,6 +475,14 @@
|
|
|
label: 'deptName',
|
|
label: 'deptName',
|
|
|
emitPath: false,
|
|
emitPath: false,
|
|
|
};
|
|
};
|
|
|
|
|
+ const cascaderDeptMultipleProp = {
|
|
|
|
|
+ checkStrictly: true,
|
|
|
|
|
+ expandTrigger: 'hover' as const,
|
|
|
|
|
+ value: 'id',
|
|
|
|
|
+ label: 'deptName',
|
|
|
|
|
+ emitPath: false,
|
|
|
|
|
+ multiple:true
|
|
|
|
|
+ };
|
|
|
const issueDeptTree = ref<DeptTree[]>([]);
|
|
const issueDeptTree = ref<DeptTree[]>([]);
|
|
|
const issueUserList = ref<Array<{ id: number; realname?: string; username?: string }>>([]);
|
|
const issueUserList = ref<Array<{ id: number; realname?: string; username?: string }>>([]);
|
|
|
|
|
|
|
@@ -512,10 +521,15 @@
|
|
|
return '';
|
|
return '';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /** 多选部门名称,与 rectification_department_ids 顺序一致,逗号拼接 */
|
|
|
|
|
+ function findDeptNamesByIds(nodes: DeptTree[] | undefined, ids: number[]): string {
|
|
|
|
|
+ return ids.map((id) => findDeptNameById(nodes, id)).filter(Boolean).join(',');
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
const handleOpenIssue = (id: number) => {
|
|
const handleOpenIssue = (id: number) => {
|
|
|
issueDangerId.value = id;
|
|
issueDangerId.value = id;
|
|
|
issueForm.value = {
|
|
issueForm.value = {
|
|
|
- rectificationDepartmentId: undefined,
|
|
|
|
|
|
|
+ rectificationDepartmentId: [],
|
|
|
rectificationResponsibleUserId: undefined,
|
|
rectificationResponsibleUserId: undefined,
|
|
|
rectificationResponsiblePersonName: '',
|
|
rectificationResponsiblePersonName: '',
|
|
|
};
|
|
};
|
|
@@ -525,17 +539,18 @@
|
|
|
const handleIssueSave = async () => {
|
|
const handleIssueSave = async () => {
|
|
|
await issueFormRef.value?.validate?.().catch(() => {});
|
|
await issueFormRef.value?.validate?.().catch(() => {});
|
|
|
const { rectificationDepartmentId, rectificationResponsibleUserId } = issueForm.value;
|
|
const { rectificationDepartmentId, rectificationResponsibleUserId } = issueForm.value;
|
|
|
- if (rectificationDepartmentId == null || rectificationResponsibleUserId == null) {
|
|
|
|
|
|
|
+ const deptIds = Array.isArray(rectificationDepartmentId) ? rectificationDepartmentId : [];
|
|
|
|
|
+ if (!deptIds.length || rectificationResponsibleUserId == null) {
|
|
|
ElMessage.warning('请选择整改责任部门和整改负责人');
|
|
ElMessage.warning('请选择整改责任部门和整改负责人');
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
const selectedUser = issueUserList.value.find((u) => u.id === rectificationResponsibleUserId);
|
|
const selectedUser = issueUserList.value.find((u) => u.id === rectificationResponsibleUserId);
|
|
|
const personName = selectedUser?.realname ?? selectedUser?.username ?? '';
|
|
const personName = selectedUser?.realname ?? selectedUser?.username ?? '';
|
|
|
- const deptName = findDeptNameById(issueDeptTree.value, rectificationDepartmentId);
|
|
|
|
|
|
|
+ const deptName = findDeptNamesByIds(issueDeptTree.value, deptIds);
|
|
|
try {
|
|
try {
|
|
|
await issueHiddenDanger({
|
|
await issueHiddenDanger({
|
|
|
danger_id: issueDangerId.value,
|
|
danger_id: issueDangerId.value,
|
|
|
- rectification_department_ids: String(rectificationDepartmentId),
|
|
|
|
|
|
|
+ rectification_department_ids: deptIds.join(','),
|
|
|
rectification_responsible_person: personName,
|
|
rectification_responsible_person: personName,
|
|
|
dept_name: deptName,
|
|
dept_name: deptName,
|
|
|
rectification_responsible_ids: String(rectificationResponsibleUserId),
|
|
rectification_responsible_ids: String(rectificationResponsibleUserId),
|