Explorar el Código

单据子表删除问题

AlanWong hace 2 años
padre
commit
b66cab22da

+ 78 - 45
src/views/audit/orderTask/index.vue

@@ -889,8 +889,6 @@
 							this.isSubmit = true;
 							this.$message.success('保存成功');
 							this.dataId = res.data;
-							// this.getDataList();
-							// (this.$refs.bill as any).showTab = 'all';
 						} else this.$message.error(res.msg);
 					})
 				} else if (this.tabType === 'all' || this.tabType === 'draftsBox') {
@@ -907,14 +905,9 @@
 		}
 		// 打开新增
 		onAdd(e : any) {
-			console.log('新增tabType ==>', this.tabType);
+			// console.log('新增tabType ==>', this.tabType);
 			if (e === 'billTable_0') {
 				(this.$refs.product as any).setShow(true); // 打开sku弹窗
-				let obj = (this.$refs.bill as any).getBillFormValue();
-				console.log(obj);
-				// if (!this.tableData) this.tableData = obj.suborderList;
-				// console.log('this.tableData ==> ', this.tableData);
-				// (this.$refs.bill as any).setBillTableValue(this.tableData, 0);// 设置第1张单据表格数据
 			} else {
 				let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
 				billConfig.form.attr.readonly = false; // 设置只读
@@ -934,8 +927,8 @@
 		// 打开编辑
 		openEdit(e : any) {
 			e = e.row ? e.row : e;
-			console.log('编辑tabType ==>', this.tabType);
-			console.log('编辑 ==>', e);
+			// console.log('编辑tabType ==>', this.tabType);
+			// console.log('编辑 ==>', e);
 			let loading = this.$loading({ target: '.main-container' });
 			api.single({ id: e.id }, 'supplyTaskOrder').then((res : any) => {
 				if (res.code === 200) {
@@ -953,8 +946,7 @@
 							return this.setReadonly(parentData, false)
 						};
 						let data = parentData.suborderList
-						data.map((v : any, i : any) => {
-							v.dataIndex = i;
+						data.map((v : any) => {
 							if (!v.prePrice) v.prePrice = '0';
 						});
 						let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
@@ -1015,6 +1007,7 @@
 				let selectData = (this.$refs.bill as any).getTableSelectData('draftsBox'); // 获取表格选中数据
 				if (selectData.length <= 0) return this.$message.warning('请选择提交数据');
 				if (selectData.length > 1) return this.$message.warning('只能提交一条数据');
+				let loading = this.$loading({ target: '.main-container' });
 				this.$confirm('确定提交吗!', '注意', {
 					confirmButtonText: '确定',
 					cancelButtonText: '取消',
@@ -1025,6 +1018,7 @@
 						if (res.code === 200) {
 							this.$message.success('提交成功');
 							this.clickTab('draftsBox');
+							loading.close();
 						} else this.$message.error(res.msg)
 					})
 				}).catch(() => this.$message.info('已取消提交'));
@@ -1033,6 +1027,7 @@
 				console.log('isChange ==> ', this.isChange);
 				console.log('isSubmit ==> ', this.isSubmit);
 				if (this.isSubmit) {
+					let loading = this.$loading({ target: '.main-container' });
 					this.$confirm('确定提交吗!', '注意', {
 						confirmButtonText: '确定',
 						cancelButtonText: '取消',
@@ -1047,6 +1042,7 @@
 								this.isSubmit = false;
 								this.dataId = '';
 								(this.$refs.bill as any).showTab = this.tabType;
+								loading.close();
 							} else this.$message.error(res.msg)
 						})
 					}).catch(() => this.$message.info('已取消提交'));
@@ -1070,6 +1066,7 @@
 					if (this.isChange || oldbillForm != newBillForm || oldData != newData) {
 						return this.$message.warning('数据变更必须先保存再提交');
 					} else {
+						let loading = this.$loading({ target: '.main-container' });
 						this.$confirm('确定提交吗!', '注意', {
 							confirmButtonText: '确定',
 							cancelButtonText: '取消',
@@ -1082,6 +1079,7 @@
 									this.$message.success('提交成功');
 									this.clickTab(this.tabType);
 									(this.$refs.bill as any).showTab = this.tabType;
+									loading.close();
 								} else this.$message.error(res.msg)
 							})
 						}).catch(() => this.$message.info('已取消提交'));
@@ -1092,6 +1090,7 @@
 		// 操作反提交
 		onReturnSmt(e : any) {
 			console.log('反提交 ==>', e);
+			let loading = this.$loading({ target: '.main-container' });
 			this.$confirm('确定反提交吗!', '注意', {
 				confirmButtonText: '确定',
 				cancelButtonText: '取消',
@@ -1103,6 +1102,7 @@
 						if (res.code === 200) {
 							this.$message.success('反提交成功');
 							this.clickTab(this.tabType);
+							loading.close();
 						} else this.$message.error(res.msg)
 					})
 				}
@@ -1118,11 +1118,13 @@
 				center: true
 			}).then(() => {
 				if (this.tabType === 'smt') {
+					let loading = this.$loading({ target: '.main-container' });
 					api.cancelSubmission({ id: this.baseInfo.id }, 'supplyTaskOrder').then((res : any) => {
 						if (res.code === 200) {
 							this.$message.success('反提交成功');
 							this.clickTab(this.tabType);
 							(this.$refs.bill as any).showTab = 'smt';
+							loading.close();
 						} else this.$message.error(res.msg)
 					})
 				}
@@ -1156,11 +1158,13 @@
 				let query : any = (this as any).$lodash.cloneDeep(this.supplierSelectData)[0];
 				query.organizationName = e[0].name;
 				query.organizationId = e[0].id;
+				let loading = this.$loading({ target: '.main-container' });
 				api.updateList(query, 'supplyTaskOrder').then((res : any) => {
 					if (res.code === 200) {
 						this.$message.success('派单成功');
 						this.getDataList();
 						(this.$refs.bill as any).showTab = 'all';
+						loading.close();
 					} else this.$message.error(res.msg);
 				})
 			}
@@ -1271,33 +1275,43 @@
 		}
 		// 确定商品新增
 		confirmProduct(e : any) {
-			let contents : any = [], goodsData = e, newArr : any = [], obj : any = {};
-			goodsData = goodsData.map((item : any) => {
-				item.materialName = item.skuTitle
-				item.prePrice = 0
-				item.unitPrice = item.price
-				item.materialSku = item.id
-				const { id, ...newData } = item
-				return newData
-			})
-			console.log('newTableData ==> ', this.newTableData);
-			this.tableData = this.newTableData.concat(goodsData);
-			console.log('tableData ==> ', this.tableData);
-			newArr = this.tableData.reduce((prev : any, current : any) => {
-				obj[current.materialSku] ? contents.push(current.materialName) : (obj[current.materialSku] = true && prev.push(current))
-				return prev
-			}, []);
-			this.tableData = newArr;
-			this.tableData.map((v : any, i : any) => {
-				v.dataIndex = i;
-				if (!v.prePrice) v.prePrice = '0';
-			});
-			if (contents.length > 0) {
-				this.$alert('商品 “' + contents + '” 已存在!', '提示', {
-					confirmButtonText: '确定',
-				});
-			};
-			(this.$refs.bill as any).setBillTableValue(this.tableData, 0);// 设置第1张单据表格数据
+			let nowData = (this.$refs.bill as any).getBillTableData(0);
+			let names = '';
+			if (e.length > 0) {
+				for (const item of e) {
+					let t = true;
+					for (const t_item of nowData) {
+						if (item.id == t_item.materialSku) {
+							if (!names) {
+								names = item.skuTitle
+							} else {
+								names = names + ',' + item.skuTitle
+							}
+							t = false;
+							break;
+						}
+					}
+					if (t) {
+						let obj : any = {};
+						obj.materialName = item.skuTitle
+						obj.materialId = item.materialId
+						obj.prePrice = 0
+						obj.unitPrice = item.price
+						obj.materialSku = item.id
+						obj.unit = item.unit
+						obj.prePrice = "0"
+						obj.isDeleted = 0
+						this.tableData.push(obj);
+						nowData.push(obj);
+					}
+				}
+				(this.$refs.bill as any).setBillTableValue(nowData, 0);// 设置第1张单据表格数据
+				if (names) {
+					this.$alert('商品 “' + names + '”已存在!', '提示', {
+						confirmButtonText: '确定',
+					});
+				}
+			}
 		}
 		// 单据表格删除
 		changeTable(item : any) {
@@ -1307,11 +1321,26 @@
 				type: 'warning',
 				center: true
 			}).then(() => {
-				this.tableData[item.dataIndex].isDeleted = 1;
-				this.newTableData = this.tableData.filter((res : any) => res.isDeleted === 0);
-				console.log('原表格数据 ==> ', this.tableData);
-				console.log('新表格数据 ==> ', this.newTableData);
-				(this.$refs.bill as any).setBillTableValue(this.newTableData, 0);// 设置第1张单据表格数据
+				let data = (this.$refs.bill as any).getBillTableData(0);
+				let i = -1;
+				let j = -1;
+				for (const v of data) {
+					i++;
+					if (v.materialSku == item.materialSku) {
+						break
+					}
+				};
+
+				for (const v of this.tableData) {
+					j++;
+					if (v.materialSku == item.materialSku && item.isDeleted === 0) {
+						break
+					}
+				};
+
+				this.tableData[j].isDeleted = 1;
+				data.splice(i, 1);
+				(this.$refs.bill as any).setBillTableValue(data, 0);// 设置第1张单据表格数据
 				this.$message.success('删除成功');
 			}).catch(() => this.$message.info('已取消删除'));
 		}
