AlanWong 2 роки тому
батько
коміт
6ad2a3d758

+ 9 - 9
src/views/audit/agencyGoods/index.vue

@@ -236,7 +236,7 @@
 							attr: {
 								size: 'mini',
 								placeholder: '请输入备注',
-								type:'textarea'
+								type: 'textarea'
 							},
 						}
 					},
@@ -255,6 +255,7 @@
 			this.parentIds = e.id;
 			let loading = this.$loading({ target: '.main-container' });
 			api.childrenTreeList(data, 'maindataMaterialOrganizationCategory').then((res : any) => {
+				loading.close();
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
 					let page = {
@@ -263,9 +264,8 @@
 						total: res.data.total //总条数
 					};
 					(this.$refs.moduleView as any).setPage(page);
-					loading.close();
 				}
-			})
+			}).catch(() => loading.close());
 		}
 		// 确认新增/编辑
 		confirm() {
@@ -310,6 +310,7 @@
 		getPageList(query : any) {
 			let loading = this.$loading({ target: '.main-container' });
 			api.pageList(query, 'maindataMaterialOrganizationCategory').then((res : any) => {
+				loading.close();
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
 					let page = {
@@ -318,9 +319,8 @@
 						total: res.data.total //总条数
 					};
 					(this.$refs.moduleView as any).setPage(page);
-					loading.close();
 				} else this.$message.error(res.msg);
-			})
+			}).catch(() => loading.close());
 		}
 		// 工具栏方法
 		clickHandle(e : any) {
@@ -343,15 +343,15 @@
 					let data = res.data;
 					this.radio = data.status;
 					api.single({ id: data.parentId }, 'maindataMaterialOrganizationCategory').then((v : any) => {
+						loading.close();
 						if (v.code === 200) {
-							loading.close();
 							data.parentName = v.data.name;
 							this.dialogFormVisible = true;
-							setTimeout(() => {(this as any).$refs.addFormId.setValue(data)},0);
+							setTimeout(() => { (this as any).$refs.addFormId.setValue(data) }, 0);
 						}
-					})
+					}).catch(() => loading.close());
 				}
-			})
+			}).catch(() => loading.close());
 		}
 		// 操作删除
 		doDelete(item : any) {

+ 5 - 10
src/views/audit/attribute/index.vue

@@ -309,13 +309,11 @@
 				query.attributeValue = JSON.stringify(this.tableConfig)
 				this.dialogFormVisible = false;
 				console.log(query);
-				let loading = this.$loading({ target: '.main-container' });
 				if (this.popTitle === '新增') {
 					api.saveList(query, 'maindataMaterialAttribute').then((res : any) => {
 						if (res.code === 200) {
 							this.$message.success('新增成功');
 							this.getDataList();
-							loading.close();
 						} else this.$message.error(res.msg);
 					})
 				} else if (this.popTitle === '编辑') {
@@ -323,7 +321,6 @@
 						if (res.code === 200) {
 							this.$message.success('编辑成功');
 							this.getDataList();
-							loading.close();
 						} else this.$message.error(res.msg);
 					})
 				}
@@ -347,6 +344,7 @@
 		getPageList(query : any) {
 			let loading = this.$loading({ target: '.main-container' });
 			api.pageList(query, 'maindataMaterialAttribute').then((res : any) => {
+				loading.close();
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
 					let page = {
@@ -355,9 +353,8 @@
 						total: res.data.total //总条数
 					};
 					(this.$refs.moduleView as any).setPage(page);
-					loading.close();
 				} else this.$message.error(res.msg);
-			})
+			}).catch(() => loading.close());
 		}
 		// 工具栏方法
 		clickHandle(e : any) {
@@ -377,17 +374,15 @@
 			this.popTitle = '编辑';
 			let loading = this.$loading({ target: '.main-container' });
 			api.single({ id: e.id }, 'maindataMaterialAttribute').then((res : any) => {
+				loading.close();
 				if (res.code === 200) {
 					let data = res.data;
 					this.dialogFormVisible = true;
 					this.radio = data.status;
 					if (data.attributeValue) this.tableConfig = JSON.parse(data.attributeValue);
-					// console.log(this.tableConfig);
-					loading.close();
-					setTimeout(() => {(this as any).$refs.addFormId.setValue(data)},0);
-					// this.$nextTick(() => (this as any).$refs.addFormId.setValue(data));
+					setTimeout(() => { (this as any).$refs.addFormId.setValue(data) }, 0);
 				}
-			})
+			}).catch(() => loading.close());
 		}
 		// 工具栏删除
 		onDelete() {

+ 4 - 11
src/views/audit/brand/index.vue

@@ -210,23 +210,20 @@
 				console.log(query);
 				query.status = this.radio;
 				this.dialogFormVisible = false;
-				let loading = this.$loading({ target: '.main-container' });
 				if (this.popTitle === '新增') {
 					api.saveList(query, 'maindataMaterialBrand').then((res : any) => {
-						loading.close();
 						if (res.code === 200) {
 							this.$message.success('新增成功');
 							this.getDataList();
 						} else this.$message.error(res.msg);
-					}).catch(() => loading.close());
+					})
 				} else if (this.popTitle === '编辑') {
 					api.updateList(query, 'maindataMaterialBrand').then((res : any) => {
-						loading.close();
 						if (res.code === 200) {
 							this.$message.success('编辑成功');
 							this.getDataList();
 						} else this.$message.error(res.msg);
-					}).catch(() => loading.close());
+					})
 				}
 			})
 		}
