Quellcode durchsuchen

查缺补漏1.0

AlanWong vor 2 Jahren
Ursprung
Commit
5e3a9af342

+ 34 - 84
src/views/audit/agencyGoods/index.vue

@@ -38,13 +38,7 @@
 	import Assembly from "@/components/Assembly/material.vue";
 	@Component
 	export default class AgencyGoods extends Vue {
-		loading : any = null
-		// 左边
-		data : any = []
-		expandedKeys : any = []
-		parentId : any = ''
-		// 右边
-		baseURL : any = process.env.VUE_APP_BASE_API
+		parentIds : any = ''
 		timeNum = 0;
 		timer : any = null
 		popTitle : any = ''
@@ -168,7 +162,7 @@
 					}, {
 						name: '删除',
 						event: {
-							click: (item : any) => (this as any).doDelete2(item)
+							click: (item : any) => (this as any).doDelete(item)
 						}
 					}]
 				}]
@@ -257,12 +251,9 @@
 		//点击树获取数据
 		onChangeTree(e : any) {
 			let data : any = {};
-			if (e.isContain) {
-				data.ids = e.id;
-			} else {
-				data.parentId = e.id;
-			};
-			this.parentId = e.id;
+			e.isContain ? data.ids = e.id : data.parentId = e.id;
+			this.parentIds = e.id;
+			let loading = this.$loading({ target: '.main-container' });
 			api.childrenTreeList(data, 'maindataMaterialOrganizationCategory').then((res : any) => {
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
@@ -271,7 +262,8 @@
 						pageSize: res.data.size, //每页条数
 						total: res.data.total //总条数
 					};
-					(this.$refs.moduleView as any).setPage(page)
+					(this.$refs.moduleView as any).setPage(page);
+					loading.close();
 				}
 			})
 		}
@@ -311,17 +303,12 @@
 			}
 			clearInterval(this.timer)
 			let query = (this.$refs.moduleView as any).getQuery();
-			query.parentId = this.parentId;
-			let newData : any = {}
-			for (let key in query) {
-				if (query[key].toString()) {
-					newData[key] = query[key]
-				}
-			}
-			console.log('表单字段 ==> ', newData);
-			this.getPageList(newData)
+			if (this.parentIds) query.parentIds = this.parentIds;
+			console.log('表单字段 ==> ', query);
+			this.getPageList(query)
 		}
 		getPageList(query : any) {
+			let loading = this.$loading({ target: '.main-container' });
 			api.pageList(query, 'maindataMaterialOrganizationCategory').then((res : any) => {
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
@@ -330,102 +317,65 @@
 						pageSize: res.data.size, //每页条数
 						total: res.data.total //总条数
 					};
-					(this.$refs.moduleView as any).setPage(page)
+					(this.$refs.moduleView as any).setPage(page);
+					loading.close();
 				} else this.$message.error(res.msg);
 			})
 		}
 		// 工具栏方法
 		clickHandle(e : any) {
 			if (e === 'onAdd') this.onAdd();
-			if (e === 'onDelete') this.onDelete();
-			if (e === 'onExport') this.onExport();
 		}
 		// 打开新增
 		onAdd() {
 			this.popTitle = '新增'
 			this.dialogFormVisible = true;
 			this.radio = 0
-			setTimeout(() => {
-				if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue({});
-			}, 0)
+			this.$nextTick(() => (this as any).$refs.addFormId.setValue());
 		}
 		// 打开编辑
 		openEdit(e : any) {
-			this.popTitle = '编辑'
-			this.dialogFormVisible = true;
-			this.radio = e.status
-			api.single({ id: e.parentId }, 'maindataMaterialOrganizationCategory').then((res : any) => {
+			console.log('打开编辑 ==> ', e);
+			this.popTitle = '编辑';
+			let loading = this.$loading({ target: '.main-container' });
+			api.single({ id: e.id }, 'maindataMaterialOrganizationCategory').then((res : any) => {
 				if (res.code === 200) {
-					e.parentName = res.data.name
-					setTimeout(() => {
-						if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue(e);
-					}, 0)
+					let data = res.data;
+					this.radio = data.status;
+					api.single({ id: data.parentId }, 'maindataMaterialOrganizationCategory').then((res : any) => {
+						if (res.code === 200) {
+							loading.close();
+							data.parentName = res.data.name;
+							this.dialogFormVisible = true;
+							this.$nextTick(() => (this as any).$refs.addFormId.setValue(data));
+						}
+					})
 				}
 			})
 		}
-		// 工具栏删除
-		onDelete() {
-			let selectData = (this.$refs.moduleView as any).getSelectData()
-			let ids = '';
-			if (selectData.length > 0) {
-				selectData.map((v : any) => {
-					ids += v.id + ','
-				})
-			} else return this.$message.warning('请选择删除数据');
-			ids = ids.slice(0, ids.length - 1);
+		// 操作删除
+		doDelete(item : any) {
 			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
 				confirmButtonText: '确定',
 				cancelButtonText: '取消',
 				type: 'warning',
 				center: true
 			}).then(() => {
-				api.deleteList({ ids: ids }, 'maindataMaterialOrganizationCategory').then((res : any) => {
+				api.delCategoryId({ id: item.id }, 'maindataMaterialOrganizationCategory').then((res : any) => {
 					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('已取消删除'));
 		}
-		// 操作删除
-		doDelete2(item : any) {
-			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
-				confirmButtonText: '确定',
-				cancelButtonText: '取消',
-				type: 'warning',
-				center: true
-			}).then(() => {
-				api.childrenTreeList({ id: item.id }, 'maindataMaterialOrganizationCategory').then((v : any) => {
-					if (v.code === 200) {
-						if (v.data.length > 0) return this.$message({ type: 'error', message: '此数据有子节点,不能进行删除!' })
-						api.deleteList({ ids: item.id }, 'maindataMaterialOrganizationCategory').then((res : any) => {
-							if (res.code === 200) {
-								(this as any).$refs.sideTree.request();
-								this.getDataList();
-								this.$message.success('删除成功!');
-							} else this.$message.error(res.msg);
-						})
-					} else this.$message({ type: 'error', message: '删除失败!请稍后再试' })
-				})
-			}).catch(() => this.$message.info('已取消删除'));
-		}
 		// 刷新/重置
 		onRefresh() {
-			let loading = this.$loading({ target: '.main-container' });
 			(this as any).$refs.moduleView.clearSearch();
-			this.parentId = '';
 			(this as any).$refs.sideTree.request();
-			this.getPageList({});
-			loading.close();
-		}
-		//导出
-		onExport() {
-			let urlArr = '/maindata/maindataMaterial';
-			let query = (this.$refs.moduleView as any).getQuery();
-			(this as any).$download(urlArr + '/export', {
-				...query
-			}, urlArr[urlArr.length - 1] + `_${new Date().getTime()}.xlsx`)
+			this.parentIds = '';
+			this.getDataList();
 		}
 	}
 </script>

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

@@ -182,7 +182,7 @@
 					}, {
 						name: '删除',
 						event: {
-							click: (item : any) => (this as any).doDelete2(item)
+							click: (item : any) => (this as any).doDelete(item)
 						}
 					}]
 				}]
@@ -355,9 +355,7 @@
 			this.dialogFormVisible = true;
 			this.radio = 0
 			this.tableConfig = [];
-			this.$nextTick(() => {
-				if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue();
-			});
+			this.$nextTick(() => (this as any).$refs.addFormId.setValue());
 		}
 		// 打开编辑
 		openEdit(e : any) {
@@ -369,9 +367,7 @@
 					this.dialogFormVisible = true;
 					this.radio = data.status;
 					loading.close();
-					this.$nextTick(() => {
-						if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue(data);
-					})
+					this.$nextTick(() => (this as any).$refs.addFormId.setValue(data));
 				}
 			})
 		}
