Browse Source

订单任务终极版

AlanWong 2 years ago
parent
commit
5c23ade1cf

+ 10 - 11
src/api/order.ts

@@ -25,14 +25,6 @@ function saveList(data : any, url : any) {
 		data: data
 	})
 }
-// 保存数据
-function msave(data : any, url : any) {
-	return request({
-		url: '/supply/' + url + '/msave',
-		method: 'POST',
-		data: data
-	})
-}
 // 提交数据
 function submitTo(data : any, url : any) {
 	return request({
@@ -63,7 +55,7 @@ function deleteList(data : any, url : any) {
 	return request({
 		url: '/supply/' + url + '/delete',
 		method: 'POST',
-		params: data
+		data: data
 	})
 }
 // 回收站数据
@@ -99,11 +91,17 @@ function backOrder(data : any, url : any, mid : any) {
 		data: data
 	})
 }
+// 业务类型
+function getbusinessType(url : any) {
+	return request({
+		url: '/supply/' + url + '/getbusinessType',
+		method: 'GET'
+	})
+}
 export default {
 	treeList,
 	pageList,
 	saveList,
-	msave,
 	updateList,
 	deleteList,
 	selectDeleteList,
@@ -111,5 +109,6 @@ export default {
 	splitOrder,
 	backOrder,
 	submitTo,
-	cancelSubmission
+	cancelSubmission,
+	getbusinessType
 }

+ 4 - 0
src/benyun/components/byBill/billModule.vue

@@ -88,6 +88,10 @@ export default class BillModule extends Vue {
   search(){
     this.$emit('search',this.getSearchValue());
   }
+	//清除搜索条件
+	clearSearch(){
+	  (this.$refs.search as any).clearValue();
+	}
   resert(){
     if(this.$refs.search){
       (this.$refs.search as any).setValue({})

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

@@ -51,6 +51,7 @@ export default class GmTools extends Vue {
     { name: '新增', icon: 'el-icon-plus', clickName: 'onAdd', _class: 'add' },
 		{ name: '保存', icon: 'el-icon-plus', clickName: 'onSave', _class: 'save' },
     { name: '提交', icon: 'el-icon-finished', clickName: 'onSmt', _class: 'smt' },
+    { name: '返提交', icon: 'el-icon-finished', clickName: 'onReturnSmt', _class: 'returnSmt' },
     { name: '接单', icon: 'el-icon-sold-out', clickName: 'onOrder', _class: 'order' },
     { name: '派单', icon: 'el-icon-sell', clickName: 'onDispatch', _class: 'dispatch' },
     { name: '修改', icon: 'el-icon-edit', clickName: 'onUpdate', _class: 'edit' },

+ 14 - 11
src/views/audit/order/index.vue

@@ -1,7 +1,7 @@
 <template>
 	<div>
 		<by-bill ref="bill" :propConfig="config" @search="search" @onSmt="doSave" @onAdd="onAdd" @onOrder="onOrder"
-			@resert="resert" @refresh="clickHandle" @detail="openEdit" @pagination="pagination">
+			@resert="resert" @refresh="clickHandle" @detail="openEdit" @onRefresh="resert" @pagination="pagination">
 		</by-bill>
 	</div>
 </template>
@@ -15,6 +15,7 @@
 		// 右边
 		baseURL : any = process.env.VUE_APP_BASE_API
 		setStatusData : any = ''
+		pageSize : any = 15
 		timeNum = 0;
 		timer : any = null
 		config : any = {
@@ -141,7 +142,7 @@
 									title: '合计金额',
 									field: 'totalPrice',
 								},
-							]
+								]
 						}
 					}
 				]
@@ -342,11 +343,11 @@
 			})
 		}
 		// 分页
-		pagination(e:any){
+		pagination(e : any) {
 			let query = {
-				pageNo:e.page.pageNum,
-				pageSize:e.page.pageSize,
-				submitState:1
+				pageNo: e.page.pageNum,
+				pageSize: this.pageSize,
+				submitState: 1
 			};
 			// query.submitState = 1; // 已提交状态
 			api.pageList(query, 'supplyTaskOrder').then((res : any) => {
@@ -355,7 +356,7 @@
 				} else this.failHandle(res)
 			})
 		}
