Przeglądaj źródła

1.商品管理优化
2.所有分类添加优化

hcf 1 rok temu
rodzic
commit
fdd73a96a6

+ 24 - 7
src/views/audit/agencyGoods/index.vue

@@ -41,6 +41,7 @@
 	import Assembly from "@/components/Assembly/material.vue";
 	@Component
 	export default class AgencyGoods extends Vue {
+		parentId : any = 0
 		parentIds : any = ''
 		timeNum = 0;
 		timer : any = null
@@ -272,7 +273,8 @@
 		onChangeTree(e : any) {
 			let data : any = {};
 			e.isContain ? data.ids = e.id : data.parentId = e.id;
-			this.parentIds = e.id;
+			this.parentIds = (this as any).$lodash.cloneDeep(e.id);
+			this.parentId = e.id[0];
 			data.pageSize = 20;
 			data.pageNo = 1;
 			let loading = this.$loading({ target: '.main-container' });
@@ -295,6 +297,9 @@
 				let query = (this as any).$refs.addFormId.getValue();
 				query.status = this.radio;
 				if (this.popTitle === '新增') {
+					if(!query.parentId){
+						query.parentId=0
+					}
 					api.saveList(query, 'maindataMaterialOrganizationCategory').then((res : any) => {
 						if (res.code === 200) {
 							this.$message.success(this.popTitle + '成功!');
@@ -361,15 +366,27 @@
 		// 打开新增
 		onAdd() {
 			this.popTitle = '新增'
-			this.radio = 0
 			this.dialogFormVisible = true;
+			this.radio = 0
 			this.getTreeList();
 			setTimeout(() => {
-				(this as any).$refs.addFormId.setValue();
-				(this as any).$refs.addFormId.$refs['parentName--comp'][0].request();
-				this.$nextTick(()=>{
-					(this as any).$refs.addFormId.clearValidate();
-				})
+				if(this.parentId!=0){
+					var data = {
+						parentName: '',
+						parentId: 0
+					}
+					api.single({ id: this.parentId }, 'maindataMaterialOrganizationCategory').then((res : any) => {
+						if (res.code === 200) {
+							data.parentName = res.data.name;
+							data.parentId = res.data.id;
+							this.dialogFormVisible = true;
+							setTimeout(() => { (this as any).$refs.addFormId.setValue(data) }, 0);
+						}
+					}).catch(() => {});
+				}else{
+					(this as any).$refs.addFormId.setValue();
+					(this as any).$refs.addFormId.$refs['parentName--comp'][0].request();
+				}
 			}, 0)
 		}
 		// 打开编辑

+ 24 - 4
src/views/audit/organClassify/index.vue

@@ -37,6 +37,7 @@
 		popTitle : any = ''
 		radio : any = 0
 		dialogFormVisible : boolean = false
+		parentId : any = 0
 		parentIds : any = '';
 		treeConfig = {
 			attr: {
@@ -236,7 +237,8 @@
 		onChangeTree(e : any) {
 			let data : any = {};
 			e.isContain ? data.ids = e.id : data.parentId = e.id;
-			this.parentIds = e.id;
+			this.parentIds = (this as any).$lodash.cloneDeep(e.id);
+			this.parentId = e.id[0];
 			let loading = this.$loading({ target: '.main-container' });
 			api.childrenTreeList(data, 'maindataOrganizationCategory').then((res : any) => {
 				if (res.code === 200) {
@@ -259,6 +261,9 @@
 				query.status = this.radio;
 				this.dialogFormVisible = false;
 				if (this.popTitle === '新增') {
+					if(!query.parentId){
+						query.parentId=0
+					}
 					api.saveList(query, 'maindataOrganizationCategory').then((res : any) => {
 						if (res.code === 200) {
 							this.$message.success(this.popTitle + '成功!');
@@ -324,11 +329,26 @@
 		onAdd() {
 			this.popTitle = '新增'
 			this.dialogFormVisible = true;
-			this.radio = 0;
+			this.radio = 0
 			this.getTreeList();
 			setTimeout(() => {
-				(this as any).$refs.addFormId.setValue();
-				(this as any).$refs.addFormId.$refs['parentName--comp'][0].request();
+				if(this.parentId!=0){
+					var data = {
+						parentName: '',
+						parentId: 0
+					}
+					api.single({ id: this.parentId }, 'maindataOrganizationCategory').then((res : any) => {
+						if (res.code === 200) {
+							data.parentName = res.data.name;
+							data.parentId = res.data.id;
+							this.dialogFormVisible = true;
+							setTimeout(() => { (this as any).$refs.addFormId.setValue(data) }, 0);
+						}
+					}).catch(() => {});
+				}else{
+					(this as any).$refs.addFormId.setValue();
+					(this as any).$refs.addFormId.$refs['parentName--comp'][0].request();
+				}
 			}, 0)
 		}
 		// 打开编辑

+ 23 - 2
src/views/audit/productClassification/index.vue

@@ -33,6 +33,7 @@
 	@Component
 	export default class ProductClassification extends Vue {
 		// 左边
+		parentId : any = 0
 		parentIds : any = ''
 		// 右边
 		timeNum = 0;
@@ -263,9 +264,11 @@
 		}
 		//点击树获取数据
 		onChangeTree(e : any) {
+			// console.log(e)
 			let data : any = {};
 			e.isContain ? data.ids = e.id : data.parentId = e.id;
 			this.parentIds = (this as any).$lodash.cloneDeep(e.id);
+			this.parentId = e.id[0];
 			this.parentIds.shift();
 			data.pageSize = 20;
 			data.pageNo = 1;
@@ -291,6 +294,9 @@
 				query.status = this.radio;
 				this.dialogFormVisible = false;
 				if (this.popTitle === '新增') {
+					if(!query.parentId){
+						query.parentId=0
+					}
 					api.saveList(query, 'maindataMaterialCategory').then((res : any) => {
 						if (res.code === 200) {
 							this.$message.success(this.popTitle + '成功!');
@@ -359,8 +365,23 @@
 			this.radio = 0
 			this.getTreeList();
 			setTimeout(() => {
-				(this as any).$refs.addFormId.setValue();
-				(this as any).$refs.addFormId.$refs['parentName--comp'][0].request();
+				if(this.parentId!=0){
+					var data = {
+						parentName: '',
+						parentId: 0
+					}
+					api.single({ id: this.parentId }, 'maindataMaterialCategory').then((res : any) => {
+						if (res.code === 200) {
+							data.parentName = res.data.name;
+							data.parentId = res.data.id;
+							this.dialogFormVisible = true;
+							setTimeout(() => { (this as any).$refs.addFormId.setValue(data) }, 0);
+						}
+					}).catch(() => {});
+				}else{
+					(this as any).$refs.addFormId.setValue();
+					(this as any).$refs.addFormId.$refs['parentName--comp'][0].request();
+				}
 			}, 0)
 		}
 		// 打开编辑

+ 5 - 2
src/views/audit/productManagement/index.vue

@@ -719,6 +719,9 @@
 					name: [{
 						required: true, message: '请输入名称', trigger: 'blur'
 					}],
+					// materialCode: [{
+					// 	required: true, message: '请输入物料编码', trigger: 'blur'
+					// }],
 					basePrice: [{
 						required: true, message: '请输入基本售价', trigger: 'blur'
 					}],
@@ -1262,8 +1265,8 @@
 						// if (parseInt(v.width) <= 0) return this.$message.warning('物料宽不能小于1');
 						// if (!v.height) return this.$message.warning('物料高必填');
 						// if (parseInt(v.height) <= 0) return this.$message.warning('物料高不能小于1');
-						if (!v.skuTitle) return this.$message.warning('物料标题必填');
-						if (!v.skuCode) return this.$message.warning('物料编码必填');
+						if (!v.skuTitle) return this.$message.warning('物料属性的标题必填');
+						if (!v.skuCode) return this.$message.warning('物料属性的物料编码必填');
 						
 						if(v.weight&&v.weight!=0){
 							v.weight = v.weight/1000

+ 23 - 3
src/views/audit/virtually/index.vue

@@ -33,6 +33,7 @@
 	@Component
 	export default class Virtually extends Vue {
 		// 左边
+		parentId : any = 0
 		parentIds : any = ''
 		// 右边
 		timeNum = 0;
@@ -264,7 +265,8 @@
 		onChangeTree(e : any) {
 			let data : any = {};
 			e.isContain ? data.ids = e.id : data.parentId = e.id;
-			this.parentIds = e.id;
+			this.parentIds = (this as any).$lodash.cloneDeep(e.id);
+			this.parentId = e.id[0];
 			data.pageSize = 20;
 			data.pageNo = 1;
 			let loading = this.$loading({ target: '.main-container' });
@@ -289,6 +291,9 @@
 				query.status = this.radio;
 				this.dialogFormVisible = false;
 				if (this.popTitle === '新增') {
+					if(!query.parentId){
+						query.parentId=0
+					}
 					api.saveList(query, 'maindataMaterialVmcategory').then((res : any) => {
 						if (res.code === 200) {
 							this.$message.success(this.popTitle + '成功!');
@@ -357,8 +362,23 @@
 			this.radio = 0
 			this.getTreeList();
 			setTimeout(() => {
-				(this as any).$refs.addFormId.setValue();
-				(this as any).$refs.addFormId.$refs['parentName--comp'][0].request();
+				if(this.parentId!=0){
+					var data = {
+						parentName: '',
+						parentId: 0
+					}
+					api.single({ id: this.parentId }, 'maindataMaterialVmcategory').then((res : any) => {
+						if (res.code === 200) {
+							data.parentName = res.data.name;
+							data.parentId = res.data.id;
+							this.dialogFormVisible = true;
+							setTimeout(() => { (this as any).$refs.addFormId.setValue(data) }, 0);
+						}
+					}).catch(() => {});
+				}else{
+					(this as any).$refs.addFormId.setValue();
+					(this as any).$refs.addFormId.$refs['parentName--comp'][0].request();
+				}
 			}, 0)
 		}
 		// 打开编辑