@@ -300,14 +297,12 @@
 				type: 'warning',
 				center: true
 			}).then(() => {
-				let loading = this.$loading({ target: '.main-container' });
 				api.deleteList({ ids: ids }, 'maindataMaterialBrand').then((res : any) => {
-					loading.close();
 					if (res.code === 200) {
 						this.getDataList();
 						this.$message.success('删除成功');
 					} else this.$message.error(res.msg);
-				}).catch(() => loading.close());
+				})
 			}).catch(() => this.$message.info('已取消删除'));
 		}
 		// 操作删除
@@ -318,14 +313,12 @@
 				type: 'warning',
 				center: true
 			}).then(() => {
-				let loading = this.$loading({ target: '.main-container' });
 				api.deleteList({ ids: item.id }, 'maindataMaterialBrand').then((res : any) => {
-					loading.close();
 					if (res.code === 200) {
 						this.getDataList();
 						this.$message.success('删除成功');
 					} else this.$message.error(res.msg);
-				}).catch(() => loading.close());
+				})
 			}).catch(() => this.$message.info('已取消删除'));
 		}
 		// 刷新/重置

+ 81 - 91
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" @onRefresh="resert" @pagination="pagination">
+		<by-bill ref="bill" :propConfig="config" @search="search" @resert="resert" @detail="openEdit" @onRefresh="resert"
+			@pagination="pagination" @onOrder="onOrder" @clickTab="clickTab">
 		</by-bill>
 	</div>
 </template>
@@ -12,22 +12,25 @@
 	import Assembly from "@/components/Assembly/order.vue";
 	@Component
 	export default class Order extends Vue {
-		// 右边
-		baseURL : any = process.env.VUE_APP_BASE_API
-		setStatusData : any = ''
 		timeNum = 0;
 		timer : any = null
+		baseInfo : any = {}
 		config : any = {
 			attr: {
 				activeName: 'all'
 			},
 			// 单据
 			bill: {
-				log:{
-				  request:{
-				    url:'/supply/supplyTaskOrderOperateLog/page',
-				    method:'GET'
-				  }
+				tool: {
+					tools: {
+						order: true,
+					}
+				},
+				log: {
+					request: {
+						url: '/supply/supplyTaskOrderOperateLog/page',
+						method: 'GET'
+					}
 				},
 				form: {
 					attr: {
@@ -309,60 +312,6 @@
 				this.getDataList()
 			}, 500)
 		}
-		// 工具栏方法
-		clickHandle(e : any) {
-			console.log('工具栏方法 ==> ', e);
-		}
-		// 保存新增
-		doSave() {
-			// (this.$refs.product as any).setShow(true)
-			(this as any).$refs.bill.$refs.billForm.validate().then(() => {
-				let query = (this as any).$refs.bill.$refs.billForm.getValue();
-				// query.suborderList = [] // 子表单数据
-				api.saveList(query, 'supplyTaskOrder').then((res : any) => {
-					if (res.code === 200) {
-						this.$message({
-							type: 'success',
-							message: '提交成功!'
-						});
-						this.getDataList();
-						(this.$refs.bill as any).showTab = 'all';
-						(this.$refs.bill as any).setBillFormValue({});
-					} else this.failHandle(res)
-				})
-			})
-		}
-		// 保存修改
-		orderTaking() {
-			let query : any = (this as any).$refs.bill.$refs.billForm.getValue();
-			api.updateList(query, 'supplyTaskOrder').then((res : any) => {
-				if (res.code === 200) {
-					this.$message({
-						type: 'success',
-						message: '保存成功!'
-					});
-					this.getDataList();
-					(this.$refs.bill as any).showTab = 'all';
-					(this.$refs.bill as any).setBillFormValue({});
-				} else this.failHandle(res)
-			})
-		}
-		// 分页
-		pagination(e : any) {
-			let query : any = (this as any).$refs.bill.getSearchValue(e.type);
-			query.pageNo = e.page.pageNum;
-			query.pageSize = e.page.pageSize;
-			query.submitState = 1;
-			let loading = this.$loading({ target: '.main-container' });
-			// query.submitState = 1; // 已提交状态
-			api.pageList(query, 'supplyTaskOrder').then((res : any) => {
-				if (res.code === 200) {
-					(this.$refs.bill as any).setTabTableValue(e.type, res.data.records);
-					loading.close()
-				} else this.failHandle(res)
-			})
-		}
-
 		getDataList() {
 			if (!this.$refs.bill) {
 				if (this.timeNum > 5) {
@@ -372,13 +321,18 @@
 				return
 			}
 			clearInterval(this.timer)
-			// submitState: 提交状态
 			this.getPageList({}, 'all'); // 综合数据
 		}
 		// 获取分页数据
 		getPageList(query : any, type : any) {
+			let data = (this.$refs.bill as any).getTablePage('all');
+			query.pageNo = data.pageNo;
+			query.pageSize = data.pageSize;
 			query.submitState = 1; // 已提交状态
+			console.log('分页数据 ==> ', query);
+			let loading = this.$loading({ target: '.main-container' });
 			api.pageList(query, 'supplyTaskOrder').then((res : any) => {
+				loading.close();
 				if (res.code === 200) {
 					(this.$refs.bill as any).setTabTableValue(type, res.data.records);
 					let page = {
@@ -387,39 +341,84 @@
 						total: res.data.total //总条数
 					};
 					(this.$refs.bill as any).setTablePage(type, page)
-				} else this.failHandle(res)
-			})
-		}
-		// 打开新增
-		onAdd(e : any) {
-			console.log(e);
-			(this.$refs.bill as any).setBillFormValue({}); // 设置单据表单数据
-			(this.$refs.bill as any).showTab = 'bill';
+				} else this.$message.error(res.msg)
+			}).catch(() => loading.close());
 		}
+		// 分页
+		pagination(e : any) {
+			let query : any = (this as any).$refs.bill.getSearchValue(e.type);
+			query.pageNo = e.page.pageNum;
+			query.pageSize = e.page.pageSize;
+			query.submitState = 1;
+			let loading = this.$loading({ target: '.main-container' });
+			api.pageList(query, 'supplyTaskOrder').then((res : any) => {
+				loading.close();
+				if (res.code === 200) {
+					(this.$refs.bill as any).setTabTableValue(e.type, res.data.records);
+				} else this.$message.error(res.msg)
+			}).catch(() => loading.close());
+		};
 		// 打开编辑
 		openEdit(e : any) {
 			e = e.row ? e.row : e;
 			let loading = this.$loading({ target: '.main-container' });
 			api.single({ id: e.id }, 'supplyTaskOrder').then((res : any) => {
+				loading.close();
 				if (res.code === 200) {
 					let parentData = res.data ? res.data : e;
+					let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
+					this.baseInfo = parentData;
+					billConfig.tool.tools = {};
+					if (parentData.status === 0) billConfig.tool.tools = { order: true, };
+					(this.$refs.bill as any).setBillConfig(billConfig);
 					(this.$refs.bill as any).setBillFormValue(parentData); // 设置单据表单数据
 					(this.$refs.bill as any).setBillTableValue(parentData.suborderList, 0);// 设置第1张单据表格数据
 					(this.$refs.bill as any).showTab = 'bill';
-					loading.close();
-				} else loading.close();
-			});
+				}
+			}).catch(() => loading.close());
+		}
+		// 切换tab栏
+		clickTab(e : any) {
+			(this.$refs.bill as any).showTab = e;
+			if (e === 'all') this.getPageList({}, 'all'); // 综合数据
+			if (e === 'bill') {
+				let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
+				billConfig.tool.tools = {};
+				(this.$refs.bill as any).setBillConfig(billConfig);
+			}
 		}
 		// 搜索
 		search(parames : any) {
-			let loading = this.$loading({ target: '.main-container' });
 			let query = parames.value
 			if (parames.type === 'draftsBox') query.submitState = 0 // 草稿箱数据
 			if (parames.type === 'smt') query.submitState = 1 // 草稿箱数据
 			this.getPageList(query, parames.type) // 获取分页数据
-			loading.close();
 		}
