|
@@ -1068,12 +1068,38 @@
|
|
|
// 如果uscCode是空的或者uscCode的数据不存在,再执行保存方法
|
|
|
if (this.commonJS.isNotEmpty(this.inputForm.uscCode)) {
|
|
|
this.workClientService.queryUscCodeIsUse(this.inputForm.uscCode).then(({data}) => {
|
|
|
- if (data.use === 'false') {
|
|
|
- this.trueSave()
|
|
|
- }
|
|
|
+ this.workClientService.queryUscCodeById(this.inputForm.id).then((uscCode) => {
|
|
|
+ if (data.use === 'false' || uscCode.data === this.inputForm.uscCode) {
|
|
|
+ this.uscCodeMessage = ''
|
|
|
+ this.workClientService.queryNameIsUse(this.inputForm.name).then((client) => {
|
|
|
+ this.workClientService.queryNameById(this.inputForm.id).then((name) => {
|
|
|
+ if (client.data.use === 'false' || name.data === this.inputForm.name) {
|
|
|
+ this.trueSave()
|
|
|
+ this.nameMessage = ''
|
|
|
+ } else {
|
|
|
+ this.nameMessage = '该客户已存在'
|
|
|
+ throw new Error()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.uscCodeMessage = '该客户已存在'
|
|
|
+ throw new Error()
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
} else {
|
|
|
- this.trueSave()
|
|
|
+ this.workClientService.queryNameIsUse(this.inputForm.name).then((client) => {
|
|
|
+ this.workClientService.queryNameById(this.inputForm.id).then((name) => {
|
|
|
+ if (client.data.use === 'false' || name.data === this.inputForm.name) {
|
|
|
+ this.trueSave()
|
|
|
+ this.nameMessage = ''
|
|
|
+ } else {
|
|
|
+ this.nameMessage = '该客户已存在'
|
|
|
+ throw new Error()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
}
|
|
|
},
|
|
|
trueSave () {
|