-		
+
 		getDataList() {
 			if (!this.$refs.bill) {
 				if (this.timeNum > 5) {
@@ -366,7 +367,7 @@
 			}
 			clearInterval(this.timer)
 			// submitState: 提交状态
-			this.getPageList({pageSize:20,pageNo:1}, 'all'); // 综合数据
+			this.getPageList({ pageSize: this.pageSize, pageNo: 1 }, 'all'); // 综合数据
 		}
 		// 获取分页数据
 		getPageList(query : any, type : any) {
@@ -376,7 +377,7 @@
 					(this.$refs.bill as any).setTabTableValue(type, res.data.records);
 					let page = {
 						pageNo: res.data.current, //当前页
-						pageSize: res.data.size, //每页条数
+						pageSize: this.pageSize, //每页条数
 						total: res.data.total //总条数
 					};
 					(this.$refs.bill as any).setTablePage(type, page)
@@ -428,8 +429,10 @@
 				})
 			}).catch(() => this.$message.info('已取消接单'));
 		}
-		resert(parames : any) {
-			console.log('重置回传参数', parames);
+		// 刷新/重置
+		resert(e : any) {
+			e = e.type ? e.type : e;
+			if (e === 'all') this.getPageList({ pageSize: this.pageSize, pageNo: 1 }, 'all'); // 综合数据
 		}
 		// 工具栏接单
 		onOrder(n : string) {

+ 179 - 116
src/views/audit/orderTask/index.vue

@@ -1,8 +1,9 @@
 <template>
 	<div>
 		<by-bill ref="bill" :propConfig="config" @search="search" @onSmt="onSmt" @onAdd="onAdd" @onDelete="onDelete"
-			@onDispatch="onDispatch" @onRefresh="onRefresh" @detail="openEdit" @onSave="onSave" @clickTab="clickTab"
-			@onChangeRow="onChangeRow" @pagination="pagination" @getSupplierModal="getSupplierModal">
+			@onDispatch="onDispatch" @onRefresh="resert" @detail="openEdit" @onSave="onSave" @clickTab="clickTab"
+			@onChangeRow="onChangeRow" @pagination="pagination" @onReturnSmt="onReturnSmt2"
+			@getSupplierModal="getSupplierModal" @resert="resert">
 		</by-bill>
 		<!-- 选择物料 -->
 		<productModal ref="product" :mulit="true" @confirm="confirmProduct" />
@@ -22,8 +23,10 @@
 		// 左边
 		tabType : any = 'all';
 		isAdd : any = false
-		pageSize : any = 15
 		supplierSelectData : any = {}
+		baseInfo : any = {}
+		isSubmit : any = false
+		isChange : any = false
 		// 右边
 		supplierInfo : any = {} // 机构信息
 		tableData : any = []
@@ -361,7 +364,7 @@
 							}, {
 								name: '反提交',
 								event: {
-									click: (item : any) => (this as any).returnSmt(item)
+									click: (item : any) => (this as any).onReturnSmt(item)
 								}
 							}]
 						}
@@ -840,49 +843,9 @@
 				this.getDataList()
 			}, 500)
 		}
-		// 工具栏提交
-		onSmt(e : any) {
-			console.log('提交 ==>', e);
-			let selectData = (this.$refs.bill as any).getTableSelectData(this.tabType); // 获取表格选中数据
-			if (selectData.length <= 0) return this.$message.warning('请选择提交数据');
-			if (selectData.length > 1) return this.$message.warning('只能提交一条数据');
-			this.$confirm('确定提交吗!', '注意', {
-				confirmButtonText: '确定',
-				cancelButtonText: '取消',
-				type: 'warning',
-				center: true
-			}).then(() => {
-				api.submitTo({ id: selectData[0].id }, 'supplyTaskOrder').then((res : any) => {
-					if (res.code === 200) {
-						this.$message.success('提交成功');
-						this.clickTab(this.tabType);
-					} else this.failHandle(res)
-				})
-			}).catch(() => this.$message.info('已取消提交'));
-		}
-		// 操作反提交
-		returnSmt(e : any) {
-			console.log('反提交 ==>', e);
-			this.$confirm('确定反提交吗!', '注意', {
-				confirmButtonText: '确定',
-				cancelButtonText: '取消',
-				type: 'warning',
-				center: true
-			}).then(() => {
-				// let query = (this.$refs.bill as any).getBillFormValue(); // 获取单据数据
-				if (this.tabType === 'smt') {
-					api.cancelSubmission({ id: e.id }, 'supplyTaskOrder').then((res : any) => {
-						if (res.code === 200) {
-							this.$message.success('反提交成功');
-							this.clickTab(this.tabType);
-						} else this.failHandle(res)
-					})
-				}
-			}).catch(() => this.$message.info('已取消反提交'));
-		}
 		// 保存