-		// 接单
+		// 工具栏接单
+		onOrder() {
+			this.$confirm('确定接单吗', '注意', {
+				confirmButtonText: '确定',
+				cancelButtonText: '取消',
+				type: 'warning',
+				center: true
+			}).then(() => {
+				let loading = this.$loading({ target: '.main-container' });
+				api.ordersaccepting({ ids: this.baseInfo.id }, 'supplyTaskOrder').then((res : any) => {
+					loading.close();
+					if (res.code === 200) {
+						this.$message.success('接单成功');
+						this.clickTab('all');
+						this.$confirm('是否跳转销售订单', '提示', {
+							confirmButtonText: '确定',
+							cancelButtonText: '取消',
+						}).then(() => {
+							this.$router.push('/document/saleOrder');
+						}).catch(() => { });
+					} else this.$message.error(res.msg)
+				}).catch(() => loading.close());
+			}).catch(() => this.$message.info('已取消接单'));
+		}
+		// 操作接单
 		getOrder(item : any) {
 			this.$confirm('确定接单吗', '注意', {
 				confirmButtonText: '确定',
@@ -429,15 +428,15 @@
 			}).then(() => {
 				api.ordersaccepting({ ids: item.id }, 'supplyTaskOrder').then((res : any) => {
 					if (res.code === 200) {
-						this.getDataList();
-						this.$message.success('接单成功!');
+						this.$message.success('接单成功');
+						this.clickTab('all');
 						this.$confirm('是否跳转销售订单', '提示', {
 							confirmButtonText: '确定',
 							cancelButtonText: '取消',
 						}).then(() => {
 							this.$router.push('/document/saleOrder');
 						})
-					} else this.failHandle(res)
+					} else this.$message.error(res.msg)
 				})
 			}).catch(() => this.$message.info('已取消接单'));
 		}
@@ -447,14 +446,5 @@
 			(this as any).$refs.bill.$refs[data].clearSearch();
 			if (data === 'all') this.getPageList({}, 'all'); // 综合数据
 		}
-		// 工具栏接单
-		onOrder(n : string) {
-			console.log(n + ':工具栏执行操作onOrder')
-		}
-		// 运行错误
-		failHandle(err : any) {
-			let msg = err.msg ? err.msg : '运行错误!';
-			this.$message.error(msg)
-		}
 	}
 </script>

+ 40 - 44
src/views/audit/orderTask/index.vue

