feat(入库计划): 查询计划编码是否重复

This commit is contained in:
LJW 2024-11-14 16:51:55 +08:00
parent 57445a6f24
commit eada1f3f27
2 changed files with 27 additions and 7 deletions

View File

@ -42,3 +42,12 @@ export function delPLAN(planId) {
method: 'delete'
})
}
// 查询计划编码是否重复
export function isDuplicatePlanCode(planCode) {
return request({
url: '/wm/PLAN/isDuplicatePlanCode/' + planCode,
method: 'get'
})
}

View File

@ -254,7 +254,7 @@
</template>
<script>
import {addPLAN, delPLAN, getPLAN, listPLAN, updatePLAN} from "@/api/wm/PLAN";
import {listPLAN, getPLAN, delPLAN, addPLAN, updatePLAN, isDuplicatePlanCode,} from "@/api/wm/PLAN";
import {listTYPE} from "@/api/md/TYPE";
import {listMdItem} from "@/api/mes/md/mdItem"
import {listArea} from "@/api/mes/wm/area"
@ -262,6 +262,20 @@ import {addWmsInTask} from "@/api/mes/wm/wmsInTask"
import WmsInPlanDetailEntityTableCmps from "@/views/mes/wm/inPlan/wmsInPlanDetailEntityTableCmps.vue";
import WmsInPlanKnifeBackFormCmps from "@/views/mes/wm/inPlan/wmsInPlanKnifeBackFormCmps.vue";
//
const planCodeValidator = (rule, value, callback) => {
if (value === "") {
callback();
} else {
isDuplicatePlanCode(value).then(res => {
if (res.data) {
callback(new Error("计划编码重复"))
} else {
callback();
}
})
}
}
export default {
name: "PLAN",
components: {WmsInPlanKnifeBackFormCmps, WmsInPlanDetailEntityTableCmps},
@ -340,19 +354,16 @@ export default {
form: {},
//
rules: {
planCode: [{required: true}],
planCode: [{required: true}, {validator: planCodeValidator, trigger: "change"}],
planTypeId: [{required: true}],
relBillCode: [{required: true}],
}
};
},
computed: {
/** 控制弹窗类型 */
isKnifeBack() {
if (this.form.planTypeId == 9 || this.form.planTypeId == 7 || this.form.planTypeId == 15) {
return true
} else {
return false
}
return this.form.planTypeId == 9 || this.form.planTypeId == 7 || this.form.planTypeId == 15;
}
},
created() {