Browse Source

feat:[模板管理][update]

luojie
luojie 2 weeks ago
parent
commit
77b052bd10
2 changed files with 9 additions and 17 deletions
  1. +7
    -16
      src/components/Template/StepComponents/ry/zlfz.vue
  2. +2
    -1
      src/components/Template/mixins/formPackageMixins.js

+ 7
- 16
src/components/Template/StepComponents/ry/zlfz.vue View File

@ -51,38 +51,29 @@ export default {
onRegentSubmit(data) { onRegentSubmit(data) {
console.log(data, "onRegentSubmit") console.log(data, "onRegentSubmit")
const { key, selectInfo } = data; const { key, selectInfo } = data;
if (key === 'gsp') {// if (key === 'gsp') {//
const { row = {} } = selectInfo;
const gspInfo = {//
max: row.kc,//
maxUnit: row.kcdw,//
}
this.$refs.stepFormPackageRef.updateFormData("gspInfo", gspInfo);
this.$refs.stepFormPackageRef.updateZlfzData("zlfz", { mybh: selectInfo.selectedId });
// this.formData[key] = data;
this.$nextTick(() => {
this.$refs.stepFormPackageRef.updateZlfzData("zlfz", { mybh: selectInfo.selectedId });
})
} }
}, },
async onSubPackageSubmit(data) { async onSubPackageSubmit(data) {
const { key } = data; const { key } = data;
if (key === 'zlfz') { if (key === 'zlfz') {
this.$refs.stepFormPackageRef.getFormData().then(res => { this.$refs.stepFormPackageRef.getFormData().then(res => {
console.log(res, "res")
if (res) { if (res) {
const { zlfz } = res; const { zlfz } = res;
const gspInfo = res.gspInfo || this.formData.gspInfo || {};
const { max, maxUnit } = gspInfo;
const gspInfo = res.selectInfo_gsp || {};
const { kc, kcdw } = gspInfo;
const dw = zlfz.formData.dw; const dw = zlfz.formData.dw;
const errMsg = "分装后小份容量之和大于母液容量,是否确认分装?" const errMsg = "分装后小份容量之和大于母液容量,是否确认分装?"
const totalVolume = zlfz.fzList.reduce((acc, cur) => acc + Number(cur.actnum), 0); const totalVolume = zlfz.fzList.reduce((acc, cur) => acc + Number(cur.actnum), 0);
const compareResult = compareVolume(totalVolume, dw, max, maxUnit);
const compareResult = compareVolume(totalVolume, dw, kc, kcdw);
const fzInfo = { const fzInfo = {
...zlfz.formData, ...zlfz.formData,
fzList: zlfz.fzList, fzList: zlfz.fzList,
}; };
if (compareResult > 0 || !max) {//
if (compareResult > 0 || !kc) {//
this.$modal.confirm(errMsg, '提示', { this.$modal.confirm(errMsg, '提示', {
confirmButtonText: this.$t('form.saveConfirm'), confirmButtonText: this.$t('form.saveConfirm'),
cancelButtonText: this.$t('form.cancel'), cancelButtonText: this.$t('form.cancel'),

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

@ -378,7 +378,7 @@ export default {
key.startsWith('selectInfo_') key.startsWith('selectInfo_')
) )
selectInfoKeys.forEach((key) => { selectInfoKeys.forEach((key) => {
result[key] = formData[key]
result[key] = this.formFields[key] || formData[key] || ''
}) })
// 更新表单字段 // 更新表单字段
this.formFields = { ...result } this.formFields = { ...result }
@ -594,6 +594,7 @@ export default {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (validateResult.valid && subComponentValidateResult.valid) { if (validateResult.valid && subComponentValidateResult.valid) {
console.log(this.formFields, 'this.formFields')
resolve(this.formFields) resolve(this.formFields)
} else if (!validateResult.valid) { } else if (!validateResult.valid) {
// this.$message.error("表单内容未填完,请填写后再提交"); // this.$message.error("表单内容未填完,请填写后再提交");

Loading…
Cancel
Save