Browse Source

1.商品管理优化
2.物料SKU管理优化

hcf 1 year ago
parent
commit
b2804e81b6
2 changed files with 58 additions and 24 deletions
  1. 25 16
      src/views/audit/productManagement/index.vue
  2. 33 8
      src/views/audit/sku/index.vue

+ 25 - 16
src/views/audit/productManagement/index.vue

@@ -113,7 +113,7 @@
 		<!-- 选择物料 -->
 		<productModal ref="product" :mulit="true" @confirm="confirmProduct" />
 		
-		<vxe-modal v-model="vxeValue" width="48%" height="88%" show-zoom resize transfer show-footer>
+		<vxe-modal v-model="vxeValue" width="48%" height="88%" show-zoom resize transfer show-footer :loading="tableloading">
 			<template #title>
 				<span>关联金蝶财务系统物料</span>
 			</template>
@@ -139,7 +139,6 @@
 				<el-table
 				    ref="multipleTable" 
 				    :data="newtableData"
-					v-loading="tableloading"
 					stripe
 					border
 				    style="width: 100%"
@@ -1085,7 +1084,7 @@
 			},
 		}
 		
-		tableloading = false
+		tableloading = true
 		tableRadio: any = {}
 		tableData: any = []
 		newtableData: any = []
@@ -1110,7 +1109,7 @@
 			this.tableSearchForm.stime = '2020-01-01';
 			this.tableSearchForm.etime = y+'-'+m+'-'+d;
 			this.etime = y+'-'+m+'-'+d;
-			this.getFinancialCode()
+			// this.getFinancialCode()
 			this.getTreeList();
 		}
 		getTreeList(){
@@ -1221,9 +1220,9 @@
 						// 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.weight&&v.weight!=0){
-							v.weight = v.weight/1000
-						}
+						// if(v.weight&&v.weight!=0){
+						// 	v.weight = v.weight/1000
+						// }
 					};
 					data = { maindataMaterialReceiveParam: query, maindataMaterialSkus: this.tableList }
 					let newArray : any = []
@@ -1268,9 +1267,9 @@
 						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
-						}
+						// if(v.weight&&v.weight!=0){
+						// 	v.weight = v.weight/1000
+						// }
 					};
 					data.maindataMaterialSkus[0].isDeleted = 0;
 					data.maindataMaterialReceiveParam.attributeList = ""
@@ -1397,10 +1396,13 @@
 									this.towTable = '' // 表格数据
 									this.attributeList = []; // 属性规格
 									this.$nextTick(() => {
-										console.log(info.data);
+										// console.log(info.data);
 										info.data.map((v : any, i : any) => {
-											if(v.weight!='0.00'&&v.weight!=0&&v.weight!='0'){
-												v.weight = parseFloat(v.weight)*1000
+											// if(v.volume&&v.weight!='0.00'&&v.weight!=0&&v.weight!='0'){
+											// 	v.weight = parseFloat(v.weight)*1000
+											// }
+											if(v.volume&&v.volume!='0.00'&&v.volume!=0&&v.volume!='0'){
+												v.volume = parseFloat(v.volume).toFixed(2)
 											}
 										});
 										(this as any).$refs.singeTable.setValue(info.data);
@@ -1413,8 +1415,11 @@
 									info.data.map((v : any, i : any) => {
 										v = Object.assign(v, skuRuleList[i])
 										v.dataIndex = i
-										if(v.weight!='0.00'&&v.weight!=0&&v.weight!='0'){
-											v.weight = parseFloat(v.weight)*1000
+										// if(v.volume&&v.weight!='0.00'&&v.weight!=0&&v.weight!='0'){
+										// 	v.weight = parseFloat(v.weight)*1000
+										// }
+										if(v.volume&&v.volume!='0.00'&&v.volume!=0&&v.volume!='0'){
+											v.volume = parseFloat(v.volume).toFixed(2)
 										}
 									});
 									newColumns.map((v : any) => {
@@ -1658,6 +1663,11 @@
 		// 打开关联金蝶财务系统物料选择
 		openVxeData(){
 			this.vxeValue = true;
+			if(this.tableData.length==0){
+				setTimeout(()=>{
+					this.getFinancialCode();
+				},0)
+			}
 		}
 		// 获取关联金蝶财务系统物料列表
 		getFinancialCode(){
@@ -1721,7 +1731,6 @@
 				val[0].unit = this.tableRadio.fbaseUnitName;
 				val[0].unitCode = this.tableRadio.fbaseUnitCode;
 			}
-			console.log(222,val);
 			(this as any).$refs.singeTable.setValue(val);
 			(this as any).$refs.form.setValue(val2);
 			this.vxeValue = false;

+ 33 - 8
src/views/audit/sku/index.vue

@@ -9,7 +9,7 @@
 		<div class="detail" v-show="isShow==='detail'" key="index2">
 			<by-tool :propConfig="toolConfig" @clickHandle="insideTools" />
 			<div class="box-shadow">
-				<by-table :propConfig="skuConfig" ref="addFormId"></by-table>
+				<by-table :propConfig="skuConfig" @onChangeRow="getInputValue" ref="addFormId"></by-table>
 			</div>
 		</div>
 	</div>
@@ -49,7 +49,7 @@
 			columns: [
 				{
 					width: '200px',
-					title: '标题',
+					title: '标题(必填项)',
 					field: 'skuTitle',
 					component: 'by-input',
 					compConfig: {
@@ -75,7 +75,7 @@
 				},
 				{
 					width: '140px',
-					title: '物料编码',
+					title: '物料编码(必填项)',
 					field: 'skuCode',
 					component: 'by-input',
 					compConfig: {
@@ -108,7 +108,8 @@
 							size: 'mini',
 							placeholder: ' ',
 							type: "number",
-							defaultValue: 0
+							defaultValue: 0,
+							min: 0
 						},
 					}
 				},
@@ -146,12 +147,13 @@
 							size: 'mini',
 							placeholder: ' ',
 							type: "integer",
+							min: 0
 						},
 					}
 				},
 				{
 					width: '90px',
-					title: '重量/kg',
+					title: '重量/g',
 					field: 'weight',
 					component: 'by-input',
 					compConfig: {
@@ -159,6 +161,7 @@
 							size: 'mini',
 							placeholder: ' ',
 							type: "number",
+							min: 0
 						},
 					}
 				},
@@ -172,6 +175,7 @@
 							size: 'mini',
 							placeholder: ' ',
 							type: "number",
+							min: 0
 						},
 					}
 				},