-		onSave(e : any) {
-			console.log('保存 ==>', this.tabType);
+		onSave() {
+			console.log('保存tabType ==>', this.tabType);
 			(this as any).$refs.bill.$refs.billForm.validate().then(() => {
 				let query = (this.$refs.bill as any).getBillFormValue(); // 获取单据数据
 				// 供应商数据
@@ -902,32 +865,27 @@
 				// 表格删除
 				query.suborderList.map((v : any, i : any) => {
 					if (v.isDeleted === 1 && !v.id) {
-						v.splice(i, 1)
+						query.suborderList.splice(i, 1)
 					}
 				});
 				if (query.deliveryData) query.deliveryData = query.deliveryData + ' 00:00:00';
 				console.log('保存参数query ==> ', query);
 
 				if (this.isAdd) {
-					query.submitState = 0
-					console.log('保存进草稿箱 ==>', query);
-					api.msave(query, 'supplyTaskOrder').then((res : any) => {
+					api.saveList(query, 'supplyTaskOrder').then((res : any) => {
 						if (res.code === 200) {
-							this.$message.success(res.msg);
+							this.$message.success('保存成功');
 							this.getDataList();
 							(this.$refs.bill as any).showTab = 'all';
 							(this.$refs.bill as any).setBillFormValue({});
 						} else this.$message.error(res.msg);
 					})
 				} else if (this.tabType === 'all' || this.tabType === 'draftsBox') {
-					if (this.tabType === 'draftsBox') query.submitState = 0;
-					console.log('保存 ==>', query);
 					api.updateList(query, 'supplyTaskOrder').then((res : any) => {
 						if (res.code === 200) {
-							this.$message.success(res.msg);
-							this.getDataList();
-							(this.$refs.bill as any).showTab = 'all';
-							(this.$refs.bill as any).setBillFormValue({});
+							this.$message.success('保存成功');
+							this.isChange = false;
+							this.isSubmit = true;
 						} else this.$message.error(res.msg);
 					})
 				};
@@ -936,7 +894,7 @@
 		}
 		// 打开新增
 		onAdd(e : any) {
-			console.log('新增 ==>', e);
+			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();
@@ -962,9 +920,10 @@
 		// 打开编辑
 		openEdit(e : any) {
 			e = e.row ? e.row : e;
-			console.log('编辑this.tabType ==>', this.tabType);
+			this.baseInfo = e;
+			console.log('编辑tabType ==>', this.tabType);
 			console.log('编辑 ==>', e);
-			if (e.sourceType == '手工输入' || this.tabType === 'draftsBox') {
+			if (this.tabType != 'smt' && e.sourceType == '手工输入' || this.tabType === 'draftsBox') {
 				if (this.tabType === 'all' && e.submitState === 1) return this.setReadonly(e);
 				let data = e.suborderList
 				data.map((v : any, i : any) => {
@@ -1008,24 +967,141 @@
 			let readonly = (this as any).$lodash.cloneDeep(this.config.bill);
 			readonly.form.attr.readonly = true; // 设置只读
 			readonly.tool.tools = {};
+			if (this.tabType === 'smt') readonly.tool.tools = { returnSmt: true };
 			readonly.tableConfig[0].table.columns = readonly.tableConfig[0].table.columns.filter((v : any) => v.title != '操作');
 			readonly.tableConfig[0].tool.tools = {};
-			console.log(readonly.tableConfig[0].table.columns.slice(0, -1));
 			let data = e.suborderList;
 			(this.$refs.bill as any).setBillConfig(readonly);
 			(this.$refs.bill as any).setBillFormValue(e);// 设置单据表单数据
 			(this.$refs.bill as any).setBillTableValue(data, 0);// 设置第1张单据表格数据
 			this.isAdd = false;
 			(this.$refs.bill as any).showTab = 'bill';
-
+		}
+		// 工具栏提交
+		onSmt(e : any) {
+			if (e === 'draftsBox') {
+				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('只能提交一条数据');
+				this.$confirm('确定提交吗!', '注意', {
+					confirmButtonText: '确定',
+					cancelButtonText: '取消',
+					type: 'warning',
+					center: true
+				}).then(() => {
+					api.submitTo({ id: selectData[0].id }, 'supplyTaskOrder').then((res : any) => {
+						if (res.code === 200) {
+							this.$message.success('提交成功');
+							this.clickTab('draftsBox');
+						} else this.$message.error(res.msg)
+					})
+				}).catch(() => this.$message.info('已取消提交'));
+			} else {
+				console.log('isChange ==> ', this.isChange);
+				console.log('isSubmit ==> ', this.isSubmit);
+				if (this.isSubmit) {
+					this.$confirm('确定提交吗!', '注意', {
+						confirmButtonText: '确定',
+						cancelButtonText: '取消',
+						type: 'warning',
+						center: true
+					}).then(() => {
+						api.submitTo({ id: this.baseInfo.id }, 'supplyTaskOrder').then((res : any) => {
+							if (res.code === 200) {
+								this.$message.success('提交成功');
+								this.clickTab(this.tabType);
+								this.isSubmit = false;
+								(this.$refs.bill as any).showTab = this.tabType;
+							} else this.$message.error(res.msg)
+						})
+					}).catch(() => this.$message.info('已取消提交'));
+				} else {
+					// 表单旧数据
+					let oldbillForm : any = (this as any).$lodash.cloneDeep(this.baseInfo);
+					if (oldbillForm.suborderList) delete oldbillForm.suborderList;
+					oldbillForm = JSON.stringify(oldbillForm);
+					// 表单新数据
+					let newBillForm : any = (this as any).$refs.bill.getBillFormValue();
+					if (newBillForm.suborderList) delete newBillForm.suborderList;
+					newBillForm = JSON.stringify(newBillForm);
+					// 表格旧数据
+					this.baseInfo.suborderList.map((v : any) => {
+						if (v._X_ROW_KEY) delete v._X_ROW_KEY;
+					});
+					let oldData : any = JSON.stringify(this.baseInfo.suborderList);
+					// 表格新数据
+					let newData : any = JSON.stringify((this as any).$refs.bill.getBillTableData(0));
+					// 数据有变进保存
+					if (this.isChange || oldbillForm != newBillForm || oldData != newData) {
+						return this.$message.warning('数据变更必须先保存再提交');
+					} else {
+						this.$confirm('确定提交吗!', '注意', {
+							confirmButtonText: '确定',
+							cancelButtonText: '取消',
+							type: 'warning',
+							center: true
+						}).then(() => {
+							// console.log(this.baseInfo.id);
+							api.submitTo({ 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 = this.tabType;
+								} else this.$message.error(res.msg)
+							})
+						}).catch(() => this.$message.info('已取消提交'));
+					}
+				}
+			}
+		}
+		// 操作反提交
+		onReturnSmt(e : any) {
+			console.log('反提交 ==>', e);
+			this.$confirm('确定反提交吗!', '注意', {
+				confirmButtonText: '确定',
+				cancelButtonText: '取消',
+				type: 'warning',
+				center: true
+			}).then(() => {
+				if (this.tabType === 'smt') {
+					api.cancelSubmission({ id: e.id }, 'supplyTaskOrder').then((res : any) => {
+						if (res.code === 200) {
+							this.$message.success('反提交成功');
+							this.clickTab(this.tabType);
+						} else this.$message.error(res.msg)
+					})
+				}
+			}).catch(() => this.$message.info('已取消反提交'));
+		}
+		// 工具栏反提交
+		onReturnSmt2() {
+			console.log('工具栏反提交 ==>', this.baseInfo);
+			this.$confirm('确定反提交吗!', '注意', {
+				confirmButtonText: '确定',
+				cancelButtonText: '取消',
+				type: 'warning',
+				center: true
+			}).then(() => {
+				if (this.tabType === 'smt') {
+					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';
+						} else this.$message.error(res.msg)
+					})
+				}
+			}).catch(() => this.$message.info('已取消反提交'));
 		}
 		// 获取机构数据
 		getSupplierModal(e : any) {
-			console.log('获取机构数据 ==> ', e);
+			// console.log('获取机构数据 ==> ', e);
 			this.supplierInfo = e;
 		}
 		// 监听表格数据变化
 		onChangeRow(e : any) {
+			this.isChange = true;
+			this.isSubmit = false;
 			e.realityPrice = parseFloat((e.number * e.unitPrice).toFixed(2));
 			e.totalPrice = e.realityPrice - e.prePrice;
 		}
@@ -1035,17 +1111,13 @@
 			goodsData = goodsData.map((item : any) => {
 				item.materialName = item.skuTitle
 				item.prePrice = 0
-				// item.materialId = item.materialId
 				item.unitPrice = item.price
 				item.materialSku = item.id
 				const { id, ...newData } = item
-				// const { skuTitle, price, id, materialId, ...newData } = item
 				return newData
 			})
 			this.tableData = this.tableData.concat(goodsData);
 			newArr = this.tableData.reduce((prev : any, current : any) => {
-				// console.log('prev ==> ', prev);
-				// console.log('current ==> ', current);
 				obj[current.materialSku] ? contents.push(current.materialName) : (obj[current.materialSku] = true && prev.push(current))
 				return prev
 			}, []);
@@ -1066,7 +1138,7 @@
 			console.log('派单 ==>', e);
 			this.supplierSelectData = (this.$refs.bill as any).getTableSelectData(this.tabType); // 获取表格选中数据
 			if (this.supplierSelectData.length <= 0) return this.$message.warning('请选择派单数据');
-			if (this.supplierSelectData.length >1) return this.$message.warning('只能派单一条数据');
+			if (this.supplierSelectData.length > 1) return this.$message.warning('只能派单一条数据');
 			(this.$refs.supplierModal as any).setShow(true);
 		}
 		// 派单确认
@@ -1088,13 +1160,12 @@
 		}
 		// 切换tab栏
 		clickTab(e : any) {
-			console.log('切换tab ==> ', e);
 			this.tabType = e;
 			// submitState: 提交状态
-			if (e === 'all') this.getPageList({ pageSize: this.pageSize, pageNo: 1 }, 'all'); // 草稿箱数据
+			if (e === 'all') this.getPageList({}, 'all'); // 综合数据
 			if (e === 'draftsBox') this.getPageList({ submitState: 0 }, 'draftsBox'); // 草稿箱数据
 			if (e === 'smt') this.getPageList({ submitState: 1 }, 'smt'); // 已提交数据
-			if (e === 'recycleBin') this.getSelectDeleteList({ pageNo: 1, pageSize: this.pageSize }); // 回收站数据
+			if (e === 'recycleBin') this.getSelectDeleteList({}) // 回收站数据
 		}
 		// 初始化
 		getDataList() {
@@ -1106,22 +1177,35 @@
 				return
 			}
 			clearInterval(this.timer)
-			this.getPageList({ pageSize: this.pageSize, pageNo: 1 }, 'all'); // 综合数据
+			this.getPageList({}, 'all'); // 综合数据
+		}
+		// 获取分页数据
+		getPageList(query : any, type : any) {
+			api.pageList(query, 'supplyTaskOrder').then((res : any) => {
+				if (res.code === 200) {
+					(this.$refs.bill as any).setTabTableValue(type, res.data.records);
+					let page = {
+						pageNo: res.data.current, //当前页
+						pageSize: res.data.size, //每页条数
+						total: res.data.total //总条数
+					};
+					(this.$refs.bill as any).setTablePage(type, page)
+				} else this.$message.error(res.msg)
+			})
 		}
 		// 分页
 		pagination(e : any) {
-			console.log('分页 ==> ', e);
-			let query : any = {
-				pageNo: e.page.pageNum,
-				pageSize: this.pageSize,
-			};
+			let query : any = (this as any).$refs.bill.getSearchValue(e.type);
+			query.pageNo = e.page.pageNum;
+			query.pageSize = e.page.pageSize;
+			console.log('分页 ==> ', query);
 			let loading = this.$loading({ target: '.main-container' });
 			if (e.type === 'recycleBin') {
 				api.selectDeleteList(query, 'supplyTaskOrder').then((res : any) => {
 					if (res.code === 200) {
 						(this.$refs.bill as any).setTabTableValue('recycleBin', res.data.records);
 						loading.close()
-					} else this.failHandle(res)
+					} else this.$message.error(res.msg)
 				});
 			} else {
 				console.log(this.tabType);
@@ -1131,24 +1215,9 @@
 					if (res.code === 200) {
 						(this.$refs.bill as any).setTabTableValue(e.type, res.data.records);
 						loading.close()
-					} else this.failHandle(res)
+					} else this.$message.error(res.msg)
 				})
 			}
