Browse Source

1.所以分类添加优化,上级取消必须,优化添加编辑
2.注册仓库优化
3.机构档案优化
4.商品管理同步金蝶时间选择修改

hcf 1 year ago
parent
commit
a306c550d5

+ 52 - 132
src/views/audit/agencyGoods/index.vue

@@ -12,32 +12,16 @@
 			</module-view>
 		</div>
 		<!-- 新增/编辑弹窗 -->
-		<el-dialog :title="popTitle+'机构商品分类'" :visible.sync="dialogFormVisible2" width="30%">
-			<by-form :propConfig="addConfig2" ref="addFormId2">
-				<template v-slot:logo>
-					<el-upload :limit='1' :action="baseURL+'/file/upload'" list-type="picture-card"
-						:on-preview="handlePictureCardPreview" :on-remove="handleRemove">
-						<i class="el-icon-plus"></i>
-					</el-upload>
-				</template>
-				<template v-slot:status class="clearfix">
-					<el-radio class="fl" style="margin-top: 8px;" v-model="radio" :label="0">正常</el-radio>
-					<el-radio class="fl" style="margin-top: 8px;" v-model="radio" :label="1">禁用</el-radio>
-				</template>
-			</by-form>
-			<div slot="footer" class="dialog-footer">
-				<el-button @click="dialogFormVisible2 = false">取 消</el-button>
-				<el-button type="primary" @click="confirm2">确 定</el-button>
-			</div>
-		</el-dialog>
-		<!-- 新增/编辑弹窗 -->
-		<el-dialog :title="popTitle+'机构商品分类'" :visible.sync="dialogFormVisible" width="30%">
+		<el-dialog :title="popTitle+'机构商品分类'" :visible.sync="dialogFormVisible" width="30%" :destroy-on-close="true">
 			<by-form :propConfig="addConfig" ref="addFormId">
 				<template v-slot:logo>
 					<el-upload :limit='1' :action="baseURL+'/file/upload'" list-type="picture-card"
 						:on-preview="handlePictureCardPreview" :on-remove="handleRemove">
 						<i class="el-icon-plus"></i>
 					</el-upload>
+				</template>
+				<template v-slot:select-tree class="clearfix">
+					
 				</template>
 				<template v-slot:status class="clearfix">
 					<el-radio class="fl" style="margin-top: 8px;" v-model="radio" :label="0">正常</el-radio>
@@ -63,8 +47,6 @@
 		popTitle : any = ''
 		radio : any = 0
 		dialogFormVisible : boolean = false
-		dialogFormVisible2 : boolean = false
-		datlis : boolean = true
 		treeConfig = {
 			attr: {
 				retConfig: {
@@ -73,12 +55,12 @@
 				},
 				defaultExpandAll: true,
 				label: 'name',
-				resType: 'data'
+				// resType: 'data'
 			},
-			request: {
-				url: '/maindata/maindataMaterialOrganizationCategory/treeList',
-				method: 'GET'
-			}
+			// request: {
+			// 	url: '/maindata/maindataMaterialOrganizationCategory/treeList',
+			// 	method: 'GET'
+			// }
 		}
 		config : any = {
 			attr:{
@@ -200,9 +182,9 @@
 					name: [{
 						required: true, message: '请输入名称', trigger: 'blur'
 					}],
-					parentName: [{
-						required: true, message: '请选择上级', trigger: 'change'
-					}],
+					// parentName: [{
+					// 	required: true, message: '请选择上级', trigger: 'change'
+					// }],
 				}
 			},
 			columns: [
@@ -269,61 +251,22 @@
 				],
 			]
 		}
-		addConfig2 = {
-			attr: {
-				size: 'small',
-				rules: {
-					name: [{
-						required: true, message: '请输入名称', trigger: 'blur'
-					}],
-				}
-			},
-			columns: [
-				[
-					{
-						labelWidth: '70px',
-						span: 23,
-						label: '名称',
-						prop: 'name',
-						component: 'by-input',
-					},
-					{
-						labelWidth: '70px',
-						span: 23,
-						label: '简称',
-						slot: true,
-						prop: 'shortName',
-						component: 'by-input',
-					},
-					{
-						labelWidth: '70px',
-						span: 23,
-						label: '状态',
-						slot: true,
-						prop: 'status',
-					},
-					{
-						labelWidth: '70px',
-						span: 23,
-						label: '备注',
-						slot: true,
-						prop: 'remark',
-						component: 'by-input',
-						compConfig: {
-							attr: {
-								size: 'mini',
-								placeholder: '请输入备注',
-								type: 'textarea'
-							},
-						}
-					},
-				],
-			]
-		}
 		mounted() {
 			this.timer = setInterval(() => {
 				this.getDataList()
 			}, 300)
+			this.getTreeList();
+		}
+		getTreeList(){
+			api.treeList('maindataMaterialOrganizationCategory').then((res : any) => {
+				console.log(res);
+				var data:any = [{
+					id: 0,
+					name: '机构商品分类',
+					children: res.data
+				}];
+				(this as any).$refs.sideTree.setData(data);
+			})
 		}
 		//点击树获取数据
 		onChangeTree(e : any) {
@@ -355,16 +298,25 @@
 					api.saveList(query, 'maindataMaterialOrganizationCategory').then((res : any) => {
 						if (res.code === 200) {
 							this.$message.success(this.popTitle + '成功!');
-							(this as any).$refs.sideTree.request();
+							// (this as any).$refs.sideTree.request();
+							this.getTreeList()
 							this.dialogFormVisible = false;
 							this.getDataList();
 						} else this.$message.error(res.msg);
 					}).catch(() => {});
 				} else if (this.popTitle === '编辑') {
+					if(!query.parentId){
+						query.parentId=0
+					}
+					if(query.parentId==query.id){
+						this.$message.error('不能设置自己是自己的上级节点')
+						return false
+					}
 					api.updateList(query, 'maindataMaterialOrganizationCategory').then((res : any) => {
 						if (res.code === 200) {
 							this.$message.success(this.popTitle + '成功!');
-							(this as any).$refs.sideTree.request();
+							// (this as any).$refs.sideTree.request();
+							this.getTreeList()
 							this.dialogFormVisible = false;
 							this.getDataList();
 						} else this.$message.error(res.msg);
@@ -372,32 +324,6 @@
 				}
 			}).catch(() => {});
 		}
