Browse Source

feat:[模板管理][update]

ouqian
luojie 1 month ago
parent
commit
915645797f
4 changed files with 252 additions and 239 deletions
  1. +1
    -1
      src/components/Template/HandleFormItem.vue
  2. +4
    -4
      src/components/Template/mixins/formPackageMixins.js
  3. +66
    -234
      src/views/business/comps/template/comps/sp/SP0021.vue
  4. +181
    -0
      src/views/business/comps/template/formConfig/sp/SP0021.js

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

@ -4,7 +4,7 @@
<el-input v-if="type === 'input'" :maxlength="item.maxlength || 50" :disabled="getDisabled()"
:class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')" @blur="onBlur"
:placeholder="getPlaceholder()" v-model="inputValue" @input="onInputChange" @change="onInputChange" />
<el-input v-else-if="type === 'textarea'" :maxlength="item.maxlength || 50" :disabled="getDisabled()"
<el-input v-else-if="type === 'textarea'" :maxlength="item.maxlength || 1000" :disabled="getDisabled()"
:class="getFillTypeStyle() + (orangeBg ? ' orange-bg' : '')" type="textarea" show-word-limit
resize="none" @blur="onBlur" :rows="item.rows || 3" :placeholder="getPlaceholder()" v-model="inputValue"
@input="onInputChange" @change="onInputChange" />

+ 4
- 4
src/components/Template/mixins/formPackageMixins.js View File

