Browse Source

feat:[模板管理][update]

lkf
luojie 2 months ago
parent
commit
9fd9262962
6 changed files with 106 additions and 56 deletions
  1. +11
    -2
      src/components/Template/CustomTable.vue
  2. +1
    -1
      src/components/Template/Step.vue
  3. +63
    -45
      src/components/Template/StepComponents/ZLSubPackage.vue
  4. +14
    -2
      src/components/Template/StepComponents/ry/zlfz.vue
  5. +9
    -2
      src/components/Template/StepFormPackage.vue
  6. +8
    -4
      src/components/Template/mixins/formPackageMixins.js

+ 11
- 2
src/components/Template/CustomTable.vue View File

@ -263,10 +263,10 @@ export default {
},
handleEditSignCallback(data) {
if (data.uuid === this.uuid) {
this.updateRecords();
this.updateRecords(data);
}
},
getRecords() {
getRecords(data) {
const records = [];
const { nickName, name } = this.$store.getters;
const { oldLocalDataSource, localDataSource, columns, prefixKey, fieldItemLabel } = this;
@ -299,6 +299,9 @@ export default {
title: oldValue ? "修改" : "提交",
time: moment().format("YYYY-MM-DD HH:mm:ss"),
};
if (data) {
record.reason = data.remark
}
this.updateZdxgjl(record);
records.push(record);
@ -324,6 +327,9 @@ export default {
title: oldSubValue ? "修改" : "提交",
time: moment().format("YYYY-MM-DD HH:mm:ss"),
};
if (data) {
record.reason = data.remark
}
this.updateZdxgjl(record);
records.push(record);
}
@ -349,6 +355,9 @@ export default {
title: oldOtherValue ? "修改" : "提交",
time: moment().format("YYYY-MM-DD HH:mm:ss"),
};
if (data) {
record.reason = data.remark
}
this.updateZdxgjl(record);
records.push(record);
}

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

@ -114,7 +114,7 @@ const stepTypes = [
{ label: '灭菌', value: 'mj' },
{ label: '复苏', value: 'fs' },
{ label: '封板', value: 'fb' },
{ label: '质量分装', value: 'zlfz' },
// { label: '', value: 'zlfz' },
];

+ 63
- 45
src/components/Template/StepComponents/ZLSubPackage.vue View File

