| | |
| | | "jspdf": "^3.0.0", |
| | | "mammoth": "^1.9.0", |
| | | "nprogress": "0.2.0", |
| | | "pako": "^2.1.0", |
| | | "print-js": "^1.6.0", |
| | | "quill": "2.0.2", |
| | | "screenfull": "5.0.2", |
| | |
| | | params: query, |
| | | }); |
| | | } |
| | | |
| | | //查看历史 |
| | | export function pageProcessTotaldeal(query) { |
| | | return request({ |
| | | url: "/processTotaldeal/pageProcessTotaldeal", |
| | | method: "get", |
| | | params: query, |
| | | }); |
| | | } |
| | |
| | | return request({ |
| | | url: "/manageDocumentIssueRecycle/addManageDocumentIssueRecycle", |
| | | method: "post", |
| | | responseType: "blob", |
| | | headers: { "Content-Type": "application/x-www-form-urlencoded" }, |
| | | data: data, |
| | | }); |
| | | } |
| | |
| | | |
| | | <script> |
| | | import jsPDF from "jspdf"; |
| | | import file from '@/utils/file.js' |
| | | export default { |
| | | props: ['isUpFile'], |
| | | data() { |
| | |
| | | } |
| | | const pdf = new jsPDF("p", "mm", "a4"); |
| | | for (let i = 0; i < this.contextList.length; i++) { |
| | | console.log(2222, this.contextList.length, this.$refs.pdfCanvas[i]) |
| | | const imgData = this.$refs.pdfCanvas[i].toDataURL('image/jpeg', 1.0); |
| | | const imgData = this.$refs.pdfCanvas[i].toDataURL('image/jpeg', 0.7); |
| | | const pdfWidth = pdf.internal.pageSize.getWidth(); |
| | | const pdfHeight = (this.$refs.pdfCanvas[i].height * pdfWidth) / this.$refs.pdfCanvas[i].width; |
| | | pdf.addImage(imgData, "JPEG", 0, 0, pdfWidth, pdfHeight); // 将图片添加到 PDF |
| | |
| | | import { convertToHtml } from 'mammoth'; |
| | | import Vue from 'vue' |
| | | import { convertToHtml } from "mammoth"; |
| | | import pako from "pako"; |
| | | import Vue from "vue"; |
| | | |
| | | export default { |
| | | async convertFileToHtml(url) { |
| | | var xhr = new XMLHttpRequest(); |
| | | xhr.open('GET', Vue.prototype.javaApi+url, true);//获取文件流的接口 |
| | | xhr.open("GET", Vue.prototype.javaApi + url, true); //获取文件流的接口 |
| | | xhr.send(); |
| | | xhr.responseType = "blob";//不能漏 |
| | | xhr.responseType = "blob"; //不能漏 |
| | | let xhrPromise = new Promise((resolve, reject) => { |
| | | xhr.onload = async function () { |
| | | if (this.status === 200) { |
| | | // 返回的文件流,转换成blob对象 |
| | | var blob = new Blob([this.response],{ type:'application/vnd.openxmlformats-officedocument.wordprocessingml.document' }); |
| | | var blob = new Blob([this.response], { |
| | | type: "application/vnd.openxmlformats-officedocument.wordprocessingml.document", |
| | | }); |
| | | // 使用mammoth将Word转换为HTML |
| | | let reader = new FileReader(); |
| | | reader.readAsArrayBuffer(blob); |
| | | let htmlContentPromise = new Promise((resolve, reject) => { |
| | | reader.onload = async function () { |
| | | var arrayBuffer = xhr.response; //arrayBuffer |
| | | const result = await convertToHtml({ arrayBuffer: arrayBuffer }) |
| | | let html = result.value.replace(//g, '') |
| | | .replace('<h1>', '<h1 style="text-align: center;">') |
| | | .replace(/<table>/g, '<table style="border-collapse: collapse;border: 1px solid #000;">') |
| | | .replace(/<tr>/g, '<tr style="height: 30px;">') |
| | | .replace(/<td>/g, '<td style="border: 1px solid #000;">') |
| | | .replace(/<p>/g, '<p style="text-indent: 2em;">') |
| | | .replace(/<a [^>]*>/g, "") |
| | | .replace(/<\/a>/g, "") |
| | | const result = await convertToHtml({ arrayBuffer: arrayBuffer }); |
| | | let html = result.value |
| | | .replace(//g, "") |
| | | .replace("<h1>", '<h1 style="text-align: center;">') |
| | | .replace( |
| | | /<table>/g, |
| | | '<table style="border-collapse: collapse;border: 1px solid #000;">' |
| | | ) |
| | | .replace(/<tr>/g, '<tr style="height: 30px;">') |
| | | .replace(/<td>/g, '<td style="border: 1px solid #000;">') |
| | | .replace(/<p>/g, '<p style="text-indent: 2em;">') |
| | | .replace(/<a [^>]*>/g, "") |
| | | .replace(/<\/a>/g, ""); |
| | | // .replace(/em/g, "cm"); |
| | | resolve(html) |
| | | resolve(html); |
| | | }; |
| | | }) |
| | | resolve(await htmlContentPromise) |
| | | }); |
| | | resolve(await htmlContentPromise); |
| | | } |
| | | |
| | | } |
| | | }) |
| | | return await xhrPromise |
| | | }; |
| | | }); |
| | | return await xhrPromise; |
| | | }, |
| | | downloadIamge(imgsrc, name) {//下载图片地址和图片名 |
| | | downloadIamge(imgsrc, name) { |
| | | //下载图片地址和图片名 |
| | | var image = new Image(); |
| | | // 解决跨域 Canvas 污染问题 |
| | | image.setAttribute("crossOrigin", "anonymous"); |
| | | image.onload = function() { |
| | | image.onload = function () { |
| | | var canvas = document.createElement("canvas"); |
| | | canvas.width = image.width; |
| | | canvas.height = image.height; |
| | |
| | | a.dispatchEvent(event); // 触发a的单击事件 |
| | | }; |
| | | image.src = imgsrc; |
| | | } |
| | | }, |
| | | // 压缩blob |
| | | compressBlob(blob) { |
| | | const reader = new FileReader(); |
| | | reader.readAsArrayBuffer(blob); |
| | | return new Promise((resolve) => { |
| | | reader.onload = () => { |
| | | const arrayBuffer = reader.result; |
| | | const uint8Array = new Uint8Array(arrayBuffer); |
| | | const compressedData = pako.deflate(uint8Array); |
| | | const compressedBlob = new Blob([compressedData], { type: blob.type }); |
| | | resolve(compressedBlob); |
| | | }; |
| | | }); |
| | | }, |
| | | }; |
| | |
| | | <template> |
| | | <div class="sample-disposal"> |
| | | <el-row class="title"> |
| | | <el-col :span="20" style="padding-left: 20px;text-align: left;">检测或校准物品的处置</el-col> |
| | | <el-col :span="4" style="text-align: right;"> |
| | | <!-- <el-button size="medium" type="primary" @click="handleDown" v-loading="outLoading" style="margin-right: 16px;">导出</el-button> --> |
| | | </el-col> |
| | | </el-row> |
| | | <el-tabs type="border-card" v-model="activeName" style="height: 100%;" @tab-click="queryParams.totaldealId = ''"> |
| | | <el-tab-pane label="填写" name="填写" style="height: 100%;" :key="1"> |
| | | <el-button size="small" type="primary" @click="handleAdd0" style="margin-left: 20px;" |
| | | v-if="addPower">新增</el-button> |
| | | <el-button size="small" type="primary" @click="handleAdd0" style="margin-left: 20px;">新增</el-button> |
| | | <div class="table" style="height: calc(100% - 200px)" v-if="activeName == '填写'"> |
| | | <lims-table :tableData="tableData" :column="column" :tableLoading="tableLoading" |
| | | :height="'calc(100vh - 290px)'" :page="page" @pagination="pagination"></lims-table> |
| | | <!-- <ValueTable ref="ValueTable0" :url="$api.processTotaldeal.pageProcessDeal" :componentData="componentData0" |
| | | :key="upIndex0" :delUrl="$api.processTotaldeal.delProcessDeal" /> --> |
| | | </div> |
| | | </el-tab-pane> |
| | | <el-tab-pane label="历史记录" name="历史记录" style="height: 100%;" :key="2"> |
| | |
| | | <div class="search_thing"> |
| | | <div class="search_label">年月:</div> |
| | | <div class="search_input"> |
| | | <el-date-picker v-model="componentData.entity.month" type="month" placeholder="选择月" format="yyyy-MM" |
| | | <el-date-picker v-model="queryParams0.month" type="month" placeholder="选择月" format="yyyy-MM" |
| | | value-format="yyyy-MM" size="small" @change="refreshTable()"> |
| | | </el-date-picker> |
| | | </div> |
| | |
| | | </div> |
| | | </div> |
| | | <div class="table"> |
| | | <!-- <ValueTable ref="ValueTable" :url="$api.processTotaldeal.pageProcessTotaldeal" :componentData="componentData" |
| | | :key="upIndex" /> --> |
| | | <lims-table :tableData="tableData0" :column="column0" :tableLoading="tableLoading" |
| | | :height="'calc(100vh - 300px)'" :page="page0" @pagination="pagination0"></lims-table> |
| | | </div> |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | |
| | | checkProcessTotaldeal, |
| | | ratifyProcessTotaldeal, |
| | | delProcessDeal, |
| | | pageProcessTotaldeal, |
| | | } from "@/api/cnas/process/sampleDisposal"; |
| | | export default { |
| | | components: { |
| | |
| | | noCheckLoading: false, |
| | | checkLoading: false, |
| | | // 历史列表 |
| | | componentData: { |
| | | entity: { |
| | | month: null, |
| | | orderBy: { |
| | | field: 'id', |
| | | order: 'desc' |
| | | } |
| | | }, |
| | | isIndex: true, |
| | | showSelect: false, |
| | | select: false, |
| | | do: [{ |
| | | id: 'handleLook', |
| | | font: '查看', |
| | | type: 'text', |
| | | method: 'handleLook', |
| | | }, { |
| | | id: 'handleDown0', |
| | | font: '下载', |
| | | type: 'text', |
| | | method: 'handleDown0', |
| | | disabFun: (row, index) => { |
| | | return !row.url |
| | | } |
| | | }, |
| | | // { |
| | | // id: 'handleAdd', |
| | | // font: '填写', |
| | | // type: 'text', |
| | | // method: 'handleAdd', |
| | | // disabFun: (row, index) => { |
| | | // return row.submitState=='已提交' |
| | | // } |
| | | // }, |
| | | { |
| | | id: 'handleSubmit', |
| | | font: '提交', |
| | | type: 'text', |
| | | method: 'handleSubmit', |
| | | disabFun: (row, index) => { |
| | | return !!row.submitState && row.submitState != '待提交' |
| | | } |
| | | }, { |
| | | id: 'handleCheck', |
| | | font: '审核', |
| | | type: 'text', |
| | | method: 'handleCheck', |
| | | disabFun: (row, index) => { |
| | | return row.examineState == '通过' || row.submitState == '待提交' |
| | | } |
| | | }, { |
| | | id: 'handleApproval', |
| | | font: '批准', |
| | | type: 'text', |
| | | method: 'handleApproval', |
| | | disabFun: (row, index) => { |
| | | return row.ratifyState == '通过' || row.submitState == '待提交' |
| | | } |
| | | }], |
| | | tagField: {}, |
| | | selectField: {}, |
| | | requiredAdd: [], |
| | | requiredUp: [], |
| | | needSort: [], |
| | | inputType: '' |
| | | }, |
| | | // 样品列表 |
| | | componentData0: { |
| | | entity: { |
| | | totaldealId: null, |
| | | orderBy: { |
| | | field: 'id', |
| | | order: 'desc' |
| | | } |
| | | }, |
| | | isIndex: true, |
| | | showSelect: false, |
| | | select: false, |
| | | do: [{ |
| | | id: 'handleAdd0', |
| | | font: '修改', |
| | | type: 'text', |
| | | method: 'handleAdd0' |
| | | }, { |
| | | id: 'delete', |
| | | font: '删除', |
| | | type: 'text', |
| | | method: 'doDiy' |
| | | }], |
| | | tagField: {}, |
| | | selectField: {}, |
| | | requiredAdd: [], |
| | | requiredUp: [], |
| | | needSort: [], |
| | | inputType: '' |
| | | }, |
| | | upIndex0: 100, |
| | | entityCopy: {}, |
| | | upIndex: 0, |
| | | addInfo: {},//新增样品 |
| | | customPageList: [], |
| | | currentInfo: { |
| | |
| | | current: 0, |
| | | }, |
| | | tableLoading: false, |
| | | queryParams0: {}, |
| | | tableData0: [], |
| | | column0: [ |
| | | { label: "月份", prop: "month" }, |
| | | { label: "总数量", prop: "totalNum" }, |
| | | { label: "提交人", prop: "submitUserName" }, |
| | | { label: "审核人", prop: "examineUserName" }, |
| | | { label: "批准人", prop: "ratifyUserName" }, |
| | | { |
| | | dataType: "action", |
| | | fixed: "right", |
| | | label: "操作", |
| | | operation: [ |
| | | { |
| | | name: "查看", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | this.handleLook(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: "下载", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | this.handleDown0(row); |
| | | }, |
| | | disabled: (row) => { |
| | | return !row.url |
| | | } |
| | | }, |
| | | { |
| | | name: "提交", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | this.handleSubmit(row); |
| | | }, |
| | | disabled: (row) => { |
| | | return !!row.submitState && row.submitState != '待提交' |
| | | } |
| | | }, |
| | | { |
| | | name: "审核", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | this.handleCheck(row); |
| | | }, |
| | | disabled: (row) => { |
| | | return row.examineState == '通过' || row.submitState == '待提交' |
| | | } |
| | | }, |
| | | { |
| | | name: "批准", |
| | | type: "text", |
| | | clickFun: (row) => { |
| | | this.handleApproval(row); |
| | | }, |
| | | disabled: (row) => { |
| | | return row.ratifyState == '通过' || row.submitState == '待提交' |
| | | } |
| | | }, |
| | | ], |
| | | }, |
| | | ], |
| | | page0: { |
| | | total: 0, |
| | | size: 10, |
| | | current: 0, |
| | | }, |
| | | }; |
| | | }, |
| | | mounted() { |
| | | // this.entityCopy = this.HaveJson(this.componentData.entity); |
| | | this.getCustomPageList() |
| | | // this.getPower() |
| | | this.getList() |
| | | this.getList0() |
| | | }, |
| | | methods: { |
| | | getPower() { |
| | |
| | | this.getList(); |
| | | }, |
| | | refresh() { |
| | | this.queryParams = {}; |
| | | this.page.current = 1; |
| | | this.getList(); |
| | | this.queryParams0 = {}; |
| | | this.page0.current = 1; |
| | | this.getList0(); |
| | | }, |
| | | refreshTable() { |
| | | this.page.current = 1; |
| | | this.getList(); |
| | | this.page0.current = 1; |
| | | this.getList0(); |
| | | }, |
| | | getList0() { |
| | | this.tableLoading = true; |
| | | let param = { ...this.queryParams0, ...this.page }; |
| | | delete param.total; |
| | | pageProcessTotaldeal({ ...param }) |
| | | .then((res) => { |
| | | this.tableLoading = false; |
| | | if (res.code === 200) { |
| | | this.tableData0 = res.data.records; |
| | | this.page0.total = res.data.total; |
| | | } |
| | | }) |
| | | .catch((err) => { |
| | | this.tableLoading = false; |
| | | }); |
| | | }, |
| | | pagination0({ page, limit }) { |
| | | this.page0.current = page; |
| | | this.page0.size = limit; |
| | | this.getList0(); |
| | | }, |
| | | // 填写 |
| | | // handleAdd(row){ |
| | |
| | | type: 'success', |
| | | message: '编辑成功!' |
| | | }); |
| | | this.$refs.ValueTable0.selectList() |
| | | this.page.current = 0; |
| | | this.getList(); |
| | | }).catch(err => { }); |
| | | } else { |
| | | // 新增 |
| | |
| | | type: 'success', |
| | | message: '新增成功!' |
| | | }); |
| | | this.$refs.ValueTable0.selectList() |
| | | this.page.current = 0; |
| | | this.getList(); |
| | | }).catch(err => { }); |
| | | } |
| | | }, |
| | |
| | | type: 'success', |
| | | message: '提交成功!' |
| | | }); |
| | | this.$refs['ValueTable'].selectList() |
| | | this.refreshTable() |
| | | }).catch(err => { }); |
| | | }) |
| | | }, |
| | |
| | | this.activeName = '填写' |
| | | this.queryParams.totaldealId = row.id |
| | | this.$nextTick(() => { |
| | | this.$refs['ValueTable0'].selectList() |
| | | this.page.current = 0; |
| | | this.getList(); |
| | | }) |
| | | }, |
| | | commonFun(row, callbanck) { |
| | |
| | | current: -1, |
| | | size: -1, ...this.queryParams |
| | | }).then(res => { |
| | | this.currentInfo.arr = res.data.body.records |
| | | this.lookDialogVisible = true |
| | | this.currentInfo.arr = res.data.records |
| | | if (callbanck) { |
| | | callbanck() |
| | | } |
| | |
| | | type: 'success', |
| | | message: '操作成功!' |
| | | }); |
| | | this.$refs['ValueTable'].selectList() |
| | | this.refreshTable() |
| | | this.lookDialogVisible = false |
| | | }).catch(err => { }); |
| | | } else if (this.title0 == '批准') { |
| | |
| | | type: 'success', |
| | | message: '操作成功!' |
| | | }); |
| | | this.$refs['ValueTable'].selectList() |
| | | this.refreshTable() |
| | | this.lookDialogVisible = false |
| | | }).catch(err => { }); |
| | | } |
| | |
| | | |
| | | .table { |
| | | background-color: #fff; |
| | | width: calc(100% - 40px); |
| | | height: calc(100% - 60px - 140px); |
| | | padding: 20px; |
| | | } |
| | |
| | | .tables { |
| | | table-layout: fixed; |
| | | width: 100%; |
| | | margin-top: 10px; |
| | | } |
| | | |
| | | .tables td { |
| | |
| | | page: { |
| | | size: 20, |
| | | current: 1, |
| | | total: 0, |
| | | }, |
| | | total: 0, |
| | | correctiveInfo: false, |
| | | viewTestRecordDialog: false, |
| | | }; |
| | |
| | | this.tableLoading = false |
| | | if (res.code === 201) return |
| | | this.tableData = res.data.records |
| | | this.total = res.data.total |
| | | this.page.total = res.data.total |
| | | }).catch(err => { |
| | | console.log('err---', err); |
| | | this.tableLoading = false |
| | |
| | | formData.append('state', this.type); // 文件名字段 |
| | | formData.append('writer', this.currentInfo.writer); // 文件名字段 |
| | | |
| | | let res = await checkManageDocumentControlled(formData) |
| | | this.checkLoading = false |
| | | this.noCheckLoading = false |
| | | if (res.code == 200) { |
| | | this.$message({ message: '操作成功', type: 'success' }); |
| | | this.checkDialogVisible = false; |
| | | this.refreshTable() |
| | | return true |
| | | } else { |
| | | this.$message({ message: '操作失败', type: 'error' }); |
| | | return false |
| | | try { |
| | | let res = await checkManageDocumentControlled(formData) |
| | | this.checkLoading = false |
| | | this.noCheckLoading = false |
| | | if (res.code == 200) { |
| | | this.$message({ message: '操作成功', type: 'success' }); |
| | | this.checkDialogVisible = false; |
| | | this.refreshTable() |
| | | return true |
| | | } else { |
| | | this.$message({ message: '操作失败', type: 'error' }); |
| | | return false |
| | | } |
| | | } catch (e) { |
| | | this.checkLoading = false |
| | | this.noCheckLoading = false |
| | | } |
| | | |
| | | |
| | | }, |
| | | handleCheckSub(type) { |
| | | this.type = type |
| | |
| | | formData.append('file', pdfBlob, fileName); // 文件字段 |
| | | formData.append('id', this.currentInfo.id); // 文件名字段 |
| | | |
| | | let res = await uploadFileManageDocumentList(formData) |
| | | this.addLoading = false |
| | | if (res.code == 200) { |
| | | this.$message({ message: '上传成功', type: 'success' }); |
| | | this.addDialogVisible = false; |
| | | this.refreshTable() |
| | | return true |
| | | } else { |
| | | this.$message({ message: '上传失败', type: 'error' }); |
| | | return false |
| | | try { |
| | | let res = await uploadFileManageDocumentList(formData) |
| | | this.addLoading = false |
| | | if (res.code == 200) { |
| | | this.$message({ message: '上传成功', type: 'success' }); |
| | | this.addDialogVisible = false; |
| | | this.refreshTable() |
| | | return true |
| | | } else { |
| | | this.$message({ message: '上传失败', type: 'error' }); |
| | | return false |
| | | } |
| | | } catch (e) { |
| | | this.addLoading = false |
| | | } |
| | | |
| | | }, |
| | | handleDelete(row) { |
| | | this.$confirm("是否删除该条数据?", "提示", { |
| | |
| | | <el-button size="small" @click="openDownloadDia">导出</el-button> |
| | | </div> |
| | | </div> |
| | | <el-table :data="tableData" style="width: 100%" height="calc(100vh - 18em)"> |
| | | <el-table :data="tableData" style="width: 100%" height="calc(100vh - 18em)" key="table1"> |
| | | <el-table-column type="index" label="序号" width="120"> |
| | | <template v-slot="scope"> |
| | | <span>{{ (page.current - 1) * page.size + scope.$index + 1 }}</span> |
| | |
| | | page: { |
| | | total: 0, |
| | | size: 10, |
| | | current: 0, |
| | | current: 1, |
| | | }, |
| | | tableData: [], |
| | | loading: false |
| | |
| | | <el-button size="small" @click="openDownloadDia">导出</el-button> |
| | | </div> |
| | | </div> |
| | | <el-table :data="tableData" style="width: 100%" height="calc(100vh - 18em)"> |
| | | <el-table :data="tableData" style="width: 100%" height="calc(100vh - 18em)" key="table0"> |
| | | <el-table-column type="index" label="序号" width="120"> |
| | | <template v-slot="scope"> |
| | | <span>{{ (search.current - 1) * search.size + scope.$index + 1 }}</span> |
| | |
| | | } |
| | | }, |
| | | getUsers() { |
| | | selectUserCondition().then((res) => { |
| | | selectUserCondition({ type: 1 }).then((res) => { |
| | | if (res.code === 201) { |
| | | return; |
| | | } |