pengjun 1 week ago
parent
commit
2c25b5cb93
  1. 6
      src/router/index.js
  2. 998
      src/views/doctorCheck/resultImport.vue

6
src/router/index.js

@ -526,6 +526,12 @@ const routes = [{
component: () =>
import ("../views/doctorCheck/checkPicImport.vue"),
},
{
path: "/resultImport",
name: "从文件导入检查结果",
component: () =>
import ("../views/doctorCheck/resultImport.vue"),
},
{
path: "/lisResultImport",
name: "从文件导入检验结果",

998
src/views/doctorCheck/resultImport.vue

@ -0,0 +1,998 @@
<template>
<div>
<!--主体-->
<div>
<div class="middlebox">
<div class="contenttitle">
体检 /
<span class="contenttitleBold">从文件导入检验结果</span>
</div>
</div>
<div style="margin-bottom: 15px;display: flex;justify-content: space-between;
background-color: #fff;border-radius: 8px;padding: 15px;margin-top: 7px;">
<div></div>
<div style="display: flex;">
<div style="padding: 0 5px;">
<a :underline="false" href="/files/检验结果导入模板_纵向.xls"><el-button class="commonbutton"
size="small">下载纵向模版</el-button></a>
</div>
<div style="padding: 0 5px;">
<a :underline="false" href="/files/检验结果导入模板_横向.xls"><el-button class="commonbutton"
size="small">下载横向模版</el-button></a>
</div>
<div style="padding: 0 5px;">
<el-button class="commonbutton" @click="seq = 10" size="small">导入</el-button>
</div>
<div style="padding: 0 5px;">
<el-button class="commonbutton" @click="btnExport('tableData')" size="small"
style="width:140px;">导入后结果状态导出</el-button>
</div>
</div>
</div>
<div id="tableData" style="padding: 15px;background-color: #fff;border-radius: 8px;">
<el-table :data="tableData" :row-class-name="importRowClassName"
:height="window.pageHeight < 600 ? 440 : (window.pageHeight - 210)" highlight-current-row size="small"
:summary-method="getSummaries" show-summary>
<el-table-column type="index" label="序号" width="40" align="center" />
<el-table-column prop="importState" label="导入状态" min-width="80" sortable />
<el-table-column prop="importDes" label="导入描述" min-width="180" sortable />
<el-table-column v-for="(item, index) in importCols" :key="`col${index}`" :prop="item.dispLabel"
align="center" :label="item.dataLabel || item.dispLabel" min-width="100" />
</el-table>
</div>
</div>
<!--弹窗-->
<div>
<el-dialog title="导入EXCEL注意事项" :visible.sync="dialogGroup.fileReadme" width="700px" :show-close="false"
:append-to-body="true" :close-on-click-modal="false">
<div style="height:400px;padding: 0 20px; ">
<br />导入Excel时Excel的格式必须符合一定规范该格式的模板文件可通过下载模板获取
<br />注意事项如下:
<br />
<div style="margin-left: 25px;">1条码号不能为空当条码号为检查项目条码时姓名可以为空否则不能为空
<br />2从仪器导出的数据可能含有标本号与仪器通道但标本号与仪器通道不参与数据导入
<br />3Excel结果纵向排列时须检查项目与结果的匹配横向排列时自动匹配
<br />4Excel中标题列不能有单元格合并
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button class="commonbutton" type="primary" @click="seq++">下一步</el-button>
<el-button class="commonbutton" @click="seq = -1">关闭</el-button>
</span>
</el-dialog>
<el-dialog title="选择文件" :visible.sync="dialogGroup.fileChoose" width="700px" :show-close="false"
:append-to-body="true" :close-on-click-modal="false">
<div style="height:400px;padding: 0 50px;">
<!-- webkitdirectory 选择文件属性 multiple 多选属性-->
<div><input id="fileNames" type="file" accept=".xlsx,.xls" @change="changeFileChoose" @focus="fileGetFocus" />
</div>
<div style="margin: 5px 70px;width:240px;">
<el-table :data="sheetNames" border ref="sheetNames" height="260" row-click="chooseSheetName"
highlight-current-row size="small">
<el-table-column prop="sheetName" label="Excel表单名" min-width="200" align="center" />
</el-table>
</div>
<div style="display: flex;flex-wrap: wrap;">
<span style="margin-top: 6px;">标题行 </span>
<el-input type="number" v-model="readDataOpts.titleRow" size="small" style="width:60px;margin: 0 5px;" />
<span style="margin-top: 6px;"></span>
</div>
<div style="margin-top: 7px;display: flex;flex-wrap: wrap;">
<span style="margin-top: -1px;">Excel结果排列方式</span>
<el-radio v-model="readDataOpts.resultMode" label="V">纵向排列</el-radio>
<el-radio v-model="readDataOpts.resultMode" label="H">横向排列</el-radio>
</div>
<div style="margin-top: 7px;display: flex;flex-wrap: wrap;">
<span style="margin-top: -1px;">条码方式</span>
<el-radio v-model="dataImportOpts.barcodeMode" label="0">人员条码</el-radio>
<el-radio v-model="dataImportOpts.barcodeMode" label="1">项目条码</el-radio>
</div>
<div style="display: flex;flex-wrap: wrap;">
<span style="margin-top: 6px;">未填检查时间时起始检查时间</span>
<el-date-picker v-model="dataImportOpts.startCheckDate" type="datetime" placeholder="选择起始检查时间" align="right"
:picker-options="pickerOptions" value-format="yyyy-MM-dd HH:mm:ss" style="width:160px;" size="small">
</el-date-picker>
<span style="margin-top: 6px;">标本间隔时间</span>
<el-input type="number" v-model="dataImportOpts.checkInterval" size="small"
style="width:60px;margin: 0 5px;">
<template slot="append"></template>
</el-input>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button class="commonbutton" type="primary" @click="seq--">上一步</el-button>
<el-button class="commonbutton" type="primary" @click="seq++">下一步</el-button>
<el-button class="commonbutton" @click="seq = -1">关闭</el-button>
</span>
</el-dialog>
<el-dialog title="选择待导入的结果信息,并执行导入" :visible.sync="dialogGroup.fileDataOpr" width="700px" :show-close="false"
:close-on-click-modal="false"> <!--:append-to-body="true" -->
<div style="height:400px;">
<div style="margin-top: -10px;">
1在标题列右击鼠标可设置实际导入数据的列名标题列有横向排列时项目列不显示<br>
2按住 Ctr1 Shift 键可进行多选<br>
</div>
<div style="margin: 5px 0px 0px;" @contextmenu.prevent=""> <!-- -->
<el-table :data="excelData" border ref="excelData" @header-contextmenu="headerContextmenu" height="360"
@row-click="chooseDataImport" row-key="id" highlight-current-row size="small"
:row-class-name="handleRowClassName">
<el-table-column type="index" align="center" label="序号" min-width="40" />
<!--
<el-table-column prop="choosed" align="center" label="选中" min-width="40"/>
-->
<el-table-column v-for="(item, index) in excelCols" :key="`col_${index}`" :prop="item.dispLabel"
align="center" :label="(item.val ? '√ ' : '') + (item.dataLabel || item.dispLabel)"
:min-width="100 + index" />
</el-table>
</div>
</div>
<span slot="footer" class="dialog-footer">
<div style="display: flex;justify-content: space-between;">
<div style="display: flex;">
<el-button class="commonbutton" type="primary" @click="btnChoose('excelData', 'all')">全选</el-button>
<el-button class="commonbutton" type="primary" @click="btnChoose('excelData')">取消全选</el-button>
</div>
<div style="display: flex;">
<el-button class="commonbutton" type="primary" @click="seq--">上一步</el-button>
<el-button class="commonbutton" type="primary" @click="btnImport">确定导入</el-button>
<el-button class="commonbutton" @click="seq = -1">关闭</el-button>
</div>
</div>
</span>
</el-dialog>
<!-- 通用进度条 -->
<el-dialog title="数据处理中……" :visible.sync="elProgress.display" width="700px" height="400" :show-close="false"
:close-on-click-modal="false" :append-to-body="true">
<ElProgressOCX />
</el-dialog>
</div>
</div>
</template>
<script>
import moment from "moment"
import { mapState, mapActions } from "vuex";
import { read, readFile, utils } from "xlsx";
import FileSaver from 'file-saver';
import { getapi, postapi, putapi, deletapi } from "@/api/api";
import { getPagePriv, checkPagePriv, deepCopy, arrayExistObj, arrayFilter, dddw, tcdate } from '../../utlis/proFunc';
import ElProgressOCX from "../../components/report/ElProgressOCX.vue";
export default {
components: {
ElProgressOCX,
},
data() {
return {
startPoint: -1, // -1
endPoint: -1, // -1
rClickRow: null, //
rClickColumn: null, //
dialogGroup: {
fileReadme: true, //EXCEL
fileChoose: false, //
fileDataOpr: false, //
},
oldSeq: -2, //
seq: 10, //
excelCols: [{ dispLabel: '', val: '', dataLabel: '' }], //excel {dispLabel:'',val:'',dataLabel:''}
importCols: [], // dataCols
excelData: [], // excel
choosedData: [], //
toApiBodys: [], // api
dataCols: [
{ dispLabel: '不设置', val: '' },
{ dispLabel: '条码号', val: 'barcode' },
{ dispLabel: '姓名', val: 'patientName' },
{ dispLabel: '标本号', val: 'sampleNo' },
{ dispLabel: '仪器通道', val: 'deviceChannel' },
{ dispLabel: '检查时间', val: 'checkDate' },
{ dispLabel: '检查医生', val: 'checkDoctorName' },
{ dispLabel: '项目', val: 'itemName' },
{ dispLabel: '结果', val: 'itemResult' }
],
preBarcode: '', //
curCheckDate: '', //
tableData: [], //
workBook: null, //EXCEL
sheetNames: [], //EXCEL {sheetName:}
readDataOpts: {
file: '', //
sheetNameChoosed: '', //
titleRow: 1, //
resultMode: 'V', //Excel H: V:
},
readDataOptsInit: {},
dataImportOpts: {
barcodeMode: '1', // '0'/'1'/
startCheckDate: '', //
checkInterval: 30, //
},
dataImportOptsInit: {},
pickerOptions: {
shortcuts: [{
text: '今天',
onClick(picker) {
picker.$emit('pick', new Date());
}
}, {
text: '昨天',
onClick(picker) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 24);
picker.$emit('pick', date);
}
}, {
text: '前天',
onClick(picker) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 48);
picker.$emit('pick', date);
}
}, {
text: '一周前',
onClick(picker) {
const date = new Date();
date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit('pick', date);
}
}]
},
};
},
//
created() {
this.seq = 10
this.readDataOptsInit = Object.assign({}, this.readDataOpts)
this.dataImportOptsInit = Object.assign({}, this.dataImportOpts)
},
//
mounted() {
this.dictInit()
},
computed: {
...mapState(["window", "dict", "elProgress", "patientRegister", "customerOrg"]),
},
methods: {
dddw, moment, checkPagePriv,
dictInit() {
},
//
clearProcess() {
let elo = document.getElementById('fileNames')
if (elo) elo.value = ''; //
this.workBook = null //EXCEL
this.sheetNames = [] //EXCEL {sheetName:}
this.readDataOpts = Object.assign({}, this.readDataOptsInit)
this.dataImportOpts = Object.assign({}, this.dataImportOptsInit)
this.startPoint = -1 // -1
this.endPoint = -1 // -1
},
//
btnFirst() {
if (!this.peisid || this.peisid == 'null') {
this.$message.warning("该用户未选归属体检中心,不能执行此操作!");
return
}
this.seq = 11
},
//
async btnProcess(seq) {
let keys = Object.keys(this.dialogGroup)
let count = 0 //
if (seq == 9 || seq == 29) {
this.workBook = null
this.sheetNameChoosed = ''
seq = 0
}
if (seq == 19) seq = 0
// console.log('keys',keys)
switch (seq) {
case -1:
//
keys.forEach(e => {
this.dialogGroup[e] = false
})
this.clearProcess()
break;
case 10:
this.excelCols = []
this.tableData = []
this.startPoint = -1 // -1
this.endPoint = -1 // -1
// EXCEL
keys.forEach(e => {
if (e == 'fileReadme') {
this.dialogGroup[e] = true
} else {
this.dialogGroup[e] = false
}
})
break;
case 11:
//
keys.forEach(e => {
if (e == 'fileChoose') {
this.dialogGroup[e] = true
} else {
this.dialogGroup[e] = false
}
})
break;
case 12:
// 退
if (this.oldSeq < seq) {
if (!this.readData()) {
this.seq--
break;
}
}
//
if (!this.dataImportOpts.startCheckDate) {
this.$message.warning({ showClose: true, message: '请选择起始检查时间' })
break;
}
if (!this.dataImportOpts.checkInterval) {
this.$message.warning({ showClose: true, message: '请填写标本间隔时间' })
break;
} else {
try {
Number(this.dataImportOpts.checkInterval)
} catch (error) {
this.$message.warning({ showClose: true, message: '标本间隔时间只能填写数字' })
break;
}
}
keys.forEach(e => {
if (e == 'fileDataOpr') {
this.dialogGroup[e] = true
} else {
this.dialogGroup[e] = false
}
})
break;
case 13:
count = 0
this.excelData.forEach(e => {
if (e.choosed) count++
})
if (count == 0) {
this.$message.warning("未选中要导入的记录")
this.seq--
break;
}
//
keys.forEach(e => {
if (e == 'fileDataOpts') {
this.dialogGroup[e] = true
} else {
this.dialogGroup[e] = false
}
})
break;
default:
break;
}
},
//
importRowClassName({ row, rowIndex }) {
if (row.importState == '导入失败') {
return "danger";
} else {
return "";
}
},
//
handleRowClassName({ row, rowIndex }) {
if (row.choosed) {
return "current-row";
} else {
return "";
}
},
//
getSummaries(param) {
const { columns, data } = param;
const sumCol = [2]; //
const sums = [];
let success = 0, fail = 0;
columns.forEach((column, index) => {
//
if (index === 1) {
sums[index] = "导入合计";
return;
}
//
if (sumCol.indexOf(index) == -1) {
sums[index] = "";
return;
}
data.forEach((item) => {
console.log('item,column.property', item, column.property)
if (item[column.property]) {
fail++
} else {
success++
}
});
});
sums[2] = `成功:${success} 条,失败:${fail} 条。`
return sums;
},
//
fileGetFocus(e) {
console.log('fileGetFocus(e)', e)
e.value = '' //
// e.target.files = []
},
//
changeFileChoose(e) {
if (e.target.files.length <= 0) return;
// console.log('file',e.target.files[0])
this.readDataOpts.file = e.target.files[0];
// Excel
// File {name: 'vulkan-1.dll',
// console.log('file',file,file.type)
let fileName = this.readDataOpts.file.name.split('.')
let fileNameExt = fileName[fileName.length - 1].toLowerCase()
if (fileNameExt != 'xls' && fileNameExt != 'xlsx') {
this.$message.warning("你选的文件可能不是标准的Excel文件!")
}
this.readFile(this.readDataOpts.file);
},
//sheetjs
readFile(file) {
const reader = new FileReader();
// reader.readAsArrayBuffer(file);
//
reader.onload = (e) => {
let data = e.target.result;
// let typedArray = new Uint8Array(data);
// var workBook = read(typedArray,{type:'array'})
// this.workBook = read(data,{type:'binary',cellDates:true}) // undefined
this.workBook = read(data, { type: 'binary' })
// var workBook = readFile(file); //
this.sheetNames = []
this.workBook.SheetNames.forEach(e => {
this.sheetNames.push({ sheetName: e })
})
this.$nextTick(() => {
this.$refs['sheetNames'].setCurrentRow(this.sheetNames[0]);
this.chooseSheetName(this.sheetNames[0])
})
}
//
reader.onerror = function (event) {
//
console.error("File could not be read!" + event.target.error);
};
reader.readAsBinaryString(file);
},
//Excel
chooseSheetName(row) {
this.readDataOpts.sheetNameChoosed = row.sheetName
},
//
readData() {
let ret = 1
if (!this.readDataOpts.file || !this.workBook || !this.readDataOpts.sheetNameChoosed) {
this.$message.warning("请选择文件及要导入的表格")
return 0
}
if (this.readDataOpts.titleRow <= 0) {
this.$message.warning("标题行不能小于1")
return 0
}
let worksheet = this.workBook.Sheets[this.readDataOpts.sheetNameChoosed];
//
let head = utils.sheet_to_json(worksheet, { header: 1 });
this.excelCols = []
head[this.readDataOpts.titleRow - 1].forEach(e => {
let lfind = arrayExistObj(this.dataCols, 'dispTitle', e), val = '', dataLabel = '';
if (lfind > -1) {
val = this.dataCols[lfind].val
dataLabel = this.dataCols[lfind].dataLabel
}
this.excelCols.push({
dispLabel: e,
val,
dataLabel
})
})
//console.log('head,',head,this.excelCols)
this.excelData = utils.sheet_to_json(worksheet, { raw: false, range: this.readDataOpts.titleRow - 1 }); //raw:false,range:1 1
this.excelData.forEach((e, index) => {
e.choosed = false;
e.index = index;
e.id = 'excelData' + index;
});
//console.log('this.excelCols',this.excelCols)
// console.log('sheet_to_json excelData',this.excelData)
// Excel
this.parseExcelData()
return ret
},
//
chooseDataImport(row) {
// console.log("this.excelData",this.excelData);
// shift
if (this.window.shift) {
//
this.excelData.forEach((e, index) => {
e.choosed = false;
e.index = index;
});
if (this.startPoint == -1) {
this.excelData[row.index].choosed = true;
this.startPoint = row.index;
} else {
if (this.startPoint > row.index) {
for (let i = row.index; i <= this.startPoint; i++) {
this.excelData[i].choosed = true;
}
} else if (this.startPoint <= row.index) {
for (let i = this.startPoint; i <= row.index; i++) {
this.excelData[i].choosed = true;
}
}
}
} else if (this.window.ctrl) { // ctrl
this.excelData[row.index].choosed = true;
if (this.startPoint == -1) {
this.startPoint = row.index;
}
} else {
// ctrl shift
//
console.log("清除所有选择");
this.excelData.forEach((e, index) => {
e.choosed = false;
e.index = index;
});
// console.log(this.excelData,row.index);
// console.log(this.excelData[row.index].choosed);
this.excelData[row.index].choosed = true;
this.startPoint = row.index;
}
},
//
btnChoose(refName, type) {
let choosed = false
if (type && type == 'all') {
choosed = true
}
this[refName].forEach(e => {
e.choosed = choosed
if (choosed) {
this.$refs[refName].setCurrentRow(e)
}
})
if (!choosed) {
this.$refs[refName].setCurrentRow()
}
},
//
headerContextmenu(column, event) {
let chooseCol = column.minWidth - 100
let items = [] //
this.dataCols.forEach(e => {
if (!(this.readDataOpts.resultMode == 'H' && (e.val == 'itemResult' || e.val == 'itemName'))) {
items.push({
label: e.dispLabel,
onClick: () => {
this.setColumn(chooseCol, e)
},
})
}
})
//
this.$contextmenu({
items,
event,
//x: event.clientX,
//y: event.clientY,
customClass: "custom-class",
zIndex: 30000, //
minWidth: 80,
height: 20
});
return false;
},
//
setColumn(oldColNum, newColObj) {
// console.log('oldColNum,newColObj',oldColNum,newColObj)
//
if (newColObj.dispLabel != "不设置") {
let lfind = arrayExistObj(this.excelCols, 'dataLabel', newColObj.dispLabel)
if (lfind > -1) {
this.excelCols[lfind].dataLabel = ''
this.excelCols[lfind].val = ''
}
}
this.excelCols[oldColNum].dataLabel = newColObj.dispLabel
this.excelCols[oldColNum].val = newColObj.val
// console.log('newColObj.val',newColObj.val)
let tempDate = ''
if (newColObj.val == 'birthDate') {
this.excelData.forEach(e => {
tempDate = e[this.excelCols[oldColNum].dispLabel]
// console.log('birthDate',tempDate)
e[this.excelCols[oldColNum].dispLabel] = tempDate ? moment(new Date(tempDate)).format('yyyy-MM-DD') : ''
})
}
},
// EXCELExcel
parseExcelData() {
let lfind = -1
this.excelCols.forEach((e, i) => {
lfind = arrayExistObj(this.dataCols, 'dispLabel', e.dispLabel)
if (lfind > -1) this.setColumn(i, this.dataCols[lfind])
});
},
//
btnImport() {
this.elProgress.display = true;
this.elProgress.percentage = 0;
this.importCols = []
this.excelCols.forEach(e => {
if (e.val) {
this.importCols.push(e)
}
})
this.tableData = [] //
this.choosedData = [] //
this.excelData.forEach(e => {
if (e.choosed) this.choosedData.push(e)
});
//
this.importing()
//
document.getElementById('fileNames').value = '';
},
//
async importing() {
// Excel
this.excelDataToApiBodys(this.choosedData)
console.log('this.toApiBodys', this.toApiBodys)
// /api/app/patientregister/createpatientregisterexcel
for (let i = 0; i < this.toApiBodys.length; i++) {
this.elProgress.percentage = Math.floor(
((i + 1) * 100) / this.choosedData.length
);
let res = await postapi('/api/app/ImportRegularResult/ImportRegularItemResultExcel', this.toApiBodys[i])
if (res.code >= 0) {
this.tableData.push(Object.assign({ importState: '导入成功' }, this.toApiBodys[i]))
} else {
this.tableData.push(Object.assign({ importState: '导入失败', importDes: res.message }, this.toApiBodys[i]))
}
}
//
this.elProgress.display = false;
this.seq = -1
},
//Excel
excelDataToApiBodys(ExcelAllChoosedData) {
this.toApiBodys = []
ExcelAllChoosedData.forEach(e => {
this.excelDataToApiBody(e)
});
},
//Excel
excelDataToApiBody(ExcelData) {
console.log('ExcelData,this.excelCols', ExcelData, this.excelCols)
let body = {
barcodeMode: this.dataImportOpts.barcodeMode
}
//
if (this.readDataOpts.resultMode == 'V') {
this.excelCols.forEach(e => {
if (e.val) {
switch (e.val) {
// case 'age':
// if (ExcelData[e.dispLabel]) body[e.val] = parseInt(ExcelData[e.dispLabel])
// break;
// case 'birthDate':
// if(ExcelData[e.dispLabel]) body[e.val] = moment(new Date(ExcelData[e.dispLabel])).format('yyyy-MM-DD')
// break;
// case 'poisons':
// if (ExcelData[e.dispLabel]) body[e.val] = ExcelData[e.dispLabel].replaceAll("", ",").split(",")
// break;
default:
body[e.val] = ExcelData[e.dispLabel]
break;
}
}
})
if (!body.checkDate) {
// console.log('body.checkDate,this.preBarcode,this.curCheckDate',body.checkDate,this.preBarcode,this.curCheckDate)
if (!this.preBarcode) {
this.preBarcode = body.barcode
this.curCheckDate = this.dataImportOpts.startCheckDate
}
if (this.preBarcode != body.barcode) {
this.preBarcode = body.barcode
this.curCheckDate = moment(new Date(new Date(this.curCheckDate).getTime() + Number(this.dataImportOpts.checkInterval) * 1000)).format('yyyy-MM-DD HH:mm:ss')
}
body.checkDate = this.curCheckDate
}
if (body.deviceChannel == undefined) delete body.deviceChannel
if (body.sampleNo == undefined) delete body.sampleNo
let lfind = arrayExistObj(this.toApiBodys,'barcode',body.barcode)
let detail = { itemName: body.itemName, itemResult: body.itemResult, checkDate: body.checkDate }
if(body.checkDoctorName) detail.checkDoctorName = body.checkDoctorName
if(lfind == -1){
this.toApiBodys.push(Object.assign({},body,{details:[detail]}))
}else{
this.toApiBodys[this.toApiBodys.length - 1].details.push(detail)
}
} else {
//
// { dataLabel: "", dispLabel: "P LCR", val: "" }
body = {
barcode: ExcelData['条码号'],
barcodeMode: this.dataImportOpts.barcodeMode,
patientName: ExcelData['姓名'],
sampleNo: ExcelData['标本号'],
deviceChannel: ExcelData['仪器通道'],
checkDate: ExcelData['检查时间'],
checkDoctorName: ExcelData['检查医生'],
details: []
}
if (!body.checkDate) {
// console.log('body.checkDate,this.preBarcode,this.curCheckDate',body.checkDate,this.preBarcode,this.curCheckDate)
if (!this.preBarcode) {
this.preBarcode = body.barcode
this.curCheckDate = this.dataImportOpts.startCheckDate
}
if (this.preBarcode != body.barcode) {
this.preBarcode = body.barcode
this.curCheckDate = moment(new Date(new Date(this.curCheckDate).getTime() + Number(this.dataImportOpts.checkInterval) * 1000)).format('yyyy-MM-DD HH:mm:ss')
}
body.checkDate = this.curCheckDate
}
if (body.deviceChannel == undefined) delete body.deviceChannel
if (body.sampleNo == undefined) delete body.sampleNo
// [
// { dispLabel: '', val: 'barcode' },
// { dispLabel: '', val: 'patientName' },
// { dispLabel: '', val: 'sampleNo' },
// { dispLabel: '', val: 'deviceChannel' },
// { dispLabel: '', val: 'checkDate' },
// { dispLabel: '', val: 'itemName' },
// { dispLabel: '', val: 'itemResult' }
// ]
this.excelCols.forEach(e => {
if (!e.dataLabel && !e.val) {
let detail = { itemName: e.dispLabel, itemResult: ExcelData[e.dispLabel], checkDate: body.checkDate }
if(body.checkDoctorName) detail.checkDoctorName = body.checkDoctorName
body.details.push(detail)
}
})
this.toApiBodys.push(body)
}
},
//
rowClickPrList(row) {
// console.log("this.excelData",this.excelData);
// shift
if (this.window.shift) {
//
this.prList.forEach((e, index) => {
e.choosed = false;
e.index = index;
});
if (this.startPoint == -1) {
this.prList[row.index].choosed = true;
this.startPoint = row.index;
} else {
if (this.startPoint > row.index) {
for (let i = row.index; i <= this.startPoint; i++) {
this.prList[i].choosed = true;
}
} else if (this.startPoint <= row.index) {
for (let i = this.startPoint; i <= row.index; i++) {
this.prList[i].choosed = true;
}
}
}
} else if (this.window.ctrl) { // ctrl
this.prList[row.index].choosed = true;
if (this.startPoint == -1) {
this.startPoint = row.index;
}
} else {
// ctrl shift
//
console.log("清除所有选择");
this.prList.forEach((e, index) => {
e.choosed = false;
e.index = index;
});
// console.log(this.excelData,row.index);
// console.log(this.excelData[row.index].choosed);
this.prList[row.index].choosed = true;
this.startPoint = row.index;
}
},
//
btnExport(elId) {
let table = document.getElementById(elId);
let tableData = table.innerHTML
let fileName = moment(new Date()).format('yyyyMMDDHHmmss') + '.xls'
let blob = new Blob([tableData], { type: "text/plain;charset=utf-8" });
FileSaver.saveAs(blob, fileName);
},
},
watch: {
"seq": {
immediate: true, //
// // deep: true, //
handler(newVal, oldVal) {
console.log('watch:seq:', newVal, oldVal)
if (!oldVal && oldVal != 0) {
this.oldSeq = -2
} else {
this.oldSeq = oldVal
}
if (newVal != oldVal) {
this.btnProcess(newVal);
}
}
},
"readDataOpts.titleRow": {
// immediate: true, //
// deep: true, //
handler(newVal, oldVal) {
console.log('watch:readDataOpts.titleRow:', newVal, oldVal)
if (newVal && newVal != oldVal) {
if (this.seq == 11) this.readData()
}
}
},
},
};
</script>
<style scoped>
@import '../../assets/css/global_button.css';
@import '../../assets/css/global_card.css';
@import '../../assets/css/global_dialog.css';
@import '../../assets/css/global_form.css';
@import '../../assets/css/global_input.css';
@import '../../assets/css/global_table.css';
@import '../../assets/css/global_menu.css';
@import '../../assets/css/global.css';
.spanLeftClass {
margin-top: 6px;
width: 70px;
}
.spanMidClass {
text-align: center;
margin-top: 6px;
width: 50px;
}
/* type=number 显示微调按钮 */
::v-deep input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
-webkit-appearance: button !important;
margin: 0 -12px 0 0 !important;
}
::v-deep .el-table__header th {
font-family: "Microsoft YaHei";
}
</style>
Loading…
Cancel
Save