From dc3e687df3ba49f48f542c9c3088ce3bbc4318cd Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 05 三月 2025 09:40:55 +0800
Subject: [PATCH] 解决上传文件需要认证的问题

---
 src/views/CNAS/process/ensureResults/qualityControlPlan/index.vue |  625 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 625 insertions(+), 0 deletions(-)

diff --git a/src/views/CNAS/process/ensureResults/qualityControlPlan/index.vue b/src/views/CNAS/process/ensureResults/qualityControlPlan/index.vue
index e69de29..e4b9fd5 100644
--- a/src/views/CNAS/process/ensureResults/qualityControlPlan/index.vue
+++ b/src/views/CNAS/process/ensureResults/qualityControlPlan/index.vue
@@ -0,0 +1,625 @@
+<template>
+  <!--  7.7璐ㄩ噺鐩戠潱璁″垝-->
+  <div>
+    <div class="table-card">
+      <TableCard title="骞村害璁″垝琛�">
+        <template v-slot:form>
+          <div class="items_center">
+            <span>璁″垝鍚嶇О锛�</span>
+            <el-input v-model="yearForm.superviseName" class="search" placeholder="璇疯緭鍏�" size="small"></el-input>
+            <el-button size="small" type="primary" @click="getYearPlanList">鏌ヨ</el-button>
+            <el-button size="small" @click="clearYear">閲嶇疆</el-button>
+          </div>
+          <div>
+            <el-upload ref='upload' :action="action" :before-upload="beforeUpload" :headers="uploadHeader"
+              :on-error="onError" :on-success="handleSuccessUp" :show-file-list="false"
+              accept='.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar'>
+              <el-button :loading="upLoading" size="small" type="primary">瀵煎叆</el-button>
+            </el-upload>
+          </div>
+        </template>
+        <template v-slot:table>
+          <limsTable ref="yearTable" :column="yearColumnData" :height="'28vh'" :highlightCurrentRow="true"
+            :rowClick="rowClick" :table-data="yearTableData" :table-loading="yearLoading"
+            style="margin-top: 0.5em;padding: 0 15px;" :page="yearPage" @pagination="pagination">
+          </limsTable>
+        </template>
+      </TableCard>
+    </div>
+    <div class="table-card">
+      <TableCard title="骞村害璁″垝鏄庣粏琛�">
+        <template v-slot:form>
+          <div class="items_center">
+            <span>鐩戠潱鐩殑锛�</span>
+            <el-input v-model="yearDetailForm.supervisePurpose" class="search" placeholder="璇疯緭鍏�"
+              size="small"></el-input>
+            <span>鐩戠潱椤圭洰锛�</span>
+            <el-input v-model="yearDetailForm.superviseProject" class="search" placeholder="璇疯緭鍏�"
+              size="small"></el-input>
+            <el-button size="small" type="primary" @click="getYearDetailPlanList">鏌ヨ</el-button>
+            <el-button size="small" @click="clearDetail">閲嶇疆</el-button>
+          </div>
+          <div>
+            <el-button size="small" type="primary" @click="showDialog('add')">鏂板</el-button>
+          </div>
+        </template>
+        <template v-slot:table>
+          <limsTable :column="yearDetailColumnData" :height="'28vh'" :table-data="yearDetailTableData"
+            :table-loading="yearDetailLoading" style="margin-top: 18px; padding: 0 15px;" :page="yearDetailPage"
+            @pagination="pagination1">
+          </limsTable>
+        </template>
+      </TableCard>
+    </div>
+    <!--鏂板淇敼寮规-->
+    <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>
+    <!--涓嶇鍚堝鐞嗘祦绋嬪脊妗�-->
+    <processing-sheet v-if="processingDia" ref="processingDia" :superviseId="superviseId"
+      @closeProcessingDia="closeProcessingDia"></processing-sheet>
+    <!--绾犳澶勭悊娴佺▼寮规-->
+    <rectify-dialog v-if="rectifyDia" ref="rectifyDia" :superviseId="superviseId"
+      @closeProcessingDia="closeRectifyDia"></rectify-dialog>
+    <el-dialog :visible.sync="ratifyDialog" title="鎵瑰噯" width="30%" @close="closeRatifyDia">
+      <span>
+        鎵瑰噯澶囨敞锛�
+        <el-input v-model="ratifyInfo.ratifyRemark" type="textarea"></el-input>
+      </span>
+      <span slot="footer" class="dialog-footer">
+        <el-button :loading="ratifyLoading" @click="handleRatify(0)">涓嶆壒鍑�</el-button>
+        <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>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="downloadDialog = false">鍙� 娑�</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import limsTable from "@/components/Table/lims-table.vue";
+import TableCard from '@/components/TableCard/index.vue';
+import DetailFormDialog from './components/detailFormDialog.vue';
+import RecordsDialog from './components/recordsDialog.vue';
+import ProcessingSheet from './components/processingSheet.vue';
+import RectifyDialog from './components/rectifyDialog.vue';
+import {
+  pageQualitySupervise,
+  ratifyQualitySupervise,
+  exportQualitySupervise,
+  delQualitySupervise,
+  pageQualitySuperviseDetail,
+  exportSuperviseDetailRecord,
+  superviseDetailAccordingExport,
+  exportSuperviseDetaillCorrect,
+  delQualitySuperviseDetail,
+} from '@/api/cnas/process/ensureResults/qualityControlPlan.js'
+export default {
+  name: 'a7-quality-control-plan',
+  // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
+  components: { RectifyDialog, ProcessingSheet, RecordsDialog, DetailFormDialog, TableCard, limsTable },
+  data() {
+    // 杩欓噷瀛樻斁鏁版嵁
+    return {
+      yearForm: {
+        superviseName: '',
+      },
+      yearPage: {
+        current: 1,
+        size: 20,
+        total: 0
+      },
+      yearColumnData: [
+        {
+          label: '璁″垝鍚嶇О',
+          prop: 'superviseName',
+          minWidth: '150px'
+        }, {
+          label: '缂栧埗浜�',
+          prop: 'writeUserName',
+          minWidth: '100'
+        }, {
+          label: '缂栧埗鏃ユ湡',
+          prop: 'writeTime',
+          minWidth: '160'
+        }, {
+          dataType: 'tag',
+          label: '鎵瑰噯鐘舵��',
+          prop: 'ratifyStatus',
+          minWidth: '100',
+          formatData: (params) => {
+            if (params === 0) {
+              return '涓嶆壒鍑�';
+            } else if (params === 1) {
+              return '鎵瑰噯';
+            } else {
+              return null;
+            }
+          },
+          formatType: (params) => {
+            if (params === 0) {
+              return 'danger';
+            } else if (params === 1) {
+              return 'success';
+            } else {
+              return null;
+            }
+          }
+        }, {
+          label: '鎵瑰噯鍐呭',
+          prop: 'ratifyRemark',
+          minWidth: '100'
+        }, {
+          label: '鎵瑰噯浜�',
+          prop: 'ratifyUserName',
+          minWidth: '100'
+        }, {
+          label: '鎵瑰噯鏃ユ湡',
+          prop: 'ratifyTime',
+          minWidth: '160'
+        }, {
+          label: '鍒涘缓鏃ユ湡',
+          prop: 'createTime',
+          minWidth: '160'
+        }, {
+          label: '鍒涘缓浜�',
+          prop: 'createUser',
+          minWidth: '100'
+        }, {
+          dataType: 'action',
+          minWidth: '170',
+          label: '鎿嶄綔',
+          fixed: 'right',
+          operation: [
+            {
+              name: '鎵瑰噯',
+              type: 'text',
+              disabled: (row) => {
+                if (row.ratifyStatus === 1) {
+                  return true
+                } else {
+                  return false
+                }
+              },
+              clickFun: (row) => {
+                this.approvalPlan(row)
+              }
+            },
+            {
+              name: '瀵煎嚭',
+              type: 'text',
+              clickFun: (row) => {
+                this.handleDown(row)
+              }
+            },
+            {
+              name: '鍒犻櫎',
+              type: 'text',
+              color: '#f56c6c',
+              clickFun: (row) => {
+                this.delPlan(row)
+              }
+            }
+          ]
+        }],
+      yearTableData: [],  // 骞磋〃
+      yearLoading: false,
+      yearDetailForm: {
+        supervisePurpose: '',
+        superviseProject: ''
+      },
+      yearDetailColumnData: [
+        {
+          label: '鐩戠潱鏃ユ湡',
+          prop: 'superviseTime',
+          minWidth: '150px'
+        }, {
+          label: '鐩戠潱鐩殑',
+          prop: 'supervisePurpose',
+          minWidth: '150px',
+          showOverflowTooltip: true,
+        }, {
+          label: '鐩戞帶椤圭洰',
+          prop: 'superviseProject',
+          minWidth: '150px'
+        }, {
+          label: '琚洃鐫d汉鍛�',
+          prop: 'supervisee',
+          minWidth: '150px'
+        }, {
+          label: '鐩戠潱鍘熷洜',
+          prop: 'superviseReason',
+          minWidth: '150px'
+        }, {
+          label: '澶囨敞',
+          prop: 'remark',
+          minWidth: '150px'
+        }, {
+          dataType: 'action',
+          width: '260',
+          label: '鎿嶄綔',
+          fixed: 'right',
+          operation: [
+            {
+              name: '缂栬緫',
+              type: 'text',
+              clickFun: (row) => {
+                this.showDialog('edit', row)
+              }
+            },
+            {
+              name: '璁板綍',
+              type: 'text',
+              clickFun: (row) => {
+                this.records(row)
+              }
+            },
+            {
+              name: '澶勭悊',
+              type: 'text',
+              clickFun: (row) => {
+                this.processing(row)
+              },
+              disabled: (row) => {
+                if (row.isAccording === 1 || row.isAccording === null) {
+                  return true
+                } else {
+                  return false
+                }
+              },
+            },
+            {
+              name: '绾犳',
+              type: 'text',
+              clickFun: (row) => {
+                this.rectify(row)
+              },
+              disabled: (row) => {
+                if (row.isAccording === 1 || row.isAccording === null || row.isCorrect === null || row.isCorrect === 0) {
+                  return true
+                } else {
+                  return false
+                }
+              },
+            },
+            {
+              name: '瀵煎嚭',
+              type: 'text',
+              clickFun: (row) => {
+                this.openDownloadDia(row);
+              },
+            },
+            {
+              name: '鍒犻櫎',
+              type: 'text',
+              color: '#f56c6c',
+              clickFun: (row) => {
+                this.delYearPlanDetail(row)
+              }
+            }
+          ]
+        }
+      ],
+      yearDetailTableData: [], // 骞存槑缁嗚〃
+      yearDetailLoading: false,
+      yearDetailPage: {
+        current: 1,
+        size: 20,
+        total: 0
+      },
+      superviseId: '',
+      formDia: false,
+      recordsDia: false,
+      processingDia: false,
+      rectifyDia: false,
+      ratifyDialog: false,
+      ratifyLoading: false,
+      ratifyInfo: {},
+      upLoading: false,
+      downloadDialog: false,
+      download: {},
+    };
+  },
+  mounted() {
+    this.getYearPlanList()
+  },
+  // 鏂规硶闆嗗悎
+  methods: {
+    // 鏌ヨ骞村害璁″垝琛�
+    getYearPlanList() {
+      const entity = {
+        superviseName: this.yearForm.superviseName,
+      }
+      const page = this.yearPage
+      this.yearLoading = true
+      pageQualitySupervise({ ...entity, ...page }).then(res => {
+        this.yearLoading = false
+        if (res.code === 201) return
+        this.yearTableData = res.data.records
+        this.yearPage.total = res.data.total
+        if (this.yearTableData.length > 0) {
+          this.rowClick(this.yearTableData[0])
+        }
+      }).catch(err => {
+        console.log('err---', err);
+        this.yearLoading = false
+      })
+    },
+    clearYear() {
+      this.yearForm.superviseName = ''
+      this.getYearPlanList()
+    },
+    // 瀵煎叆娴佺▼
+    beforeUpload(file) {
+      if (file.size > 1024 * 1024 * 10) {
+        this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10M');
+        this.$refs.upload.clearFiles()
+        return false;
+      } else {
+        this.upLoading = true;
+        return true;
+      }
+    },
+    onError(err, file, fileList) {
+      this.$message.error('涓婁紶澶辫触')
+      this.$refs.upload.clearFiles()
+    },
+    handleSuccessUp(response) {
+      this.upLoading = false;
+      if (response.code == 200) {
+        this.$message.success('涓婁紶鎴愬姛');
+        this.getYearPlanList()
+      }
+    },
+    // 鎵瑰噯
+    approvalPlan(row) {
+      this.ratifyDialog = true
+      this.ratifyInfo = row
+    },
+    handleRatify(ratifyStatus) {
+      // 鎵瑰噯鐘舵�� , 0 涓嶉�氳繃, 1閫氳繃
+      this.ratifyInfo.ratifyStatus = ratifyStatus
+      this.ratifyLoading = true
+      ratifyQualitySupervise(this.ratifyInfo).then(res => {
+        this.ratifyLoading = false
+        if (res.code === 201) return
+        this.$message.success('鎿嶄綔鎴愬姛')
+        this.closeRatifyDia()
+      }).catch(err => {
+        console.log('err---', err);
+        this.ratifyLoading = false
+      })
+    },
+    closeRatifyDia() {
+      this.ratifyDialog = false
+      this.ratifyInfo.ratifyRemark = ''
+      this.getYearPlanList()
+    },
+    // 瀵煎嚭
+    handleDown(row) {
+      exportQualitySupervise({ superviseId: row.superviseId }).then(res => {
+        this.outLoading = false
+        const blob = new Blob([res], { type: 'application/msword' });
+        this.$download.saveAs(blob, row.superviseName + '.docx')
+      })
+    },
+    // 鍒犻櫎杩涘害璁″垝琛�
+    delPlan(row) {
+      this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?', '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      }).then(() => {
+        this.yearLoading = true
+        delQualitySupervise({ superviseId: row.superviseId }).then(res => {
+          this.yearLoading = false
+          if (res.code === 201) return
+          this.$message.success('鍒犻櫎鎴愬姛')
+          this.getYearPlanList()
+        }).catch(err => {
+          this.yearLoading = false
+          console.log('err---', err);
+        })
+      }).catch(() => {
+        this.$message({
+          type: 'info',
+          message: '宸插彇娑堝垹闄�'
+        });
+      });
+    },
+    // 骞村害璁″垝琛ㄦ牸锛岀偣鍑昏鏁版嵁鍚庡埛鏂拌鎯�
+    rowClick(row) {
+      this.superviseId = row.superviseId
+      this.getYearDetailPlanList()
+    },
+    // 鑾峰彇骞村害鏄庣粏琛�
+    getYearDetailPlanList() {
+      const entity = {
+        superviseId: this.superviseId,
+        supervisePurpose: this.yearDetailForm.supervisePurpose,
+        superviseProject: this.yearDetailForm.superviseProject,
+      }
+      const page = this.yearDetailPage
+      this.yearDetailLoading = true
+      pageQualitySuperviseDetail({ ...entity, ...page }).then(res => {
+        this.yearDetailLoading = false
+        if (res.code === 201) return
+        this.yearDetailTableData = res.data.records
+        this.yearDetailPage.total = res.data.total
+      }).catch(err => {
+        console.log('err---', err);
+        this.yearDetailLoading = false
+      })
+    },
+    // 閲嶇疆鏄庣粏琛�
+    clearDetail() {
+      this.yearDetailForm = {
+        supervisePurpose: '',
+        superviseProject: ''
+      }
+      this.getYearDetailPlanList()
+    },
+    // 鎵撳紑骞村害鏄庣粏鏂板銆佷慨鏀瑰脊妗�
+    showDialog(type, row) {
+      this.formDia = true
+      this.$nextTick(() => {
+        this.$refs.formDia.openDia(type, row)
+      })
+    },
+    closeDia() {
+      this.formDia = false
+      this.getYearDetailPlanList()
+    },
+    // 璁板綍娴佺▼
+    records(row) {
+      this.recordsDia = true
+      this.$nextTick(() => {
+        this.$refs.recordsDia.openDia(row)
+      })
+    },
+    closeRecordsDia() {
+      this.recordsDia = false
+      this.getYearDetailPlanList()
+    },
+    // 涓嶇鍚堟祦绋嬪脊妗�
+    processing(row) {
+      this.processingDia = true
+      this.$nextTick(() => {
+        this.$refs.processingDia.openDia(row)
+      })
+    },
+    closeProcessingDia() {
+      this.processingDia = false
+      this.getYearDetailPlanList()
+    },
+    // 绾犳娴佺▼寮规
+    rectify(row) {
+      this.rectifyDia = true
+      this.$nextTick(() => {
+        this.$refs.rectifyDia.openDia(row)
+      })
+    },
+    closeRectifyDia() {
+      this.rectifyDia = false
+      this.getYearDetailPlanList()
+    },
+    // 鎵撳紑瀵煎嚭寮规
+    openDownloadDia(row) {
+      this.downloadDialog = true
+      this.download = row
+    },
+    // 瀵煎嚭璁板綍
+    controlDown() {
+      exportSuperviseDetailRecord({ superviseDetailsId: this.download.superviseDetailsId }).then(res => {
+        const blob = new Blob([res], { type: 'application/msword' });
+        this.$download.saveAs(blob, '璁板綍瀵煎嚭' + '.docx')
+      }).catch(err => {
+        console.log('err---', err);
+      })
+    },
+    // 澶勭悊鍗曞鍑�
+    processingDown() {
+      superviseDetailAccordingExport({
+        superviseDetailsId: this.download.superviseDetailsId
+      }).then(res => {
+        const blob = new Blob([res], { type: 'application/msword' });
+        this.$download.saveAs(blob, '涓嶇鍚堥」瀵煎嚭' + '.docx')
+      }).catch(err => {
+        console.log('err---', err);
+      })
+    },
+    // 绾犳鍗曞鍑�
+    supervisoryDown() {
+      exportSuperviseDetaillCorrect({
+        superviseDetailsCorrectId: this.download.superviseDetailsCorrectId
+      }).then(res => {
+        this.outLoading = false
+        const blob = new Blob([res], { type: 'application/msword' });
+        this.$download.saveAs(blob, '鐩戠潱绾犳鎺柦' + '.docx')
+      })
+    },
+    // 鍒犻櫎骞村害璇︽儏鍒楄〃
+    delYearPlanDetail(row) {
+      this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ暟鎹�, 鏄惁缁х画?', '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      }).then(() => {
+        this.yearDetailLoading = true
+        delQualitySuperviseDetail({
+          superviseDetailsId: row.superviseDetailsId
+        }).then(res => {
+          this.yearDetailLoading = false
+          if (res.code === 201) return
+          this.$message.success('鍒犻櫎鎴愬姛')
+          this.getYearDetailPlanList()
+        }).catch(err => {
+          this.yearDetailLoading = false
+          console.log('err---', err);
+        })
+      })
+    },
+    // 骞磋鍒掑垎椤�
+    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.getYearDetailPlanList();
+    },
+  },
+  // 鐢ㄤ簬涓婁紶鏂囦欢鐨勪俊鎭�
+  computed: {
+    action() {
+      return this.javaApi + '/qualitySupervise/importQualitySupervise'
+    }
+  },
+};
+</script>
+
+<style scoped>
+.table-card {
+  background-color: #ffffff;
+}
+
+.flex_column {
+  display: flex;
+  height: 80vh;
+  flex-direction: column;
+  overflow: auto;
+  justify-content: space-between;
+}
+
+.pagination {
+  display: flex;
+  justify-content: space-between
+}
+
+.items_center {
+  display: flex;
+  align-items: center;
+}
+
+.date_box {
+  margin: 0 5px;
+}
+
+.search {
+  width: 150px;
+  padding: 0 16px;
+}
+</style>
\ No newline at end of file

--
Gitblit v1.9.3