ソースを参照

1.机构商品分类优化
2.商品管理物流属性重量单位值转换

hcf 1 年間 前
コミット
69144756fc

+ 127 - 13
src/views/audit/agencyGoods/index.vue

@@ -12,6 +12,25 @@
 			</module-view>
 		</div>
 		<!-- 新增/编辑弹窗 -->
+		<el-dialog :title="popTitle+'机构商品分类'" :visible.sync="dialogFormVisible2" width="30%">
+			<by-form :propConfig="addConfig2" ref="addFormId2">
+				<template v-slot:logo>
+					<el-upload :limit='1' :action="baseURL+'/file/upload'" list-type="picture-card"
+						:on-preview="handlePictureCardPreview" :on-remove="handleRemove">
+						<i class="el-icon-plus"></i>
+					</el-upload>
+				</template>
+				<template v-slot:status class="clearfix">
+					<el-radio class="fl" style="margin-top: 8px;" v-model="radio" :label="0">正常</el-radio>
+					<el-radio class="fl" style="margin-top: 8px;" v-model="radio" :label="1">禁用</el-radio>
+				</template>
+			</by-form>
+			<div slot="footer" class="dialog-footer">
+				<el-button @click="dialogFormVisible2 = false">取 消</el-button>
+				<el-button type="primary" @click="confirm2">确 定</el-button>
+			</div>
+		</el-dialog>
+		<!-- 新增/编辑弹窗 -->
 		<el-dialog :title="popTitle+'机构商品分类'" :visible.sync="dialogFormVisible" width="30%">
 			<by-form :propConfig="addConfig" ref="addFormId">
 				<template v-slot:logo>
@@ -44,6 +63,8 @@
 		popTitle : any = ''
 		radio : any = 0
 		dialogFormVisible : boolean = false
