| | |
| | | :data="seletedSceneList" |
| | | :dayTask="dayTask" |
| | | @delete="deleteScene" |
| | | @submit="createSubtasks" |
| | | ></CompSubTaskSelect> |
| | | <div> |
| | | <!-- <el-scrollbar height="50vh"> --> |
| | |
| | | </div> |
| | | </el-col> |
| | | <el-col :span="8"> |
| | | <el-row justify="space-between"> |
| | | <el-text>单日计划</el-text> |
| | | <el-button type="success" size="small" @click="editTask" |
| | | >新增</el-button |
| | | > |
| | | </el-row> |
| | | <el-divider /> |
| | | <div> |
| | | <el-scrollbar :height="height"> |
| | | <ItemSubTask |
| | | v-for="stask in curSubTaskList" |
| | | :key="stask.guid" |
| | | :item="stask" |
| | | > |
| | | <template #default="{ item }"> |
| | | <el-button type="danger" size="small" @click="editTask" |
| | | >移除</el-button |
| | | > |
| | | </template> |
| | | </ItemSubTask> |
| | | </el-scrollbar> |
| | | </div> |
| | | <CompSubTaskList |
| | | v-model="curSubTaskList" |
| | | :height="height" |
| | | @submit="deleteSubtasks" |
| | | ></CompSubTaskList> |
| | | </el-col> |
| | | </el-row> |
| | | </template> |
| | |
| | | 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'; |
| | | |
| | | import CompMonitorObj from './CompMonitorObj.vue'; |
| | | import CompSubTaskSelect from './CompSubTaskSelect.vue'; |
| | | import CompSubTaskList from './CompSubTaskList.vue'; |
| | | import dayjs from 'dayjs'; |
| | | |
| | | const route = useRoute(); |
| | | |
| | |
| | | dayTask: Object, |
| | | mObjList: Array |
| | | }); |
| | | |
| | | const emit = defineEmits(['submit']) |
| | | |
| | | /*************************** 数据初始化 ************************************/ |
| | | // 巡查子任务集合 |
| | |
| | | const index = seletedSceneList.value.indexOf(item); |
| | | seletedSceneList.value.splice(index, 1); |
| | | } |
| | | |
| | | function createSubtasks(executors) { |
| | | const dt = props.dayTask; |
| | | const subtasks = seletedSceneList.value.map((_) => { |
| | | const s = _.scene; |
| | | return { |
| | | // 主键由服务端创建 |
| | | stguid: undefined, |
| | | tguid: dt.tsGuid, |
| | | tsguid: dt.guid, |
| | | name: `${s.name}巡查`, |
| | | typeno: 1, |
| | | type: '巡查', |
| | | provincecode: s.provincecode, |
| | | provincename: s.provincename, |
| | | citycode: s.citycode, |
| | | cityname: s.cityname, |
| | | districtcode: s.districtcode, |
| | | districtname: s.districtname, |
| | | scensename: s.name, |
| | | scenseid: s.guid, |
| | | scenseaddress: s.location, |
| | | planstarttime: dt.date, |
| | | planendtime: dayjs(dt.date).endOf('day').set('millisecond', 0).toDate(), |
| | | deployerguid: 'rAR0A4gJdlOZEqZs', |
| | | deployerusername: 'ccheck', |
| | | deployerrealname: '整改审核', |
| | | executorguids: executors.ids, |
| | | executorusernames: executors.uName, |
| | | executorrealtimes: executors.rName, |
| | | status: '未执行', |
| | | remark: undefined |
| | | }; |
| | | }); |
| | | |
| | | // 更新场景监管次数 |
| | | 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> |