| | |
| | | import VueOfficeExcel from '@vue-office/excel' |
| | | //引入相关样式 |
| | | import '@vue-office/excel/lib/index.css' |
| | | import * as XLSX from "xlsx"; |
| | | export default { |
| | | components: { |
| | | VueOfficeDocx, |
| | |
| | | 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, |
| | |
| | | return obj |
| | | }) |
| | | this.csvList = arr |
| | | // console.log(333,this.csvList) |
| | | this.csvList.forEach(m=>{ |
| | | console.log(this.calculateFormulas(m.column,m.tableData)) |
| | | m.tableData = this.calculateFormulas(m.column,m.tableData) |
| | | }) |
| | | }).catch( err => { |
| | | console.log(err) |
| | | }) |
| | |
| | | } |
| | | } |
| | | return result |
| | | }, |
| | | /** |
| | | * 计算表格公式 |
| | | * |
| | | * @param tableHeaders 表头数据 |
| | | * @param tableData 表格数据 |
| | | */ |
| | | calculateFormulas(tableHeaders,tableData){ |
| | | // 生成 Excel Sheet 格式 |
| | | const sheetData = [tableHeaders.map(m=>m.label), ...tableData.map((row) => Object.values(row))]; |
| | | const worksheet = XLSX.utils.aoa_to_sheet(sheetData); |
| | | // 计算公式 |
| | | XLSX.utils.sheet_add_aoa(worksheet, [], { origin: -1 }); |
| | | const newSheetData = XLSX.utils.sheet_to_json(worksheet, { header: 1 }); |
| | | // 更新表头和表格数据 |
| | | tableData = newSheetData.slice(1).map((row) => |
| | | row.reduce((obj, value, index) => { |
| | | obj[newSheetData[0][index]] = value; |
| | | return obj; |
| | | }, {}) |
| | | ); |
| | | return tableData |
| | | }, |
| | | resetStyle(){ |
| | | const elements = document.querySelectorAll('[style*="pt"]'); |
| | |
| | | <el-button type="primary" @click="confirmExport" :loading="upLoadExport">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | <input id="ScanCodeInfo" v-model="codeInfo" @keyup.enter="keyup" style="opacity: 0;height: 0px;margin: 0px;padding: 0px;position: absolute;top: 0;"></input> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | } |
| | | } |
| | | }, |
| | | watch:{ |
| | | qrCodeVisible(newVal){ |
| | | if(newVal){ |
| | | // this.$message.success('扫码:打开') |
| | | this.sampleCode = null |
| | | let input = document.getElementById('ScanCodeInfo'); |
| | | input.focus(); |
| | | this.startTime = setInterval(()=>{ |
| | | input.focus() |
| | | },1000) |
| | | }else{ |
| | | // this.$message.warning('扫码:关闭') |
| | | clearInterval(this.startTime) |
| | | } |
| | | }, |
| | | exportVisible(newVal){ |
| | | if(newVal){ |
| | | // this.$message.success('扫码:打开') |
| | | this.sampleCode = null |
| | | let input = document.getElementById('ScanCodeInfo'); |
| | | input.focus(); |
| | | this.startTime = setInterval(()=>{ |
| | | input.focus() |
| | | },1000) |
| | | }else{ |
| | | // this.$message.warning('扫码:关闭') |
| | | clearInterval(this.startTime) |
| | | } |
| | | }, |
| | | }, |
| | | created() { |
| | | this.getLaboratoryDicts() |
| | | this.getTypeDicts() |
| | |
| | | keyup(e){ |
| | | var code = '' |
| | | try{ |
| | | // console.log(2222,this.codeInfo) |
| | | code = this.codeInfo.substring() |
| | | if(code==null||code==undefined||code==''){ |
| | | this.$message.error('该二维码有误') |
| | |
| | | <div style="width:100%;height: 400px;overflow-y: auto;" v-loading="loadPint"> |
| | | <div class="dia_body"> |
| | | <el-checkbox |
| | | style="margin: 10px 5px;" |
| | | style="margin: 10px 5px;text-align: left;" |
| | | :indeterminate="isIndeterminate" |
| | | v-model="checkAll" |
| | | @change="handleCheckAllChange">全选</el-checkbox> |
| | | <el-checkbox-group @change="changePrintCode()" v-model="checkIndexList"> |
| | | <el-checkbox-group @change="changePrintCode()" v-model="checkIndexList" style="text-align: left;"> |
| | | <el-card class="box-card" v-for="(item, i) in qrData" :key="i+'wwwww'" style="margin-bottom: 15px; font-size: 16px !important;"> |
| | | <el-checkbox :label="i" :key="i" style="position: relative;top:-10px;left:5px"><br></el-checkbox> |
| | | <div> |
| | |
| | | <el-button type="primary" @click="confirmShelves" :loading="upLoadShelves">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | <!-- <input type="password" id="ScanCodeInfo" v-model="codeInfo" @keyup.enter="keyup" style="opacity: 0;height: 0px;margin: 0px;padding: 0px;position: absolute;top: 0;"></input> --> |
| | | <input id="ScanCodeInfo0" v-model="codeInfo" @keyup.enter="keyup" style="opacity: 0;height: 0px;margin: 0px;padding: 0px;position: absolute;top: 0;"></input> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | codeInfo:null, |
| | | } |
| | | }, |
| | | // watch:{ |
| | | // storageVisible(newVal){ |
| | | // if(newVal){ |
| | | // // this.$message.success('扫码:打开') |
| | | // let input = document.getElementById('ScanCodeInfo'); |
| | | // input.focus(); |
| | | // this.startTime = setInterval(()=>{ |
| | | // input.focus() |
| | | // },1000) |
| | | // }else{ |
| | | // // this.$message.warning('扫码:关闭') |
| | | // clearInterval(this.startTime) |
| | | // } |
| | | // }, |
| | | // exportVisible(newVal){ |
| | | // if(newVal){ |
| | | // // this.$message.success('扫码:打开') |
| | | // let input = document.getElementById('ScanCodeInfo'); |
| | | // input.focus(); |
| | | // this.startTime = setInterval(()=>{ |
| | | // input.focus() |
| | | // },1000) |
| | | // }else{ |
| | | // // this.$message.warning('扫码:关闭') |
| | | // clearInterval(this.startTime) |
| | | // } |
| | | // }, |
| | | // isEdit(newVal){ |
| | | // if(!newVal){ |
| | | // this.shelves = {} |
| | | // } |
| | | // } |
| | | // }, |
| | | watch:{ |
| | | storageVisible(newVal){ |
| | | if(newVal){ |
| | | this.sampleCode = null |
| | | // this.$message.success('扫码:打开') |
| | | let input = document.getElementById('ScanCodeInfo0'); |
| | | input.focus(); |
| | | this.startTime = setInterval(()=>{ |
| | | input.focus() |
| | | },1000) |
| | | }else{ |
| | | // this.$message.warning('扫码:关闭') |
| | | clearInterval(this.startTime) |
| | | } |
| | | }, |
| | | exportVisible(newVal){ |
| | | if(newVal){ |
| | | // this.$message.success('扫码:打开') |
| | | this.sampleCode = null |
| | | let input = document.getElementById('ScanCodeInfo0'); |
| | | input.focus(); |
| | | this.startTime = setInterval(()=>{ |
| | | input.focus() |
| | | },1000) |
| | | }else{ |
| | | // this.$message.warning('扫码:关闭') |
| | | clearInterval(this.startTime) |
| | | } |
| | | }, |
| | | isEdit(newVal){ |
| | | if(!newVal){ |
| | | this.shelves = {} |
| | | } |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.selectList() |
| | | }, |
| | |
| | | keyup(e){ |
| | | var code = '' |
| | | try{ |
| | | console.log(2222,this.codeInfo) |
| | | code = this.codeInfo.substring() |
| | | if(code==null||code==undefined||code==''){ |
| | | this.$message.error('该二维码有误') |
| | |
| | | //本地 |
| | | // Vue.prototype.LOCATIONVUE = "http://127.0.0.1:80"; |
| | | // const javaApi = 'http://127.0.0.1:8001'; |
| | | const javaApi = 'http://172.20.10.5:8001'; |
| | | // const javaApi = 'http://172.20.10.5:8001'; |
| | | |
| | | // //通信测试库 |
| | | // Vue.prototype.LOCATIONVUE = "http://10.1.13.77:8080"; |
| | | // const javaApi = 'http://10.1.13.77:8001'; |
| | | const javaApi = 'http://10.1.13.77:8001'; |
| | | |
| | | // 通信正式库 |
| | | // Vue.prototype.LOCATIONVUE = "https://ztwxlims.ztt.cn:7443"; |