lslaiwy 1 month ago
parent
commit
cb12fabe65
8 changed files with 330 additions and 143 deletions
  1. +8
    -19
      src/components/Template/BaseInfoFormPackage.vue
  2. +20
    -49
      src/components/Template/CustomTable.vue
  3. +1
    -1
      src/components/Template/HandleFormItem.vue
  4. +7
    -1
      src/lang/en/template/dl.js
  5. +8
    -2
      src/lang/zh/template/dl.js
  6. +62
    -34
      src/views/business/comps/template/comps/dl/DL008.vue
  7. +1
    -0
      src/views/business/comps/template/comps/dl/DL009.vue
  8. +223
    -37
      src/views/business/comps/template/comps/dl/DL010.vue

+ 8
- 19
src/components/Template/BaseInfoFormPackage.vue View File

@ -6,19 +6,12 @@
<div class="grid-container"> <div class="grid-container">
<div v-for="(sItem, key) in item.config" class="form-item" <div v-for="(sItem, key) in item.config" class="form-item"
:class="sItem.span == 1 ? 'full-row' : ''" :key="key"> :class="sItem.span == 1 ? 'full-row' : ''" :key="key">
<template v-if="sItem.type === 'input'">
<template v-if="sItem.type === 'input' || sItem.type === 'inputNumber'">
<div class="form-title">{{ $t(sItem.label) }}</div> <div class="form-title">{{ $t(sItem.label) }}</div>
<HandleFormItem :field-item-label="fieldItemLabel" @blur="onBlur(key, $event)" :item="sItem" <HandleFormItem :field-item-label="fieldItemLabel" @blur="onBlur(key, $event)" :item="sItem"
v-model="formFields[key]" :field-key="prefixKey + '_' + key" @copy="onCopy(sItem, key)" v-model="formFields[key]" :field-key="prefixKey + '_' + key" @copy="onCopy(sItem, key)"
:error="errors[key]" @update:error="errors[key] = false" :error="errors[key]" @update:error="errors[key] = false"
:orange-bg="orangeBgFields[key]" />
</template>
<template v-else-if="sItem.type === 'inputNumber'">
<div class="form-title">{{ $t(sItem.label) }}</div>
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + key"
type="inputNumber" @blur="onBlur(key, $event)" :item="sItem"
@input="onInputNumberChange(key, $event)" v-model="formFields[key]"
@copy="onCopy(sItem, key)" :error="errors[key]" @update:error="errors[key] = false"
:type="sItem.type"
:orange-bg="orangeBgFields[key]" /> :orange-bg="orangeBgFields[key]" />
</template> </template>
</div> </div>
@ -102,9 +95,10 @@
</div> </div>
</div> </div>
</div> </div>
<div v-else-if="sItem.type === 'input'" class="item-center">
<div v-else-if="sItem.type === 'input'||sItem.type === 'textarea' || sItem.type === 'inputNumber'" class="item-center">
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + key" <HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + key"
@blur="onBlur(key, $event)" :item="sItem" v-model="formFields[key]" @blur="onBlur(key, $event)" :item="sItem" v-model="formFields[key]"
:type="sItem.type"
@copy="onCopy(sItem, key)" :error="errors[key]" @update:error="errors[key] = false" @copy="onCopy(sItem, key)" :error="errors[key]" @update:error="errors[key] = false"
:ref="key" :orange-bg="orangeBgFields[key]" /> :ref="key" :orange-bg="orangeBgFields[key]" />
<span v-if="sItem.subType === 'text'" class="sub-text">{{ $t(sItem.subText) }}</span> <span v-if="sItem.subType === 'text'" class="sub-text">{{ $t(sItem.subText) }}</span>
@ -113,12 +107,6 @@
@clickButton="(e, val, data) => handleClickButton(e, sItem, val, data)" /> @clickButton="(e, val, data) => handleClickButton(e, sItem, val, data)" />
</div> </div>
<div v-else-if="sItem.type === 'textarea'">
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + key"
@blur="onBlur(key, $event)" type="textarea" :item="sItem" v-model="formFields[key]"
@copy="onCopy(sItem, key)" :error="errors[key]" @update:error="errors[key] = false"
:orange-bg="orangeBgFields[key]" />
</div>
<div v-else-if="sItem.type === 'clickable'" class="flex1"> <div v-else-if="sItem.type === 'clickable'" class="flex1">
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + key" <HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + key"
type="clickable" @clickable="handleClickable(sItem, key)" :error="errors[key]" type="clickable" @clickable="handleClickable(sItem, key)" :error="errors[key]"
@ -196,8 +184,9 @@
</div> </div>
</div> </div>
</div> </div>
<div v-else-if="sItem.type === 'input'" class="flex flex1">
<div v-else-if="sItem.type === 'input' || sItem.type === 'inputNumber'" class="flex flex1">
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + key" <HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + key"
:type="sItem.type"
@blur="onBlur(key, $event)" class="flex1" :item="sItem" v-model="formFields[key]" @blur="onBlur(key, $event)" class="flex1" :item="sItem" v-model="formFields[key]"
@copy="onCopy(sItem, key)" :error="errors[key]" @update:error="errors[key] = false" @copy="onCopy(sItem, key)" :error="errors[key]" @update:error="errors[key] = false"
:orange-bg="orangeBgFields[key]" /> :orange-bg="orangeBgFields[key]" />
@ -249,7 +238,7 @@
<span v-else class="default-placeholder-text">请选择</span> <span v-else class="default-placeholder-text">请选择</span>
</div> --> </div> -->
</div> </div>
<div v-else-if="sItem.type === 'inputNumber'" class="flex flex1">
<!-- <div v-else-if="sItem.type === 'inputNumber'" class="flex flex1">
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + key" <HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + key"
type="inputNumber" @blur="onBlur(key, $event)" class="flex1" :item="sItem" type="inputNumber" @blur="onBlur(key, $event)" class="flex1" :item="sItem"
@input="onInputNumberChange(key, $event)" :value="formFields[key]" @input="onInputNumberChange(key, $event)" :value="formFields[key]"
@ -278,7 +267,7 @@
@beforeReagentSubmit="(data, callback) => onBeforeReagentSubmit(data, callback, sItem.subKey)" @beforeReagentSubmit="(data, callback) => onBeforeReagentSubmit(data, callback, sItem.subKey)"
@onRegentSubmit="(data, inputValue) => onRegentSubmit(data, inputValue, sItem.subKey, sItem)" @onRegentSubmit="(data, inputValue) => onRegentSubmit(data, inputValue, sItem.subKey, sItem)"
:item="getRegentItem(sItem, 'subType')" :value="formFields[sItem.subKey]" /> :item="getRegentItem(sItem, 'subType')" :value="formFields[sItem.subKey]" />
</div>
</div> -->
<div v-else-if="sItem.type === 'clickable'" class="flex flex1"> <div v-else-if="sItem.type === 'clickable'" class="flex flex1">
<HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + key" <HandleFormItem :field-item-label="fieldItemLabel" :field-key="prefixKey + '_' + key"
type="clickable" @clickable="handleClickable(sItem, key)" :error="errors[key]" type="clickable" @clickable="handleClickable(sItem, key)" :error="errors[key]"

