riku
2024-10-30 d4e7c11e06b643c9353444c839cec40c25945219
src/views/fysp/check/components/CompProblemCard.vue
@@ -59,15 +59,9 @@
    <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">
@@ -85,19 +79,103 @@
      </el-col>
    </el-row>
  </el-card>
  <div class="dialog-wrapper">
    <el-dialog
      title="问题更正"
      width="80%"
      v-model="proAddOrUpdDialogVisible"
      :before-close="proAddOrUpdDialogClose"
    >
      <CompProblemAddOrUpd
        v-if="proAddOrUpdDialogVisible"
        :problem="deepCopyPro"
        :subtask="deepCopySubtask"
        :topTask="deepCopyTopTask"
        ref="compProblemAddOrUpdRef"
        @submited="onProSubmited"
      />
    </el-dialog>
  </div>
  <el-dialog width="80%" title="整改提交" v-model="addChangeDialogVisible">
    <ComChangeEdit
      :changeType="0"
      v-if="addChangeDialogVisible"
      :problemId="problem.guid"
      :subtask="subtask"
      :month="month"
      @submited="onAddChangeSubmited"
    />
  </el-dialog>
  <el-dialog
    width="80%"
    title="整改检验"
    v-model="changeEditDialogVisible"
    :before-close="changeEditDialogClose"
  >
    <ComChangeEdit
      :changeType="1"
      v-if="changeEditDialogVisible"
      :problemId="problem.guid"
      :oldChangeFileList="problem.mediafileList"
      :subtask="subtask"
      :month="month"
      @submited="onChangeSubmited"
    />
  </el-dialog>
  <!-- 问题复现 -->
  <el-dialog
    width="80%"
    title="问题复现"
    v-model="proRecentDialogVisible"
    :before-close="proRecentDialogClose"
  >
    <CompProRecent
      v-if="proRecentDialogVisible"
      :subtask="subtask"
      :topTask="topTask"
      :problem="problem"
    />
  </el-dialog>
</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 {
  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 +183,18 @@
      default: 1
    }
  },
  emits:['submit'],
  emits: ['submit'],
  data() {
    return {
      addChangeDialogVisible: false,
      // 近期情况
      proRecentDialogVisible: false,
      month: -1,
      deepCopyPro: {},
      deepCopySubtask: {},
      deepCopyTopTask: {},
      proAddOrUpdDialogVisible: false,
      changeEditDialogVisible: false,
      // 审核步骤
      steps: [
        {
@@ -123,12 +210,13 @@
          aft: '整改已审核'
        }
      ]
    }
    };
  },
  mounted() {},
  computed: {
    // 问题名称
    title() {
      return this.problem.problemname
      return this.problem.problemname;
    },
    // 问题描述
    descriptions() {
@@ -141,11 +229,11 @@
          name: '提交时间',
          value: this.problem.time.replace('T', ' ').split('.')[0]
        }
      ]
      ];
    },
    // 问题图片
    pics() {
      return ProCheckProxy.proPics(this.problem)
      return ProCheckProxy.proPics(this.problem);
    },
    /**
     * 获取当前问题审核步骤
@@ -153,46 +241,119 @@
    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() {},
    onAddChangeSubmited() {
      this.$emit('updated', true);
      this.addChangeDialogVisible = false;
    },
    // 近期情况弹窗关闭
    proRecentDialogClose() {
      this.proRecentDialogVisible = false;
    },
    newProblem() {
      this.proAddOrUpdDialogVisible = true;
    },
    onProSubmited(isOk) {
      this.$emit('updated', isOk);
      this.proAddOrUpdDialogVisible = false;
    },
    onChangeSubmited(isOk) {
      this.$emit('updated', isOk);
      this.changeEditDialogVisible = false;
    },
    proAddOrUpdDialogClose() {
      this.proAddOrUpdDialogVisible = false;
    },
    changeEditDialogClose() {
      this.changeEditDialogVisible = 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);
    },
    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)
          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')
              pro.extension3 = status;
              this.$emit('submit');
            }
          })
          });
        }
      })
      });
    },
    updatePro() {},
    updateChange() {}
    addChange() {
      this.addChangeDialogVisible = true;
    },
    updatePro() {
      this.deepCopyPro = useCloned(this.problem).cloned.value;
      this.deepCopySubtask = useCloned(this.subtask).cloned.value;
      this.deepCopyTopTask = useCloned(this.topTask).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.addChange();
      } else {
        this.changeEditDialogVisible = true;
      }
    },
    currProRecent() {
      this.proRecentDialogVisible = true;
    }
  }
}
};
</script>
<style scoped>
.layout {