|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <Dialog :hide-title="false" custom-show type="sm" title="任务下达" @confirm="confirmRegister" @close="closeDialog">
|
|
|
+ <Dialog :hide-title="false" custom-show type="sm" height="1670px" title="任务下达" @confirm="confirmRegister" @close="closeDialog" >
|
|
|
<div class="dialog-content">
|
|
|
<div class="dialog-body">
|
|
|
<el-form ref="taskFormRef" :model="form" :rules="rules">
|
|
@@ -32,7 +32,7 @@
|
|
|
filterable
|
|
|
@change="handleUnitChange"
|
|
|
>
|
|
|
- <el-option v-for="unit in filteredUnits" :key="unit.id" :label="unit.unit_name" :value="unit.unit_name" />
|
|
|
+ <el-option v-for="unit in filteredUnits" :key="unit.unit_id" :label="unit.unit_name" :value="unit.unit_name" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="执行人" label-width="200px" prop="executor">
|
|
@@ -45,6 +45,7 @@
|
|
|
:teleported="false"
|
|
|
clearable
|
|
|
filterable
|
|
|
+ @change="handleExecutorChange"
|
|
|
>
|
|
|
<el-option v-for="user in executorList" :key="user.userId" :label="user.nickName" :value="user.nickName" />
|
|
|
</el-select>
|
|
@@ -97,6 +98,7 @@ const initFormData = {
|
|
|
unit_name: '',
|
|
|
registrar: '',
|
|
|
executor: '',
|
|
|
+ executor_id: '',
|
|
|
contact_phone: '',
|
|
|
expire_time: '',
|
|
|
event_code: '',
|
|
@@ -141,8 +143,9 @@ const fetchUser = async () => {
|
|
|
|
|
|
const fetchUnits = async () => {
|
|
|
try {
|
|
|
- const response = await getUserList({});
|
|
|
+ const response = await getUnits({}); // getUserList({});
|
|
|
if (response.code === 200) {
|
|
|
+ /*
|
|
|
const units = new Map();
|
|
|
response.rows.forEach((unit) => {
|
|
|
if (!units.has(unit.deptName)) {
|
|
@@ -153,6 +156,8 @@ const fetchUnits = async () => {
|
|
|
}
|
|
|
});
|
|
|
filteredUnits.value = Array.from(units.values());
|
|
|
+ */
|
|
|
+ filteredUnits.value = response.data;
|
|
|
} else {
|
|
|
console.error('获取单位数据失败:', response.msg);
|
|
|
}
|
|
@@ -177,10 +182,18 @@ const fetchUsers = async (deptId) => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+
|
|
|
const handleUnitChange = async (newUnitName) => {
|
|
|
const selectedUnit = filteredUnits.value.find((unit) => unit.unit_name === newUnitName);
|
|
|
if (selectedUnit) {
|
|
|
- await fetchUsers(selectedUnit.unitId);
|
|
|
+ await fetchUsers(selectedUnit.unit_id);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+const handleExecutorChange = async(newExecutorName) => {
|
|
|
+ const selectedExecutor = executorList.value.find((user) => user.nickName === newExecutorName);
|
|
|
+ if (selectedExecutor) {
|
|
|
+ form.value.executor_id = selectedExecutor.userId;
|
|
|
}
|
|
|
};
|
|
|
|
|
@@ -209,7 +222,7 @@ const confirmRegister = () => {
|
|
|
onMounted(() => {
|
|
|
fetchUser();
|
|
|
fetchUnits();
|
|
|
- fetchUsers();
|
|
|
+ // fetchUsers();
|
|
|
});
|
|
|
</script>
|
|
|
|