Crunchy
2025-04-29 e5454b769d44a34af423bf87ac8a740bf8c20341
src/views/CNAS/process/ensureResults/qualityControlPlan/index.vue
@@ -2,62 +2,68 @@
  <!--  7.7质量监督计划-->
  <div class="app-container">
    <div class="table-card">
      <div style="display: flex;justify-content: space-between;">
        <el-form :model="yearForm" ref="yearForm" size="small" :inline="true">
          <el-form-item label="计划名称" prop="superviseName">
            <el-input size="small" placeholder="请输入" clearable
                      v-model="yearForm.superviseName"
      <div style="display: flex;justify-content: space-between">
        <div style="display: flex;">
          <div style="margin-bottom: 18px;margin-right: 10px;display: flex;align-items: center;line-height: 32px;">
            <span style="width: 88px;font-size: 14px;font-weight: 700;color: #606266;">计划名称</span>
            <el-input size="small" placeholder="请输入" clearable v-model="yearForm.superviseName"
                      @keyup.enter.native="getYearPlanList"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button icon="el-icon-refresh" size="mini" @click="clearYear">重 置</el-button>
            <el-button type="primary" icon="el-icon-search" size="mini" @click="getYearPlanList">查 询</el-button>
          </el-form-item>
        </el-form>
        <div>
          </div>
          <div style="line-height: 30px;">
            <el-button type="primary" size="mini" @click="getYearPlanList">查询</el-button>
            <el-button size="mini" @click="clearYear">重置</el-button>
          </div>
        </div>
        <div style="line-height: 30px;">
          <el-button size="small" type="primary" @click="record">导入</el-button>
        </div>
      </div>
      <lims-table :tableData="yearTableData" :column="yearColumnData" :page="yearPage" :tableLoading="yearLoading"
                  height="40vh" @pagination="pagination" :rowClick="rowClick"
                  key="yearTableData"></lims-table>
        height="40vh" @pagination="pagination" :rowClick="rowClick" key="yearTableData"></lims-table>
    </div>
    <div style="margin-top: 20px">
      <div style="display: flex;justify-content: space-between;">
        <el-form :model="yearDetailForm" ref="yearDetailForm" size="small" :inline="true">
          <el-form-item>
            <el-radio-group v-model="yearDetailForm.causeType" @change="getYearDetailPlanList" size="small">
      <div style="display: flex;justify-content: space-between">
        <div style="display: flex;">
          <div style="margin-bottom: 18px;margin-right: 10px;display: flex;align-items: center;line-height: 32px;">
            <el-radio-group v-model="yearDetailForm.causeType" @change="getYearDetailPlan" size="small">
              <el-radio-button :label="1">定期监督</el-radio-button>
              <el-radio-button :label="2">动态监督</el-radio-button>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="监控目的" prop="supervisePurpose">
            <el-input v-model="yearDetailForm.supervisePurpose" placeholder="请输入" size="small"></el-input>
          </el-form-item>
          <el-form-item label="监控项目" prop="superviseProject">
            <el-input v-model="yearDetailForm.superviseProject" placeholder="请输入" size="small"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button icon="el-icon-refresh" size="mini" @click="clearDetail">重 置</el-button>
            <el-button type="primary" icon="el-icon-search" size="mini" @click="getYearDetailPlanList">查 询</el-button>
          </el-form-item>
        </el-form>
        <div>
          </div>
          <div style="margin-bottom: 18px;margin-right: 10px;display: flex;align-items: center;line-height: 32px;">
            <span style="width: 88px;font-size: 14px;font-weight: 700;color: #606266;">监控目的</span>
            <el-input v-model="yearDetailForm.supervisePurpose" placeholder="请输入" size="small"
                      @keyup.enter.native="getYearDetailPlan"></el-input>
          </div>
          <div style="margin-bottom: 18px;margin-right: 10px;display: flex;align-items: center;line-height: 32px;">
            <span style="width: 88px;font-size: 14px;font-weight: 700;color: #606266;">监控项目</span>
            <el-input v-model="yearDetailForm.superviseProject" placeholder="请输入" size="small"
                      @keyup.enter.native="getYearDetailPlan"></el-input>
          </div>
          <div style="line-height: 30px;">
            <el-button type="primary" size="mini" @click="getYearDetailPlan">查询</el-button>
            <el-button size="mini" @click="clearDetail">重置</el-button>
          </div>
        </div>
        <div style="line-height: 30px;">
          <el-button size="small" type="primary" @click="showDialog('add')">新增</el-button>
        </div>
      </div>
      <lims-table :tableData="yearDetailTableData" :column="yearDetailColumnData" :page="yearDetailPage" :tableLoading="yearDetailLoading"
                  height="40vh" @pagination="pagination1"
                  key="yearDetailTableData"></lims-table>
      <lims-table :tableData="yearDetailTableData" :column="yearDetailColumnData" :page="yearDetailPage"
        :tableLoading="yearDetailLoading" height="40vh" @pagination="pagination1" key="yearDetailColumnData"></lims-table>
    </div>
    <!--新增修改弹框-->
    <detail-form-dialog v-if="formDia" ref="formDia" :superviseId="superviseId" @closeDia="closeDia"></detail-form-dialog>
    <detail-form-dialog v-if="formDia" ref="formDia" :superviseId="superviseId"
      @closeDia="closeDia"></detail-form-dialog>
    <!--记录流程弹框-->
    <records-dialog v-if="recordsDia" ref="recordsDia" :superviseId="superviseId" @closeRecordsDia="closeRecordsDia"></records-dialog>
    <records-dialog v-if="recordsDia" ref="recordsDia" :superviseId="superviseId"
      @closeRecordsDia="closeRecordsDia"></records-dialog>
    <!--不符合处理流程弹框-->
    <processing-sheet v-if="processingDia" ref="processingDia" :superviseId="superviseId" @closeProcessingDia="closeProcessingDia"></processing-sheet>
    <processing-sheet v-if="processingDia" ref="processingDia" :superviseId="superviseId"
      @closeProcessingDia="closeProcessingDia"></processing-sheet>
    <!--纠正处理流程弹框-->
    <rectify-dialog-new v-if="rectifyDia" ref="rectifyDia" :superviseId="superviseId" @closeProcessingDia="closeRectifyDia"></rectify-dialog-new>
    <rectify-dialog-new v-if="rectifyDia" ref="rectifyDia" :superviseId="superviseId"
      @closeRectifyDia="closeRectifyDia"></rectify-dialog-new>
    <el-dialog :visible.sync="ratifyDialog" title="批准" width="30%" @close="closeRatifyDia">
      <span>
        批准备注:
