diff --git a/src/components/Template/StepComponents/pcr/hsypfz.vue b/src/components/Template/StepComponents/pcr/hsypfz.vue
index 7f7d562..5c2afca 100644
--- a/src/components/Template/StepComponents/pcr/hsypfz.vue
+++ b/src/components/Template/StepComponents/pcr/hsypfz.vue
@@ -20,23 +20,10 @@ export default {
StepFormPackage
},
mounted() {
- this.getCode();
+ this.handleBackfillCode("lbbh","lbbhCode");
},
methods: {
- async getCode() {
- const { lbbhCode } = this.formData;
- if (this.templateFillType === 'actFill') {
- const stepFormData = this.getFilledFormData();
- const { lbbh } = stepFormData;
- const result = await this.getLatestSn({
- count: 1,
- type: 1,
- pre: lbbh,
- })
- this.$refs.stepFormPackageRef.updateFormData("lbbhCode",result[0])
- console.log(result,"reee")
- }
- }
+
},
computed: {
formConfig() {
diff --git a/src/components/Template/mixins/stepMixins.js b/src/components/Template/mixins/stepMixins.js
index e8b5e8d..341b3e0 100644
--- a/src/components/Template/mixins/stepMixins.js
+++ b/src/components/Template/mixins/stepMixins.js
@@ -1,4 +1,4 @@
-import { getuuid } from '@/utils/index.js'
+import { getuuid ,justUpdateFilledFormData} from '@/utils/index.js'
import { EventBus } from '@/utils/eventBus'
import { getLatestSn, getLatestSnArr } from '@/api/template'
export default {
@@ -33,7 +33,7 @@ export default {
data() {
return {
uuid: getuuid(),
- fzInfo: null
+ fzInfo:{},
}
},
mounted() {
@@ -50,6 +50,22 @@ export default {
},
methods: {
+ //回填编号 preField 前缀 updateField 需要更新的字段
+ async handleBackfillCode(preField,updateField){
+ const updateValue = this.formData[updateField];
+ if (this.templateFillType === 'actFill' && !updateValue) {
+ const stepFormData = this.getFilledFormData();
+ const preValue = stepFormData[preField];
+ const result = await this.getLatestSn({
+ pre: preValue,
+ })
+ this.$refs.stepFormPackageRef.updateFormData(updateField,result[0])
+ this.justUpdateFilledFormData();
+ }
+ },
+ justUpdateFilledFormData(){
+ justUpdateFilledFormData();
+ },
//获取最新的多个编号
async getLatestSnArr(params) {
const res = await getLatestSnArr(params)
@@ -77,15 +93,9 @@ export default {
},
onSubPackageSubmit(data) {
if (data.uuid === this.uuid) {
- console.log(data, 'ddd')
- this.fzInfo = data
- //通知后端保存数据
- const params = {
- type: 'fieldChanged',
- newRecord: null,
- resourceList: null
- }
- EventBus.$emit('onModifyRecord', params)
+ delete data.uuid //删除uuid字段,不然会导致下次匹配的时候匹配到错误的uuid
+ this.$refs.stepFormPackageRef.updateFormData('fzInfo',data)
+ this.justUpdateFilledFormData();
}
},
// 点击按钮
@@ -104,30 +114,37 @@ export default {
console.warn('请配制分装参数')
return
}
+ const fzInfo = stepFormData.fzInfo || this.formData.fzInfo;
const maxVolume = stepFormData[maxVolumeField]
const maxVolumeUnit = stepFormData[maxVolumeUnitField]
myCodeFields.forEach((key) => {
fields.push(stepFormData[key])
})
-
EventBus.$emit('showSubPackageDialog', {
mybh: fields.join(''),
maxVolume,
maxVolumeUnit,
uuid: this.uuid,
- fzType: 'step'
+ fzType: 'step',
+ ...fzInfo,
})
}
},
async getFormData() {
- return await this.$refs.stepFormPackageRef.getFormData()
+ const data = await this.$refs.stepFormPackageRef.getFormData();
+ data.fzInfo = data.fzInfo || this.formData.fzInfo;
+ return data
},
getFilledFormData() {
- return this.$refs.stepFormPackageRef?.getFilledFormData()
+ const data = this.$refs.stepFormPackageRef?.getFilledFormData();
+ data.fzInfo = data.fzInfo || this.formData.fzInfo;
+ return data
},
getSjResource() {
- return this.$refs.stepFormPackageRef?.getSjResource()
+ const data = this.$refs.stepFormPackageRef?.getSjResource();
+ data.fzInfo = data.fzInfo || this.formData.fzInfo;
+ return data
},
//试验配制条件options
getDictOptions(dictType) {
diff --git a/src/views/business/comps/template/dialog/SubPackageDialog.vue b/src/views/business/comps/template/dialog/SubPackageDialog.vue
index e279be6..dc231e5 100644
--- a/src/views/business/comps/template/dialog/SubPackageDialog.vue
+++ b/src/views/business/comps/template/dialog/SubPackageDialog.vue
@@ -5,13 +5,14 @@
@@ -19,22 +20,25 @@
分装编号
单位:
- onCommonBlur(e, 'dw')" v-model="formData.dw" />
+ onCommonBlur(e, 'dw')"
+ v-model="formData.dw" />
每份包装量:
-
+
-
平均分配
+
平均分配
重置
@@ -56,7 +60,7 @@ import { isValueEmpty } from "@/utils/index";
import moment from 'moment';
import { getuuid } from "@/utils/index.js";
export default {
- inject: ['updateZdxgjl',"getZdxgjl"],
+ inject: ['updateZdxgjl', "getZdxgjl"],
dicts: [
'business_tjdw',
],
@@ -98,7 +102,7 @@ export default {
fzListErrors: [], // 分装列表错误状态
uuid: "",//事件id
originalData: {},//原始数据
- uuid:getuuid(),//事件id
+ uuid: getuuid(),//事件id
}
},
computed: {
@@ -112,21 +116,21 @@ export default {
},
mounted() {
EventBus.$on('onEditSignCallback', this.handleEditSignCallback);
- EventBus.$on('onFormEditSignCancel', this.handleEditSignCancel);
+ EventBus.$on('onFormEditSignCancel', this.handleEditSignCancel);
},
unmounted() {
- EventBus.$off('onEditSignCallback', this.handleEditSignCallback);
- EventBus.$off('onFormEditSignCancel', this.handleEditSignCancel);
- },
+ EventBus.$off('onEditSignCallback', this.handleEditSignCallback);
+ EventBus.$off('onFormEditSignCancel', this.handleEditSignCancel);
+ },
methods: {
handleEditSignCancel(data) {
-
- },
- handleEditSignCallback(data) {
- if (data.uuid === this.uuid) {
- this.updateRecords();
- }
- },
+
+ },
+ handleEditSignCallback(data) {
+ if (data.uuid === this.uuid) {
+ this.updateRecords();
+ }
+ },
close() {
this.visible = false;
this.fzList = [];
@@ -209,16 +213,16 @@ export default {
this.close();
}, 500);
},
- getCommonInfo(type){
+ getCommonInfo(type) {
const { nickName, name } = this.$store.getters;
- const o ={
- mybh:"母液编号",
- fzsl:"分装数量",
- dw:"单位",
- mfbzl:"每份包装量",
- num:"分装编号"
+ const o = {
+ mybh: "母液编号",
+ fzsl: "分装数量",
+ dw: "单位",
+ mfbzl: "每份包装量",
+ num: "分装编号"
}
- return{
+ return {
userNameCn: nickName,
userNameEn: name,
time: moment().format("YYYY-MM-DD HH:mm:ss"),
@@ -250,9 +254,9 @@ export default {
});
// 比较分装列表
this.compareFzList(originalData.fzList, nowData.fzList, records);
-
+
console.log(records, "records")
-
+
this.handleSubmit();
if (records.length == 0) {
return;
@@ -270,7 +274,7 @@ export default {
compareFzList(originalFzList, nowFzList, records) {
console.log(originalFzList, nowFzList, records, "compareFzList")
const { mybh } = this.formData;
- if(!originalFzList.length){
+ if (!originalFzList.length) {
nowFzList.forEach(item => {
const record = {
key: mybh + '_num_' + item.subCode,
@@ -284,47 +288,20 @@ export default {
})
return;
}
- if (originalFzList.length === nowFzList.length) {
- for (let i = 0; i < originalFzList.length; i++) {
- if (originalFzList[i].num !== nowFzList[i].num) {
- const record = {
- key: mybh + '_num_' + originalFzList[i].subCode,
- oldValue: originalFzList[i].num,
- value: nowFzList[i].num,
- title: originalFzList[i].num ? "修改" : "提交",
- ...this.getCommonInfo('num'),
- };
- records.push(record);
- this.updateZdxgjl(record);
- }
- }
- }else if(originalFzList.length>nowFzList.length){
- for (let i = 0; i < nowFzList.length; i++) {
- if (originalFzList[i].num !== nowFzList[i].num) {
- const record = {
- key: mybh + '_num_' + nowFzList[i].subCode,
- oldValue: originalFzList[i].num,
- value: nowFzList[i].num,
- title: originalFzList[i].num ? "修改" : "提交",
- ...this.getCommonInfo('num'),
- };
- records.push(record);
- this.updateZdxgjl(record);
- }
- }
- }else{
- for (let i = 0; i < originalFzList.length; i++) {
- if (originalFzList[i].num !== nowFzList[i].num) {
- const record = {
- key: mybh + '_num_' + nowFzList[i].subCode,
- oldValue: originalFzList[i].num,
- value: nowFzList[i].num,
- title: originalFzList[i].num ? "修改" : "提交",
- ...this.getCommonInfo('num'),
- };
- records.push(record);
- this.updateZdxgjl(record);
- }
+ for (let i = 0; i < nowFzList.length; i++) {
+ const originalItem = originalFzList[i] || {};
+ const originalCode = originalItem.subCode + originalItem.num;
+ const nowCode = nowFzList[i].subCode + nowFzList[i].num;
+ if (originalCode !== nowCode) {
+ const record = {
+ key: mybh + '_num_' + nowFzList[i].subCode,
+ oldValue: originalItem.num,
+ value: nowFzList[i].num,
+ title: originalItem.num ? "修改" : "提交",
+ ...this.getCommonInfo('num'),
+ };
+ records.push(record);
+ this.updateZdxgjl(record);
}
}
@@ -510,7 +487,12 @@ export default {
margin-right: 5px;
// width: 200px;
}
-.ml-5{
+
+.ml-5 {
margin-left: 5px;
}
+
+.ml-10 {
+ margin-left: 10px;
+}
\ No newline at end of file