| | |
| | | <CompSubTaskList |
| | | v-model="curSubTaskList" |
| | | :height="height" |
| | | @submit="deleteSubtasks" |
| | | ></CompSubTaskList> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | import { ref, watch, onMounted } from 'vue'; |
| | | import { useCloned } from '@vueuse/core'; |
| | | import { useRoute, useRouter } from 'vue-router'; |
| | | import { ElMessage, ElNotification, ElMessageBox } from 'element-plus'; |
| | | import taskApi from '@/api/fysp/taskApi'; |
| | | import subtaskApi from '@/api/fysp/subtaskApi'; |
| | | import TaskProxy from '../TaskProxy'; |
| | |
| | | dayTask: Object, |
| | | mObjList: Array |
| | | }); |
| | | |
| | | const emit = defineEmits(['submit']) |
| | | |
| | | /*************************** 数据初始化 ************************************/ |
| | | // 巡查子任务集合 |
| | |
| | | function createSubtasks(executors) { |
| | | const dt = props.dayTask; |
| | | const subtasks = seletedSceneList.value.map((_) => { |
| | | const s = _.scene |
| | | const s = _.scene; |
| | | return { |
| | | // 主键由服务端创建 |
| | | stguid: undefined, |
| | |
| | | remark: undefined |
| | | }; |
| | | }); |
| | | subtaskApi.putSubtasks(subtasks) |
| | | |
| | | // 更新场景监管次数 |
| | | seletedSceneList.value.forEach((s) => { |
| | | s.extension1 = s.extension1 ? parseInt(s.extension1) + 1 + '' : '1'; |
| | | }); |
| | | taskApi.updateMonitorObject(seletedSceneList.value).then((res) => { |
| | | if (res > 0) { |
| | | subtaskApi.putSubtasks(subtasks).then((res) => { |
| | | seletedSceneList.value = []; |
| | | fetchSubTask(props.dayTask.guid); |
| | | ElMessage({ |
| | | message: '巡查任务添加成功', |
| | | type: 'success' |
| | | }); |
| | | emit('submit') |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | function deleteSubtasks() { |
| | | emit('submit') |
| | | } |
| | | </script> |
| | | <style scoped></style> |