소스 검색

解决数据修改名称重复验证Bug

oyq28 3 년 전
부모
커밋
85078d3af9

+ 5 - 0
imcs-ui/src/views/zuihou/lineSideLibrary/goodsShelvesMgr/components/Edit.vue

@@ -73,6 +73,9 @@ export default {
   data () {
     let validateExsit = (rule, value, callback) => {
       //后台方法
+      if(this.type=="edit" && value === this.oldName){
+        return true
+      }
       this.checkExist(value).then(res => {
         res = res.data               
         if (res && res.data) {         
@@ -95,6 +98,7 @@ export default {
       // 选项列表(必选)
       list: [],
       type: 'add',
+      oldName: '',
       tenant: this.initTenant(),
       screenWidth: 0,
       width: this.initWidth(),
@@ -166,6 +170,7 @@ export default {
     setTenant (val, dicts) {
     	if(val){
     		this.tenant = { ...val }
+        this.oldName = val.name
     		console.log("row数据:", val)
     	}else{
     		// 新增没有数据

+ 7 - 2
imcs-ui/src/views/zuihou/lineSideLibrary/locationMgr/components/Edit.vue

@@ -58,7 +58,10 @@ export default {
   },
   data () {
     let validateExsit = (rule, value, callback) => {
-      //后台方法
+      //后台方法       
+      if(this.type=="edit" && value === this.oldName){
+        return true
+      }      
       this.checkExist(value).then(res => {
         res = res.data;       
         // console.log("check验证:", res);
@@ -72,6 +75,7 @@ export default {
     return {
       type: 'add',
       currNodeName: '',
+      oldName: '',      
       tenant: this.initTenant(),
       screenWidth: 0,
       width: this.initWidth(),
@@ -105,7 +109,7 @@ export default {
   created() {
   	// 获取【库位类型】数据
   	this.getWareTypeList()
-	},
+	}, 
   computed: {
     isVisible: {
       get () {
@@ -149,6 +153,7 @@ export default {
     	console.log("货架数据:", currNode)
     	if(val){
     		this.tenant = { ...val }
+        this.oldName = val.name
     	}else{  // 如果是新增
     		// 给【上级层】显示使用
 	    	this.currNodeName = currNode.name

+ 5 - 0
imcs-ui/src/views/zuihou/resourceProductMgr/resourcesMgr/components/TenantEdit.vue

@@ -53,6 +53,9 @@ export default {
   data () {
     let validateExsit = (rule, value, callback) => {
       //后台方法
+      if(this.type=="edit" && value === this.oldName){
+        return true
+      } 
       this.checkExist(value).then(res => {
         res = res.data               
         if (res && res.data) { 
@@ -66,6 +69,7 @@ export default {
       type: 'add',
       rowData:{},
       tenant: this.initTenant(),
+      oldName: '',
       screenWidth: 0,
       width: this.initWidth(),
       confirmDisabled: false,
@@ -122,6 +126,7 @@ export default {
     setTenant (val, rowData) {
     	if(val){
     		this.tenant = { ...val }
+        this.oldName = val.name
     	}
       this.rowData = rowData
     },