@@ -68,54 +74,43 @@
        <el-button :loading="ratifyLoading" type="primary" @click="handleRatify(1)">批 准</el-button>
      </span>
    </el-dialog>
    <el-dialog
      :visible.sync="downloadDialog"
      title="导出"
      width="600px">
          <span>
            <el-button plain type="primary" @click="controlDown">记录单导出</el-button>
            <el-button plain type="primary" @click="processingDown">处理单导出</el-button>
            <el-button plain type="primary" @click="supervisoryDown">纠正单导出</el-button>
          </span>
    <el-dialog :visible.sync="downloadDialog" title="导出" width="600px">
      <span>
        <el-button plain type="primary" :disabled="download.recordStatus !== 3" @click="controlDown">记录单导出</el-button>
        <el-button plain type="primary" :disabled="download.accordingStatus !== 3" @click="processingDown">处理单导出</el-button>
        <el-button plain type="primary" :disabled="download.correctStatus !== 3" @click="supervisoryDown">纠正单导出</el-button>
      </span>
      <span slot="footer" class="dialog-footer">
            <el-button @click="downloadDialog = false">取 消</el-button>
          </span>
        <el-button @click="downloadDialog = false">取 消</el-button>
      </span>
    </el-dialog>
    <!--导入计划-->
    <el-dialog :visible.sync="uploadDia" title="数据导入" width="500px"
               :close-on-click-modal="false" :close-on-press-escape="false">
    <el-dialog :visible.sync="uploadDia" title="数据导入" width="500px" :close-on-click-modal="false"
      :close-on-press-escape="false">
      <div style="display: flex; align-items: center;">
        <span style="width: 80px">年份:</span>
        <el-date-picker
          v-model="superviseYear"
          type="year"
          value-format="yyyy"
          clearable
          size="small"
          format="yyyy"
        <el-date-picker v-model="superviseYear" type="year" value-format="yyyy" clearable size="small" format="yyyy"
          placeholder="选择年">
        </el-date-picker>
        <span  style="width: 110px">监督员:</span>
        <el-select v-model="recordUserIds" placeholder="请选择" size="small"
                   @change="splitList"
                   :multiple-limit="2" filterable multiple style="width: 100%">
        <span style="width: 110px">监督员:</span>
        <el-select v-model="recordUserIds" placeholder="请选择" size="small" @change="splitList" :multiple-limit="2"
          filterable multiple style="width: 100%">
          <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"></el-option>
        </el-select>
      </div>
      <div style="display: flex;align-items: center;margin: 10px 0">
        <div style="width: 60px">批准人:</div>
        <el-select v-model="ratifyUserId" clearable
                   filterable size="small" style="width: 50%;">
        <el-select v-model="ratifyUserId" clearable filterable size="small" style="width: 50%;">
          <el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id">
          </el-option>
        </el-select>
      </div>
      <div style="margin: 0 auto;">
        <el-upload ref="upload1" :action="action" :auto-upload="false" :file-list="fileList" :headers="uploadHeader" :limit="1"
                   accept='.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar'
                   :on-change="beforeUpload" :on-error="onError" :on-success="handleSuccessUp" drag
                   :data="{recordUserIds: recordUserIds1, superviseYear: superviseYear, ratifyUserId: ratifyUserId}"
                   name="file">
        <el-upload ref="upload1" :action="action" :auto-upload="false" :file-list="fileList" :headers="uploadHeader"
          :limit="1" accept='.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar'
          :on-change="beforeUpload" :on-error="onError" :on-success="handleSuccessUp" drag
          :data="{ recordUserIds: recordUserIds1, superviseYear: superviseYear, ratifyUserId: ratifyUserId }"
          name="file">
          <i class="el-icon-upload"></i>
          <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
        </el-upload>
