|
|
@ -21,13 +21,16 @@ |
|
|
$t('template.common.downloadTemplate') }}</el-button> |
|
|
$t('template.common.downloadTemplate') }}</el-button> |
|
|
<el-button type="primary" @click="showImportExcelDialog">{{ |
|
|
<el-button type="primary" @click="showImportExcelDialog">{{ |
|
|
$t('template.common.importTemplate') |
|
|
$t('template.common.importTemplate') |
|
|
}}</el-button> |
|
|
|
|
|
|
|
|
}}</el-button> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<el-button type="primary" @click="downloadTableData">{{ |
|
|
|
|
|
$t('template.common.downloadTableData') }}</el-button> |
|
|
|
|
|
|
|
|
<CustomTable @blur="onHandleTableBlur" @headerSelectChange="onHandleTableBlur" |
|
|
<CustomTable @blur="onHandleTableBlur" @headerSelectChange="onHandleTableBlur" |
|
|
:ref="`stepTableRef`" :columns="tableStepColumns" :formData="formData" :prefixKey="`table`" |
|
|
:ref="`stepTableRef`" :columns="tableStepColumns" :formData="formData" :prefixKey="`table`" |
|
|
:showOperation="fillType === 'preFill'" |
|
|
|
|
|
fieldItemLabel="template.common.operationSteps" @clickButton="handleClickButton"> |
|
|
|
|
|
|
|
|
:showOperation="fillType === 'preFill'" fieldItemLabel="template.common.operationSteps" |
|
|
|
|
|
@clickButton="handleClickButton"> |
|
|
<template slot="operation" slot-scope="{ row, rowIndex, columns }"> |
|
|
<template slot="operation" slot-scope="{ row, rowIndex, columns }"> |
|
|
<TableOpertaion :fillType="fillType" :row="row" :rowIndex="rowIndex" :columns="columns" |
|
|
<TableOpertaion :fillType="fillType" :row="row" :rowIndex="rowIndex" :columns="columns" |
|
|
@deleteRow="(rowIndex) => deleteRow(rowIndex)"></TableOpertaion> |
|
|
@deleteRow="(rowIndex) => deleteRow(rowIndex)"></TableOpertaion> |
|
|
@ -53,19 +56,21 @@ import TableList from "@/components/Template/Table"; |
|
|
import Step from "@/components/Template/Step"; |
|
|
import Step from "@/components/Template/Step"; |
|
|
import templateMixin from "../../mixins/templateMixin.js"; |
|
|
import templateMixin from "../../mixins/templateMixin.js"; |
|
|
import CustomTable from '@/components/Template/CustomTable.vue'; |
|
|
import CustomTable from '@/components/Template/CustomTable.vue'; |
|
|
import { isValueEmpty } from '@/utils/index'; |
|
|
|
|
|
|
|
|
import { isValueEmpty, getStringWidth } from '@/utils/index'; |
|
|
import { getLatestSnArr } from '@/api/template'; |
|
|
import { getLatestSnArr } from '@/api/template'; |
|
|
import { EventBus } from "@/utils/eventBus"; |
|
|
import { EventBus } from "@/utils/eventBus"; |
|
|
import { volumeConverter } from "@/utils/volConverter";//体积单位转换 |
|
|
import { volumeConverter } from "@/utils/volConverter";//体积单位转换 |
|
|
import { convertConcentration } from "@/utils/conConverter";//浓度单位转换 |
|
|
import { convertConcentration } from "@/utils/conConverter";//浓度单位转换 |
|
|
import SelectReagentDialog from '../../dialog/SelectReagentDialog.vue'; |
|
|
import SelectReagentDialog from '../../dialog/SelectReagentDialog.vue'; |
|
|
import { getPCR007Config } from "../../formConfig/PCRTableConfig.js"; |
|
|
|
|
|
|
|
|
import { getPCR007Config } from "../../formConfig/PCRTableConfig.js"; |
|
|
import TableOpertaion from "@/components/Template/operation/TableOpertaion.vue" |
|
|
import TableOpertaion from "@/components/Template/operation/TableOpertaion.vue" |
|
|
import { addTj, uniqeResource, uniqeResourceOne, addDecimals,uniqeYqOne } from "@/utils/calUnitTools"; |
|
|
|
|
|
|
|
|
import { addTj, uniqeResource, uniqeResourceOne, addDecimals, uniqeYqOne } from "@/utils/calUnitTools"; |
|
|
import ImportExcelDialog from '../../dialog/ImportExcelDialog' |
|
|
import ImportExcelDialog from '../../dialog/ImportExcelDialog' |
|
|
import { getBalance } from '@/utils/tpph.js'; |
|
|
import { getBalance } from '@/utils/tpph.js'; |
|
|
|
|
|
import * as XLSX from 'xlsx' |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
name: "PCR005", |
|
|
|
|
|
|
|
|
name: "PCR007", |
|
|
components: { BaseInfoFormPackage, LineLabel, TableList, Step, CustomTable, TableOpertaion, SelectReagentDialog, ImportExcelDialog }, |
|
|
components: { BaseInfoFormPackage, LineLabel, TableList, Step, CustomTable, TableOpertaion, SelectReagentDialog, ImportExcelDialog }, |
|
|
mixins: [templateMixin], |
|
|
mixins: [templateMixin], |
|
|
props: { |
|
|
props: { |
|
|
@ -192,9 +197,54 @@ export default { |
|
|
}, |
|
|
}, |
|
|
mounted() { |
|
|
mounted() { |
|
|
const formData = this.getFormDataByTemplateData(); |
|
|
const formData = this.getFormDataByTemplateData(); |
|
|
|
|
|
|
|
|
this.onHandleTableBlur() |
|
|
this.onHandleTableBlur() |
|
|
}, |
|
|
}, |
|
|
methods: { |
|
|
methods: { |
|
|
|
|
|
downloadTableData() { |
|
|
|
|
|
this.$modal.loading() |
|
|
|
|
|
let content = this.getFilledFormData(); |
|
|
|
|
|
var tabelStr = |
|
|
|
|
|
'<table border="1" class="html-tabel">' + |
|
|
|
|
|
'<tr style="background:#eee;">' + |
|
|
|
|
|
'<th style="text-align: center;">' + '样品名称' + '</th>' + |
|
|
|
|
|
'<th style="text-align: center;">' + '采集管重量' + content.headerSelectFields.cjgzlUnit + '</th>' + |
|
|
|
|
|
' </tr>' |
|
|
|
|
|
let _datastr = '' |
|
|
|
|
|
_.forEach(content.stepTableFormData, function (value) { |
|
|
|
|
|
_datastr = |
|
|
|
|
|
_datastr + |
|
|
|
|
|
'<tr style="text-align: center;">' + |
|
|
|
|
|
' <td>' + |
|
|
|
|
|
value.ypmc + |
|
|
|
|
|
'</td>' + |
|
|
|
|
|
' <td>' + |
|
|
|
|
|
value.cjgzl + |
|
|
|
|
|
'</td>' + |
|
|
|
|
|
'</tr>' |
|
|
|
|
|
}) |
|
|
|
|
|
tabelStr = tabelStr + _datastr + ' <table>' |
|
|
|
|
|
// Worksheet名 |
|
|
|
|
|
var worksheet = this.formData.bdmc |
|
|
|
|
|
var uri = 'data:application/vnd.ms-excel;base64,' |
|
|
|
|
|
// 真正要导出(下载)的HTML模板 |
|
|
|
|
|
var exportTemplate = `<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" |
|
|
|
|
|
xmlns="http://www.w3.org/TR/REC-html40"> |
|
|
|
|
|
<head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet> |
|
|
|
|
|
<x:Name>${worksheet}</x:Name> |
|
|
|
|
|
<x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet> |
|
|
|
|
|
</x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--> |
|
|
|
|
|
</head> |
|
|
|
|
|
<body> |
|
|
|
|
|
${tabelStr} |
|
|
|
|
|
</body> |
|
|
|
|
|
</html>` |
|
|
|
|
|
var a = document.createElement('a') |
|
|
|
|
|
a.download = worksheet + '.xls' |
|
|
|
|
|
a.href = uri + window.btoa(unescape(encodeURIComponent(exportTemplate))) |
|
|
|
|
|
a.click() |
|
|
|
|
|
this.$modal.closeLoading() |
|
|
|
|
|
}, |
|
|
downloadExcelTemplate() { |
|
|
downloadExcelTemplate() { |
|
|
this.exportExcel(['样品名称', '样品初始浓采样前样品管试剂预计添加体积度'], 'PCR分析采集管称重记录表导入模板') |
|
|
this.exportExcel(['样品名称', '样品初始浓采样前样品管试剂预计添加体积度'], 'PCR分析采集管称重记录表导入模板') |
|
|
}, |
|
|
}, |
|
|
@ -212,7 +262,7 @@ export default { |
|
|
list.push({ |
|
|
list.push({ |
|
|
ypmc: item[0], |
|
|
ypmc: item[0], |
|
|
cyqypgsjyjtjtj: item[1], |
|
|
cyqypgsjyjtjtj: item[1], |
|
|
id:this.getuuid(), |
|
|
|
|
|
|
|
|
id: this.getuuid(), |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
this.$refs.stepTableRef.addRows(list) |
|
|
this.$refs.stepTableRef.addRows(list) |
|
|
@ -256,11 +306,11 @@ export default { |
|
|
|
|
|
|
|
|
//使用仪器 |
|
|
//使用仪器 |
|
|
tmpYq.push(content.selectInfo_solution || formData.selectInfo_solution) |
|
|
tmpYq.push(content.selectInfo_solution || formData.selectInfo_solution) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//使用的试剂、仪器 |
|
|
//使用的试剂、仪器 |
|
|
const stepResource = this.$refs.stepRef.getStepResource() |
|
|
const stepResource = this.$refs.stepRef.getStepResource() |
|
|
this.resourceTmp = uniqeResource(tmpResource, stepResource.sjResource || []) |
|
|
this.resourceTmp = uniqeResource(tmpResource, stepResource.sjResource || []) |
|
|
this.yqResourceTmp = uniqeYqOne([...stepResource.yqResource || [],...tmpYq]) |
|
|
|
|
|
|
|
|
this.yqResourceTmp = uniqeYqOne([...stepResource.yqResource || [], ...tmpYq]) |
|
|
return this.resourceTmp; |
|
|
return this.resourceTmp; |
|
|
}, |
|
|
}, |
|
|
//保存 |
|
|
//保存 |
|
|
@ -276,18 +326,18 @@ export default { |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
//第五步表格按钮点击 |
|
|
//第五步表格按钮点击 |
|
|
async handleClickButton(e, rowIndex,colIndex,ee,data) { |
|
|
|
|
|
if(e==='targetDiluentVolumePrecision'){ |
|
|
|
|
|
|
|
|
async handleClickButton(e, rowIndex, colIndex, ee, data) { |
|
|
|
|
|
if (e === 'targetDiluentVolumePrecision') { |
|
|
const content = this.getFilledFormData() |
|
|
const content = this.getFilledFormData() |
|
|
let formData = this.formData; |
|
|
|
|
|
|
|
|
let formData = this.formData; |
|
|
|
|
|
|
|
|
let qy = content.yqInfo_solution || formData.yqInfo_solution |
|
|
let qy = content.yqInfo_solution || formData.yqInfo_solution |
|
|
let dw = content.headerSelectFields.cjgzlUnit |
|
|
let dw = content.headerSelectFields.cjgzlUnit |
|
|
|
|
|
|
|
|
let x = await getBalance({yq:qy,dw:dw}) |
|
|
|
|
|
if(x && x.success){ |
|
|
|
|
|
this.$refs.stepTableRef?.updateDataSourceByRowIndex(rowIndex, { cjgzl: x.value },{signData:data,updateFields:['cjgzl']}); |
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
|
let x = await getBalance({ yq: qy, dw: dw }) |
|
|
|
|
|
if (x && x.success) { |
|
|
|
|
|
this.$refs.stepTableRef?.updateDataSourceByRowIndex(rowIndex, { cjgzl: x.value }, { signData: data, updateFields: ['cjgzl'] }); |
|
|
|
|
|
} else { |
|
|
this.$message.error(x.message || '称量失败') |
|
|
this.$message.error(x.message || '称量失败') |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|