@@ -383,7 +379,7 @@
 				selectData.map((v : any) => {
 					ids += v.id + ','
 				})
-			} else return this.$message({ type: 'warning', message: '请选择删除数据' })
+			} else return this.$message.warning('请选择删除数据');
 			ids = ids.slice(0, ids.length - 1);
 			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
 				confirmButtonText: '确定',
@@ -400,7 +396,7 @@
 			}).catch(() => this.$message.info('已取消删除'));
 		}
 		// 操作删除
-		doDelete2(item : any) {
+		doDelete(item : any) {
 			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
 				confirmButtonText: '确定',
 				cancelButtonText: '取消',

+ 5 - 9
src/views/audit/brand/index.vue

@@ -138,7 +138,7 @@
 					}, {
 						name: '删除',
 						event: {
-							click: (item : any) => (this as any).doDelete2(item)
+							click: (item : any) => (this as any).doDelete(item)
 						}
 					}]
 				}]
@@ -271,9 +271,7 @@
 			this.popTitle = '新增';
 			this.dialogFormVisible = true;
 			this.radio = 0;
-			this.$nextTick(() => {
-				if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue();
-			});
+			this.$nextTick(() => (this as any).$refs.addFormId.setValue());
 		}
 		// 打开编辑
 		openEdit(e : any) {
@@ -285,9 +283,7 @@
 					this.dialogFormVisible = true;
 					this.radio = data.status;
 					loading.close();
-					this.$nextTick(() => {
-						if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue(data);
-					})
+					this.$nextTick(() => (this as any).$refs.addFormId.setValue(data));
 				}
 			})
 		}
@@ -299,7 +295,7 @@
 				selectData.map((v : any) => {
 					ids += v.id + ','
 				})
-			} else return this.$message({ type: 'warning', message: '请选择删除数据' })
+			} else return this.$message.warning('请选择删除数据');
 			ids = ids.slice(0, ids.length - 1);
 			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
 				confirmButtonText: '确定',
@@ -316,7 +312,7 @@
 			}).catch(() => this.$message.info('已取消删除'));
 		}
 		// 操作删除
-		doDelete2(item : any) {
+		doDelete(item : any) {
 			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
 				confirmButtonText: '确定',
 				cancelButtonText: '取消',

+ 42 - 77
src/views/audit/distributor/index.vue

@@ -8,11 +8,11 @@
 		</div>
 		<div class="bill-main">
 			<module-view :propConfig="config" ref="moduleView" @pagination="getDataList" @search="getDataList"
-				@resert="getDataList" @clickHandle="clickHandle" @detail="openEdit" @onRefresh="onRefresh">
+				@resert="onRefresh" @clickHandle="clickHandle" @detail="openEdit" @onRefresh="onRefresh">
 			</module-view>
 		</div>
 		<!-- 新增/编辑弹窗 -->
-		<el-dialog :title="popTitle+'商'" :visible.sync="dialogFormVisible" width="30%">
+		<el-dialog :title="popTitle+'分销商'" :visible.sync="dialogFormVisible" width="30%">
 			<by-form :propConfig="addConfig" ref="addFormId">
 				<template v-slot:status class="clearfix">
 					<el-radio class="fl" style="margin-top: 8px;" v-model="radio" :label="0">正常</el-radio>
@@ -32,19 +32,16 @@
 	import Assembly from "@/components/Assembly/material.vue";
 	@Component
 	export default class Supplier extends Vue {
-		baseURL : any = process.env.VUE_APP_BASE_API
-		loading : any = null
 		timeNum = 0;
 		timer : any = null
 		popTitle : any = ''
 		radio : any = 0
 		dialogFormVisible : boolean = false
-		categoryId : any = '';
+		categoryIds : any = '';
 		treeConfig = {
 			attr: {
 				retConfig: {
 					id: 'id',
-					name: 'name'
 				},
 				defaultExpandAll: true,
 				label: 'name',
@@ -169,7 +166,7 @@
 					}, {
 						name: '删除',
 						event: {
-							click: (item : any) => (this as any).doDelete2(item)
+							click: (item : any) => (this as any).doDelete(item)
 						}
 					}]
 				}]
@@ -180,7 +177,7 @@
 				size: 'small',
 				rules: {
 					categoryName: [{
-						required: true, message: '请输入父级', trigger: 'blur'
+						required: true, message: '请输入父级', trigger: 'change'
 					}],
 					name: [{
 						required: true, message: '请输入名称', trigger: 'blur'
@@ -283,8 +280,8 @@
 		}
 		//点击树获取数据
 		onChangeTree(e : any) {
-			console.log('点击结果:', e)
-			this.categoryId = e.id
+			this.categoryIds = e.id;
+			let loading = this.$loading({ target: '.main-container' });
 			api.byCategoryPage({ categoryId: e.id }, 'maindataOrganizationCategory').then((res : any) => {
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
@@ -293,7 +290,8 @@
 						pageSize: res.data.size, //每页条数
 						total: res.data.total //总条数
 					};
-					(this.$refs.moduleView as any).setPage(page)
+					(this.$refs.moduleView as any).setPage(page);
+					loading.close();
 				}
 			})
 		}
@@ -305,10 +303,9 @@
 				query.status = this.radio;
 				// 手机验证
 				let reg = /^1[3456789]\d{9}$/;
-				let reg2 = /^0\d{2,3}-\d{7,8}$/; 
+				let reg2 = /^0\d{2,3}-\d{7,8}$/;
 				if (query.telephone && !reg.test(query.telephone)) return this.$message.warning('请输入正确手机号码');
 				if (query.phonenum && !reg2.test(query.phonenum)) return this.$message.warning('请输入正确联系电话');
-				
 				this.dialogFormVisible = false;
 
 				if (this.popTitle === '新增') {
@@ -342,6 +339,12 @@
 			}
 			clearInterval(this.timer)
 			let query = (this.$refs.moduleView as any).getQuery();
+			if (this.categoryIds) query.categoryIds = this.categoryIds;
+			console.log('表单字段 ==> ', query);
+			this.getPageList(query)
+		}
+		getPageList(query : any) {
+			let loading = this.$loading({ target: '.main-container' });
 			api.pageList(query, 'maindataMaterialDistributor').then((res : any) => {
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
@@ -350,61 +353,43 @@
 						pageSize: res.data.size, //每页条数
 						total: res.data.total //总条数
 					};
-					(this.$refs.moduleView as any).setPage(page)
+					(this.$refs.moduleView as any).setPage(page);
+					loading.close();
 				} else this.$message.error(res.msg);
 			})
 		}
 		// 工具栏方法
 		clickHandle(e : any) {
 			if (e === 'onAdd') this.onAdd();
-			if (e === 'onDelete') this.onDelete();
-			if (e === 'onExport') this.onExport();
 		}
 		// 打开新增
 		onAdd() {
-			this.popTitle = '新增';
+			this.popTitle = '新增'
 			this.dialogFormVisible = true;
-			this.radio = 0;
-			setTimeout(() => {
-				if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue('');
-			}, 0)
+			this.radio = 0
+			this.$nextTick(() => {
+				(this as any).$refs.addFormId.setValue();
+			});
 		}
 		// 打开编辑
 		openEdit(e : any) {
+			console.log('打开编辑 ==> ', e);
 			this.popTitle = '编辑'
-			this.dialogFormVisible = true;
-			this.radio = e.status;
-			setTimeout(() => {
-				if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue(e);
-			}, 0)
-		}
-		// 工具栏删除
-		onDelete() {
-			let selectData = (this.$refs.moduleView as any).getSelectData()
-			let ids = '';
-			if (selectData.length > 0) {
-				selectData.map((v : any) => {
-					ids += v.id + ','
-				})
-			} else return this.$message.warning('请选择删除数据');
-			ids = ids.slice(0, ids.length - 1);
-			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
-				confirmButtonText: '确定',
-				cancelButtonText: '取消',
-				type: 'warning',
-				center: true
-			}).then(() => {
-				api.deleteList({ ids: ids }, 'maindataMaterialDistributor').then((res : any) => {
-					if (res.code === 200) {
-						(this as any).$refs.sideTree.request();
-						this.getDataList();
-						this.$message.success('删除成功!');
-					} else this.$message.error(res.msg);
-				})
-			}).catch(() => this.$message.info('已取消删除'));
+			let loading = this.$loading({ target: '.main-container' });
+			api.single({ id: e.id }, 'maindataMaterialDistributor').then((res : any) => {
+				if (res.code === 200) {
+					let data = res.data;
+					this.radio = data.status;
+					loading.close();
+					this.dialogFormVisible = true;
+					this.$nextTick(() => {
+						(this as any).$refs.addFormId.setValue(data);
+					});
+				}
+			})
 		}
 		// 操作删除