+ 20
- 49
src/components/Template/CustomTable.vue View File

@ -28,7 +28,6 @@
<div v-else-if="headerSelectFields[col.headerSelectKey]" class="fill-type-icon" <div v-else-if="headerSelectFields[col.headerSelectKey]" class="fill-type-icon"
:style="{ width: (templateFillType !== 'actFill') ? '60px' : 'auto' }">({{ :style="{ width: (templateFillType !== 'actFill') ? '60px' : 'auto' }">({{
headerSelectFields[col.headerSelectKey] }})</div> headerSelectFields[col.headerSelectKey] }})</div>
</div> </div>
</div> </div>
@ -58,29 +57,23 @@
<div v-if="!isBorder && col.label" class="mr-5"> <div v-if="!isBorder && col.label" class="mr-5">
{{ $t(col.label) }} {{ $t(col.label) }}
</div> </div>
<template v-if="col.bodyType === 'input'">
<HandleFormItem :fieldKey="prefixKey + '_' + col.prop + '_' + rowIndex"
:fieldItemLabel="fieldItemLabel" type="input"
@blur="onBlur(rowIndex, col.prop, $event)" @copy="onCopy(rowIndex, col)"
class="body-input" :item="getBodyItem(col, rowIndex)" v-model="row[col.prop]"
@change="onBodyValueChange(rowIndex, colIndex, $event)"
:error="hasError(rowIndex, colIndex, col.prop)"
@update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)"
@beforeSaveRecord="(data, callback) => beforeSaveRecord(data, callback, rowIndex, col, row)"
:orange-bg="hasOrangeBg(rowIndex, colIndex, col.prop)" />
</template>
<template v-else-if="col.bodyType === 'inputNumber'">
<HandleFormItem :fieldKey="prefixKey + '_' + col.prop + '_' + rowIndex"
:fieldItemLabel="fieldItemLabel" type="inputNumber"
@copy="onCopy(rowIndex, col)" class="body-input-number"
:item="getBodyItem(col, rowIndex)" v-model="row[col.prop]"
@blur="onBlur(rowIndex, col.prop, $event)"
@change="onBodyValueChange(rowIndex, colIndex, $event)"
:error="hasError(rowIndex, colIndex, col.prop)"
@beforeSaveRecord="(data, callback) => beforeSaveRecord(data, callback, rowIndex, col, row)"
@update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)"
:orange-bg="hasOrangeBg(rowIndex, colIndex, col.prop)" />
<template
v-if="col.bodyType === 'input' || col.bodyType === 'inputNumber' || col.bodyType === 'select'">
<div class="flex flex1">
<HandleFormItem :fieldKey="prefixKey + '_' + col.prop + '_' + rowIndex"
:fieldItemLabel="fieldItemLabel" :type="col.bodyType"
@blur="onBlur(rowIndex, col.prop, $event)" @copy="onCopy(rowIndex, col)"
class="body-input" :item="getBodyItem(col, rowIndex)"
v-model="row[col.prop]"
@change="onBodyValueChange(rowIndex, colIndex, $event, row, col.bodyType)"
:error="hasError(rowIndex, colIndex, col.prop)"
@update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)"
@beforeSaveRecord="(data, callback) => beforeSaveRecord(data, callback, rowIndex, col, row)"
:orange-bg="hasOrangeBg(rowIndex, colIndex, col.prop)" />
</div>
</template> </template>
<!--
<template v-else-if="col.bodyType === 'select'"> <template v-else-if="col.bodyType === 'select'">
<div class="flex flex1"> <div class="flex flex1">
<HandleFormItem :fieldKey="prefixKey + '_' + col.prop + '_' + rowIndex" <HandleFormItem :fieldKey="prefixKey + '_' + col.prop + '_' + rowIndex"
@ -94,7 +87,7 @@
</div> </div>
</template>
</template> -->
<div class="flex flex1" v-else-if="col.bodyType === 'clickable'"> <div class="flex flex1" v-else-if="col.bodyType === 'clickable'">
<HandleFormItem :fieldKey="prefixKey + '_' + col.prop + '_' + rowIndex" <HandleFormItem :fieldKey="prefixKey + '_' + col.prop + '_' + rowIndex"
:fieldItemLabel="fieldItemLabel" type="clickable" class="body-clickable" :fieldItemLabel="fieldItemLabel" type="clickable" class="body-clickable"
@ -158,39 +151,17 @@
</div> </div>
<div class="m-l-5" :class="{ 'flex1': col.bodySubType !== 'button' }" <div class="m-l-5" :class="{ 'flex1': col.bodySubType !== 'button' }"
v-if="isShowBodySub(col, row)"> v-if="isShowBodySub(col, row)">
<template v-if="col.bodySubType === 'inputNumber'">
<HandleFormItem :fieldKey="prefixKey + '_' + col.bodySubKey + '_' + rowIndex"
:fieldItemLabel="fieldItemLabel" type="inputNumber"
@blur="onSubBlur(rowIndex, col.bodySubKey, $event)"
@copy="onCopy(rowIndex, col)" :item="getBodySubItem(col)"
v-model="row[col.bodySubKey]"
@change="onBodySubValueChange(rowIndex, colIndex, $event,)"
:error="hasError(rowIndex, colIndex, col.bodySubKey)"
@update:error="onErrorUpdate(rowIndex, colIndex, col.bodySubKey, $event)"
:orange-bg="hasOrangeBg(rowIndex, colIndex, col.bodySubKey)" />
</template>
<template v-if="col.bodySubType === 'input'">
<template v-if="col.bodySubType === 'inputNumber' || col.bodySubType === 'input'">
<HandleFormItem :fieldKey="prefixKey + '_' + col.bodySubKey + '_' + rowIndex" <HandleFormItem :fieldKey="prefixKey + '_' + col.bodySubKey + '_' + rowIndex"
:fieldItemLabel="fieldItemLabel" type="input"
:fieldItemLabel="fieldItemLabel" :type="col.bodySubType"
@blur="onSubBlur(rowIndex, col.bodySubKey, $event)" @blur="onSubBlur(rowIndex, col.bodySubKey, $event)"
@copy="onCopy(rowIndex, col)" :item="getBodySubItem(col)" @copy="onCopy(rowIndex, col)" :item="getBodySubItem(col)"
v-model="row[col.bodySubKey]" v-model="row[col.bodySubKey]"
@change="onBodySubValueChange(rowIndex, colIndex, $event,)"
:error="hasError(rowIndex, colIndex, col.bodySubKey)"
@update:error="onErrorUpdate(rowIndex, colIndex, col.bodySubKey, $event)"
:orange-bg="hasOrangeBg(rowIndex, colIndex, col.bodySubKey)" />
</template>
<template v-else-if="col.bodySubType === 'select'">
<HandleFormItem :fieldKey="prefixKey + '_' + col.bodySubKey + '_' + rowIndex"
:fieldItemLabel="fieldItemLabel" type="select" class="body-select"
@blur="onSubBlur(rowIndex, col.bodySubKey, $event)"
:item="getBodySubItem(col, rowIndex)" v-model="row[col.bodySubKey]"
@change="onBodySubValueChange(rowIndex, colIndex, $event, row, 'select')"
@change="onBodySubValueChange(rowIndex, colIndex, $event, row, col.bodySubType)"
:error="hasError(rowIndex, colIndex, col.bodySubKey)" :error="hasError(rowIndex, colIndex, col.bodySubKey)"
@update:error="onErrorUpdate(rowIndex, colIndex, col.bodySubKey, $event)" @update:error="onErrorUpdate(rowIndex, colIndex, col.bodySubKey, $event)"
:orange-bg="hasOrangeBg(rowIndex, colIndex, col.bodySubKey)" /> :orange-bg="hasOrangeBg(rowIndex, colIndex, col.bodySubKey)" />
</template> </template>
<template v-else-if="col.bodySubType === 'span'"> <template v-else-if="col.bodySubType === 'span'">
<div class="body-span"> <div class="body-span">
{{ row[col.bodySubKey] }} {{ row[col.bodySubKey] }}

+ 1
- 1
src/components/Template/HandleFormItem.vue View File

@ -1673,7 +1673,7 @@ export default {
.error-border { .error-border {
.el-input-group__prepend, .el-input-group__prepend,
input,
.el-input__inner,
textarea, textarea,
.el-select, .el-select,
.clickable, .clickable,

+ 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()

Loading…
Cancel
Save