riku
2024-11-14 ae234efb788bca2fa77f700442427996fa7f4aca
src/views/fysp/check/ProCheck.vue
@@ -3,7 +3,7 @@
    <template #header>
      <SearchBar @on-submit="search">
        <template #summary>
          <CompSubTaskStatistic :subtasks="subtasks"/>
          <CompSubTaskStatistic :subtasks="subtasks" />
        </template>
      </SearchBar>
    </template>
@@ -27,35 +27,85 @@
        v-loading="mainLoading"
      >
        <CompProblemCard
          v-for="(p, i) in curProList"
          v-if="compProblemCardVisible"
          :key="i"
          :index="i+1"
          v-for="(p, i) in curProList"
          :index="i + 1"
          :problem="p"
          :subtask="curSubtask.data"
          :topTask="topTask"
          @updated="onProSubmited"
          @submit="updateSubtask"
        ></CompProblemCard>
      </el-scrollbar>
      <el-empty v-else description="暂无记录" v-loading="mainLoading" />
    </template>
  </BaseContentLayout>
  <el-dialog
    v-model="proAddOrUpdDialogVisible"
    :before-close="proAddOrUpdDialogClose"
    width="80%"
    title="新增问题"
  >
    <CompProblemAddOrUpd
      v-if="proAddOrUpdDialogVisible"
      :subtask="curSubtask.data"
      :topTask="topTask"
      ref="compProblemAddOrUpdRef"
      @submited="newProSubmit"
    />
  </el-dialog>
  <ArbitraryPhoto
    v-if="anyPhotoDialog"
    v-model:dialog-visible="anyPhotoDialog"
    title="场景图片"
    :readonly="true"
    :subtask="curSubtask.data"
    ref="arbitraryPhotoRef"
  ></ArbitraryPhoto>
  <el-drawer
    direction="ltr"
    v-model="deviceShowDialog"
    :before-close="beforeDeviceShowDialogclose"
    title="设施设备"
    size="45%"
  >
    <CompDeviceShowTest v-if="deviceShowDialog" ref="deviceShowRef">
    </CompDeviceShowTest>
  </el-drawer>
