AlanWong 2 жил өмнө
parent
commit
e1d41c11af

+ 21 - 18
src/benyun/components/byBill/byBill.vue

@@ -166,24 +166,27 @@ export default class ByBill extends VueViews {
   setBillConfig(c:any){
     if(c){
       this.config.bill = c;
-      if(c.form){
-        (this.$refs.billForm as any).setConfig(c.form)
-      }
-      if(this.$refs.billTool){
-        (this.$refs.billTool as any).initTools()
-      }
-      if(c?.tableConfig?.length > 0){
-        let n = 0;
-        for(const item of c.tableConfig){
-          if(this.$refs['tableTool_'+n]){
-            (this.$refs['tableTool_'+n] as any)[0].initTools();
-          }
-          if(item.table && this.$refs['billTable_'+n]){
-            (this.$refs['billTable_'+n] as any)[0].setConfig(item.table)
-          }
-          n++;
-        }
-      }
+			this.$nextTick(()=>{
+				if(c.form){
+				  (this.$refs.billForm as any).setConfig(c.form)
+				}
+				if(this.$refs.billTool){
+				  (this.$refs.billTool as any).initTools()
+				}
+				
+				if(c?.tableConfig?.length > 0){
+				  let n = 0;
+				  for(const item of c.tableConfig){
+				    if(this.$refs['tableTool_'+n]){
+				      (this.$refs['tableTool_'+n] as any)[0].initTools();
+				    }
+				    if(item.table && this.$refs['billTable_'+n]){
+				      (this.$refs['billTable_'+n] as any)[0].setConfig(item.table)
+				    }
+				    n++;
+				  }
+				}
+			})
     }
   }
 

+ 1 - 0
src/benyun/components/byTool/byTool.vue

@@ -78,6 +78,7 @@ export default class GmTools extends Vue {
   }
 
   setTool(data:any){
+		this.showTools = [];
     for(const item of this.tools){
       if(data[item._class]){
         let obj:any = (this as any).$lodash.cloneDeep(item);

+ 23 - 18
src/views/audit/orderTask/index.vue

@@ -15,6 +15,8 @@
 	import productModal from "./components/productModal.vue";
 	@Component({ components: { productModal } })
 	export default class OrderTask extends Vue {
+		// 左边
+		tabType : any = 'all';
 		// 右边
 		tableData : any = []
 		mergeObj : any = []
@@ -124,7 +126,7 @@
 								size: 'mini',
 								height: 500,
 								align: 'center',
-								readonly:true
+								readonly: true
 							},
 							columns:
 								[{
@@ -797,22 +799,24 @@
 		}
 		// 保存
 		onSave(e : any) {
-			// console.log('保存 ==>', e);
-			if (e === 'bill') {
+			console.log('保存 ==>', this.tabType);
+			if (this.tabType === 'all' || this.tabType === 'draftsBox') {
 				(this as any).$refs.bill.$refs.billForm.validate().then(() => {
 					let query = (this.$refs.bill as any).getBillFormValue(); // 获取单据数据
+					// 子表数据
 					query.suborderList = this.tableData;
 					if (query.suborderList.length > 0) {
 						query.suborderList.map((v : any) => {
 							v.taskOrderId = query.id
 						})
 					};
+					// 表格删除
 					query.suborderList.map((v : any, i : any) => {
 						if (v.isDeleted !== 1 && !v.id) {
-							console.log(v);
 							v.splice(i, 1)
 						}
 					});
+					if (this.tabType === 'draftsBox') query.submitState = 0;
 					console.log('保存 ==>', query);
 					api.updateList(query, 'supplyTaskOrder').then((res : any) => {
 						if (res.code === 200) {
@@ -823,7 +827,7 @@
 						} else this.$message.error(res.msg);
 					})
 				})
-			}
+			};
 		}
 		// 确定商品新增
 		confirmProduct(e : any) {
@@ -863,17 +867,18 @@
 		// 打开编辑
 		openEdit(e : any) {
 			console.log('编辑 ==>', e);
-			if (e.tpye === 'all') {
+			if (e.type === 'all' || e.type === 'draftsBox') {
 				e = e.row ? e.row : e;
 				let data = e.suborderList
 				data.map((v : any, i : any) => {
 					v.dataIndex = i
 				});
+				let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
+				billConfig.form.attr.readonly = false; // 设置只可读
+				billConfig.tool.tools = { save: true, };
+				billConfig.tableConfig[0].tool.tools = { add: true };
 				this.tableData = data;
-				// let readonly = (this as any).$lodash.cloneDeep(this.config.bill);
-				// console.log(this.config.bill);
-				// (this.$refs.bill as any).setBillConfig(readonly);
-				(this.$refs.bill as any).setBillFormValue(e); // 设置单据表单数据
+				(this.$refs.bill as any).setBillConfig(billConfig);
 				(this.$refs.bill as any).setBillTableValue(data, 0);// 设置第1张单据表格数据
 				(this.$refs.bill as any).showTab = 'bill';
 			} else this.setReadonly(e.row ? e.row : e);
@@ -882,17 +887,13 @@
 		setReadonly(e : any) {
 			let readonly = (this as any).$lodash.cloneDeep(this.config.bill);
 			readonly.form.attr.readonly = true; // 设置只可读
-			for (let key in readonly.tool) {
-				delete readonly.tool[key]
-			};
-			for (let key in readonly.tableConfig[0].tool) {
-				delete readonly.tableConfig[0].tool[key]
-			};
+			readonly.tool.tools = {};
+			readonly.tableConfig[0].tool.tools = {};
 			let data = e.suborderList;
-			console.log('setBillConfig ==> ', readonly);
 			(this.$refs.bill as any).setBillConfig(readonly);
 			(this.$refs.bill as any).setBillTableValue(data, 0);// 设置第1张单据表格数据
 			(this.$refs.bill as any).showTab = 'bill';
+
 		}
 		// 派单
 		onDispatch(e : any) {
@@ -919,6 +920,7 @@
 		// 切换tab栏
 		clickTab(e : any) {
 			console.log('切换tab ==> ', e);
+			this.tabType = e;
 			// submitState: 提交状态
 			if (e === 'draftsBox') this.getPageList({ submitState: 0 }, 'draftsBox'); // 草稿箱数据
 			if (e === 'smt') this.getPageList({ submitState: 1 }, 'smt'); // 已提交数据
@@ -1041,6 +1043,9 @@
 		}
 		// 操作删除
 		doDelete2(item : any) {
+			if (this.tabType === '') {
+
+			};
 			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
 				confirmButtonText: '确定',
 				cancelButtonText: '取消',
@@ -1053,7 +1058,7 @@
 						this.$message.success('删除成功!');
 					} else this.failHandle(res)
 				})
-			}).catch(() => this.$message.error('已取消删除'));
+			}).catch(() => this.$message.info('已取消删除'));
 		}
 		// 运行错误
 		failHandle(err : any) {

+ 86 - 85
src/views/audit/productManagement/index.vue

@@ -145,6 +145,28 @@
 				align: 'center',
 			},
 			columns: [
+				{
+					title: '标题',
+					field: 'skuTitle',
+					component: 'by-input',
+					compConfig: {
+						attr: {
+							size: 'mini',
+							placeholder: ' '
+						},
+					}
+				},
+				{
+					title: '副标题',
+					field: 'skuSubtitle',
+					component: 'by-input',
+					compConfig: {
+						attr: {
+							size: 'mini',
+							placeholder: ' '
+						},
+					}
+				},
 				{
 					title: '价格',
 					field: 'price',
@@ -154,7 +176,7 @@
 							size: 'mini',
 							placeholder: ' ',
 							type: "number",
-							defaultValue: '20'
+							defaultValue: 20
 						},
 					}
 				},
@@ -179,7 +201,7 @@
 							size: 'mini',
 							placeholder: ' ',
 							type: "number",
-							defaultValue: '100'
+							defaultValue: 100
 						},
 					}
 				},