-		confirm2() {
-			(this as any).$refs.addFormId2.validate().then(() => {
-				let query = (this as any).$refs.addFormId2.getValue();
-				query.status = this.radio;
-				if (this.popTitle === '新增') {
-					query.parentId = 0;
-					api.saveList(query, 'maindataMaterialOrganizationCategory').then((res : any) => {
-						if (res.code === 200) {
-							this.$message.success(this.popTitle + '成功!');
-							(this as any).$refs.sideTree.request();
-							this.dialogFormVisible2 = false;
-							this.getDataList();
-						} else this.$message.error(res.msg);
-					}).catch(() => {});
-				} else if (this.popTitle === '编辑') {
-					api.updateList(query, 'maindataMaterialOrganizationCategory').then((res : any) => {
-						if (res.code === 200) {
-							this.$message.success(this.popTitle + '成功!');
-							(this as any).$refs.sideTree.request();
-							this.dialogFormVisible2 = false;
-							this.getDataList();
-						} else this.$message.error(res.msg);
-					}).catch(() => {});
-				}
-			}).catch(() => {});
-		}
 		// 获取列表数据
 		getDataList() {
 			if (!this.$refs.moduleView) {
@@ -418,11 +344,6 @@
 			api.pageList(query, 'maindataMaterialOrganizationCategory').then((res : any) => {
 				loading.close();
 				if (res.code === 200) {
-					if(res.data.records.length==0){
-						this.datlis = false
-					}else{
-						this.datlis = true
-					};
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
 					let page = {
 						pageNo: res.data.current, //当前页
@@ -441,25 +362,22 @@
 		onAdd() {
 			this.popTitle = '新增'
 			this.radio = 0
-			console.log(this.datlis)
-			if(!this.datlis){
-				this.dialogFormVisible2 = true;
-			}else{
-				this.dialogFormVisible = true;
-				setTimeout(() => {
-					(this as any).$refs.addFormId.setValue();
-					(this as any).$refs.addFormId.$refs['parentName--comp'][0].request();
-					this.$nextTick(()=>{
-						(this as any).$refs.addFormId.clearValidate();
-					})
-				}, 0)
-			}
+			this.dialogFormVisible = true;
+			this.getTreeList();
+			setTimeout(() => {
+				(this as any).$refs.addFormId.setValue();
+				(this as any).$refs.addFormId.$refs['parentName--comp'][0].request();
+				this.$nextTick(()=>{
+					(this as any).$refs.addFormId.clearValidate();
+				})
+			}, 0)
 		}
 		// 打开编辑
 		openEdit(e : any) {
 			console.log('打开编辑 ==> ', e);
 			this.popTitle = '编辑';
 			let loading = this.$loading({ target: '.main-container' });
+			this.getTreeList();
 			api.single({ id: e.id }, 'maindataMaterialOrganizationCategory').then((res : any) => {
 				if (res.code === 200) {
 					let data = res.data;
@@ -468,7 +386,6 @@
 						api.single({ id: data.parentId }, 'maindataMaterialOrganizationCategory').then((v : any) => {
 							loading.close();
 							if (v.code === 200) {
-								console.log(data.parentId)
 								data.parentName = v.data.name;
 								this.dialogFormVisible = true;
 								setTimeout(() => { (this as any).$refs.addFormId.setValue(data) }, 0);
@@ -476,9 +393,10 @@
 						}).catch(() => loading.close());
 					}else{
 						loading.close();
-						this.dialogFormVisible2 = true;
-						setTimeout(() => { (this as any).$refs.addFormId2.setValue(data) }, 0);
+						this.dialogFormVisible = true;
+						setTimeout(() => { (this as any).$refs.addFormId.setValue(data) }, 0);
 					}
+					
 				}
 			}).catch(() => loading.close());
 		}
@@ -492,7 +410,8 @@
 			}).then(() => {
 				api.delCategoryId({ id: item.id }, 'maindataMaterialOrganizationCategory').then((res : any) => {
 					if (res.code === 200) {
-						(this as any).$refs.sideTree.request();
+						// (this as any).$refs.sideTree.request();
+						this.getTreeList()
 						this.getDataList();
 						this.$message.success('删除成功');
 					} else this.$message.error(res.msg);
@@ -502,7 +421,8 @@
 		// 刷新/重置
 		onRefresh() {
 			(this as any).$refs.moduleView.clearSearch();
-			(this as any).$refs.sideTree.request();
+			// (this as any).$refs.sideTree.request();
+			this.getTreeList()
 			this.parentIds = '';
 			this.getDataList();
 		}

+ 28 - 25
src/views/audit/depots/index.vue

@@ -326,12 +326,14 @@
 								(this as any).openEdit2(item)
 							}
 						}
-					}, {
-						name: '删除',
-						event: {
-							click: (item : any) => (this as any).doDelete3(item, 'maindataStoringLocation')
-						}
-					}]
+					}, 
+					// {
+					// 	name: '删除',
+					// 	event: {
+					// 		click: (item : any) => (this as any).doDelete3(item, 'maindataStoringLocation')
+					// 	}
+					// },
+					]
 				}]
 			},
 		}