@@ -1324,7 +1353,8 @@
 				selectData.map((v : any) => {
 					ids.push(v.id)
 				})
-			} else return this.$message({ type: 'warning', message: '请选择删除数据' })
+			} else return this.$message({ type: 'warning', message: '请选择删除数据' });
+			let loading = this.$loading({ target: '.main-container' });
 			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
 				confirmButtonText: '确定',
 				cancelButtonText: '取消',
@@ -1335,12 +1365,14 @@
 					if (res.code === 200) {
 						this.clickTab(this.tabType);
 						this.$message.success('删除成功!');
+						loading.close();
 					} else this.$message.error(res.msg)
 				})
 			}).catch(() => this.$message.info('已取消删除'));
 		}
 		// 操作删除
 		doDelete2(item : any) {
+			let loading = this.$loading({ target: '.main-container' });
 			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
 				confirmButtonText: '确定',
 				cancelButtonText: '取消',
@@ -1351,6 +1383,7 @@
 					if (res.code === 200) {
 						this.clickTab(this.tabType);
 						this.$message.success('删除成功!');
+						loading.close();
 					} else this.$message.error(res.msg)
 				})
 			}).catch(() => this.$message.info('已取消删除'));

+ 76 - 45
src/views/audit/outbound/index.vue

@@ -23,6 +23,7 @@
 		baseInfo : any = {};
 		isSubmit : any = false
 		isChange : any = false
