Browse Source

feat:[模板管理][update]

lkf
luojie 1 month ago
parent
commit
b5855ae496
7 changed files with 39 additions and 25 deletions
  1. +4
    -4
      src/components/Template/BaseInfoFormPackage.vue
  2. +5
    -4
      src/components/Template/CustomTable.vue
  3. +6
    -1
      src/components/Template/HandleFormItem.vue
  4. +2
    -2
      src/components/Template/README.md
  5. +4
    -3
      src/components/Template/mixins/formPackageMixins.js
  6. +7
    -3
      src/views/business/comps/template/comps/sp/SP0019.vue
  7. +11
    -8
      src/views/business/comps/template/formConfig/sp/SP0019.js

+ 4
- 4
src/components/Template/BaseInfoFormPackage.vue View File

@ -115,7 +115,7 @@
:field-item-label="fieldItemLabel" :field-key="prefixKey+'_'+key" :type="sItem.type" :field-item-label="fieldItemLabel" :field-key="prefixKey+'_'+key" :type="sItem.type"
sourceFrom = "baseInfoFormPackage" sourceFrom = "baseInfoFormPackage"
:error="errors[key]" @update:error="errors[key] = false" :error="errors[key]" @update:error="errors[key] = false"
@onRegentSubmit="(data)=>onRegentSubmit(data,key,sItem)"
@onRegentSubmit="(data,inputValue)=>onRegentSubmit(data,inputValue,key,sItem)"
:item="sItem" :value="formFields[key]" /> :item="sItem" :value="formFields[key]" />
</div> </div>
@ -176,7 +176,7 @@
:item="getRegentItem(sItem,'subType')" :item="getRegentItem(sItem,'subType')"
sourceFrom = "baseInfoFormPackage" sourceFrom = "baseInfoFormPackage"
@beforeReagentSubmit="(data, callback)=>onBeforeReagentSubmit(data, callback,sItem.subKey)" @beforeReagentSubmit="(data, callback)=>onBeforeReagentSubmit(data, callback,sItem.subKey)"
@onRegentSubmit="(data)=>onRegentSubmit(data,sItem.subKey,sItem)"
@onRegentSubmit="(data,inputValue)=>onRegentSubmit(data,inputValue,sItem.subKey,sItem)"
:error="errors[sItem.subKey]" @update:error="errors[sItem.subKey] = false" :error="errors[sItem.subKey]" @update:error="errors[sItem.subKey] = false"
:value="formFields[sItem.subKey]" /> :value="formFields[sItem.subKey]" />
<div v-show="isShowOther(formFields[sItem.subKey])" class="flex flex1"> <div v-show="isShowOther(formFields[sItem.subKey])" class="flex flex1">
@ -213,7 +213,7 @@
sourceFrom = "baseInfoFormPackage" sourceFrom = "baseInfoFormPackage"
:error="errors[sItem.subKey]" :type="sItem.subType" :error="errors[sItem.subKey]" :type="sItem.subType"
@beforeReagentSubmit="(data, callback)=>onBeforeReagentSubmit(data, callback,sItem.subKey)" @beforeReagentSubmit="(data, callback)=>onBeforeReagentSubmit(data, callback,sItem.subKey)"
@onRegentSubmit="(data)=>onRegentSubmit(data,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">
@ -234,7 +234,7 @@
<HandleFormItem :field-item-label="fieldItemLabel" <HandleFormItem :field-item-label="fieldItemLabel"
sourceFrom = "baseInfoFormPackage" sourceFrom = "baseInfoFormPackage"
@beforeReagentSubmit="(data, callback)=>onBeforeReagentSubmit(data, callback,key)" @beforeReagentSubmit="(data, callback)=>onBeforeReagentSubmit(data, callback,key)"
@onRegentSubmit="(data)=>onRegentSubmit(data,key,sItem)"
@onRegentSubmit="(data,inputValue)=>onRegentSubmit(data,inputValue,key,sItem)"
:field-key="prefixKey+'_'+key" :type="sItem.type" :field-key="prefixKey+'_'+key" :type="sItem.type"
:error="errors[key]" @update:error="errors[key] = false" :error="errors[key]" @update:error="errors[key] = false"
:item="getRegentItem(sItem)" :value="formFields[key]" /> :item="getRegentItem(sItem)" :value="formFields[key]" />