@@ -524,17 +526,17 @@
 							loading.close();
 							if (res.code === 200) {
 								this.dialogFormVisible = false;
-								this.$message.success(this.popTitle + '成功');
+								// this.$message.success(this.popTitle + '成功');
 								this.getDataList();
-								this.$confirm('是否注册仓位', '提示', {
-									confirmButtonText: '确定',
-									cancelButtonText: '取消',
-								}).then(() => {
-									api.single({ id: res.data }, 'maindataStorehouse').then((data : any) => {
-										this.changeTab(data.data);
-										this.onAdd2();
-									}).catch(() => {});
-								}).catch(() => {
+								// this.$confirm('是否注册仓位', '提示', {
+								// 	confirmButtonText: '确定',
+								// 	cancelButtonText: '取消',
+								// }).then(() => {
+								// 	api.single({ id: res.data }, 'maindataStorehouse').then((data : any) => {
+								// 		this.changeTab(data.data);
+								// 		this.onAdd2();
+								// 	}).catch(() => {});
+								// }).catch(() => {
 									let data = {
 										storehouseId: res.data,
 										idDelete: 0,
@@ -547,10 +549,11 @@
 									};
 									api.saveList(data, 'maindataStoringLocation').then((res : any) => {
 										if (res.code === 200) {
-											this.$alert('此仓库将新增一个默认仓位');
+											this.$message.success('仓库注册成功,同时新增一个默认仓位')
+											// this.$alert('此仓库将新增一个默认仓位');
 										} else this.$message.error(res.msg)
 									}).catch(() => {});
-								});
+								// });
 							} else this.$message.error(res.msg)
 						}).catch(() => loading.close());
 					} else if (this.popTitle === '编辑') {
@@ -774,11 +777,11 @@
 				center: true
 			}).then(() => {
 				let loading = this.$loading({ target: '.main-container' });
-				api.single({ id: item.id }, 'maindataStorehouse').then((res : any) => {
-					if (res.data.subList.length > 0) {
-						loading.close();
-						this.$message.warning('此仓库下有仓位,不可删除!');
-					} else {
+				// api.single({ id: item.id }, 'maindataStorehouse').then((res : any) => {
+				// 	if (res.data.subList.length > 0) {
+				// 		loading.close();
+				// 		this.$message.warning('此仓库下有仓位,不可删除!');
+				// 	} else {
 						api.deleteList({ ids: item.id }, url).then((res : any) => {
 							loading.close();
 							if (res.code === 200) {
@@ -786,8 +789,8 @@
 								this.$message.success('删除成功');
 							} else this.$message.error(res.msg)
 						}).catch(() => loading.close());
-					}
-				}).catch(() => loading.close());
+				// 	}
+				// }).catch(() => loading.close());
 			}).catch(() => this.$message.info('已取消删除'));
 		}
 		// 仓位工具栏删除

+ 25 - 9
src/views/audit/distributor/index.vue

@@ -61,12 +61,12 @@
 				},
 				defaultExpandAll: true,
 				label: 'name',
-				resType: 'data'
+				// resType: 'data'
 			},
