From 1309d6a2a55fc1cf07de57da3891a8d3230b2db8 Mon Sep 17 00:00:00 2001 From: spring <2396852758@qq.com> Date: 星期五, 21 二月 2025 16:08:54 +0800 Subject: [PATCH] 管理体系文件控制搬迁完成 --- src/api/cnas/systemManagement/documentControl.js | 277 +++ src/assets/stamps/电力.png | 0 src/views/CNAS/systemManagement/documentControl/index.vue | 67 src/views/structural/premises/index.vue | 176 +- vue.config.js | 2 src/assets/stamps/储能.png | 0 src/views/CNAS/systemManagement/documentControl/components/FileList.vue | 436 ++++++ src/views/business/materialOrderComponents/materialOrder/filesLookVisible.vue | 73 src/views/CNAS/systemManagement/documentControl/components/ControlledFileApplication.vue | 571 ++++++++ src/views/CNAS/systemManagement/documentControl/components/FileObsoletionRequest.vue | 496 ++++++ src/assets/stamps/射频.png | 0 src/views/system/menu/index.vue | 145 - src/assets/stamps/装备.png | 0 src/views/CNAS/systemManagement/documentControl/components/FileChangeRequest.vue | 706 +++++++++ src/assets/stamps/通信.png | 0 src/views/CNAS/systemManagement/documentControl/components/DistributionCollectionRecord.vue | 622 ++++++++ public/index.html | 1 src/layout/components/Sidebar/Item.vue | 3 src/views/business/inspectionTask/inspection.vue | 3 src/components/UpPdfStamp/index.vue | 165 ++ src/store/modules/tagsView.js | 238 +- src/main.js | 2 package.json | 5 src/assets/stamps/质量负责人.png | 0 src/assets/stamps/主任.png | 0 src/assets/stamps/技术负责人.png | 0 src/assets/stamps/综合室.png | 0 src/components/Preview/filePreview.vue | 229 +++ 28 files changed, 3,868 insertions(+), 349 deletions(-) diff --git a/package.json b/package.json index ec535d5..a4ff793 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,9 @@ }, "dependencies": { "@riophae/vue-treeselect": "0.4.0", + "@vue-office/docx": "^1.6.3", + "@vue-office/excel": "^1.7.14", + "@vue/composition-api": "^1.7.2", "axios": "0.28.1", "clipboard": "2.0.8", "core-js": "3.37.1", @@ -49,6 +52,7 @@ "js-beautify": "1.13.0", "js-cookie": "3.0.1", "jsencrypt": "3.0.0-rc.1", + "jspdf": "^3.0.0", "mammoth": "^1.9.0", "nprogress": "0.2.0", "print-js": "^1.6.0", @@ -60,6 +64,7 @@ "vue-barcode": "^1.3.0", "vue-count-to": "1.0.13", "vue-cropper": "0.5.5", + "vue-demi": "^0.14.10", "vue-meta": "2.4.0", "vue-qr": "^4.0.9", "vue-router": "3.4.9", diff --git a/public/index.html b/public/index.html index 7a42a58..0a54df5 100644 --- a/public/index.html +++ b/public/index.html @@ -227,4 +227,5 @@ </body> <script src="<%= BASE_URL %>luckysheet/plugins/js/plugin.js"></script> <script src="<%= BASE_URL %>luckysheet/luckysheet.umd.js"></script> + <script src="https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.16.105/pdf.min.js"></script> </html> diff --git a/src/api/cnas/systemManagement/documentControl.js b/src/api/cnas/systemManagement/documentControl.js new file mode 100644 index 0000000..2d35c9e --- /dev/null +++ b/src/api/cnas/systemManagement/documentControl.js @@ -0,0 +1,277 @@ +// 浣撶郴鏂囦欢鎺у埗鐩稿叧鎺ュ彛 +import request from "@/utils/request"; + +// 鏂囦欢娓呭崟-闄勪欢涓婁紶 +export function uploadFileManageDocumentList(data) { + return request({ + url: "/manageDocumentList/uploadFileManageDocumentList", + method: "post", + headers: { "Content-Type": "application/x-www-form-urlencoded" }, + data: data, + }); +} + +//鏂囦欢娓呭崟-鍒楄〃 +export function pageManageDocumentList(query) { + return request({ + url: "/manageDocumentList/pageManageDocumentList", + method: "get", + params: query, + }); +} + +//鏂囦欢娓呭崟-鍒犻櫎 +export function delManageDocumentList(query) { + return request({ + url: "/manageDocumentList/delManageDocumentList", + method: "delete", + params: query, + }); +} + +// 鏂囦欢娓呭崟-缂栬緫 +export function doManageDocumentList(data) { + return request({ + url: "/manageDocumentList/doManageDocumentList", + method: "post", + data: data, + }); +} + +// 鏂囦欢鍙楁帶-鏂板 +export function addManageDocumentControlled(data) { + return request({ + url: "/manageDocumentControlled/addManageDocumentControlled", + method: "post", + headers: { "Content-Type": "application/x-www-form-urlencoded" }, + data: data, + }); +} + +// 鏂囦欢鍙楁帶-淇敼 +export function doManageDocumentControlled(data) { + return request({ + url: "/manageDocumentControlled/doManageDocumentControlled", + method: "post", + headers: { "Content-Type": "application/x-www-form-urlencoded" }, + data: data, + }); +} + +//鏂囦欢鍙楁帶-鑾峰彇pdf鏂囦欢娴� +export function checkManageDocumentControlledPdf(query) { + return request({ + url: "/manageDocumentControlled/checkManageDocumentControlledPdf", + method: "get", + headers: { + responseType: "blob", + }, + params: query, + }); +} + +// 鏂囦欢鍙楁帶-瀹℃牳 +export function checkManageDocumentControlled(data) { + return request({ + url: "/manageDocumentControlled/checkManageDocumentControlled", + method: "post", + headers: { "Content-Type": "application/x-www-form-urlencoded" }, + data: data, + }); +} + +//鏂囦欢鍙楁帶-鍒犻櫎 +export function delManageDocumentControlled(query) { + return request({ + url: "/manageDocumentControlled/delManageDocumentControlled", + method: "delete", + params: query, + }); +} + +//鏂囦欢鍙楁帶-鍒楄〃 +export function pageManageDocumentControlled(query) { + return request({ + url: "/manageDocumentControlled/pageManageDocumentControlled", + method: "get", + params: query, + }); +} + +//鏂囦欢浣滃簾-鍒楄〃 +export function pageManageDocumentCancel(query) { + return request({ + url: "/manageDocumentCancel/pageManageDocumentCancel", + method: "get", + params: query, + }); +} + +// 鏂囦欢鍙戞斁鍥炴敹-瀵煎嚭 +export function exportManageDocumentIssueRecycle(query) { + return request({ + url: "/manageDocumentIssueRecycle/exportManageDocumentIssueRecycle", + method: "get", + params: query, + }); +} + +// 鏂囦欢鍙戞斁鍥炴敹-鏂板 +export function addManageDocumentIssueRecycle(data) { + return request({ + url: "/manageDocumentIssueRecycle/addManageDocumentIssueRecycle", + method: "post", + headers: { "Content-Type": "application/x-www-form-urlencoded" }, + data: data, + }); +} + +// 鏂囦欢鍙戞斁鍥炴敹-缂栬緫 +export function doManageDocumentIssueRecycle(data) { + return request({ + url: "/manageDocumentIssueRecycle/doManageDocumentIssueRecycle", + method: "post", + data: data, + }); +} + +// 鏂囦欢鍙戞斁鍥炴敹-瀹℃牳 +export function checkManageDocumentIssueRecycle(data) { + return request({ + url: "/manageDocumentIssueRecycle/checkManageDocumentIssueRecycle", + method: "post", + data: data, + }); +} + +// 鏂囦欢鍙戞斁鍥炴敹-鍒楄〃 +export function pageManageDocumentIssueRecycle(query) { + return request({ + url: "/manageDocumentIssueRecycle/pageManageDocumentIssueRecycle", + method: "get", + params: query, + }); +} + +//鏂囦欢鍙戞斁鍥炴敹-鍒楄〃 +export function delManageDocumentIssueRecycle(query) { + return request({ + url: "/manageDocumentIssueRecycle/delManageDocumentIssueRecycle", + method: "delete", + params: query, + }); +} + +// 鏂囦欢鍙樻洿-瀵煎嚭 +export function exportManageDocumentAlter(query) { + return request({ + url: "/manageDocumentAlter/exportManageDocumentAlter", + method: "get", + headers: { responseType: "blob" }, + params: query, + }); +} + +// 鏂囦欢鍙樻洿-鏂板 +export function addManageDocumentAlter(data) { + return request({ + url: "/manageDocumentAlter/addManageDocumentAlter", + method: "post", + headers: { "Content-Type": "application/x-www-form-urlencoded" }, + data: data, + }); +} + +// 鏂囦欢鍙樻洿-缂栬緫 +export function doManageDocumentAlter(data) { + return request({ + url: "/manageDocumentAlter/doManageDocumentAlter", + method: "post", + headers: { "Content-Type": "application/x-www-form-urlencoded" }, + data: data, + }); +} + +// 鏂囦欢鍙樻洿-杞崲娴� +export function checkManageDocumentAlterPdf(query) { + return request({ + url: "/manageDocumentAlter/checkManageDocumentAlterPdf", + method: "get", + headers: { responseType: "blob" }, + params: query, + }); +} + +// 鏂囦欢鍙樻洿-瀹℃牳 +export function checkManageDocumentAlter(data) { + return request({ + url: "/manageDocumentAlter/checkManageDocumentAlter", + method: "post", + headers: { "Content-Type": "application/x-www-form-urlencoded" }, + data: data, + }); +} + +//鏂囦欢鍙樻洿-鍒犻櫎 +export function delManageDocumentAlter(query) { + return request({ + url: "/manageDocumentAlter/delManageDocumentAlter", + method: "delete", + params: query, + }); +} + +// 鏂囦欢鍙樻洿-鍒楄〃 +export function pageManageDocumentAlter(query) { + return request({ + url: "/manageDocumentAlter/pageManageDocumentAlter", + method: "get", + params: query, + }); +} + +// 鏂囦欢浣滃簾-鏂板 +export function addManageDocumentCancel(data) { + return request({ + url: "/manageDocumentCancel/addManageDocumentCancel", + method: "post", + data: data, + }); +} + +// 鏂囦欢浣滃簾-缂栬緫 +export function doManageDocumentCancel(data) { + return request({ + url: "/manageDocumentCancel/doManageDocumentCancel", + method: "post", + data: data, + }); +} + +// 鏂囦欢浣滃簾-瀹℃牳 +export function checkManageDocumentCancel(data) { + return request({ + url: "/manageDocumentCancel/checkManageDocumentCancel", + method: "post", + data: data, + }); +} + +//鏂囦欢浣滃簾-瀵煎嚭 +export function exportManageDocumentCancel(query) { + return request({ + url: "/manageDocumentCancel/exportManageDocumentCancel", + method: "get", + headers: { responseType: "blob" }, + params: query, + }); +} + +//鏂囦欢浣滃簾-鍒犻櫎 +export function delManageDocumentCancel(query) { + return request({ + url: "/manageDocumentCancel/delManageDocumentCancel", + method: "delete", + params: query, + }); +} diff --git "a/src/assets/stamps/\344\270\273\344\273\273.png" "b/src/assets/stamps/\344\270\273\344\273\273.png" new file mode 100644 index 0000000..f3312ee --- /dev/null +++ "b/src/assets/stamps/\344\270\273\344\273\273.png" Binary files differ diff --git "a/src/assets/stamps/\345\202\250\350\203\275.png" "b/src/assets/stamps/\345\202\250\350\203\275.png" new file mode 100644 index 0000000..6260cad --- /dev/null +++ "b/src/assets/stamps/\345\202\250\350\203\275.png" Binary files differ diff --git "a/src/assets/stamps/\345\260\204\351\242\221.png" "b/src/assets/stamps/\345\260\204\351\242\221.png" new file mode 100644 index 0000000..b243bd8 --- /dev/null +++ "b/src/assets/stamps/\345\260\204\351\242\221.png" Binary files differ diff --git "a/src/assets/stamps/\346\212\200\346\234\257\350\264\237\350\264\243\344\272\272.png" "b/src/assets/stamps/\346\212\200\346\234\257\350\264\237\350\264\243\344\272\272.png" new file mode 100644 index 0000000..630ede1 --- /dev/null +++ "b/src/assets/stamps/\346\212\200\346\234\257\350\264\237\350\264\243\344\272\272.png" Binary files differ diff --git "a/src/assets/stamps/\347\224\265\345\212\233.png" "b/src/assets/stamps/\347\224\265\345\212\233.png" new file mode 100644 index 0000000..cb873aa --- /dev/null +++ "b/src/assets/stamps/\347\224\265\345\212\233.png" Binary files differ diff --git "a/src/assets/stamps/\347\273\274\345\220\210\345\256\244.png" "b/src/assets/stamps/\347\273\274\345\220\210\345\256\244.png" new file mode 100644 index 0000000..97fce30 --- /dev/null +++ "b/src/assets/stamps/\347\273\274\345\220\210\345\256\244.png" Binary files differ diff --git "a/src/assets/stamps/\350\243\205\345\244\207.png" "b/src/assets/stamps/\350\243\205\345\244\207.png" new file mode 100644 index 0000000..894f70d --- /dev/null +++ "b/src/assets/stamps/\350\243\205\345\244\207.png" Binary files differ diff --git "a/src/assets/stamps/\350\264\250\351\207\217\350\264\237\350\264\243\344\272\272.png" "b/src/assets/stamps/\350\264\250\351\207\217\350\264\237\350\264\243\344\272\272.png" new file mode 100644 index 0000000..dde64e9 --- /dev/null +++ "b/src/assets/stamps/\350\264\250\351\207\217\350\264\237\350\264\243\344\272\272.png" Binary files differ diff --git "a/src/assets/stamps/\351\200\232\344\277\241.png" "b/src/assets/stamps/\351\200\232\344\277\241.png" new file mode 100644 index 0000000..232e283 --- /dev/null +++ "b/src/assets/stamps/\351\200\232\344\277\241.png" Binary files differ diff --git a/src/components/Preview/filePreview.vue b/src/components/Preview/filePreview.vue new file mode 100644 index 0000000..0381a79 --- /dev/null +++ b/src/components/Preview/filePreview.vue @@ -0,0 +1,229 @@ +<template> + <div> + <div v-if="isImage"> + <img :src="imgUrl" alt="Image Preview" /> + </div> + <div v-if="isPdf"> + <object :data="fileUrl" type="application/pdf" width="100%" height="750px"> + <p>鎮ㄧ殑娴忚鍣ㄤ笉鏀寔 PDF 棰勮銆�<a :href="fileUrl">涓嬭浇 PDF 鏂囦欢</a></p> + </object> + </div> + <div v-if="isDoc"> + <p v-if="!isDocShow">鏂囨。鏃犳硶鐩存帴棰勮锛岃涓嬭浇鏌ョ湅銆�</p> + <a :href="fileUrl" v-if="!isDocShow">涓嬭浇鏂囦欢</a> + <vue-office-docx v-else :src="fileUrl" style="height: 100vh;" @rendered="renderedHandler" @error="errorHandler" /> + </div> + <div v-if="isXls"> + <p v-if="!isDocShow">鏂囨。鏃犳硶鐩存帴棰勮锛岃涓嬭浇鏌ョ湅銆�</p> + <a :href="fileUrl" v-if="!isDocShow">涓嬭浇鏂囦欢</a> + <vue-office-excel v-else :src="fileUrl" :options="options" style="height: 100vh;" @rendered="renderedHandler" + @error="errorHandler" /> + </div> + <div v-if="isZipOrRar"> + <p>鍘嬬缉鏂囦欢鏃犳硶鐩存帴棰勮锛岃涓嬭浇鏌ョ湅銆�</p> + <a :href="fileUrl">涓嬭浇鏂囦欢</a> + </div> + <div v-if="isCsv"> + <p v-if="csvList.length == 0">CSV 鏂囦欢鏃犳硶鐩存帴棰勮锛岃涓嬭浇鏌ョ湅銆�</p> + <a :href="fileUrl" v-if="csvList.length == 0">涓嬭浇鏂囦欢</a> + <el-tabs type="border-card" v-if="csvList.length > 0" tab-position="bottom"> + <el-tab-pane :label="item.sheetName" v-for="(item, index) in csvList" :key="index"> + <el-table :data="item.tableData" height="75vh"> + <el-table-column :label="m.label" :prop="m.prop" v-for="(m, i) in item.column" :key="i" min-width="120px" + show-overflow-tooltip> + <template slot-scope="scope" slot="header"> + <div> + <el-tooltip :content="m.label" placement="top"> + <div class="oneLine"> + <span>{{ m.label }}</span> + </div> + </el-tooltip> + </div> + </template> + </el-table-column> + </el-table> + </el-tab-pane> + </el-tabs> + </div> + <div v-if="!isSupported"> + <p>涓嶆敮鎸佺殑鏂囦欢鏍煎紡</p> + </div> + </div> +</template> + +<script> +import VueOfficeDocx from '@vue-office/docx' +//寮曞叆鐩稿叧鏍峰紡 +import '@vue-office/docx/lib/index.css' +import VueOfficeExcel from '@vue-office/excel' +//寮曞叆鐩稿叧鏍峰紡 +import '@vue-office/excel/lib/index.css' +export default { + components: { + VueOfficeDocx, + VueOfficeExcel, + }, + props: { + fileUrl: { + type: String, + required: true + }, + currentFile: { + type: Object, + required: true + }, + }, + data() { + return { + isDocShow: true, + options: { + xls: false, //棰勮xlsx鏂囦欢璁句负false锛涢瑙坸ls鏂囦欢璁句负true + minColLength: 0, // excel鏈�灏戞覆鏌撳灏戝垪锛屽鏋滄兂瀹炵幇xlsx鏂囦欢鍐呭鏈夊嚑鍒楋紝灏辨覆鏌撳嚑鍒楋紝鍙互灏嗘鍊艰缃负0. + minRowLength: 0, // excel鏈�灏戞覆鏌撳灏戣锛屽鏋滄兂瀹炵幇鏍规嵁xlsx瀹為檯鍑芥暟娓叉煋锛屽彲浠ュ皢姝ゅ�艰缃负0. + widthOffset: 10, //濡傛灉娓叉煋鍑烘潵鐨勭粨鏋滄劅瑙夊崟鍏冩牸瀹藉害涓嶅锛屽彲浠ュ湪榛樿娓叉煋鐨勫垪琛ㄥ搴︿笂鍐嶅姞 Npx瀹� + heightOffset: 10, //鍦ㄩ粯璁ゆ覆鏌撶殑鍒楄〃楂樺害涓婂啀鍔� Npx楂� + beforeTransformData: (workbookData) => { return workbookData }, //搴曞眰閫氳繃exceljs鑾峰彇excel鏂囦欢鍐呭锛岄�氳繃璇ラ挬瀛愬嚱鏁帮紝鍙互瀵硅幏鍙栫殑excel鏂囦欢鍐呭杩涜淇敼锛屾瘮濡傛煇涓崟鍏冩牸鐨勬暟鎹樉绀轰笉姝g‘锛屽彲浠ュ湪姝よ嚜琛屼慨鏀规瘡涓崟鍏冩牸鐨剉alue鍊笺�� + transformData: (workbookData) => { return workbookData }, //灏嗚幏鍙栧埌鐨別xcel鏁版嵁杩涜澶勭悊涔嬪悗涓旀覆鏌撳埌椤甸潰涔嬪墠锛屽彲閫氳繃transformData瀵瑰嵆灏嗘覆鏌撶殑鏁版嵁鍙婃牱寮忚繘琛屼慨鏀癸紝姝ゆ椂姣忎釜鍗曞厓鏍肩殑text鍊煎氨鏄嵆灏嗘覆鏌撳埌椤甸潰涓婄殑鍐呭 + }, + csvList: [],//csv鏂囦欢鏁版嵁 + imgUrl: '' + } + }, + computed: { + isImage() { + let state = /\.(jpg|jpeg|png|gif)$/i.test(this.fileUrl) + this.imgUrl = this.fileUrl + if (state) { + this.imgUrl = this.fileUrl.replaceAll('word', 'img') + } + return state; + }, + isPdf() { + return /\.pdf$/i.test(this.fileUrl); + }, + isDoc() { + return /\.(doc|docx)$/i.test(this.fileUrl); + }, + isXls() { + let state = /\.(xls|xlsx)$/i.test(this.fileUrl) + if (state) { + if (/\.(xlsx)$/i.test(this.fileUrl)) { + this.options.xls = false + } else { + this.options.xls = true + } + } + return state; + }, + isZipOrRar() { + return /\.(zip|rar)$/i.test(this.fileUrl); + }, + isCsv() { + let state = /\.csv$/i.test(this.fileUrl) + if (state) { + this.loadCSVData(); + // this.main() + } + return state; + }, + isSupported() { + return this.isImage || this.isPdf || this.isDoc || this.isZipOrRar || this.isCsv || this.isXls; + } + }, + methods: { + renderedHandler() { + console.log("娓叉煋瀹屾垚") + this.isDocShow = true + this.resetStyle() + }, + errorHandler() { + console.log("娓叉煋澶辫触") + this.isDocShow = false + }, + async loadCSVData() { + this.$axios.post(this.$api.insOrderPlan.preview, { + id: this.currentFile.id, + }).then(res => { + let arr = res.data + arr = arr.map(m => { + let obj = { + sheetName: m.sheetName, + tableData: [], + column: [] + } + obj.tableData = this.formatCSVToTable(m.content.replaceAll('null', ' ')) + // .replaceAll('MIN','=MIN').replaceAll('MAX','=MAX').replaceAll('AVERAGE','=AVERAGE') + for (let item in obj.tableData[0]) { + obj.column.push({ + label: item, + prop: item, + }) + } + return obj + }) + this.csvList = arr + }).catch(err => { + console.log(err) + }) + }, + formatCSVToTable(str) { + const result = []; + const jsonObj = str.split("\n"); + let arrHeader = []; + for (const i in jsonObj) { + if (typeof jsonObj[i] === 'string' && jsonObj[i].length > 0) { + const row = `${jsonObj[i]}`; + if (row.trim().length > 0) { + const kv = jsonObj[i].split(','); + if (i == 0) { + // 鑾峰彇column琛ㄥご + arrHeader = kv; + } else { + const obj = {}; + for (let index = 0; index < arrHeader.length; index++) { + // 缁勮琛ㄦ牸鏁版嵁 + const name = String(arrHeader[index]); + if (!arrHeader[index]) continue + if (!obj[name]) { + try { + if (kv[index]) { + obj[name] = String(kv[index]); + } else { + obj[name] = ''; + } + } catch (err) { + obj[name] = ''; + } + } + } + result.push(obj); + } + } + } + } + return result + }, + resetStyle() { + const elements = document.querySelectorAll('[style*="pt"]'); + for (const element of elements) { + const style = element.getAttribute('style'); + if (!!style) { + element.setAttribute('style', style.replace(/pt/g, 'px')); + } + } + }, + } +} +</script> + +<style scoped> +img { + max-width: 100%; +} + +.oneLine { + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} +</style> diff --git a/src/components/UpPdfStamp/index.vue b/src/components/UpPdfStamp/index.vue new file mode 100644 index 0000000..e348eab --- /dev/null +++ b/src/components/UpPdfStamp/index.vue @@ -0,0 +1,165 @@ +<template> + <div class="up-pdf-stamp"> + <div class="work" style="display: flex;justify-content: space-between;align-items: center;margin-bottom: 10px;" + v-if="isUpFile"> + <input type="file" @change="handleFileUpload" accept="application/pdf" ref="fileInput" /> + </div> + <p style="color: red;font-size: 12px;margin: 16px 0;" v-if="canvasNumPages > 0">鎻愮ず锛氬湪鏂囦欢鑼冨洿鍐咃紝鍗曞嚮榧犳爣鐩栫珷锛屽弻鍑婚紶鏍囧凡鐩栧ソ绔犲鍙垹闄ゅ綋鍓嶇珷</p> + <canvas ref="pdfCanvas" @click="e => handleCanvasClick(e, index)" style="border: 1px solid #000;" + @dblclick="e => removeStamp(e, index)" v-for="(item, index) in canvasNumPages" :key="index"></canvas> + </div> +</template> + +<script> +import jsPDF from "jspdf"; +export default { + props: ['isUpFile'], + data() { + return { + pdfDoc: null, // 瀛樺偍涓婁紶鐨� PDF 鏁版嵁 + stamps: [], // 璁板綍鐩栫珷鐨勪綅缃� + contextList: [],//canvas鍒楄〃 + canvasNumPages: 0,// 瀛樺偍 PDF 鎬婚〉鏁� + stampWidth: 120, // 鐩栫珷瀹藉害 + stampHeight: 80, // 鐩栫珷楂樺害 + stampsName: '', + stampsList: ['涓讳换', '璐ㄩ噺璐熻矗浜�', '鎶�鏈礋璐d汉', '缁煎悎瀹�', '閫氫俊', '鐢靛姏', '瑁呭', '鍌ㄨ兘', '灏勯'], + fileName: '鏂囦欢鍚�' + }; + }, + methods: { + handleFileUpload(event) { + const file = event.target.files[0]; + if (file.size > 20 * 1024 * 1024) { + this.$refs.fileInput.value = ""; // 娓呯┖鏂囦欢杈撳叆妗嗗唴瀹� + return this.$message.error('鏂囦欢澶у皬涓嶈兘瓒呰繃20M') + } + this.lookFile(file) + }, + lookFile(file, currentStamp) { + this.fileName = file.name + if (currentStamp) { + this.stampsName = currentStamp + } else { + const index = this.stampsList.indexOf(m => file.name.includes(m)) + if (index > -1) { + this.stampsName = this.stampsList[index] + } else { + this.stampsName = '缁煎悎瀹�' + } + } + if (file && file.type === 'application/pdf') { + const reader = new FileReader(); + reader.onload = (e) => { + const typedArray = new Uint8Array(e.target.result); + this.loadPDF(typedArray); + }; + reader.readAsArrayBuffer(file); + } else { + this.$message.error('璇烽�夋嫨 PDF 鏂囦欢'); + } + }, + loadPDF(typedArray) { + pdfjsLib.getDocument(typedArray).promise.then(pdfDoc_ => { + this.pdfDoc = pdfDoc_; + this.canvasNumPages = this.pdfDoc._pdfInfo.numPages + this.stamps = [] + this.contextList = [] + for (let i = 1; i <= this.canvasNumPages; i++) { + this.$nextTick(() => { + this.renderPage(i); // 娓叉煋椤甸潰 + }); + this.stamps.push([]) + } + }); + }, + // 娓叉煋鎸囧畾椤甸潰 + renderPage(pageNum) { + this.pdfDoc.getPage(pageNum).then(page => { + const canvas = this.$refs.pdfCanvas[pageNum - 1]; + this.contextList.push(canvas.getContext("2d")) + const viewport = page.getViewport({ scale: 1.5 }); + + canvas.width = viewport.width; + canvas.height = viewport.height; + + page.render({ + canvasContext: this.contextList[pageNum - 1], + viewport: viewport + }).promise.then(() => { + this.stamps[pageNum - 1].forEach(m => { + this.drawStamps(m.x, m.y, pageNum - 1) + }) + }); + }); + }, + // 鍗曞嚮--娣诲姞绔� + handleCanvasClick(event, i) { + const x = event.offsetX; + const y = event.offsetY; + const index = this.stamps[i].findIndex(stamp => { + let x0 = x - stamp.x; + let y0 = y - stamp.y; + return x0 > 0 && x0 < this.stampWidth && y0 > 0 && y0 < this.stampHeight; + }); + if (index > -1) return; + this.drawStamps(x, y, i) + this.stamps[i].push({ x, y }); + }, + // 鍙屽嚮--鍒犻櫎鐩栫珷 + removeStamp(event, i) { + const x = event.offsetX; + const y = event.offsetY; + // 鏌ユ壘琚弻鍑荤殑鐩栫珷 + const index = this.stamps[i].findIndex(stamp => { + let x0 = x - stamp.x; + let y0 = y - stamp.y; + return x0 > 0 && x0 < this.stampWidth && y0 > 0 && y0 < this.stampHeight; + }); + if (index === -1) return; + this.stamps[i].splice(index, 1); // 鍒犻櫎鎸囧畾鐨勭洊绔� + this.contextList[i].clearRect(0, 0, this.contextList[i].width, this.contextList[i].height); + this.renderPage(i + 1) + }, + // 娓叉煋绔� + drawStamps(x, y, index) { + var img = new Image(); + console.log(this.stampsName) + // 璁剧疆鍥剧墖婧� + img.src = require("@/assets/stamps/" + this.stampsName + ".png"); // 鏇挎崲涓轰綘鐨勫浘鐗囬摼鎺� + let that = this + img.onload = function () { + // 鍥剧墖鍔犺浇瀹屾垚鍚庯紝灏嗗浘鐗囩粯鍒跺埌canvas涓� + that.contextList[index].drawImage(img, x, y, that.stampWidth, that.stampHeight); + }; + }, + // 鐢熸垚 PDF 鐨勫嚱鏁� + async generatePDF() { + if (this.contextList.length === 0) { + this.$message({ message: '璇峰厛涓婁紶PDF鏂囦欢', type: 'error' }); + this.$emit('uploadPDFErr') + return false + } + 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 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 + if (i !== this.contextList.length - 1) { + pdf.addPage(); // 娣诲姞鏂扮殑涓�椤� + } + } + + // 灏� PDF 鏂囦欢淇濆瓨鎴栦笂浼� + const pdfOutput = pdf.output('blob'); // 鑾峰彇 PDF 鏂囦欢鐨� Blob 瀵硅薄 + + // 涓婁紶鍒板悗绔� + return this.$emit('uploadPDF', pdfOutput, this.fileName) + }, + } +} +</script> + +<style scoped></style> diff --git a/src/layout/components/Sidebar/Item.vue b/src/layout/components/Sidebar/Item.vue index be3285d..69a9858 100644 --- a/src/layout/components/Sidebar/Item.vue +++ b/src/layout/components/Sidebar/Item.vue @@ -17,11 +17,12 @@ const vnodes = [] if (icon) { - vnodes.push(<svg-icon icon-class={icon}/>) + vnodes.push(<svg-icon icon-class={icon} />) } if (title) { if (title.length > 5) { + // vnodes.push(<el-tooltip class="item" effect="dark" content={(title)} placement="top-end"><span slot='title' title={(title)}>{(title)}</span></el-tooltip>) vnodes.push(<span slot='title' title={(title)}>{(title)}</span>) } else { vnodes.push(<span slot='title'>{(title)}</span>) diff --git a/src/main.js b/src/main.js index f0f2eb0..9ae30ea 100644 --- a/src/main.js +++ b/src/main.js @@ -65,7 +65,7 @@ }; Vue.prototype.javaApi = process.env.VUE_APP_BASE_API ? process.env.VUE_APP_BASE_API - : "http://192.168.0.170:8002"; + : "http://192.168.1.36:8002"; Vue.prototype.checkPermi = checkPermi; // 鍏ㄥ眬缁勪欢鎸傝浇 diff --git a/src/store/modules/tagsView.js b/src/store/modules/tagsView.js index 5fc011c..b4e4e55 100644 --- a/src/store/modules/tagsView.js +++ b/src/store/modules/tagsView.js @@ -1,228 +1,234 @@ const state = { visitedViews: [], cachedViews: [], - iframeViews: [] -} + iframeViews: [], +}; const mutations = { ADD_IFRAME_VIEW: (state, view) => { - if (state.iframeViews.some(v => v.path === view.path)) return + if (state.iframeViews.some((v) => v.path === view.path)) return; state.iframeViews.push( Object.assign({}, view, { - title: view.meta.title || 'no-name' + title: view.meta.title || "no-name", }) - ) + ); }, ADD_VISITED_VIEW: (state, view) => { - if (state.visitedViews.some(v => v.path === view.path)) return + if (state.visitedViews.some((v) => v.path === view.path)) return; state.visitedViews.push( Object.assign({}, view, { - title: view.meta.title || 'no-name' + title: view.meta.title || "no-name", }) - ) + ); }, ADD_CACHED_VIEW: (state, view) => { - if (state.cachedViews.includes(view.name)) return + if (state.cachedViews.includes(view.name)) return; if (view.meta && !view.meta.noCache) { - state.cachedViews.push(view.name) + state.cachedViews.push(view.name); } }, DEL_VISITED_VIEW: (state, view) => { for (const [i, v] of state.visitedViews.entries()) { if (v.path === view.path) { - state.visitedViews.splice(i, 1) - break + state.visitedViews.splice(i, 1); + break; } } - state.iframeViews = state.iframeViews.filter(item => item.path !== view.path) + state.iframeViews = state.iframeViews.filter( + (item) => item.path !== view.path + ); }, DEL_IFRAME_VIEW: (state, view) => { - state.iframeViews = state.iframeViews.filter(item => item.path !== view.path) + state.iframeViews = state.iframeViews.filter( + (item) => item.path !== view.path + ); }, DEL_CACHED_VIEW: (state, view) => { - const index = state.cachedViews.indexOf(view.name) - index > -1 && state.cachedViews.splice(index, 1) + const index = state.cachedViews.indexOf(view.name); + index > -1 && state.cachedViews.splice(index, 1); }, DEL_OTHERS_VISITED_VIEWS: (state, view) => { - state.visitedViews = state.visitedViews.filter(v => { - return v.meta.affix || v.path === view.path - }) - state.iframeViews = state.iframeViews.filter(item => item.path === view.path) + state.visitedViews = state.visitedViews.filter((v) => { + return v.meta.affix || v.path === view.path; + }); + state.iframeViews = state.iframeViews.filter( + (item) => item.path === view.path + ); }, DEL_OTHERS_CACHED_VIEWS: (state, view) => { - const index = state.cachedViews.indexOf(view.name) + const index = state.cachedViews.indexOf(view.name); if (index > -1) { - state.cachedViews = state.cachedViews.slice(index, index + 1) + state.cachedViews = state.cachedViews.slice(index, index + 1); } else { - state.cachedViews = [] + state.cachedViews = []; } }, - DEL_ALL_VISITED_VIEWS: state => { + DEL_ALL_VISITED_VIEWS: (state) => { // keep affix tags - const affixTags = state.visitedViews.filter(tag => tag.meta.affix) - state.visitedViews = affixTags - state.iframeViews = [] + const affixTags = state.visitedViews.filter((tag) => tag.meta.affix); + state.visitedViews = affixTags; + state.iframeViews = []; }, - DEL_ALL_CACHED_VIEWS: state => { - state.cachedViews = [] + DEL_ALL_CACHED_VIEWS: (state) => { + state.cachedViews = []; }, UPDATE_VISITED_VIEW: (state, view) => { for (let v of state.visitedViews) { if (v.path === view.path) { - v = Object.assign(v, view) - break + v = Object.assign(v, view); + break; } } }, DEL_RIGHT_VIEWS: (state, view) => { - const index = state.visitedViews.findIndex(v => v.path === view.path) + const index = state.visitedViews.findIndex((v) => v.path === view.path); if (index === -1) { - return + return; } state.visitedViews = state.visitedViews.filter((item, idx) => { if (idx <= index || (item.meta && item.meta.affix)) { - return true + return true; } - const i = state.cachedViews.indexOf(item.name) + const i = state.cachedViews.indexOf(item.name); if (i > -1) { - state.cachedViews.splice(i, 1) + state.cachedViews.splice(i, 1); } - if(item.meta.link) { - const fi = state.iframeViews.findIndex(v => v.path === item.path) - state.iframeViews.splice(fi, 1) + if (item.meta.link) { + const fi = state.iframeViews.findIndex((v) => v.path === item.path); + state.iframeViews.splice(fi, 1); } - return false - }) + return false; + }); }, DEL_LEFT_VIEWS: (state, view) => { - const index = state.visitedViews.findIndex(v => v.path === view.path) + const index = state.visitedViews.findIndex((v) => v.path === view.path); if (index === -1) { - return + return; } state.visitedViews = state.visitedViews.filter((item, idx) => { if (idx >= index || (item.meta && item.meta.affix)) { - return true + return true; } - const i = state.cachedViews.indexOf(item.name) + const i = state.cachedViews.indexOf(item.name); if (i > -1) { - state.cachedViews.splice(i, 1) + state.cachedViews.splice(i, 1); } - if(item.meta.link) { - const fi = state.iframeViews.findIndex(v => v.path === item.path) - state.iframeViews.splice(fi, 1) + if (item.meta.link) { + const fi = state.iframeViews.findIndex((v) => v.path === item.path); + state.iframeViews.splice(fi, 1); } - return false - }) - } -} + return false; + }); + }, +}; const actions = { addView({ dispatch }, view) { - dispatch('addVisitedView', view) - dispatch('addCachedView', view) + dispatch("addVisitedView", view); + dispatch("addCachedView", view); }, addIframeView({ commit }, view) { - commit('ADD_IFRAME_VIEW', view) + commit("ADD_IFRAME_VIEW", view); }, addVisitedView({ commit }, view) { - commit('ADD_VISITED_VIEW', view) + commit("ADD_VISITED_VIEW", view); }, addCachedView({ commit }, view) { - commit('ADD_CACHED_VIEW', view) + commit("ADD_CACHED_VIEW", view); }, delView({ dispatch, state }, view) { - return new Promise(resolve => { - dispatch('delVisitedView', view) - dispatch('delCachedView', view) + return new Promise((resolve) => { + dispatch("delVisitedView", view); + dispatch("delCachedView", view); resolve({ visitedViews: [...state.visitedViews], - cachedViews: [...state.cachedViews] - }) - }) + cachedViews: [...state.cachedViews], + }); + }); }, delVisitedView({ commit, state }, view) { - return new Promise(resolve => { - commit('DEL_VISITED_VIEW', view) - resolve([...state.visitedViews]) - }) + return new Promise((resolve) => { + commit("DEL_VISITED_VIEW", view); + resolve([...state.visitedViews]); + }); }, delIframeView({ commit, state }, view) { - return new Promise(resolve => { - commit('DEL_IFRAME_VIEW', view) - resolve([...state.iframeViews]) - }) + return new Promise((resolve) => { + commit("DEL_IFRAME_VIEW", view); + resolve([...state.iframeViews]); + }); }, delCachedView({ commit, state }, view) { - return new Promise(resolve => { - commit('DEL_CACHED_VIEW', view) - resolve([...state.cachedViews]) - }) + return new Promise((resolve) => { + commit("DEL_CACHED_VIEW", view); + resolve([...state.cachedViews]); + }); }, delOthersViews({ dispatch, state }, view) { - return new Promise(resolve => { - dispatch('delOthersVisitedViews', view) - dispatch('delOthersCachedViews', view) + return new Promise((resolve) => { + dispatch("delOthersVisitedViews", view); + dispatch("delOthersCachedViews", view); resolve({ visitedViews: [...state.visitedViews], - cachedViews: [...state.cachedViews] - }) - }) + cachedViews: [...state.cachedViews], + }); + }); }, delOthersVisitedViews({ commit, state }, view) { - return new Promise(resolve => { - commit('DEL_OTHERS_VISITED_VIEWS', view) - resolve([...state.visitedViews]) - }) + return new Promise((resolve) => { + commit("DEL_OTHERS_VISITED_VIEWS", view); + resolve([...state.visitedViews]); + }); }, delOthersCachedViews({ commit, state }, view) { - return new Promise(resolve => { - commit('DEL_OTHERS_CACHED_VIEWS', view) - resolve([...state.cachedViews]) - }) + return new Promise((resolve) => { + commit("DEL_OTHERS_CACHED_VIEWS", view); + resolve([...state.cachedViews]); + }); }, delAllViews({ dispatch, state }, view) { - return new Promise(resolve => { - dispatch('delAllVisitedViews', view) - dispatch('delAllCachedViews', view) + return new Promise((resolve) => { + dispatch("delAllVisitedViews", view); + dispatch("delAllCachedViews", view); resolve({ visitedViews: [...state.visitedViews], - cachedViews: [...state.cachedViews] - }) - }) + cachedViews: [...state.cachedViews], + }); + }); }, delAllVisitedViews({ commit, state }) { - return new Promise(resolve => { - commit('DEL_ALL_VISITED_VIEWS') - resolve([...state.visitedViews]) - }) + return new Promise((resolve) => { + commit("DEL_ALL_VISITED_VIEWS"); + resolve([...state.visitedViews]); + }); }, delAllCachedViews({ commit, state }) { - return new Promise(resolve => { - commit('DEL_ALL_CACHED_VIEWS') - resolve([...state.cachedViews]) - }) + return new Promise((resolve) => { + commit("DEL_ALL_CACHED_VIEWS"); + resolve([...state.cachedViews]); + }); }, updateVisitedView({ commit }, view) { - commit('UPDATE_VISITED_VIEW', view) + commit("UPDATE_VISITED_VIEW", view); }, delRightTags({ commit }, view) { - return new Promise(resolve => { - commit('DEL_RIGHT_VIEWS', view) - resolve([...state.visitedViews]) - }) + return new Promise((resolve) => { + commit("DEL_RIGHT_VIEWS", view); + resolve([...state.visitedViews]); + }); }, delLeftTags({ commit }, view) { - return new Promise(resolve => { - commit('DEL_LEFT_VIEWS', view) - resolve([...state.visitedViews]) - }) + return new Promise((resolve) => { + commit("DEL_LEFT_VIEWS", view); + resolve([...state.visitedViews]); + }); }, -} +}; export default { namespaced: true, state, mutations, - actions -} + actions, +}; diff --git a/src/views/CNAS/systemManagement/documentControl/components/ControlledFileApplication.vue b/src/views/CNAS/systemManagement/documentControl/components/ControlledFileApplication.vue new file mode 100644 index 0000000..81b5f6a --- /dev/null +++ b/src/views/CNAS/systemManagement/documentControl/components/ControlledFileApplication.vue @@ -0,0 +1,571 @@ +<template> + <!-- 鏂囦欢鍙楁帶鐢宠 --> + <div class="controlled-file-application" style="height: 100%;"> + <div class="search"> + <div class="search_thing"> + <div class="search_label">鐢宠鏂囦欢缂栧彿锛�</div> + <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="queryParams.documentCode" + @keyup.enter.native="refreshTable()"></el-input></div> + </div> + <!-- <div class="search_thing"> + <div class="search_label">鐢宠浜猴細</div> + <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable + v-model="queryParams.createUserName" @keyup.enter.native="refreshTable()"></el-input></div> + </div> --> + <div class="search_thing" style="padding-left: 30px;"> + <el-button size="small" @click="refresh()">閲� 缃�</el-button> + <el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button> + </div> + <div class="btns" style="padding-left: 30px;"> + <el-button size="small" type="primary" + @click="addDialogVisible = true, addInfo = {}, file = null">鏂囦欢鍙楁帶鐢宠</el-button> + </div> + </div> + <div class="table"> + <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading" + :height="'calc(100vh - 290px)'" @pagination="pagination"></lims-table> + </div> + <el-dialog title="鏂囦欢鍙楁帶鐢宠" :visible.sync="addDialogVisible" width="800px" top="10vh"> + <el-row> + <el-col :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label"><span style="color:red;margin-right: 4px;">*</span>鐢宠缂栧彿锛�</div> + <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable + v-model="addInfo.documentCode"></el-input></div> + </div> + </el-col> + <el-col :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">璐d换浜猴細</div> + <div class="search_input"> + <el-select v-model="addInfo.dutyUser" size="small" style="width: 100%;" filterable> + <el-option v-for="item in personList" :key="item.value" :label="item.label" :value="item.value"> + </el-option> + </el-select> + </div> + </div> + </el-col> + <el-col :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">鏂囦欢绫诲埆锛�</div> + <div class="search_input"> + <el-select v-model="addInfo.type" size="small" style="width: 100%;"> + <el-option v-for="item in fileType" :key="item.value" :label="item.label" :value="item.value"> + </el-option> + </el-select> + </div> + </div> + </el-col> + <el-col :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">鏂囦欢鍚嶇О锛�</div> + <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable + v-model="addInfo.name"></el-input></div> + </div> + </el-col> + <el-col :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">鏂囦欢鐗堟湰锛�</div> + <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable + v-model="addInfo.version"></el-input></div> + </div> + </el-col> + <el-col :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">涓婁紶闄勪欢锛�</div> + <div class="search_input"><el-upload style="margin: 8px 0 0px 50px;" action="#" :auto-upload="false" + :multiple="false" accept='.pdf' :on-change="handleChangeUpload" v-if="addDialogVisible"> + <el-button size="small" type="primary">涓婁紶闄勪欢</el-button> + </el-upload></div> + </div> + </el-col> + <el-col :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">浣滆�咃細</div> + <div class="search_input"> + <!-- <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="addInfo.writer"></el-input> --> + <el-select v-model="addInfo.writer" size="small" style="width: 100%;" filterable> + <el-option v-for="item in personList" :key="item.value" :label="item.label" :value="item.label"> + </el-option> + </el-select> + </div> + </div> + </el-col> + <el-col :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">鎻愪氦鏃ユ湡锛�</div> + <div class="search_input"> + <el-date-picker v-model="addInfo.submitDate" type="date" size="small" placeholder="閫夋嫨鏃ユ湡" + format="yyyy-MM-dd" value-format="yyyy-MM-dd" style="width: 100%;"> + </el-date-picker> + </div> + </div> + </el-col> + <el-col :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">璇存槑锛�</div> + <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="addInfo.instructions" + type="textarea" :rows="2"></el-input></div> + </div> + </el-col> + </el-row> + <span slot="footer" class="dialog-footer"> + <el-button @click="addDialogVisible = false">鍙� 娑�</el-button> + <el-button type="primary" @click="handleAdd" :loading="addLoading">纭� 瀹�</el-button> + </span> + </el-dialog> + <el-dialog title="鏌ョ湅闄勪欢" :visible.sync="lookDialogVisible" width="800px" top="5vh" fullscreen> + <filePreview v-if="lookDialogVisible" :fileUrl="javaApi + '/word/' + currentInfo.url" :currentFile="{}" + style="height: 90vh;overflow-y: auto;" /> + </el-dialog> + <el-dialog title="瀹℃牳" :visible.sync="checkDialogVisible" width="1000px" top="5vh"> + <UpPdfStamp ref="UpPdfStamp" v-if="checkDialogVisible" @uploadPDF="uploadPDF" :isUpFile="false"></UpPdfStamp> + <span slot="footer" class="dialog-footer"> + <el-button @click="handleCheckSub('涓嶉�氳繃')" :loading="noCheckLoading">涓嶉�氳繃</el-button> + <el-button type="primary" @click="handleCheckSub('閫氳繃')" :loading="checkLoading">閫� 杩�</el-button> + </span> + </el-dialog> + <el-dialog title="閫夋嫨鍙楁帶绔�" :visible.sync="checkStampDialogVisible" width="600px" top="5vh"> + <div class="stamp-list"> + <img :src="require('@/assets/stamps/' + item + '.png')" alt="" v-for="(item, index) in stampsList" :key="index" + style="width: 120px;height: 80px;margin: 6px;" class="stamp" :class="{ active: currentStamp == item }" + @click="currentStamp = item"> + </div> + <span slot="footer" class="dialog-footer"> + <el-button @click="checkStampDialogVisible = false">鍙� 娑�</el-button> + <el-button type="primary" @click="handleCheck0(currentInfo)">纭� 瀹�</el-button> + </span> + </el-dialog> + </div> +</template> + +<script> +import UpPdfStamp from '@/components/UpPdfStamp/index.vue' +import filePreview from '@/components/Preview/filePreview.vue' +import limsTable from "@/components/Table/lims-table.vue"; +import { + selectUserCondition, +} from "@/api/business/inspectionTask.js"; +import { + addManageDocumentControlled, + doManageDocumentControlled, + checkManageDocumentControlledPdf, + delManageDocumentControlled, + pageManageDocumentControlled, + checkManageDocumentControlled, +} from '@/api/cnas/systemManagement/documentControl.js' +import { mapGetters } from "vuex"; +export default { + components: { + filePreview, + UpPdfStamp, + limsTable + }, + computed: { + ...mapGetters(["nickName"]), + }, + data() { + return { + upLoading: false, + addPower: false, + addDialogVisible: false, + addLoading: false, + lookDialogVisible: false, + checkDialogVisible: false, + checkStampDialogVisible: false, + addInfo: {}, + personList: [], + fileType: [], + file: null, + currentInfo: {}, + checkLoading: false, + noCheckLoading: false, + type: '', + stampsList: ['涓讳换', '璐ㄩ噺璐熻矗浜�', '鎶�鏈礋璐d汉', '缁煎悎瀹�', '閫氫俊', '鐢靛姏', '瑁呭', '鍌ㄨ兘', '灏勯'], + currentStamp: '涓讳换', + queryParams: {}, + tableData: [], + column: [ + { label: "鐢宠鏂囦欢缂栧彿", prop: "documentCode" }, + { + label: "鏂囦欢绫诲埆", prop: "type", width: "120px", dataType: "tag", + formatData: (params) => { + return this.fileType.find((m) => m.value == params).label; + }, + formatType: (params) => { + return this.fileType.find((m) => m.value == params).type; + }, + }, + { + label: "鐢宠浜�", + prop: "createUserName", + }, + { label: "鐢宠鏃堕棿", prop: "createTime" }, + { label: "璇存槑", prop: "instructions" }, + { label: "鎻愪氦鏃ユ湡", prop: "submitDate" }, + { label: "璐d换浜�", prop: "dutyUserName" }, + { + label: "鐢宠鐘舵��", prop: "state", dataType: "tag", + formatData: (params) => { + return params; + }, + formatType: (params) => { + if (params == '閫氳繃') { + return 'success' + } else { + return 'danger' + } + }, + }, + { + dataType: "action", + fixed: "right", + label: "鎿嶄綔", + operation: [ + { + name: "缂栬緫", + type: "text", + clickFun: (row) => { + this.handleUpdate(row); + }, + disabled: (row) => { + return row.state == '閫氳繃' + } + }, + { + name: "瀹℃牳", + type: "text", + clickFun: (row) => { + this.handleCheck(row); + }, + disabled: (row) => { + return !row.dutyUserName.includes(this.nickName) || row.state == '閫氳繃' + } + }, + { + name: "鏌ョ湅闄勪欢", + type: "text", + clickFun: (row) => { + this.handleLook(row); + }, + }, + { + name: "涓嬭浇", + type: "text", + clickFun: (row) => { + this.handleDown(row); + }, + }, + + { + name: "鍒犻櫎", + type: "text", + clickFun: (row) => { + this.handleDelete(row); + }, + disabled: (row, index) => { + return row.state == '閫氳繃' + } + }, + ], + }, + ], + page: { + total: 0, + size: 10, + current: 0, + }, + tableLoading: false, + } + }, + mounted() { + this.getList() + this.getAuthorizedPerson() + this.selectEnumByCategory() + }, + methods: { + getList() { + this.tableLoading = true; + let param = { ...this.queryParams, ...this.page }; + delete param.total; + pageManageDocumentControlled({ ...param }) + .then((res) => { + this.tableLoading = false; + if (res.code === 200) { + this.tableData = res.data.records; + this.page.total = res.data.total; + } + }) + .catch((err) => { + this.tableLoading = false; + }); + }, + pagination({ page, limit }) { + this.page.current = page; + this.page.size = limit; + this.getList(); + }, + refreshTable() { + this.page.current = 1; + this.getList(); + }, + refresh() { + this.queryParams = {}; + this.page.current = 1; + this.getList(); + }, + getPower() { + let power = JSON.parse(sessionStorage.getItem('power')) + let up = false + let del = false + let add = false + // let check = false + for (var i = 0; i < power.length; i++) { + if (power[i].menuMethod == 'addManageDocumentControlled') { + up = true + } + if (power[i].menuMethod == 'addManageDocumentControlled') { + add = true + } + if (power[i].menuMethod == 'delManageDocumentControlled') { + del = true + } + // if (power[i].menuMethod == 'checkManageDocumentControlled') { + // check = true + // } + } + // if (!check) { + // this.componentData.do.splice(2, 1) + // } + if (!del) { + this.componentData.do.splice(1, 1) + } + if (!up) { + this.componentData.do.splice(0, 1) + } + this.addPower = add + }, + getAuthorizedPerson() { + selectUserCondition().then(res => { + let data = [] + res.data.forEach(a => { + data.push({ + label: a.name, + value: a.id + }) + }) + this.personList = data + }) + }, + selectEnumByCategory() { + // 鏂囦欢绫诲埆 + this.getDicts("document_type").then((response) => { + this.fileType = this.dictToValue(response.data); + }); + }, + // 鎻愪氦 + handleAdd() { + if (!this.addInfo.documentCode) return this.$message({ type: 'error', message: "璇疯緭鍏ョ紪鍙�" }) + if (!this.addInfo.id) { + // 鏂板 + let fd = new FormData(); + //鏂囦欢淇℃伅涓璻aw鎵嶆槸鐪熺殑鏂囦欢 + if (this.file) { + fd.append("file", this.file.raw); + } + for (let m in this.addInfo) { + fd.append(m, this.addInfo[m]) + } + this.addLoading = true + addManageDocumentControlled(fd).then(res => { + this.addLoading = false + if (res.code == 200) { + this.$message({ + type: 'success', + message: '娣诲姞鎴愬姛' + }) + this.refreshTable() + this.addDialogVisible = false + } else { + this.$message({ + type: 'error', + message: '娣诲姞澶辫触' + }) + } + }) + } else { + // 淇敼 + let { id, documentCode, dutyUser, type, name, version, writer, submitDate, instructions } = this.addInfo + let fd = new FormData(); + //鏂囦欢淇℃伅涓璻aw鎵嶆槸鐪熺殑鏂囦欢 + if (this.file) { + fd.append("file", this.file.raw); + } + fd.append("id", id); + fd.append("documentCode", documentCode); + fd.append("dutyUser", dutyUser); + fd.append("type", type); + fd.append("name", name); + fd.append("version", version); + fd.append("writer", writer); + fd.append("submitDate", submitDate); + fd.append("instructions", instructions); + this.addLoading = true + doManageDocumentControlled(fd).then(res => { + this.addLoading = false + if (res.code == 200) { + this.refreshTable() + this.addDialogVisible = false + } else { + this.$message({ + type: 'error', + message: '娣诲姞澶辫触' + }) + } + }) + } + }, + handleChangeUpload(file, fileLists) { + this.file = file + this.$set(this.addInfo, 'name', file.name) + }, + // 缂栬緫 + handleUpdate(row) { + this.title = '鏂囦欢鍙樻洿鐢宠' + this.addInfo = this.HaveJson(row) + this.addDialogVisible = true + }, + // 鏌ョ湅闄勪欢 + handleLook(row) { + this.currentInfo = row + this.lookDialogVisible = true + }, + // 瀹℃牳 + handleCheck(row) { + this.title = '瀹℃牳' + this.currentInfo = row + if (!row.url) return this.$message.warning('鏂囦欢鏈笂浼�') + this.checkStampDialogVisible = true + }, + handleCheck0(row) { + this.checkStampDialogVisible = false + this.checkDialogVisible = true + checkManageDocumentControlledPdf({ id: row.id }).then(res => { + const blob = new Blob([res]); + const file = new File([blob], row.name, { type: 'application/pdf' }) + this.$refs.UpPdfStamp.lookFile(file, this.currentStamp) + }).catch(err => { + console.log(err) + }) + }, + handleDown(row) { + if (!row.url) return this.$message.warning('鏂囦欢鏈笂浼�') + let url = this.javaApi + '/word/' + row.url + this.$download.saveAs(url, row.url); + }, + async uploadPDF(pdfBlob) { + const formData = new FormData(); + formData.append('file', pdfBlob, this.fileName + '.pdf'); // 鏂囦欢瀛楁 + formData.append('id', this.currentInfo.id); // 鏂囦欢鍚嶅瓧娈� + 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 + } + }, + handleCheckSub(type) { + this.type = type + if (type == '閫氳繃') { + this.checkLoading = true + } else { + this.noCheckLoading = true + } + this.addLoading = true + this.$refs['UpPdfStamp'].generatePDF() + }, + handleDelete(row) { + this.$confirm("鏄惁鍒犻櫎璇ユ潯鏁版嵁?", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { + delManageDocumentControlled({ id: row.id }).then((res) => { + if (res.code == 201) return; + this.$message.success("鍒犻櫎鎴愬姛"); + this.refresh(); + }); + }) + .catch(() => { }); + }, + } +} +</script> + +<style scoped> +.title { + height: 60px; + line-height: 60px; +} + +.search { + background-color: #fff; + height: 40px; + display: flex; + align-items: center; + position: relative; +} + +.search_thing { + width: 350px; + display: flex; + align-items: center; +} + +.search_label { + width: 110px; + font-size: 14px; + text-align: right; +} + +.search_input { + width: calc(100% - 110px); +} + +.table { + background-color: #fff; + height: calc(100% - 60px - 80px); + padding: 20px; +} + +.btns { + position: absolute; + right: 20px; + top: 5px; +} + +.stamp { + cursor: pointer; + border: #fff 1px solid; +} + +.stamp:hover { + border: #3A7BFA 1px solid; + box-shadow: inset 0px 0px 15px #3A7BFA; +} + +.stamp.active { + border: #3A7BFA 1px solid; + box-shadow: inset 0px 0px 15px #3A7BFA; +} +</style> diff --git a/src/views/CNAS/systemManagement/documentControl/components/DistributionCollectionRecord.vue b/src/views/CNAS/systemManagement/documentControl/components/DistributionCollectionRecord.vue new file mode 100644 index 0000000..c111c0f --- /dev/null +++ b/src/views/CNAS/systemManagement/documentControl/components/DistributionCollectionRecord.vue @@ -0,0 +1,622 @@ +<template> + <!-- 鍙戞斁鍥炴敹璁板綍 --> + <div class="distribution-collection-record" style="height: 100%;"> + <div class="search"> + <div class="search_thing"> + <div class="search_label">鏂囦欢缂栧彿锛�</div> + <div class="search_input"><el-input v-model="queryParams.documentCode" clearable placeholder="璇疯緭鍏�" size="small" + @keyup.enter.native="refreshTable()"></el-input></div> + </div> + <div class="search_thing"> + <div class="search_label">鏂囦欢鍚嶇О锛�</div> + <div class="search_input"><el-input v-model="queryParams.name" clearable placeholder="璇疯緭鍏�" size="small" + @keyup.enter.native="refreshTable()"></el-input></div> + </div> + <div class="search_thing" style="padding-left: 30px;"> + <el-button size="small" @click="refresh()">閲� 缃�</el-button> + <el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button> + </div> + <div class="btns" style="padding-left: 30px;"> + <el-button v-if="addPower" size="small" type="primary" + @click="addDialogVisible = true, addInfo = {}, radio = '鍙戞斁'">娣诲姞鍙戞斁璁板綍</el-button> + <el-button v-if="outPower" :loading="outLoading" size="small" type="primary" @click="handleOut">瀵煎嚭</el-button> + </div> + </div> + <div class="table"> + <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading" + :height="'calc(100vh - 290px)'" @pagination="pagination"></lims-table> + </div> + <el-dialog :title="'娣诲姞' + radio + '璁板綍'" :visible.sync="addDialogVisible" top="10vh" width="800px"> + <el-row> + <el-col :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label"><span style="color:red;margin-right: 4px;">*</span>鐢宠缂栧彿锛�</div> + <div class="search_input"> + <el-select v-model="addInfo.documentCode" :disabled="radio == '鍥炴敹'" allow-create clearable filterable + size="small" style="width: 100%;" @change="changeFileList"> + <el-option v-for="item in fileList" :key="item.documentCode" :label="item.documentCode" + :value="item.documentCode"> + </el-option> + </el-select> + </div> + </div> + </el-col> + <el-col v-if="radio == '鍙戞斁'" :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label"><span style="color:red;margin-right: 4px;">*</span>鍙戞斁浜猴細</div> + <div class="search_input"> + <el-select v-model="addInfo.issueUser" filterable size="small" style="width: 100%;"> + <el-option v-for="item in personList" :key="item.value" :label="item.label" :value="item.value"> + </el-option> + </el-select> + </div> + </div> + </el-col> + <el-col v-else :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label"><span style="color:red;margin-right: 4px;">*</span>鍥炴敹浜猴細</div> + <div class="search_input"> + <el-select v-model="addInfo.recycleUser" filterable size="small" style="width: 100%;"> + <el-option v-for="item in personList" :key="item.value" :label="item.label" :value="item.value"> + </el-option> + </el-select> + </div> + </div> + </el-col> + <el-col :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label"><span style="color:red;margin-right: 4px;">*</span>瀹℃壒浜猴細</div> + <div class="search_input"> + <el-select v-model="addInfo.receiveUser" :disabled="radio != '鍙戞斁'" filterable size="small" + style="width: 100%;"> + <el-option v-for="item in personList" :key="item.value" :label="item.label" :value="item.value"> + </el-option> + </el-select> + </div> + </div> + </el-col> + <el-col :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">鏂囦欢鍚嶇О锛�</div> + <div class="search_input"><el-input v-model="addInfo.name" :disabled="radio == '鍥炴敹'" clearable + placeholder="璇疯緭鍏�" size="small"></el-input></div> + </div> + </el-col> + <el-col :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">鏂囦欢鐗堟湰锛�</div> + <div class="search_input"><el-input v-model="addInfo.version" :disabled="radio == '鍥炴敹'" clearable + placeholder="璇疯緭鍏�" size="small"></el-input></div> + </div> + </el-col> + <el-col :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">鏂囦欢鐘舵�侊細</div> + <div class="search_input"> + <el-select v-model="addInfo.state" :disabled="radio == '鍥炴敹'" size="small" style="width: 100%;"> + <el-option v-for="(item, index) in fileState" :key="index" :label="item.label" + :value="item.value"></el-option> + </el-select> + </div> + </div> + </el-col> + <el-col v-if="radio == '鍙戞斁'" :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">鍙戞斁缂栧彿锛�</div> + <div class="search_input"><el-input v-model="addInfo.issueCode" clearable placeholder="璇疯緭鍏�" + size="small"></el-input></div> + </div> + </el-col> + <el-col v-else :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">鍥炴敹缂栧彿锛�</div> + <div class="search_input"><el-input v-model="addInfo.recycleCode" clearable placeholder="璇疯緭鍏�" + size="small"></el-input></div> + </div> + </el-col> + <el-col v-if="radio == '鍙戞斁'" :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">鍙戞斁鏃堕棿锛�</div> + <div class="search_input"> + <el-date-picker v-model="addInfo.issueDate" format="yyyy-MM-dd" placeholder="閫夋嫨鏃ユ湡" size="small" + style="width: 100%;" type="date" value-format="yyyy-MM-dd"> + </el-date-picker> + </div> + </div> + </el-col> + <el-col v-else :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">鍥炴敹鏃堕棿锛�</div> + <div class="search_input"> + <el-date-picker v-model="addInfo.recycleDate" format="yyyy-MM-dd" placeholder="閫夋嫨鏃ユ湡" size="small" + style="width: 100%;" type="date" value-format="yyyy-MM-dd"> + </el-date-picker> + </div> + </div> + </el-col> + <el-col v-if="radio == '鍙戞斁'" :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">鍙戞斁璇存槑锛�</div> + <div class="search_input"><el-input v-model="addInfo.issueNote" :rows="2" clearable placeholder="璇疯緭鍏�" + size="small" type="textarea"></el-input></div> + </div> + </el-col> + <el-col v-else :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">鍥炴敹璇存槑锛�</div> + <div class="search_input"><el-input v-model="addInfo.recycleNote" :rows="2" clearable placeholder="璇疯緭鍏�" + size="small" type="textarea"></el-input></div> + </div> + </el-col> + <el-col v-if="radio == '鍙戞斁'" :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">涓婁紶闄勪欢锛�</div> + <div class="search_input"><el-upload :auto-upload="false" :multiple="false" :on-change="handleChangeUpload" + accept='.pdf,.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx' action="#" style="margin: 8px 0 0px 50px;"> + <el-button size="small" type="primary">涓婁紶闄勪欢</el-button> + </el-upload></div> + </div> + </el-col> + </el-row> + <span slot="footer" class="dialog-footer"> + <el-button @click="addDialogVisible = false">鍙� 娑�</el-button> + <el-button :loading="addLoading" type="primary" @click="handleAdd">纭� 瀹�</el-button> + </span> + </el-dialog> + <el-dialog :visible.sync="lookDialogVisible" fullscreen title="鏌ョ湅闄勪欢" top="5vh" width="800px"> + <filePreview v-if="lookDialogVisible" :currentFile="{}" :fileUrl="javaApi + '/word/' + currentInfo.url" + style="height: 90vh;overflow-y: auto;" /> + </el-dialog> + </div> +</template> + +<script> +import limsTable from "@/components/Table/lims-table.vue"; +import filePreview from '@/components/Preview/filePreview.vue' +import { + selectUserCondition, +} from "@/api/business/inspectionTask.js"; +import { + pageManageDocumentList, + pageManageDocumentCancel, + exportManageDocumentIssueRecycle, + addManageDocumentIssueRecycle, + doManageDocumentIssueRecycle, + checkManageDocumentIssueRecycle, + pageManageDocumentIssueRecycle, + delManageDocumentIssueRecycle, +} from '@/api/cnas/systemManagement/documentControl.js' +import { mapGetters } from "vuex"; +export default { + components: { + filePreview, + limsTable + }, + computed: { + ...mapGetters(["userId"]), + }, + data() { + return { + ddPower: false, + outPower: true, + addInfo: {}, + addPower: true, + addLoading: false, + addDialogVisible: false, + outLoading: false, + personList: [], + fileList: [], + fileList0: [], + radio: '鍙戞斁', + fileState: [], + file: null, + currentInfo: {}, + lookDialogVisible: false, + queryParams: {}, + tableData: [], + column: [ + { label: "鏂囦欢缂栧彿", prop: "documentCode" }, + { label: "鏂囦欢鍚嶇О", prop: "name" }, + { + label: "鏂囦欢鐗堟湰", + prop: "version", + }, + { label: "鏂囦欢鐘舵��", prop: "documentState" }, + { label: "鍙戞斁缂栧彿", prop: "issueUserName" }, + { label: "鍙戞斁浜�", prop: "department" }, + { label: "鍙戞斁鏃ユ湡", prop: "issueDate" }, + { label: "鍥炴敹浜�", prop: "recycleUserName" }, + { label: "鍥炴敹鏃ユ湡", prop: "recycleDate" }, + { + dataType: "action", + fixed: "right", + label: "鎿嶄綔", + operation: [ + { + name: "鍥炴敹璁板綍", + type: "text", + clickFun: (row) => { + this.handleUpdate(row); + } + }, + { + name: "鍒犻櫎", + type: "text", + clickFun: (row) => { + this.handleDelete(row); + }, + disabFun: (row, index) => { + return row.documentState == '閫氳繃' + } + }, + { + name: "鏌ョ湅闄勪欢", + type: "text", + clickFun: (row) => { + this.handleLook(row); + }, + disabFun: (row, index) => { + return !row.url + } + }, + { + name: "瀹℃牳", + type: "text", + clickFun: (row) => { + this.handleCheck(row); + }, + disabFun: (row, index) => { + return row.receiveUser != this.userId || row.documentState == '閫氳繃' + } + }, + ], + }, + ], + page: { + total: 0, + size: 10, + current: 0, + }, + tableLoading: false, + } + }, + mounted() { + this.getList() + this.getAuthorizedPerson() + this.getFileList() + this.getFileList0() + this.selectEnumByCategory() + }, + methods: { + getPower() { + let power = JSON.parse(sessionStorage.getItem('power')) + let out = false + let del = false + let add = false + // let check = false + for (var i = 0; i < power.length; i++) { + if (power[i].menuMethod == 'exportManageDocumentIssueRecycle') { + out = true + } + if (power[i].menuMethod == 'addManageDocumentIssueRecycle') { + add = true + } + if (power[i].menuMethod == 'delManageDocumentIssueRecycle') { + del = true + } + // if (power[i].menuMethod == 'checkManageDocumentControlled') { + // check = true + // } + } + // if (!check) { + // this.componentData.do.splice(2, 1) + // } + if (!del) { + this.componentData.do.splice(1, 1) + } + if (!add) { + this.componentData.do.splice(0, 1) + } + this.addPower = add + this.outPower = out + }, + getList() { + this.tableLoading = true; + let param = { ...this.queryParams, ...this.page }; + delete param.total; + pageManageDocumentIssueRecycle({ ...param }) + .then((res) => { + this.tableLoading = false; + if (res.code === 200) { + this.tableData = res.data.records; + this.page.total = res.data.total; + } + }) + .catch((err) => { + this.tableLoading = false; + }); + }, + pagination({ page, limit }) { + this.page.current = page; + this.page.size = limit; + this.getList(); + }, + refresh() { + this.queryParams = {}; + this.page.current = 1; + this.getList(); + }, + refreshTable() { + this.page.current = 1; + this.getList(); + }, + selectEnumByCategory() { + // 鏂囦欢鐘舵�� + this.getDicts("document_state").then((response) => { + this.fileState = this.dictToValue(response.data); + }); + }, + // 鑾峰彇浜哄憳鍒楄〃 + getAuthorizedPerson() { + selectUserCondition().then(res => { + let data = [] + res.data.forEach(a => { + data.push({ + label: a.name, + value: a.id + }) + }) + this.personList = data + }) + }, + // 鑾峰彇鏂囦欢鍒楄〃--鏂囦欢娓呭崟 + getFileList() { + pageManageDocumentList({ + current: -1, + size: -1 + }).then(res => { + this.fileList = res.data.records + }).catch(err => { }) + }, + // 鑾峰彇鏂囦欢鍒楄〃--浣滃簾鏂囦欢 + getFileList0() { + pageManageDocumentCancel({ + current: -1, + size: -1 + }).then(res => { + this.fileList0 = res.data.records + }).catch(err => { }) + }, + // 瀵煎嚭 + handleOut() { + this.outLoading = true + // queryParams + exportManageDocumentIssueRecycle(this.queryParams).then(res => { + this.outLoading = false + const blob = new Blob([res], { type: 'application/octet-stream' }); + this.$download.saveAs(blob, '鍙戞斁鍥炴敹璁板綍.xlsx') + //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆 + // let reader = new FileReader(); + // reader.readAsText(blob, 'utf-8'); + // reader.onload = () => { + // try { + // let result = JSON.parse(reader.result); + // if (result.message) { + // this.$message.error(result.message); + // } else { + // const url = URL.createObjectURL(blob); + // const link = document.createElement('a'); + // link.href = url; + // link.download = '鍙戞斁鍥炴敹璁板綍.xlsx'; + // link.click(); + // this.$message.success('瀵煎嚭鎴愬姛') + // } + // } catch (err) { + // console.log(err); + // const url = URL.createObjectURL(blob); + // const link = document.createElement('a'); + // link.href = url; + // link.download = '鍙戞斁鍥炴敹璁板綍.xlsx'; + // link.click(); + // this.$message.success('瀵煎嚭鎴愬姛') + // } + // } + }) + }, + changeFileList(e) { + if (e) { + let obj = this.fileList.find(a => a.documentCode == e) + if (obj) { + this.addInfo.name = obj.name + this.addInfo.version = obj.version + this.addInfo.state = obj.state + } + } + }, + // 鎻愪氦 + handleAdd() { + if (!this.addInfo.documentCode) { + this.$message.error('璇烽�夋嫨鏂囦欢') + return + } + if (!this.addInfo.receiveUser) { + this.$message.error('璇烽�夋嫨瀹℃壒浜�') + return + } + if (this.radio == '鍙戞斁') { + if (!this.addInfo.issueUser) { + this.$message.error('璇烽�夋嫨鍙戞斁浜�') + return + } + } else { + if (!this.addInfo.recycleUser) { + this.$message.error('璇烽�夋嫨鍥炴敹浜�') + return + } + } + this.addLoading = true; + if (!this.addInfo.id) { + // 鏂板鍙戞斁璁板綍 + let fd = new FormData(); + //鏂囦欢淇℃伅涓璻aw鎵嶆槸鐪熺殑鏂囦欢 + if (this.file) { + fd.append("file", this.file.raw); + } + for (let key in this.addInfo) { + fd.append(key, this.addInfo[key]) + } + addManageDocumentIssueRecycle(fd).then(res => { + this.addLoading = false; + if (res.code == 200) { + this.$message.success('鍙戞斁鎴愬姛') + this.addDialogVisible = false + this.refreshTable() + } + }) + } else { + let { documentCode, id, issueUser, recycleUser, receiveUser, name, version, documentState, issueCode, recycleCode, issueDate, recycleDate, issueNote, recycleNote } = this.addInfo + // 娣诲姞鍥炴敹璁板綍 + doManageDocumentIssueRecycle({ + documentCode, + id, + issueUser, + recycleUser, + receiveUser, + name, + version, + documentState, + issueCode, + recycleCode, + issueDate, + recycleDate, + issueNote, + recycleNote + }).then(res => { + this.addLoading = false; + if (res.code == 200) { + this.$message.success('鎻愪氦鎴愬姛') + this.addDialogVisible = false + this.refreshTable() + } + }) + } + }, + // 娣诲姞鍥炴敹 + handleUpdate(row) { + this.addInfo = this.HaveJson(row) + this.radio = '鍥炴敹' + this.addDialogVisible = true + }, + // 瀹℃牳 + handleCheck(row) { + this.$confirm('鏄惁瀹℃牳閫氳繃?', '鎻愮ず', { + confirmButtonText: '閫氳繃', + cancelButtonText: '涓嶉�氳繃', + type: 'warning', + closeOnClickModal: false, // 绂佹鐐瑰嚮閬僵灞傚叧闂� + distinguishCancelAndClose: true, + beforeClose: (action, instance, done) => { + if (action === 'confirm') { + // 鐐瑰嚮鈥滅‘瀹氣�濇寜閽紝鍏佽鍏抽棴 + checkManageDocumentIssueRecycle({ id: row.id, documentState: '閫氳繃' }).then(res => { + this.refreshTable() + done(); + this.$message({ + type: 'success', + message: '鎻愪氦鎴愬姛' + }) + }) + .catch(err => { + + }) + } else if (action === 'cancel') { + // 鐐瑰嚮鈥滃彇娑堚�濇寜閽紝涓嶅厑璁稿叧闂� + checkManageDocumentIssueRecycle({ id: row.id, documentState: '涓嶉�氳繃' }).then(res => { + this.refreshTable() + done(); + this.$message({ + type: 'success', + message: '鎻愪氦鎴愬姛' + }) + }) + .catch(err => { + + }) + } else if (action === 'close') { + // 鐐瑰嚮鈥溍椻�濇寜閽紝涓嶅厑璁稿叧闂� + done(); + console.log("脳鎸夐挳鐐瑰嚮浜嬩欢锛屼笉鍏抽棴寮规"); + } + } + }) + }, + handleChangeUpload(file, fileLists) { + this.file = file + this.$set(this.addInfo, 'name', file.name) + }, + // 鏌ョ湅闄勪欢 + handleLook(row) { + this.currentInfo = this.HaveJson(row) + this.lookDialogVisible = true + }, + handleDelete(row) { + this.$confirm("鏄惁鍒犻櫎璇ユ潯鏁版嵁?", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { + delManageDocumentIssueRecycle({ id: row.id }).then((res) => { + if (res.code == 201) return; + this.$message.success("鍒犻櫎鎴愬姛"); + this.refresh(); + }); + }) + .catch(() => { }); + }, + } +} +</script> + +<style scoped> +.title { + height: 60px; + line-height: 60px; +} + +.search { + background-color: #fff; + height: 40px; + display: flex; + align-items: center; + position: relative; +} + +.search_thing { + width: 350px; + display: flex; + align-items: center; +} + +.search_label { + width: 110px; + font-size: 14px; + text-align: right; +} + +.search_input { + width: calc(100% - 110px); +} + +.table { + background-color: #fff; + height: calc(100% - 60px - 80px); + padding: 20px; +} + +.btns { + position: absolute; + right: 20px; + top: 5px; +} +</style> diff --git a/src/views/CNAS/systemManagement/documentControl/components/FileChangeRequest.vue b/src/views/CNAS/systemManagement/documentControl/components/FileChangeRequest.vue new file mode 100644 index 0000000..b66b5c7 --- /dev/null +++ b/src/views/CNAS/systemManagement/documentControl/components/FileChangeRequest.vue @@ -0,0 +1,706 @@ +<template> + <!-- 鏂囦欢鍙樻洿鐢宠 --> + <div class="file-change-request" style="height: 100%;"> + <div class="search"> + <div class="search_thing"> + <div class="search_label">鐢宠鏂囦欢缂栧彿锛�</div> + <div class="search_input"><el-input v-model="queryParams.code" clearable placeholder="璇疯緭鍏�" size="small" + @keyup.enter.native="refreshTable()"></el-input></div> + </div> + <div class="search_thing" style="padding-left: 30px;"> + <el-button size="small" @click="refresh()">閲� 缃�</el-button> + <el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button> + </div> + <div class="btns"> + <el-button size="small" type="primary" + @click="addDialogVisible = true, addInfo = {}, currentFile = {}, title = '鏂囦欢鍙樻洿鐢宠'">鏂囦欢鍙樻洿鐢宠</el-button> + <el-button :loading="outLoading" size="small" type="primary" @click="handleOut">瀵煎嚭</el-button> + </div> + </div> + <div class="table"> + <!-- <ValueTable :key="upIndex" ref="ValueTable" :componentData="componentData" + :delUrl="$api.manageDocumentList.delManageDocumentAlter" + :url="$api.manageDocumentList.pageManageDocumentAlter" /> --> + <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading" + :height="'calc(100vh - 290px)'" @pagination="pagination"></lims-table> + </div> + <el-dialog :title="title" :visible.sync="addDialogVisible" top="0vh" width="950px"> + <el-row> + <el-col :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label"><span style="color:red;margin-right: 4px;">*</span>鐢宠缂栧彿锛�</div> + <div class="search_input"><el-input v-model="addInfo.code" :disabled="title == '瀹℃牳'" clearable + placeholder="璇疯緭鍏�" size="small"></el-input></div> + </div> + </el-col> + <el-col :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">瀹℃壒浜猴細</div> + <div class="search_input"> + <el-select v-model="addInfo.checkUser" :disabled="title == '瀹℃牳'" filterable size="small" + style="width: 100%;"> + <el-option v-for="item in personList" :key="item.value" :label="item.label" :value="item.value"> + </el-option> + </el-select> + </div> + </div> + </el-col> + <el-col :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">鏈熸湜鍙樻洿鏃堕棿锛�</div> + <div class="search_input"> + <el-date-picker v-model="addInfo.expectAlterDate" :disabled="title == '瀹℃牳'" format="yyyy-MM-dd" + placeholder="閫夋嫨鏃ユ湡" size="small" style="width: 100%;" type="date" value-format="yyyy-MM-dd"> + </el-date-picker> + </div> + </div> + </el-col> + <el-col :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">瀹為檯鍙樻洿鏃堕棿锛�</div> + <div class="search_input"> + <el-date-picker v-model="addInfo.actuallyAlterDate" :disabled="title == '瀹℃牳'" format="yyyy-MM-dd" + placeholder="閫夋嫨鏃ユ湡" size="small" style="width: 100%;" type="date" value-format="yyyy-MM-dd"> + </el-date-picker> + </div> + </div> + </el-col> + <el-col :span="24" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">閫夋嫨鏂囦欢锛�</div> + <div class="search_input"> + <el-select v-model="addInfo.alterBeforeCode" :disabled="title == '瀹℃牳'" allow-create clearable filterable + size="small" style="width: 100%;" @change="getCurrentFile"> + <el-option v-for="item in fileList" :key="item.documentCode" :label="item.title" + :value="item.documentCode"> + </el-option> + </el-select> + </div> + </div> + </el-col> + <el-col :span="24"> + <h4 class="title">褰撳墠鏂囦欢淇℃伅</h4> + </el-col> + <el-col :span="8" style="margin-bottom: 16px;"> + <div class="search_thing" style="width: 100%;"> + <div class="search_label">鏂囦欢缂栧彿锛�</div> + <div class="search_input"><el-input v-model="currentFile.documentCode" :disabled="title == '瀹℃牳'" clearable + placeholder="璇疯緭鍏�" size="small"></el-input></div> + </div> + </el-col> + <el-col :span="8" style="margin-bottom: 16px;"> + <div class="search_thing" style="width: 100%;"> + <div class="search_label">鏂囦欢鍚嶇О锛�</div> + <div class="search_input"><el-input v-model="currentFile.name" :disabled="title == '瀹℃牳'" clearable + placeholder="璇疯緭鍏�" size="small"></el-input></div> + </div> + </el-col> + <el-col :span="8" style="margin-bottom: 16px;"> + <div class="search_thing" style="width: 100%;"> + <div class="search_label">鏂囦欢鐗堟湰锛�</div> + <div class="search_input"><el-input v-model="currentFile.version" :disabled="title == '瀹℃牳'" clearable + placeholder="璇疯緭鍏�" size="small"></el-input></div> + </div> + </el-col> + <el-col :span="8" style="margin-bottom: 16px;"> + <div class="search_thing" style="width: 100%;"> + <div class="search_label">鎻愪氦浜猴細</div> + <div class="search_input"><el-select v-model="currentFile.createUser" disabled filterable size="small" + style="width: 100%;"> + <el-option v-for="item in personList" :key="item.value" :label="item.label" :value="item.value"> + </el-option> + </el-select></div> + </div> + </el-col> + <!-- <el-col :span="8" style="margin-bottom: 16px;"> + <div class="search_thing" style="width: 100%;"> + <div class="search_label">瀹℃牳浜猴細</div> + <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="addInfo.version" disabled></el-input></div> + </div> + </el-col> + <el-col :span="8" style="margin-bottom: 16px;"> + <div class="search_thing" style="width: 100%;"> + <div class="search_label">浣滃簾浜猴細</div> + <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="addInfo.version" disabled></el-input></div> + </div> + </el-col> --> + <el-col :span="8" style="margin-bottom: 16px;"> + <div class="search_thing" style="width: 100%;"> + <div class="search_label">鎻愪氦鏃堕棿锛�</div> + <div class="search_input"><el-input v-model="currentFile.createTime" clearable disabled placeholder="璇疯緭鍏�" + size="small"></el-input></div> + </div> + </el-col> + <el-col :span="8" style="margin-bottom: 16px;"> + <div class="search_thing" style="width: 100%;"> + <div class="search_label">瀹℃牳鏃堕棿锛�</div> + <div class="search_input"><el-input v-model="currentFile.effectiveDate" clearable disabled placeholder="璇疯緭鍏�" + size="small"></el-input></div> + </div> + </el-col> + <!-- <el-col :span="8" style="margin-bottom: 16px;"> + <div class="search_thing" style="width: 100%;"> + <div class="search_label">浣滃簾鏃堕棿锛�</div> + <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="addInfo.version" disabled></el-input></div> + </div> + </el-col> --> + <el-col :span="8" style="margin-bottom: 16px;"> + <div class="search_thing" style="width: 100%;"> + <div class="search_label">鏂囦欢鐘舵�侊細</div> + <div class="search_input"> + <el-select v-model="currentFile.state" disabled size="small" style="width: 100%;"> + <el-option v-for="item in fileState" :key="item.value" :label="item.label" :value="item.value"> + </el-option> + </el-select> + </div> + </div> + </el-col> + <!-- <el-col :span="8" style="margin-bottom: 16px;"> + <div class="search_thing" style="width: 100%;"> + <div class="search_label">鏂囦欢璇存槑锛�</div> + <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="addInfo.instructions" type="textarea" + :rows="2" disabled></el-input></div> + </div> + </el-col> --> + <el-col :span="24"> + <h4 class="title">鏂囦欢鍙樻洿鐢宠</h4> + </el-col> + <el-col :span="8" style="margin-bottom: 16px;"> + <div class="search_thing" style="width: 100%;"> + <div class="search_label">鍙樻洿鍚庣紪鍙凤細</div> + <div class="search_input"><el-input v-model="addInfo.alterAfterCode" :disabled="title == '瀹℃牳'" clearable + placeholder="璇疯緭鍏�" size="small"></el-input></div> + </div> + </el-col> + <el-col :span="8" style="margin-bottom: 16px;"> + <div class="search_thing" style="width: 100%;"> + <div class="search_label">鍙樻洿鍚庡悕绉帮細</div> + <div class="search_input"><el-input v-model="addInfo.alterAfterName" :disabled="title == '瀹℃牳'" clearable + placeholder="璇疯緭鍏�" size="small"></el-input></div> + </div> + </el-col> + <el-col :span="8" style="margin-bottom: 16px;"> + <div class="search_thing" style="width: 100%;"> + <div class="search_label">鍓嶄竴鐗堟湰澶勭悊锛�</div> + <div class="search_input"> + <el-select v-model="addInfo.method" :disabled="title == '瀹℃牳'" size="small" style="width: 100%;"> + <el-option label="浣滃簾" value="浣滃簾"></el-option> + <el-option label="瀛樻。涓嶅彲鐢�" value="瀛樻。涓嶅彲鐢�"> + </el-option> + </el-select> + </div> + </div> + </el-col> + <el-col :span="8" style="margin-bottom: 16px;"> + <div class="search_thing" style="width: 100%;"> + <div class="search_label">鍙樻洿鍚庣増鏈細</div> + <div class="search_input"><el-input v-model="addInfo.alterAfterVersion" :disabled="title == '瀹℃牳'" clearable + placeholder="璇疯緭鍏�" size="small"></el-input></div> + </div> + </el-col> + <el-col :span="16" style="margin-bottom: 16px;"> + <div class="search_thing" style="width: 100%;"> + <div class="search_label">鍙樻洿璇存槑锛�</div> + <div class="search_input"><el-input v-model="addInfo.alterNote" :disabled="title == '瀹℃牳'" :rows="2" + clearable placeholder="璇疯緭鍏�" size="small" type="textarea"></el-input></div> + </div> + </el-col> + <el-col v-if="title != '瀹℃牳'" :span="24" style="margin-bottom: 16px;"> + <div class="search_thing" style="width: 100%;"> + <div class="search_label">鐩稿叧闄勪欢锛�</div> + <div class="search_input"><el-upload v-if="addDialogVisible" :auto-upload="false" :multiple="false" + :on-change="handleChangeUpload" accept='.pdf' action="#" style="margin: 8px 0 0px 50px;"> + <el-button size="small" type="primary">涓婁紶闄勪欢</el-button> + </el-upload></div> + </div> + </el-col> + <UpPdfStamp v-if="title == '瀹℃牳' && addDialogVisible" ref="UpPdfStamp" :isUpFile="false" @uploadPDF="uploadPDF"> + </UpPdfStamp> + </el-row> + <span v-if="title != '瀹℃牳'" slot="footer" class="dialog-footer"> + <el-button @click="addDialogVisible = false">鍙� 娑�</el-button> + <el-button :loading="addLoading" type="primary" @click="handleAdd">纭� 瀹�</el-button> + </span> + <span v-else slot="footer" class="dialog-footer"> + <el-button :loading="noCheckLoading" @click="handleCheckSub('涓嶉�氳繃')">涓嶉�氳繃</el-button> + <el-button :loading="checkLoading" type="primary" @click="handleCheckSub('閫氳繃')">閫� 杩�</el-button> + </span> + </el-dialog> + <el-dialog :visible.sync="lookDialogVisible" fullscreen title="鏌ョ湅闄勪欢" top="5vh" width="800px"> + <filePreview v-if="lookDialogVisible" :currentFile="{}" :fileUrl="javaApi + '/word/' + currentInfo.alterAfterUrl" + style="height: 90vh;overflow-y: auto;" /> + </el-dialog> + </div> +</template> + +<script> +import limsTable from "@/components/Table/lims-table.vue"; +import UpPdfStamp from '@/components/UpPdfStamp/index.vue' +import filePreview from '@/components/Preview/filePreview.vue' +import { + selectUserCondition, +} from "@/api/business/inspectionTask.js"; +import { + exportManageDocumentAlter, + pageManageDocumentList, + addManageDocumentAlter, + doManageDocumentAlter, + checkManageDocumentAlterPdf, + checkManageDocumentAlter, + delManageDocumentAlter, + pageManageDocumentAlter, +} from '@/api/cnas/systemManagement/documentControl.js' +import { mapGetters } from "vuex"; +export default { + components: { + limsTable, + filePreview, + UpPdfStamp, + }, + computed: { + ...mapGetters(["userId"]), + }, + data() { + return { + title: '鏂囦欢鍙樻洿鐢宠', + noCheckLoading: false, + checkLoading: false, + addDialogVisible: false, + addInfo: {}, + addPower: false, + outPower: false, + outLoading: false, + personList: [], + fileList: [], + currentFile: {}, + fileState: [], + file: null, + addLoading: false, + lookDialogVisible: false, + currentInfo: { + }, + type: null, + fileName: null, + queryParams: {}, + tableData: [], + column: [ + { label: "鐢宠缂栧彿", prop: "code" }, + { label: "鐢宠浜�", prop: "createUserName", width: "120px" }, + { + label: "鍙樻洿璇存槑", + prop: "alterNote", + }, + { label: "鏈熸湜鍙樻洿鏃堕棿", prop: "expectAlterDate" }, + { label: "瀹為檯鍙樻洿鏃堕棿", prop: "actuallyAlterDate" }, + { + label: "鐘舵��", prop: "state", dataType: "tag", + formatData: (params) => { + return params; + }, + formatType: (params) => { + if (params == '閫氳繃') { + return 'success' + } else { + return 'danger' + } + }, + }, + { + dataType: "action", + fixed: "right", + label: "鎿嶄綔", + operation: [ + { + name: "缂栬緫", + type: "text", + clickFun: (row) => { + this.handleUpdate(row); + }, + disabled: (row, index) => { + return row.state == '閫氳繃' + } + }, + { + name: "鍒犻櫎", + type: "text", + clickFun: (row) => { + this.handleDelete(row); + }, + disabled: (row, index) => { + return row.state == '閫氳繃' + } + }, + { + name: "瀹℃牳", + type: "text", + clickFun: (row) => { + this.handleCheck(row); + }, + disabled: (row, index) => { + return row.checkUser != this.userId || row.state == '閫氳繃' + } + }, + { + name: "鏌ョ湅闄勪欢", + type: "text", + clickFun: (row) => { + this.handleLook(row); + }, + }, + { + name: "涓嬭浇闄勪欢", + type: "text", + clickFun: (row) => { + this.handleDown(row); + }, + }, + ], + }, + ], + page: { + total: 0, + size: 10, + current: 0, + }, + tableLoading: false, + } + }, + mounted() { + this.getList() + this.getAuthorizedPerson() + this.getFileList() + this.selectEnumByCategory() + }, + methods: { + getPower() { + let power = JSON.parse(sessionStorage.getItem('power')) + let up = false + let del = false + let add = false + let out = false + for (var i = 0; i < power.length; i++) { + if (power[i].menuMethod == 'addManageDocumentAlter') { + up = true + } + if (power[i].menuMethod == 'addManageDocumentAlter') { + add = true + } + if (power[i].menuMethod == 'delManageDocumentAlter') { + del = true + } + if (power[i].menuMethod == 'exportManageDocumentAlter') { + out = true + } + } + if (!del) { + this.componentData.do.splice(1, 1) + } + if (!up) { + this.componentData.do.splice(0, 1) + } + this.addPower = add + this.outPower = out + }, + getList() { + this.tableLoading = true; + let param = { ...this.queryParams, ...this.page }; + delete param.total; + pageManageDocumentAlter({ ...param }) + .then((res) => { + this.tableLoading = false; + if (res.code === 200) { + this.tableData = res.data.records; + this.page.total = res.data.total; + } + }) + .catch((err) => { + this.tableLoading = false; + }); + }, + pagination({ page, limit }) { + this.page.current = page; + this.page.size = limit; + this.getList(); + }, + refresh() { + this.queryParams = {}; + this.page.current = 1; + this.getList(); + }, + refreshTable() { + this.page.current = 1; + this.getList(); + }, + // 瀵煎嚭 + handleOut() { + this.outLoading = true + exportManageDocumentAlter(this.queryParams).then(res => { + this.outLoading = false + const blob = new Blob([res], { type: 'application/octet-stream' }); + this.$download.saveAs(blob, '鏂囦欢鍙樻洿璁板綍.xlsx') + }) + }, + getAuthorizedPerson() { + selectUserCondition().then(res => { + let data = [] + res.data.forEach(a => { + data.push({ + label: a.name, + value: a.id + }) + }) + this.personList = data + }) + }, + // 鑾峰彇鏂囦欢鍒楄〃--鏂囦欢娓呭崟 + getFileList() { + pageManageDocumentList({ + current: -1, + size: -1 + }).then(res => { + this.fileList = res.data.records.map(m => { + m.title = m.documentCode + ':' + m.name + return m + }) + }).catch(err => { }) + }, + // 褰撳墠鏂囦欢 + getCurrentFile(e) { + this.currentFile = this.fileList.find(m => m.documentCode == e) + if (!this.currentFile) { + this.currentFile = {} + } + }, + selectEnumByCategory() { + // 鏂囦欢鐘舵�� + this.getDicts("document_state").then((response) => { + this.fileState = this.dictToValue(response.data); + }); + }, + handleChangeUpload(file, fileLists) { + this.file = file + this.$set(this.addInfo, 'alterAfterName', file.name) + }, + handleAdd() { + if (!this.addInfo.code) return this.$message({ type: 'error', message: "璇疯緭鍏ョ敵璇风紪鍙�" }) + if (!this.addInfo.id) { + // 鏂板 + let fd = new FormData(); + //鏂囦欢淇℃伅涓璻aw鎵嶆槸鐪熺殑鏂囦欢 + if (this.file) { + fd.append("file", this.file.raw); + } + for (let m in this.addInfo) { + fd.append(m, this.addInfo[m]) + } + let { name, version, documentCode } = this.currentFile; + fd.append("alterBeforeName", name); + fd.append("alterBeforeVersion", version); + // fd.append("alterBeforeCode",documentCode); + this.addLoading = true + addManageDocumentAlter(fd).then(res => { + this.addLoading = false + if (res.code == 200) { + this.$message({ + type: 'success', + message: '娣诲姞鎴愬姛' + }) + this.refreshTable() + this.addDialogVisible = false + } else { + this.$message({ + type: 'error', + message: '娣诲姞澶辫触' + }) + } + }) + } else { + // 淇敼 + let fd = new FormData(); + //鏂囦欢淇℃伅涓璻aw鎵嶆槸鐪熺殑鏂囦欢 + if (this.file) { + fd.append("file", this.file.raw); + } + let { name, version } = this.currentFile; + fd.append("alterBeforeName", name); + fd.append("alterBeforeVersion", version); + let { code, checkUser, expectAlterDate, actuallyAlterDate, alterAfterCode, method, alterAfterVersion, alterNote, alterAfterName, id } = this.addInfo + fd.append("code", code); + fd.append("checkUser", checkUser); + fd.append("expectAlterDate", expectAlterDate); + fd.append("actuallyAlterDate", actuallyAlterDate); + fd.append("alterAfterCode", alterAfterCode); + fd.append("method", method); + fd.append("alterAfterVersion", alterAfterVersion); + fd.append("alterNote", alterNote); + fd.append("alterAfterName", alterAfterName); + fd.append("id", id); + this.addLoading = true + doManageDocumentAlter(fd).then(res => { + this.addLoading = false + if (res.code == 200) { + this.$message({ + type: 'success', + message: '淇敼鎴愬姛' + }) + this.refreshTable() + this.addDialogVisible = false + } else { + this.$message({ + type: 'error', + message: '淇敼澶辫触' + }) + } + }) + } + }, + // 缂栬緫 + handleUpdate(row) { + this.title = '鏂囦欢鍙樻洿鐢宠' + this.addInfo = this.HaveJson(row) + let alterBeforeCode = this.addInfo.alterBeforeCode + this.getCurrentFile(alterBeforeCode) + this.addDialogVisible = true + }, + // 棰勮 + handleLook(row) { + this.currentInfo = this.HaveJson(row) + this.lookDialogVisible = true + }, + // 涓嬭浇闄勪欢 + handleDown(row) { + if (!row.alterAfterUrl) return this.$message.warning('鏂囦欢鏈笂浼�') + let url = this.javaApi + '/word/' + row.alterAfterUrl + this.$download.saveAs(url, row.alterAfterUrl) + }, + // 鎵撳紑瀹℃牳寮规 + handleCheck(row) { + this.title = '瀹℃牳' + this.fileName = row.alterAfterName + if (!row.alterAfterUrl) return this.$message.warning('鏂囦欢鏈笂浼�') + this.addInfo = this.HaveJson(row) + let alterBeforeCode = this.addInfo.alterBeforeCode + this.getCurrentFile(alterBeforeCode) + this.addDialogVisible = true + checkManageDocumentAlterPdf({ id: row.id }).then(res => { + // + const blob = new Blob([res]); + const file = new File([blob], row.name, { type: 'application/pdf' }) + this.$refs.UpPdfStamp.lookFile(file) + this.currentInfo = row + }).catch(err => { + console.log(err) + }) + }, + // 瀹℃牳淇濆瓨 + async uploadPDF(pdfBlob) { + const formData = new FormData(); + formData.append('file', pdfBlob, this.fileName + '.pdf'); // 鏂囦欢瀛楁 + formData.append('id', this.currentInfo.id); // 鏂囦欢鍚嶅瓧娈� + formData.append('state', this.type); // 鏂囦欢鍚嶅瓧娈� + + let res = await checkManageDocumentAlter(formData) + this.checkLoading = false + this.noCheckLoading = 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 + } + }, + // 鎻愪氦瀹℃牳 + handleCheckSub(type) { + this.type = type + if (type == '閫氳繃') { + this.checkLoading = true + } else { + this.noCheckLoading = true + } + this.addLoading = true + this.$refs['UpPdfStamp'].generatePDF() + }, + handleDelete(row) { + this.$confirm("鏄惁鍒犻櫎璇ユ潯鏁版嵁?", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { + delManageDocumentAlter({ id: row.id }).then((res) => { + if (res.code == 201) return; + this.$message.success("鍒犻櫎鎴愬姛"); + this.refresh(); + }); + }) + .catch(() => { }); + }, + } +} +</script> + +<style scoped> +.title { + height: 60px; + line-height: 60px; +} + +.search { + background-color: #fff; + height: 40px; + display: flex; + align-items: center; + position: relative; +} + +.search_thing { + width: 350px; + display: flex; + align-items: center; +} + +.search_label { + width: 110px; + font-size: 14px; + text-align: right; +} + +.search_input { + width: calc(100% - 110px); +} + +.table { + background-color: #fff; + height: calc(100% - 60px - 80px); + padding: 20px; +} + +.btns { + position: absolute; + right: 20px; + top: 5px; +} + +h4.title { + position: relative; + height: 30px; + line-height: 30px; + box-sizing: border-box; + padding-left: 16px; + margin-left: 10px; + margin-bottom: 10px; +} + +h4.title::after { + content: ''; + width: 4px; + height: 20px; + background: #3A7BFA; + position: absolute; + top: 5px; + left: 0; +} +</style> diff --git a/src/views/CNAS/systemManagement/documentControl/components/FileList.vue b/src/views/CNAS/systemManagement/documentControl/components/FileList.vue new file mode 100644 index 0000000..b3d2158 --- /dev/null +++ b/src/views/CNAS/systemManagement/documentControl/components/FileList.vue @@ -0,0 +1,436 @@ +<template> + <!-- 鏂囦欢娓呭崟 --> + <div class="file-list" style="height: 100%;"> + <div class="search"> + <div class="search_thing"> + <div class="search_label">鏂囦欢鍚嶇О锛�</div> + <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="queryParams.name" + @keyup.enter.native="refreshTable()"></el-input></div> + </div> + <div class="search_thing"> + <div class="search_label">鏂囦欢鐘舵�侊細</div> + <div class="search_input"> + <el-select v-model="queryParams.state" size="small" @change="refreshTable()"> + <el-option :label="item.label" :value="item.value" v-for="(item, index) in fileState" + :key="index"></el-option> + </el-select> + </div> + </div> + <div class="search_thing" style="padding-left: 30px;"> + <el-button size="small" @click="refresh()">閲� 缃�</el-button> + <el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button> + </div> + <div class="btns" style="padding-left: 30px;"> + <el-upload :action="action" :multiple="false" accept='.xls,.xlsx' :headers="headers" :on-change="beforeUpload" + :on-error="onError" ref='upload' :on-success="handleSuccessUp" :show-file-list="false"> + <el-button size="small" type="primary" :loading="upLoading">瀵煎叆</el-button></el-upload> + </div> + </div> + <div class="table"> + <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading" + :height="'calc(100vh - 290px)'" @pagination="pagination"></lims-table> + </div> + <el-dialog title="涓婁紶" :visible.sync="addDialogVisible" width="1000px" top="3vh"> + <UpPdfStamp ref="UpPdfStamp" v-if="addDialogVisible" @uploadPDF="uploadPDF" :isUpFile="true" + @uploadPDFErr="uploadPDFErr"></UpPdfStamp> + <span slot="footer" class="dialog-footer"> + <el-button @click="addDialogVisible = false">鍙� 娑�</el-button> + <el-button type="primary" @click="handleAdd" v-loading="addLoading">纭� 瀹�</el-button> + </span> + </el-dialog> + <el-dialog title="鏌ョ湅闄勪欢" :visible.sync="lookDialogVisible" width="800px" top="5vh" fullscreen> + <filePreview v-if="lookDialogVisible" :fileUrl="javaApi + '/word/' + currentInfo.url" :currentFile="{}" + style="max-height: 90vh;overflow-y: auto;" /> + </el-dialog> + <!-- 鏂板/缂栬緫 --> + <el-dialog :title="title" :visible.sync="addDia" width="500px"> + <el-form :model="currentInfo" ref="currentInfoForm" :rules="rules" label-position="right" label-width="120px"> + <el-form-item label="鏂囦欢缂栧彿" prop="documentCode"> + <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="currentInfo.documentCode"></el-input> + </el-form-item> + <el-form-item label="绫诲埆" prop="type"> + <el-select v-model="currentInfo.type" size="small" clearable placeholder="璇烽�夋嫨" style="width: 100%"> + <el-option v-for="item in fileType" :key="item.value" :label="item.label" :value="item.value"> + </el-option> + </el-select> + </el-form-item> + <el-form-item label="鍚嶇О" prop="name"> + <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="currentInfo.name"> + </el-input> + </el-form-item> + <el-form-item label="鏂囦欢鐗堟湰" prop="version"> + <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="currentInfo.version"> + </el-input> + </el-form-item> + <el-form-item label="浣滆��" prop="writer"> + <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="currentInfo.writer"> + </el-input> + </el-form-item> + <el-form-item label="鐢熸晥鏃ユ湡" prop="effectiveDate"> + <el-date-picker v-model="currentInfo.effectiveDate" format="yyyy-MM-dd" value-format="yyyy-MM-dd" type="date" + size="small" placeholder="閫夋嫨鏃ユ湡"> + </el-date-picker> + </el-form-item> + <el-form-item label="鏂囦欢鐘舵��" prop="state"> + <el-select v-model="currentInfo.state" size="small" clearable placeholder="璇烽�夋嫨" style="width: 100%"> + <el-option v-for="item in fileState" :key="item.value" :label="item.label" :value="item.value"> + </el-option> + </el-select> + </el-form-item> + </el-form> + <span slot="footer" class="dialog-footer"> + <el-button @click="addDia = false">鍙� 娑�</el-button> + <el-button :loading="uploading" type="primary" @click="submitProduct('currentInfoForm')">纭� 璁�</el-button> + </span> + </el-dialog> + </div> +</template> + +<script> +import UpPdfStamp from '@/components/UpPdfStamp/index.vue' +import filePreview from '@/components/Preview/filePreview.vue' +import limsTable from "@/components/Table/lims-table.vue"; +import { + uploadFileManageDocumentList, + pageManageDocumentList, + delManageDocumentList, + doManageDocumentList, +} from '@/api/cnas/systemManagement/documentControl.js' +import { getToken } from "@/utils/auth"; +export default { + components: { + UpPdfStamp, + filePreview, + limsTable, + }, + data() { + return { + addDialogVisible: false, + lookDialogVisible: false, + addPower: false, + upLoading: false, + addLoading: false, + currentInfo: {}, + fileType: [], + fileState: [], + title: '鏂板', + queryParams: {}, + tableData: [], + column: [ + { label: "鏂囦欢缂栧彿", prop: "documentCode" }, + { + label: "绫诲埆", prop: "type", width: "120px", dataType: "tag", + formatData: (params) => { + return this.fileType.find((m) => m.value == params).label; + }, + formatType: (params) => { + return this.fileType.find((m) => m.value == params).type; + }, + }, + { + label: "鍚嶇О", + prop: "name", + }, + { label: "鏂囦欢鐗堟湰", prop: "version" }, + { label: "浣滆��", prop: "writer" }, + { label: "鐢熸晥鏃ユ湡", prop: "effectiveDate" }, + { + label: "鏂囦欢鐘舵��", prop: "state", dataType: "tag", + formatData: (params) => { + return this.fileState.find((m) => m.value == params).label; + }, + formatType: (params) => { + return this.fileState.find((m) => m.value == params).type; + }, + }, + { + dataType: "action", + fixed: "right", + label: "鎿嶄綔", + operation: [ + { + name: "缂栬緫", + type: "text", + clickFun: (row) => { + this.openAdd("缂栬緫", row); + }, + }, + { + name: "涓婁紶", + type: "text", + clickFun: (row) => { + this.handleUp(row); + }, + }, + { + name: "涓嬭浇", + type: "text", + clickFun: (row) => { + this.handleDown(row); + }, + }, + { + name: "鏌ョ湅闄勪欢", + type: "text", + clickFun: (row) => { + this.handleLook(row); + }, + }, + { + name: "鍒犻櫎", + type: "text", + clickFun: (row) => { + this.handleDelete(row); + }, + }, + ], + }, + ], + page: { + total: 0, + size: 10, + current: 0, + }, + tableLoading: false, + addDia: false, + rules: { + documentCode: [{ required: true, message: "璇疯緭鍏ユ枃浠剁紪鍙�", trigger: "blur" }], + }, + uploading: false, + } + }, + // 鐢ㄤ簬涓婁紶鏂囦欢鐨勪俊鎭� + computed: { + headers() { + return { + 'Authorization': "Bearer " + getToken() + } + }, + action() { + return this.javaApi + '/manageDocumentList/exportManageDocumentList' + } + }, + mounted() { + this.getList() + this.selectEnumByCategory() + }, + methods: { + getList() { + this.tableLoading = true; + let param = { ...this.queryParams, ...this.page }; + delete param.total; + pageManageDocumentList({ ...param }) + .then((res) => { + this.tableLoading = false; + if (res.code === 200) { + this.tableData = res.data.records; + this.page.total = res.data.total; + } + }) + .catch((err) => { + this.tableLoading = false; + }); + }, + pagination({ page, limit }) { + this.page.current = page; + this.page.size = limit; + this.getList(); + }, + refreshTable() { + this.page.current = 1; + this.getList(); + }, + refresh() { + this.queryParams = {}; + this.page.current = 1; + this.getList(); + }, + openAdd(title, row) { + this.title = title; + if (row) { + this.currentInfo = row; + } else { + this.currentInfo = {}; + } + this.addDia = true; + }, + // 涓嬭浇鏂囦欢 + handleDown(row) { + if (!row.url) return this.$message.warning('鏂囦欢鏈笂浼�') + let url = this.javaApi + '/word/' + row.url + this.$download.saveAs(url, row.url); + }, + // 鏌ョ湅鏂囦欢 + handleLook(row) { + if (!row.url) return this.$message.warning('鏂囦欢鏈笂浼�') + this.currentInfo = row + this.lookDialogVisible = true + }, + getPower() { + let power = JSON.parse(sessionStorage.getItem('power')) + let up = false + let upFile = false + let add = false + for (var i = 0; i < power.length; i++) { + if (power[i].menuMethod == 'doManageDocumentList') { + up = true + } + if (power[i].menuMethod == 'exportManageDocumentList') { + add = true + } + if (power[i].menuMethod == 'uploadFileManageDocumentList') { + upFile = true + } + } + if (!upFile) { + this.componentData.do.splice(1, 1) + } + if (!up) { + this.componentData.do.splice(0, 1) + } + this.addPower = add + }, + // 涓婁紶鏂囦欢 + handleUp(row) { + this.currentInfo = row + this.addDialogVisible = true; + }, + // 鎻愪氦涓婁紶 + handleAdd() { + this.addLoading = true + this.$refs['UpPdfStamp'].generatePDF() + }, + uploadPDFErr() { + this.addLoading = false + }, + 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.refreshTable() + } + }, + selectEnumByCategory() { + // 鏂囦欢绫诲埆 + this.getDicts("document_type").then((response) => { + this.fileType = this.dictToValue(response.data); + }); + // 鏂囦欢鐘舵�� + this.getDicts("document_state").then((response) => { + this.fileState = this.dictToValue(response.data); + }); + }, + async uploadPDF(pdfBlob, fileName) { + const formData = new FormData(); + 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 + } + }, + handleDelete(row) { + this.$confirm("鏄惁鍒犻櫎璇ユ潯鏁版嵁?", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { + delManageDocumentList({ id: row.id }).then((res) => { + if (res.code == 201) return; + this.$message.success("鍒犻櫎鎴愬姛"); + this.refresh(); + }); + }) + .catch(() => { }); + }, + submitProduct(formName) { + this.$refs[formName].validate((valid) => { + if (valid) { + this.uploading = true; + doManageDocumentList(this.currentInfo) + .then((res) => { + this.uploading = false; + if (res.code != 200) { + return; + } + this.$message.success("鎻愪氦鎴愬姛"); + this.refresh(); + this.addDia = false; + }) + .catch((err) => { + this.uploading = false; + }); + } else { + return false; + } + }); + }, + } +} +</script> + +<style scoped> +.title { + height: 60px; + line-height: 60px; +} + +.search { + background-color: #fff; + height: 40px; + display: flex; + align-items: center; + position: relative; +} + +.search_thing { + width: 350px; + display: flex; + align-items: center; +} + +.search_label { + width: 110px; + font-size: 14px; + text-align: right; +} + +.search_input { + width: calc(100% - 110px); +} + +.table { + background-color: #fff; + height: calc(100% - 60px - 80px); + padding: 20px; +} + +.btns { + position: absolute; + right: 20px; + top: 5px; +} +</style> diff --git a/src/views/CNAS/systemManagement/documentControl/components/FileObsoletionRequest.vue b/src/views/CNAS/systemManagement/documentControl/components/FileObsoletionRequest.vue new file mode 100644 index 0000000..6744fa5 --- /dev/null +++ b/src/views/CNAS/systemManagement/documentControl/components/FileObsoletionRequest.vue @@ -0,0 +1,496 @@ +<template> + <!-- 鏂囦欢浣滃簾鐢宠 --> + <div class="file-obsoletion-request" style="height: 100%;"> + <div class="search"> + <div class="search_thing"> + <div class="search_label">鏂囦欢缂栧彿锛�</div> + <div class="search_input"><el-input v-model="queryParams.documentCode" clearable placeholder="璇疯緭鍏�" size="small" + @keyup.enter.native="refreshTable()"></el-input></div> + </div> + <div class="search_thing" style="padding-left: 30px;"> + <el-button size="small" @click="refresh()">閲� 缃�</el-button> + <el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button> + </div> + <div class="btns" style="padding-left: 30px;"> + <el-button size="small" type="primary" @click="addDialogVisible = true, addInfo = {}">鏂囦欢浣滃簾鐢宠</el-button> + <el-button :loading="outLoading" size="small" type="primary" @click="handleOut">瀵煎嚭</el-button> + </div> + </div> + <div class="table"> + <!-- <ValueTable :key="upIndex" ref="ValueTable" :componentData="componentData" + :delUrl="$api.manageDocumentList.delManageDocumentCancel" + :url="$api.manageDocumentList.pageManageDocumentCancel" /> --> + <lims-table :tableData="tableData" :column="column" :page="page" :tableLoading="tableLoading" + :height="'calc(100vh - 290px)'" @pagination="pagination"></lims-table> + </div> + <el-dialog :visible.sync="addDialogVisible" title="鏂囦欢浣滃簾鐢宠" top="10vh" width="800px"> + <el-row> + <el-col :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label"><span style="color:red;margin-right: 4px;">*</span>鐢宠缂栧彿锛�</div> + <div class="search_input"> + <el-select v-model="addInfo.documentCode" allow-create clearable filterable size="small" + style="width: 100%;" @change="changeFileList"> + <el-option v-for="item in fileList" :key="item.documentCode" :label="item.documentCode" + :value="item.documentCode"> + </el-option> + </el-select> + </div> + </div> + </el-col> + <el-col :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">瀹℃壒浜猴細</div> + <div class="search_input"> + <el-select v-model="addInfo.checkUser" filterable size="small" style="width: 100%;"> + <el-option v-for="item in personList" :key="item.value" :label="item.label" :value="item.value"> + </el-option> + </el-select> + </div> + </div> + </el-col> + <el-col :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">鏂囦欢鍚嶇О锛�</div> + <div class="search_input"><el-input v-model="addInfo.name" clearable placeholder="璇疯緭鍏�" + size="small"></el-input></div> + </div> + </el-col> + <el-col :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">鏂囦欢鐗堟湰锛�</div> + <div class="search_input"><el-input v-model="addInfo.version" clearable placeholder="璇疯緭鍏�" + size="small"></el-input></div> + </div> + </el-col> + <el-col :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">鏂囦欢鐘舵�侊細</div> + <div class="search_input"> + <el-select v-model="addInfo.state" size="small" style="width: 100%;"> + <el-option v-for="(item, index) in fileState" :key="index" :label="item.label" + :value="item.value"></el-option> + </el-select> + </div> + </div> + </el-col> + <!-- <el-col :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">浣滃簾鏂瑰紡锛�</div> + <div class="search_input"> + <el-select v-model="addInfo.method" size="small" style="width: 100%;"> + <el-option label="浣滃簾" value="浣滃簾"></el-option> + <el-option label="鏃犳晥" value="鏃犳晥"></el-option> + </el-select> + </div> + </div> + </el-col> --> + <el-col :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">鏈熸湜浣滃簾鏃堕棿锛�</div> + <div class="search_input"> + <el-date-picker v-model="addInfo.expectCancelDate" format="yyyy-MM-dd" placeholder="閫夋嫨鏃ユ湡" size="small" + style="width: 100%;" type="date" value-format="yyyy-MM-dd"> + </el-date-picker> + </div> + </div> + </el-col> + <el-col :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">瀹為檯浣滃簾鏃堕棿锛�</div> + <div class="search_input"> + <el-date-picker v-model="addInfo.actuallyCancelDate" format="yyyy-MM-dd" placeholder="閫夋嫨鏃ユ湡" size="small" + style="width: 100%;" type="date" value-format="yyyy-MM-dd"> + </el-date-picker> + </div> + </div> + </el-col> + <el-col :span="12" style="margin-bottom: 16px;"> + <div class="search_thing"> + <div class="search_label">浣滃簾璇存槑锛�</div> + <div class="search_input"><el-input v-model="addInfo.cancelNote" :rows="2" clearable placeholder="璇疯緭鍏�" + size="small" type="textarea"></el-input></div> + </div> + </el-col> + </el-row> + <span slot="footer" class="dialog-footer"> + <el-button @click="addDialogVisible = false">鍙� 娑�</el-button> + <el-button :loading="addLoading" type="primary" @click="handleAdd">纭� 瀹�</el-button> + </span> + </el-dialog> + </div> +</template> + +<script> +import limsTable from "@/components/Table/lims-table.vue"; +import { + selectUserCondition, +} from "@/api/business/inspectionTask.js"; +import { + addManageDocumentCancel, + pageManageDocumentList, + doManageDocumentCancel, + checkManageDocumentCancel, + exportManageDocumentCancel, + delManageDocumentCancel, + pageManageDocumentCancel, +} from '@/api/cnas/systemManagement/documentControl.js' +import { mapGetters } from "vuex"; +export default { + components: { + limsTable + }, + computed: { + ...mapGetters(["userId"]), + }, + data() { + return { + addPower: false, + outPower: false, + addInfo: {}, + addLoading: false, + addDialogVisible: false, + personList: [], + fileList: [], + outLoading: false, + fileState: [], + queryParams: {}, + tableData: [], + column: [ + { label: "鏂囦欢缂栧彿", prop: "documentCode" }, + { label: "鐢宠浜�", prop: "createUserName", width: "120px" }, + { + label: "浣滃簾璇存槑", + prop: "cancelNote", + }, + { label: "鏈熸湜浣滃簾鏃堕棿", prop: "expectCancelDate" }, + { label: "瀹為檯浣滃簾鏃ユ湡", prop: "actuallyCancelDate" }, + { + label: "浣滃簾鐘舵��", prop: "state", dataType: "tag", + formatData: (params) => { + return params; + }, + formatType: (params) => { + if (params == '閫氳繃') { + return 'success' + } else { + return 'danger' + } + } + }, + { + dataType: "action", + fixed: "right", + label: "鎿嶄綔", + operation: [ + { + name: "缂栬緫", + type: "text", + clickFun: (row) => { + this.handleUpdate(row); + }, + disabled: (row, index) => { + return row.state == '閫氳繃' + } + }, + { + name: "鍒犻櫎", + type: "text", + clickFun: (row) => { + this.handleDelete(row); + }, + disabled: (row, index) => { + return row.state == '閫氳繃' + } + }, + { + name: "瀹℃牳", + type: "text", + clickFun: (row) => { + this.handleCheck(row); + }, + disabled: (row, index) => { + return row.checkUser != this.userId || row.state == '閫氳繃' + } + }, + ], + }, + ], + page: { + total: 0, + size: 10, + current: 0, + }, + tableLoading: false, + } + }, + mounted() { + this.getList() + this.getAuthorizedPerson() + this.getFileList() + this.selectEnumByCategory() + }, + methods: { + getPower() { + let power = JSON.parse(sessionStorage.getItem('power')) + let out = false + let del = false + let add = false + // let check = false + for (var i = 0; i < power.length; i++) { + if (power[i].menuMethod == 'exportManageDocumentCancel') { + out = true + } + if (power[i].menuMethod == 'addManageDocumentCancel') { + add = true + } + if (power[i].menuMethod == 'delManageDocumentCancel') { + del = true + } + // if (power[i].menuMethod == 'checkManageDocumentControlled') { + // check = true + // } + } + // if (!check) { + // this.componentData.do.splice(2, 1) + // } + if (!del) { + this.componentData.do.splice(1, 1) + } + if (!add) { + this.componentData.do.splice(0, 1) + } + this.addPower = add + this.outPower = out + }, + getList() { + this.tableLoading = true; + let param = { ...this.queryParams, ...this.page }; + delete param.total; + pageManageDocumentCancel({ ...param }) + .then((res) => { + this.tableLoading = false; + if (res.code === 200) { + this.tableData = res.data.records; + this.page.total = res.data.total; + } + }) + .catch((err) => { + this.tableLoading = false; + }); + }, + pagination({ page, limit }) { + this.page.current = page; + this.page.size = limit; + this.getList(); + }, + refresh() { + this.queryParams = {}; + this.page.current = 1; + this.getList(); + }, + refreshTable() { + this.page.current = 1; + this.getList(); + }, + selectEnumByCategory() { + // 鏂囦欢鐘舵�� + this.getDicts("document_state").then((response) => { + this.fileState = this.dictToValue(response.data); + }); + }, + // 鑾峰彇浜哄憳鍒楄〃 + getAuthorizedPerson() { + selectUserCondition().then(res => { + let data = [] + res.data.forEach(a => { + data.push({ + label: a.name, + value: a.id + }) + }) + this.personList = data + }) + }, + // 鑾峰彇鏂囦欢鍒楄〃 + getFileList() { + pageManageDocumentList({ + current: -1, + size: -1 + }).then(res => { + this.fileList = res.data.records + }).catch(err => { }) + }, + // 鎻愪氦 + handleAdd() { + if (!this.addInfo.documentCode) { + this.$message.error('璇疯緭鍏ョ敵璇风紪鍙�') + return false + } + this.addInfo.method = '浣滃簾' + this.addLoading = true + if (!this.addInfo.id) { + // 鏂板 + addManageDocumentCancel(this.addInfo).then(res => { + this.addLoading = false + this.refreshTable() + this.$message({ + type: 'success', + message: '鎻愪氦鎴愬姛' + }) + this.addDialogVisible = false + }).catch(err => { }) + } else { + // 缂栬緫 + doManageDocumentCancel({ + id: this.addInfo.id, + method: '浣滃簾', + documentCode: this.addInfo.documentCode, + checkUser: this.addInfo.checkUser, + name: this.addInfo.name, + version: this.addInfo.version, + documentState: this.addInfo.documentState, + expectCancelDate: this.addInfo.expectCancelDate, + actuallyCancelDate: this.addInfo.actuallyCancelDate, + cancelNote: this.addInfo.cancelNote, + }).then(res => { + this.addLoading = false + this.refreshTable() + this.$message({ + type: 'success', + message: '鎻愪氦鎴愬姛' + }) + this.addDialogVisible = false + }).catch(err => { }) + } + + }, + // 閫変腑鏂囦欢 + changeFileList(e) { + if (e) { + let obj = this.fileList.find(a => a.documentCode == e) + if (obj) { + this.addInfo.name = obj.name + this.addInfo.version = obj.version + this.addInfo.documentState = obj.state + } + } + }, + handleUpdate(row) { + this.addInfo = this.HaveJson(row) + this.addDialogVisible = true + }, + // 瀹℃牳 + handleCheck(row) { + this.$confirm('鏄惁瀹℃牳閫氳繃?', '鎻愮ず', { + confirmButtonText: '閫氳繃', + cancelButtonText: '涓嶉�氳繃', + type: 'warning', + closeOnClickModal: false, // 绂佹鐐瑰嚮閬僵灞傚叧闂� + distinguishCancelAndClose: true, + beforeClose: (action, instance, done) => { + if (action === 'confirm') { + // 鐐瑰嚮鈥滅‘瀹氣�濇寜閽紝鍏佽鍏抽棴 + checkManageDocumentCancel({ id: row.id, state: '閫氳繃' }).then(res => { + this.refreshTable() + done(); + this.$message({ + type: 'success', + message: '鎻愪氦鎴愬姛' + }) + }) + .catch(err => { + + }) + } else if (action === 'cancel') { + // 鐐瑰嚮鈥滃彇娑堚�濇寜閽紝涓嶅厑璁稿叧闂� + checkManageDocumentCancel({ id: row.id, state: '涓嶉�氳繃' }).then(res => { + this.refreshTable() + done(); + this.$message({ + type: 'success', + message: '鎻愪氦鎴愬姛' + }) + }) + .catch(err => { + + }) + } else if (action === 'close') { + // 鐐瑰嚮鈥溍椻�濇寜閽紝涓嶅厑璁稿叧闂� + done(); + console.log("脳鎸夐挳鐐瑰嚮浜嬩欢锛屼笉鍏抽棴寮规"); + } + } + }) + }, + // 瀵煎嚭 + handleOut() { + this.outLoading = true + exportManageDocumentCancel(this.queryParams).then(res => { + this.outLoading = false + const blob = new Blob([res], { type: 'application/octet-stream' }); + this.$download.saveAs(blob, '鏂囦欢浣滃簾琛�.xlsx') + this.$message.success('瀵煎嚭鎴愬姛') + }) + }, + handleDelete(row) { + this.$confirm("鏄惁鍒犻櫎璇ユ潯鏁版嵁?", "鎻愮ず", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning", + }) + .then(() => { + delManageDocumentCancel({ id: row.id }).then((res) => { + if (res.code == 201) return; + this.$message.success("鍒犻櫎鎴愬姛"); + this.refresh(); + }); + }) + .catch(() => { }); + }, + } +} +</script> + +<style scoped> +.title { + height: 60px; + line-height: 60px; +} + +.search { + background-color: #fff; + height: 40px; + display: flex; + align-items: center; + position: relative; +} + +.search_thing { + width: 350px; + display: flex; + align-items: center; +} + +.search_label { + width: 110px; + font-size: 14px; + text-align: right; +} + +.search_input { + width: calc(100% - 110px); +} + +.table { + background-color: #fff; + height: calc(100% - 60px - 80px); + padding: 20px; +} + +.btns { + position: absolute; + right: 20px; + top: 5px; +} +</style> diff --git a/src/views/CNAS/systemManagement/documentControl/index.vue b/src/views/CNAS/systemManagement/documentControl/index.vue new file mode 100644 index 0000000..5062e5c --- /dev/null +++ b/src/views/CNAS/systemManagement/documentControl/index.vue @@ -0,0 +1,67 @@ +<template> + <div class="file-handling"> + <el-tabs type="border-card" v-model="activeName" style="height: 100%;"> + <el-tab-pane :label="item.name" :name="item.component" v-for="(item, index) in tabList" :key="index" + style="height: 100%;"> + <component :is="item.component" :key="item.component"></component> + </el-tab-pane> + </el-tabs> + </div> +</template> + +<script> +import FileList from './components/FileList.vue' +import ControlledFileApplication from './components/ControlledFileApplication.vue' +import DistributionCollectionRecord from './components/DistributionCollectionRecord.vue' +import FileChangeRequest from './components/FileChangeRequest.vue' +import FileObsoletionRequest from './components/FileObsoletionRequest.vue' +export default { + components: { + FileList, + ControlledFileApplication, + DistributionCollectionRecord, + FileChangeRequest, + FileObsoletionRequest + }, + data() { + return { + tabList: [ + { + name: '鏂囦欢娓呭崟', + component: 'FileList' + }, + { + name: '鏂囦欢鍙楁帶鐢宠', + component: 'ControlledFileApplication' + }, + { + name: '鍙戞斁鍥炴敹璁板綍', + component: 'DistributionCollectionRecord' + }, + { + name: '鏂囦欢鍙樻洿鐢宠', + component: 'FileChangeRequest' + }, + { + name: '鏂囦欢浣滃簾鐢宠', + component: 'FileObsoletionRequest' + }, + ], + activeName: 'FileList' + }; + }, +} +</script> + +<style scoped> +.file-handling { + margin-top: 10px; + height: calc(100% - 20px); +} + +>>>.el-tabs__content { + height: 100%; + padding: 0; + padding-top: 10px; +} +</style> diff --git a/src/views/business/inspectionTask/inspection.vue b/src/views/business/inspectionTask/inspection.vue index aea46d7..3a77d1f 100644 --- a/src/views/business/inspectionTask/inspection.vue +++ b/src/views/business/inspectionTask/inspection.vue @@ -546,6 +546,7 @@ import DataWorker from '../../../DataWorker.worker'; import html2canvas from "html2canvas"; import { mapGetters } from "vuex"; +import { getToken } from "@/utils/auth"; export default { name: 'inspection', components: { @@ -771,7 +772,7 @@ ...mapGetters(["userId"]), headers() { return { - token: sessionStorage.getItem("token"), + 'Authorization': "Bearer " + getToken() }; }, action() { diff --git a/src/views/business/materialOrderComponents/materialOrder/filesLookVisible.vue b/src/views/business/materialOrderComponents/materialOrder/filesLookVisible.vue index bf6d838..5b90f8e 100644 --- a/src/views/business/materialOrderComponents/materialOrder/filesLookVisible.vue +++ b/src/views/business/materialOrderComponents/materialOrder/filesLookVisible.vue @@ -3,23 +3,20 @@ <el-dialog title="闄勪欢鏌ョ湅" :visible.sync="isShow" width="80%" @closed="$emit('closeFilesLook')"> <div style="display: flex;justify-content: space-between;"> <ul class="tab"> - <li v-for="(m,i) in dataVisibleTitle" :key="i" :class="{active:i===dataVisibleIndex}" @click="handleDataVisibleTab(m,i)">{{m.label}}</li> + <li v-for="(m, i) in dataVisibleTitle" :key="i" :class="{ active: i === dataVisibleIndex }" + @click="handleDataVisibleTab(m, i)">{{ m.label }}</li> </ul> - <el-upload :action="action" - :auto-upload="true" - :data="{orderId: dataVisibleIndex === 0 ? filesLookInfo.enterOrderId : filesLookInfo.quarterOrderId}" - :on-success="handleSuccessUp" :show-file-list="false" - accept='.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar' :headers="headers" - :before-upload="beforeUpload" - style="width: 80px !important;" - :on-error="onError" ref='upload'> + <el-upload :action="action" :auto-upload="true" + :data="{ orderId: dataVisibleIndex === 0 ? filesLookInfo.enterOrderId : filesLookInfo.quarterOrderId }" + :on-success="handleSuccessUp" :show-file-list="false" + accept='.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar' :headers="headers" + :before-upload="beforeUpload" style="width: 80px !important;" :on-error="onError" ref='upload'> <el-button size="small" type="primary" style="height: 38px">闄勪欢涓婁紶</el-button> </el-upload> </div> <div v-if="filesDialogVisible"> - <lims-table :tableData="tableDataFile" :column="columnFile" - @pagination="paginationFile" height="500px" key="tableDataFile" - :page="pageFile" :tableLoading="tableLoadingFile"></lims-table> + <lims-table :tableData="tableDataFile" :column="columnFile" @pagination="paginationFile" height="500px" + key="tableDataFile" :page="pageFile" :tableLoading="tableLoadingFile"></lims-table> </div> </el-dialog> </div> @@ -29,12 +26,12 @@ import ValueTable from "@/components/Table/value-table.vue"; import file from "@/utils/file"; import limsTable from "@/components/Table/lims-table.vue"; -import {delfile, downFile, getFileList} from "@/api/business/rawMaterialOrder"; - +import { delfile, downFile, getFileList } from "@/api/business/rawMaterialOrder"; +import { getToken } from "@/utils/auth"; export default { name: "filesLookVisible", // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢� - components: {limsTable, ValueTable}, + components: { limsTable, ValueTable }, props: { filesDialogVisible: { type: Boolean, @@ -42,7 +39,7 @@ }, filesLookInfo: { type: Object, - default: () => {} + default: () => { } }, }, data() { @@ -74,9 +71,9 @@ } } }, - {label: '闄勪欢鍚嶇О', prop: 'fileName'}, - {label: '涓婁紶浜�', prop: 'name'}, - {label: '涓婁紶鏃堕棿', prop: 'createTime'}, + { label: '闄勪欢鍚嶇О', prop: 'fileName' }, + { label: '涓婁紶浜�', prop: 'name' }, + { label: '涓婁紶鏃堕棿', prop: 'createTime' }, { dataType: 'action', fixed: 'right', @@ -101,9 +98,9 @@ } ], pageFile: { - total:0, - size:10, - current:1 + total: 0, + size: 10, + current: 1 }, isShow: this.filesDialogVisible, dataVisibleTitle: [ @@ -118,7 +115,7 @@ ], dataVisibleIndex: 0, // tab鏍忛�夋嫨鍊� entity: { - insOrderId:'' + insOrderId: '' }, } }, @@ -128,7 +125,7 @@ // 鏂规硶闆嗗悎 methods: { // 鍒囨崲鏁版嵁鏌ョ湅tab鏍� - handleDataVisibleTab (m, i) { + handleDataVisibleTab(m, i) { this.dataVisibleIndex = i this.getFileList() }, @@ -140,7 +137,7 @@ this.entity.insOrderId = this.filesLookInfo.quarterOrderId } this.tableLoadingFile = true - const params = {...this.entity} + const params = { ...this.entity } getFileList(params).then(res => { this.tableLoadingFile = false if (res.code === 200) { @@ -151,20 +148,20 @@ this.tableLoadingFile = false }) }, - paginationFile (page) { + paginationFile(page) { this.pageFile.size = page.limit this.getFileList() }, // 涓嬭浇 - handleDown(row){ - downFile({id: row.id,}).then(res => { + handleDown(row) { + downFile({ id: row.id, }).then(res => { if (res.code === 200) { let url = ''; - if(res.data.type==1){ - url = this.javaApi+'/img/'+res.data.fileUrl - file.downloadIamge(url,row.fileName) - }else{ - url = this.javaApi+'/word/'+res.data.fileUrl + if (res.data.type == 1) { + url = this.javaApi + '/img/' + res.data.fileUrl + file.downloadIamge(url, row.fileName) + } else { + url = this.javaApi + '/word/' + res.data.fileUrl const link = document.createElement('a'); link.href = url; link.download = row.fileName; @@ -175,7 +172,7 @@ }) }, - handleSuccessUp(response, ) { + handleSuccessUp(response,) { this.upLoading = false; if (response.code == 200) { this.$message.success('涓婁紶鎴愬姛'); @@ -205,13 +202,13 @@ this.$refs.upload.clearFiles() }, // 鍒犻櫎 - delete (row) { + delete(row) { this.$confirm('鏄惁鍒犻櫎褰撳墠鏁版嵁?', "璀﹀憡", { confirmButtonText: "纭畾", cancelButtonText: "鍙栨秷", type: "warning" }).then(() => { - delfile({id: row.id}).then(res => { + delfile({ id: row.id }).then(res => { if (res.code === 500) { return } @@ -220,13 +217,13 @@ }).catch(e => { this.$message.error('鍒犻櫎澶辫触') }) - }).catch(() => {}) + }).catch(() => { }) } }, computed: { headers() { return { - 'token': sessionStorage.getItem('token') + 'Authorization': "Bearer " + getToken() } }, action() { diff --git a/src/views/structural/premises/index.vue b/src/views/structural/premises/index.vue index 0204f36..8ff0e53 100644 --- a/src/views/structural/premises/index.vue +++ b/src/views/structural/premises/index.vue @@ -5,11 +5,11 @@ <el-form :model="queryParams" ref="queryForm" size="small" :inline="true"> <el-form-item label="瀹為獙瀹ゅ悕绉�" prop="laboratoryName"> <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="queryParams.laboratoryName" - @keyup.enter.native="refreshTable"></el-input> + @keyup.enter.native="refreshTable"></el-input> </el-form-item> <el-form-item label="瀹為獙瀹ょ紪鐮�" prop="laboratoryNumber"> <el-input size="small" placeholder="璇疯緭鍏�" clearable v-model="queryParams.laboratoryNumber" - @keyup.enter.native="refreshTable"></el-input> + @keyup.enter.native="refreshTable"></el-input> </el-form-item> <el-form-item> <el-button type="primary" icon="el-icon-search" size="mini" @click="refreshTable">鏌� 璇�</el-button> @@ -22,15 +22,13 @@ </div> </div> <div class="table"> - <lims-table :tableData="tableData" :column="column" - :height="'calc(100vh - 250px)'" - @pagination="pagination" - :page="page" :tableLoading="tableLoading"></lims-table> + <lims-table :tableData="tableData" :column="column" :height="'calc(100vh - 250px)'" @pagination="pagination" + :page="page" :tableLoading="tableLoading"></lims-table> </div> -<!-- 鏂板瀹為獙瀹�--> + <!-- 鏂板瀹為獙瀹�--> <el-dialog :title="formTitle" :visible.sync="addDia" width="450px"> - <el-form ref="laboratoryForm" :model="laboratoryForm" :rules="userRules" - label-position="right" label-width="100px"> + <el-form ref="laboratoryForm" :model="laboratoryForm" :rules="userRules" label-position="right" + label-width="100px"> <el-form-item label="瀹為獙瀹ゅ悕绉�" prop="laboratoryName"> <el-input v-model="laboratoryForm.laboratoryName" size="small" clearable></el-input> </el-form-item> @@ -51,52 +49,36 @@ </el-form-item> </el-form> <span slot="footer" class="dialog-footer"> - <el-button @click="reset">鍙� 娑�</el-button> - <el-button type="primary" @click="customAdd" :loading="loading">纭� 瀹�</el-button> - </span> + <el-button @click="reset">鍙� 娑�</el-button> + <el-button type="primary" @click="customAdd" :loading="loading">纭� 瀹�</el-button> + </span> </el-dialog> <el-dialog title="鍗扮珷绠$悊" :visible.sync="fileVisible" width="60vw"> <div class="btns"> <el-button size="medium" type="primary" @click="openUpload">鏇存柊鍗扮珷</el-button> </div> - <lims-table :tableData="fileComponentData" :column="fileComponentDataColumn" - @pagination="fileComponentPagination" height="500px" - :page="fileComponentPage" :tableLoading="fileComponentTableLoading"></lims-table> + <lims-table :tableData="fileComponentData" :column="fileComponentDataColumn" @pagination="fileComponentPagination" + height="500px" :page="fileComponentPage" :tableLoading="fileComponentTableLoading"></lims-table> </el-dialog> <el-dialog title="鏇存柊鍗扮珷" :visible.sync="upFileVisible" width="400px"> - <el-form ref="dataForm" :model="dataForm" :rules="dataFormRules" - label-position="right" label-width="80px"> + <el-form ref="dataForm" :model="dataForm" :rules="dataFormRules" label-position="right" label-width="80px"> <el-form-item label="鍗扮珷绫诲瀷" prop="type"> - <el-cascader - v-model="dataForm.type" - :options="options" - :show-all-levels="false" - :props="props" - placeholder="璇烽�夋嫨" size="small" - style="width:100%" - collapse-tags - clearable></el-cascader> + <el-cascader v-model="dataForm.type" :options="options" :show-all-levels="false" :props="props" + placeholder="璇烽�夋嫨" size="small" style="width:100%" collapse-tags clearable></el-cascader> </el-form-item> <el-form-item label="鍗扮珷鍥剧墖" prop="address"> - <el-upload - class="avatar-uploader" - :action="action" - :headers="headers" - accept='image/jpg,image/jpeg,image/png' - :show-file-list="false" - :on-success="handleSuccess" - :on-change="beforeUpload" - ref="upload" + <el-upload class="avatar-uploader" :action="action" :headers="headers" accept='image/jpg,image/jpeg,image/png' + :show-file-list="false" :on-success="handleSuccess" :on-change="beforeUpload" ref="upload" :on-error="onError"> - <img v-if="dataForm.address" :src="javaApi+'/img/'+dataForm.address" class="avatar" > + <img v-if="dataForm.address" :src="javaApi + '/img/' + dataForm.address" class="avatar"> <i v-else class="el-icon-plus avatar-uploader-icon"></i> </el-upload> </el-form-item> </el-form> <span slot="footer" class="dialog-footer"> - <el-button @click="upFileVisible = false">鍙� 娑�</el-button> - <el-button type="primary" @click="confirmConnect" :loading="loading">纭� 瀹�</el-button> - </span> + <el-button @click="upFileVisible = false">鍙� 娑�</el-button> + <el-button type="primary" @click="confirmConnect" :loading="loading">纭� 瀹�</el-button> + </span> </el-dialog> </div> </template> @@ -111,8 +93,8 @@ selectSeal, upParameter } from "@/api/structural/laboratoryScope"; -import {getCertificationDetail} from "@/api/structural/laboratory"; - +import { getCertificationDetail } from "@/api/structural/laboratory"; +import { getToken } from "@/utils/auth"; export default { components: { limsTable @@ -121,7 +103,7 @@ computed: { headers() { return { - 'token': sessionStorage.getItem('token') + 'Authorization': "Bearer " + getToken() } }, action() { @@ -137,14 +119,14 @@ tableData: [], tableLoading: false, column: [ - {label: '瀹為獙瀹ゅ悕绉�', prop: 'laboratoryName'}, - {label: '鍦烘墍缂栫爜', prop: 'laboratoryNumber'}, - {label: '瀹為獙瀹や唬鍙�', prop: 'laboratoryCode'}, - {label: '璐熻矗浜�', prop: 'head'}, - {label: '璐熻矗浜虹數璇�', prop: 'phoneNumber'}, - {label: '鍦板潃', prop: 'address'}, - {label: '鍒涘缓浜�', prop: 'createUserName'}, - {label: '鍒涘缓鏃堕棿', prop: 'createTime'}, + { label: '瀹為獙瀹ゅ悕绉�', prop: 'laboratoryName' }, + { label: '鍦烘墍缂栫爜', prop: 'laboratoryNumber' }, + { label: '瀹為獙瀹や唬鍙�', prop: 'laboratoryCode' }, + { label: '璐熻矗浜�', prop: 'head' }, + { label: '璐熻矗浜虹數璇�', prop: 'phoneNumber' }, + { label: '鍦板潃', prop: 'address' }, + { label: '鍒涘缓浜�', prop: 'createUserName' }, + { label: '鍒涘缓鏃堕棿', prop: 'createTime' }, { dataType: 'action', fixed: 'right', @@ -176,9 +158,9 @@ } ], page: { - total:0, - size:10, - current:1 + total: 0, + size: 10, + current: 1 }, addDia: false, formTitle: '', @@ -196,43 +178,43 @@ fileComponentTableLoading: false, fileComponentData: [], fileComponentDataColumn: [ - {label: '瀹為獙瀹ゅ悕绉�', prop: 'laboratoryName'}, - {label: '鍗扮珷鍥剧墖', prop: 'address', dataType: 'image'}, - {label: '鍗扮珷绫诲瀷', prop: 'type'}, + { label: '瀹為獙瀹ゅ悕绉�', prop: 'laboratoryName' }, + { label: '鍗扮珷鍥剧墖', prop: 'address', dataType: 'image' }, + { label: '鍗扮珷绫诲瀷', prop: 'type' }, ], fileComponentPage: { - total:0, - size:10, - current:1, + total: 0, + size: 10, + current: 1, layout: 'total, prev, pager, next' }, - fileVisible:false, - upFileVisible:false, - loading:false, - dataForm:{ - type:'', - address:'', + fileVisible: false, + upFileVisible: false, + loading: false, + dataForm: { + type: '', + address: '', }, dataFormRules: { type: [{ required: true, message: '璇烽�夋嫨鍗扮珷绫诲瀷', trigger: 'change' }], address: [{ required: false, message: '璇蜂笂浼犲浘鐗�', trigger: 'change' }], }, - props: { multiple: false,emitPath:false,}, - options:[ + props: { multiple: false, emitPath: false, }, + options: [ { - value:'瀹為獙瀹よ祫璐�', - label:'瀹為獙瀹よ祫璐�', - children:[] + value: '瀹為獙瀹よ祫璐�', + label: '瀹為獙瀹よ祫璐�', + children: [] }, { - value:'濮旀墭鎶ュ憡', - label:'濮旀墭鎶ュ憡', - children:null + value: '濮旀墭鎶ュ憡', + label: '濮旀墭鎶ュ憡', + children: null }, { - value:'杩涘巶鎶ュ憡', - label:'杩涘巶鎶ュ憡', - children:null + value: '杩涘巶鎶ュ憡', + label: '杩涘巶鎶ュ憡', + children: null }, ], } @@ -243,7 +225,7 @@ methods: { refreshTable() { this.tableLoading = true - selectItemParameter({...this.page, ...this.queryParams}).then(res => { + selectItemParameter({ ...this.page, ...this.queryParams }).then(res => { this.tableLoading = false if (res.code === 200) { this.tableData = res.data.records @@ -259,7 +241,7 @@ this.refreshTable() }, // 鍒嗛〉鍒囨崲 - pagination (page) { + pagination(page) { this.page.size = page.limit this.refreshTable() }, @@ -300,34 +282,34 @@ } }) }, - reset () { + reset() { this.resetForm('laboratoryForm') this.addDia = false }, // 鍒犻櫎瀹為獙瀹� - delete (row) { + delete(row) { this.$confirm('鏄惁鍒犻櫎褰撳墠鏁版嵁?', "璀﹀憡", { confirmButtonText: "纭畾", cancelButtonText: "鍙栨秷", type: "warning" }).then(() => { - delParameter({id: row.id}).then(res => { + delParameter({ id: row.id }).then(res => { this.$message.success('鍒犻櫎鎴愬姛') this.refreshTable() }).catch(e => { this.$message.error('鍒犻櫎澶辫触') }) - }).catch(() => {}) + }).catch(() => { }) }, // 鎵撳紑鍗扮珷绠$悊寮规 - fileManagement(row){ + fileManagement(row) { this.fileVisible = true; this.fileComponentTableLoading = true this.currentRow = row this.getFileComponentList() }, - getFileComponentList () { - selectSeal({id: this.currentRow.id, ...this.fileComponentPage}).then(res => { + getFileComponentList() { + selectSeal({ id: this.currentRow.id, ...this.fileComponentPage }).then(res => { this.fileComponentTableLoading = false if (res.code === 200) { this.fileComponentData = res.data.records @@ -337,19 +319,19 @@ this.fileComponentTableLoading = false }) }, - fileComponentPagination (page) { + fileComponentPagination(page) { this.fileComponentPage.size = page.limit this.getFileComponentList() }, // 鎵撳紑鏇存柊鍗扮珷寮规 - openUpload(){ + openUpload() { this.dataForm.type = ''; this.dataForm.address = ''; this.upFileVisible = true; this.getCertificationOperation() }, // 鏌ヨ鍗扮珷绫诲瀷 - getCertificationOperation(){ + getCertificationOperation() { const params = { current: -1, size: -1, @@ -363,11 +345,11 @@ }) }, // 鎻愪氦鏇存柊鍗扮珷 - confirmConnect(){ + confirmConnect() { this.$refs['dataForm'].validate((valid) => { if (valid) { this.loading = true; - addSeal({labId:this.currentRow.id, ...this.dataForm}).then(res => { + addSeal({ labId: this.currentRow.id, ...this.dataForm }).then(res => { this.loading = false; this.getFileComponentList() this.upFileVisible = false; @@ -375,12 +357,12 @@ } }) }, - handleSuccess(response,){ + handleSuccess(response,) { if (response.code === 200) { this.dataForm.address = response.data.url } }, - beforeUpload(file,type) { + beforeUpload(file, type) { if (file.size > 1024 * 1024 * 10) { this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10M'); this.$refs.upload.clearFiles() @@ -389,7 +371,7 @@ return true; } }, - onError(err, file, fileList,type) { + onError(err, file, fileList, type) { this.$message.error('涓婁紶澶辫触') this.$refs.upload.clearFiles() }, @@ -402,13 +384,16 @@ display: flex; justify-content: space-between; } -.btns{ + +.btns { text-align: right; margin-bottom: 10px; } + ::v-deep .el-dialog__body { padding-top: 8px !important; } + .avatar-uploader ::v-deep .el-upload { border: 1px dashed #666666; border-radius: 6px; @@ -416,9 +401,11 @@ position: relative; overflow: hidden; } + .avatar-uploader ::v-deep .el-upload:hover { border-color: #409EFF; } + .avatar-uploader-icon { font-size: 20px; color: #8c939d; @@ -427,6 +414,7 @@ line-height: 90px; text-align: center; } + .avatar { width: 90px; height: 90px; diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue index 5a37d9d..c9e5b75 100644 --- a/src/views/system/menu/index.vue +++ b/src/views/system/menu/index.vue @@ -2,21 +2,12 @@ <div class="app-container"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"> <el-form-item label="鑿滃崟鍚嶇О" prop="menuName"> - <el-input - v-model="queryParams.menuName" - placeholder="璇疯緭鍏ヨ彍鍗曞悕绉�" - clearable - @keyup.enter.native="handleQuery" - /> + <el-input v-model="queryParams.menuName" placeholder="璇疯緭鍏ヨ彍鍗曞悕绉�" clearable @keyup.enter.native="handleQuery" /> </el-form-item> <el-form-item label="鐘舵��" prop="status"> <el-select v-model="queryParams.status" placeholder="鑿滃崟鐘舵��" clearable> - <el-option - v-for="dict in dict.type.sys_normal_disable" - :key="dict.value" - :label="dict.label" - :value="dict.value" - /> + <el-option v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.label" + :value="dict.value" /> </el-select> </el-form-item> <el-form-item> @@ -27,35 +18,17 @@ <el-row :gutter="10" class="mb8"> <el-col :span="1.5"> - <el-button - type="primary" - plain - icon="el-icon-plus" - size="mini" - @click="handleAdd" - v-hasPermi="['system:menu:add']" - >鏂板</el-button> + <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" + v-hasPermi="['system:menu:add']">鏂板</el-button> </el-col> <el-col :span="1.5"> - <el-button - type="info" - plain - icon="el-icon-sort" - size="mini" - @click="toggleExpandAll" - >灞曞紑/鎶樺彔</el-button> + <el-button type="info" plain icon="el-icon-sort" size="mini" @click="toggleExpandAll">灞曞紑/鎶樺彔</el-button> </el-col> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> </el-row> - <el-table - v-if="refreshTable" - v-loading="loading" - :data="menuList" - row-key="menuId" - :default-expand-all="isExpandAll" - :tree-props="{children: 'children', hasChildren: 'hasChildren'}" - > + <el-table v-if="refreshTable" v-loading="loading" :data="menuList" row-key="menuId" + :default-expand-all="isExpandAll" :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"> <el-table-column prop="menuName" label="鑿滃崟鍚嶇О" :show-overflow-tooltip="true" width="160"></el-table-column> <el-table-column prop="icon" label="鍥炬爣" align="center" width="100"> <template slot-scope="scope"> @@ -67,7 +40,7 @@ <el-table-column prop="component" label="缁勪欢璺緞" :show-overflow-tooltip="true"></el-table-column> <el-table-column prop="status" label="鐘舵��" width="80"> <template slot-scope="scope"> - <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/> + <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status" /> </template> </el-table-column> <el-table-column label="鍒涘缓鏃堕棿" align="center" prop="createTime"> @@ -77,27 +50,12 @@ </el-table-column> <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width"> <template slot-scope="scope"> - <el-button - size="mini" - type="text" - icon="el-icon-edit" - @click="handleUpdate(scope.row)" - v-hasPermi="['system:menu:edit']" - >淇敼</el-button> - <el-button - size="mini" - type="text" - icon="el-icon-plus" - @click="handleAdd(scope.row)" - v-hasPermi="['system:menu:add']" - >鏂板</el-button> - <el-button - size="mini" - type="text" - icon="el-icon-delete" - @click="handleDelete(scope.row)" - v-hasPermi="['system:menu:remove']" - >鍒犻櫎</el-button> + <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" + v-hasPermi="['system:menu:edit']">淇敼</el-button> + <el-button size="mini" type="text" icon="el-icon-plus" @click="handleAdd(scope.row)" + v-hasPermi="['system:menu:add']">鏂板</el-button> + <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" + v-hasPermi="['system:menu:remove']">鍒犻櫎</el-button> </template> </el-table-column> </el-table> @@ -108,13 +66,8 @@ <el-row> <el-col :span="24"> <el-form-item label="涓婄骇鑿滃崟" prop="parentId"> - <treeselect - v-model="form.parentId" - :options="menuOptions" - :normalizer="normalizer" - :show-count="true" - placeholder="閫夋嫨涓婄骇鑿滃崟" - /> + <treeselect v-model="form.parentId" :options="menuOptions" :normalizer="normalizer" :show-count="true" + placeholder="閫夋嫨涓婄骇鑿滃崟" /> </el-form-item> </el-col> </el-row> @@ -132,20 +85,10 @@ <el-row> <el-col :span="24" v-if="form.menuType != 'F'"> <el-form-item label="鑿滃崟鍥炬爣" prop="icon"> - <el-popover - placement="bottom-start" - width="460" - trigger="click" - @show="$refs['iconSelect'].reset()" - > + <el-popover placement="bottom-start" width="460" trigger="click" @show="$refs['iconSelect'].reset()"> <IconSelect ref="iconSelect" @selected="selected" :active-icon="form.icon" /> <el-input slot="reference" v-model="form.icon" placeholder="鐐瑰嚮閫夋嫨鍥炬爣" readonly> - <svg-icon - v-if="form.icon" - slot="prefix" - :icon-class="form.icon" - style="width: 25px;" - /> + <svg-icon v-if="form.icon" slot="prefix" :icon-class="form.icon" style="width: 25px;" /> <i v-else slot="prefix" class="el-icon-search el-input__icon" /> </el-input> </el-popover> @@ -169,7 +112,7 @@ <el-form-item prop="isFrame"> <span slot="label"> <el-tooltip content="閫夋嫨鏄閾惧垯璺敱鍦板潃闇�瑕佷互`http(s)://`寮�澶�" placement="top"> - <i class="el-icon-question"></i> + <i class="el-icon-question"></i> </el-tooltip> 鏄惁澶栭摼 </span> @@ -183,7 +126,7 @@ <el-form-item prop="path"> <span slot="label"> <el-tooltip content="璁块棶鐨勮矾鐢卞湴鍧�锛屽锛歚user`锛屽澶栫綉鍦板潃闇�鍐呴摼璁块棶鍒欎互`http(s)://`寮�澶�" placement="top"> - <i class="el-icon-question"></i> + <i class="el-icon-question"></i> </el-tooltip> 璺敱鍦板潃 </span> @@ -196,7 +139,7 @@ <el-form-item prop="component"> <span slot="label"> <el-tooltip content="璁块棶鐨勭粍浠惰矾寰勶紝濡傦細`system/user/index`锛岄粯璁ゅ湪`views`鐩綍涓�" placement="top"> - <i class="el-icon-question"></i> + <i class="el-icon-question"></i> </el-tooltip> 缁勪欢璺緞 </span> @@ -208,7 +151,7 @@ <el-input v-model="form.perms" placeholder="璇疯緭鍏ユ潈闄愭爣璇�" maxlength="100" /> <span slot="label"> <el-tooltip content="鎺у埗鍣ㄤ腑瀹氫箟鐨勬潈闄愬瓧绗︼紝濡傦細@PreAuthorize(`@ss.hasPermi('system:user:list')`)" placement="top"> - <i class="el-icon-question"></i> + <i class="el-icon-question"></i> </el-tooltip> 鏉冮檺瀛楃 </span> @@ -221,7 +164,7 @@ <el-input v-model="form.query" placeholder="璇疯緭鍏ヨ矾鐢卞弬鏁�" maxlength="255" /> <span slot="label"> <el-tooltip content='璁块棶璺敱鐨勯粯璁や紶閫掑弬鏁帮紝濡傦細`{"id": 1, "name": "ry"}`' placement="top"> - <i class="el-icon-question"></i> + <i class="el-icon-question"></i> </el-tooltip> 璺敱鍙傛暟 </span> @@ -231,7 +174,7 @@ <el-form-item prop="isCache"> <span slot="label"> <el-tooltip content="閫夋嫨鏄垯浼氳`keep-alive`缂撳瓨锛岄渶瑕佸尮閰嶇粍浠剁殑`name`鍜屽湴鍧�淇濇寔涓�鑷�" placement="top"> - <i class="el-icon-question"></i> + <i class="el-icon-question"></i> </el-tooltip> 鏄惁缂撳瓨 </span> @@ -247,16 +190,13 @@ <el-form-item prop="visible"> <span slot="label"> <el-tooltip content="閫夋嫨闅愯棌鍒欒矾鐢卞皢涓嶄細鍑虹幇鍦ㄤ晶杈规爮锛屼絾浠嶇劧鍙互璁块棶" placement="top"> - <i class="el-icon-question"></i> + <i class="el-icon-question"></i> </el-tooltip> 鏄剧ず鐘舵�� </span> <el-radio-group v-model="form.visible"> - <el-radio - v-for="dict in dict.type.sys_show_hide" - :key="dict.value" - :label="dict.value" - >{{dict.label}}</el-radio> + <el-radio v-for="dict in dict.type.sys_show_hide" :key="dict.value" :label="dict.value">{{ dict.label + }}</el-radio> </el-radio-group> </el-form-item> </el-col> @@ -264,17 +204,28 @@ <el-form-item prop="status"> <span slot="label"> <el-tooltip content="閫夋嫨鍋滅敤鍒欒矾鐢卞皢涓嶄細鍑虹幇鍦ㄤ晶杈规爮锛屼篃涓嶈兘琚闂�" placement="top"> - <i class="el-icon-question"></i> + <i class="el-icon-question"></i> </el-tooltip> 鑿滃崟鐘舵�� </span> <el-radio-group v-model="form.status"> - <el-radio - v-for="dict in dict.type.sys_normal_disable" - :key="dict.value" - :label="dict.value" - >{{dict.label}}</el-radio> + <el-radio v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.value">{{ + dict.label + }}</el-radio> </el-radio-group> + </el-form-item> + </el-col> + <el-col :span="12" v-if="form.menuType != 'M'"> + <el-form-item prop="status"> + <span slot="label"> + <el-tooltip content="閫夋嫨鍙湅鎴戞寜閽紝鍦ㄨ鑹茬鐞嗗鍙厤缃彧鐪嬫垜鐨勬暟鎹潈闄�" placement="top"> + <i class="el-icon-question"></i> + </el-tooltip> + 鍙湅鎴戞寜閽� + </span> + <el-switch v-model="form.isRersonalButton" inactive-text="涓嶆樉绀�" active-text="鏄剧ず" inactive-value="0" + active-value="1"> + </el-switch> </el-form-item> </el-col> </el-row> @@ -433,7 +384,7 @@ }); }, /** 鎻愪氦鎸夐挳 */ - submitForm: function() { + submitForm: function () { this.$refs["form"].validate(valid => { if (valid) { if (this.form.menuId != undefined) { @@ -454,12 +405,12 @@ }, /** 鍒犻櫎鎸夐挳鎿嶄綔 */ handleDelete(row) { - this.$modal.confirm('鏄惁纭鍒犻櫎鍚嶇О涓�"' + row.menuName + '"鐨勬暟鎹」锛�').then(function() { + this.$modal.confirm('鏄惁纭鍒犻櫎鍚嶇О涓�"' + row.menuName + '"鐨勬暟鎹」锛�').then(function () { return delMenu(row.menuId); }).then(() => { this.getList(); this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => {}); + }).catch(() => { }); } } }; diff --git a/vue.config.js b/vue.config.js index 018c3bb..89d8e0f 100644 --- a/vue.config.js +++ b/vue.config.js @@ -36,7 +36,7 @@ proxy: { // detail: https://cli.vuejs.org/config/#devserver-proxy [process.env.VUE_APP_BASE_API]: { - target: `http://192.168.0.170:8002`, + target: `http://192.168.1.36:8002`, changeOrigin: true, pathRewrite: { ["^" + process.env.VUE_APP_BASE_API]: "", -- Gitblit v1.9.3