@@ -185,6 +189,7 @@
 							size: 'mini',
 							placeholder: ' ',
 							type: "number",
+							min: 0
 						},
 					}
 				},
@@ -198,6 +203,7 @@
 							size: 'mini',
 							placeholder: ' ',
 							type: "number",
+							min: 0
 						},
 					}
 				},
@@ -311,7 +317,7 @@
 					},
 					{
 						width: '80px',
-						title: '重量/kg',
+						title: '重量/g',
 						field: 'weight',
 					},
 					{
@@ -417,8 +423,9 @@
 		}
 		// 保存
 		doFormData() {
-			let data : any = (this as any).$refs.addFormId.getValue()
-			if (!data[0].financialCode) return this.$message.warning('财务编号不能为空');
+			let data : any = (this as any).$refs.addFormId.getValue();
+			if (!data[0].skuTitle) return this.$message.warning('物料标题不能为空');
+			if (!data[0].skuCode) return this.$message.warning('物料编号不能为空');
 			api.updateList(data[0], 'maindataMaterialSku').then((res : any) => {
 				if (res.code === 200) {
 					this.$message.success('编辑成功');
@@ -446,6 +453,14 @@
 			api.pageList(query, 'maindataMaterialSku').then((res : any) => {
 				loading.close();
 				if (res.code === 200) {
+					res.data.records.map((v : any, i : any) => {
+						if(v.volume&&v.weight!='0.00'&&v.weight!=0&&v.weight!='0'){
+							v.weight = parseFloat(v.weight).toFixed(2)
+						}
+						if(v.volume&&v.volume!='0.00'&&v.volume!=0&&v.volume!='0'){
+							v.volume = parseFloat(v.volume).toFixed(2)
+						}
+					});
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
 					let page = {
 						pageNo: res.data.current, //当前页
@@ -464,10 +479,20 @@
 					this.baseInfo = res.data;
 					this.isShow = 'detail';
 					loading.close();
+					if(res.data.volume&&res.data.volume!='0.00'&&res.data.volume!=0&&res.data.volume!='0'){
+						res.data.volume = parseFloat(res.data.volume).toFixed(2)
+					}
 					setTimeout(() => { (this as any).$refs.addFormId.setValue([res.data]) }, 0);
 				} else loading.close();
 			}).catch(() => loading.close());
 		}
+		// 监听表格数据
+		getInputValue(e : any) {
+			// console.log('监听表格 ==> ', e);
+			if (e.length && e.width && e.height) {
+				e.volume = (e.length * e.width * e.height).toFixed(2);
+			}
+		}
 		// 内页工具栏方法
 		insideTools(e : any) {
 			if (e === 'onReturn') this.isShow = 'home';