-		doDelete2(item : any) {
+		doDelete(item : any) {
 			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
 				confirmButtonText: '确定',
 				cancelButtonText: '取消',
@@ -418,34 +403,14 @@
 						this.$message.success('删除成功!');
 					} else this.$message.error(res.msg);
 				})
-			}).catch(() => {
-				this.$message.info('已取消删除');
-			});
+			}).catch(() => this.$message.info('已取消删除'));
 		}
-		// 刷新
+		// 刷新/重置
 		onRefresh() {
-			this.loading = this.$loading({ target: '.main-container' });
 			(this as any).$refs.moduleView.clearSearch();
-			api.pageList({}, 'maindataMaterialDistributor').then((res : any) => {
-				if (res.code === 200) {
-					(this.$refs.moduleView as any).setTableValue(res.data.records);
-					let page = {
-						pageNo: res.data.current, //当前页
-						pageSize: res.data.size, //每页条数
-						total: res.data.total //总条数
-					};
-					(this.$refs.moduleView as any).setPage(page);
-					this.loading.close();
-				} else this.$message.error(res.msg);
-			})
-		}
-		//导出
-		onExport() {
-			let urlArr = '/maindata/maindataMaterial';
-			let query = (this.$refs.moduleView as any).getQuery();
-			(this as any).$download(urlArr + '/export', {
-				...query
-			}, urlArr[urlArr.length - 1] + `_${new Date().getTime()}.xlsx`)
+			(this as any).$refs.sideTree.request();
+			this.categoryIds = '';
+			this.getDataList();
 		}
 	}
 </script>

+ 42 - 76
src/views/audit/manufacturer/index.vue

@@ -8,7 +8,7 @@
 		</div>
 		<div class="bill-main">
 			<module-view :propConfig="config" ref="moduleView" @pagination="getDataList" @search="getDataList"
-				@resert="getDataList" @clickHandle="clickHandle" @detail="openEdit" @onRefresh="onRefresh">
+				@resert="onRefresh" @clickHandle="clickHandle" @detail="openEdit" @onRefresh="onRefresh">
 			</module-view>
 		</div>
 		<!-- 新增/编辑弹窗 -->
@@ -32,19 +32,16 @@
 	import Assembly from "@/components/Assembly/material.vue";
 	@Component
 	export default class Supplier extends Vue {
-		baseURL : any = process.env.VUE_APP_BASE_API
-		loading : any = null
 		timeNum = 0;
 		timer : any = null
 		popTitle : any = ''
 		radio : any = 0
 		dialogFormVisible : boolean = false
-		categoryId : any = '';
+		categoryIds : any = '';
 		treeConfig = {
 			attr: {
 				retConfig: {
 					id: 'id',
-					name: 'name'
 				},
 				defaultExpandAll: true,
 				label: 'name',
@@ -169,7 +166,7 @@
 					}, {
 						name: '删除',
 						event: {
-							click: (item : any) => (this as any).doDelete2(item)
+							click: (item : any) => (this as any).doDelete(item)
 						}
 					}]
 				}]
@@ -180,7 +177,7 @@
 				size: 'small',
 				rules: {
 					categoryName: [{
-						required: true, message: '请输入父级', trigger: 'blur'
+						required: true, message: '请输入父级', trigger: 'change'
 					}],
 					name: [{
 						required: true, message: '请输入名称', trigger: 'blur'
@@ -283,8 +280,8 @@
 		}
 		//点击树获取数据
 		onChangeTree(e : any) {
-			console.log('点击结果:', e)
-			this.categoryId = e.id
+			this.categoryIds = e.id;
+			let loading = this.$loading({ target: '.main-container' });
 			api.byCategoryPage({ categoryId: e.id }, 'maindataOrganizationCategory').then((res : any) => {
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
@@ -293,7 +290,8 @@
 						pageSize: res.data.size, //每页条数
 						total: res.data.total //总条数
 					};
-					(this.$refs.moduleView as any).setPage(page)
+					(this.$refs.moduleView as any).setPage(page);
+					loading.close();
 				}
 			})
 		}
@@ -305,11 +303,11 @@
 				query.status = this.radio;
 				// 手机验证
 				let reg = /^1[3456789]\d{9}$/;
-				let reg2 = /^0\d{2,3}-\d{7,8}$/; 
+				let reg2 = /^0\d{2,3}-\d{7,8}$/;
 				if (query.telephone && !reg.test(query.telephone)) return this.$message.warning('请输入正确手机号码');
 				if (query.phonenum && !reg2.test(query.phonenum)) return this.$message.warning('请输入正确联系电话');
 				this.dialogFormVisible = false;
-				
+
 				if (this.popTitle === '新增') {
 					api.saveList(query, 'maindataMaterialManufacturer').then((res : any) => {
 						if (res.code === 200) {
@@ -341,6 +339,12 @@
 			}
 			clearInterval(this.timer)
 			let query = (this.$refs.moduleView as any).getQuery();
+			if (this.categoryIds) query.categoryIds = this.categoryIds;
+			console.log('表单字段 ==> ', query);
+			this.getPageList(query)
+		}
+		getPageList(query : any) {
+			let loading = this.$loading({ target: '.main-container' });
 			api.pageList(query, 'maindataMaterialManufacturer').then((res : any) => {
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
@@ -349,61 +353,43 @@
 						pageSize: res.data.size, //每页条数
 						total: res.data.total //总条数
 					};
-					(this.$refs.moduleView as any).setPage(page)
+					(this.$refs.moduleView as any).setPage(page);
+					loading.close();
 				} else this.$message.error(res.msg);
 			})
 		}
 		// 工具栏方法
 		clickHandle(e : any) {
 			if (e === 'onAdd') this.onAdd();
-			if (e === 'onDelete') this.onDelete();
-			if (e === 'onExport') this.onExport();
 		}
 		// 打开新增
 		onAdd() {
-			this.popTitle = '新增';
+			this.popTitle = '新增'
 			this.dialogFormVisible = true;
-			this.radio = 0;
-			setTimeout(() => {
-				if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue('');
-			}, 0)
+			this.radio = 0
+			this.$nextTick(() => {
+				(this as any).$refs.addFormId.setValue();
+			});
 		}
 		// 打开编辑
 		openEdit(e : any) {
+			console.log('打开编辑 ==> ', e);
 			this.popTitle = '编辑'
-			this.dialogFormVisible = true;
-			this.radio = e.status;
-			setTimeout(() => {
-				if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue(e);
-			}, 0)
-		}
-		// 工具栏删除
-		onDelete() {
-			let selectData = (this.$refs.moduleView as any).getSelectData()
-			let ids = '';
-			if (selectData.length > 0) {
-				selectData.map((v : any) => {
-					ids += v.id + ','
-				})
-			} else return this.$message.warning('请选择删除数据');
-			ids = ids.slice(0, ids.length - 1);
-			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
-				confirmButtonText: '确定',
-				cancelButtonText: '取消',
-				type: 'warning',
-				center: true
-			}).then(() => {
-				api.deleteList({ ids: ids }, 'maindataMaterialManufacturer').then((res : any) => {
-					if (res.code === 200) {
-						(this as any).$refs.sideTree.request();
-						this.getDataList();
-						this.$message.success('删除成功!');
-					} else this.$message.error(res.msg);
-				})
-			}).catch(() => this.$message.info('已取消删除'));
+			let loading = this.$loading({ target: '.main-container' });
+			api.single({ id: e.id }, 'maindataMaterialManufacturer').then((res : any) => {
+				if (res.code === 200) {
+					let data = res.data;
+					this.radio = data.status;
+					loading.close();
+					this.dialogFormVisible = true;
+					this.$nextTick(() => {
+						(this as any).$refs.addFormId.setValue(data);
+					});
+				}
+			})
 		}
 		// 操作删除