@@ -192,7 +214,7 @@
 							size: 'mini',
 							placeholder: ' ',
 							type: "number",
-							defaultValue: '100'
+							defaultValue: 100
 						},
 					}
 				},
@@ -205,7 +227,7 @@
 							size: 'mini',
 							placeholder: ' ',
 							type: "number",
-							defaultValue: '500'
+							defaultValue: 5
 						},
 					}
 				},
@@ -218,7 +240,7 @@
 							size: 'mini',
 							placeholder: ' ',
 							type: "number",
-							defaultValue: '28'
+							defaultValue: 5
 						},
 					}
 				},
@@ -231,7 +253,7 @@
 							size: 'mini',
 							placeholder: ' ',
 							type: "number",
-							defaultValue: '18'
+							defaultValue: 18
 						},
 					}
 				},
@@ -244,23 +266,13 @@
 							size: 'mini',
 							placeholder: ' ',
 							type: "number",
-							defaultValue: '6'
+							defaultValue: 6
 						},
 					}
 				},
 				{
 					title: '体积/cm³',
 					field: 'volume',
-					component: 'by-input',
-					compConfig: {
-						attr: {
-							size: 'mini',
-							placeholder: ' ',
-							readonly: true,
-							type: "number",
-							defaultValue: '3024'
-						},
-					},
 				},
 			]
 		}