@@ -856,7 +856,6 @@
 				let query = (this.$refs.bill as any).getBillFormValue(); // 获取单据数据
 				// 手机验证
 				let reg = /^1[3456789]\d{9}$/;
-				// let reg = /^0\d{2,3}-\d{7,8}$/ 
 				if (query.deliveryPhone && !reg.test(query.deliveryPhone)) return this.$message.warning('请输入正确手机号码');
 				// 供应商数据
 				if (!query.organizationName) query.organizationName = this.supplierInfo.name;
@@ -883,8 +882,8 @@
 				let loading = this.$loading({ target: '.main-container' });
 				if (this.isAdd) {
 					api.saveList(query, 'supplyTaskOrder').then((res : any) => {
+						loading.close();
 						if (res.code === 200) {
-							loading.close();
 							this.isAdd = false;
 							this.isChange = false;
 							this.isSubmit = true;
@@ -894,8 +893,8 @@
 					}).catch(() => loading.close());
 				} else if (this.tabType === 'all' || this.tabType === 'draftsBox') {
 					api.updateList(query, 'supplyTaskOrder').then((res : any) => {
+						loading.close();
 						if (res.code === 200) {
-							loading.close();
 							this.$message.success('保存成功');
 							this.isChange = false;
 							this.isSubmit = true;
@@ -939,13 +938,13 @@
 					if (parentData.sourceType === '手工输入') {
 						// 已提交
 						if (parentData.submitState === 1) {
-							loading.close();
-							return this.setReadonly(parentData, true)
+							this.setReadonly(parentData, true);
+							return loading.close();
 						};
 						// 回收站
 						if (this.tabType === 'recycleBin') {
-							loading.close();
-							return this.setReadonly(parentData, false)
+							this.setReadonly(parentData, false);
+							return loading.close();
 						};
 						let data = parentData.suborderList
 						data.map((v : any) => {
@@ -982,8 +981,8 @@
 						(this.$refs.bill as any).showTab = 'bill';
 						loading.close();
 					} else {
-						loading.close();
 						this.setReadonly(parentData, false);
+						loading.close();
 					};
 				}
 			})
@@ -1009,44 +1008,43 @@
 				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: '取消',
 					type: 'warning',
 					center: true
 				}).then(() => {
+					let loading = this.$loading({ target: '.main-container' });
 					api.submitTo({ id: selectData[0].id }, 'supplyTaskOrder').then((res : any) => {
+						loading.close();
 						if (res.code === 200) {
 							this.$message.success('提交成功');
 							this.clickTab('draftsBox');
-							loading.close();
 						} else this.$message.error(res.msg)
-					})
+					}).catch(() => loading.close());
 				}).catch(() => this.$message.info('已取消提交'));
 			} else {
 				if (this.isAdd) return this.$message.warning('新增数据必须先保存才能提交');
 				console.log('isChange ==> ', this.isChange);
 				console.log('isSubmit ==> ', this.isSubmit);
 				if (this.isSubmit) {
-					let loading = this.$loading({ target: '.main-container' });
 					this.$confirm('确定提交吗!', '注意', {
 						confirmButtonText: '确定',
 						cancelButtonText: '取消',
 						type: 'warning',
 						center: true
 					}).then(() => {
+						let loading = this.$loading({ target: '.main-container' });
 						let id = this.dataId ? this.dataId : this.baseInfo.id;
 						api.submitTo({ id: id }, 'supplyTaskOrder').then((res : any) => {
+							loading.close();
 							if (res.code === 200) {
 								this.$message.success('提交成功');
-								this.clickTab(this.tabType);
 								this.isSubmit = false;
 								this.dataId = '';
-								(this.$refs.bill as any).showTab = this.tabType;
-								loading.close();
+								this.clickTab(this.tabType);
 							} else this.$message.error(res.msg)
-						})
+						}).catch(() => loading.close());
 					}).catch(() => this.$message.info('已取消提交'));
 				} else {
 					// 表单旧数据
@@ -1068,20 +1066,18 @@
 					if (this.isChange || oldbillForm != newBillForm || oldData != newData) {
 						return this.$message.warning('数据变更必须先保存再提交');
 					} else {
-						let loading = this.$loading({ target: '.main-container' });
 						this.$confirm('确定提交吗!', '注意', {
 							confirmButtonText: '确定',
 							cancelButtonText: '取消',
 							type: 'warning',
 							center: true
 						}).then(() => {
-							// console.log(this.baseInfo.id);
+							let loading = this.$loading({ target: '.main-container' });
 							api.submitTo({ id: this.baseInfo.id }, 'supplyTaskOrder').then((res : any) => {
+								loading.close();
 								if (res.code === 200) {
 									this.$message.success('提交成功');
 									this.clickTab(this.tabType);
-									(this.$refs.bill as any).showTab = this.tabType;
-									loading.close();
 								} else this.$message.error(res.msg)
 							}).catch(() => loading.close());
 						}).catch(() => this.$message.info('已取消提交'));
@@ -1092,18 +1088,18 @@
 		// 操作反提交
 		onReturnSmt(e : any) {
 			console.log('反提交 ==>', e);
-			let loading = this.$loading({ target: '.main-container' });
 			this.$confirm('确定反提交吗!', '注意', {
 				confirmButtonText: '确定',
 				cancelButtonText: '取消',
 				type: 'warning',
 				center: true
 			}).then(() => {
+				let loading = this.$loading({ target: '.main-container' });
 				api.cancelSubmission({ id: e.id }, 'supplyTaskOrder').then((res : any) => {
+					loading.close();
 					if (res.code === 200) {
 						this.$message.success('反提交成功');
 						this.clickTab(this.tabType);
-						loading.close();
 					} else this.$message.error(res.msg)
 				}).catch(() => loading.close());
 			}).catch(() => this.$message.info('已取消反提交'));
@@ -1119,11 +1115,10 @@
 			}).then(() => {
 				let loading = this.$loading({ target: '.main-container' });
 				api.cancelSubmission({ id: this.baseInfo.id }, 'supplyTaskOrder').then((res : any) => {
+					loading.close();
 					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)
 				}).catch(() => loading.close());
 			}).catch(() => this.$message.info('已取消反提交'));
