Browse Source

feat:[模板管理][PCR导出]

zhangteng
HanLong 1 day ago
parent
commit
0024aa2207
5 changed files with 211 additions and 15 deletions
  1. +2
    -2
      src/views/business/comps/template/comps/pcr/PCR007.vue
  2. +64
    -13
      src/views/business/comps/template/comps/pcr/PCR008.vue
  3. +47
    -0
      src/views/business/comps/template/comps/pcr/PCR009.vue
  4. +51
    -0
      src/views/business/comps/template/comps/pcr/PCR010.vue
  5. +47
    -0
      src/views/business/comps/template/comps/pcr/PCR011.vue

+ 2
- 2
src/views/business/comps/template/comps/pcr/PCR007.vue View File

@ -24,7 +24,7 @@
}}</el-button>
</div>
<el-button type="primary" @click="downloadTableData">{{
<el-button v-if="fillType == 'qc'" type="primary" @click="downloadTableData">{{
$t('template.common.downloadTableData') }}</el-button>
<CustomTable @blur="onHandleTableBlur" @headerSelectChange="onHandleTableBlur"
@ -208,7 +208,7 @@ export default {
'<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>' +
'<th style="text-align: center;">' + '采集管重量'+ '</th>' +
' </tr>'
let _datastr = ''
_.forEach(content.stepTableFormData, function (value) {

+ 64
- 13
src/views/business/comps/template/comps/pcr/PCR008.vue View File

@ -22,11 +22,14 @@
$t('form.delete') }}</el-button>
</div>
<el-button v-if="fillType == 'qc'" type="primary" @click="downloadTableData">{{
$t('template.common.downloadTableData') }}</el-button>
<CustomTable @blur="onHandleTableBlur" @headerSelectChange="onHandleTableBlur"
:ref="`stepTableRef`" :columns="tableStepColumns" :formData="formData" :prefixKey="`table`"
:showCheckAll="true" @selectionChange="handleSelectionChange"
:showOperation="fillType === 'preFill'" fieldItemLabel="template.common.operationSteps"
@clickButton="handleClickButton">
@clickButton="handleClickButton">
<template slot="operation" slot-scope="{ row, rowIndex, columns }">
<TableOpertaion :fillType="fillType" :row="row" :rowIndex="rowIndex" :columns="columns"
@deleteRow="(rowIndex) => deleteRow(rowIndex)"></TableOpertaion>
@ -59,7 +62,7 @@ import { convertConcentration } from "@/utils/conConverter";//浓度单位转换
import SelectReagentDialog from '../../dialog/SelectReagentDialog.vue';
import { getPCR008Config } from "../../formConfig/PCRTableConfig.js";
import TableOpertaion from "@/components/Template/operation/TableOpertaion.vue"
import { addTj, subTj, uniqeResource, uniqeResourceOne, addDecimals,uniqeYqOne } from "@/utils/calUnitTools";
import { addTj, subTj, uniqeResource, uniqeResourceOne, addDecimals, uniqeYqOne } from "@/utils/calUnitTools";
import ImportExcelDialog from '../../dialog/ImportExcelDialog'
import { getBalance } from '@/utils/tpph.js';
export default {
@ -160,7 +163,7 @@ export default {
label: 'template.common.actualFill',
type: "select",
fillType: "actFill",
otherCode: "actOther",otherCodeCompareTo: "preOther",
otherCode: "actOther", otherCodeCompareTo: "preOther",
multiple: true,
compareTo: "pre",
options: this.getDictOptions('business_pztj')
@ -247,6 +250,54 @@ export default {
this.onHandleTableBlur()
},
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;">' + '组织重量' + '</th>' +
'<th style="text-align: center;">' + '实际匀浆溶液补加入量' + '</th>' +
' </tr>'
let _datastr = ''
_.forEach(content.stepTableFormData, function (value) {
_datastr =
_datastr +
'<tr style="text-align: center;">' +
' <td>' +
value.ypmc +
'</td>' +
' <td>' +
value.zzzl +
'</td>' +
' <td>' +
value.sjyjrybjrl +
'</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()
},
onBeforeReagentSubmit(data) {
const { selectData, callback } = data;
@ -339,7 +390,7 @@ export default {
let cjgz = item.cjgz
let tabZzzl;
// =
if(lzzgz && cjgz) {
if (lzzgz && cjgz) {
let temp = subTj([lzzgz, cjgz], [content.headerSelectFields.lzzgzUnit, content.headerSelectFields.cjgzUnit])
let zzzl = temp.total
let zzzlUnit = temp.unit
@ -348,7 +399,7 @@ export default {
}
// =
if(tabZzzl && bs && yjyjry) {
if (tabZzzl && bs && yjyjry) {
let temp = subTj([tabZzzl * bs, yjyjry], [content.headerSelectFields.zzzlUnit, yjyjryUnit])
let ysyjrybjrl = temp.total
let ysyjrybjrlUnit = temp.unit
@ -408,7 +459,7 @@ export default {
//使
const stepResource = this.$refs.stepRef.getStepResource()
this.resourceTmp = uniqeResource(tmpResource, stepResource.sjResource || [])
this.yqResourceTmp = uniqeYqOne([...stepResource.yqResource || [],...tmpYq])
this.yqResourceTmp = uniqeYqOne([...stepResource.yqResource || [], ...tmpYq])
return this.resourceTmp;
},
//
@ -425,19 +476,19 @@ export default {
}
},
//
async handleClickButton(e, rowIndex,colIndex,ee,data) {
async handleClickButton(e, rowIndex, colIndex, ee, data) {
debugger
if(e==='lzzgzBtn'){
if (e === 'lzzgzBtn') {
const content = this.getFilledFormData()
let formData = this.formData;
let formData = this.formData;
let qy = content.yqInfo_dztpbh || formData.yqInfo_dztpbh
let dw = content.headerSelectFields.lzzgzUnit
let x = await getBalance({yq:qy,dw:dw})
if(x && x.success){
this.$refs.stepTableRef?.updateDataSourceByRowIndex(rowIndex, { lzzgz: x.value },{signData:data,updateFields:['lzzgz']});
}else{
let x = await getBalance({ yq: qy, dw: dw })
if (x && x.success) {
this.$refs.stepTableRef?.updateDataSourceByRowIndex(rowIndex, { lzzgz: x.value }, { signData: data, updateFields: ['lzzgz'] });
} else {
this.$message.error(x.message || '称量失败')
}
}

+ 47
- 0
src/views/business/comps/template/comps/pcr/PCR009.vue View File

@ -24,6 +24,9 @@
}}</el-button>
</div>
<el-button v-if="fillType == 'qc'" type="primary" @click="downloadTableData">{{
$t('template.common.downloadTableData') }}</el-button>
<CustomTable @blur="onHandleTableBlur" @headerSelectChange="onHandleTableBlur"
:ref="`stepTableRef`" :columns="tableStepColumns" :formData="formData" :prefixKey="`table`"
:showOperation="fillType === 'preFill'" fieldItemLabel="template.common.operationSteps">
@ -235,6 +238,50 @@ export default {
this.onHandleTableBlur()
},
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;">' + '实际匀浆溶液补加入量' + '</th>' +
' </tr>'
let _datastr = ''
_.forEach(content.stepTableFormData, function (value) {
_datastr =
_datastr +
'<tr style="text-align: center;">' +
' <td>' +
value.ypmc +
'</td>' +
' <td>' +
value.sjyjrybjrl +
'</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() {
this.exportExcel(['样品名称', '组织重'], 'PCR分析组织匀浆表-知组织重导入模板')
},

+ 51
- 0
src/views/business/comps/template/comps/pcr/PCR010.vue View File

@ -24,6 +24,9 @@
}}</el-button>
</div>
<el-button v-if="fillType == 'qc'" type="primary" @click="downloadTableData">{{
$t('template.common.downloadTableData') }}</el-button>
<CustomTable @blur="onHandleTableBlur" @headerSelectChange="onHandleTableBlur"
:ref="`stepTableRef`" :columns="tableStepColumns" :formData="formData" :prefixKey="`table`"
:showOperation="fillType === 'preFill'" fieldItemLabel="template.common.operationSteps"
@ -230,6 +233,54 @@ export default {
this.onHandleTableBlur()
},
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;">' + '称取重量' + '</th>' +
'<th style="text-align: center;">' + '实际匀浆溶液加入量' + '</th>' +
' </tr>'
let _datastr = ''
_.forEach(content.stepTableFormData, function (value) {
_datastr =
_datastr +
'<tr style="text-align: center;">' +
' <td>' +
value.ypmc +
'</td>' +
' <td>' +
value.cqzl +
'</td>' +
' <td>' +
value.sjyjryjrl +
'</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() {
this.exportExcel(['样品名称'], 'PCR分析组织匀浆表-常规导入模板')
},

+ 47
- 0
src/views/business/comps/template/comps/pcr/PCR011.vue View File

@ -24,6 +24,9 @@
}}</el-button>
</div>
<el-button v-if="fillType == 'qc'" type="primary" @click="downloadTableData">{{
$t('template.common.downloadTableData') }}</el-button>
<CustomTable @blur="onHandleTableBlur" @headerSelectChange="onHandleTableBlur"
:ref="`stepTableRef`" :columns="tableStepColumns" :formData="formData" :prefixKey="`table`"
:showOperation="fillType === 'preFill'" fieldItemLabel="template.common.operationSteps">
@ -218,6 +221,50 @@ export default {
this.onHandleTableBlur()
},
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;">' + '实际样品加样体积' + '</th>' +
' </tr>'
let _datastr = ''
_.forEach(content.stepTableFormData, function (value) {
_datastr =
_datastr +
'<tr style="text-align: center;">' +
' <td>' +
value.ypmc +
'</td>' +
' <td>' +
value.sjypjytj +
'</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() {
this.exportExcel(['样品名称'], 'PCR分析核酸提取样品处理表导入模板')
},

Loading…
Cancel
Save