-		doDelete2(item : any) {
+		doDelete(item : any) {
 			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
 				confirmButtonText: '确定',
 				cancelButtonText: '取消',
@@ -417,34 +403,14 @@
 						this.$message.success('删除成功!');
 					} else this.$message.error(res.msg);
 				})
-			}).catch(() => {
-				this.$message.info('已取消删除');
-			});
+			}).catch(() => this.$message.info('已取消删除'));
 		}
-		// 刷新
+		// 刷新/重置
 		onRefresh() {
-			this.loading = this.$loading({ target: '.main-container' });
 			(this as any).$refs.moduleView.clearSearch();
-			api.pageList({}, 'maindataMaterialManufacturer').then((res : any) => {
-				if (res.code === 200) {
-					(this.$refs.moduleView as any).setTableValue(res.data.records);
-					let page = {
-						pageNo: res.data.current, //当前页
-						pageSize: res.data.size, //每页条数
-						total: res.data.total //总条数
-					};
-					(this.$refs.moduleView as any).setPage(page);
-					this.loading.close();
-				} else this.$message.error(res.msg);
-			})
-		}
-		//导出
-		onExport() {
-			let urlArr = '/maindata/maindataMaterial';
-			let query = (this.$refs.moduleView as any).getQuery();
-			(this as any).$download(urlArr + '/export', {
-				...query
-			}, urlArr[urlArr.length - 1] + `_${new Date().getTime()}.xlsx`)
+			(this as any).$refs.sideTree.request();
+			this.categoryIds = '';
+			this.getDataList();
 		}
 	}
 </script>

+ 20 - 65
src/views/audit/organClassify/index.vue

@@ -8,11 +8,11 @@
 		</div>
 		<div class="bill-main">
 			<module-view :propConfig="config" ref="moduleView" @pagination="getDataList" @search="getDataList"
-				@resert="getDataList" @clickHandle="clickHandle" @detail="openEdit" @onRefresh="onRefresh">
+				@resert="onRefresh" @clickHandle="clickHandle" @detail="openEdit" @onRefresh="onRefresh">
 			</module-view>
 		</div>
 		<!-- 新增/编辑弹窗 -->
-		<el-dialog :title="popTitle+'供应商'" :visible.sync="dialogFormVisible" width="30%">
+		<el-dialog :title="popTitle+'机构分类'" :visible.sync="dialogFormVisible" width="30%">
 			<by-form :propConfig="addConfig" ref="addFormId">
 				<template v-slot:status class="clearfix">
 					<el-radio class="fl" style="margin-top: 8px;" v-model="radio" :label="0">正常</el-radio>
@@ -31,15 +31,13 @@
 	import api from "@/api/currency";
 	import Assembly from "@/components/Assembly/material.vue";
 	@Component
-	export default class Supplier extends Vue {
-		baseURL : any = process.env.VUE_APP_BASE_API
-		loading : any = null
+	export default class OrganClassify extends Vue {
 		timeNum = 0;
 		timer : any = null
 		popTitle : any = ''
 		radio : any = 0
 		dialogFormVisible : boolean = false
-		parentId : any = '';
+		parentIds : any = '';
 		treeConfig = {
 			attr: {
 				retConfig: {
@@ -99,7 +97,6 @@
 			tool: {
 				tools: {
 					add: true,
-					delete: true,
 					search: true,
 					refresh: true
 				}
@@ -141,7 +138,7 @@
 					}, {
 						name: '删除',
 						event: {
-							click: (item : any) => (this as any).doDelete2(item)
+							click: (item : any) => (this as any).doDelete(item)
 						}
 					}]
 				}]
@@ -222,14 +219,10 @@
 		}
 		//点击树获取数据
 		onChangeTree(e : any) {
-			console.log(e);
 			let data : any = {};
-			if (e.isContain) {
-				data.ids = e.id;
-			} else {
-				data.parentId = e.id;
-			};
-			this.parentId = e.id;
+			e.isContain ? data.ids = e.id : data.parentId = e.id;
+			this.parentIds = e.id;
+			let loading = this.$loading({ target: '.main-container' });
 			api.childrenTreeList(data, 'maindataOrganizationCategory').then((res : any) => {
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
@@ -238,7 +231,8 @@
 						pageSize: res.data.size, //每页条数
 						total: res.data.total //总条数
 					};
-					(this.$refs.moduleView as any).setPage(page)
+					(this.$refs.moduleView as any).setPage(page);
+					loading.close();
 				}
 			})
 		}
@@ -279,10 +273,11 @@
 			}
 			clearInterval(this.timer)
 			let query = (this.$refs.moduleView as any).getQuery();
-			if (this.parentId) query.parentId = this.parentId;
+			if (this.parentIds) query.parentIds = this.parentIds;
 			this.getPageList(query)
 		}
 		getPageList(query : any) {
+			let loading = this.$loading({ target: '.main-container' });
 			api.pageList(query, 'maindataOrganizationCategory').then((res : any) => {
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
@@ -291,24 +286,21 @@
 						pageSize: res.data.size, //每页条数
 						total: res.data.total //总条数
 					};
-					(this.$refs.moduleView as any).setPage(page)
+					(this.$refs.moduleView as any).setPage(page);
+					loading.close();
 				} else this.$message.error(res.msg);
 			})
 		}
 		// 工具栏方法
 		clickHandle(e : any) {
 			if (e === 'onAdd') this.onAdd();
-			if (e === 'onDelete') this.onDelete();
-			if (e === 'onExport') this.onExport();
 		}
 		// 打开新增
 		onAdd() {
 			this.popTitle = '新增'
 			this.dialogFormVisible = true;
 			this.radio = 0
-			setTimeout(() => {
-				if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue('');
-			}, 0)
+			this.$nextTick(() => (this as any).$refs.addFormId.setValue());
 		}
 		// 打开编辑
 		openEdit(e : any) {
@@ -323,41 +315,14 @@
 							data.parentName = res.data.name;
 							loading.close();
 							this.dialogFormVisible = true;
-							setTimeout(() => {
-								if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue(data);
-							}, 0)
+							this.$nextTick(() => (this as any).$refs.addFormId.setValue(data));
 						}
 					});
 				}
 			});
 		}
-		// 工具栏删除
-		onDelete() {
-			let selectData = (this.$refs.moduleView as any).getSelectData()
-			let ids = '';
-			if (selectData.length > 0) {
-				selectData.map((v : any) => {
-					ids += v.id + ','
-				})
-			} else return this.$message.warning('请选择删除数据');
-			ids = ids.slice(0, ids.length - 1);
-			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
-				confirmButtonText: '确定',
-				cancelButtonText: '取消',
-				type: 'warning',
-				center: true
-			}).then(() => {
-				api.deleteList({ ids: ids }, 'maindataOrganizationCategory').then((res : any) => {
-					if (res.code === 200) {
-						(this as any).$refs.sideTree.request();
-						this.getDataList();
-						this.$message.success('删除成功!');
-					} else this.$message.error(res.msg);
-				})
-			}).catch(() => this.$message.info('已取消删除'));
-		}
 		// 操作删除
