| | |
| | | collapse-tags |
| | | placeholder="选择执行人" |
| | | :max-collapse-tags="1" |
| | | style="width: 240px" |
| | | style="width: 150px" |
| | | > |
| | | <template #header> |
| | | <el-checkbox |
| | |
| | | </FYForm> |
| | | </el-row> |
| | | <div> |
| | | <el-scrollbar :height="scrollHeight" v-if="data.length > 0"> |
| | | <el-space wrap> |
| | | <ItemMonitorObj v-for="obj in data" :key="obj.movid" :item="obj"> |
| | | <el-scrollbar :height="height" v-if="modelValue.length > 0"> |
| | | <el-space wrap :direction="direction"> |
| | | <ItemMonitorObj |
| | | v-for="obj in modelValue" |
| | | :key="obj.movid" |
| | | :item="obj" |
| | | > |
| | | <template #default="{ item }"> |
| | | <el-button |
| | | size="small" |
| | |
| | | /** |
| | | * 巡查子任务创建 |
| | | */ |
| | | 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({ |
| | | // 子任务集合 |
| | | data: { |
| | | modelValue: { |
| | | type: Array, |
| | | default: () => [] |
| | | }, |
| | | height: String, |
| | | height: { |
| | | type: String, |
| | | default: '14vh' |
| | | }, |
| | | direction: { |
| | | type: String, |
| | | default: 'horizontal' |
| | | }, |
| | | // 日任务 |
| | | dayTask: Object |
| | | }); |
| | | |
| | | const emit = defineEmits(['delete']); |
| | | const emit = defineEmits(['submit', 'delete', 'update:modelValue']); |
| | | |
| | | const scrollHeight = ref('14vh'); |
| | | const data = computed(() => props.modelValue); |
| | | |
| | | // 移除任务场景 |
| | | function deleteScene(item) { |
| | | item.select = false; |
| | | const index = data.value.indexOf(item); |
| | | if (index > -1) { |
| | | data.value.splice(index, 1); |
| | | emit('update:modelValue', data.value); |
| | | } |
| | | emit('delete', item); |
| | | } |
| | | |
| | |
| | | ] |
| | | }); |
| | | function submit(v, success, fail) { |
| | | if (props.data.length == 0) { |
| | | // ElMessage({ |
| | | // message: '未选择监管场景', |
| | | // type: 'warning' |
| | | // }); |
| | | if (props.modelValue.length == 0) { |
| | | fail('未选择监管场景'); |
| | | } else if (v.value.executor.length == 0) { |
| | | fail('未选择执行人'); |
| | | } else { |
| | | success(); |
| | | // 将任务执行人格式化并传递 |
| | | const param = TaskProxy.getExecutors(v.value.executor, executors.value); |
| | | TaskProxy.createSubtasks(props.dayTask, props.modelValue, param).then( |
| | | () => { |
| | | formInfo.value.executor = []; |
| | | emit('update:modelValue', []); |
| | | emit('submit'); |
| | | } |
| | | ); |
| | | } |
| | | } |
| | | |
| | | /************************* 任务执行人下拉选框 *******************************/ |
| | | // 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; |
| | | formInfo.value.executor = []; |
| | | } |
| | | // 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; |
| | | // 根据日任务,获取对应的总任务信息,再获取执行人员信息 |
| | | taskApi.fetchTaskById(nV.tsGuid).then((res) => { |
| | | getExecutors(res); |
| | | }); |
| | | } |
| | | }, |
| | | { immediate: true } |
| | | ); |
| | | // |
| | | |
| | | watch( |
| | | () => formInfo.value.executor, |
| | | (val) => { |