@@ -141,13 +136,13 @@
  ratifyQualitySupervise, superviseDetailAccordingExport,
  exportSuperviseDetaillCorrect
} from "@/api/cnas/process/ensureResults/qualitySupervise";
import {selectUserCondition} from "@/api/business/inspectionTask";
import {mapGetters} from "vuex";
import { selectUserCondition } from "@/api/business/inspectionTask";
import { mapGetters } from "vuex";
export default {
  name: 'a7-quality-control-plan',
  name: 'QualityControlPlan',
  // import 引入的组件需要注入到对象中才能使用
  components: {limsTable, RectifyDialogNew, ProcessingSheet, RecordsDialog, DetailFormDialog},
  components: { limsTable, RectifyDialogNew, ProcessingSheet, RecordsDialog, DetailFormDialog },
  data() {
    // 这里存放数据
    return {
@@ -163,20 +158,19 @@
        {
          label: '计划名称',
          prop: 'superviseName',
          minWidth: '150px'
          width: '150px'
        }, {
          label: '编制人',
          prop: 'writeUserName',
          minWidth: '100'
        }, {
          label: '编制日期',
          prop: 'writeTime',
          minWidth: '160'
          width: '160'
        }, {
          dataType: 'tag',
          label: '批准状态',
          prop: 'ratifyStatus',
          minWidth: '100',
          width: '100',
          formatData: (params) => {
            if (params === 0) {
              return '不批准';
@@ -195,23 +189,19 @@
              return null;
            }
          }
        },{
        }, {
          label: '批准内容',
          prop: 'ratifyRemark',
          minWidth: '100'
        },{
        }, {
          label: '批准人',
          prop: 'ratifyUserName',
          minWidth: '100'
        },{
        }, {
          label: '批准日期',
          prop: 'ratifyTime',
          minWidth: '160'
          width: '160'
        }, {
          dataType: 'action',
          minWidth: '170',
          label: '操作',
          fixed: 'right',
          operation: [
            {
              name: '批准',
@@ -269,33 +259,123 @@
        {
          label: '监督日期',
          prop: 'superviseTime',
          minWidth: '150px'
          width: '120px'
        }, {
          label: '监督目的',
          prop: 'supervisePurpose',
          minWidth: '150px',
          showOverflowTooltip: true,
          width: '180px',
        }, {
          label: '监控项目',
          prop: 'superviseProject',
          minWidth: '150px'
          width: '180px'
        }, {
          label: '被监督人员',
          prop: 'supervisee',
          minWidth: '150px'
          width: '120px'
        }, {
          label: '监督原因',
          prop: 'superviseReason',
          minWidth: '150px'
          width: '150px'
        },{
          dataType: 'tag',
          label: '记录状态',
          prop: 'recordStatus',
          width: '100',
          formatData: (params) => {
            if (params === 0) {
              return '未开始';
            } else if (params === 1) {
              return '待评价';
            }  else if (params === 2) {
              return '不批准';
            } else if (params === 3) {
              return '已批准';
            } else {
              return null;
            }
          },
          formatType: (params) => {
            if (params === 0) {
              return '';
            } else if (params === 1) {
              return 'warning';
            } else if (params === 2) {
              return 'danger';
            }  else if (params === 3) {
              return 'success';
            } else {
              return null;
            }
          }
        },{
          dataType: 'tag',
          label: '控制状态',
          prop: 'accordingStatus',
          width: '100',
          formatData: (params) => {
            if (params === 0) {
              return '未开始';
            } else if (params === 1) {
              return '待评价';
            }  else if (params === 2) {
              return '不批准';
            } else if (params === 3) {
              return '已批准';
            } else {
              return null;
            }
          },
          formatType: (params) => {
            if (params === 0) {
              return '';
            } else if (params === 1) {
              return 'warning';
            } else if (params === 2) {
              return 'danger';
            }  else if (params === 3) {
              return 'success';
            } else {
              return null;
            }
          }
        },{
          dataType: 'tag',
          label: '纠正状态',
          prop: 'correctStatus',
          width: '100',
          formatData: (params) => {
            if (params === 0) {
              return '未开始';
            } else if (params === 1) {
              return '待评价';
            }  else if (params === 2) {
              return '不批准';
            } else if (params === 3) {
              return '已批准';
            } else {
              return null;
            }
          },
          formatType: (params) => {
            if (params === 0) {
              return '';
            } else if (params === 1) {
              return 'warning';
            } else if (params === 2) {
              return 'danger';
            }  else if (params === 3) {
              return 'success';
            } else {
              return null;
            }
          }
        }, {
          label: '备注',
          prop: 'remark',
          minWidth: '150px'
        },{
        }, {
          dataType: 'action',
          width: '260',
          label: '操作',
          fixed: 'right',
          label: '操作',
          operation: [
            {
              name: '编辑',
@@ -364,6 +444,7 @@
        size: 20,
        total: 0
      },
      currentScrollPosition: 0,
      superviseId: '',
      formDia: false,
      recordsDia: false,
@@ -390,7 +471,7 @@
  // 方法集合
  methods: {
    // 查询年度计划表
    getYearPlanList () {
    getYearPlanList() {
      const entity = {
        superviseName: this.yearForm.superviseName,
      }
@@ -408,18 +489,13 @@
        this.yearLoading = false
      })
    },
    clearYear () {
    clearYear() {
      this.yearForm.superviseName = ''
      this.getYearPlanList()
    },
    pagination({ page, limit }) {
      this.yearPage.current = page;
      this.yearPage.size = limit;
      this.getYearPlanList();
    },
    pagination1({ page, limit }) {
      this.yearDetailPage.current = page;
      this.yearDetailPage.size = limit;
      this.getYearPlanList();
    },
    // 导入流程
@@ -446,7 +522,7 @@
        }, 1000)
      }
    },
    splitList (val) {
    splitList(val) {
      const string = this.HaveJson(val)
      this.recordUserIds1 = string.join(',');
      console.log(this.recordUserIds1)
@@ -469,7 +545,7 @@
      this.$refs.upload1.submit();
    },
    // 关闭导入弹框
    closeUploadDia () {
    closeUploadDia() {
      this.uploadDia = false;
      this.recordUserIds = []
      this.ratifyUserId = ''
@@ -477,21 +553,21 @@
      this.getYearPlanList()
    },
    // 打开报告弹框
    record (row) {
    record(row) {
      this.uploadDia = true
      this.getUserList()
    },
    getUserList(){
      selectUserCondition({ type: 0 }).then((res) => {
    getUserList() {
      selectUserCondition({ type: 2 }).then((res) => {
        this.userList = res.data;
      })
    },
    // 批准
    approvalPlan (row) {
    approvalPlan(row) {
      this.ratifyDialog = true
      this.ratifyInfo = row
    },
    handleRatify (ratifyStatus) {
    handleRatify(ratifyStatus) {
      // 批准状态 , 0 不通过, 1通过
      this.ratifyInfo.ratifyStatus = ratifyStatus
      this.ratifyLoading = true
@@ -504,33 +580,32 @@
        this.ratifyLoading = false
      })
    },
    closeRatifyDia () {
    closeRatifyDia() {
      this.ratifyDialog = false
      this.ratifyInfo.ratifyRemark = ''
      this.getYearPlanList()
    },
    // 导出
    handleDown (row) {
      exportQualitySupervise({superviseId: row.superviseId}).then(res => {
    handleDown(row) {
      exportQualitySupervise({ superviseId: row.superviseId }).then(res => {
        try {
          this.outLoading = false
          const blob = new Blob([res],{ type: 'application/msword' });
          const blob = new Blob([res], { type: 'application/msword' });
          this.$download.saveAs(blob, row.superviseName + '.docx')
          this.$message.success('导出成功')
        } catch (error) {
          console.error('创建Blob对象时出错:', error);
        }
      })
    },
    // 删除进度计划表
    delPlan (row) {
    delPlan(row) {
      this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.yearLoading = true
        delQualitySupervise({superviseId: row.superviseId}).then(res => {
        delQualitySupervise({ superviseId: row.superviseId }).then(res => {
          this.yearLoading = false
          this.$message.success('删除成功')
          this.getYearPlanList()
@@ -548,10 +623,15 @@
    // 年度计划表格,点击行数据后刷新详情
    rowClick(row) {
      this.superviseId = row.superviseId
      this.getYearDetailPlan()
    },
    getYearDetailPlan () {
      this.yearDetailPage.current = 1
      this.yearDetailPage.size = 20
      this.getYearDetailPlanList()
    },
    // 获取年度明细表
    getYearDetailPlanList () {
    getYearDetailPlanList() {
      const entity = {
        superviseId: this.superviseId,
        supervisePurpose: this.yearDetailForm.supervisePurpose,
@@ -569,100 +649,99 @@
        this.yearDetailLoading = false
      })
    },
    pagination1(page) {
      this.yearDetailPage.size = page.limit;
      this.getYearDetailPlanList();
    },
    // 重置明细表
    clearDetail () {
      this.yearDetailForm = {
        supervisePurpose: '',
        superviseProject: ''
      }
    clearDetail() {
      this.yearDetailForm.supervisePurpose = ''
      this.yearDetailForm.superviseProject = ''
      this.getYearDetailPlanList()
    },
    // 打开年度明细新增、修改弹框
    showDialog (type, row) {
    showDialog(type, row) {
      this.formDia = true
      this.$nextTick(() => {
        this.$refs.formDia.openDia(type, row)
        this.$refs.formDia.openDia(type, row, this.yearDetailForm.causeType)
      })
    },
    closeDia () {
    closeDia() {
      this.formDia = false
      this.getYearDetailPlanList()
    },
    // 记录流程
    records (row) {
    records(row) {
      this.recordsDia = true
      this.$nextTick(() => {
        this.$refs.recordsDia.openDia(row)
      })
    },
    closeRecordsDia () {
    closeRecordsDia() {
      this.recordsDia = false
      this.getYearDetailPlanList()
    },
    // 不符合流程弹框
    processing (row) {
    processing(row) {
      this.processingDia = true
      this.$nextTick(() => {
        this.$refs.processingDia.openDia(row)
      })
    },
    closeProcessingDia () {
    closeProcessingDia() {
      this.processingDia = false
      this.getYearDetailPlanList()
    },
    // 纠正流程弹框
    rectify (row) {
    rectify(row) {
      this.rectifyDia = true
      this.$nextTick(() => {
        this.$refs.rectifyDia.openDia(row)
      })
    },
    closeRectifyDia () {
    closeRectifyDia() {
      this.rectifyDia = false
      this.getYearDetailPlanList()
    },
    // 打开导出弹框
    openDownloadDia (row) {
    openDownloadDia(row) {
      this.downloadDialog = true
      this.download = row
    },
    // 导出记录
    controlDown () {
      exportSuperviseDetailRecord({superviseDetailsId: this.download.superviseDetailsId}).then(res => {
    controlDown() {
      exportSuperviseDetailRecord({ superviseDetailsId: this.download.superviseDetailsId }).then(res => {
        const blob = new Blob([res], { type: 'application/msword' });
        this.$download.saveAs(blob, '记录导出.docx')
        this.$message.success('导出成功')
      }).catch(err => {
        console.log('err---', err);
      })
    },
    // 处理单导出
    processingDown () {
      superviseDetailAccordingExport({superviseDetailsId: this.download.superviseDetailsId}).then(res => {
    processingDown() {
      superviseDetailAccordingExport({ superviseDetailsId: this.download.superviseDetailsId }).then(res => {
        const blob = new Blob([res], { type: 'application/msword' });
        this.$download.saveAs(blob, '不符合项导出.docx')
        this.$message.success('导出成功')
      }).catch(err => {
        console.log('err---', err);
      })
    },
    // 纠正单导出
    supervisoryDown () {
      exportSuperviseDetaillCorrect({superviseDetailsCorrectId: this.download.superviseDetailsCorrectId}).then(res => {
    supervisoryDown() {
      exportSuperviseDetaillCorrect({ superviseDetailsCorrectId: this.download.superviseDetailsCorrectId }).then(res => {
        const blob = new Blob([res], { type: 'application/msword' });
        this.$download.saveAs(blob, '监督纠正措施.docx')
        this.$message.success('导出成功')
      })
    },
    // 删除年度详情列表
    delYearPlanDetail (row) {
    delYearPlanDetail(row) {
      this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.yearDetailLoading = true
        delQualitySuperviseDetail({superviseDetailsId: row.superviseDetailsId}).then(res => {
        delQualitySuperviseDetail({ superviseDetailsId: row.superviseDetailsId }).then(res => {
          this.yearDetailLoading = false
          this.$message.success('删除成功')
          this.getYearDetailPlanList()
@@ -687,6 +766,7 @@
.table-card {
  background-color: #ffffff;
}
.flex_column {
  display: flex;
  height: 80vh;