+ 5
- 4
src/components/Template/CustomTable.vue View File

@ -99,8 +99,8 @@
sourceFrom = "customTable" sourceFrom = "customTable"
:item="getBodyItem(col, rowIndex)" :value="row[col.prop]" :item="getBodyItem(col, rowIndex)" :value="row[col.prop]"
:error="hasError(rowIndex, colIndex, col.prop)" :error="hasError(rowIndex, colIndex, col.prop)"
@onRegentSubmit="(data)=>onRegentSubmit(data,col, rowIndex, colIndex, row)"
@beforeReagentSubmit="(data, callback)=>onBeforeReagentSubmit(data, callback,col,row)"
@onRegentSubmit="(data,inputValue)=>onRegentSubmit(data,inputValue,col, rowIndex, colIndex, row)"
@beforeReagentSubmit="(data, callback)=>onBeforeReagentSubmit(data, callback,col,row)"
@update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)" @update:error="onErrorUpdate(rowIndex, colIndex, col.prop, $event)"
:orange-bg="hasOrangeBg(rowIndex, colIndex, col.prop)" /> :orange-bg="hasOrangeBg(rowIndex, colIndex, col.prop)" />
</div> </div>
@ -354,11 +354,11 @@ export default {
} }
this.$emit("beforeReagentSubmit", {selectData:data, callback, key:col.prop, rowData:row}) this.$emit("beforeReagentSubmit", {selectData:data, callback, key:col.prop, rowData:row})
}, },
onRegentSubmit(data, col, rowIndex, colIndex, row){
onRegentSubmit(data, inputValue, col, rowIndex, colIndex, row){
if (this.templateFillType !== 'actFill') { if (this.templateFillType !== 'actFill') {
return return
} }
this.updateDataSourceByRowIndex(rowIndex,{[col.prop]:data.selectedId})
this.updateDataSourceByRowIndex(rowIndex,{[col.prop]:inputValue})
this.$emit("onRegentSubmit", {selectInfo:data,key:col.prop, col, rowIndex, colIndex, rowData:row}) this.$emit("onRegentSubmit", {selectInfo:data,key:col.prop, col, rowIndex, colIndex, rowData:row})
}, },
isShowAddRos() { isShowAddRos() {
@ -651,6 +651,7 @@ export default {
copyFrom: col.copyFrom || "", copyFrom: col.copyFrom || "",
compareTo: col.compareTo, // compareTo compareTo: col.compareTo, // compareTo
type: col.bodyType || "input", type: col.bodyType || "input",
filledCodes:col.filledCodes,
}; };
if (col.bodyDisabled) { if (col.bodyDisabled) {
item.disabled = col.bodyDisabled; item.disabled = col.bodyDisabled;

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

@ -478,6 +478,11 @@ export default {
// //
executeReagentSubmit(data) { executeReagentSubmit(data) {
this.inputValue = data.selectedId; this.inputValue = data.selectedId;
const {filledCodes=[]} = this.item;
const {selectInfo} = data;
if(filledCodes.length>0){
this.inputValue = selectInfo[filledCodes[0]]+"("+selectInfo[filledCodes[1]]+")";
}
this.selectRegentInfo = data; this.selectRegentInfo = data;
EventBus.$emit("hideSelectMixReagentDialog"); EventBus.$emit("hideSelectMixReagentDialog");
this.onCommonHandleSaveRecord(this.inputValue); this.onCommonHandleSaveRecord(this.inputValue);
@ -919,7 +924,7 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
EventBus.$emit('onModifyRecord', params,) EventBus.$emit('onModifyRecord', params,)
if (this.regentType.includes(this.item.type)) { if (this.regentType.includes(this.item.type)) {
this.$emit("onRegentSubmit", this.selectRegentInfo);
this.$emit("onRegentSubmit", this.selectRegentInfo, this.inputValue);
} }
}) })
}, },

