From 3d6addd2c0817b30bd328605cb048ca9698742a6 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期五, 28 二月 2025 16:50:17 +0800 Subject: [PATCH] 修复新建子任务时,未提前建立日任务的bug --- src/views/fysp/task/components/CompSubTaskSelect.vue | 66 +++++++++++++++++++-------------- 1 files changed, 38 insertions(+), 28 deletions(-) diff --git a/src/views/fysp/task/components/CompSubTaskSelect.vue b/src/views/fysp/task/components/CompSubTaskSelect.vue index 53a4e03..738df23 100644 --- a/src/views/fysp/task/components/CompSubTaskSelect.vue +++ b/src/views/fysp/task/components/CompSubTaskSelect.vue @@ -70,16 +70,12 @@ /** * 宸℃煡瀛愪换鍔″垱寤� */ -import { ref, reactive, watch, computed, onMounted } from 'vue'; +import { ref, reactive, watch, computed, onMounted, inject } from 'vue'; import { ElMessageBox, ElNotification, ElMessage } from 'element-plus'; import taskApi from '@/api/fysp/taskApi'; import TaskProxy from '../TaskProxy'; -onMounted(() => { - // if (props.height) { - // scrollHeight.value = - // } -}); +// const topTask = inject('topTask'); const props = defineProps({ // 瀛愪换鍔¢泦鍚� @@ -122,12 +118,16 @@ } else { success(); // 灏嗕换鍔℃墽琛屼汉鏍煎紡鍖栧苟浼犻�� - const param = TaskProxy.getExecutors(v.value.executor, executors.value) - emit('submit', param) + const param = TaskProxy.getExecutors(v.value.executor, executors.value); + emit('submit', param); } } /************************* 浠诲姟鎵ц浜轰笅鎷夐�夋 *******************************/ +// onMounted(() => { +// getExecutors(topTask.value); +// }); + const executors = ref([]); // 鏄惁鍏ㄩ�� const checkAll = ref(false); @@ -142,36 +142,46 @@ formInfo.value.executor = []; } } + +function getExecutors(t) { + const ids = t.executorguids.split('#'); + const userNames = t.executorusernames.split('#'); + const realNames = t.executorrealnames.split('#'); + const list = []; + ids.forEach((e, i) => { + if (i < userNames.length && i < realNames.length) { + list.push({ + label: realNames[i], + value: e, + data: { + id: e, + userName: userNames[i], + realName: realNames[i] + } + }); + } + }); + + executors.value = list; +} +// watch(topTask, (nV, oV) => { +// if (nV != oV) { +// getExecutors(nV); +// } +// }); + watch( () => props.dayTask, (nV, oV) => { if (nV != oV) { taskApi.fetchTaskById(nV.guid).then((res) => { - const ids = res.executorguids.split('#'); - const userNames = res.executorusernames.split('#'); - const realNames = res.executorrealnames.split('#'); - const list = []; - ids.forEach((e, i) => { - if (i < userNames.length && i < realNames.length) { - list.push({ - label: realNames[i], - value: e, - data: { - id: e, - userName: userNames[i], - realName: realNames[i] - } - }); - } - }); - - executors.value = list; + getExecutors(res); }); } }, { immediate: true } ); -// + watch( () => formInfo.value.executor, (val) => { -- Gitblit v1.9.3