riku
2024-11-21 9b2b08c3b44de3d2f76069936dfe5ba0e0ece0aa
src/views/fysp/check/components/CompProblemCard.vue
@@ -1,6 +1,11 @@
<template>
  <el-card class="layout" shadow="hover">
    <el-steps :active="proStatus.index" finish-status="success" style="" align-center>
    <el-steps
      :active="proStatus.index"
      finish-status="success"
      style=""
      align-center
    >
      <el-step v-for="(s, i) in getSteps" :key="i" :title="s" />
    </el-steps>
@@ -30,12 +35,20 @@
    </el-descriptions>
    <el-scrollbar>
      <el-descriptions title=" " :column="2" direction="vertical" size="small" border>
      <el-descriptions
        title=" "
        :column="2"
        direction="vertical"
        size="small"
        border
      >
        <template v-for="(pic, t) in pics" :key="t">
          <template v-if="pic.path.length > 0">
            <el-descriptions-item
              :label="pic.title"
              :label-class-name="t == 0 ? 'descriptions-label-1' : 'descriptions-label-2'"
              :label-class-name="
                t == 0 ? 'descriptions-label-1' : 'descriptions-label-2'
              "
            >
              <el-space>
                <el-image
@@ -59,45 +72,139 @@
    <el-row v-if="true" style="margin-top: 16px">
      <el-col :span="12">
        <el-row justify="start" class="btn-group">
          <el-button type="success" size="small" @click="updatePro" plain>修改问题</el-button>
          <el-button
            type="primary"
            size="small"
            @click="updateChange"
            plain
            :disabled="!proStatus.changeable"
            >修改整改</el-button
          <el-button type="success" size="small" @click="updatePro" plain
            >问题更正</el-button
          >
          <el-button type="primary" size="small" @click="updateChange" plain
            >整改检验</el-button
          >
          <el-button type="info" size="small" @click="currProRecent" plain
            >问题复现</el-button
          >
        </el-row>
      </el-col>
      <el-col :span="12">
        <el-row justify="end" class="btn-group">
          <el-button type="danger" size="small" @click="deletePro" :disabled="!proStatus.deletable"
          <el-button
            type="danger"
            size="small"
            @click="deletePro"
            :disabled="!proStatus.deletable"
            >删除</el-button
          >
          <el-button type="warning" size="small" @click="rejectPro" :disabled="!proStatus.checkable"
          <el-button
            v-if="proStatus.name.indexOf('不通过') != -1"
            type="danger"
            size="small"
            @click="revokePro"
            :disabled="proStatus.checkable"
            >撤销驳回</el-button
          >
          <el-button
            v-else
            type="warning"
            size="small"
            @click="rejectPro"
            :disabled="!proStatus.checkable"
            >驳回</el-button
          >
          <el-button type="success" size="small" @click="passPro" :disabled="!proStatus.checkable"
          <el-button
            v-if="
              proStatus.name.indexOf('不通过') == -1 &&
              proStatus.name.indexOf('通过') != -1
            "
            type="danger"
            size="small"
            @click="revokePro"
            :disabled="proStatus.checkable"
            >撤销通过</el-button
          >
          <el-button
            v-else
            type="success"
            size="small"
            @click="passPro"
            :disabled="!proStatus.checkable"
            >通过</el-button
          >
        </el-row>
      </el-col>
    </el-row>
  </el-card>
  <CompProblemAddOrUpd
    title="问题更正"
    v-if="proAddOrUpdDialogVisible"
    v-model:visible="proAddOrUpdDialogVisible"
    :problem="deepCopyPro"
    :subtask="subtask"
    :topTask="topTask"
    ref="compProblemAddOrUpdRef"
    @cancel="onProCanceled"
    @submit="onProSubmited"
  />
  <!-- 整改 -->
  <ComChangeEdit
    :title="changeType == 1 ? '整改检验' : '整改提交'"
    v-if="changeDialogVisible"
    v-model:visible="changeDialogVisible"
    :changeType="changeType"
    :problemId="problem.guid"
    :subtask="subtask"
    :month="month"
    :oldChangeFileList="problem.mediafileList"
    @cancel="onChangeCanceled"
    @submit="onChangeSubmited"
  />
  <!-- 问题复现 -->
  <CompProRecent
    title="问题复现"
    v-if="proRecentDialogVisible"
    v-model:visible="proRecentDialogVisible"
    :subtask="subtask"
    :topTask="topTask"
    :problem="problem"
  />
