riku
5 天以前 f19e5267cc23b1c714dc746239864f33ed715dd9
src/views/fysp/task/components/CompSubTaskSelect.vue
@@ -17,7 +17,7 @@
              collapse-tags
              placeholder="选择执行人"
              :max-collapse-tags="1"
              style="width: 240px"
              style="width: 150px"
            >
              <template #header>
                <el-checkbox
@@ -40,9 +40,13 @@
      </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"
@@ -79,21 +83,34 @@
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(['submit', '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);
}
@@ -109,17 +126,21 @@
  ]
});
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);
    emit('submit', param);
    TaskProxy.createSubtasks(props.dayTask, props.modelValue, param).then(
      () => {
        formInfo.value.executor = [];
        emit('update:modelValue', []);
        emit('submit');
      }
    );
  }
}
@@ -163,6 +184,7 @@
  });
  executors.value = list;
  formInfo.value.executor = [];
}
// watch(topTask, (nV, oV) => {
//   if (nV != oV) {
@@ -174,7 +196,8 @@
  () => props.dayTask,
  (nV, oV) => {
    if (nV != oV) {
      taskApi.fetchTaskById(nV.guid).then((res) => {
      // 根据日任务,获取对应的总任务信息,再获取执行人员信息
      taskApi.fetchTaskById(nV.tsGuid).then((res) => {
        getExecutors(res);
      });
    }