-
-		}
-		// 获取分页数据
-		getPageList(query : any, type : any) {
-			api.pageList(query, 'supplyTaskOrder').then((res : any) => {
-				if (res.code === 200) {
-					(this.$refs.bill as any).setTabTableValue(type, res.data.records);
-					let page = {
-						pageNo: res.data.current, //当前页
-						pageSize: this.pageSize, //每页条数
-						total: res.data.total //总条数
-					};
-					(this.$refs.bill as any).setTablePage(type, page)
-				} else this.failHandle(res)
-			})
 		}
 		// 回收站数据
 		getSelectDeleteList(query : any) {
@@ -1157,17 +1226,17 @@
 					(this.$refs.bill as any).setTabTableValue('recycleBin', res.data.records);
 					let page = {
 						pageNo: res.data.current, //当前页
-						pageSize: this.pageSize, //每页条数
+						pageSize: res.data.size, //每页条数
 						total: res.data.total //总条数
 					};
 					(this.$refs.bill as any).setTablePage('recycleBin', page)
-				} else this.failHandle(res)
+				} else this.$message.error(res.msg)
 			});
 		}
 		// 搜索
 		search(parames : any) {
 			let loading = this.$loading({ target: '.main-container' });
-			let query = parames.value
+			let query = parames.value;
 			if (parames.type === 'draftsBox') query.submitState = 0 // 草稿箱数据
 			if (parames.type === 'smt') query.submitState = 1 // 已提交数据
 			console.log('搜索 ==> ', query);
@@ -1179,14 +1248,14 @@
 				loading.close()
 			}
 		}