</template>
<script>
import ArbitraryPhoto from './components/ArbitraryPhoto.vue';
import taskApi from '@/api/fysp/taskApi';
import ProCheckProxy from './ProCheckProxy';
import { ElMessageBox, ElNotification, ElMessage } from 'element-plus';
import CompProblemAddOrUpd from './components/CompProblemAddOrUpd.vue';
import CompProblemCard from './components/CompProblemCard.vue';
import CompSubTaskStatistic from './components/CompSubTaskStatistic.vue';
import CompDeviceShowTest from './components/CompDeviceShowTest.vue';
export default {
  components: { CompProblemCard, CompSubTaskStatistic },
  components: {
    CompProblemCard,
    CompSubTaskStatistic,
    CompProblemAddOrUpd,
    ArbitraryPhoto,
    CompDeviceShowTest
  },
  data() {
    return {
      compProblemCardVisible: true,
      // 设备图
      deviceShowDialog: false,
      // 任意图
      anyPhotoDialog: false,
      // 新增问题
      proAddOrUpdDialogVisible: false,
      //左侧菜单栏加载状态
      sideLoading: false,
      //右侧内容栏加载状态
      mainLoading: false,
      // 总任务
      topTask: {},
      //子任务列表
      subtasks: [],
      //当前选中的任务
@@ -67,16 +117,30 @@
        {
          name: '新增问题',
          color: 'success',
          click: () => {
            this.proAddOrUpdDialogVisible = true;
          }
        },
        {
          name: '任意图片',
          name: '场景图片',
          color: 'warning',
          click: () => {
            this.anyPhotoDialog = true;
          }
        },
        {
          name: '批量审核',
          color: 'primary',
          name: '设施设备',
          color: 'info',
          click: () => {
            this.openDeviceShowDialog();
          }
        },
      ],
        // {
        //   name: '批量审核',
        //   color: 'primary',
        //   click: () => {}
        // }
      ]
    };
  },
  computed: {
@@ -90,50 +154,50 @@
        {
          name: '任务总计',
          value: 0,
          type: 'info',
          type: 'info'
        },
        {
          name: '问题未审核',
          value: 0,
          type: 'success',
          icon: 'SuccessFilled',
          icon: 'SuccessFilled'
        },
        {
          name: '问题部分审核',
          value: 0,
          type: 'success',
          icon: 'SuccessFilled',
          icon: 'SuccessFilled'
        },
        {
          name: '问题全部审核',
          value: 0,
          type: 'success',
          icon: 'SuccessFilled',
          icon: 'SuccessFilled'
        },
        {
          name: '未整改',
          value: 0,
          type: 'info',
          icon: 'WarningFilled',
          icon: 'WarningFilled'
        },
        {
          name: '整改未审核',
          value: 0,
          type: 'info',
          icon: 'WarningFilled',
          icon: 'WarningFilled'
        },
        {
          name: '整改部分审核',
          value: 0,
          type: 'warning',
          icon: 'WarningFilled',
          icon: 'WarningFilled'
        },
        {
          name: '整改全部审核',
          value: 0,
          type: 'warning',
          icon: 'WarningFilled',
        },
          icon: 'WarningFilled'
        }
      ];
      this.subtasks.forEach((s) => {
@@ -158,16 +222,43 @@
      });
      return _summary;
    },
    }
  },
  methods: {
    // 打开设备图
    openDeviceShowDialog() {
      this.deviceShowDialog = true;
      this.$nextTick(() => {
        this.$refs.deviceShowRef.init(this.curSubtask.data.scene);
      });
    },
    // 关闭设备图弹窗
    beforeDeviceShowDialogclose(done) {
      // this.deviceShowDialog = false;
      done();
    },
    // 关闭任意图片弹窗
    beforeAnyPhotoDialogclose() {
      this.anyPhotoDialog = false;
    },
    handleCloseCheckAnyPhono() {
      this.beforeAnyPhotoDialogclose();
    },
    proAddOrUpdDialogClose() {
      this.proAddOrUpdDialogVisible = false;
    },
    //查询子任务统计信息
    search(formSearch) {
      this.topTask = formSearch.topTask;
      this.sideLoading = true;
      this.mainLoading = true;
      this.curProList = [];
      this.curSubtask = {};
      taskApi.getSubtaskSummary(formSearch).then((res) => {
      const param = {
        topTaskId: formSearch.topTask.tguid,
        sceneTypeId: formSearch.sceneTypeId
      };
      taskApi.getSubtaskSummary(param).then((res) => {
        const list = [];
        res.forEach((s) => {
          const t = this.getSubtaskType(s);
@@ -175,7 +266,7 @@
            type: t,
            title: s.stName,
            categoly: s.stPlanTime.split('T')[0],
            data: s,
            data: s
          });
        });
        this.subtasks = list;
@@ -201,6 +292,7 @@
    },
    //点击左侧菜单任务事件
    chooseSubtask(s) {
      // this.currInsGuid = s.data.insGuid
      this.sideLoading = false;
      this.mainLoading = true;
      // const controller = new AbortController();
@@ -214,12 +306,46 @@
          this.mainLoading = false;
        });
    },
    // 问题卡片组件主动发起刷新父组件数据
    updateSubtask() {
      this.curSubtask.data.proCheckedNum++;
      this.curSubtask.type = this.getSubtaskType(this.curSubtask.data);
      this.refreshCurrSubtask();
    },
    onProSubmited(isOk) {
      this.proAddOrUpdDialogClose();
      if (!isOk) {
        return;
      }
      this.updateSubtask();
    },
    newProSubmit(isOk) {
      this.proAddOrUpdDialogVisible = false;
      if (!isOk) {
        return;
      }
      this.refreshCurrSubtask();
    },
    // 刷新当前选中子任务
    refreshCurrSubtask() {
      this.compProblemCardVisible = false;
      this.sideLoading = false;
      this.mainLoading = true;
      setTimeout(() => {
        taskApi
          .getProBySubtask(this.curSubtask.data.stGuid)
          .then((res) => {
            this.curProList = res;
            // this.curSubtask = s;
          })
          .finally(() => {
            this.mainLoading = false;
            this.compProblemCardVisible = true;
          });
      }, 150);
    }
  },
  mounted() {},
  mounted() {}
};
</script>