@@ -272,6 +284,7 @@
 			},
 			columns: [
 				{
+					width: '170px',
 					title: '标题',
 					field: 'skuTitle',
 					component: 'by-input',
@@ -283,6 +296,7 @@
 					}
 				},
 				{
+					width: '150px',
 					title: '副标题',
 					field: 'skuSubtitle',
 					component: 'by-input',
@@ -294,7 +308,19 @@
 					}
 				},
 				{
-					width: '100px',
+					width: '150px',
+					title: '物料编码',
+					field: 'code',
+					component: 'by-input',
+					compConfig: {
+						attr: {
+							size: 'mini',
+							placeholder: ' '
+						},
+					}
+				},
+				{
+					width: '80px',
 					title: '价格',
 					field: 'price',
 					component: 'by-input',
@@ -303,12 +329,12 @@
 							size: 'mini',
 							placeholder: ' ',
 							type: "number",
-							defaultValue: '20'
+							defaultValue: 20
 						},
 					}
 				},
 				{
-					width: '100px',
+					width: '80px',
 					title: '单位',
 					field: 'unit',
 					component: 'by-input',
@@ -321,7 +347,7 @@
 					}
 				},
 				{
-					width: '100px',
+					width: '80px',
 					title: '库存',
 					field: 'stock',
 					component: 'by-input',
@@ -330,7 +356,7 @@
 							size: 'mini',
 							placeholder: ' ',
 							type: "number",
-							defaultValue: '100'
+							defaultValue: 100
 						},
 					}
 				},
@@ -344,12 +370,12 @@
 							size: 'mini',
 							placeholder: ' ',
 							type: "number",
-							defaultValue: '100'
+							defaultValue: 100
 						},
 					}
 				},
 				{
-					width: '100px',
+					width: '80px',
 					title: '重量/g',
 					field: 'weight',
 					component: 'by-input',
@@ -358,12 +384,12 @@
 							size: 'mini',
 							placeholder: ' ',
 							type: "number",
-							defaultValue: '500'
+							defaultValue: 500
 						},
 					}
 				},
 				{
-					width: '100px',
+					width: '80px',
 					title: '长/cm',
 					field: 'length',
 					component: 'by-input',
@@ -372,12 +398,12 @@
 							size: 'mini',
 							placeholder: ' ',
 							type: "number",
-							defaultValue: '28'
+							defaultValue: 28
 						},
 					}
 				},
 				{
-					width: '100px',
+					width: '80px',
 					title: '宽/cm',
 					field: 'width',
 					component: 'by-input',
@@ -386,12 +412,12 @@
 							size: 'mini',
 							placeholder: ' ',
 							type: "number",
-							defaultValue: '18'
+							defaultValue: 18
 						},
 					}
 				},
 				{
-					width: '100px',
+					width: '80px',
 					title: '高/cm',
 					field: 'height',
 					component: 'by-input',
@@ -400,24 +426,14 @@
 							size: 'mini',
 							placeholder: ' ',
 							type: "number",
-							defaultValue: '6'
+							defaultValue: 6
 						},
 					}
 				},
 				{
-					width: '100px',
+					width: '80px',
 					title: '体积/cm³',
 					field: 'volume',
-					component: 'by-input',
-					compConfig: {
-						attr: {
-							size: 'mini',
-							placeholder: ' ',
-							readonly: true,
-							type: "number",
-							defaultValue: '3024'
-						},
-					},
 				},
 				{
 					width: '80px',
@@ -493,25 +509,23 @@
 					},
 					{
 						span: 6,
-						label: '货号',
-						prop: 'itemNumber',
+						label: '物料编码',
+						prop: 'code',
 						component: 'by-input',
 						compConfig: {
 							attr: {
-								placeholder: '请输入货号',
-								clearable: true
+								placeholder: '请输入物料编码',
 							}
 						}
 					},
 					{
 						span: 6,
-						label: '国际码',
-						prop: 'nsCode',
+						label: '货号',
+						prop: 'itemNumber',
 						component: 'by-input',
-						labelWidth: '70px',
 						compConfig: {
 							attr: {
-								placeholder: '请输入国际码',
+								placeholder: '请输入货号',
 								clearable: true
 							}
 						}
@@ -529,7 +543,8 @@
 								type: 'number'
 							}
 						}
