Browse Source

feat:[模板管理][DL010导入导出]

ouqian
ouqian 1 month ago
parent
commit
18fc7f8d1e
6 changed files with 626 additions and 340 deletions
  1. +7
    -1
      src/lang/en/template/dl.js
  2. +8
    -2
      src/lang/zh/template/dl.js
  3. +62
    -34
      src/views/business/comps/template/comps/dl/DL008.vue
  4. +1
    -0
      src/views/business/comps/template/comps/dl/DL009.vue
  5. +223
    -37
      src/views/business/comps/template/comps/dl/DL010.vue
  6. +325
    -266
      src/views/business/comps/template/comps/yp/YP003.vue

+ 7
- 1
src/lang/en/template/dl.js View File

@ -87,7 +87,6 @@ export default {
jprq: 'Dissection Date', jprq: 'Dissection Date',
jprqKssj: 'Start Time', jprqKssj: 'Start Time',
jprqJssj: 'End Time', jprqJssj: 'End Time',
sysj: 'Test Reagent',
sjmc: 'Reagent Name', sjmc: 'Reagent Name',
bh: 'Number', bh: 'Number',
ph: 'Batch Number', ph: 'Batch Number',
@ -98,9 +97,16 @@ export default {
mc: 'Name', mc: 'Name',
zcqk: 'Status/Condition/Performance', zcqk: 'Status/Condition/Performance',
sjxx: 'Collection Information', sjxx: 'Collection Information',
rqxz: 'Container Selection',
xzmb: 'Download Template', xzmb: 'Download Template',
dr: 'Import', dr: 'Import',
dwbh: 'Animal Number', dwbh: 'Animal Number',
yslhnzsjyjrl: 'Preset 0.9% Sodium Chloride Injection Volume',
sjlhnzsjyjrl: 'Actual 0.9% Sodium Chloride Injection Volume',
sjgs: 'Bone Marrow Collection',
lx: 'Centrifugation',
ysjrxq: 'Preset Serum Addition',
sjjrxq: 'Actual Serum Addition',
dwxb: 'Gender', dwxb: 'Gender',
dwzl: 'Animal Species', dwzl: 'Animal Species',
xcqkxzjd: 'Next Test/Calibration/Verification Date', xcqkxzjd: 'Next Test/Calibration/Verification Date',

+ 8
- 2
src/lang/zh/template/dl.js View File

@ -88,7 +88,6 @@ export default {
jprq: '解剖日期', jprq: '解剖日期',
jprqKssj: '开始时间', jprqKssj: '开始时间',
jprqJssj: '结束时间', jprqJssj: '结束时间',
sysj: '试验试剂',
sjmc: '试剂名称', sjmc: '试剂名称',
bh: '编号', bh: '编号',
ph: '批号', ph: '批号',
@ -98,10 +97,17 @@ export default {
yqsybh: '仪器使用编号', yqsybh: '仪器使用编号',
mc: '名称', mc: '名称',
zcqk: '状态/情况/性能', zcqk: '状态/情况/性能',
sjxx: '受集信息',
sjxx: '采集信息',
rqxz: '容器选择',
xzmb: '下载模板', xzmb: '下载模板',
dr: '导入', dr: '导入',
dwbh: '动物编号', dwbh: '动物编号',
yslhnzsjyjrl: '预设0.9%氯化钠注射液加入量',
sjlhnzsjyjrl: '实际0.9%氯化钠注射液加入量',
sjgs: '收集骨髓',
lx: '离心',
ysjrxq: '预设加入血清',
sjjrxq: '实际加入血清',
dwxb: '性别', dwxb: '性别',
dwzl: '动物种类', dwzl: '动物种类',
xcqkxzjd: '下次测试/校准/检定日期', xcqkxzjd: '下次测试/校准/检定日期',

+ 62
- 34
src/views/business/comps/template/comps/dl/DL008.vue View File

@ -39,32 +39,31 @@
<!-- 成像情况 --> <!-- 成像情况 -->
<LineLabel label="template.dl.dl008.cxqk" /> <LineLabel label="template.dl.dl008.cxqk" />
<div class="template-form-item"> <div class="template-form-item">
<BaseInfoFormPackage
:ref="refConf.cxqkqxbb"
:formConfig="cxqkqxbbInfoFormConfig"
:formData="formData"
@clickButton="handleClickButton"
@onRegentSubmit="onRegentSubmit"
>
</BaseInfoFormPackage>
<CustomTable
:columns="cxqkColumns"
:ref="refConf.cxqk"
@onRegentSubmit="(e) => onRegentSubmit(e)"
:showOperation="false"
:showAddRow="false"
:formData="cxqkFormData"
:prefixKey="`cxqkTable`"
:isBorder="true"
:showSort="false"
>
</CustomTable>
<BaseInfoFormPackage
:ref="refConf.cxqkwrqk"
:formConfig="cxqkwrqkConfig"
:formData="formData"
/>
<BaseInfoFormPackage
:ref="refConf.cxqkqxbb"
:formConfig="cxqkqxbbInfoFormConfig"
:formData="formData"
@clickButton="handleClickButton"
@onRegentSubmit="onRegentSubmit"
>
</BaseInfoFormPackage>
<CustomTable
:columns="cxqkColumns"
:ref="refConf.cxqk"
@onRegentSubmit="(e) => onRegentSubmit(e)"
:showOperation="false"
:showAddRow="false"
:formData="cxqkFormData"
:prefixKey="`cxqkTable`"
:isBorder="true"
:showSort="false"
>
</CustomTable>
<BaseInfoFormPackage
:ref="refConf.cxqkwrqk"
:formConfig="cxqkwrqkConfig"
:formData="formData"
/>
</div> </div>
<BaseInfoFormPackage <BaseInfoFormPackage
@ -153,11 +152,11 @@ export default {
// '' // ''
label: 'template.dl.dl008.wrqk', label: 'template.dl.dl008.wrqk',
type: 'select', type: 'select',
span:1,
span: 1,
options: this.getDictOptions('business_dl_ameswrqk'), options: this.getDictOptions('business_dl_ameswrqk'),
fillType: 'actFill', fillType: 'actFill',
otherCode: 'cxqkwrqkOther', otherCode: 'cxqkwrqkOther',
showOtherLabel:false
showOtherLabel: false
} }
} }
} }
@ -297,6 +296,7 @@ export default {
config: { config: {
cxqkqxbd: { cxqkqxbd: {
label: 'template.dl.dl007.qxbd', label: 'template.dl.dl007.qxbd',
qxbdType: 'DL006',
type: 'qxbd', type: 'qxbd',
fillType: 'actFill', fillType: 'actFill',
filledCodes: ['bdmc', 'bdbh'] filledCodes: ['bdmc', 'bdbh']
@ -312,9 +312,7 @@ export default {
refConf refConf
} }
}, },
mounted() {
},
mounted() {},
methods: { methods: {
// //
deleteTableRow(rowIndex, refName) { deleteTableRow(rowIndex, refName) {
@ -362,9 +360,39 @@ export default {
if (key === 'cxqkqxbd') { if (key === 'cxqkqxbd') {
// MOCK: // MOCK:
const mockData = [ const mockData = [
{"jlzb":"A","jzbh1":undefined,"jzbh2":undefined,"jzbh3":undefined,"jzbh4":undefined,"jzbh1Label":"001","jzbh2Label":"004","jzbh3Label":"007","jzbh4Label":"010"},
{"jlzb":"A","jzbh1":undefined,"jzbh2":undefined,"jzbh3":undefined,"jzbh4":undefined,"jzbh1Label":"002","jzbh2Label":"005","jzbh3Label":"008","jzbh4Label":"011"},
{"jlzb":"A","jzbh1":undefined,"jzbh2":undefined,"jzbh3":undefined,"jzbh4":undefined,"jzbh1Label":"003","jzbh2Label":"006","jzbh3Label":"009","jzbh4Label":"012"}
{
jlzb: 'A',
jzbh1: undefined,
jzbh2: undefined,
jzbh3: undefined,
jzbh4: undefined,
jzbh1Label: '001',
jzbh2Label: '004',
jzbh3Label: '007',
jzbh4Label: '010'
},
{
jlzb: 'A',
jzbh1: undefined,
jzbh2: undefined,
jzbh3: undefined,
jzbh4: undefined,
jzbh1Label: '002',
jzbh2Label: '005',
jzbh3Label: '008',
jzbh4Label: '011'
},
{
jlzb: 'A',
jzbh1: undefined,
jzbh2: undefined,
jzbh3: undefined,
jzbh4: undefined,
jzbh1Label: '003',
jzbh2Label: '006',
jzbh3Label: '009',
jzbh4Label: '012'
}
] ]
this.$refs[refConf.cxqk].updateDataSource(mockData) this.$refs[refConf.cxqk].updateDataSource(mockData)
} }

+ 1
- 0
src/views/business/comps/template/comps/dl/DL009.vue View File

@ -257,6 +257,7 @@ export default {
jgxxQxbd: { jgxxQxbd: {
label: 'template.dl.dl009.qxbd', label: 'template.dl.dl009.qxbd',
type: 'qxbd', type: 'qxbd',
qxbdType: 'DL006',
fillType: 'actFill', fillType: 'actFill',
filledCodes: ['bdmc', 'bdbh'] filledCodes: ['bdmc', 'bdbh']
} }

+ 223
- 37
src/views/business/comps/template/comps/dl/DL010.vue View File

@ -58,12 +58,22 @@
<LineLabel label="template.dl.dl010.sjxx" /> <LineLabel label="template.dl.dl010.sjxx" />
<div class="template-form-item"> <div class="template-form-item">
<div class="sj-operation-btns"> <div class="sj-operation-btns">
<el-button size="small" type="primary">{{
$t('template.dl.dl010.xzmb')
}}</el-button>
<el-button size="small" type="success">{{
$t('template.dl.dl010.dr')
}}</el-button>
<el-button
size="small"
type="primary"
@click="
() => {
downloadExcelTemplate(downloadArr)
}
"
>{{ $t('template.dl.dl010.xzmb') }}</el-button
>
<el-button
size="small"
type="success"
@click="handleImportExcel"
>{{ $t('template.dl.dl010.dr') }}</el-button
>
</div> </div>
<CustomTable <CustomTable
:columns="sjxxColumns" :columns="sjxxColumns"
@ -85,6 +95,7 @@
></TableOpertaionDelete> ></TableOpertaionDelete>
</template> </template>
</CustomTable> </CustomTable>
<Step :ref="refConf.sjxxStep" :formData="formData.stepData" />
</div> </div>
<BaseInfoFormPackage <BaseInfoFormPackage
@ -97,6 +108,12 @@
</div> </div>
</div> </div>
</div> </div>
<ImportExcelDialog
ref="ImportExcelDialog"
@onLoadData="onLoadExcelData"
:downloadArr="downloadArr"
@downloadExcelTemplate="downloadExcelTemplate"
/>
</div> </div>
</template> </template>
@ -109,11 +126,13 @@ import TableList from '@/components/Template/Table'
import Step from '@/components/Template/Step' import Step from '@/components/Template/Step'
import templateMixin from '../../mixins/templateMixin' import templateMixin from '../../mixins/templateMixin'
import moment from 'moment' import moment from 'moment'
import ImportExcelDialog from '../../dialog/ImportExcelDialog'
const refConf = { const refConf = {
base: 'baseInfoRef', base: 'baseInfoRef',
sysj: 'sysjTableRef', sysj: 'sysjTableRef',
yqsy: 'yqsyTableRef', yqsy: 'yqsyTableRef',
sjxxStep: 'sjxxStepRef',
sjxx: 'sjxxTableRef', sjxx: 'sjxxTableRef',
remark: 'remarkRef' remark: 'remarkRef'
} }
@ -127,7 +146,8 @@ export default {
TableList, TableList,
Step, Step,
CustomTable, CustomTable,
TableOpertaionDelete
TableOpertaionDelete,
ImportExcelDialog
}, },
mixins: [templateMixin], mixins: [templateMixin],
props: { props: {
@ -290,12 +310,6 @@ export default {
yqsyColumns() { yqsyColumns() {
return [ return [
{ {
label: 'template.dl.dl010.yqbh',
prop: 'yqbh',
bodyType: 'yq',
bodyFillType: 'actFill'
},
{
label: 'template.dl.dl010.yqmc', label: 'template.dl.dl010.yqmc',
prop: 'yqmc', prop: 'yqmc',
bodyType: 'input', bodyType: 'input',
@ -312,6 +326,12 @@ export default {
disabled: true disabled: true
}, },
{ {
label: 'template.dl.dl010.yqbh',
prop: 'yqbh',
bodyType: 'yq',
bodyFillType: 'actFill'
},
{
label: 'template.dl.dl010.xccsjzjdrq', label: 'template.dl.dl010.xccsjzjdrq',
prop: 'jzrq', prop: 'jzrq',
bodyType: 'input', bodyType: 'input',
@ -321,45 +341,69 @@ export default {
} }
] ]
}, },
//
//
sjxxColumns() { sjxxColumns() {
return [ return [
{ {
label: 'template.dl.dl010.dwbh', label: 'template.dl.dl010.dwbh',
prop: 'dwbh', prop: 'dwbh',
bodyType: 'input', bodyType: 'input',
bodyFillType: 'actFill'
bodyMaxlength: 50,
bodyFillType: 'preFill'
},
{
label: 'template.dl.dl010.yslhnzsjyjrl',
headerSelectKey: 'yslhnUnit',
headerOptions: this.getDictOptions('business_tjdw'),
prop: 'yslhnzsjyjrl',
bodyType: 'inputNumber',
bodyMaxlength: 10,
fillType: 'preFill',
bodyFillType: 'preFill'
}, },
{ {
label: 'template.dl.dl010.dwxb',
prop: 'dwxb',
bodyType: 'select',
label: 'template.dl.dl010.sjlhnzsjyjrl',
headerSelectKey: 'yslhnUnit',
headerOptions: this.getDictOptions('business_tjdw'),
prop: 'sjlhnzsjyjrl',
bodyMaxlength: 10,
bodyType: 'inputNumber',
bodyFillType: 'actFill', bodyFillType: 'actFill',
options: this.getDictOptions('sys_user_sex')
fillType: 'preFill'
}, },
{ {
label: 'template.dl.dl010.dwzl',
prop: 'dwzl',
bodyType: 'input',
label: 'template.dl.dl010.sjgs',
prop: 'sjgs',
bodyType: 'checkbox',
checkboxLabel: '',
bodyFillType: 'actFill' bodyFillType: 'actFill'
}, },
{ {
label: 'template.dl.dl010.xcqkxzjd',
prop: 'xcqk',
bodyType: 'input',
label: 'template.dl.dl010.lx',
prop: 'lx',
bodyType: 'checkbox',
checkboxLabel: '',
bodyFillType: 'actFill' bodyFillType: 'actFill'
}, },
{ {
label: 'template.dl.dl010.bz',
prop: 'bz',
bodyType: 'input',
bodyFillType: 'actFill'
label: 'template.dl.dl010.ysjrxq',
prop: 'ysjrxq',
bodyType: 'inputNumber',
bodyFillType: 'preFill',
bodyMaxlength: 10,
fillType: 'preFill',
headerSelectKey: 'yslhnUnit',
headerOptions: this.getDictOptions('business_tjdw')
}, },
{ {
label: 'template.dl.dl010.sjsj',
prop: 'sjsj',
bodyType: 'input',
bodyFillType: 'actFill'
label: 'template.dl.dl010.sjjrxq',
prop: 'sjjrxq',
bodyType: 'inputNumber',
bodyMaxlength: 10,
bodyFillType: 'actFill',
fillType: 'preFill',
headerSelectKey: 'yslhnUnit',
headerOptions: this.getDictOptions('business_tjdw')
} }
] ]
} }
@ -367,25 +411,167 @@ export default {
data() { data() {
return { return {
formData: {}, formData: {},
refConf
refConf,
downloadArr: ['动物编号', '预设0.9%氯化钠注射液加入量', '预设加入血清']
} }
}, },
methods: { methods: {
downloadExcelTemplate(arr) {
this.exportExcel(arr, '骨髓收集记录表-采集信息导入模板')
},
//
onLoadExcelData(excelData) {
console.log(excelData, 'excelData')
if (excelData.length < 2) {
this.$message.error('Excel 数据为空')
return
}
//
const headers = excelData[0]
//
const headerMap = {
动物编号: 'dwbh',
'预设0.9%氯化钠注射液加入量': 'yslhnzsjyjrl',
预设加入血清: 'ysjrxq'
}
//
const headerIndexMap = {}
headers.forEach((header, index) => {
const fieldName = headerMap[header]
if (fieldName) {
headerIndexMap[fieldName] = index
}
})
//
const requiredFields = ['dwbh', 'yslhnzsjyjrl', 'ysjrxq']
const missingFields = requiredFields.filter(
(field) => headerIndexMap[field] === undefined
)
if (missingFields.length > 0) {
const missingHeaders = missingFields.map((field) => {
return Object.keys(headerMap).find((key) => headerMap[key] === field)
})
this.$message.error(
`Excel 表头缺少必需列: ${missingHeaders.join('、')}`
)
return
}
//
const dataRows = excelData.slice(1)
//
const validateDwbh = (value) => {
// 50
if (!value) return ''
const str = String(value).trim()
return str.length <= 50 ? str : ''
}
const validateNumber = (value) => {
// 10
if (!value) return ''
const str = String(value).trim()
//
const numberRegex = /^-?\d{1,10}(\.\d+)?$/
return numberRegex.test(str) ? str : ''
}
//
const list = dataRows.map((row, index) => {
const dwbh = validateDwbh(row[headerIndexMap.dwbh])
const yslhnzsjyjrl = validateNumber(row[headerIndexMap.yslhnzsjyjrl])
const ysjrxq = validateNumber(row[headerIndexMap.ysjrxq])
//
if (!dwbh && row[headerIndexMap.dwbh]) {
console.warn(`${index + 2}行:动物编号超过50字,已清空`)
}
if (!yslhnzsjyjrl && row[headerIndexMap.yslhnzsjyjrl]) {
console.warn(
`${index + 2}行:预设0.9%氯化钠注射液加入量格式不正确,已清空`
)
}
if (!ysjrxq && row[headerIndexMap.ysjrxq]) {
console.warn(`${index + 2}行:预设加入血清格式不正确,已清空`)
}
return {
dwbh, //
yslhnzsjyjrl, // 0.9%
ysjrxq, //
sjlhnzsjyjrl: '', // 0.9%
sjgs: '', //
lx: '', //
sjjrxq: '' //
}
})
// 使 addRows
this.$refs[refConf.sjxx].addRows(list)
//
this.$refs.ImportExcelDialog.cancel()
//
this.$message.success(`成功导入 ${list.length} 条数据`)
//
setTimeout(() => {
this.justUpdateFilledFormData()
}, 100)
},
//
handleImportExcel() {
this.$refs.ImportExcelDialog.show()
},
// //
deleteTableRow(rowIndex, refName) { deleteTableRow(rowIndex, refName) {
this.$refs[refName].deleteRow(rowIndex) this.$refs[refName].deleteRow(rowIndex)
}, },
// //
getFilledFormData() { getFilledFormData() {
return this.getFilledFormDataByRefs(refNames)
const baseData = this.$refs.baseInfoRef.getFilledFormData()
const sysjData = this.$refs.sysjTableRef.getFilledFormData()
const yqsyData = this.$refs.yqsyTableRef.getFilledFormData()
const sjxxStepData = this.$refs.sjxxStepRef.getFilledFormData()
const sjxxData = this.$refs.sjxxTableRef.getFilledFormData()
const remarkData = this.$refs.remarkRef.getFilledFormData()
return {
...baseData,
...sysjData,
...yqsyData,
...sjxxStepData,
...sjxxData,
...remarkData
}
}, },
// //
async getFormData() { async getFormData() {
return await this.validFormFields(refNames)
//
const validFlag = await this.validFields()
if (!validFlag) {
return false
}
return this.getFilledFormData()
}, },
// //
async validFields() { async validFields() {
return await this.validFormFields(refNames)
const refsToValidate = [
'baseInfoRef',
'sysjTableRef',
'yqsyTableRef',
'sjxxStepRef',
'sjxxTableRef',
'remarkRef'
]
return await this.validFormFields(refsToValidate)
}, },
getResource() { getResource() {
const sysjStepResource = this.$refs.sysjTableRef.getStepResource() const sysjStepResource = this.$refs.sysjTableRef.getStepResource()

+ 325
- 266
src/views/business/comps/template/comps/yp/YP003.vue View File

@ -1,280 +1,339 @@
<!-- 配体结合分析溶液配制记录表 --> <!-- 配体结合分析溶液配制记录表 -->
<template> <template>
<div>
<div class="detail-container">
<div class="detail-title"><img src="@/assets/images/detail-title.png">{{ formData.bdmc }}<img
src="@/assets/images/detail-title.png" /></div>
<div class="detail-content">
<div class="content">
<BaseInfoFormPackage fieldItemLabel="template.common.baseInfo" label="template.common.baseInfo"
ref="baseInfoRef" :formConfig="baseInfoFormConfig" :formData="formData" />
<TableList label="template.common.reagentInfo" :columns="sysjColumns" :dataSource="resource" />
<TableList label="template.common.instrumentInfo" :columns="yqColumns" :dataSource="yqResource" />
<LineLabel label="template.yp.yp003.ybxx" />
<div>
<div class="detail-container">
<div class="detail-title">
<img src="@/assets/images/detail-title.png" />{{ formData.bdmc
}}<img src="@/assets/images/detail-title.png" />
</div>
<div class="detail-content">
<div class="content">
<BaseInfoFormPackage
fieldItemLabel="template.common.baseInfo"
label="template.common.baseInfo"
ref="baseInfoRef"
:formConfig="baseInfoFormConfig"
:formData="formData"
/>
<TableList
label="template.common.reagentInfo"
:columns="sysjColumns"
:dataSource="resource"
/>
<TableList
label="template.common.instrumentInfo"
:columns="yqColumns"
:dataSource="yqResource"
/>
<CustomTable
:ref="`tableRef`"
:columns="tableColumns"
:formData="formData"
operationWidth = "80px"
:prefixKey = "`table`"
fieldItemLabel = "template.yp.yp003.ybxx"
@clickButton="handleClickButton"
@onCheckboxTagChange="onCheckboxTagChange"
:showOperation="fillType === 'preFill'"
>
<template slot="operation" slot-scope="{ row, rowIndex, columns }">
<TableOpertaionDelete :row="row" :rowIndex="rowIndex" :columns="columns" @deleteRow="deleteRow" ></TableOpertaionDelete>
</template>
</CustomTable>
<LineLabel label="template.yp.yp003.fqxx" />
<Step ref="stepRef" :formData="formData.stepData"></Step>
<BaseInfoFormPackage fieldItemLabel="template.yp.yp003.fqyq" label="template.yp.yp003.fqyq"
ref="fqyqRef" :formConfig="fqyqConig" :formData="formData" />
<BaseInfoFormPackage fieldItemLabel="template.common.remark" label="template.common.remark"
ref="remarkRef" :formConfig="remarkConig" :formData="formData" />
</div>
</div>
</div>
<!-- <button @click="onSave">保存</button> -->
<ImportExcelDialog ref="ImportExcelDialog" @onLoadData="onLoadExcelData" :downloadArr="['动物编号']" @downloadExcelTemplate="downloadExcelTemplate" />
</div>
<LineLabel label="template.yp.yp003.ybxx" />
<CustomTable
:ref="`tableRef`"
:columns="tableColumns"
:formData="formData"
operationWidth="80px"
:prefixKey="`table`"
fieldItemLabel="template.yp.yp003.ybxx"
@clickButton="handleClickButton"
@onCheckboxTagChange="onCheckboxTagChange"
:showOperation="fillType === 'preFill'"
>
<template slot="operation" slot-scope="{ row, rowIndex, columns }">
<TableOpertaionDelete
:row="row"
:rowIndex="rowIndex"
:columns="columns"
@deleteRow="deleteRow"
></TableOpertaionDelete>
</template>
</CustomTable>
<LineLabel label="template.yp.yp003.fqxx" />
<Step ref="stepRef" :formData="formData.stepData"></Step>
<BaseInfoFormPackage
fieldItemLabel="template.yp.yp003.fqyq"
label="template.yp.yp003.fqyq"
ref="fqyqRef"
:formConfig="fqyqConig"
:formData="formData"
/>
<BaseInfoFormPackage
fieldItemLabel="template.common.remark"
label="template.common.remark"
ref="remarkRef"
:formConfig="remarkConig"
:formData="formData"
/>
</div>
</div>
</div>
<!-- <button @click="onSave">保存</button> -->
<ImportExcelDialog
ref="ImportExcelDialog"
@onLoadData="onLoadExcelData"
:downloadArr="['动物编号']"
@downloadExcelTemplate="downloadExcelTemplate"
/>
</div>
</template> </template>
<script> <script>
import BaseInfoFormPackage from "@/components/Template/BaseInfoFormPackage";
import LineLabel from "@/components/Template/LineLabel";
import TableList from "@/components/Template/Table";
import Step from "@/components/Template/Step";
import templateMixin from "../../mixins/templateMixin";
import CustomTable from '@/components/Template/CustomTable.vue';
import { EventBus } from "@/utils/eventBus";
import { uniqeResource } from "@/utils/calUnitTools";
import BaseInfoFormPackage from '@/components/Template/BaseInfoFormPackage'
import LineLabel from '@/components/Template/LineLabel'
import TableList from '@/components/Template/Table'
import Step from '@/components/Template/Step'
import templateMixin from '../../mixins/templateMixin'
import CustomTable from '@/components/Template/CustomTable.vue'
import { EventBus } from '@/utils/eventBus'
import { uniqeResource } from '@/utils/calUnitTools'
import { debounce } from 'lodash-es' import { debounce } from 'lodash-es'
import TableOpertaionDelete from "@/components/Template/operation/TableOpertaionDelete.vue"
import TableOpertaionDelete from '@/components/Template/operation/TableOpertaionDelete.vue'
import ImportExcelDialog from '../../dialog/ImportExcelDialog' import ImportExcelDialog from '../../dialog/ImportExcelDialog'
export default { export default {
name: "YP003",
components: { ImportExcelDialog,BaseInfoFormPackage, LineLabel, TableList, Step, CustomTable,TableOpertaionDelete },
mixins: [templateMixin],
props: {
fillType: {
type: String,
default: 'preFill',
},
},
computed: {
//
fqyqConig() {
return [
{
type: "cellItem",
config: {
fqyq: {
label: "template.yp.yp003.sfyfzyq",
type: "fqyq",
fillType: "actFill",
span: 1,
}
}
}
]
},
//
remarkConig() {
return [
{
type: "cellItem",
config: {
remark: {
label: "",
type: "textarea",
fillType: "actFill",
span: 1,
placeholder: 'template.common.remarkPlaceholder',
maxlength: 1000,
rows: 5
}
}
}
]
},
//
baseInfoFormConfig() {
return [
{
type: "cardItem",
config: {
studyMc: {
label: 'template.common.testName',
type: "input",
disabled: true,
},
studySn: {
label: 'template.common.testNumber',
type: "input",
disabled: true,
},
}
},
{
type: "conditionItem",
label: 'template.common.processCondition',
config: {
pre: {
label: 'template.common.preFill',
type: "select",
multiple: true,
fillType: "preFill",
options: this.getDictOptions('business_pztj'),
otherCode: "preOther",
},
act: {
label: 'template.common.actualFill',
type: "select",
fillType: "actFill",
otherCode: "actOther",
multiple: true,
compareTo: "pre",
options: this.getDictOptions('business_pztj')
}
}
},
{
type: "conditionItem",
label: 'template.yp.yp003.yplx',
config: {
yplx: {
label: 'template.yp.yp003.yplx',
type: "select",
fillType: "preFill",
options: this.getDictOptions('business_yplx'),
otherCode: "yplxOther",
},
}
},
{
type: "cellItem",
label: 'template.lba.lba002.czsj',
config: {
startDate: {
label: 'template.common.startTime',
type: "input",
},
endDate: {
label: 'template.common.endTime',
type: "input",
},
}
}
]
},
//
tableColumns() {
return [{
label: 'template.yp.yp003.cyd',
prop: 'cyd',
bodyType: 'input',
bodyFillType: 'actFill',
width: 100,
bodyMaxlength: 50,
},{
label: 'template.yp.yp003.dwbh',
prop: 'dwbh',
bodyType: 'checkboxTag',
bodyFillType: 'actFill',
bodySubType:"button",
bodySubFillType:"preFill",
bodySubButtonName:"template.common.importTemplate",
bodySubKey:"exportBtn",
showBodySub:this.fillType === "preFill",
width: 280,
},{
label: 'template.yp.yp003.ypsl',
prop: 'ypsl',
bodyType: 'input',
bodyDisabled: true,
bodyFillType: 'actFill',
width: 80,
}]
},
},
data() {
return {
formData: {},
currentRowIndex: -1,
};
},
mounted() {
},
methods: {
//
handleClickButton(key,rowIndex,colIndex,e,data){
if(key === "exportBtn"){
this.currentRowIndex = rowIndex;
this.$refs.ImportExcelDialog.show()
}
},
//
getFilledFormData() {
return this.getFilledFormDataByRefs(["baseInfoRef", "tableRef", "stepRef", "fqyqRef","remarkRef"])
},
//
async getFormData() {
let content = await this.validFormFields(["baseInfoRef", "tableRef", "stepRef", "fqyqRef","remarkRef"]);
return content;
},
getResource() {
//使
const stepResource = this.$refs.stepRef.getStepResource()
this.resourceTmp = stepResource.sjResource || []
this.yqResourceTmp = stepResource.yqResource || []
return this.resourceTmp;
},
//
async onSave() {
let content = await this.$refs.stepRef.getFormData();
console.log(content);
},
//
deleteRow(rowIndex) {
const tableRef = this.$refs['tableRef'];
if (tableRef) {
tableRef.deleteRow(rowIndex);
}
},
name: 'YP003',
components: {
ImportExcelDialog,
BaseInfoFormPackage,
LineLabel,
TableList,
Step,
CustomTable,
TableOpertaionDelete
},
mixins: [templateMixin],
props: {
fillType: {
type: String,
default: 'preFill'
}
},
computed: {
//
fqyqConig() {
return [
{
type: 'cellItem',
config: {
fqyq: {
label: 'template.yp.yp003.sfyfzyq',
type: 'fqyq',
fillType: 'actFill',
span: 1
}
}
}
]
},
//
remarkConig() {
return [
{
type: 'cellItem',
config: {
remark: {
label: '',
type: 'textarea',
fillType: 'actFill',
span: 1,
placeholder: 'template.common.remarkPlaceholder',
maxlength: 1000,
rows: 5
}
}
}
]
},
//
baseInfoFormConfig() {
return [
{
type: 'cardItem',
config: {
studyMc: {
label: 'template.common.testName',
type: 'input',
disabled: true
},
studySn: {
label: 'template.common.testNumber',
type: 'input',
disabled: true
}
}
},
{
type: 'conditionItem',
label: 'template.common.processCondition',
config: {
pre: {
label: 'template.common.preFill',
type: 'select',
multiple: true,
fillType: 'preFill',
options: this.getDictOptions('business_pztj'),
otherCode: 'preOther'
},
act: {
label: 'template.common.actualFill',
type: 'select',
fillType: 'actFill',
otherCode: 'actOther',
multiple: true,
compareTo: 'pre',
options: this.getDictOptions('business_pztj')
}
}
},
{
type: 'conditionItem',
label: 'template.yp.yp003.yplx',
config: {
yplx: {
label: 'template.yp.yp003.yplx',
type: 'select',
fillType: 'preFill',
options: this.getDictOptions('business_yplx'),
otherCode: 'yplxOther'
}
}
},
{
type: 'cellItem',
label: 'template.lba.lba002.czsj',
config: {
startDate: {
label: 'template.common.startTime',
type: 'input'
},
endDate: {
label: 'template.common.endTime',
type: 'input'
}
}
}
]
},
//
tableColumns() {
return [
{
label: 'template.yp.yp003.cyd',
prop: 'cyd',
bodyType: 'input',
bodyFillType: 'actFill',
width: 100,
bodyMaxlength: 50
},
{
label: 'template.yp.yp003.dwbh',
prop: 'dwbh',
bodyType: 'checkboxTag',
bodyFillType: 'actFill',
bodySubType: 'button',
bodySubFillType: 'preFill',
bodySubButtonName: 'template.common.importTemplate',
bodySubKey: 'exportBtn',
showBodySub: this.fillType === 'preFill',
width: 280
},
{
label: 'template.yp.yp003.ypsl',
prop: 'ypsl',
bodyType: 'input',
bodyDisabled: true,
bodyFillType: 'actFill',
width: 80
}
]
}
},
data() {
return {
formData: {},
currentRowIndex: -1
}
},
mounted() {},
methods: {
//
handleClickButton(key, rowIndex, colIndex, e, data) {
if (key === 'exportBtn') {
this.currentRowIndex = rowIndex
this.$refs.ImportExcelDialog.show()
}
},
//
getFilledFormData() {
return this.getFilledFormDataByRefs([
'baseInfoRef',
'tableRef',
'stepRef',
'fqyqRef',
'remarkRef'
])
},
//
async getFormData() {
let content = await this.validFormFields([
'baseInfoRef',
'tableRef',
'stepRef',
'fqyqRef',
'remarkRef'
])
return content
},
getResource() {
//使
const stepResource = this.$refs.stepRef.getStepResource()
this.resourceTmp = stepResource.sjResource || []
this.yqResourceTmp = stepResource.yqResource || []
return this.resourceTmp
},
//
async onSave() {
let content = await this.$refs.stepRef.getFormData()
console.log(content)
},
//
deleteRow(rowIndex) {
const tableRef = this.$refs['tableRef']
if (tableRef) {
tableRef.deleteRow(rowIndex)
}
},
showImportExcelDialog() {
this.$refs.ImportExcelDialog.show()
},
onLoadExcelData(excelData) {
const data = excelData.splice(1);
const tagData = data.map((item)=>{
return {
checked:undefined,
tagValue:item[0],
}
})
this.$refs.tableRef.updateDataSourceByRowIndex(this.currentRowIndex,{dwbh:tagData});
this.$refs.tableRef.onErrorUpdate(this.currentRowIndex, 1, 'dwbh', false)
this.$refs.ImportExcelDialog.cancel()
setTimeout(() => {
this.justUpdateFilledFormData();
}, 100);
},
downloadExcelTemplate(arr){
this.exportExcel(arr)
},
onCheckboxTagChange(rowIndex,colIndex,data){
const num = data.filter((item)=>item.checked).length;
this.$refs.tableRef.updateDataSourceByRowIndex(rowIndex, {'ypsl':num})
}
}
};
showImportExcelDialog() {
this.$refs.ImportExcelDialog.show()
},
onLoadExcelData(excelData) {
const data = excelData.splice(1)
const tagData = data.map((item) => {
return {
checked: undefined,
tagValue: item[0]
}
})
this.$refs.tableRef.updateDataSourceByRowIndex(this.currentRowIndex, {
dwbh: tagData
})
this.$refs.tableRef.onErrorUpdate(this.currentRowIndex, 1, 'dwbh', false)
this.$refs.ImportExcelDialog.cancel()
setTimeout(() => {
this.justUpdateFilledFormData()
}, 100)
},
downloadExcelTemplate(arr) {
this.exportExcel(arr)
},
onCheckboxTagChange(rowIndex, colIndex, data) {
const num = data.filter((item) => item.checked).length
this.$refs.tableRef.updateDataSourceByRowIndex(rowIndex, { ypsl: num })
}
}
}
</script> </script>
<style rel="stylesheet/scss" lang="scss"> <style rel="stylesheet/scss" lang="scss">
</style> </style>

Loading…
Cancel
Save