-		// 刷新
-		onRefresh(e : any) {
-			console.log('刷新 ==>', e);
-			(this as any).$refs.bill.$refs[e].resert();
-			if (e === 'all') this.getPageList({}, 'all'); // 综合查询
-			if (e === 'draftsBox') this.getPageList({ submitState: 0 }, 'draftsBox'); // 草稿箱数据
-			if (e === 'smt') this.getPageList({ submitState: 1 }, 'smt'); // 已提交数据
-			if (e === 'recycleBin') this.getSelectDeleteList({}) // 回收站数据
+		// 刷新/重置
+		resert(e : any) {
+			let data:any = e.type ? e.type : e;
+			(this as any).$refs.bill.$refs[data].clearSearch();
+			if (data === 'all') this.getPageList({}, 'all'); // 综合数据
+			if (data === 'draftsBox') this.getPageList({ submitState: 0 }, 'draftsBox'); // 草稿箱数据
+			if (data === 'smt') this.getPageList({ submitState: 1 }, 'smt'); // 已提交数据
+			if (data === 'recycleBin') this.getSelectDeleteList({}) // 回收站数据
 		}
 		// 单据表格删除
 		changeTable(item : any) {
@@ -1208,24 +1277,23 @@
 		onDelete(e : any) {
 			console.log('工具栏删除 ==> ', e);
 			let selectData = (this.$refs.bill as any).getTableSelectData(e)
-			let ids = '';
+			let ids : any = [];
 			if (selectData.length > 0) {
 				selectData.map((v : any) => {
-					ids += v.id + ','
+					ids.push(v.id)
 				})
 			} else return this.$message({ type: 'warning', message: '请选择删除数据' })
-			ids = ids.slice(0, ids.length - 1);
 			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
 				confirmButtonText: '确定',
 				cancelButtonText: '取消',
 				type: 'warning',
 				center: true
 			}).then(() => {
-				api.deleteList({ ids: ids }, 'supplyTaskOrder').then((res : any) => {
+				api.deleteList(ids, 'supplyTaskOrder').then((res : any) => {
 					if (res.code === 200) {
 						this.clickTab(this.tabType);
 						this.$message.success('删除成功!');
-					} else this.failHandle(res)
+					} else this.$message.error(res.msg)
 				})
 			}).catch(() => this.$message.info('已取消删除'));
 		}
@@ -1241,14 +1309,9 @@
 					if (res.code === 200) {
 						this.clickTab(this.tabType);
 						this.$message.success('删除成功!');
-					} else this.failHandle(res)
+					} else this.$message.error(res.msg)
 				})
 			}).catch(() => this.$message.info('已取消删除'));
 		}