@@ -1148,8 +1143,8 @@
 			if (query.length > 1) return this.$message.warning('只能派单一条数据');
 			let loading = this.$loading({ target: '.main-container' });
 			api.single({ id: query[0].id }, 'supplyTaskOrder').then((res : any) => {
+				loading.close();
 				if (res.code === 200) {
-					loading.close();
 					this.supplierSelectData = res.data;
 					(this.$refs.supplierModal as any).setShow(true);
 				}
@@ -1164,11 +1159,10 @@
 				console.log(query);
 				let loading = this.$loading({ target: '.main-container' });
 				api.updateList(query, 'supplyTaskOrder').then((res : any) => {
+					loading.close();
 					if (res.code === 200) {
 						this.$message.success('派单成功');
-						this.getDataList();
-						(this.$refs.bill as any).showTab = 'all';
-						loading.close();
+						this.clickTab(this.tabType);
 					} else this.$message.error(res.msg);
 				}).catch(() => loading.close());
 			}
@@ -1176,6 +1170,7 @@
 		// 切换tab栏
 		clickTab(e : any) {
 			this.tabType = e;
+			(this.$refs.bill as any).showTab = e;
 			// submitState: 提交状态
 			if (e === 'all') this.getPageList({}, 'all'); // 综合数据
 			if (e === 'draftsBox') this.getPageList({ submitState: 0 }, 'draftsBox'); // 草稿箱数据
@@ -1202,8 +1197,13 @@
 		}
 		// 获取分页数据
 		getPageList(query : any, type : any) {
+			let data = (this.$refs.bill as any).getTablePage(this.tabType);
+			query.pageNo = data.pageNo;
+			query.pageSize = data.pageSize;
+			console.log('分页数据 ==> ', query);
 			let loading = this.$loading({ target: '.main-container' });
 			api.pageList(query, 'supplyTaskOrder').then((res : any) => {
+				loading.close();
 				if (res.code === 200) {
 					(this.$refs.bill as any).setTabTableValue(type, res.data.records);
 					let page = {
@@ -1212,7 +1212,6 @@
 						total: res.data.total //总条数
 					};
 					(this.$refs.bill as any).setTablePage(type, page);
-					loading.close();
 				} else this.$message.error(res.msg)
 			}).catch(() => loading.close());
 		}
@@ -1224,9 +1223,9 @@
 			let loading = this.$loading({ target: '.main-container' });
 			if (e.type === 'recycleBin') {
 				api.selectDeleteList(query, 'supplyTaskOrder').then((res : any) => {
+					loading.close();
 					if (res.code === 200) {
 						(this.$refs.bill as any).setTabTableValue('recycleBin', res.data.records);
-						loading.close();
 					} else this.$message.error(res.msg)
 				}).catch(() => loading.close());
 			} else {
@@ -1234,16 +1233,18 @@
 				if (e.type == 'draftsBox') query.submitState = 0; // 草稿箱数据
 				if (e.type == 'smt') query.submitState = 1; // 已提交数据
 				api.pageList(query, 'supplyTaskOrder').then((res : any) => {
+					loading.close();
 					if (res.code === 200) {
 						(this.$refs.bill as any).setTabTableValue(e.type, res.data.records);
-						loading.close();
 					} else this.$message.error(res.msg)
 				}).catch(() => loading.close());
 			}
 		}
 		// 回收站数据
 		getSelectDeleteList(query : any) {
+			let loading = this.$loading({ target: '.main-container' });
 			api.selectDeleteList(query, 'supplyTaskOrder').then((res : any) => {
+				loading.close();
 				if (res.code === 200) {
 					(this.$refs.bill as any).setTabTableValue('recycleBin', res.data.records);
 					let page = {
@@ -1253,21 +1254,18 @@
 					};
 					(this.$refs.bill as any).setTablePage('recycleBin', page)
 				} else this.$message.error(res.msg)
-			});
+			}).catch(() => loading.close());
 		}
 		// 搜索
 		search(parames : any) {
-			let loading = this.$loading({ target: '.main-container' });
 			let query = parames.value;
 			if (parames.type === 'draftsBox') query.submitState = 0 // 草稿箱数据
 			if (parames.type === 'smt') query.submitState = 1 // 已提交数据
 			console.log('搜索 ==> ', query);
 			if (this.tabType === 'recycleBin') {
 				this.getSelectDeleteList(query); // 回收站分页数据
-				loading.close()
 			} else {
 				this.getPageList(query, parames.type) // 获取分页数据
-				loading.close()
 			}
 		}
 		// 刷新/重置
@@ -1336,14 +1334,12 @@
 						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张单据表格数据
