gaoluyang
9 小时以前 29be8639dc16b5d82bddc6099b1fa5cdca75f77a
src/views/CNAS/process/ensureResults/qualityControlPlan/components/recordsDialog.vue
@@ -70,6 +70,18 @@
          </tr>
          <tr>
            <td class="td-title">
              <p>监督方式:</p>
            </td>
            <td colspan="5">
              <el-select v-if="currentStep === 0" v-model="superviseModeList" multiple filterable collapse-tags
                         placeholder="请选择监督方式(程序4.2.4)" size="small" style="width: 100%">
                <el-option v-for="item in superviseModeItems" :key="item" :label="item" :value="item"></el-option>
              </el-select>
              <span v-else class="td-info"> {{ form.superviseMethod }}</span>
            </td>
          </tr>
          <tr>
            <td class="td-title">
              <p><span class="required-span">* </span>监督记录:</p>
            </td>
            <td colspan="5">
@@ -108,6 +120,23 @@
                        type="textarea">
              </el-input>
              <span v-else class="td-info"> {{ form.rectifyAdvice }}</span>
            </td>
          </tr>
          <tr>
            <td class="td-title">
              <p>被监督人员确认意见:</p>
            </td>
            <td colspan="5">
              <span v-if="form.confirmOpinion" class="td-info">{{ form.confirmOpinion }}</span>
              <template v-else-if="canConfirm">
                <el-input v-model="confirmOpinion" :rows="2" size="small" type="textarea"
                          placeholder="对监督记录真实性表示认可。"/>
                <el-button :loading="confirming" size="small" type="primary" style="margin-top: 6px"
                           @click="confirmRecord">确 认</el-button>
              </template>
              <span v-else class="td-info">
                {{ form.superviseDetailsRecordId ? '待被监督人员确认' : '监督员提交后由被监督人员确认' }}
              </span>
            </td>
          </tr>
          <tr>
@@ -170,11 +199,26 @@
<script>
import {
  addSuperviseDetailRecord,
  addSuperviseRecordOpinion, getRecordUser,
  addSuperviseRecordOpinion, confirmSuperviseRecord, getRecordUser,
  getSuperviseDetailRecord
} from "@/api/cnas/process/ensureResults/qualitySupervise";
import {selectUserCondition} from "@/api/business/inspectionTask";
import {mapGetters} from "@/utils/store-compat";
// 监督内容9项,与受控记录表 LMSY-CX29-JL02 的文字及横排顺序完全一致
const SUPERVISE_CONTENT_ITEMS = [
  '人员持证及培训', '设施及环境条件', '检测方法',
  '仪器设备管理', '测量溯源性', '标准物质管理',
  '样品制备和处置', '检测数据处理', '结果报告结果'
]
// 监督方式,对应《质量监督程序》4.2.4
const SUPERVISE_MODE_ITEMS = [
  '核查原始记录和报告',
  '现场监督实际操作过程',
  '与被监督对象交流',
  '内部质量控制/外部质量评估',
  '培训效果评价'
]
export default {
  name: 'recordsDialog',
@@ -200,6 +244,8 @@
        ratifyOpinion: '',
        isAccording: '',
        isFinish: '',
        superviseMethod: '',
        confirmOpinion: '',
      },
      currentStep: 0,
      editLoad: false,
@@ -209,11 +255,27 @@
      ratifyUserId: '',
      superviseeList: [],
      superviseContentList: [],
      superviseContentItems: ['人员持证及培训', '设施及环境条件', '检测方法', '仪器设备管理', '测量溯源性', '标准物质管理', '样品制备和处置', '检测数据处理', '结果报告结果'],
      superviseContentItems: SUPERVISE_CONTENT_ITEMS,
      superviseModeItems: SUPERVISE_MODE_ITEMS,
      superviseModeList: [],
      confirmOpinion: '',
      confirming: false,
    };
  },
  computed: {
    ...mapGetters(["userId"]),
    ...mapGetters(["userId", "nickName"]),
    // 记录已提交且尚未确认时,只有被监督人员本人可以确认(程序4.2.5)
    canConfirm() {
      if (!this.form.superviseDetailsRecordId || this.form.confirmOpinion) {
        return false
      }
      const members = (this.form.testMember || '').split('、').map(item => item.trim()).filter(Boolean)
      if (this.nickName && members.includes(this.nickName)) {
        return true
      }
      // 兜底:计划明细中登记的被监督人员
      return !!this.supervisedUserId && Number(this.supervisedUserId) === Number(this.userId)
    },
    contentRows() {
      const rows = []
      for (let i = 0; i < this.superviseContentItems.length; i += 3) {
@@ -255,6 +317,8 @@
        this.ratifyUserId = res.data.ratifyUserId
        this.superviseeList = this.form.testMember ? this.form.testMember.split('、').filter(i => i) : []
        this.superviseContentList = this.form.superviseContent ? this.form.superviseContent.split('、').filter(i => i) : []
        this.superviseModeList = this.form.superviseMethod ? this.form.superviseMethod.split('、').filter(i => i) : []
        this.confirmOpinion = this.form.confirmOpinion || ''
        this.getRecordUser()
      }).catch(err => {
        console.log('err---', err);
@@ -273,6 +337,7 @@
        }
        this.form.testMember = this.superviseeList.join('、')
        this.form.superviseContent = this.superviseContentList.join('、')
        this.form.superviseMethod = this.superviseModeList.join('、')
        this.addInfo()
      } else {
        this.editInfo(isFinish)
@@ -311,6 +376,20 @@
        this.editLoad = false
      })
    },
    // 被监督人员确认监督记录(程序4.2.5)
    confirmRecord () {
      const opinion = (this.confirmOpinion || '').trim() || '对监督记录真实性表示认可。'
      this.confirming = true
      confirmSuperviseRecord({
        superviseDetailsId: this.form.superviseDetailsId,
        confirmOpinion: opinion
      }).then(() => {
        this.form.confirmOpinion = opinion
        this.$message.success('已确认监督记录')
      }).finally(() => {
        this.confirming = false
      })
    },
    // 关闭弹框
    closeRecordsDia () {
      this.formDia = false
@@ -331,7 +410,12 @@
    },
    getRecordUser () {
      getRecordUser({superviseDetailsId: this.form.superviseDetailsId}).then(res => {
        this.recordUserList = res.data
        this.recordUserList = res.data || []
        // 计划已指定监督员但尚未产生记录时,默认反显第一位监督员;
        // 后端只有在存在上月记录时才会自动带出监督员,首次填写会为空。
        if (this.currentStep === 0 && !this.form.supervisor && this.recordUserList.length) {
          this.form.supervisor = this.recordUserList[0].userName
        }
      })
    },
  }