ソースを参照

仓库表问题修复

hcf 1 年間 前
コミット
f39f89d3c6

+ 25 - 13
src/views/audit/depots/components/ruleForm.vue

@@ -147,7 +147,6 @@
 					(this as any).thirdPartnerList = res.data
 				}
 			});
-			(this as any).clearValue();
 		}
 		//表单验证
 		validate(parames?:any):Promise<any>{
@@ -171,11 +170,13 @@
 				});
 			})
 		}
-		setValue(e: any){
-			// console.log(e);
-			if(e.name){
-				(this as any).ruleForm = e;
-				(this as any).$set((this as any).ruleForm, 'thirdSysName', 'GEEKPLUS');
+		setValue(data: any){
+			console.log(data);
+			// if(e.name){
+			(this as any).$nextTick(()=>{
+				var val = (this as any).$lodash.cloneDeep(data);
+				(this as any).ruleForm = val;
+				(this as any).ruleForm.thirdSysName = 'GEEKPLUS';
 				if((this as any).ruleForm.isThird==null){
 					(this as any).ruleForm.isThird = 0
 				};
@@ -188,9 +189,10 @@
 				(this as any).$set((this as any).parentValue, 'street', (this as any).ruleForm.street);
 				(this as any).$set((this as any).parentValue, 'streetCode', (this as any).ruleForm.streetCode);
 				(this as any).$refs.byArea.setValue((this as any).parentValue);
-			}else{
-				(this as any).clearValue();
-			}
+				// }else{
+				// 	(this as any).clearValue();
+				// }
+			})
 		}
 		//获取数据
 		getValue(){
@@ -204,7 +206,15 @@
 			data.regionCode = (this as any).parentValue.regionCode;
 			data.street = (this as any).parentValue.street;
 			data.streetCode = (this as any).parentValue.streetCode;
-			return data;
+			
+			if(data.isThird == 0 || data.isThird == null){
+				data.thirdSysName = null;
+				data.thirdPartnerId = null;
+				data.thirdPartnerName = null;
+				data.thirdStorehouseName = null;
+			}
+			
+			return (this as any).$lodash.cloneDeep(data);
 		}
 		toCargoOwner(){
 			this.$emit('toCargoOwner')
@@ -232,7 +242,7 @@
 			}
 		}
 		clearValue(){
-			(this as any).ruleForm = {
+			var ruleForm = {
 				name: null, //名称
 				financeType: '金蝶', //金蝶财务系统名称
 				financeStorehouseName: null, //金蝶仓库名称
@@ -252,6 +262,7 @@
 				street: null, //仓库所在街道
 				streetCode: null, //街道编码
 			};
+			(this as any).ruleForm = ruleForm;
 			(this as any).parentValue = {
 				province: null,
 				provinceCode: null,
@@ -263,9 +274,10 @@
 				streetCode: null,
 			};
 			(this as any).byAreaSlot = false;
-			(this as any).$nextTick(()=>{
+			this.$nextTick(()=>{
 				(this as any).$refs.byArea.clearValue();
-			})
+				(this.$refs.ruleForm as any).clearValidate();
+			});
 		}
 	}
 </script>

+ 11 - 4
src/views/audit/depots/index.vue

@@ -9,7 +9,7 @@
 				<!-- <by-form :propConfig="addConfig" ref="addFormId"></by-form> -->
 				<ruleForm ref='addFormId' @toCargoOwner="toCargoOwner"></ruleForm>
 				<div slot="footer" class="dialog-footer">
-					<el-button @click="dialogFormVisible = false">取 消</el-button>
+					<el-button @click="close">取 消</el-button>
 					<el-button type="primary" @click="confirm">确 定</el-button>
 				</div>
 			</el-dialog>
@@ -493,7 +493,12 @@
 				this.getDataList()
 			}, 500)
 		}
-		
+		close(){
+			(this as any).$refs.addFormId.clearValue();
+			setTimeout(()=>{
+				this.dialogFormVisible = false;
+			},0)
+		}
 		// 跳转货主管理
 		toCargoOwner(){
 			this.dialogFormVisible = false;
@@ -505,12 +510,12 @@
 				(this.$refs.addFormId as any).validate().then(()=>{
 					let query = (this as any).$refs.addFormId.getValue();
 					// console.log(query);
-					this.dialogFormVisible = false;
 					if (this.popTitle === '注册') {
 						let loading = this.$loading({ target: '.main-container' });
 						api.saveList(query, 'maindataStorehouse').then((res : any) => {
 							loading.close();
 							if (res.code === 200) {
+								this.dialogFormVisible = false;
 								this.$message.success(this.popTitle + '成功');
 								this.getDataList();
 								this.$confirm('是否注册仓位', '提示', {
@@ -545,6 +550,7 @@
 						api.updateList(query, 'maindataStorehouse').then((res : any) => {
 							loading.close();
 							if (res.code === 200) {
+								this.dialogFormVisible = false;
 								this.$message.success(this.popTitle + '成功');
 								this.getDataList();
 							} else this.$message.error(res.msg)
@@ -559,12 +565,12 @@
 				let query = (this as any).$refs.addFormId2.getValue();
 				query.storehouseId = this.tableData.id;
 				query.idDelete = 0;
-				this.dialogFormVisible2 = false;
 				if (this.popTitle === '注册') {
 					let loading = this.$loading({ target: '.main-container' });
 					api.saveList(query, 'maindataStoringLocation').then((res : any) => {
 						loading.close();
 						if (res.code === 200) {
+							this.dialogFormVisible2 = false;
 							this.$message.success(this.popTitle + '成功');
 							this.getOneself(query.storehouseId);
 						} else this.$message.error(res.msg)
@@ -574,6 +580,7 @@
 					api.updateList(query, 'maindataStoringLocation').then((res : any) => {
 						loading.close();
 						if (res.code === 200) {
+							this.dialogFormVisible2 = false;
 							this.$message.success(this.popTitle + '成功');
 							this.getOneself(query.storehouseId);
 						} else this.$message.error(res.msg)