+		dialogFormVisible2 : boolean = false
+		datlis : boolean = true
 		treeConfig = {
 			attr: {
 				retConfig: {
@@ -192,6 +213,7 @@
 						labelWidth: '70px',
 						prop: 'parentName',
 						component: 'select-tree',
+						slot: true,
 						compConfig: {
 							attr: {
 								label: 'name',
@@ -247,6 +269,57 @@
 				],
 			]
 		}
+		addConfig2 = {
+			attr: {
+				size: 'small',
+				rules: {
+					name: [{
+						required: true, message: '请输入名称', trigger: 'blur'
+					}],
+				}
+			},
+			columns: [
+				[
+					{
+						labelWidth: '70px',
+						span: 23,
+						label: '名称',
+						prop: 'name',
+						component: 'by-input',
+					},
+					{
+						labelWidth: '70px',
+						span: 23,
+						label: '简称',
+						slot: true,
+						prop: 'shortName',
+						component: 'by-input',
+					},
+					{
+						labelWidth: '70px',
+						span: 23,
+						label: '状态',
+						slot: true,
+						prop: 'status',
+					},
+					{
+						labelWidth: '70px',
+						span: 23,
+						label: '备注',
+						slot: true,
+						prop: 'remark',
+						component: 'by-input',
+						compConfig: {
+							attr: {
+								size: 'mini',
+								placeholder: '请输入备注',
+								type: 'textarea'
+							},
+						}
+					},
+				],
+			]
+		}
 		mounted() {
 			this.timer = setInterval(() => {
 				this.getDataList()
@@ -278,12 +351,38 @@
 			(this as any).$refs.addFormId.validate().then(() => {
 				let query = (this as any).$refs.addFormId.getValue();
 				query.status = this.radio;
-				this.dialogFormVisible = false;
 				if (this.popTitle === '新增') {
 					api.saveList(query, 'maindataMaterialOrganizationCategory').then((res : any) => {
 						if (res.code === 200) {
 							this.$message.success(this.popTitle + '成功!');
 							(this as any).$refs.sideTree.request();
+							this.dialogFormVisible = false;
+							this.getDataList();
+						} else this.$message.error(res.msg);
+					}).catch(() => {});
+				} else if (this.popTitle === '编辑') {
+					api.updateList(query, 'maindataMaterialOrganizationCategory').then((res : any) => {
+						if (res.code === 200) {
+							this.$message.success(this.popTitle + '成功!');
+							(this as any).$refs.sideTree.request();
+							this.dialogFormVisible = false;
+							this.getDataList();
+						} else this.$message.error(res.msg);
+					}).catch(() => {});
+				}
+			}).catch(() => {});
+		}
+		confirm2() {
+			(this as any).$refs.addFormId2.validate().then(() => {
+				let query = (this as any).$refs.addFormId2.getValue();
+				query.status = this.radio;
+				if (this.popTitle === '新增') {
+					query.parentId = 0;
+					api.saveList(query, 'maindataMaterialOrganizationCategory').then((res : any) => {
+						if (res.code === 200) {
+							this.$message.success(this.popTitle + '成功!');
+							(this as any).$refs.sideTree.request();
+							this.dialogFormVisible2 = false;
 							this.getDataList();
 						} else this.$message.error(res.msg);
 					}).catch(() => {});
@@ -292,6 +391,7 @@
 						if (res.code === 200) {
 							this.$message.success(this.popTitle + '成功!');
 							(this as any).$refs.sideTree.request();
+							this.dialogFormVisible2 = false;
 							this.getDataList();
 						} else this.$message.error(res.msg);
 					}).catch(() => {});
@@ -318,6 +418,9 @@
 			api.pageList(query, 'maindataMaterialOrganizationCategory').then((res : any) => {
 				loading.close();
 				if (res.code === 200) {
+					if(res.data.records.length==0){
+						this.datlis = false
+					}
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
 					let page = {
 						pageNo: res.data.current, //当前页
@@ -335,12 +438,16 @@
 		// 打开新增
 		onAdd() {
 			this.popTitle = '新增'
-			this.dialogFormVisible = true;
 			this.radio = 0
-			setTimeout(() => {
-				(this as any).$refs.addFormId.setValue();
-				(this as any).$refs.addFormId.$refs['parentName--comp'][0].request();
-			}, 0)
+			if(!this.datlis){
+				this.dialogFormVisible2 = true;
+			}else{
+				this.dialogFormVisible = true;
+				setTimeout(() => {
+					(this as any).$refs.addFormId.setValue();
+					(this as any).$refs.addFormId.$refs['parentName--comp'][0].request();
+				}, 0)
+			}
 		}
 		// 打开编辑
 		openEdit(e : any) {
@@ -351,14 +458,21 @@
 				if (res.code === 200) {
 					let data = res.data;
 					this.radio = data.status;
-					api.single({ id: data.parentId }, 'maindataMaterialOrganizationCategory').then((v : any) => {
+					if(data.parentId!=0){
+						api.single({ id: data.parentId }, 'maindataMaterialOrganizationCategory').then((v : any) => {
+							loading.close();
+							if (v.code === 200) {
+								console.log(data.parentId)
+								data.parentName = v.data.name;
+								this.dialogFormVisible = true;
+								setTimeout(() => { (this as any).$refs.addFormId.setValue(data) }, 0);
+							}
+						}).catch(() => loading.close());
+					}else{
 						loading.close();
-						if (v.code === 200) {
-							data.parentName = v.data.name;
-							this.dialogFormVisible = true;
-							setTimeout(() => { (this as any).$refs.addFormId.setValue(data) }, 0);
-						}
-					}).catch(() => loading.close());
+						this.dialogFormVisible2 = true;
+						setTimeout(() => { (this as any).$refs.addFormId2.setValue(data) }, 0);
+					}
 				}
 			}).catch(() => loading.close());
 		}

+ 19 - 6
src/views/audit/productManagement/index.vue

@@ -542,12 +542,12 @@
 						},
 					}
 				},
-				{
-					width: '80px',
-					title: '库存',
-					field: 'stock',
-					slot: true,
-				},
+				// {
+				// 	width: '80px',
+				// 	title: '库存',
+				// 	field: 'stock',
+				// 	slot: true,
+				// },
 				{
 					width: '100px',
 					title: '保质期(天)',
@@ -1178,6 +1178,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');
+						
+						v.weight = v.weight/1000
 					};
 					data = { maindataMaterialReceiveParam: query, maindataMaterialSkus: this.tableList }
 					let newArray : any = []
@@ -1219,6 +1221,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');
+						
+						v.weight = v.weight/1000
 					};
 					data.maindataMaterialSkus[0].isDeleted = 0;
 					data.maindataMaterialReceiveParam.attributeList = ""
@@ -1343,6 +1347,12 @@
 									this.towTable = '' // 表格数据
 									this.attributeList = []; // 属性规格
 									this.$nextTick(() => {
+										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
+											}
+										});
 										(this as any).$refs.singeTable.setValue(info.data);
 									});
 								} else {
@@ -1353,6 +1363,9 @@
 									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
+										}
 									});
 									newColumns.map((v : any) => {
 										tableConfig.columns.unshift({