@@ -1359,37 +1355,37 @@
 				selectData.map((v : any) => {
 					ids.push(v.id)
 				})
-			} else return this.$message({ type: 'warning', message: '请选择删除数据' });
-			let loading = this.$loading({ target: '.main-container' });
+			} else return this.$message.warning('请选择删除数据');
 			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
 				confirmButtonText: '确定',
 				cancelButtonText: '取消',
 				type: 'warning',
 				center: true
 			}).then(() => {
+				let loading = this.$loading({ target: '.main-container' });
 				api.deleteList(ids, 'supplyTaskOrder').then((res : any) => {
+					loading.close();
 					if (res.code === 200) {
+						this.$message.success('删除成功');
 						this.clickTab(this.tabType);
-						this.$message.success('删除成功!');
-						loading.close();
 					} else this.$message.error(res.msg)
 				}).catch(() => loading.close());
 			}).catch(() => this.$message.info('已取消删除'));
 		}
 		// 操作删除
 		doDelete2(item : any) {
-			let loading = this.$loading({ target: '.main-container' });
 			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
 				confirmButtonText: '确定',
 				cancelButtonText: '取消',
 				type: 'warning',
 				center: true
 			}).then(() => {
+				let loading = this.$loading({ target: '.main-container' });
 				api.deleteList({ ids: item.id }, 'supplyTaskOrder').then((res : any) => {
+					loading.close();
 					if (res.code === 200) {
 						this.clickTab(this.tabType);
-						this.$message.success('删除成功!');
-						loading.close();
+						this.$message.success('删除成功');
 					} else this.$message.error(res.msg)
 				}).catch(() => loading.close());
 			}).catch(() => this.$message.info('已取消删除'));

+ 25 - 27
src/views/audit/outbound/index.vue

@@ -139,6 +139,9 @@
 							operator: [{
 								required: true, message: '请输入经办人', trigger: 'blur'
 							}],
+							businessType: [{
+								required: true, message: '请选择业务类型', trigger: 'change'
+							}],
 						}
 					},
 					columns: [
@@ -838,8 +841,6 @@
 			console.log('保存 ==>', this.tabType);
 			(this as any).$refs.bill.$refs.billForm.validate().then(() => {
 				let query = (this.$refs.bill as any).getBillFormValue(); // 获取单据数据
-				console.log(query);
-
 				// 子表数据
 				// query.suborderList = this.tableData;
 				query.purchaseOrderId = query.id;
@@ -875,9 +876,8 @@
 							this.dataId = res.data;
 						} else this.$message.error(res.msg);
 					})
-				} else if (this.tabType === 'all' || this.tabType === 'draftsBox') {
-					if (this.tabType === 'draftsBox') query.submitState = 0;
-					console.log('保存 ==>', query);
+				} else {
+					query.submitState = 0;
 					api.updateList(query, 'supplyOutOrder').then((res : any) => {
 						if (res.code === 200) {
 							this.$message.success('保存成功');
@@ -886,13 +886,30 @@
 						} else this.$message.error(res.msg);
 					})
 				};
-
+				
 			})
 		}
+		// 切换tab栏
+		clickTab(e : any) {
+			console.log('切换tab ==> ', e);
+			this.tabType = e;
+			(this.$refs.bill as any).showTab = e;
+			// submitState: 提交状态
+			if (e === 'source') { this.getCitationList({}) }; // 引单出库
+			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({}); // 回收站数据
+			if (e === 'bill') {
+				let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
+				billConfig.tool.tools = {};
+				billConfig.tool.customTools = [];
+				(this.$refs.bill as any).setBillConfig(billConfig);
+			}
+		}
 		// 出库打开引单
 		outbound() {
 			this.clickTab('source');
-			(this.$refs.bill as any).showTab = 'source';
 		}
 		// 打开编辑
 		openEdit(e : any) {
@@ -1116,25 +1133,6 @@
 				})
 			}).catch(() => this.$message.info('已取消反提交'));
 		}
-		// 切换tab栏
-		clickTab(e : any) {
-			console.log('切换tab ==> ', e);
-			this.tabType = e;
-			// submitState: 提交状态
-			if (e === 'source') {
-				this.getCitationList({});
-			}
-			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({}); // 回收站数据
-			if (e === 'bill') {
-				let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
-				billConfig.tool.tools = {};
-				billConfig.tool.customTools = [];
-				(this.$refs.bill as any).setBillConfig(billConfig);
-			}
-		}
 		// 初始化
 		getDataList() {
 			if (!this.$refs.bill) {
@@ -1173,7 +1171,7 @@
 						pageSize: res.data.size, //每页条数
 						total: res.data.total //总条数
 					};
-					(this.$refs.bill as any).setTablePage(type, page)
+					(this.$refs.bill as any).setTablePage(type, page);
 				} else this.failHandle(res)
 			})
 		}

+ 8 - 8
src/views/audit/productClassification/index.vue