-		doDelete2(item : any) {
+		doDelete(item : any) {
 			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
 				confirmButtonText: '确定',
 				cancelButtonText: '取消',
@@ -375,22 +340,12 @@
 				this.$message.info('已取消删除');
 			});
 		}
-		// 刷新
+		// 刷新/重置
 		onRefresh() {
-			let loading = this.$loading({ target: '.main-container' });
 			(this as any).$refs.moduleView.clearSearch();
-			this.parentId = '';
 			(this as any).$refs.sideTree.request();
-			this.getPageList({});
-			loading.close();
-		}
-		//导出
-		onExport() {
-			let urlArr = '/maindata/maindataMaterial';
-			let query = (this.$refs.moduleView as any).getQuery();
-			(this as any).$download(urlArr + '/export', {
-				...query
-			}, urlArr[urlArr.length - 1] + `_${new Date().getTime()}.xlsx`)
+			this.parentIds = '';
+			this.getDataList();
 		}
 	}
 </script>

+ 12 - 17
src/views/audit/outbound/index.vue

@@ -1091,14 +1091,12 @@
 				type: 'warning',
 				center: true
 			}).then(() => {
-				if (this.tabType === 'smt') {
-					api.cancelSubmission({ id: e.id }, 'supplyOutOrder').then((res : any) => {
-						if (res.code === 200) {
-							this.$message.success('反提交成功');
-							this.clickTab(this.tabType);
-						} else this.$message.error(res.msg)
-					})
-				}
+				api.cancelSubmission({ id: e.id }, 'supplyOutOrder').then((res : any) => {
+					if (res.code === 200) {
+						this.$message.success('反提交成功');
+						this.clickTab(this.tabType);
+					} else this.$message.error(res.msg)
+				})
 			}).catch(() => this.$message.info('已取消反提交'));
 		}
 		// 工具栏反提交
@@ -1110,15 +1108,12 @@
 				type: 'warning',
 				center: true
 			}).then(() => {
-				if (this.tabType === 'smt') {
-					api.cancelSubmission({ id: this.baseInfo.id }, 'supplyOutOrder').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)
-					})
-				}
+				api.cancelSubmission({ id: this.baseInfo.id }, 'supplyOutOrder').then((res : any) => {
+					if (res.code === 200) {
+						this.$message.success('反提交成功');
+						this.clickTab(this.tabType);
+					} else this.$message.error(res.msg)
+				})
 			}).catch(() => this.$message.info('已取消反提交'));
 		}
 		// 切换tab栏

+ 19 - 26
src/views/audit/productClassification/index.vue

@@ -33,10 +33,8 @@
 	@Component
 	export default class ProductClassification extends Vue {
 		// 左边
-		expandedKeys : any = []
 		parentIds : any = ''
 		// 右边
-		baseURL : any = process.env.VUE_APP_BASE_API
 		timeNum = 0;
 		timer : any = null
 		popTitle : any = ''
@@ -248,12 +246,9 @@
 		onChangeTree(e : any) {
 			console.log(e);
 			let data : any = {};
-			if (e.isContain) {
-				data.ids = e.id;
-			} else {
-				data.parentId = e.id;
-			};
+			e.isContain ? data.ids = e.id : data.parentId = e.id;
 			this.parentIds = e.id;
+			let loading = this.$loading({ target: '.main-container' });
 			api.childrenTreeList(data, 'maindataMaterialCategory').then((res : any) => {
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
@@ -262,7 +257,8 @@
 						pageSize: res.data.size, //每页条数
 						total: res.data.total //总条数
 					};
-					(this.$refs.moduleView as any).setPage(page)
+					(this.$refs.moduleView as any).setPage(page);
+					loading.close();
 				}
 			})
 		}
@@ -304,14 +300,8 @@
 			clearInterval(this.timer)
 			let query = (this.$refs.moduleView as any).getQuery();
 			if (this.parentIds) query.parentIds = this.parentIds;
-			let newData : any = {}
-			for (let key in query) {
-				if (query[key].toString()) {
-					newData[key] = query[key]
-				}
-			}
-			console.log('表单字段 ==> ', newData);
-			this.getPageList(newData)
+			console.log('表单字段 ==> ', query);
+			this.getPageList(query)
 		}
 		getPageList(query : any) {
 			let loading = this.$loading({ target: '.main-container' });
@@ -337,22 +327,25 @@
 			this.popTitle = '新增'
 			this.dialogFormVisible = true;
 			this.radio = 0
-			this.$nextTick(() => {
-				if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue();
-			});
+			this.$nextTick(() => (this as any).$refs.addFormId.setValue());
 		}
 		// 打开编辑
 		openEdit(e : any) {
 			console.log('打开编辑 ==> ', e);
 			this.popTitle = '编辑'
-			this.dialogFormVisible = true;
-			this.radio = e.status;
-			api.single({ id: e.parentId }, 'maindataMaterialCategory').then((res : any) => {
+			let loading = this.$loading({ target: '.main-container' });
+			api.single({ id: e.id }, 'maindataMaterialCategory').then((res : any) => {
 				if (res.code === 200) {
-					e.parentName = res.data.name
-					this.$nextTick(() => {
-						if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue(e);
-					});
+					let data = res.data;
+					this.radio = data.status;
+					api.single({ id: data.parentId }, 'maindataMaterialCategory').then((res : any) => {
+						if (res.code === 200) {
+							loading.close();
+							data.parentName = res.data.name;
+							this.dialogFormVisible = true;
+							this.$nextTick(() => (this as any).$refs.addFormId.setValue(data));
+						}
+					})
 				}
 			})
 		}

+ 92 - 88
src/views/audit/productManagement/index.vue

@@ -116,7 +116,6 @@
 	import ForTab from "@/components/ForTab/index.vue";
 	@Component({ components: { ForTab } })
 	export default class productManagement extends Vue {
-		loading : any = null
 		tagsData : any = [] // 标签值
 		isShow = 'home'
 		isEdit = true
@@ -124,8 +123,6 @@
 		isSingle : any = true
 		timeNum = 0;
 		timer : any = null
-		data : any = []
-		expandedKeys : any = []
 		materialSpec : any = 0
 		status : any = 0
 		ismakeup : any = 0
@@ -864,6 +861,7 @@
 		//点击树获取数据
 		onChangeTree(e : any) {
 			this.categoryIds = e.id;
+			let loading = this.$loading({ target: '.main-container' });
 			api.byCategoryPage({ categoryId: e.id }, 'maindataMaterialCategory').then((res : any) => {
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
@@ -872,7 +870,8 @@
 						pageSize: res.data.size, //每页条数
 						total: res.data.total //总条数
 					};
-					(this.$refs.moduleView as any).setPage(page)
+					(this.$refs.moduleView as any).setPage(page);
+					loading.close();
 				}
 			})
 		}
@@ -979,7 +978,7 @@
 
 			});
 		}
-		// 新增
+		// 打开新增
 		onAdd() {
 			this.isShow = 'add'; // 展示类型
 			this.selectValue = '' // 物料属性名称
@@ -989,91 +988,96 @@
 			this.attributeList = [] // 属性规格
 			this.tableList = [] // 表格数据
 			this.materialSpec = 0; // 单规格
+			this.status = 0; // 物料状态
+			this.ismakeup = 0; // 商品组合
+			this.issued = 0; // 是否公布
 			this.isSingle = true; // 显示单表格
 			this.isEdit = false; // 是否编辑
 			(this as any).$refs.byTool.setTool({ return: true, save: true });
-			setTimeout(() => {
+			this.$nextTick(() => {
 				(this as any).$refs.form.setValue(); // 设置表单数据
 				(this as any).$refs.singeTable.setValue([{}]) // 设置单表格数据
-			}, 0)
+			});
 		}
