riku
2024-10-14 7e1d38f401555ac635c9ce10f63902d9a4c402e0
src/views/fysp/check/ProCheck.vue
@@ -8,11 +8,7 @@
      </SearchBar>
    </template>
    <template #aside>
      <SideList
        :items="subtasks"
        :loading="sideLoading"
        @item-click="chooseSubtask"
      ></SideList>
      <SideList :items="subtasks" :loading="sideLoading" @item-click="chooseSubtask"></SideList>
    </template>
    <template #main>
      <ToolBar
@@ -21,41 +17,99 @@
        :buttons="buttons"
        :loading="mainLoading"
      ></ToolBar>
      <el-scrollbar
        v-if="curProList.length > 0"
        class="el-scrollbar"
        v-loading="mainLoading"
      >
      <el-scrollbar v-if="curProList.length > 0" class="el-scrollbar" v-loading="mainLoading">
        <CompProblemCard
          v-for="(p, i) in curProList"
          v-if="compProblemCardVisible"
          :key="i"
          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>
  <el-dialog
    v-model="anyPhotoDialog"
    :before-close="beforeAnyPhotoDialogclose"
    width="80%"
    title="任意图片"
  >
    <ArbitraryPhoto
      v-if="anyPhotoDialog"
      :readonly="true"
      :subtask="curSubtask.data"
      ref="arbitraryPhotoRef"
      @selectByAnyPhonoEvent="handleCloseCheckAnyPhono"
    >
    </ArbitraryPhoto>
  </el-dialog>
  <el-drawer
    :direction="rtl"
    v-model="deviceShowDialog"
    :before-close="beforeDeviceShowDialogclose"
    title="设施设备"
    size="65%"
  >
    <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 CompDeviceShow from './components/CompDeviceShow.vue';
import CompProblemCard from './components/CompProblemCard.vue';
import CompSubTaskStatistic from './components/CompSubTaskStatistic.vue';
import CompProRecent from './components/CompProRecent.vue';
import CompDeviceShowTest from './components/CompDeviceShowTest.vue';
export default {
  components: { CompProblemCard, CompSubTaskStatistic },
  components: {
    CompProblemCard,
    CompSubTaskStatistic,
    CompProblemAddOrUpd,
    ArbitraryPhoto,
    CompDeviceShowTest,
    CompProRecent
  },
  data() {
    return {
      compProblemCardVisible: true,
      // 设备图
      deviceShowDialog: false,
      // 任意图
      anyPhotoDialog: false,
      // 新增问题
      proAddOrUpdDialogVisible: false,
      //左侧菜单栏加载状态
      sideLoading: false,
      //右侧内容栏加载状态
      mainLoading: false,
      // 总任务
      topTask: {},
      //子任务列表
      subtasks: [],
      //当前选中的任务
@@ -67,16 +121,30 @@
        {
          name: '新增问题',
          color: 'success',
          click: () => {
            this.proAddOrUpdDialogVisible = true;
          }
        },
        {
          name: '任意图片',
          color: 'warning',
          click: () => {
            this.anyPhotoDialog = true;
          }
        },
        {
          name: '设施设备',
          color: 'info',
          click: () => {
            this.openDeviceShowDialog();
          }
        },
        {
          name: '批量审核',
          color: 'primary',
        },
      ],
          click: () => {}
        }
      ]
    };
  },
  computed: {
@@ -90,50 +158,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,11 +226,33 @@
      });
      return _summary;
    },
    }
  },
  methods: {
    // 打开设备图
    openDeviceShowDialog() {
      this.deviceShowDialog = true;
      this.$nextTick(() => {
        this.$refs.deviceShowRef.init(this.curSubtask.data.scene);
      });
    },
    // 关闭设备图弹窗
    beforeDeviceShowDialogclose() {
      this.deviceShowDialog = false;
    },
    // 关闭任意图片弹窗
    beforeAnyPhotoDialogclose() {
      this.anyPhotoDialog = false;
    },
    handleCloseCheckAnyPhono() {
      this.beforeAnyPhotoDialogclose();
    },
    proAddOrUpdDialogClose() {
      this.proAddOrUpdDialogVisible = false;
    },
    //查询子任务统计信息
    search(formSearch) {
      this.topTask = formSearch.obj;
      this.sideLoading = true;
      this.mainLoading = true;
      this.curProList = [];
@@ -175,7 +265,7 @@
            type: t,
            title: s.stName,
            categoly: s.stPlanTime.split('T')[0],
            data: s,
            data: s
          });
        });
        this.subtasks = list;
@@ -201,6 +291,7 @@
    },
    //点击左侧菜单任务事件
    chooseSubtask(s) {
      // this.currInsGuid = s.data.insGuid
      this.sideLoading = false;
      this.mainLoading = true;
      // const controller = new AbortController();
@@ -214,12 +305,49 @@
          this.mainLoading = false;
        });
    },
    updateSubtask() {
    // 问题卡片组件主动发起刷新父组件数据
    updateSubtask(isOk) {
      this.curSubtask.data.proCheckedNum++;
      this.curSubtask.type = this.getSubtaskType(this.curSubtask.data);
      if (!isOk) {
        return;
      }
      this.refreshCurrSubtask();
    },
    onProSubmited(isOk) {
      this.proAddOrUpdDialogClose();
      if (!isOk) {
        return;
      }
      this.updateSubtask(isOk);
    },
    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>