@@ -250,6 +250,7 @@
 			this.parentIds = e.id;
 			let loading = this.$loading({ target: '.main-container' });
 			api.childrenTreeList(data, 'maindataMaterialCategory').then((res : any) => {
+				loading.close();
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
 					let page = {
@@ -258,9 +259,8 @@
 						total: res.data.total //总条数
 					};
 					(this.$refs.moduleView as any).setPage(page);
-					loading.close();
 				}
-			})
+			}).catch(() => loading.close());
 		}
 		// 确认新增/编辑
 		confirm() {
@@ -306,6 +306,7 @@
 		getPageList(query : any) {
 			let loading = this.$loading({ target: '.main-container' });
 			api.pageList(query, 'maindataMaterialCategory').then((res : any) => {
+				loading.close();
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
 					let page = {
@@ -314,9 +315,8 @@
 						total: res.data.total //总条数
 					};
 					(this.$refs.moduleView as any).setPage(page);
-					loading.close();
 				} else this.$message.error(res.msg);
-			})
+			}).catch(() => loading.close());
 		}
 		// 工具栏方法
 		clickHandle(e : any) {
@@ -339,15 +339,15 @@
 					let data = res.data;
 					this.radio = data.status;
 					api.single({ id: data.parentId }, 'maindataMaterialCategory').then((res : any) => {
+						loading.close();
 						if (res.code === 200) {
-							loading.close();
 							data.parentName = res.data.name;
 							this.dialogFormVisible = true;
-							setTimeout(() => {(this as any).$refs.addFormId.setValue(data)},0);
+							setTimeout(() => { (this as any).$refs.addFormId.setValue(data) }, 0);
 						}
-					})
+					}).catch(() => loading.close());
 				}
-			})
+			}).catch(() => loading.close());
 		}
 		// 操作删除
 		doDelete(item : any) {

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

@@ -863,6 +863,7 @@
 			this.categoryIds = e.id;
 			let loading = this.$loading({ target: '.main-container' });
 			api.byCategoryPage({ categoryId: e.id }, 'maindataMaterialCategory').then((res : any) => {
+				loading.close();
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
 					let page = {
@@ -871,9 +872,8 @@
 						total: res.data.total //总条数
 					};
 					(this.$refs.moduleView as any).setPage(page);
-					loading.close();
 				}
-			})
+			}).catch(() => loading.close());
 		}
 		// 保存编辑/新增
 		doFormData() {
@@ -955,25 +955,28 @@
 					data.maindataMaterial.attributeList = ""
 				}
 				// console.log('data ==> ', data);
+				let loading = this.$loading({ target: '.main-container' });
 				if (this.isEdit) { // 编辑
 					other.updateSpuAndSku(data, 'maindataMaterial').then((res : any) => {
+						loading.close()
 						if (res.code === 200) {
 							this.isShow = 'home';
 							(this as any).$refs.sideTree.request();
 							this.getDataList();
-							this.$message.success('保存成功!');
+							this.$message.success('保存成功');
 						}
-					})
+					}).catch(() => loading.close());
 					// 新增
 				} else {
 					other.saveSpuAndSku(data, 'maindataMaterial').then((res : any) => {
+						loading.close()
 						if (res.code === 200) {
 							this.isShow = 'home';
 							(this as any).$refs.sideTree.request();
 							this.getDataList();
-							this.$message.success('保存成功!');
+							this.$message.success('保存成功');
 						}
-					})
+					}).catch(() => loading.close());
 				}
 
 			});
@@ -1010,12 +1013,12 @@
 					if (res.code === 200) {
 						if (res.data) data.vmCategoryName = res.data.name;
 					}
-				});
+				}).catch(() => loading.close());
 				api.single({ id: data.organizationCategoryId }, 'maindataMaterialOrganizationCategory').then((res : any) => {
 					if (res.code === 200) {
 						if (res.data) data.organizationCategoryName = res.data.name;
 					}
-				});
+				}).catch(() => loading.close());
 				api.single({ id: data.categoryId }, 'maindataMaterialCategory').then((res : any) => {
 					if (res.code === 200) data.categoryName = res.data.name;
 					if (data.attributeId) {
@@ -1023,7 +1026,7 @@
 							if (p.code === 200) {
 								if (p.data) this.selectValue = p.data.name
 							}
-						})
+						}).catch(() => loading.close());
 					}
 					this.intercept = data.attributeId // 拦截物料属性判断
 					this.isEdit = true;
@@ -1046,7 +1049,7 @@
 								this.towTable = '' // 表格数据
 								this.attributeList = []; // 属性规格
 								this.$nextTick(() => {
-										(this as any).$refs.singeTable.setValue(info.data);
+									(this as any).$refs.singeTable.setValue(info.data);
 								});
 							} else {
 								this.forFun(this.attributeList[0], 0) // 生成sku
@@ -1077,9 +1080,9 @@
 						}
 						(this as any).$refs.form.setValue(data)
 						loading.close()
-					})
-				})
-			})
+					}).catch(() => loading.close());
+				}).catch(() => loading.close());
+			}).catch(() => loading.close());
 		}
 		// 立即生成
 		generateNow() {
@@ -1230,7 +1233,7 @@
 				}
 				(this as any).$refs['getValue_' + index][0].clearValue();
 				this.generateNow();
-				this.$message.success('添加成功!');
+				this.$message.success('添加成功');
 			}).catch(() => this.$message.info('已取消添加'));
 		}
 		// 添加sku规格
@@ -1253,7 +1256,7 @@
 				this.normsValue = '';
 				this.isAdd = false;
 				this.generateNow();
-				this.$message.success('添加成功!');
+				this.$message.success('添加成功');
 			}).catch(() => this.$message.info('已取消添加'));
 		}
 		// 监听表格数据