-		// 编辑
+		// 打开编辑
 		getDetail(e : any) {
 			console.log('编辑 ==> ', e);
 			(this as any).$refs.byTool.setTool({ return: true, save: true, delete: true });
-			this.loading = this.$loading({ target: '.my-container' });
-			// api.single({id:e.id},'maindataMaterial').then((res:any) => {})
-			api.single({ id: e.vmCategoryId }, 'maindataMaterialVmcategory').then((res : any) => {
-				if (res.code === 200) {
-					if (res.data) e.vmCategoryName = res.data.name;
-				}
-			});
-			api.single({ id: e.organizationCategoryId }, 'maindataMaterialOrganizationCategory').then((res : any) => {
-				if (res.code === 200) {
-					if (res.data) e.organizationCategoryName = res.data.name;
-				}
-			});
-			api.single({ id: e.categoryId }, 'maindataMaterialCategory').then((res : any) => {
-				if (res.code === 200) e.categoryName = res.data.name;
-				if (e.attributeId) {
-					api.single({ id: e.attributeId }, 'maindataMaterialAttribute').then((res : any) => {
-						if (res.code === 200) {
-							if (res.data) this.selectValue = res.data.name
-						}
-					})
-				}
-				this.intercept = e.attributeId // 拦截物料属性判断
-				this.isEdit = true;
-				this.editInfo = e;
-				this.isShow = 'add';
-				// 标签
-				if (e.tags) {
-					this.tagsData = e.tags.split(",")
-				} else this.tagsData = [];
-				this.materialSpec = e.materialSpec
-				this.isSingle = e.materialSpec === 0 ? true : false;
-				if (e.attributeList) this.attributeList = JSON.parse(e.attributeList);
-				other.selectByMaterialId({ id: e.id }, 'maindataMaterialSku').then((res : any) => {
+			let loading = this.$loading({ target: '.my-container' });
+			api.single({ id: e.id }, 'maindataMaterial').then((v : any) => {
+				let data = v.data;
+				api.single({ id: data.vmCategoryId }, 'maindataMaterialVmcategory').then((res : any) => {
 					if (res.code === 200) {
-						this.status = e.status
-						this.ismakeup = e.ismakeup
-						this.issued = e.issued
-						if (this.isSingle) {
-							this.selectValue = '' // 物料属性名称
-							this.towTable = '' // 表格数据
-							this.attributeList = []; // 属性规格
-							setTimeout(() => {
-								(this as any).$refs.singeTable.setValue(res.data);
-							}, 0)
-						} else {
-							this.forFun(this.attributeList[0], 0) // 生成sku
-							let tableConfig = (this as any).$lodash.cloneDeep(this.tableConfig);
-							let skuRuleList = (this as any).$lodash.cloneDeep(this.skuRuleList);
-							let newColumns = (this as any).$lodash.cloneDeep(this.attributeList).reverse();
-							res.data.map((v : any, i : any) => {
-								v = Object.assign(v, skuRuleList[i])
-								v.dataIndex = i
-							});
-							newColumns.map((v : any) => {
-								tableConfig.columns.unshift({
-									width: '80px',
-									title: v.title,
-									field: v.field,
-								})
-							});
-							this.tableList = (this as any).$lodash.cloneDeep(res.data);
-							// console.log('表格配置 ==> ', tableConfig);
-							console.log('skuRuleList ==> ', skuRuleList);
-							console.log('表格数据 ==> ', this.tableList);
-							this.setTableConfig = tableConfig;
-							setTimeout(() => {
-								(this as any).$refs.table.setConfig(tableConfig); // 设置表格配置
-								(this as any).$refs.table.setValue(this.tableList) // 设置表格数据
-							}, 300)
-						}
+						if (res.data) data.vmCategoryName = res.data.name;
 					}
-					(this as any).$refs.form.setValue(e)
-					this.loading.close()
+				});
+				api.single({ id: data.organizationCategoryId }, 'maindataMaterialOrganizationCategory').then((res : any) => {
+					if (res.code === 200) {
+						if (res.data) data.organizationCategoryName = res.data.name;
+					}
+				});
+				api.single({ id: data.categoryId }, 'maindataMaterialCategory').then((res : any) => {
+					if (res.code === 200) data.categoryName = res.data.name;
+					if (data.attributeId) {
+						api.single({ id: data.attributeId }, 'maindataMaterialAttribute').then((p : any) => {
+							if (p.code === 200) {
+								if (p.data) this.selectValue = p.data.name
+							}
+						})
+					}
+					this.intercept = data.attributeId // 拦截物料属性判断
+					this.isEdit = true;
+					this.editInfo = data;
+					this.isShow = 'add';
+					// 标签
+					if (data.tags) {
+						this.tagsData = data.tags.split(",")
+					} else this.tagsData = [];
+					this.materialSpec = data.materialSpec
+					this.isSingle = data.materialSpec === 0 ? true : false;
+					if (data.attributeList) this.attributeList = JSON.parse(data.attributeList);
+					other.selectByMaterialId({ id: data.id }, 'maindataMaterialSku').then((info : any) => {
+						if (info.code === 200) {
+							this.status = data.status
+							this.ismakeup = data.ismakeup
+							this.issued = data.issued
+							if (this.isSingle) {
+								this.selectValue = '' // 物料属性名称
+								this.towTable = '' // 表格数据
+								this.attributeList = []; // 属性规格
+								this.$nextTick(() => {
+										(this as any).$refs.singeTable.setValue(info.data);
+								});
+							} else {
+								this.forFun(this.attributeList[0], 0) // 生成sku
+								let tableConfig = (this as any).$lodash.cloneDeep(this.tableConfig);
+								let skuRuleList = (this as any).$lodash.cloneDeep(this.skuRuleList);
+								let newColumns = (this as any).$lodash.cloneDeep(this.attributeList).reverse();
+								info.data.map((v : any, i : any) => {
+									v = Object.assign(v, skuRuleList[i])
+									v.dataIndex = i
+								});
+								newColumns.map((v : any) => {
+									tableConfig.columns.unshift({
+										width: '80px',
+										title: v.title,
+										field: v.field,
+									})
+								});
+								this.tableList = (this as any).$lodash.cloneDeep(info.data);
+								// console.log('表格配置 ==> ', tableConfig);
+								console.log('skuRuleList ==> ', skuRuleList);
+								console.log('表格数据 ==> ', this.tableList);
+								this.setTableConfig = tableConfig;
+								this.$nextTick(() => {
+									(this as any).$refs.table.setConfig(tableConfig); // 设置表格配置
+									(this as any).$refs.table.setValue(this.tableList) // 设置表格数据
+								});
+							}
+						}
+						(this as any).$refs.form.setValue(data)
+						loading.close()
+					})
 				})
 			})
 		}
@@ -1126,10 +1130,10 @@
 			console.log('新表格数据 ==> ', skuRuleList);
 			this.tableList = skuRuleList;
 			this.setTableConfig = tableConfig;
-			setTimeout(() => {
+			this.$nextTick(() => {
 				(this as any).$refs.table.setConfig(tableConfig); // 设置表格配置
 				(this as any).$refs.table.setValue(this.tableList); // 设置表格数据
-			}, 0)
+			});
 		}
 		// 更换物料属性数据
 		getSelectValue(e : any) {
@@ -1174,10 +1178,10 @@
 						console.log('表格数据 ==> ', skuRuleList);
 						this.setTableConfig = tableConfig;
 						this.tableList = skuRuleList;
-						setTimeout(() => {
+						this.$nextTick(() => {
 							(this as any).$refs.table.setConfig(tableConfig); // 设置表格配置
 							(this as any).$refs.table.setValue(skuRuleList); // 设置表格数据
-						}, 0)
+						});
 					}
 				})
 			}).catch(() => { });