-		// 运行错误
-		failHandle(err : any) {
-			let msg = err.msg ? err.msg : '运行错误!';
-			this.$message.error(msg)
-		}
 	}
 </script>

+ 1 - 1
src/views/audit/outbound/index.vue

@@ -945,7 +945,7 @@
 				// 表格删除
 				query.suborderList.map((v : any, i : any) => {
 					if (v.isDeleted === 1 && !v.id) {
-						v.splice(i, 1)
+						query.suborderList.splice(i, 1)
 					}
 				});
 				if (query.deliveryData) query.deliveryData = query.deliveryData + ' 00:00:00';

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

@@ -1281,14 +1281,12 @@
 		forFun(data : any, i : number, v ?: any) {
 			if (data.list) {
 				let d : Array<any> = [];
-				// data.list = data.list.reverse()
 				data.list.forEach((item : any) => {
 					if (i == 0) { // 第一次循环
 						let obj : any = {}
 						obj[data.field] = item
 						d.push(obj);
 					} else {
-						// v = v.reverse()
 						v.forEach((ele : any) => {
 							let obj : any = {};
 							obj = (this as any).$lodash.clone(ele);

+ 21 - 18
src/views/audit/saleOrder/index.vue

@@ -649,24 +649,6 @@
 			(this.$refs.bill as any).setBillTableValue(e.suborderList, 0);// 设置第1张单据表格数据
 			(this.$refs.bill as any).showTab = 'bill';
 		}
-		// 单据操作退单
-		doBackOrder2(e : any) {
-			console.log(e);
-			this.$confirm('确定退单吗!', '注意', {
-				confirmButtonText: '确定',
-				cancelButtonText: '取消',
-				type: 'warning',
-				center: true
-			}).then(() => {
-				api.backOrder({ mid: e.id }, 'supplyPurchaseOrder', e.id).then((res : any) => {
-					if (res.code === 200) {
-						this.$message.success('退单成功!');
-						this.getDataList();
-						(this.$refs.bill as any).showTab = 'all';
-					} else this.$message.error(res.msg)
-				})
-			}).catch(() => this.$message.info('已取消退单'));
-		}
 		// 工具栏退单
 		doBackOrder() {
 			let selectData = (this as any).$refs.bill.getTableSelectData('all');
@@ -706,6 +688,27 @@
 				(this.$refs.bill as any).setBillConfig(billConfig);
 			}
 		}
+		// 单据操作退单
+		doBackOrder2(e : any) {
+			console.log(e);
+			e.suborderList.map((v : any) => {
+				delete v.id;
+			})
+			this.$confirm('确定退单吗!', '注意', {
+				confirmButtonText: '确定',
+				cancelButtonText: '取消',
+				type: 'warning',
+				center: true
+			}).then(() => {
+				api.backOrder(e.suborderList, 'supplyPurchaseOrder', e.id).then((res : any) => {
+					if (res.code === 200) {
+						this.$message.success('退单成功!');
+						this.getDataList();
+						(this.$refs.bill as any).showTab = 'all';
+					} else this.$message.error(res.msg)
+				})
+			}).catch(() => this.$message.info('已取消退单'));
+		}
 		// 分页
 		pagination(e : any) {
 			let query = {

+ 1 - 1
src/views/audit/warehousing/index.vue

@@ -755,7 +755,7 @@
 				// 表格删除
 				query.suborderList.map((v : any, i : any) => {
 					if (v.isDeleted === 1 && !v.id) {
-						v.splice(i, 1)
+						query.suborderList.splice(i, 1)
 					}
 				});