| | |
| | | /** |
| | | * 巡查子任务创建 |
| | | */ |
| | | 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({ |
| | | // 子任务集合 |
| | |
| | | } 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); |
| | |
| | | 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) => { |