From 66b3c4c129b05b634d37ac7eac63eff0f0b9f426 Mon Sep 17 00:00:00 2001 From: spring <2396852758@qq.com> Date: 星期四, 27 二月 2025 10:11:52 +0800 Subject: [PATCH] 修改体系管理要求bug --- src/api/cnas/systemManagement/documentControl.js | 2 src/components/UpPdfStamp/index.vue | 4 src/views/CNAS/process/sampleDisposal/index.vue | 238 +++++++++++++++------------------ src/views/CNAS/systemManagement/measuresDealRisks/components/hazardIdentificationRiskAssessment.vue | 4 src/views/CNAS/systemManagement/measuresDealRisks/components/listRiskAnalysisControlPlans.vue | 2 package.json | 1 src/api/cnas/process/sampleDisposal.js | 9 + src/views/CNAS/systemManagement/documentControl/components/FileList.vue | 25 ++- src/views/performance/class/index.vue | 2 src/views/CNAS/systemManagement/documentControl/components/ControlledFileApplication.vue | 29 ++- src/utils/file.js | 69 ++++++--- src/views/CNAS/systemManagement/correctiveAction/index.vue | 4 12 files changed, 208 insertions(+), 181 deletions(-) diff --git a/package.json b/package.json index a4ff793..2b89237 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,7 @@ "jspdf": "^3.0.0", "mammoth": "^1.9.0", "nprogress": "0.2.0", + "pako": "^2.1.0", "print-js": "^1.6.0", "quill": "2.0.2", "screenfull": "5.0.2", diff --git a/src/api/cnas/process/sampleDisposal.js b/src/api/cnas/process/sampleDisposal.js index 9eef314..a763edd 100644 --- a/src/api/cnas/process/sampleDisposal.js +++ b/src/api/cnas/process/sampleDisposal.js @@ -63,3 +63,12 @@ params: query, }); } + +//鏌ョ湅鍘嗗彶 +export function pageProcessTotaldeal(query) { + return request({ + url: "/processTotaldeal/pageProcessTotaldeal", + method: "get", + params: query, + }); +} diff --git a/src/api/cnas/systemManagement/documentControl.js b/src/api/cnas/systemManagement/documentControl.js index 3fc97b7..9a322b4 100644 --- a/src/api/cnas/systemManagement/documentControl.js +++ b/src/api/cnas/systemManagement/documentControl.js @@ -120,7 +120,7 @@ return request({ url: "/manageDocumentIssueRecycle/addManageDocumentIssueRecycle", method: "post", - responseType: "blob", + headers: { "Content-Type": "application/x-www-form-urlencoded" }, data: data, }); } diff --git a/src/components/UpPdfStamp/index.vue b/src/components/UpPdfStamp/index.vue index e348eab..9b8fe8c 100644 --- a/src/components/UpPdfStamp/index.vue +++ b/src/components/UpPdfStamp/index.vue @@ -12,6 +12,7 @@ <script> import jsPDF from "jspdf"; +import file from '@/utils/file.js' export default { props: ['isUpFile'], data() { @@ -142,8 +143,7 @@ } const pdf = new jsPDF("p", "mm", "a4"); for (let i = 0; i < this.contextList.length; i++) { - console.log(2222, this.contextList.length, this.$refs.pdfCanvas[i]) - const imgData = this.$refs.pdfCanvas[i].toDataURL('image/jpeg', 1.0); + const imgData = this.$refs.pdfCanvas[i].toDataURL('image/jpeg', 0.7); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = (this.$refs.pdfCanvas[i].height * pdfWidth) / this.$refs.pdfCanvas[i].width; pdf.addImage(imgData, "JPEG", 0, 0, pdfWidth, pdfHeight); // 灏嗗浘鐗囨坊鍔犲埌 PDF diff --git a/src/utils/file.js b/src/utils/file.js index c3a3e7b..9c7e99e 100644 --- a/src/utils/file.js +++ b/src/utils/file.js @@ -1,48 +1,55 @@ -import { convertToHtml } from 'mammoth'; -import Vue from 'vue' +import { convertToHtml } from "mammoth"; +import pako from "pako"; +import Vue from "vue"; export default { async convertFileToHtml(url) { var xhr = new XMLHttpRequest(); - xhr.open('GET', Vue.prototype.javaApi+url, true);//鑾峰彇鏂囦欢娴佺殑鎺ュ彛 + xhr.open("GET", Vue.prototype.javaApi + url, true); //鑾峰彇鏂囦欢娴佺殑鎺ュ彛 xhr.send(); - xhr.responseType = "blob";//涓嶈兘婕� + xhr.responseType = "blob"; //涓嶈兘婕� let xhrPromise = new Promise((resolve, reject) => { xhr.onload = async function () { if (this.status === 200) { // 杩斿洖鐨勬枃浠舵祦锛岃浆鎹㈡垚blob瀵硅薄 - var blob = new Blob([this.response],{ type:'application/vnd.openxmlformats-officedocument.wordprocessingml.document' }); + var blob = new Blob([this.response], { + type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + }); // 浣跨敤mammoth灏哤ord杞崲涓篐TML let reader = new FileReader(); reader.readAsArrayBuffer(blob); let htmlContentPromise = new Promise((resolve, reject) => { reader.onload = async function () { var arrayBuffer = xhr.response; //arrayBuffer - const result = await convertToHtml({ arrayBuffer: arrayBuffer }) - let html = result.value.replace(/飪�/g, '') - .replace('<h1>', '<h1 style="text-align: center;">') - .replace(/<table>/g, '<table style="border-collapse: collapse;border: 1px solid #000;">') - .replace(/<tr>/g, '<tr style="height: 30px;">') - .replace(/<td>/g, '<td style="border: 1px solid #000;">') - .replace(/<p>/g, '<p style="text-indent: 2em;">') - .replace(/<a [^>]*>/g, "") - .replace(/<\/a>/g, "") + const result = await convertToHtml({ arrayBuffer: arrayBuffer }); + let html = result.value + .replace(/飪�/g, "") + .replace("<h1>", '<h1 style="text-align: center;">') + .replace( + /<table>/g, + '<table style="border-collapse: collapse;border: 1px solid #000;">' + ) + .replace(/<tr>/g, '<tr style="height: 30px;">') + .replace(/<td>/g, '<td style="border: 1px solid #000;">') + .replace(/<p>/g, '<p style="text-indent: 2em;">') + .replace(/<a [^>]*>/g, "") + .replace(/<\/a>/g, ""); // .replace(/em/g, "cm"); - resolve(html) + resolve(html); }; - }) - resolve(await htmlContentPromise) + }); + resolve(await htmlContentPromise); } - - } - }) - return await xhrPromise + }; + }); + return await xhrPromise; }, - downloadIamge(imgsrc, name) {//涓嬭浇鍥剧墖鍦板潃鍜屽浘鐗囧悕 + downloadIamge(imgsrc, name) { + //涓嬭浇鍥剧墖鍦板潃鍜屽浘鐗囧悕 var image = new Image(); // 瑙e喅璺ㄥ煙 Canvas 姹℃煋闂 image.setAttribute("crossOrigin", "anonymous"); - image.onload = function() { + image.onload = function () { var canvas = document.createElement("canvas"); canvas.width = image.width; canvas.height = image.height; @@ -57,5 +64,19 @@ a.dispatchEvent(event); // 瑙﹀彂a鐨勫崟鍑讳簨浠� }; image.src = imgsrc; - } + }, + // 鍘嬬缉blob + compressBlob(blob) { + const reader = new FileReader(); + reader.readAsArrayBuffer(blob); + return new Promise((resolve) => { + reader.onload = () => { + const arrayBuffer = reader.result; + const uint8Array = new Uint8Array(arrayBuffer); + const compressedData = pako.deflate(uint8Array); + const compressedBlob = new Blob([compressedData], { type: blob.type }); + resolve(compressedBlob); + }; + }); + }, }; diff --git a/src/views/CNAS/process/sampleDisposal/index.vue b/src/views/CNAS/process/sampleDisposal/index.vue index 705000e..0d12c66 100644 --- a/src/views/CNAS/process/sampleDisposal/index.vue +++ b/src/views/CNAS/process/sampleDisposal/index.vue @@ -1,20 +1,11 @@ <template> <div class="sample-disposal"> - <el-row class="title"> - <el-col :span="20" style="padding-left: 20px;text-align: left;">妫�娴嬫垨鏍″噯鐗╁搧鐨勫缃�</el-col> - <el-col :span="4" style="text-align: right;"> - <!-- <el-button size="medium" type="primary" @click="handleDown" v-loading="outLoading" style="margin-right: 16px;">瀵煎嚭</el-button> --> - </el-col> - </el-row> <el-tabs type="border-card" v-model="activeName" style="height: 100%;" @tab-click="queryParams.totaldealId = ''"> <el-tab-pane label="濉啓" name="濉啓" style="height: 100%;" :key="1"> - <el-button size="small" type="primary" @click="handleAdd0" style="margin-left: 20px;" - v-if="addPower">鏂板</el-button> + <el-button size="small" type="primary" @click="handleAdd0" style="margin-left: 20px;">鏂板</el-button> <div class="table" style="height: calc(100% - 200px)" v-if="activeName == '濉啓'"> <lims-table :tableData="tableData" :column="column" :tableLoading="tableLoading" :height="'calc(100vh - 290px)'" :page="page" @pagination="pagination"></lims-table> - <!-- <ValueTable ref="ValueTable0" :url="$api.processTotaldeal.pageProcessDeal" :componentData="componentData0" - :key="upIndex0" :delUrl="$api.processTotaldeal.delProcessDeal" /> --> </div> </el-tab-pane> <el-tab-pane label="鍘嗗彶璁板綍" name="鍘嗗彶璁板綍" style="height: 100%;" :key="2"> @@ -22,7 +13,7 @@ <div class="search_thing"> <div class="search_label">骞存湀锛�</div> <div class="search_input"> - <el-date-picker v-model="componentData.entity.month" type="month" placeholder="閫夋嫨鏈�" format="yyyy-MM" + <el-date-picker v-model="queryParams0.month" type="month" placeholder="閫夋嫨鏈�" format="yyyy-MM" value-format="yyyy-MM" size="small" @change="refreshTable()"> </el-date-picker> </div> @@ -33,8 +24,8 @@ </div> </div> <div class="table"> - <!-- <ValueTable ref="ValueTable" :url="$api.processTotaldeal.pageProcessTotaldeal" :componentData="componentData" - :key="upIndex" /> --> + <lims-table :tableData="tableData0" :column="column0" :tableLoading="tableLoading" + :height="'calc(100vh - 300px)'" :page="page0" @pagination="pagination0"></lims-table> </div> </el-tab-pane> </el-tabs> @@ -122,6 +113,7 @@ checkProcessTotaldeal, ratifyProcessTotaldeal, delProcessDeal, + pageProcessTotaldeal, } from "@/api/cnas/process/sampleDisposal"; export default { components: { @@ -142,105 +134,6 @@ noCheckLoading: false, checkLoading: false, // 鍘嗗彶鍒楄〃 - componentData: { - entity: { - month: null, - orderBy: { - field: 'id', - order: 'desc' - } - }, - isIndex: true, - showSelect: false, - select: false, - do: [{ - id: 'handleLook', - font: '鏌ョ湅', - type: 'text', - method: 'handleLook', - }, { - id: 'handleDown0', - font: '涓嬭浇', - type: 'text', - method: 'handleDown0', - disabFun: (row, index) => { - return !row.url - } - }, - // { - // id: 'handleAdd', - // font: '濉啓', - // type: 'text', - // method: 'handleAdd', - // disabFun: (row, index) => { - // return row.submitState=='宸叉彁浜�' - // } - // }, - { - id: 'handleSubmit', - font: '鎻愪氦', - type: 'text', - method: 'handleSubmit', - disabFun: (row, index) => { - return !!row.submitState && row.submitState != '寰呮彁浜�' - } - }, { - id: 'handleCheck', - font: '瀹℃牳', - type: 'text', - method: 'handleCheck', - disabFun: (row, index) => { - return row.examineState == '閫氳繃' || row.submitState == '寰呮彁浜�' - } - }, { - id: 'handleApproval', - font: '鎵瑰噯', - type: 'text', - method: 'handleApproval', - disabFun: (row, index) => { - return row.ratifyState == '閫氳繃' || row.submitState == '寰呮彁浜�' - } - }], - tagField: {}, - selectField: {}, - requiredAdd: [], - requiredUp: [], - needSort: [], - inputType: '' - }, - // 鏍峰搧鍒楄〃 - componentData0: { - entity: { - totaldealId: null, - orderBy: { - field: 'id', - order: 'desc' - } - }, - isIndex: true, - showSelect: false, - select: false, - do: [{ - id: 'handleAdd0', - font: '淇敼', - type: 'text', - method: 'handleAdd0' - }, { - id: 'delete', - font: '鍒犻櫎', - type: 'text', - method: 'doDiy' - }], - tagField: {}, - selectField: {}, - requiredAdd: [], - requiredUp: [], - needSort: [], - inputType: '' - }, - upIndex0: 100, - entityCopy: {}, - upIndex: 0, addInfo: {},//鏂板鏍峰搧 customPageList: [], currentInfo: { @@ -285,12 +178,81 @@ current: 0, }, tableLoading: false, + queryParams0: {}, + tableData0: [], + column0: [ + { label: "鏈堜唤", prop: "month" }, + { label: "鎬绘暟閲�", prop: "totalNum" }, + { label: "鎻愪氦浜�", prop: "submitUserName" }, + { label: "瀹℃牳浜�", prop: "examineUserName" }, + { label: "鎵瑰噯浜�", prop: "ratifyUserName" }, + { + dataType: "action", + fixed: "right", + label: "鎿嶄綔", + operation: [ + { + name: "鏌ョ湅", + type: "text", + clickFun: (row) => { + this.handleLook(row); + }, + }, + { + name: "涓嬭浇", + type: "text", + clickFun: (row) => { + this.handleDown0(row); + }, + disabled: (row) => { + return !row.url + } + }, + { + name: "鎻愪氦", + type: "text", + clickFun: (row) => { + this.handleSubmit(row); + }, + disabled: (row) => { + return !!row.submitState && row.submitState != '寰呮彁浜�' + } + }, + { + name: "瀹℃牳", + type: "text", + clickFun: (row) => { + this.handleCheck(row); + }, + disabled: (row) => { + return row.examineState == '閫氳繃' || row.submitState == '寰呮彁浜�' + } + }, + { + name: "鎵瑰噯", + type: "text", + clickFun: (row) => { + this.handleApproval(row); + }, + disabled: (row) => { + return row.ratifyState == '閫氳繃' || row.submitState == '寰呮彁浜�' + } + }, + ], + }, + ], + page0: { + total: 0, + size: 10, + current: 0, + }, }; }, mounted() { // this.entityCopy = this.HaveJson(this.componentData.entity); this.getCustomPageList() - // this.getPower() + this.getList() + this.getList0() }, methods: { getPower() { @@ -364,13 +326,34 @@ this.getList(); }, refresh() { - this.queryParams = {}; - this.page.current = 1; - this.getList(); + this.queryParams0 = {}; + this.page0.current = 1; + this.getList0(); }, refreshTable() { - this.page.current = 1; - this.getList(); + this.page0.current = 1; + this.getList0(); + }, + getList0() { + this.tableLoading = true; + let param = { ...this.queryParams0, ...this.page }; + delete param.total; + pageProcessTotaldeal({ ...param }) + .then((res) => { + this.tableLoading = false; + if (res.code === 200) { + this.tableData0 = res.data.records; + this.page0.total = res.data.total; + } + }) + .catch((err) => { + this.tableLoading = false; + }); + }, + pagination0({ page, limit }) { + this.page0.current = page; + this.page0.size = limit; + this.getList0(); }, // 濉啓 // handleAdd(row){ @@ -404,7 +387,8 @@ type: 'success', message: '缂栬緫鎴愬姛!' }); - this.$refs.ValueTable0.selectList() + this.page.current = 0; + this.getList(); }).catch(err => { }); } else { // 鏂板 @@ -420,7 +404,8 @@ type: 'success', message: '鏂板鎴愬姛!' }); - this.$refs.ValueTable0.selectList() + this.page.current = 0; + this.getList(); }).catch(err => { }); } }, @@ -439,7 +424,7 @@ type: 'success', message: '鎻愪氦鎴愬姛!' }); - this.$refs['ValueTable'].selectList() + this.refreshTable() }).catch(err => { }); }) }, @@ -451,7 +436,8 @@ this.activeName = '濉啓' this.queryParams.totaldealId = row.id this.$nextTick(() => { - this.$refs['ValueTable0'].selectList() + this.page.current = 0; + this.getList(); }) }, commonFun(row, callbanck) { @@ -461,8 +447,8 @@ current: -1, size: -1, ...this.queryParams }).then(res => { - this.currentInfo.arr = res.data.body.records this.lookDialogVisible = true + this.currentInfo.arr = res.data.records if (callbanck) { callbanck() } @@ -497,7 +483,7 @@ type: 'success', message: '鎿嶄綔鎴愬姛!' }); - this.$refs['ValueTable'].selectList() + this.refreshTable() this.lookDialogVisible = false }).catch(err => { }); } else if (this.title0 == '鎵瑰噯') { @@ -512,7 +498,7 @@ type: 'success', message: '鎿嶄綔鎴愬姛!' }); - this.$refs['ValueTable'].selectList() + this.refreshTable() this.lookDialogVisible = false }).catch(err => { }); } @@ -574,7 +560,6 @@ .table { background-color: #fff; - width: calc(100% - 40px); height: calc(100% - 60px - 140px); padding: 20px; } @@ -586,7 +571,6 @@ .tables { table-layout: fixed; width: 100%; - margin-top: 10px; } .tables td { diff --git a/src/views/CNAS/systemManagement/correctiveAction/index.vue b/src/views/CNAS/systemManagement/correctiveAction/index.vue index 6e92fbd..bb41fae 100644 --- a/src/views/CNAS/systemManagement/correctiveAction/index.vue +++ b/src/views/CNAS/systemManagement/correctiveAction/index.vue @@ -109,8 +109,8 @@ page: { size: 20, current: 1, + total: 0, }, - total: 0, correctiveInfo: false, viewTestRecordDialog: false, }; @@ -131,7 +131,7 @@ this.tableLoading = false if (res.code === 201) return this.tableData = res.data.records - this.total = res.data.total + this.page.total = res.data.total }).catch(err => { console.log('err---', err); this.tableLoading = false diff --git a/src/views/CNAS/systemManagement/documentControl/components/ControlledFileApplication.vue b/src/views/CNAS/systemManagement/documentControl/components/ControlledFileApplication.vue index 81b5f6a..1a25201 100644 --- a/src/views/CNAS/systemManagement/documentControl/components/ControlledFileApplication.vue +++ b/src/views/CNAS/systemManagement/documentControl/components/ControlledFileApplication.vue @@ -470,18 +470,25 @@ formData.append('state', this.type); // 鏂囦欢鍚嶅瓧娈� formData.append('writer', this.currentInfo.writer); // 鏂囦欢鍚嶅瓧娈� - let res = await checkManageDocumentControlled(formData) - this.checkLoading = false - this.noCheckLoading = false - if (res.code == 200) { - this.$message({ message: '鎿嶄綔鎴愬姛', type: 'success' }); - this.checkDialogVisible = false; - this.refreshTable() - return true - } else { - this.$message({ message: '鎿嶄綔澶辫触', type: 'error' }); - return false + try { + let res = await checkManageDocumentControlled(formData) + this.checkLoading = false + this.noCheckLoading = false + if (res.code == 200) { + this.$message({ message: '鎿嶄綔鎴愬姛', type: 'success' }); + this.checkDialogVisible = false; + this.refreshTable() + return true + } else { + this.$message({ message: '鎿嶄綔澶辫触', type: 'error' }); + return false + } + } catch (e) { + this.checkLoading = false + this.noCheckLoading = false } + + }, handleCheckSub(type) { this.type = type diff --git a/src/views/CNAS/systemManagement/documentControl/components/FileList.vue b/src/views/CNAS/systemManagement/documentControl/components/FileList.vue index 7a88db6..765c0d3 100644 --- a/src/views/CNAS/systemManagement/documentControl/components/FileList.vue +++ b/src/views/CNAS/systemManagement/documentControl/components/FileList.vue @@ -334,17 +334,22 @@ formData.append('file', pdfBlob, fileName); // 鏂囦欢瀛楁 formData.append('id', this.currentInfo.id); // 鏂囦欢鍚嶅瓧娈� - let res = await uploadFileManageDocumentList(formData) - this.addLoading = false - if (res.code == 200) { - this.$message({ message: '涓婁紶鎴愬姛', type: 'success' }); - this.addDialogVisible = false; - this.refreshTable() - return true - } else { - this.$message({ message: '涓婁紶澶辫触', type: 'error' }); - return false + try { + let res = await uploadFileManageDocumentList(formData) + this.addLoading = false + if (res.code == 200) { + this.$message({ message: '涓婁紶鎴愬姛', type: 'success' }); + this.addDialogVisible = false; + this.refreshTable() + return true + } else { + this.$message({ message: '涓婁紶澶辫触', type: 'error' }); + return false + } + } catch (e) { + this.addLoading = false } + }, handleDelete(row) { this.$confirm("鏄惁鍒犻櫎璇ユ潯鏁版嵁?", "鎻愮ず", { diff --git a/src/views/CNAS/systemManagement/measuresDealRisks/components/hazardIdentificationRiskAssessment.vue b/src/views/CNAS/systemManagement/measuresDealRisks/components/hazardIdentificationRiskAssessment.vue index 07629ec..b0c63c5 100644 --- a/src/views/CNAS/systemManagement/measuresDealRisks/components/hazardIdentificationRiskAssessment.vue +++ b/src/views/CNAS/systemManagement/measuresDealRisks/components/hazardIdentificationRiskAssessment.vue @@ -13,7 +13,7 @@ <el-button size="small" @click="openDownloadDia">瀵煎嚭</el-button> </div> </div> - <el-table :data="tableData" style="width: 100%" height="calc(100vh - 18em)"> + <el-table :data="tableData" style="width: 100%" height="calc(100vh - 18em)" key="table1"> <el-table-column type="index" label="搴忓彿" width="120"> <template v-slot="scope"> <span>{{ (page.current - 1) * page.size + scope.$index + 1 }}</span> @@ -142,7 +142,7 @@ page: { total: 0, size: 10, - current: 0, + current: 1, }, tableData: [], loading: false diff --git a/src/views/CNAS/systemManagement/measuresDealRisks/components/listRiskAnalysisControlPlans.vue b/src/views/CNAS/systemManagement/measuresDealRisks/components/listRiskAnalysisControlPlans.vue index 33adb1f..ca6e916 100644 --- a/src/views/CNAS/systemManagement/measuresDealRisks/components/listRiskAnalysisControlPlans.vue +++ b/src/views/CNAS/systemManagement/measuresDealRisks/components/listRiskAnalysisControlPlans.vue @@ -13,7 +13,7 @@ <el-button size="small" @click="openDownloadDia">瀵煎嚭</el-button> </div> </div> - <el-table :data="tableData" style="width: 100%" height="calc(100vh - 18em)"> + <el-table :data="tableData" style="width: 100%" height="calc(100vh - 18em)" key="table0"> <el-table-column type="index" label="搴忓彿" width="120"> <template v-slot="scope"> <span>{{ (search.current - 1) * search.size + scope.$index + 1 }}</span> diff --git a/src/views/performance/class/index.vue b/src/views/performance/class/index.vue index d5a7a4a..31ac64c 100644 --- a/src/views/performance/class/index.vue +++ b/src/views/performance/class/index.vue @@ -808,7 +808,7 @@ } }, getUsers() { - selectUserCondition().then((res) => { + selectUserCondition({ type: 1 }).then((res) => { if (res.code === 201) { return; } -- Gitblit v1.9.3