@ -3,12 +3,15 @@
<div class="zl-container">
<div class="dialog-content">
<div class="header-container">
<div class="header-item">
<div class="header-title">母编号</div>
<HandleFormItem fieldKey = "clfz_mybh" :item="inputItem" :error="formErrors.mybh"
v-model="formData.mybh" />
<div class="header-item" v-for="item in subConfig" :key="item.key">
<div class="header-title">{{ item.label }}</div>
<HandleFormItem fieldItemLabel = "质量分装" :fieldKey = item.fieldKey
:item="item" :error="formErrors[item.key]"
:type="item.type"
@blur = "(e)=>onCommonBlur(e,item.key)"
v-model="formData[item.key]" />
</div>
<div class="header-item">
<!-- <div class="header-item">
<div class="header-title">分装数量</div>
<HandleFormItem fieldKey = "clfz_fzsl" @blur="onBlurFzsl" :item="integerInputNumberItem"
type = "inputNumber"
@ -17,19 +20,20 @@
<div class="header-item">
<div class="header-title">单位</div>
<div class="unit-select">
<HandleFormItem :item="unitItem" type="select" :error="formErrors.dw"
<HandleFormItem fieldKey = "clfz_dw" :item="unitItem" type="select" :error="formErrors.dw"
@blur="(e) => onCommonBlur(e, 'dw')" v-model="formData.dw" />
</div>
</div>
</div> -->
</div>
<div class="content-container">
<div class="header-container">
<div v-for="(item, index) in fzList" class="list-item" :key="index">
<div class="list-label">{{ formData.mybh }}-set{{ item.subCode }}</div>
<HandleFormItem :fieldKey = "'clfz_set'+index+'_prenum'" :item="preInputNumberItem"
<HandleFormItem fieldItemLabel = "质量分装" :fieldKey = "'clfz_set'+index+'_prenum'" :item="preInputNumberItem"
:error="hasError(index, 'prenum')"
:disabled="true"
type="inputNumber" @blur="onBlurFzNum(index,'prenum')" v-model="item.prenum" />
<HandleFormItem :fieldKey = "'clfz_set'+index+'_actnum'" class="ml-5" :item="inputNumberItem"
<HandleFormItem fieldItemLabel = "质量分装" :fieldKey = "'clfz_set'+index+'_actnum'" class="ml-5" :item="inputNumberItem"
:error="hasError(index, 'actnum')"
type="inputNumber" @blur="onBlurFzNum(index,'actnum')" v-model="item.actnum" />
<HandleFormItem
@ -46,7 +50,6 @@
<script>
import HandleFormItem from '@/components/Template/HandleFormItem.vue';
import { compareVolume } from '@/utils/volumeTools.js';
import { EventBus } from '@/utils/eventBus';
import { getLatestSn } from '@/api/template';
import { isValueEmpty } from '@/utils/index.js';
@ -73,30 +76,30 @@ export default {
},
integerInputNumberItem: {
type: "inputNumber",
fillType: "preFill",
fillType: "actFill",
precision: 0,
maxlength: 3
},
inputNumberItem: {
type: "inputNumber",
fillType: "actFill",
label:"实际称量"
},
preInputNumberItem: {
type: "inputNumber",
fillType: "preFill",
label:"预计称量"
},
formData: {
mybh: "",//
fzsl: "",//
dw: "",//
mfbzl: "",//
},
fzList: [],//
//
formErrors: {
fzsl: false,
dw: false,
mfbzl: false,
},
fzListErrors: [], //
uuid:"",//id
@ -131,19 +134,42 @@ export default {
}
},
computed: {
unitItem() {
return {
type: "select",
fillType: "actFill",
options: this.dict.type.business_tjdw
}
}
subConfig(){
return[
{
fieldKey:"clfz_mybh",
key:"mybh",
label:"母编号",
type:"input",
disabled: true,
fillType: "actFill",
},
{
fieldKey:"clfz_fzsl",
key:"fzsl",
label:"分装数量",
type:"inputNumber",
fillType: "preFill",
},
{
fieldKey:"clfz_dw",
key:"dw",
label:"单位",
type:"select",
options: this.dict.type.business_tjdw,
fillType: "preFill",
},
]
},
},
methods: {
updateFormData(data){
this.formData = {...this.formData,...data};
},
//
getButtonItem() {
return {
fillType: "preFill",
fillType: "actFill",
buttonName:"获取值",
}
},
@ -157,30 +183,13 @@ export default {
let isValid = true;
//
const baseFieldConfigs = [
{
field: 'fzsl',
errorField: 'fzsl',
itemConfig: this.integerInputNumberItem
},
{
field: 'dw',
errorField: 'dw',
itemConfig: this.unitItem
},
{
field: 'mfbzl',
errorField: 'mfbzl',
itemConfig: this.inputNumberItem
}
];
const baseFieldConfigs = this.subConfig;
//
baseFieldConfigs.forEach(config => {
if (config.itemConfig.fillType === this.templateFillType) {
if (!this.formData[config.field]) {
this.formErrors[config.errorField] = true;
if (config.fillType === this.templateFillType) {
if (isValueEmpty(this.formData[config.key]) && !config.disabled) {
this.formErrors[config.key] = true;
isValid = false;
}
}
@ -214,7 +223,7 @@ export default {
}
}
}
return {valid: isValid,error:""};
return {valid: isValid,error:"质量分装数据没填完"};
},
resetErrors() {
//
@ -229,7 +238,6 @@ export default {
},
//
async onBlurFzsl(e) {
console.log(e,"失去焦点时的数量")
//
if (e) {
this.formErrors.fzsl = false;
@ -252,6 +260,13 @@ export default {
subCode: codes[i],
});
}
const params = {
type: "fieldChanged",
newRecord: null,
resourceList: null,
}
EventBus.$emit("onModifyRecord", params);
}
},
@ -260,10 +275,13 @@ export default {
console.log(item,"获取值")
this.fzList = [...this.fzList]
},
onCommonBlur(e, field) {
onCommonBlur(e,field) {
if (this.formData[field]) {
this.formErrors[field] = false;
}
if(field === 'fzsl'){
this.onBlurFzsl(e);
}
},
onBlurFzNum(index, field) {
if (this.fzList[index]) {

+ 14
- 2
src/components/Template/StepComponents/ry/zlfz.vue View File

@ -1,6 +1,8 @@
<!-- 质量分装 -->
<template>
<StepFormPackage ref="stepFormPackageRef" prefixKey="ry_czdd" @resetRecord="resetRecord" :form-config="formConfig"
<StepFormPackage
@onDialogSubmit = "onDialogSubmit"
ref="stepFormPackageRef" prefixKey="ry_zlfz" @resetRecord="resetRecord" :form-config="formConfig"
:formData="formData" />
</template>
@ -38,7 +40,7 @@ export default {
},
{
config:{
clfz:{
zlfz:{
type: "zlfz",
}
}
@ -46,6 +48,16 @@ export default {
]
}
},
methods: {
onDialogSubmit(data,key){
console.log(data,key,"onDialogSubmit")
if(key === 'yq'){//
this.$refs.stepFormPackageRef.updateZlfzData("zlfz",{mybh:data.selectedId});
// this.formData[key] = data;
}
}
}
}
</script>

+ 9
- 2
src/components/Template/StepFormPackage.vue View File

@ -48,6 +48,7 @@
<span>{{ formFields[key] }}</span>
</template>
<template v-else-if="sItem.type === 'zlfz'">
{{ key }}
<ZLSubPackage @update="(data)=>onSubPackageUpdate(data,key)" :subData = "formFields[key]" :ref="'zlSubPackageRef_'+key" />
</template>
@ -120,6 +121,12 @@ export default {
}
},
methods: {
updateZlfzData(key,data){
const ref = this.$refs[`zlSubPackageRef_${key}`][0];
if(ref){
ref.updateFormData(data);
}
},
//
onSubPackageUpdate(data,key){
this.formFields[key] = data;
@ -132,7 +139,7 @@ export default {
if (item.config) {
for (const key in item.config) {
const sItem = item.config[key];
if (sItem.type === 'zlfz') {
if (sItem.type === 'zlfz') {//
// keyref
const refName = `zlSubPackageRef_${key}`;
const zlSubPackageRef = this.$refs[refName];
@ -211,7 +218,7 @@ export default {
this.allFieldsConfig[this.currentClickKey].sjSelectType = data.selectType;
this.formFields[`selectInfo_${this.currentClickKey}`] = data.selectInfo;
}
this.$emit("onDialogSubmit",data)
this.$emit("onDialogSubmit",data,this.currentClickKey)
},
//
onReagentSubmit(data){

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

@ -50,7 +50,7 @@ export default {
},
methods: {
getRecords() {
getRecords(data) {
const records = [];
const { nickName, name } = this.$store.getters;
const { oldFormFields, formFields, allFieldsConfig, prefixKey, fieldItemLabel } = this;
@ -72,6 +72,9 @@ export default {
title: oldValue ? "修改" : "提交",
time: moment().format("YYYY-MM-DD HH:mm:ss"),
}
if (data) {
record.reason = data.remark
}
this.updateZdxgjl(record);
records.push(record);
}
@ -86,7 +89,7 @@ export default {
},
handleEditSignCallback(data) {
if (data.uuid === this.uuid) {
this.updateRecord();
this.updateRecord(data);
}
},
handleClickButton(key) {
@ -134,8 +137,8 @@ export default {
this.$set(this.errors, key, false);
}
},
updateRecord() {
const records = this.getRecords();
updateRecord(data) {
const records = this.getRecords(data);
const params = {
type: "fieldChanged",
newRecord: records,
@ -345,6 +348,7 @@ export default {
const errors = [];
// 清空之前的错误状态
this.errors = {};
console.log(allFieldsConfig,"allFieldsConfig")
for (const key in allFieldsConfig) {
const o = allFieldsConfig[key];
if (o.otherCode) {//

Loading…
Cancel
Save