@@ -1186,8 +1190,8 @@
 		changeSingle() {
 			if (this.isSingle) {
 				if ((this as any).$refs.singeTable) this.singeTable = (this as any).$refs.singeTable.getValue()
-				this.isSingle = false
-				setTimeout(() => {
+				this.isSingle = false;
+				this.$nextTick(() => {
 					// 设置表格数据
 					if (this.towTable) {
 						if ((this as any).$refs.table) {
@@ -1196,17 +1200,17 @@
 							(this as any).$refs.table.setValue(this.towTable); // 设置表格数据
 						}
 					}
-				}, 0)
+				});
 			} else {
 				if ((this as any).$refs.table) this.towTable = (this as any).$refs.table.getValue()
 				this.isSingle = true;
-				setTimeout(() => {
+				this.$nextTick(() => {
 					// 设置单表格数据
 					if (this.singeTable) {
 						console.log('单表格数据 ==> ', this.singeTable);
 						(this as any).$refs.singeTable.setValue(this.singeTable);
 					} else (this as any).$refs.singeTable.setValue([{}]);
-				}, 0)
+				});
 			}
 		}
 		// 添加规格

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

@@ -111,8 +111,6 @@
 					search: {
 						attr: {
 							size: 'mini',
-							align: 'left',
-							triggerRowCheck: 'row'
 						},
 						columns: [
 							[
@@ -174,7 +172,8 @@
 							size: 'mini',
 							seq: true,
 							align: 'left',
-							radio: true
+							radio: true,
+							triggerRowCheck: 'row'
 						},
 						columns: [
 							{

+ 42 - 75
src/views/audit/supplier/index.vue

@@ -8,11 +8,11 @@
 		</div>
 		<div class="bill-main">
 			<module-view :propConfig="config" ref="moduleView" @pagination="getDataList" @search="getDataList"
-				@resert="getDataList" @clickHandle="clickHandle" @detail="openEdit" @onRefresh="onRefresh">
+				@resert="onRefresh" @clickHandle="clickHandle" @detail="openEdit" @onRefresh="onRefresh">
 			</module-view>
 		</div>
 		<!-- 新增/编辑弹窗 -->
-		<el-dialog :title="popTitle+'商'" :visible.sync="dialogFormVisible" width="30%">
+		<el-dialog :title="popTitle+'供应商'" :visible.sync="dialogFormVisible" width="30%">
 			<by-form :propConfig="addConfig" ref="addFormId">
 				<template v-slot:status class="clearfix">
 					<el-radio class="fl" style="margin-top: 8px;" v-model="radio" :label="0">正常</el-radio>
@@ -32,14 +32,12 @@
 	import Assembly from "@/components/Assembly/material.vue";
 	@Component
 	export default class Supplier extends Vue {
-		baseURL : any = process.env.VUE_APP_BASE_API
-		loading : any = null
 		timeNum = 0;
 		timer : any = null
 		popTitle : any = ''
 		radio : any = 0
 		dialogFormVisible : boolean = false
-		categoryId : any = '';
+		categoryIds : any = '';
 		treeConfig = {
 			attr: {
 				retConfig: {
@@ -168,7 +166,7 @@
 					}, {
 						name: '删除',
 						event: {
-							click: (item : any) => (this as any).doDelete2(item)
+							click: (item : any) => (this as any).doDelete(item)
 						}
 					}]
 				}]
@@ -179,7 +177,7 @@
 				size: 'small',
 				rules: {
 					categoryName: [{
-						required: true, message: '请输入父级', trigger: 'blur'
+						required: true, message: '请输入父级', trigger: 'change'
 					}],
 					name: [{
 						required: true, message: '请输入名称', trigger: 'blur'
@@ -282,8 +280,8 @@
 		}
 		//点击树获取数据
 		onChangeTree(e : any) {
-			console.log('点击结果:', e)
-			this.categoryId = e.id
+			this.categoryIds = e.id;
+			let loading = this.$loading({ target: '.main-container' });
 			api.byCategoryPage({ categoryId: e.id }, 'maindataOrganizationCategory').then((res : any) => {
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
@@ -292,7 +290,8 @@
 						pageSize: res.data.size, //每页条数
 						total: res.data.total //总条数
 					};
-					(this.$refs.moduleView as any).setPage(page)
+					(this.$refs.moduleView as any).setPage(page);
+					loading.close();
 				}
 			})
 		}
@@ -304,7 +303,7 @@
 				query.status = this.radio;
 				// 手机验证
 				let reg = /^1[3456789]\d{9}$/;
-				let reg2 = /^0\d{2,3}-\d{7,8}$/; 
+				let reg2 = /^0\d{2,3}-\d{7,8}$/;
 				if (query.telephone && !reg.test(query.telephone)) return this.$message.warning('请输入正确手机号码');
 				if (query.phonenum && !reg2.test(query.phonenum)) return this.$message.warning('请输入正确联系电话');
 				this.dialogFormVisible = false;
@@ -340,6 +339,12 @@
 			}
 			clearInterval(this.timer)
 			let query = (this.$refs.moduleView as any).getQuery();
+			if (this.categoryIds) query.categoryIds = this.categoryIds;
+			console.log('表单字段 ==> ', query);
+			this.getPageList(query)
+		}
+		getPageList(query : any) {
+			let loading = this.$loading({ target: '.main-container' });
 			api.pageList(query, 'maindataMaterialSupplier').then((res : any) => {
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
@@ -348,61 +353,43 @@
 						pageSize: res.data.size, //每页条数
 						total: res.data.total //总条数
 					};
-					(this.$refs.moduleView as any).setPage(page)
+					(this.$refs.moduleView as any).setPage(page);
+					loading.close();
 				} else this.$message.error(res.msg);
 			})
 		}
 		// 工具栏方法
 		clickHandle(e : any) {
 			if (e === 'onAdd') this.onAdd();
-			if (e === 'onDelete') this.onDelete();
-			if (e === 'onExport') this.onExport();
 		}
 		// 打开新增
 		onAdd() {
-			this.popTitle = '新增';
+			this.popTitle = '新增'
 			this.dialogFormVisible = true;
-			this.radio = 0;
-			setTimeout(() => {
-				if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue('');
-			}, 0)
+			this.radio = 0
+			this.$nextTick(() => {
+				(this as any).$refs.addFormId.setValue();
+			});
 		}
 		// 打开编辑
 		openEdit(e : any) {
+			console.log('打开编辑 ==> ', e);
 			this.popTitle = '编辑'
-			this.dialogFormVisible = true;
-			this.radio = e.status;
-			setTimeout(() => {
-				if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue(e);
-			}, 0)
-		}
-		// 工具栏删除
-		onDelete() {
-			let selectData = (this.$refs.moduleView as any).getSelectData()
-			let ids = '';
-			if (selectData.length > 0) {
-				selectData.map((v : any) => {
-					ids += v.id + ','
-				})
-			} else return this.$message.warning('请选择删除数据');
-			ids = ids.slice(0, ids.length - 1);
-			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
-				confirmButtonText: '确定',
-				cancelButtonText: '取消',
-				type: 'warning',
-				center: true
-			}).then(() => {
-				api.deleteList({ ids: ids }, 'maindataMaterialSupplier').then((res : any) => {
-					if (res.code === 200) {
-						(this as any).$refs.sideTree.request();
-						this.getDataList();
-						this.$message.success('删除成功!');
-					} else this.$message.error(res.msg);
-				})
-			}).catch(() => this.$message.info('已取消删除'));
+			let loading = this.$loading({ target: '.main-container' });
+			api.single({ id: e.id }, 'maindataMaterialSupplier').then((res : any) => {
+				if (res.code === 200) {
+					let data = res.data;
+					this.radio = data.status;
+					loading.close();
+					this.dialogFormVisible = true;
+					this.$nextTick(() => {
+						(this as any).$refs.addFormId.setValue(data);
+					});
+				}
+			})
 		}
 		// 操作删除