+ 2
- 2
src/components/Template/README.md View File

@ -7,7 +7,7 @@
config: { config: {
storageCondition: {//当前表单的key值; storageCondition: {//当前表单的key值;
label: "存储条件",//当前表单的label值,有的表单可能没有; label: "存储条件",//当前表单的label值,有的表单可能没有;
type: "input"|"select"|"inputerNumber"|"textarea"|"dateTime"|"span"|"clickable",//当前表单的type值
type: "input"|"select"|"inputNumber"|"textarea"|"dateTime"|"span"|"clickable",|"attachment" |'sj', 'gsp', 'mix', 'xj', 'xb', 'gyzj', 'mjy', 'yq', 'jcb', 'qxbd'//当前表单的type值
fillType: "preFill" |"actFill",//主要是边框的区分,preFill为预填(蓝色),actFill为实际填报(橙色); fillType: "preFill" |"actFill",//主要是边框的区分,preFill为预填(蓝色),actFill为实际填报(橙色);
options: this.getDictOptions("business_cctj"),//当前表单的type为select时,options为必填项,如:[{label:"",value:""}] options: this.getDictOptions("business_cctj"),//当前表单的type为select时,options为必填项,如:[{label:"",value:""}]
otherCode: "storageConditionOther",//当前表单可能会触发其他输入项,otherCode为其他输入项的key值; otherCode: "storageConditionOther",//当前表单可能会触发其他输入项,otherCode为其他输入项的key值;
@ -23,7 +23,7 @@
subFillType: "preFill" |"actFill",//第二个字段的边框区分,preFill为预填(蓝色),actFill为实际填报(橙色); subFillType: "preFill" |"actFill",//第二个字段的边框区分,preFill为预填(蓝色),actFill为实际填报(橙色);
subPlaceholder: "请输入存储条件",//第二个表单的placeholder值,不填写时默认拼接请输入/请选择+label; subPlaceholder: "请输入存储条件",//第二个表单的placeholder值,不填写时默认拼接请输入/请选择+label;
compareTo: "storageCondition",//需要比较的字段,字段不一样时背景标红; compareTo: "storageCondition",//需要比较的字段,字段不一样时背景标红;
copyFrom:"storageCondition",//需要复制的字段,复制后会自动填充到当前表单;
copyFrom:"storageCondition",//需要复制的字段,复制后会自动填充到当前表单;
}, },
} }

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

@ -62,9 +62,9 @@ export default {
}, },
//试剂/仪器等弹窗提交 //试剂/仪器等弹窗提交
onRegentSubmit(data,key,item){
this.updateFormData(key,data.selectedId);
this.$emit("onRegentSubmit", {selectInfo:data,key,config:item});
onRegentSubmit(data,inputValue,key,item){
this.updateFormData(key,inputValue);
this.$emit("onRegentSubmit", {selectInfo:data,inputValue,key,config:item});
}, },
getRegentItem(item,fieldCode="type"){ getRegentItem(item,fieldCode="type"){
const type = item[fieldCode] ; const type = item[fieldCode] ;
@ -73,6 +73,7 @@ export default {
type, type,
fillType: item.subFillType || item.fillType, fillType: item.subFillType || item.fillType,
parentLabel: item.label, parentLabel: item.label,
filledCodes:item.filledCodes,
} }
}, },

+ 7
- 3
src/views/business/comps/template/comps/sp/SP0019.vue View File