@ -319,7 +319,7 @@ export default {
}
}
if (o.type === "attachment") {
if (o.type === "attachment"&&o.fillType === this.templateFillType) {
const attValue = formFields[key];
if (!attValue || attValue == "[]") {
errors.push({
@ -329,8 +329,8 @@ export default {
});
this.$set(this.errors, key, true);
}
} else if (o.type === "fqyq") {
const fqyqValue = formFields[key];
} else if (o.type === "fqyq" &&o.fillType === this.templateFillType) {
const fqyqValue = formFields[key] || {};
const {mainRadio, subRadio,inputValue} = fqyqValue;
if (!mainRadio) {
errors.push({
@ -360,7 +360,7 @@ export default {
}
continue
}else if(o.type === "checkboxTree"){
}else if(o.type === "checkboxTree"&&o.fillType === this.templateFillType){
const checkboxTreeValue = formFields[key] || {};
const {checkedValues=[],otherValues = {}} = checkboxTreeValue;;
const {options = []} = o;

+ 66
- 234
src/views/business/comps/template/comps/sp/SP0021.vue View File

@ -11,47 +11,67 @@
<TableList label="template.common.sjInfo" :columns="sjColumns" :dataSource="resourceSj" />
<TableList label="template.common.instrumentInfo" :columns="yqColumns" :dataSource="yqResource" />
<BaseInfoFormPackage fieldItemLabel="template.common.storageCondition"
label="template.common.storageCondition" ref="storageConditionRef"
label="template.common.storageCondition" :ref="refConfig.storageConditionRef"
:formConfig="storageFormConfig" :formData="formData" />
<LineLabel label="template.common.operationSteps" />
<LineLabel label="样本说明" />
<div class="template-form-item">
<el-button class="print-btn" v-if="fillType === 'actFill'" type="primary" @click="printTag">{{
$t('template.common.bqdy') }}</el-button>
<BaseInfoFormPackage fieldItemLabel="template.common.operationSteps" ref="stepFormPackageRef"
:formConfig="stepFormConfig" @blur="onHandleBlur" :formData="formData" />
<!-- <el-button class="print-btn" v-if="fillType === 'actFill'" type="primary" @click="onAdd">新增</el-button>
<el-button class="print-btn" v-if="fillType === 'actFill'" type="primary" @click="printTag">删除</el-button> -->
<BaseInfoFormPackage fieldItemLabel="样本说明" label = "样本说明" :ref="refConfig.ybsmFormPackageRef"
:formConfig="ybsmFormConfig" @blur="onHandleBlur" :formData="formData" />
<el-button v-if="fillType === 'actFill'" type="primary" @click="onImportAnimal">导入动物</el-button>
<CustomTable
:ref = "refConfig.ybsmTableRef"
:columns="ybsmColumns"
:showOperation="fillType === 'actFill'"
:showAddRow="fillType === 'actFill'"
:dataSource="formData.ybsmData" >
<template slot="operation" slot-scope="{ row, rowIndex, columns }">
<TableOpertaionDelete
:row="row"
:rowIndex="rowIndex"
:columns="columns"
@deleteRow="() => deleteTableRow(rowIndex, 'ybsmTableRef')"
></TableOpertaionDelete>
</template>
</CustomTable>
</div>
<Step ref="stepRef" :formData="formData.stepData"></Step>
<Step :ref="refConfig.stepRef" :formData="formData.stepData"></Step>
<BaseInfoFormPackage fieldItemLabel="template.common.remark" label="template.common.remark"
ref="remarkRef" :formConfig="remarkConig" :formData="formData" />
:ref="refConfig.remarkRef" :formConfig="remarkConig" :formData="formData" />
</div>
</div>
</div>
<!-- <button @click="onSave">保存</button> -->
<ImportExcelDialog ref="ImportExcelDialog" @onLoadData="onLoadExcelData" :downloadArr="['动物编号']" @downloadExcelTemplate="downloadExcelTemplate" />
</div>
</template>
<script>
import BaseInfoFormPackage from "@/components/Template/BaseInfoFormPackage";
import TableOpertaionDelete from "@/components/Template/operation/TableOpertaionDelete";
import ImportExcelDialog from '../../dialog/ImportExcelDialog'
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 { getLatestSn } from '@/api/template';
import { EventBus } from "@/utils/eventBus";
import { uniqeResource } from "@/utils/calUnitTools";
import { debounce } from 'lodash-es'
import { getBaseInfoFormConfig, getStorageFormConfig, getRemarkFormConfig, getYbsmFormConfig,getTableColumns } from "../../formConfig/sp/SP0021";
const refConfig = {
baseInfoRef: "baseInfoRef",
remarkRef: "remarkRef",
synrRef: "synrRef",
yqjgRef: "yqjgRef",
cjrqRef: "cjrqRef",
fxpsjwjRef: "fxpsjwjRef",
storageConditionRef: "storageConditionRef",
stepRef: "stepRef",
ybsmTableRef: "ybsmTableRef",
ybsmFormPackageRef: "ybsmFormPackageRef",
}
const compRefs = Object.values(refConfig);
export default {
name: "SP0021",
components: { BaseInfoFormPackage, LineLabel, TableList, Step, CustomTable },
components: { BaseInfoFormPackage, LineLabel, TableList, Step, CustomTable,TableOpertaionDelete,ImportExcelDialog },
mixins: [templateMixin],
props: {
fillType: {
@ -66,206 +86,23 @@ export default {
computed: {
//
storageFormConfig() {
return [
{
type: "conditionItem",
config: {
storageCondition: {
label: 'template.common.storageConditionLabel',
type: "select",
fillType: "preFill",
options: this.getDictOptions("business_cctj"),
otherCode: "storageConditionOther",
},
}
}
];
return getStorageFormConfig(this)
},
//
remarkConig() {
return [
{
type: "cellItem",
config: {
remark: {
label: "",
type: "textarea",
fillType: "actFill",
span: 1,
placeholder: 'template.common.remarkPlaceholder',
maxlength: 1000,
rows: 5
}
}
}
]
return getRemarkFormConfig(this)
},
//
baseInfoFormConfig() {
//002
let baseConfig = this.sn=='DL002'?
{
studyMc: {
label: 'template.common.testName',
type: "input",
disabled: true,
},
studySn: {
label: 'template.common.testNumber',
type: "input",
disabled: true,
}
}:
{
studyMc: {
label: 'template.common.testName',
type: "input",
disabled: true,
},
studySn: {
label: 'template.common.testNumber',
type: "input",
disabled: true,
},
methodCode: {
label: 'template.common.methodCode',
type: "input",
fillType: "preFill",
maxlength: 50
},
versionNum: {
label: 'template.common.versionNumber',
type: "inputNumber",
fillType: "actFill",
prepend: "V",
maxlength: 50
},
}
return [
{
type: "cardItem",
config: baseConfig
},
{
type: "conditionItem",
label: 'template.common.testConfigurationConditions',
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: "cellItem",
label: 'template.common.configurationTime',
config: {
startDate: {
label: 'template.common.startTime',
type: "input",
},
endDate: {
label: 'template.common.endTime',
type: "input",
},
}
}
]
return getBaseInfoFormConfig(this)
},
//
stepFormConfig() {
return [
{
type: "step",
config: {
targetName: {
label: 'template.common.targetSolutionName',
type: "input",
fillType: "preFill",
maxlength: 50
},
targetCode: {
label: 'template.common.targetSolutionCode',
type: "input",
subType: "span",
fillType: "preFill",
subKey: "targetCodeSn",
maxlength: 20
},
targetPreConcentration: {
label: 'template.common.targetPreConcentration',
type: "inputNumber",
subType: "select",
subKey: "targetPreConcentrationUnit",
fillType: "preFill",
subOptions: this.getDictOptions('business_nddw'),
maxlength: 10,
selectTo: "targetActConcentrationUnit",//
},
targetActConcentration: {
label: 'template.common.targetActConcentration',
type: "inputNumber",
subType: "select",
subKey: "targetActConcentrationUnit",
compareTo: "targetPreConcentration",//
fillType: "actFill",
subFillType: "preFill",
subOptions: this.getDictOptions('business_nddw'),
copyFrom: "targetPreConcentration",//
maxlength: 10
},
targetPreVolume: {
label: 'template.common.targetPreVolume',
type: "inputNumber",
subType: "select",
subKey: "targetPreVolumeUnit",
subOptions: this.getDictOptions('business_tjdw'),
fillType: "preFill",
maxlength: 10,
selectTo: "targetActVolumeUnit",//
},
targetActVolume: {
label: 'template.common.targetActVolume',
type: "inputNumber",
subType: "select",
subKey: "targetActVolumeUnit",
fillType: "actFill",
subFillType: "preFill",
subOptions: this.getDictOptions('business_tjdw'),
compareTo: "targetPreVolume",//
copyFrom: "targetPreVolume",//
maxlength: 10
},
effectivePeriod: {
label: 'template.common.effectivePeriod',
type: "inputNumber",
subType: "select",
subKey: "effectivePeriodUnit",
fillType: "preFill",
subOptions: this.getDictOptions('business_yxqdw'),
maxlength: 10
},
expireDate: {
label: 'template.common.expireDate',
type: "input",
},
}
}
]
//
ybsmFormConfig() {
return getYbsmFormConfig(this)
},
//
ybsmColumns() {
return getTableColumns(this)
},
},
data() {
@ -275,40 +112,35 @@ export default {
};
},
mounted() {
const formData = this.getFormDataByTemplateData();
if (!formData.targetCodeSn && this.fillType === "actFill") {
this.getCode(formData);
}
},
methods: {
//
printTag() {
const printConfig = this.getBasePrintConfig();
const { storageCondition, targetCodeSn } = this.formData;
printConfig["存储条件"] = storageCondition;
printConfig["编号"] = targetCodeSn;
EventBus.$emit('showTagPrintDialog', { printConfig })
onLoadExcelData(excelData) {
const data = excelData.splice(1);
console.log(data,"ddd")
this.$refs.ImportExcelDialog.cancel()
setTimeout(() => {
this.justUpdateFilledFormData();
}, 100);
},
downloadExcelTemplate(arr){
this.exportExcel(arr)
},
//
onImportAnimal(){
this.$refs.ImportExcelDialog.show()
},
//
deleteTableRow(rowIndex, refName) {
this.$refs[refName].deleteRow(rowIndex)
},
//
getCode: debounce(async function (v) {
const result = await getLatestSn({
count: 1,
pre: v.targetCode,
type: 1
})
if (result.code == 200) {
this.$refs.stepFormPackageRef.updateFormData("targetCodeSn", result.data[0])
}
}, 100),
//
getFilledFormData() {
return this.getFilledFormDataByRefs(["baseInfoRef", "storageConditionRef", "stepFormPackageRef", "stepRef", "remarkRef"])
return this.getFilledFormDataByRefs(compRefs)
},
//
async getFormData() {
let content = await this.validFormFields(["baseInfoRef", "storageConditionRef", "stepFormPackageRef", "stepRef", "remarkRef"]);
let content = await this.validFormFields(compRefs);
return content;
},
getResource() {

+ 181
- 0
src/views/business/comps/template/formConfig/sp/SP0021.js View File

@ -0,0 +1,181 @@
export const getBaseInfoFormConfig = ($this) => {
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.testConfigurationConditions',
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.sp.sp00456.rqcz',
config: {
containerMaterial: {
label: 'template.sp.sp00456.rqcz',
type: 'select',
options: $this.getDictOptions('business_rqcz'),
fillType: 'actFill',
multiple: true,
otherCode: 'containerMaterialOther'
}
}
},
{
type: "cellItem",
label: 'template.sp.sp008.clsj',
config: {
startDate: {
label: 'template.common.startTime',
type: "input",
},
endDate: {
label: 'template.common.endTime',
type: "input",
},
}
}
]
}
//存储条件
export const getStorageFormConfig = ($this) => {
return [
{
type: "conditionItem",
config: {
storageCondition: {
label: 'template.common.storageConditionLabel',
type: "select",
fillType: "preFill",
options: $this.getDictOptions("business_cctj"),
otherCode: "storageConditionOther",
},
}
}
]
}
//备注
export const getRemarkFormConfig = ($this) => {
return [
{
type: "cellItem",
config: {
remark: {
label: "",
type: "textarea",
fillType: "actFill",
span: 1,
placeholder: 'template.common.remarkPlaceholder',
maxlength: 1000,
rows: 5
}
}
}
]
}
export const getYbsmFormConfig = ($this) => {
return [
{
type: "step",
config: {
zzmc: {
label: '组织名称',
type: "input",
fillType: "actFill",
maxlength: 50
},
sjd: {
label: '时间点',
type: "input",
fillType: "actFill",
maxlength: 50
},
xsbl: {
label: '稀释比例',
type: "inputNumber",
fillType: "actFill",
maxlength: 10
},
xztp: {
label: '选择天平',
type: "yq",
fillType: "actFill",
},
}
}
]
}
export const getTableColumns = ($this) => {
return [
{
label: '动物编号',
prop: 'dwbh',
width: 280,
bodyType: 'input',
bodyFillType: 'actFill',
},
{
label: '称取重量(g)',
prop: 'cqzl',
width: 280,
bodyType: 'input',
bodyDisabled: true,
bodyFillType: 'actFill',
bodySubFillType: 'actFill',
bodySubType:"button",
bodySubKey:"calcCqzl",
bodySubButtonName:"获取值",
},
{
label: '匀浆溶液理论加入量(ml)',
prop: 'lljrl',
width: 280,
bodyType: 'inputNumber',
bodyFillType: 'actFill',
},
{
label: '匀浆溶液实际加入量(ml)',
prop: 'sjjrl',
width: 280,
bodyType: 'inputNumber',
bodyFillType: 'actFill',
},
]
}

Loading…
Cancel
Save