-					}, {
+					},
+					{
 						span: 6,
 						label: '市场价格',
 						prop: 'markPrice',
@@ -553,6 +568,18 @@
 							}
 						}
 					},
+					{
+						span: 6,
+						label: '国际码',
+						prop: 'nsCode',
+						component: 'by-input',
+						compConfig: {
+							attr: {
+								placeholder: '请输入国际码',
+								clearable: true
+							}
+						}
+					},
 				],
 				[
 					{
@@ -748,32 +775,6 @@
 								}
 							}
 						},
-						// {
-						// 	span: 6,
-						// 	label: '价格',
-						// 	prop: 'price',
-						// 	component: 'by-input',
-						// 	labelWidth: '70px',
-						// 	compConfig: {
-						// 		attr: {
-						// 			placeholder: '请输入价格(成交、成本价)',
-						// 			clearable: true
-						// 		}
-						// 	}
-						// },
-						// {
-						// 	span: 6,
-						// 	label: '保质期',
-						// 	prop: 'shelfLife',
-						// 	component: 'by-input',
-						// 	labelWidth: '70px',
-						// 	compConfig: {
-						// 		attr: {
-						// 			placeholder: '请输入保质期',
-						// 			clearable: true
-						// 		}
-						// 	}
-						// },
 					]
 				]
 			},
@@ -870,13 +871,13 @@
 		}
 		// 监听单表格数据
 		getSingleValue(e : any) {
-			// console.log(e);
-			// console.log(this.singleTable);
+			console.log('监听单表格 ==> ', e);
+			e.volume = e.length * e.width * e.height
 		}
-		// 监听表数据
+		// 监听表数据
 		getInputValue(e : any) {
-			// console.log(this.tableList);
-			// e.height = 666
+			console.log('监听表格 ==> ', e);
+			e.volume = e.length * e.width * e.height
 		}
 		// 保存编辑/新增
 		doFormData() {
@@ -919,12 +920,11 @@
 				} else { // 单规格
 					data = { maindataMaterial: query, maindataMaterialSkus: (this.$refs.singeTable as any).getValue() }
 					data.maindataMaterialSkus[0].isDeleted = 0;
-					data.maindataMaterialSkus[0].skuTitle = query.name;
-					data.maindataMaterialSkus[0].skuSubtitle = query.shortName;
+					// data.maindataMaterialSkus[0].skuTitle = query.name;
+					// data.maindataMaterialSkus[0].skuSubtitle = query.shortName;
 					data.maindataMaterial.attributeList = ""
 				}
 				console.log('data ==> ', data);
-
 				if (this.isEdit) { // 编辑
 					other.updateSpuAndSku(data, 'maindataMaterial').then((res : any) => {
 						if (res.code === 200) {
@@ -1165,6 +1165,7 @@
 				setTimeout(() => {
 					// 设置单表格数据
 					if (this.singeTable) {
+						console.log('单表格数据 ==> ',this.singeTable);
 						(this as any).$refs.singeTable.setValue(this.singeTable);
 					} else (this as any).$refs.singeTable.setValue([{}]);
 				}, 0)