| | |
| | | getInsProduct2: "/insOrderPlan/getInsProduct2", // æ¥çåå²çæ¬æ¬ |
| | | scanInsOrderState: "/insOrderPlan/scanInsOrderState", // æ«ç æ¥æ£æ¥å£ |
| | | getInsOrderUserList: "/insOrderPlan/getInsOrderUserList", // æ¥çæ£éªåå²å表 |
| | | preview: "/insOrderPlan/preview", // csvæä»¶é¢è§ |
| | | } |
| | | |
| | | const systemLog = { |
| | |
| | | }" |
| | | v-if="state==1&&fileAdd" |
| | | :on-success="handleSuccessUp" :show-file-list="false" |
| | | accept='.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar,.csv' :headers="headers" :on-change="beforeUpload" |
| | | accept='.jpg,.jpeg,.png,.gif,.docx,.xls,.xlsx,.pdf,.zip,.rar,.csv' :headers="headers" :on-change="beforeUpload" |
| | | style="width: 80px !important;" |
| | | :on-error="onError" ref='upload'> |
| | | <el-button size="small" type="primary" v-if="state==1">éä»¶ä¸ä¼ </el-button></el-upload> |
| | |
| | | <el-button type="primary" @click="submit0">ç¡® å®</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | <el-dialog |
| | | title="æä»¶é¢è§" |
| | | :visible.sync="lookFileVisible" |
| | | width="60%" fullscreen> |
| | | <filePreview v-if="lookFileVisible" :fileUrl="currentFile.url" |
| | | :currentFile="currentFile" style="max-height: 87vh;overflow-y: auto;"/> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | import excelFunction from '../../../util/excelFountion' |
| | | import CircuitParameters1 from './circuit-parameters1.vue' |
| | | import CircuitParameters2 from './circuit-parameters2.vue' |
| | | import filePreview from '../../tool/file-preview.vue' |
| | | export default { |
| | | props: ['sonLaboratory', 'orderId', 'state','inspectorList','version','orderStateId','isLook','num1','noBack'], |
| | | components: { |
| | | ValueTable, |
| | | Circuit, |
| | | CircuitParameters1, |
| | | CircuitParameters2 |
| | | CircuitParameters2, |
| | | filePreview |
| | | }, |
| | | data() { |
| | | return { |
| | | lookFileVisible:false,//é¢è§æä»¶ |
| | | experimentDia:false, |
| | | experimentInfo:{ |
| | | note:'', |
| | |
| | | disabFun: (row, index) => { |
| | | return this.state!=1 |
| | | } |
| | | }, |
| | | { |
| | | id: '1', |
| | | font: 'é¢è§', |
| | | type: 'text', |
| | | method: 'lookFile', |
| | | } |
| | | ], |
| | | isPage: false, |
| | |
| | | otherForm:{ |
| | | temperature:'', |
| | | humidity:'' |
| | | } |
| | | }, |
| | | currentFile:{},//å½åæä»¶ |
| | | } |
| | | }, |
| | | // ç¨äºä¸ä¼ æä»¶çä¿¡æ¯ |
| | |
| | | await this.handleChangeSample(this.currentSample) |
| | | this.currentNum++ |
| | | this.tableLoading = false |
| | | }, |
| | | lookFile(row){ |
| | | this.currentFile = row; |
| | | if(row.type==1){ |
| | | this.currentFile.url = this.javaApi+'/img/'+row.fileUrl |
| | | }else{ |
| | | this.currentFile.url = this.javaApi+'/word/'+row.fileUrl |
| | | } |
| | | this.lookFileVisible = true |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <div v-if="isImage"> |
| | | <img :src="fileUrl" alt="Image Preview" /> |
| | | </div> |
| | | <div v-if="isPdf"> |
| | | <object :data="fileUrl" type="application/pdf" width="100%" height="600px"> |
| | | <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 |
| | | :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 |
| | | :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>CSV æä»¶æ æ³ç´æ¥é¢è§ï¼è¯·ä¸è½½æ¥çã</p> |
| | | <a :href="fileUrl">ä¸è½½æä»¶</a> |
| | | <div id="teacherPaperAnswer"></div> |
| | | </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' |
| | | import Papa from 'papaparse'; |
| | | import jschardet from 'jschardet' |
| | | 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ï¼é¢è§xlsæä»¶è®¾ä¸ºtrue |
| | | minColLength: 0, // excelæå°æ¸²æå¤å°åï¼å¦ææ³å®ç°xlsxæä»¶å
容æå åï¼å°±æ¸²æå åï¼å¯ä»¥å°æ¤å¼è®¾ç½®ä¸º0. |
| | | minRowLength: 0, // excelæå°æ¸²æå¤å°è¡ï¼å¦ææ³å®ç°æ ¹æ®xlsxå®é
彿°æ¸²æï¼å¯ä»¥å°æ¤å¼è®¾ç½®ä¸º0. |
| | | widthOffset: 10, //å¦ææ¸²æåºæ¥çç»ææè§åå
æ ¼å®½åº¦ä¸å¤ï¼å¯ä»¥å¨é»è®¤æ¸²æçå表宽度ä¸åå Npx宽 |
| | | heightOffset: 10, //å¨é»è®¤æ¸²æçå表é«åº¦ä¸åå Npxé« |
| | | beforeTransformData: (workbookData) => {return workbookData}, //åºå±éè¿exceljsè·åexcelæä»¶å
容ï¼éè¿è¯¥é©å彿°ï¼å¯ä»¥å¯¹è·åçexcelæä»¶å
容è¿è¡ä¿®æ¹ï¼æ¯å¦æä¸ªåå
æ ¼çæ°æ®æ¾ç¤ºä¸æ£ç¡®ï¼å¯ä»¥å¨æ¤èªè¡ä¿®æ¹æ¯ä¸ªåå
æ ¼çvalueå¼ã |
| | | transformData: (workbookData) => {return workbookData}, //å°è·åå°çexcelæ°æ®è¿è¡å¤çä¹å䏿¸²æå°é¡µé¢ä¹åï¼å¯éè¿transformData对å³å°æ¸²æçæ°æ®åæ ·å¼è¿è¡ä¿®æ¹ï¼æ¤æ¶æ¯ä¸ªåå
æ ¼çtextå¼å°±æ¯å³å°æ¸²æå°é¡µé¢ä¸çå
容 |
| | | }, |
| | | } |
| | | }, |
| | | computed: { |
| | | isImage() { |
| | | return /\.(jpg|jpeg|png|gif)$/i.test(this.fileUrl); |
| | | }, |
| | | isPdf() { |
| | | return /\.pdf$/i.test(this.fileUrl); |
| | | }, |
| | | isDoc() { |
| | | return /\.(doc|docx)$/i.test(this.fileUrl); |
| | | }, |
| | | isXls(){ |
| | | return /\.(xls|xlsx)$/i.test(this.fileUrl); |
| | | }, |
| | | 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 |
| | | }, |
| | | errorHandler() { |
| | | console.log("渲æå¤±è´¥") |
| | | this.isDocShow = false |
| | | }, |
| | | async loadCSVData() { |
| | | this.$axios.post(this.$api.insOrderPlan.preview, { |
| | | id: this.currentFile.id, |
| | | }).then( res => { |
| | | console.log(res.data) |
| | | }).catch( err => { |
| | | console.log(err) |
| | | }) |
| | | }, |
| | | async main(){ |
| | | //渲æè¡¨æ ¼ |
| | | this.paintingTable(criteriaAnswer,"teacherPaperAnswer"); //ç¨idå®ä½æ¸²æç®æ |
| | | }, |
| | | paintingTable(File, location) { |
| | | $("#" + location + "").empty(); |
| | | let table = '<table class="table table-bordered" style="zoom:0.8";>'; |
| | | for (let j = 0; j < File.length; j++) { |
| | | if (j == 0) { |
| | | table += '<thead><tr style="white-space: nowrap;"><th scope="col">#</th>'; |
| | | for (let k in File[j]) { |
| | | table += '<th scope="col">' + k + '</th>'; |
| | | } |
| | | table += '</tr></thead><tbody style="white-space: pre;">'; |
| | | } |
| | | table += '<tr><th scope="row" style="vertical-align: middle;">' + Number(j + 1) + '</th>'; |
| | | for (let k in File[j]) { |
| | | table += '<td style="vertical-align: middle; padding:0 20px; border: inset;background:#FFFFFF;"><div style="text-align:left;">' + File[j][k] + '</div></td>'; |
| | | } |
| | | table += '</tr>'; |
| | | } |
| | | table += '</tbody>'; |
| | | $("#" + location + "").append(table); |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | img { |
| | | max-width: 100%; |
| | | } |
| | | </style> |