</template>
<script>
import ProCheckProxy from '../ProCheckProxy'
import problemApi from '@/api/fysp/problemApi'
import { useMessageBoxTip } from '@/composables/messageBox'
import ProCheckProxy from '../ProCheckProxy';
import problemApi from '@/api/fysp/problemApi';
import { useMessageBoxTip } from '@/composables/messageBox';
import CompProblemAddOrUpd from './CompProblemAddOrUpd.vue';
import ComChangeEdit from './ComChangeEdit.vue';
import CompProRecent from './CompProRecent.vue';
import { useCloned } from '@vueuse/core';
export default {
  emits: ['check', 'submit', 'cancel'],
  components: {
    CompProblemAddOrUpd,
    ComChangeEdit,
    CompProRecent
  },
  props: {
    // 只读选项
    readonly: {
      type: Boolean,
      default: () => {
        return false;
      }
    },
    topTask: {
      type: Object,
      default: () => {}
    },
    subtask: {
      type: Object,
      default: () => {}
    },
    insGuid: {
      type: String,
      default: () => ''
    },
    problem: {
      type: Object,
      default: () => {
        return {}
        return {};
      }
    },
    index: {
@@ -105,9 +212,19 @@
      default: 1
    }
  },
  emits:['submit'],
  data() {
    return {
      changeDialogVisible: false,
      changeType: -1,
      addChangeDialogVisible: false,
      // 近期情况
      proRecentDialogVisible: false,
      month: -1,
      deepCopyPro: {},
      deepCopySubtask: {},
      deepCopyTopTask: {},
      proAddOrUpdDialogVisible: false,
      changeEditDialogVisible: false,
      // 审核步骤
      steps: [
        {
@@ -123,12 +240,13 @@
          aft: '整改已审核'
        }
      ]
    }
    };
  },
  mounted() {},
  computed: {
    // 问题名称
    title() {
      return this.problem.problemname
      return this.problem.problemname;
    },
    // 问题描述
    descriptions() {
@@ -141,11 +259,11 @@
          name: '提交时间',
          value: this.problem.time.replace('T', ' ').split('.')[0]
        }
      ]
      ];
    },
    // 问题图片
    pics() {
      return ProCheckProxy.proPics(this.problem)
      return ProCheckProxy.proPics(this.problem);
    },
    /**
     * 获取当前问题审核步骤
@@ -153,46 +271,136 @@
    getSteps() {
      return this.steps.map((v, i) => {
        if (i >= this.proStatus.index) {
          return v.bef
          return v.bef;
        } else {
          return v.aft
          return v.aft;
        }
      })
      });
    },
    // 问题状态
    proStatus() {
      return ProCheckProxy.proStatusMap(this.problem.extension3)
      return ProCheckProxy.proStatusMap(this.problem.extension3);
    }
  },
  methods: {
    deletePro() {},
    onProCanceled() {
      this.proAddOrUpdDialogVisible = false;
    },
    onProSubmited(isOk) {
      this.$emit('submit', isOk);
      this.proAddOrUpdDialogVisible = false;
    },
    onChangeCanceled() {
      this.changeDialogVisible = false;
    },
    onChangeSubmited(isOk) {
      this.$emit('submit', isOk);
      this.changeDialogVisible = false;
    },
    deletePro() {
      useMessageBoxTip({
        confirmMsg: '是否删除问题',
        confirmTitle: '确定',
        onConfirm: () => {
          return problemApi
            .deleteProblem({
              pid: this.problem.guid
            })
            .then((res) => {
              if (res.success) {
                this.$emit('submit');
              }
            });
        }
      });
    },
    rejectPro() {
      this.checkPro(false)
      this.checkPro(false);
    },
    passPro() {
      this.checkPro(true)
      this.checkPro(true);
    },
    revokePro() {
      const pro = this.problem;
      let status = this.proStatus;
      let doneMsg;
      if (status.index <= 2) {
        doneMsg = '问题未审核';
      } else if (status.index <= 3) {
        doneMsg = '整改未审核';
      }
      useMessageBoxTip({
        confirmMsg: `确认撤回到${doneMsg}?`,
        confirmTitle: '审核撤回',
        onConfirm: () => {
          const { status, action } = ProCheckProxy.proBeforeStatus(
            pro.extension3
          );
          return problemApi
            .checkProblem({ pId: pro.guid, action: action })
            .then((res) => {
              if (res.success) {
                pro.extension3 = status
                this.$emit('check');
              }
            });
        }
      });
    },
    checkPro(pass) {
      const pro = this.problem
      let doneMsg = pass ? '通过' : '驳回'
      const pro = this.problem;
      let doneMsg = pass ? '通过' : '驳回';
      useMessageBoxTip({
        confirmMsg: `确认是否${doneMsg}该问题?`,
        confirmTitle: '问题审核',
        onConfirm: () => {
          const { status, action } = ProCheckProxy.proNextStatus(pro.extension3, pass)
          return problemApi.checkProblem({ pId: pro.guid, action: action }).then((res) => {
            if (res.success) {
              pro.extension3 = status
              this.$emit('submit')
            }
          })
          const { status, action } = ProCheckProxy.proNextStatus(
            pro.extension3,
            pass
          );
          return problemApi
            .checkProblem({ pId: pro.guid, action: action })
            .then((res) => {
              if (res.success) {
                pro.extension3 = status
                this.$emit('check');
              }
            });
        }
      })
      });
    },
    updatePro() {},
    updateChange() {}
    updatePro() {
      this.deepCopyPro = useCloned(this.problem).cloned.value;
      this.$nextTick(() => {
        this.proAddOrUpdDialogVisible = true;
      });
    },
    getCurrentMouth() {
      // 使用Date对象解析日期字符串
      var date = new Date(this.subtask.subtask.planstarttime);
      // 获取月份信息,月份是从0开始的,所以需要加1
      this.month = date.getMonth() + 1;
      if (String(this.month).length == 1) {
        this.month = `0${this.month}`;
      }
      // 获取年份
      var year = date.getFullYear();
      this.month = `${year}-${this.month}`;
    },
    updateChange() {
      this.getCurrentMouth();
      if (!this.problem.ischanged) {
        this.changeType = 0;
      } else {
        this.changeType = 1;
      }
      this.changeDialogVisible = true;
    },
    currProRecent() {
      this.proRecentDialogVisible = true;
    }
  }
}
};
</script>
<style scoped>
.layout {