-			request: {
-				url: '/maindata/maindataOrganizationCategory/treeUseList',
-				method: 'GET'
-			}
+			// request: {
+			// 	url: '/maindata/maindataOrganizationCategory/treeUseList',
+			// 	method: 'GET'
+			// }
 		}
 		config : any = {
 			attr: {
@@ -371,6 +371,18 @@
 			this.timer = setInterval(() => {
 				this.getDataList()
 			}, 300)
+			this.getTreeList();
+		}
+		getTreeList(){
+			api.treeList('maindataOrganizationCategory').then((res : any) => {
+				console.log(res);
+				var data:any = [{
+					id: 0,
+					name: '机构分类',
+					children: res.data
+				}];
+				(this as any).$refs.sideTree.setData(data);
+			})
 		}
 		//点击树获取数据
 		onChangeTree(e : any) {
@@ -419,7 +431,8 @@
 						loading.close();
 						if (res.code === 200) {
 							this.$message.success('保存成功');
-							(this as any).$refs.sideTree.request();
+							// (this as any).$refs.sideTree.request();
+							this.getTreeList();
 							this.isShow = 'home'; // 展示类型
 							this.dialogFormVisible = false;
 							this.getDataList();
@@ -430,7 +443,8 @@
 						loading.close();
 						if (res.code === 200) {
 							this.$message.success('编辑成功');
-							(this as any).$refs.sideTree.request();
+							// (this as any).$refs.sideTree.request();
+							this.getTreeList();
 							this.isShow = 'home'; // 展示类型
 							this.dialogFormVisible = false;
 							this.getDataList();
@@ -514,7 +528,8 @@
 				api.deleteList({ ids: item.id }, 'maindataMaterialDistributor').then((res : any) => {
 					loading.close();
 					if (res.code === 200) {
-						(this as any).$refs.sideTree.request();
+						// (this as any).$refs.sideTree.request();
+						this.getTreeList();
 						this.getDataList();
 						this.$message.success('删除成功');
 					} else this.$message.error(res.msg);
@@ -524,7 +539,8 @@
 		// 刷新/重置
 		onRefresh() {
 			(this as any).$refs.moduleView.clearSearch();
-			(this as any).$refs.sideTree.request();
+			// (this as any).$refs.sideTree.request();
+			this.getTreeList();
 			this.categoryIds = '';
 			this.getDataList();
 		}

+ 28 - 12
src/views/audit/manufacturer/index.vue

@@ -61,12 +61,12 @@
 				},
 				defaultExpandAll: true,
 				label: 'name',
-				resType: 'data'
+				// resType: 'data'
 			},
-			request: {
-				url: '/maindata/maindataOrganizationCategory/treeUseList',
-				method: 'GET'
-			}
+			// request: {
+			// 	url: '/maindata/maindataOrganizationCategory/treeUseList',
+			// 	method: 'GET'
+			// }
 		}
 		config : any = {
 			attr: {
@@ -195,9 +195,9 @@
 			attr: {
 				size: 'medium',
 				rules: {
-					categoryName: [{
-						required: true, message: '请输入父级', trigger: 'change'
-					}],
+					// categoryName: [{
+					// 	required: true, message: '请输入父级', trigger: 'change'
+					// }],
 					name: [{
 						required: true, message: '请输入名称', trigger: 'blur'
 					}],
@@ -372,6 +372,18 @@
 			this.timer = setInterval(() => {
 				this.getDataList()
 			}, 300)
+			this.getTreeList();
+		}
+		getTreeList(){
+			api.treeList('maindataOrganizationCategory').then((res : any) => {
+				console.log(res);
+				var data:any = [{
+					id: 0,
+					name: '机构分类',
+					children: res.data
+				}];
+				(this as any).$refs.sideTree.setData(data);
+			})
 		}
 		//点击树获取数据
 		onChangeTree(e : any) {
@@ -419,7 +431,8 @@
 						loading.close();
 						if (res.code === 200) {
 							this.$message.success('保存成功');
-							(this as any).$refs.sideTree.request();
+							// (this as any).$refs.sideTree.request();
+							this.getTreeList();
 							this.isShow = 'home'; // 展示类型
 							this.getDataList();
 						} else this.$message.error(res.msg);
@@ -429,7 +442,8 @@
 						loading.close();
 						if (res.code === 200) {
 							this.$message.success('编辑成功');
-							(this as any).$refs.sideTree.request();
+							// (this as any).$refs.sideTree.request();
+							this.getTreeList();
 							this.isShow = 'home'; // 展示类型
 							this.getDataList();
 						} else this.$message.error(res.msg);
@@ -512,7 +526,8 @@
 				api.deleteList({ ids: item.id }, 'maindataMaterialManufacturer').then((res : any) => {
 					loading.close();
 					if (res.code === 200) {
-						(this as any).$refs.sideTree.request();
+						// (this as any).$refs.sideTree.request();
+						this.getTreeList();
 						this.getDataList();
 						this.$message.success('删除成功');
 					} else this.$message.error(res.msg);
@@ -522,7 +537,8 @@
 		// 刷新/重置
 		onRefresh() {
 			(this as any).$refs.moduleView.clearSearch();
-			(this as any).$refs.sideTree.request();
+			// (this as any).$refs.sideTree.request();
+			this.getTreeList();
 			this.categoryIds = '';
 			this.getDataList();
 		}

+ 53 - 21
src/views/audit/organClassify/index.vue

@@ -12,7 +12,7 @@
 			</module-view>
 		</div>
 		<!-- 新增/编辑弹窗 -->
-		<el-dialog :title="popTitle+'机构分类'" :visible.sync="dialogFormVisible" width="30%">
+		<el-dialog :title="popTitle+'机构分类'" :visible.sync="dialogFormVisible" width="30%" :destroy-on-close="true">
 			<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>
@@ -45,12 +45,12 @@
 				},
 				defaultExpandAll: true,
 				label: 'name',
-				resType: 'data'
+				// resType: 'data'
 			},
-			request: {
-				url: '/maindata/maindataOrganizationCategory/treeList',
-				method: 'GET'
-			}
+			// request: {
+			// 	url: '/maindata/maindataOrganizationCategory/treeList',
+			// 	method: 'GET'
+			// }
 		}
 		config : any = {
 			attr:{
@@ -151,9 +151,9 @@
 			attr: {
 				size: 'small',
 				rules: {
-					parentName: [{
-						required: true, message: '请输入父级', trigger: 'blur'
-					}],
+					// parentName: [{
+					// 	required: true, message: '请输入父级', trigger: 'blur'
+					// }],
 					name: [{
 						required: true, message: '请输入名称', trigger: 'blur'
 					}],
@@ -219,6 +219,18 @@
 			this.timer = setInterval(() => {
 				this.getDataList()
 			}, 300)
+			this.getTreeList();
+		}
+		getTreeList(){
+			api.treeList('maindataOrganizationCategory').then((res : any) => {
+				console.log(res);
+				var data:any = [{
+					id: 0,
+					name: '机构分类',
+					children: res.data
+				}];
+				(this as any).$refs.sideTree.setData(data);
+			})
 		}
 		//点击树获取数据
 		onChangeTree(e : any) {
@@ -250,15 +262,25 @@
 					api.saveList(query, 'maindataOrganizationCategory').then((res : any) => {
 						if (res.code === 200) {
 							this.$message.success(this.popTitle + '成功!');
-							(this as any).$refs.sideTree.request();
+							// (this as any).$refs.sideTree.request();
+							this.getTreeList();
 							this.getDataList();
 						} else this.$message.error(res.msg);
 					}).catch(() => {});
 				} else if (this.popTitle === '编辑') {
+					if(!query.parentId){
+						query.parentId=0
+					}
+					if(query.parentId==query.id){
+						this.$message.error('不能设置自己是自己的上级节点')
+						return false
+					}
 					api.updateList(query, 'maindataOrganizationCategory').then((res : any) => {
 						if (res.code === 200) {
-							this.$message.success(this.popTitle + '成功!');
-							(this as any).$refs.sideTree.request();
+							// this.$message.success(this.popTitle + '成功!');
+							this.getTreeList();
+							// (this as any).$refs.sideTree.request();
+							this.getTreeList();
 							this.getDataList();
 						} else this.$message.error(res.msg);
 					}).catch(() => {});
@@ -303,6 +325,7 @@
 			this.popTitle = '新增'
 			this.dialogFormVisible = true;
 			this.radio = 0;
+			this.getTreeList();
 			setTimeout(() => {
 				(this as any).$refs.addFormId.setValue();
 				(this as any).$refs.addFormId.$refs['parentName--comp'][0].request();
@@ -312,18 +335,25 @@
 		openEdit(e : any) {
 			this.popTitle = '编辑'
 			let loading = this.$loading({ target: '.main-container' });
+			this.getTreeList();
 			api.single({ id: e.id }, 'maindataOrganizationCategory').then((res : any) => {
 				if (res.code === 200) {
 					let data = res.data;
 					this.radio = res.data.status;
-					api.single({ id: res.data.parentId }, 'maindataOrganizationCategory').then((res : any) => {
+					if(data.parentId!=0){
+						api.single({ id: data.parentId }, 'maindataOrganizationCategory').then((res : any) => {
+							loading.close();
+							if (res.code === 200) {
+								data.parentName = res.data.name;
+								this.dialogFormVisible = true;
+								this.$nextTick(() => (this as any).$refs.addFormId.setValue(data));
+							}
+						}).catch(() => loading.close());
+					}else{
 						loading.close();
-						if (res.code === 200) {
-							data.parentName = res.data.name;
-							this.dialogFormVisible = true;
-							this.$nextTick(() => (this as any).$refs.addFormId.setValue(data));
-						}
-					}).catch(() => loading.close());
+						this.dialogFormVisible = true;
+						setTimeout(() => { (this as any).$refs.addFormId.setValue(data) }, 0);
+					}
 				}
 			}).catch(() => loading.close());
 		}
@@ -337,7 +367,8 @@
 			}).then(() => {
 				api.delCategoryId({ id: item.id }, 'maindataOrganizationCategory').then((res : any) => {
 					if (res.code === 200) {
-						(this as any).$refs.sideTree.request();
+						// (this as any).$refs.sideTree.request();
+						this.getTreeList();
 						this.getDataList();
 						this.$message.success('删除成功!');
 					} else this.$message.error(res.msg);
@@ -349,7 +380,8 @@
 		// 刷新/重置
 		onRefresh() {
 			(this as any).$refs.moduleView.clearSearch();
-			(this as any).$refs.sideTree.request();
+			// (this as any).$refs.sideTree.request();
+			this.getTreeList();
 			this.parentIds = '';
 			this.getDataList();
 		}

+ 51 - 20
src/views/audit/productClassification/index.vue

@@ -12,7 +12,7 @@
 			</module-view>
 		</div>
 		<!-- 新增/编辑弹窗 -->
-		<el-dialog :title="popTitle+'商品分类'" :visible.sync="dialogFormVisible" width="30%">
+		<el-dialog :title="popTitle+'商品分类'" :visible.sync="dialogFormVisible" width="30%" :destroy-on-close="true">
 			<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>
@@ -47,12 +47,12 @@
 				},
 				defaultExpandAll: true,
 				label: 'name',
-				resType: 'data'
+				// resType: 'data'
 			},
-			request: {
-				url: '/maindata/maindataMaterialCategory/treeList',
-				method: 'GET'
-			}
+			// request: {
+			// 	url: '/maindata/maindataMaterialCategory/treeList',
+			// 	method: 'GET'
+			// }
 		}
 		config : any = {
 			attr: {
@@ -175,9 +175,9 @@
 					name: [{
 						required: true, message: '请输入名称', trigger: 'blur'
 					}],
-					parentName: [{
-						required: true, message: '请选择上级', trigger: 'change'
-					}],
+					// parentName: [{
+					// 	required: true, message: '请选择上级', trigger: 'change'
+					// }],
 				}
 			},
 			columns: [
@@ -248,6 +248,18 @@
 			this.timer = setInterval(() => {
 				this.getDataList()
 			}, 500)
+			this.getTreeList();
+		}
+		getTreeList(){
+			api.treeList('maindataMaterialCategory').then((res : any) => {
+				console.log(res);
+				var data:any = [{
+					id: 0,
+					name: '物料分类',
+					children: res.data
+				}];
+				(this as any).$refs.sideTree.setData(data);
+			})
 		}
 		//点击树获取数据
 		onChangeTree(e : any) {
@@ -282,15 +294,24 @@
 					api.saveList(query, 'maindataMaterialCategory').then((res : any) => {
 						if (res.code === 200) {
 							this.$message.success(this.popTitle + '成功!');
-							(this as any).$refs.sideTree.request();
+							// (this as any).$refs.sideTree.request();
+							this.getTreeList();
 							this.getDataList();
 						} else this.$message.error(res.msg);
 					}).catch(() => {});
 				} else if (this.popTitle === '编辑') {
+					if(!query.parentId){
+						query.parentId=0
+					}
+					if(query.parentId==query.id){
+						this.$message.error('不能设置自己是自己的上级节点')
+						return false
+					}
 					api.updateList(query, 'maindataMaterialCategory').then((res : any) => {
 						if (res.code === 200) {
 							this.$message.success(this.popTitle + '成功!');
-							(this as any).$refs.sideTree.request();
+							// (this as any).$refs.sideTree.request();
+							this.getTreeList();
 							this.getDataList();
 						} else this.$message.error(res.msg);
 					}).catch(() => {});
@@ -336,6 +357,7 @@
 			this.popTitle = '新增'
 			this.dialogFormVisible = true;
 			this.radio = 0
+			this.getTreeList();
 			setTimeout(() => {
 				(this as any).$refs.addFormId.setValue();
 				(this as any).$refs.addFormId.$refs['parentName--comp'][0].request();
@@ -346,18 +368,25 @@
 			console.log('打开编辑 ==> ', e);
 			this.popTitle = '编辑'
 			let loading = this.$loading({ target: '.main-container' });
+			this.getTreeList();
 			api.single({ id: e.id }, 'maindataMaterialCategory').then((res : any) => {
 				if (res.code === 200) {
 					let data = res.data;
 					this.radio = data.status;
-					api.single({ id: data.parentId }, 'maindataMaterialCategory').then((res : any) => {
+					if(data.parentId!=0){
+						api.single({ id: data.parentId }, 'maindataMaterialCategory').then((res : any) => {
+							loading.close();
+							if (res.code === 200) {
+								data.parentName = res.data.name;
+								this.dialogFormVisible = true;
+								setTimeout(() => { (this as any).$refs.addFormId.setValue(data) }, 0);
+							}
+						}).catch(() => loading.close());
+					}else{
 						loading.close();
-						if (res.code === 200) {
-							data.parentName = res.data.name;
-							this.dialogFormVisible = true;
-							setTimeout(() => { (this as any).$refs.addFormId.setValue(data) }, 0);
-						}
-					}).catch(() => loading.close());
+						this.dialogFormVisible = true;
+						setTimeout(() => { (this as any).$refs.addFormId.setValue(data) }, 0);
+					}
 				}
 			}).catch(() => loading.close());
 		}
@@ -371,7 +400,8 @@
 			}).then(() => {
 				api.delCategoryId({ id: item.id }, 'maindataMaterialCategory').then((res : any) => {
 					if (res.code === 200) {
-						(this as any).$refs.sideTree.request();
+						// (this as any).$refs.sideTree.request();
+						this.getTreeList();
 						this.getDataList();
 						this.$message.success('删除成功');
 					} else this.$message.error(res.msg);
@@ -381,7 +411,8 @@
 		// 刷新/重置
 		onRefresh() {
 			(this as any).$refs.moduleView.clearSearch();
-			(this as any).$refs.sideTree.request();
+			// (this as any).$refs.sideTree.request();
+			this.getTreeList();
 			this.parentIds = '';
 			this.getDataList();
 		}

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

@@ -183,7 +183,7 @@
 			width="518px">
 			<el-date-picker	v-model="stime" type="date" placeholder="选择日期" value-format="yyyy-MM-dd"></el-date-picker>
 			<span style="margin: 0 12px;">至</span>
-			<el-date-picker	v-model="etime" type="date" readonly placeholder="选择日期"></el-date-picker>
+			<el-date-picker	v-model="etime" type="date" :picker-options="pickerOptions" placeholder="选择日期" value-format="yyyy-MM-dd"></el-date-picker>
 			<span slot="footer" class="dialog-footer">
 				<el-button @click="dateDialogVisible = false">取 消</el-button>
 				<el-button type="primary" @click="dateConfirm">确 定</el-button>
@@ -237,6 +237,11 @@
 		dateLoading = false
 		stime = null
 		etime = new Date()
+		pickerOptions : any = {
+			disabledDate(time : any) {
+			  return time.getTime() > Date.now();
+			}
+		}
 		// tab
 		toolConfig = {
 			tools: {
@@ -1451,7 +1456,7 @@
 		dateConfirm(){
 			if((this as any).stime){
 				(this as any).dateLoading = true;
-				api.syncMaterialByKingdeeToOmsy({stime: (this as any).stime}).then((res : any) => {
+				api.getFinancialCode({stime: (this as any).stime, etime: (this as any).etime}).then((res : any) => {
 					if(res.code === 200){
 						(this as any).dateDialogVisible = false;
 						(this as any).dateLoading = false;

+ 25 - 12
src/views/audit/supplier/index.vue

@@ -59,12 +59,12 @@
 				},
 				defaultExpandAll: true,
 				label: 'name',
-				resType: 'data'
+				// resType: 'data'
 			},
-			request: {
-				url: '/maindata/maindataOrganizationCategory/treeUseList',
-				method: 'GET',
-			}
+			// request: {
+			// 	url: '/maindata/maindataOrganizationCategory/treeUseList',
+			// 	method: 'GET',
+			// }
 		}
 		config : any = {
 			attr: {
@@ -193,9 +193,9 @@
 			attr: {
 				size: 'medium',
 				rules: {
-					categoryName: [{
-						required: true, message: '请输入父级', trigger: 'change'
-					}],
+					// categoryName: [{
+					// 	required: true, message: '请输入父级', trigger: 'change'
+					// }],
 					name: [{
 						required: true, message: '请输入名称', trigger: 'blur'
 					}],
@@ -369,6 +369,18 @@
 			this.timer = setInterval(() => {
 				this.getDataList()
 			}, 300)
+			this.getTreeList();
+		}
+		getTreeList(){
+			api.treeList('maindataOrganizationCategory').then((res : any) => {
+				console.log(res);
+				var data:any = [{
+					id: 0,
+					name: '机构分类',
+					children: res.data
+				}];
+				(this as any).$refs.sideTree.setData(data);
+			})
 		}
 		//点击树获取数据
 		onChangeTree(e : any) {
@@ -416,7 +428,7 @@
 						loading.close();
 						if (res.code === 200) {
 							this.$message.success('保存成功');
-							(this as any).$refs.sideTree.request();
+							// (this as any).$refs.sideTree.request();
 							this.isShow = 'home'; // 展示类型
 							this.getDataList();
 						} else this.$message.error(res.msg);
@@ -426,7 +438,7 @@
 						loading.close();
 						if (res.code === 200) {
 							this.$message.success('编辑成功');
-							(this as any).$refs.sideTree.request();
+							// (this as any).$refs.sideTree.request();
 							this.isShow = 'home'; // 展示类型
 							this.getDataList();
 						} else this.$message.error(res.msg);
@@ -509,7 +521,7 @@
 				api.deleteList({ ids: item.id }, 'maindataMaterialSupplier').then((res : any) => {
 					loading.close();
 					if (res.code === 200) {
-						(this as any).$refs.sideTree.request();
+						// (this as any).$refs.sideTree.request();
 						this.getDataList();
 						this.$message.success('删除成功');
 					} else this.$message.error(res.msg);
@@ -519,7 +531,8 @@
 		// 刷新/重置
 		onRefresh() {
 			(this as any).$refs.moduleView.clearSearch();
-			(this as any).$refs.sideTree.request();
+			// (this as any).$refs.sideTree.request();
+			this.getTreeList();
 			this.categoryIds = '';
 			this.getDataList();
 		}

+ 52 - 21
src/views/audit/virtually/index.vue

@@ -12,7 +12,7 @@
 			</module-view>
 		</div>
 		<!-- 新增/编辑弹窗 -->
-		<el-dialog :title="popTitle+'虚拟分类'" :visible.sync="dialogFormVisible" width="30%">
+		<el-dialog :title="popTitle+'虚拟分类'" :visible.sync="dialogFormVisible" width="30%" :destroy-on-close="true">
 			<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>
@@ -47,12 +47,12 @@
 				},
 				defaultExpandAll: true,
 				label: 'name',
-				resType: 'data'
+				// resType: 'data'
 			},
-			request: {
-				url: '/maindata/maindataMaterialVmcategory/treeList',
-				method: 'GET'
-			}
+			// request: {
+			// 	url: '/maindata/maindataMaterialVmcategory/treeList',
+			// 	method: 'GET'
+			// }
 		}
 		config : any = {
 			attr: {
@@ -175,9 +175,9 @@
 					name: [{
 						required: true, message: '请输入名称', trigger: 'blur'
 					}],
-					parentName: [{
-						required: true, message: '请选择上级', trigger: 'change'
-					}],
+					// parentName: [{
+					// 	required: true, message: '请选择上级', trigger: 'change'
+					// }],
 				}
 			},
 			columns: [
@@ -247,6 +247,18 @@
 			this.timer = setInterval(() => {
 				this.getDataList()
 			}, 500)
+			this.getTreeList();
+		}
+		getTreeList(){
+			api.treeList('maindataMaterialVmcategory').then((res : any) => {
+				console.log(res);
+				var data:any = [{
+					id: 0,
+					name: '虚拟分类',
+					children: res.data
+				}];
+				(this as any).$refs.sideTree.setData(data);
+			})
 		}
 		//点击树获取数据
 		onChangeTree(e : any) {
@@ -280,15 +292,24 @@
 					api.saveList(query, 'maindataMaterialVmcategory').then((res : any) => {
 						if (res.code === 200) {
 							this.$message.success(this.popTitle + '成功!');
-							(this as any).$refs.sideTree.request();
+							// (this as any).$refs.sideTree.request();
+							this.getTreeList();
 							this.getDataList();
 						} else this.$message.error(res.msg);
 					}).catch(() => {});
 				} else if (this.popTitle === '编辑') {
+					if(!query.parentId){
+						query.parentId=0
+					}
+					if(query.parentId==query.id){
+						this.$message.error('不能设置自己是自己的上级节点')
+						return false
+					}
 					api.updateList(query, 'maindataMaterialVmcategory').then((res : any) => {
 						if (res.code === 200) {
 							this.$message.success(this.popTitle + '成功!');
-							(this as any).$refs.sideTree.request();
+							// (this as any).$refs.sideTree.request();
+							this.getTreeList();
 							this.getDataList();
 						} else this.$message.error(res.msg);
 					}).catch(() => {});
@@ -334,6 +355,7 @@
 			this.popTitle = '新增'
 			this.dialogFormVisible = true;
 			this.radio = 0
+			this.getTreeList();
 			setTimeout(() => {
 				(this as any).$refs.addFormId.setValue();
 				(this as any).$refs.addFormId.$refs['parentName--comp'][0].request();
@@ -344,19 +366,26 @@
 			console.log('打开编辑 ==> ', e);
 			this.popTitle = '编辑'
 			let loading = this.$loading({ target: '.main-container' });
+			this.getTreeList();
 			api.single({ id: e.id }, 'maindataMaterialVmcategory').then((res : any) => {
 				if (res.code === 200) {
 					let data = res.data;
 					this.radio = data.status;
-					api.single({ id: data.parentId }, 'maindataMaterialVmcategory').then((res : any) => {
+					if(data.parentId!=0){
+						api.single({ id: data.parentId }, 'maindataMaterialVmcategory').then((res : any) => {
+							loading.close();
+							if (res.code === 200) {
+								data.parentName = res.data.name;
+								this.dialogFormVisible = true;
+								console.log(data, 'data');
+								setTimeout(() => { (this as any).$refs.addFormId.setValue(data) }, 0);
+							}
+						}).catch(() => {});
+					}else{
 						loading.close();
-						if (res.code === 200) {
-							data.parentName = res.data.name;
-							this.dialogFormVisible = true;
-							console.log(data, 'data');
-							setTimeout(() => { (this as any).$refs.addFormId.setValue(data) }, 0);
-						}
-					}).catch(() => {});
+						this.dialogFormVisible = true;
+						setTimeout(() => { (this as any).$refs.addFormId.setValue(data) }, 0);
+					}
 				}
 			}).catch(() => loading.close());
 		}
@@ -370,7 +399,8 @@
 			}).then(() => {
 				api.delCategoryId({ id: item.id }, 'maindataMaterialVmcategory').then((res : any) => {
 					if (res.code === 200) {
-						(this as any).$refs.sideTree.request();
+						// (this as any).$refs.sideTree.request();
+						this.getTreeList();
 						this.getDataList();
 						this.$message.success('删除成功');
 					} else this.$message.error(res.msg);
@@ -380,7 +410,8 @@
 		// 刷新/重置
 		onRefresh() {
 			(this as any).$refs.moduleView.clearSearch();
-			(this as any).$refs.sideTree.request();
+			// (this as any).$refs.sideTree.request();
+			this.getTreeList();
 			this.parentIds = '';
 			this.getDataList();
 		}