+		dataId : any = ''
 		// 右边
 		supplierInfo : any = {} // 机构信息
 		businessType : any = '' // 业务类型
@@ -783,7 +784,7 @@
 			}, 500)
 		}
 		// 引单
-		citationOrder() {
+		citationOrder(e : any) {
 			let parentData : any = (this as any).$refs.bill.getSourceTableSelectData(0);
 			if (parentData.length <= 0) return this.$message.warning('请选择引单数据');
 			let loading = this.$loading({ target: '.main-container' });
@@ -791,10 +792,10 @@
 				if (res.code === 200) {
 					parentData = res.data ? [res.data] : parentData;
 					parentData = parentData.map((item : any, i : any) => {
-						item.dataIndex = i;
 						item.receiveAddress = item.address
 						item.receive = item.consignee
 						item.receivePhone = item.phone
+						item.outOrderNo = item.orderNumber
 						const { ...newData } = item
 						return newData
 					})
@@ -803,10 +804,11 @@
 						v.deliveryNumber = v.number - v.outNumber;
 						if (v.deliveryNumber < v.number) v.number = v.deliveryNumber;
 					});
-					this.isAdd = true;
 					this.tableData = parentData[0];
+					billConfig.tool.tools = { save: true, smt: true };
 					// console.log('this.tableData ==> ', this.tableData);
-					billConfig.tool.tools = { save: true };
+					// billConfig.tool.tools = { save: true };
+					this.isAdd = true;
 					(this.$refs.bill as any).showTab = 'bill';
 					loading.close();
 					setTimeout(() => {
@@ -830,32 +832,6 @@
 			e.totalPrice = e.realityPrice - e.prePrice;
 
 		}
-		// 确定商品新增
-		confirmProduct(e : any) {
-			let contents : any = [], goodsData = e, newArr : any = [], obj : any = {};
-			goodsData = goodsData.map((item : any) => {
-				item.materialName = item.skuTitle
-				item.unitPrice = item.price
-				item.materialSku = item.id
-				const { id, ...newData } = item
-				return newData
-			})
-			this.tableData = this.tableData.concat(goodsData);
-			newArr = this.tableData.reduce((prev : any, current : any) => {
-				obj[current.materialSku] ? contents.push(current.materialName) : (obj[current.materialSku] = true && prev.push(current))
-				return prev
-			}, []);
-			this.tableData = newArr;
-			this.tableData.map((v : any, i : any) => {
-				v.dataIndex = i
-			});
-			if (contents.length > 0) {
-				this.$alert('商品 “' + contents + '” 已存在!', '提示', {
-					confirmButtonText: '确定',
-				});
-			};
-			(this.$refs.bill as any).setBillTableValue(this.tableData, 0);// 设置第1张单据表格数据
-		}
 		// 保存
 		onSave(e : any) {
 			console.log('保存 ==>', this.tabType);
@@ -891,12 +867,11 @@
 					delete query.id;
 					api.outbound(query, 'supplyOutOrder').then((res : any) => {
 						if (res.code === 200) {
-							// this.isAdd = false;
-							// this.isChange = false;
-							// this.isSubmit = true;
-							this.getDataList();
+							this.isAdd = false;
+							this.isChange = false;
+							this.isSubmit = true;
 							this.$message.success('保存成功');
-							(this.$refs.bill as any).showTab = 'all';
+							this.dataId = res.data;
 						} else this.$message.error(res.msg);
 					})
 				} else if (this.tabType === 'all' || this.tabType === 'draftsBox') {
@@ -956,8 +931,7 @@
 						if (this.tabType === 'draftsBox' || parentData.submitState === 0) billConfig.tool.tools = { save: true, smt: true };
 						let data : any = parentData.suborderList;
 						let array : any = [];
-						data.map((v : any, i : any) => {
-							v.dataIndex = i;
+						data.map((v : any) => {
 							v.towInOne = v.storehouseName + ',' + v.storingLocationName; // 仓库仓位
 							array.push({
 								storidId: v.storingLocationId,
@@ -979,6 +953,7 @@
 								(this.$refs.bill as any).setBillFormValue(parentData);// 设置单据表单数据
 								(this.$refs.bill as any).setBillTableValue(newData, 0);// 设置第1张单据表格数据
 								this.isAdd = false;
+								this.dataId = '';
 								(this.$refs.bill as any).showTab = 'bill';
 								loading.close();
 							}
@@ -1047,7 +1022,7 @@
 					})
 				}).catch(() => this.$message.info('已取消提交'));
 			} else {
-				// if (this.isAdd) return this.$message.warning('新增数据必须先保存才能提交');
+				if (this.isAdd) return this.$message.warning('新增数据必须先保存才能提交');
 				console.log('isChange ==> ', this.isChange);
 				console.log('isSubmit ==> ', this.isSubmit);
 				if (this.isSubmit) {
@@ -1092,11 +1067,12 @@
 							type: 'warning',
 							center: true
 						}).then(() => {
-							// console.log(this.baseInfo.id);
-							api.submitTo({ id: this.baseInfo.id }, 'supplyOutOrder').then((res : any) => {
+							let id = this.dataId ? this.dataId : this.baseInfo.id;
+							api.submitTo({ id: id }, 'supplyOutOrder').then((res : any) => {
 								if (res.code === 200) {
 									this.$message.success('提交成功');
 									this.clickTab(this.tabType);
+									this.dataId = '';
 									(this.$refs.bill as any).showTab = this.tabType;
 								} else this.$message.error(res.msg)
 							})
@@ -1277,6 +1253,46 @@
 				if (data === 'recycleBin') this.getSelectDeleteList({}) // 回收站数据
 			}
 		}
+		// 确定商品新增
+		confirmProduct(e : any) {
+			let nowData = (this.$refs.bill as any).getBillTableData(0);
+			let names = '';
+			if (e.length > 0) {
+				for (const item of e) {
+					let t = true;
+					for (const t_item of nowData) {
+						if (item.id == t_item.materialSku) {
+							if (!names) {
+								names = item.skuTitle
+							} else {
+								names = names + ',' + item.skuTitle
+							}
+							t = false;
+							break;
+						}
+					}
+					if (t) {
+						let obj : any = {};
+						obj.materialName = item.skuTitle
+						obj.materialId = item.materialId
+						obj.prePrice = 0
+						obj.unitPrice = item.price
+						obj.materialSku = item.id
+						obj.unit = item.unit
+						obj.prePrice = "0"
+						obj.isDeleted = 0
+						this.tableData.push(obj);
+						nowData.push(obj);
+					}
+				}
+				(this.$refs.bill as any).setBillTableValue(nowData, 0);// 设置第1张单据表格数据
+				if (names) {
+					this.$alert('商品 “' + names + '”已存在!', '提示', {
+						confirmButtonText: '确定',
+					});
+				}
+			}
+		}
 		// 单据表格删除
 		changeTable(item : any) {
 			this.$confirm('确定删除吗!', '注意', {
@@ -1285,11 +1301,26 @@
 				type: 'warning',
 				center: true
 			}).then(() => {
-				this.tableData[item.dataIndex].isDeleted = 1;
-				let newData = this.tableData.filter((res : any) => res.isDeleted === 0);
-				console.log('原表格数据 ==> ', this.tableData);
-				console.log('新表格数据 ==> ', newData);
-				(this.$refs.bill as any).setBillTableValue(newData, 0);// 设置第1张单据表格数据
+				let data = (this.$refs.bill as any).getBillTableData(0);
+				let i = -1;
+				let j = -1;
+				for (const v of data) {
+					i++;
+					if (v.materialSku == item.materialSku) {
+						break
+					}
+				};
+
+				for (const v of this.tableData) {
+					j++;
+					if (v.materialSku == item.materialSku && item.isDeleted === 0) {
+						break
+					}
+				};
+
+				this.tableData[j].isDeleted = 1;
+				data.splice(i, 1);
+				(this.$refs.bill as any).setBillTableValue(data, 0);// 设置第1张单据表格数据
 				this.$message.success('删除成功');
 			}).catch(() => this.$message.info('已取消删除'));
 		}

+ 100 - 71
src/views/audit/warehousing/index.vue

@@ -25,6 +25,7 @@
 		baseInfo : any = {};
 		isSubmit : any = false
 		isChange : any = false
+		dataId : any = ''
 		// 右边
 		supplierInfo : any = {} // 机构信息
 		businessType : any = '' // 业务类型
@@ -688,34 +689,6 @@
 			this.isSubmit = false;
 			e.totalPrice = parseFloat((e.number * e.unitPrice).toFixed(2));
 		}
-		// 确定商品新增
-		confirmProduct(e : any) {
-			let contents : any = [], goodsData = e, newArr : any = [], obj : any = {};
-			goodsData = goodsData.map((item : any) => {
-				item.materialName = item.skuTitle
-				item.prePrice = 0
-				item.unitPrice = item.price
-				item.materialSku = item.id
-				const { id, ...newData } = item
-				return newData
-			})
-			this.tableData = this.tableData.concat(goodsData);
-			newArr = this.tableData.reduce((prev : any, current : any) => {
-				obj[current.materialSku] ? contents.push(current.materialName) : (obj[current.materialSku] = true && prev.push(current))
-				return prev
-			}, []);
-			this.tableData = newArr;
-			this.tableData.map((v : any, i : any) => {
-				v.dataIndex = i
-				if (!v.prePrice) v.prePrice = '0';
-			});
-			if (contents.length > 0) {
-				this.$alert('商品 “' + contents + '” 已存在!', '提示', {
-					confirmButtonText: '确定',
-				});
-			};
-			(this.$refs.bill as any).setBillTableValue(this.tableData, 0);// 设置第1张单据表格数据
-		}
 		// 保存
 		onSave(e : any) {
 			// console.log('保存 ==>', this.tabType);
@@ -746,12 +719,11 @@
 				if (this.isAdd) {
 					api.saveList(query, 'supplyEntryOrder').then((res : any) => {
 						if (res.code === 200) {
-							// this.isAdd = false;
-							// this.isChange = false;
-							// this.isSubmit = true;
-							this.getDataList();
+							this.isAdd = false;
+							this.isChange = false;
+							this.isSubmit = true;
 							this.$message.success('保存成功');
-							(this.$refs.bill as any).showTab = 'all';
+							this.dataId = res.data;
 						} else this.$message.error(res.msg);
 					})
 				} else if (this.tabType === 'all' || this.tabType === 'draftsBox') {
@@ -809,40 +781,40 @@
 							return this.setReadonly(parentData)
 						}
 						let data = parentData.suborderList
-						data.map((v : any, i : any) => {
-							v.dataIndex = i;
+						data.map((v : any) => {
 							if (!v.prePrice) v.prePrice = '0';
 							v.towInOne = v.storehouseName + ',' + v.storingLocationName; // 仓库仓位
-							let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
-							if (billConfig.tableConfig[0].table.columns.at(-1).title != '操作') {
-								billConfig.tableConfig[0].table.columns.push({
-									width: 90,
-									title: '操作',
-									action: true,
-									plugins: [{
-										icon: 'el-icon-delete',
-										name: '删除',
-										audit: '',
-										event: {
-											click: (item : any) => {
-												(this as any).changeTable(item)
-											}
-										}
-									}]
-								})
-							};
-							billConfig.form.attr.readonly = false; // 设置只读
-							billConfig.tool.tools = { save: true, };
-							if (this.tabType === 'draftsBox' || parentData.submitState === 0) billConfig.tool.tools = { save: true, smt: true };
-							billConfig.tableConfig[0].tool.tools = { add: true };
-							this.tableData = data;
-							(this.$refs.bill as any).setBillConfig(billConfig);
-							(this.$refs.bill as any).setBillFormValue(parentData);// 设置单据表单数据
-							(this.$refs.bill as any).setBillTableValue(data, 0);// 设置第1张单据表格数据
-							this.isAdd = false;
-							(this.$refs.bill as any).showTab = 'bill';
-							loading.close();
 						});
+						let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
+						if (billConfig.tableConfig[0].table.columns.at(-1).title != '操作') {
+							billConfig.tableConfig[0].table.columns.push({
+								width: 90,
+								title: '操作',
+								action: true,
+								plugins: [{
+									icon: 'el-icon-delete',
+									name: '删除',
+									audit: '',
+									event: {
+										click: (item : any) => {
+											(this as any).changeTable(item)
+										}
+									}
+								}]
+							})
+						};
+						billConfig.form.attr.readonly = false; // 设置只读
+						billConfig.tool.tools = { save: true, };
+						if (this.tabType === 'draftsBox' || parentData.submitState === 0) billConfig.tool.tools = { save: true, smt: true };
+						billConfig.tableConfig[0].tool.tools = { add: true };
+						this.tableData = data;
+						(this.$refs.bill as any).setBillConfig(billConfig);
+						(this.$refs.bill as any).setBillFormValue(parentData);// 设置单据表单数据
+						(this.$refs.bill as any).setBillTableValue(data, 0);// 设置第1张单据表格数据
+						this.isAdd = false;
+						this.dataId = '';
+						(this.$refs.bill as any).showTab = 'bill';
+						loading.close();
 					} else {
 						loading.close();
 						this.setReadonly(parentData);
@@ -893,7 +865,7 @@
 					})
 				}).catch(() => this.$message.info('已取消提交'));
 			} else {
-				// if(this.isAdd) return this.$message.warning('新增数据必须先保存才能提交');
+				if(this.isAdd) return this.$message.warning('新增数据必须先保存才能提交');
 				console.log('isChange ==> ', this.isChange);
 				console.log('isSubmit ==> ', this.isSubmit);
 				if (this.isSubmit) {
@@ -903,11 +875,13 @@
 						type: 'warning',
 						center: true
 					}).then(() => {
-						api.submitTo({ id: this.baseInfo.id }, 'supplyEntryOrder').then((res : any) => {
+						let id = this.dataId ? this.dataId : this.baseInfo.id;
+						api.submitTo({ id: id }, 'supplyEntryOrder').then((res : any) => {
 							if (res.code === 200) {
 								this.$message.success('提交成功');
 								this.clickTab(this.tabType);
 								this.isSubmit = false;
+								this.dataId = '';
 								(this.$refs.bill as any).showTab = this.tabType;
 							} else this.$message.error(res.msg)
 						})
@@ -1090,6 +1064,46 @@
 			if (data === 'smt') this.getPageList({ submitState: 1 }, 'smt'); // 已提交数据
 			if (data === 'recycleBin') this.getSelectDeleteList({}) // 回收站数据
 		}
+		// 确定商品新增
+		confirmProduct(e : any) {
+			let nowData = (this.$refs.bill as any).getBillTableData(0);
+			let names = '';
+			if (e.length > 0) {
+				for (const item of e) {
+					let t = true;
+					for (const t_item of nowData) {
+						if (item.id == t_item.materialSku) {
+							if (!names) {
+								names = item.skuTitle
+							} else {
+								names = names + ',' + item.skuTitle
+							}
+							t = false;
+							break;
+						}
+					}
+					if (t) {
+						let obj : any = {};
+						obj.materialName = item.skuTitle
+						obj.materialId = item.materialId
+						obj.prePrice = 0
+						obj.unitPrice = item.price
+						obj.materialSku = item.id
+						obj.unit = item.unit
+						obj.prePrice = "0"
+						obj.isDeleted = 0
+						this.tableData.push(obj);
+						nowData.push(obj);
+					}
+				}
+				(this.$refs.bill as any).setBillTableValue(nowData, 0);// 设置第1张单据表格数据
+				if (names) {
+					this.$alert('商品 “' + names + '”已存在!', '提示', {
+						confirmButtonText: '确定',
+					});
+				}
+			}
+		}
 		// 单据表格删除
 		changeTable(item : any) {
 			this.$confirm('确定删除吗!', '注意', {
@@ -1098,11 +1112,26 @@
 				type: 'warning',
 				center: true
 			}).then(() => {
-				this.tableData[item.dataIndex].isDeleted = 1;
-				let newData = this.tableData.filter((res : any) => res.isDeleted === 0);
-				console.log('原表格数据 ==> ', this.tableData);
-				console.log('新表格数据 ==> ', newData);
-				(this.$refs.bill as any).setBillTableValue(newData, 0);// 设置第1张单据表格数据
+				let data = (this.$refs.bill as any).getBillTableData(0);
+				let i = -1;
+				let j = -1;
+				for (const v of data) {
+					i++;
+					if (v.materialSku == item.materialSku) {
+						break
+					}
+				};
+
+				for (const v of this.tableData) {
+					j++;
+					if (v.materialSku == item.materialSku && item.isDeleted === 0) {
+						break
+					}
+				};
+
+				this.tableData[j].isDeleted = 1;
+				data.splice(i, 1);
+				(this.$refs.bill as any).setBillTableValue(data, 0);// 设置第1张单据表格数据
 				this.$message.success('删除成功');
 			}).catch(() => this.$message.info('已取消删除'));
 		}