|
@@ -335,12 +335,27 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
data () {
|
|
|
+ let validateExsit = (rule, value, callback) => {
|
|
|
+ //后台方法
|
|
|
+ if(this.type=="edit" && value === this.oldName){
|
|
|
+ return callback()
|
|
|
+ }
|
|
|
+ this.checkExist(value).then(res => {
|
|
|
+ res = res.data
|
|
|
+ if (res && res.data) {
|
|
|
+ callback(new Error('名称已存在'))
|
|
|
+ }else{
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
return {
|
|
|
type: 'add',
|
|
|
tenant: this.initTenant(),
|
|
|
screenWidth: 0,
|
|
|
width: this.initWidth(),
|
|
|
confirmDisabled: false,
|
|
|
+ oldName: '',
|
|
|
dialog: {
|
|
|
isVisible: false,
|
|
|
title: ""
|
|
@@ -364,7 +379,8 @@ export default {
|
|
|
},
|
|
|
rules: {
|
|
|
orderName: [
|
|
|
- { required: true, message: this.$t("rules.require"), trigger: 'blur' }
|
|
|
+ { required: true, message: this.$t("rules.require"), trigger: 'blur' },
|
|
|
+ { validator: validateExsit, trigger: 'blur'}
|
|
|
],
|
|
|
zoneId: [
|
|
|
{ required: true, message: this.$t("rules.require"), trigger: 'blur' }
|
|
@@ -495,6 +511,9 @@ export default {
|
|
|
zoneId: '',
|
|
|
}
|
|
|
},
|
|
|
+ checkExist(name){
|
|
|
+ return orderMgrApi.checkField({"orderName":name})
|
|
|
+ },
|
|
|
|
|
|
initWidth () {
|
|
|
this.screenWidth = document.body.clientWidth
|
|
@@ -511,6 +530,7 @@ export default {
|
|
|
if(val){
|
|
|
this.tenant = { ...val }
|
|
|
// 修改的时候,订单详情数据(BOM产品)
|
|
|
+ this.oldName = val.orderName
|
|
|
this.getBomList()
|
|
|
}
|
|
|
// 字典表
|