@@ -1306,7 +1309,7 @@
 				center: true
 			}).then(() => {
 				this.tagsData.splice(index, 1)
-				this.$message.success('删除成功!');
+				this.$message.success('删除成功');
 			}).catch(() => this.$message.info('已取消删除'));
 		}
 		// 删除标签
@@ -1319,7 +1322,7 @@
 			}).then(() => {
 				this.attributeList[index].list.splice(this.attributeList[index].list.indexOf(tag), 1);
 				this.generateNow();
-				this.$message.success('删除成功!');
+				this.$message.success('删除成功');
 			}).catch(() => this.$message.info('已取消删除'));
 		}
 		// 删除数组
@@ -1332,7 +1335,7 @@
 			}).then(() => {
 				this.attributeList.splice(index, 1);
 				this.generateNow();
-				this.$message.success('删除成功!');
+				this.$message.success('删除成功');
 			}).catch(() => this.$message.info('已取消删除'));
 		}
 		// 删除表格数据
@@ -1349,7 +1352,7 @@
 				})
 				let filterList = this.tableList.filter((v : any) => v.isDeleted !== 1);
 				(this as any).$refs.table.setValue(filterList); // 设置表格数据
-				this.$message.success('删除成功!');
+				this.$message.success('删除成功');
 			}).catch(() => this.$message.info('已取消删除'));
 		}
 		// 获取物料属性
@@ -1412,7 +1415,7 @@
 			}).then(() => {
 				other.deleteSpuAndSku({ ids: item.id }, 'maindataMaterial').then((res : any) => {
 					if (res.code === 200) {
-						this.$message.success('删除成功!');
+						this.$message.success('删除成功');
 						this.isShow = 'home';
 						(this as any).$refs.sideTree.request();
 						this.getDataList();
@@ -1440,7 +1443,7 @@
 					if (res.code === 200) {
 						(this as any).$refs.sideTree.request();
 						this.getDataList();
-						this.$message.success('删除成功!');
+						this.$message.success('删除成功');
 					} else this.$message.error(res.msg);
 				})
 			}).catch(() => this.$message.info('已取消删除'));
@@ -1457,7 +1460,7 @@
 					if (res.code === 200) {
 						(this as any).$refs.sideTree.request();
 						this.getDataList();
-						this.$message.success('删除成功!');
+						this.$message.success('删除成功');
 					} else this.$message.error(res.msg);
 				})
 			}).catch(() => this.$message.info('已取消删除'));

+ 3 - 3
src/views/audit/saleOrder/index.vue

@@ -34,7 +34,7 @@
 	import OrderType from "./components/orderType.vue";
 	import Assembly from "@/components/Assembly/saleOrder.vue";
 	@Component
-	export default class OrderTask extends Vue {
+	export default class SaleOrder extends Vue {
 		vxeValue = false
 		isCitation = false
 		timeNum = 0;
@@ -634,8 +634,8 @@
 						(this.$refs.bill as any).setBillFormValue(parentData[0]); // 设置单据表单数据
 						(this.$refs.bill as any).setBillTableValue(parentData[0].suborderList, 0);// 设置第1张单据表格数据
 					}, 0)
-				}
-			})
+				} else loading.close();
+			}).catch(() => loading.close());
 		};
 		// 接单
 		onOrder() {

+ 7 - 7
src/views/audit/virtually/index.vue

@@ -251,6 +251,7 @@
 			this.parentIds = e.id;
 			let loading = this.$loading({ target: '.main-container' });
 			api.childrenTreeList(data, 'maindataMaterialVmcategory').then((res : any) => {
+				loading.close();
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
 					let page = {
@@ -259,9 +260,8 @@
 						total: res.data.total //总条数
 					};
 					(this.$refs.moduleView as any).setPage(page);
-					loading.close();
 				}
-			})
+			}).catch(() => loading.close());
 		}
 		// 确认新增/编辑
 		confirm() {
@@ -307,6 +307,7 @@
 		getPageList(query : any) {
 			let loading = this.$loading({ target: '.main-container' });
 			api.pageList(query, 'maindataMaterialVmcategory').then((res : any) => {
+				loading.close();
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
 					let page = {
@@ -315,9 +316,8 @@
 						total: res.data.total //总条数
 					};
 					(this.$refs.moduleView as any).setPage(page);
-					loading.close();
 				} else this.$message.error(res.msg);
-			})
+			}).catch(() => loading.close());
 		}
 		// 工具栏方法
 		clickHandle(e : any) {
@@ -340,15 +340,15 @@
 					let data = res.data;
 					this.radio = data.status;
 					api.single({ id: data.parentId }, 'maindataMaterialVmcategory').then((res : any) => {
+						loading.close();
 						if (res.code === 200) {
-							loading.close();
 							data.parentName = res.data.name;
 							this.dialogFormVisible = true;
-							setTimeout(() => {(this as any).$refs.addFormId.setValue(data)},0);
+							setTimeout(() => { (this as any).$refs.addFormId.setValue(data) }, 0);
 						}
 					})
 				}
-			})
+			}).catch(() => loading.close());
 		}
 		// 操作删除
 		doDelete(item : any) {

+ 5 - 0
src/views/audit/warehousing/index.vue

@@ -55,6 +55,11 @@
 					attr: {
 						size: 'medium',
 						readonly: false,
+						rules: {
+							businessType: [{
+								required: true, message: '请选择业务类型', trigger: 'change'
+							}],
+						}
 					},
 					columns: [
 						[