@ -13,6 +13,7 @@
:columns="yqInfoColumns" :columns="yqInfoColumns"
:formData = "formData" :formData = "formData"
ref = "yqInfoTableRef" ref = "yqInfoTableRef"
@onRegentSubmit="(data, col, rowIndex, colIndex, row)=>onYqSubmit(data, col, rowIndex, colIndex, row)"
:showAddRow = "fillType === 'actFill'" :showAddRow = "fillType === 'actFill'"
:showOperation = "fillType === 'actFill'" :showOperation = "fillType === 'actFill'"
:prefixKey="`yqTable`" :prefixKey="`yqTable`"
@ -21,7 +22,7 @@
<TableOpertaionDelete :row="row" :rowIndex="rowIndex" :columns="columns" @deleteRow="()=>deleteRow(rowIndex,'yqInfoTableRef')" ></TableOpertaionDelete> <TableOpertaionDelete :row="row" :rowIndex="rowIndex" :columns="columns" @deleteRow="()=>deleteRow(rowIndex,'yqInfoTableRef')" ></TableOpertaionDelete>
</template> </template>
</CustomTable> </CustomTable>
<BaseInfoFormPackage class="mt-20" fieldItemLabel="色谱柱型号" label="色谱柱型号" ref="storageConditionRef"
<BaseInfoFormPackage class="mt-20" fieldItemLabel="色谱柱型号" label="色谱柱型号" ref="spzxhRef"
:formConfig="storageFormConfig" :formData="formData" /> :formConfig="storageFormConfig" :formData="formData" />
<LineLabel label="溶液" /> <LineLabel label="溶液" />
<CustomTable <CustomTable
@ -117,13 +118,16 @@ export default {
}, },
methods: { methods: {
onYqSubmit(data, col, rowIndex, colIndex, row){
console.log(data, col, rowIndex, colIndex, row,"onRegentSubmit")
},
// //
getFilledFormData() { getFilledFormData() {
return this.getFilledFormDataByRefs(["baseInfoRef", "storageConditionRef", "yqInfoTableRef", "ryTableRef", "remarkRef"])
return this.getFilledFormDataByRefs(["baseInfoRef", "storageConditionRef", "spzxhRef", "yqInfoTableRef", "ryTableRef", "remarkRef"])
}, },
// //
async getFormData() { async getFormData() {
let content = await this.validFormFields(["baseInfoRef", "storageConditionRef", "yqInfoTableRef","ryTableRef", "remarkRef"]);
let content = await this.validFormFields(["baseInfoRef", "storageConditionRef", "spzxhRef","yqInfoTableRef","ryTableRef", "remarkRef"]);
console.log(content) console.log(content)
return content; return content;
}, },

+ 11
- 8
src/views/business/comps/template/formConfig/sp/SP0019.js View File

@ -51,6 +51,7 @@ export const storageFormConfig = [
label: '色谱柱型号', label: '色谱柱型号',
type: 'yq', type: 'yq',
fillType: 'actFill', fillType: 'actFill',
filledCodes:['mc','bh'],
}, },
} }
}, },
@ -60,9 +61,17 @@ export const storageFormConfig = [
export const getYqColumns = ($this) => { export const getYqColumns = ($this) => {
return [ return [
{ {
label: 'template.common.instrumentCode',
prop: "bh",
bodyType: "yq",
bodyFillType: 'actFill',
},//仪器编号
{
label: 'template.common.instrumentName', label: 'template.common.instrumentName',
prop: "mc", prop: "mc",
bodyType: "yq",
bodyType: "input",
bodyType: "input",
bodyDisabled: true,
bodyFillType: 'actFill', bodyFillType: 'actFill',
},//仪器名称 },//仪器名称
{ {
@ -72,13 +81,7 @@ export const getYqColumns = ($this) => {
bodyDisabled: true, bodyDisabled: true,
bodyFillType: 'actFill', bodyFillType: 'actFill',
},//仪器型号 },//仪器型号
{
label: 'template.common.instrumentCode',
prop: "bh",
bodyType: "input",
bodyDisabled: true,
bodyFillType: 'actFill',
},//仪器编号
{ {
label: 'template.common.nextTestDate', label: 'template.common.nextTestDate',
prop: "jzrq", prop: "jzrq",

Loading…
Cancel
Save