-		doDelete2(item : any) {
+		doDelete(item : any) {
 			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
 				confirmButtonText: '确定',
 				cancelButtonText: '取消',
@@ -416,34 +403,14 @@
 						this.$message.success('删除成功!');
 					} else this.$message.error(res.msg);
 				})
-			}).catch(() => {
-				this.$message.info('已取消删除');
-			});
+			}).catch(() => this.$message.info('已取消删除'));
 		}
-		// 刷新
+		// 刷新/重置
 		onRefresh() {
-			this.loading = this.$loading({ target: '.main-container' });
 			(this as any).$refs.moduleView.clearSearch();
-			api.pageList({}, 'maindataMaterialSupplier').then((res : any) => {
-				if (res.code === 200) {
-					(this.$refs.moduleView as any).setTableValue(res.data.records);
-					let page = {
-						pageNo: res.data.current, //当前页
-						pageSize: res.data.size, //每页条数
-						total: res.data.total //总条数
-					};
-					(this.$refs.moduleView as any).setPage(page);
-					this.loading.close();
-				} else this.$message.error(res.msg);
-			})
-		}
-		//导出
-		onExport() {
-			let urlArr = '/maindata/maindataMaterial';
-			let query = (this.$refs.moduleView as any).getQuery();
-			(this as any).$download(urlArr + '/export', {
-				...query
-			}, urlArr[urlArr.length - 1] + `_${new Date().getTime()}.xlsx`)
+			(this as any).$refs.sideTree.request();
+			this.categoryIds = '';
+			this.getDataList();
 		}
 	}
 </script>

+ 29 - 72
src/views/audit/virtually/index.vue

@@ -33,11 +33,8 @@
 	@Component
 	export default class Virtually extends Vue {
 		// 左边
-		data : any = []
-		expandedKeys : any = []
 		parentIds : any = ''
 		// 右边
-		baseURL : any = process.env.VUE_APP_BASE_API
 		timeNum = 0;
 		timer : any = null
 		popTitle : any = ''
@@ -134,11 +131,11 @@
 				}, {
 					title: '简称',
 					field: 'shortName'
-				}, 
+				},
 				{
 					title: '备注',
 					field: 'remark',
-				}, 
+				},
 				{
 					width: 80,
 					title: '状态',
@@ -161,7 +158,7 @@
 					}, {
 						name: '删除',
 						event: {
-							click: (item : any) => (this as any).doDelete2(item)
+							click: (item : any) => (this as any).doDelete(item)
 						}
 					}]
 				}]
@@ -235,7 +232,7 @@
 							attr: {
 								size: 'mini',
 								placeholder: '请输入备注',
-								type:'textarea'
+								type: 'textarea'
 							},
 						}
 					},
@@ -250,12 +247,9 @@
 		//点击树获取数据
 		onChangeTree(e : any) {
 			let data : any = {};
-			if (e.isContain) {
-				data.ids = e.id;
-			} else {
-				data.parentId = e.id;
-			};
+			e.isContain ? data.ids = e.id : data.parentId = e.id;
 			this.parentIds = e.id;
+			let loading = this.$loading({ target: '.main-container' });
 			api.childrenTreeList(data, 'maindataMaterialVmcategory').then((res : any) => {
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
@@ -264,7 +258,8 @@
 						pageSize: res.data.size, //每页条数
 						total: res.data.total //总条数
 					};
-					(this.$refs.moduleView as any).setPage(page)
+					(this.$refs.moduleView as any).setPage(page);
+					loading.close();
 				}
 			})
 		}
@@ -306,16 +301,11 @@
 			clearInterval(this.timer)
 			let query = (this.$refs.moduleView as any).getQuery();
 			if (this.parentIds) query.parentIds = this.parentIds;
-			let newData : any = {}
-			for (let key in query) {
-				if (query[key].toString()) {
-					newData[key] = query[key]
-				}
-			}
-			console.log('表单字段 ==> ', newData);
-			this.getPageList(newData)
+			console.log('表单字段 ==> ', query);
+			this.getPageList(query)
 		}
 		getPageList(query : any) {
+			let loading = this.$loading({ target: '.main-container' });
 			api.pageList(query, 'maindataMaterialVmcategory').then((res : any) => {
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
@@ -325,66 +315,43 @@
 						total: res.data.total //总条数
 					};
 					(this.$refs.moduleView as any).setPage(page);
+					loading.close();
 				} else this.$message.error(res.msg);
 			})
 		}
 		// 工具栏方法
 		clickHandle(e : any) {
 			if (e === 'onAdd') this.onAdd();
-			if (e === 'onDelete') this.onDelete();
-			if (e === 'onExport') this.onExport();
 		}
 		// 打开新增
 		onAdd() {
 			this.popTitle = '新增'
 			this.dialogFormVisible = true;
 			this.radio = 0
-			this.$nextTick(() => {
-				if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue();
-			});
+			this.$nextTick(() => (this as any).$refs.addFormId.setValue());
 		}
 		// 打开编辑
 		openEdit(e : any) {
-			console.log(e);
+			console.log('打开编辑 ==> ', e);
 			this.popTitle = '编辑'
-			this.dialogFormVisible = true;
-			this.radio = e.status
-			api.single({ id: e.parentId }, 'maindataMaterialVmcategory').then((res : any) => {
+			let loading = this.$loading({ target: '.main-container' });
+			api.single({ id: e.id }, 'maindataMaterialVmcategory').then((res : any) => {
 				if (res.code === 200) {
-					e.parentName = res.data.name
-					setTimeout(() => {
-						if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue(e);
-					}, 0)
+					let data = res.data;
+					this.radio = data.status;
+					api.single({ id: data.parentId }, 'maindataMaterialVmcategory').then((res : any) => {
+						if (res.code === 200) {
+							loading.close();
+							data.parentName = res.data.name;
+							this.dialogFormVisible = true;
+							this.$nextTick(() => (this as any).$refs.addFormId.setValue(data));
+						}
+					})
 				}
 			})
 		}
-		// 工具栏删除
-		onDelete() {
-			let selectData = (this.$refs.moduleView as any).getSelectData();
-			let ids = '';
-			if (selectData.length > 0) {
-				selectData.map((v : any) => {
-					ids += v.id + ','
-				})
-			} else return this.$message.warning('请选择删除数据');
-			ids = ids.slice(0, ids.length - 1);
-			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
-				confirmButtonText: '确定',
-				cancelButtonText: '取消',
-				type: 'warning',
-				center: true
-			}).then(() => {
-				api.deleteList({ ids: ids }, 'maindataMaterialVmcategory').then((res : any) => {
-					if (res.code === 200) {
-						(this as any).$refs.sideTree.request();
-						this.getDataList();
-						this.$message.success('删除成功!');
-					} else this.$message.error(res.msg);
-				})
-			}).catch(() => this.$message.info('已取消删除'));
-		}
 		// 操作删除
-		doDelete2(item : any) {
+		doDelete(item : any) {
 			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
 				confirmButtonText: '确定',
 				cancelButtonText: '取消',
@@ -402,20 +369,10 @@
 		}
 		// 刷新/重置
 		onRefresh() {
-			let loading = this.$loading({ target: '.main-container' });
 			(this as any).$refs.moduleView.clearSearch();
-			this.parentIds = '';
 			(this as any).$refs.sideTree.request();
-			this.getPageList({});
-			loading.close();
-		}
-		//导出
-		onExport() {
-			let urlArr = '/maindata/maindataMaterial';
-			let query = (this.$refs.moduleView as any).getQuery();
-			(this as any).$download(urlArr + '/export', {
-				...query
-			}, urlArr[urlArr.length - 1] + `_${new Date().getTime()}.xlsx`)
+			this.parentIds = '';
+			this.getDataList();
 		}
 	}
 </script>