AlanWong 2 years ago
parent
commit
bb1d33b669

+ 2 - 1
src/api/login.ts

@@ -36,7 +36,8 @@ export function refreshToken() {
 export function getInfo() {
 export function getInfo() {
 	return request({
 	return request({
 		url: '/system/user/getInfo',
 		url: '/system/user/getInfo',
-		method: 'get'
+		method: 'get',
+		params:{tenantId:'000000'}
 	})
 	})
 }
 }
 
 

+ 19 - 65
src/views/audit/agencyGoods/index.vue

@@ -3,9 +3,7 @@
 		<div class="bill-left">
 		<div class="bill-left">
 			<div class="bill-tab">
 			<div class="bill-tab">
 				<div class="tab-title">导航</div>
 				<div class="tab-title">导航</div>
-<!-- 				<el-tree :data="data" node-key="id" :default-expanded-keys="expandedKeys" :props="props"
-					@node-click="handleNodeClick"></el-tree> -->
-					<side-tree :propConfig="treeConfig" @onChange="onChangeTree" />
+				<side-tree :propConfig="treeConfig" @onChange="onChangeTree" ref="sideTree" />
 			</div>
 			</div>
 		</div>
 		</div>
 		<div class="bill-main">
 		<div class="bill-main">
@@ -45,10 +43,6 @@
 		data : any = []
 		data : any = []
 		expandedKeys : any = []
 		expandedKeys : any = []
 		parentId : any = ''
 		parentId : any = ''
-		props = {
-			label: 'name',
-			children: 'children'
-		}
 		// 右边
 		// 右边
 		baseURL : any = process.env.VUE_APP_BASE_API
 		baseURL : any = process.env.VUE_APP_BASE_API
 		timeNum = 0;
 		timeNum = 0;
@@ -250,7 +244,6 @@
 			]
 			]
 		}
 		}
 		mounted() {
 		mounted() {
-			// this.getTreeList()
 			this.timer = setInterval(() => {
 			this.timer = setInterval(() => {
 				this.getDataList()
 				this.getDataList()
 			}, 300)
 			}, 300)
@@ -270,18 +263,6 @@
 				}
 				}
 			})
 			})
 		}
 		}
-		// 获取树型导航数据
-		getTreeList() {
-			api.treeList('maindataMaterialOrganizationCategory').then((res : any) => {
-				if (res.code === 200) {
-					this.data = res.data;
-					this.expandedKeys.push(res.data[0].id)
-					res.data[0].children.map((v : any) => {
-						this.expandedKeys.push(v.id)
-					})
-				} else this.failHandle(res)
-			})
-		}
 		// 确认新增/编辑
 		// 确认新增/编辑
 		confirm() {
 		confirm() {
 			(this as any).$refs.addFormId.validate().then(() => {
 			(this as any).$refs.addFormId.validate().then(() => {
@@ -291,24 +272,18 @@
 				if (this.popTitle === '新增') {
 				if (this.popTitle === '新增') {
 					api.saveList(query, 'maindataMaterialOrganizationCategory').then((res : any) => {
 					api.saveList(query, 'maindataMaterialOrganizationCategory').then((res : any) => {
 						if (res.code === 200) {
 						if (res.code === 200) {
-							this.$message({
-								type: 'success',
-								message: this.popTitle + '成功!'
-							});
-							this.getTreeList();
+							this.$message.success(this.popTitle + '成功!');
+							(this as any).$refs.sideTree.request();
 							this.getDataList();
 							this.getDataList();
-						} else this.failHandle(res)
+						} else this.$message.error(res.msg);
 					})
 					})
 				} else if (this.popTitle === '编辑') {
 				} else if (this.popTitle === '编辑') {
 					api.updateList(query, 'maindataMaterialOrganizationCategory').then((res : any) => {
 					api.updateList(query, 'maindataMaterialOrganizationCategory').then((res : any) => {
 						if (res.code === 200) {
 						if (res.code === 200) {
-							this.$message({
-								type: 'success',
-								message: this.popTitle + '成功!'
-							});
-							this.getTreeList();
+							this.$message.success(this.popTitle + '成功!');
+							(this as any).$refs.sideTree.request();
 							this.getDataList();
 							this.getDataList();
-						} else this.failHandle(res)
+						} else this.$message.error(res.msg);
 					})
 					})
 				}
 				}
 			})
 			})
@@ -341,7 +316,7 @@
 						total: res.data.total //总条数
 						total: res.data.total //总条数
 					};
 					};
 					(this.$refs.moduleView as any).setPage(page)
 					(this.$refs.moduleView as any).setPage(page)
-				} else this.failHandle(res)
+				} else this.$message.error(res.msg);
 			})
 			})
 		}
 		}
 		// 工具栏方法
 		// 工具栏方法
@@ -381,7 +356,7 @@
 				selectData.map((v : any) => {
 				selectData.map((v : any) => {
 					ids += v.id + ','
 					ids += v.id + ','
 				})
 				})
-			} else return this.$message({ type: 'warning', message: '请选择删除数据' })
+			} else return this.$message.warning('请选择删除数据');
 			ids = ids.slice(0, ids.length - 1);
 			ids = ids.slice(0, ids.length - 1);
 			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
 			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
 				confirmButtonText: '确定',
 				confirmButtonText: '确定',
@@ -391,20 +366,12 @@
 			}).then(() => {
 			}).then(() => {
 				api.deleteList({ ids: ids }, 'maindataMaterialOrganizationCategory').then((res : any) => {
 				api.deleteList({ ids: ids }, 'maindataMaterialOrganizationCategory').then((res : any) => {
 					if (res.code === 200) {
 					if (res.code === 200) {
-						this.getTreeList();
+						(this as any).$refs.sideTree.request();
 						this.getDataList();
 						this.getDataList();
-						this.$message({
-							type: 'success',
-							message: '删除成功!'
-						});
-					} else this.failHandle(res)
+						this.$message.success('删除成功!');
+					} else this.$message.error(res.msg);
 				})
 				})
-			}).catch(() => {
-				this.$message({
-					type: 'info',
-					message: '已取消删除'
-				});
-			});
+			}).catch(() => this.$message.info('已取消删除'));
 		}
 		}
 		// 操作删除
 		// 操作删除
 		doDelete2(item : any) {
 		doDelete2(item : any) {
@@ -419,25 +386,17 @@
 						if (v.data.length > 0) return this.$message({ type: 'error', message: '此数据有子节点,不能进行删除!' })
 						if (v.data.length > 0) return this.$message({ type: 'error', message: '此数据有子节点,不能进行删除!' })
 						api.deleteList({ ids: item.id }, 'maindataMaterialOrganizationCategory').then((res : any) => {
 						api.deleteList({ ids: item.id }, 'maindataMaterialOrganizationCategory').then((res : any) => {
 							if (res.code === 200) {
 							if (res.code === 200) {
-								this.getTreeList();
+								(this as any).$refs.sideTree.request();
 								this.getDataList();
 								this.getDataList();
-								this.$message({
-									type: 'success',
-									message: '删除成功!'
-								});
-							} else this.failHandle(res)
+								this.$message.success('删除成功!');
+							} else this.$message.error(res.msg);
 						})
 						})
 					} else this.$message({ type: 'error', message: '删除失败!请稍后再试' })
 					} else this.$message({ type: 'error', message: '删除失败!请稍后再试' })
 				})
 				})
-			}).catch(() => {
-				this.$message({
-					type: 'info',
-					message: '已取消删除'
-				});
-			});
+			}).catch(() => this.$message.info('已取消删除'));
 		}
 		}
 		// 刷新
 		// 刷新
-		onRefresh(){
+		onRefresh() {
 			this.loading = this.$loading({ target: '.main-container' });
 			this.loading = this.$loading({ target: '.main-container' });
 			(this as any).$refs.moduleView.clearSearch();
 			(this as any).$refs.moduleView.clearSearch();
 			api.pageList({}, 'maindataMaterialOrganizationCategory').then((res : any) => {
 			api.pageList({}, 'maindataMaterialOrganizationCategory').then((res : any) => {
@@ -461,12 +420,6 @@
 				...query
 				...query
 			}, urlArr[urlArr.length - 1] + `_${new Date().getTime()}.xlsx`)
 			}, urlArr[urlArr.length - 1] + `_${new Date().getTime()}.xlsx`)
 		}
 		}
-		// 运行错误
-		failHandle(err : any) {
-			let msg = err.msg ? err.msg : '运行错误!';
-			this.$message.error(msg)
-		}
-
 	}
 	}
 </script>
 </script>
 <style lang="scss" scoped>
 <style lang="scss" scoped>
@@ -489,6 +442,7 @@
 			padding-right: 16px;
 			padding-right: 16px;
 			flex-shrink: 0;
 			flex-shrink: 0;
 			height: 740px;
 			height: 740px;
+
 			// box-sizing: border-box;
 			// box-sizing: border-box;
 			.bill-tab {
 			.bill-tab {
 				width: 150px;
 				width: 150px;

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

@@ -651,7 +651,7 @@
 						{
 						{
 							width: 80,
 							width: 80,
 							title: '状态',
 							title: '状态',
-							field: 'submitState',
+							field: 'status',
 							component: Assembly,
 							component: Assembly,
 						},
 						},
 						{
 						{

+ 13 - 28
src/views/audit/productClassification/index.vue

@@ -3,7 +3,7 @@
 		<div class="bill-left">
 		<div class="bill-left">
 			<div class="bill-tab">
 			<div class="bill-tab">
 				<div class="tab-title">导航</div>
 				<div class="tab-title">导航</div>
-					<side-tree :propConfig="treeConfig" @onChange="onChangeTree" />
+					<side-tree :propConfig="treeConfig" @onChange="onChangeTree" ref="sideTree" />
 			</div>
 			</div>
 		</div>
 		</div>
 		<div class="bill-main">
 		<div class="bill-main">
@@ -37,10 +37,6 @@
 		data : any = []
 		data : any = []
 		expandedKeys : any = []
 		expandedKeys : any = []
 		parentId : any = ''
 		parentId : any = ''
-		props = {
-			label: 'name',
-			children: 'children'
-		}
 		// 右边
 		// 右边
 		baseURL : any = process.env.VUE_APP_BASE_API
 		baseURL : any = process.env.VUE_APP_BASE_API
 		timeNum = 0;
 		timeNum = 0;
@@ -272,22 +268,18 @@
 				if (this.popTitle === '新增') {
 				if (this.popTitle === '新增') {
 					api.saveList(query, 'maindataMaterialCategory').then((res : any) => {
 					api.saveList(query, 'maindataMaterialCategory').then((res : any) => {
 						if (res.code === 200) {
 						if (res.code === 200) {
-							this.$message({
-								type: 'success',
-								message: this.popTitle + '成功!'
-							});
+							this.$message.success(this.popTitle + '成功!');
+							(this as any).$refs.sideTree.request();
 							this.getDataList();
 							this.getDataList();
-						} else this.failHandle(res)
+						} else this.$message.error(res.msg);
 					})
 					})
 				} else if (this.popTitle === '编辑') {
 				} else if (this.popTitle === '编辑') {
 					api.updateList(query, 'maindataMaterialCategory').then((res : any) => {
 					api.updateList(query, 'maindataMaterialCategory').then((res : any) => {
 						if (res.code === 200) {
 						if (res.code === 200) {
-							this.$message({
-								type: 'success',
-								message: this.popTitle + '成功!'
-							});
+							this.$message.success(this.popTitle + '成功!');
+							(this as any).$refs.sideTree.request();
 							this.getDataList();
 							this.getDataList();
-						} else this.failHandle(res)
+						} else this.$message.error(res.msg);
 					})
 					})
 				}
 				}
 			})
 			})
@@ -323,7 +315,7 @@
 						total: res.data.total //总条数
 						total: res.data.total //总条数
 					};
 					};
 					(this.$refs.moduleView as any).setPage(page)
 					(this.$refs.moduleView as any).setPage(page)
-				} else this.failHandle(res)
+				} else this.$message.error(res.msg);
 			})
 			})
 		}
 		}
 		// 工具栏方法
 		// 工具栏方法
@@ -374,12 +366,10 @@
 			}).then(() => {
 			}).then(() => {
 				api.deleteList({ ids: ids }, 'maindataMaterialCategory').then((res : any) => {
 				api.deleteList({ ids: ids }, 'maindataMaterialCategory').then((res : any) => {
 					if (res.code === 200) {
 					if (res.code === 200) {
+						(this as any).$refs.sideTree.request();
 						this.getDataList();
 						this.getDataList();
-						this.$message({
-							type: 'success',
-							message: '删除成功!'
-						});
-					} else this.failHandle(res)
+						this.$message.success('删除成功');
+					} else this.$message.error(res.msg);
 				})
 				})
 			}).catch(() => {
 			}).catch(() => {
 				this.$message({
 				this.$message({
@@ -401,12 +391,13 @@
 						if (v.data.length > 0) return this.$message({ type: 'error', message: '此数据有子节点,不能进行删除!' })
 						if (v.data.length > 0) return this.$message({ type: 'error', message: '此数据有子节点,不能进行删除!' })
 						api.deleteList({ ids: item.id }, 'maindataMaterialCategory').then((res : any) => {
 						api.deleteList({ ids: item.id }, 'maindataMaterialCategory').then((res : any) => {
 							if (res.code === 200) {
 							if (res.code === 200) {
+								(this as any).$refs.sideTree.request();
 								this.getDataList();
 								this.getDataList();
 								this.$message({
 								this.$message({
 									type: 'success',
 									type: 'success',
 									message: '删除成功!'
 									message: '删除成功!'
 								});
 								});
-							} else this.failHandle(res)
+							} else this.$message.error(res.msg);
 						})
 						})
 					} else this.$message({ type: 'error', message: '删除失败!请稍后再试' })
 					} else this.$message({ type: 'error', message: '删除失败!请稍后再试' })
 				})
 				})
@@ -433,12 +424,6 @@
 				...query
 				...query
 			}, urlArr[urlArr.length - 1] + `_${new Date().getTime()}.xlsx`)
 			}, urlArr[urlArr.length - 1] + `_${new Date().getTime()}.xlsx`)
 		}
 		}
-		// 运行错误
-		failHandle(err : any) {
-			let msg = err.msg ? err.msg : '运行错误!';
-			this.$message.error(msg)
-		}
-
 	}
 	}
 </script>
 </script>
 <style lang="scss" scoped>
 <style lang="scss" scoped>

+ 77 - 194
src/views/audit/productManagement/index.vue

@@ -4,14 +4,14 @@
 			<div class="bill-left" v-show="isShow==='home'" key="item">
 			<div class="bill-left" v-show="isShow==='home'" key="item">
 				<div class="bill-tab">
 				<div class="bill-tab">
 					<div class="bill-title">导航</div>
 					<div class="bill-title">导航</div>
-					<side-tree :propConfig="treeConfig" @onChange="onChangeTree" />
+					<side-tree :propConfig="treeConfig" @onChange="onChangeTree" ref="sideTree" />
 				</div>
 				</div>
 			</div>
 			</div>
 			<div class="bill-main" v-show="isShow==='home'" key="item2">
 			<div class="bill-main" v-show="isShow==='home'" key="item2">
 				<module-view :propConfig="config" ref="moduleView" @pagination="getDataList" @search="getDataList"
 				<module-view :propConfig="config" ref="moduleView" @pagination="getDataList" @search="getDataList"
 					@resert="getDataList" @clickHandle="clickHandle" @detail="getDetail" @onRefresh="onRefresh" />
 					@resert="getDataList" @clickHandle="clickHandle" @detail="getDetail" @onRefresh="onRefresh" />
 			</div>
 			</div>
-			<!-- 新增 -->
+			<!-- 新增/编辑 -->
 			<div class="detil" v-show="isShow==='add'" key="item3">
 			<div class="detil" v-show="isShow==='add'" key="item3">
 				<by-tool :propConfig="toolConfig" @clickHandle="insideTools" ref="byTool" />
 				<by-tool :propConfig="toolConfig" @clickHandle="insideTools" ref="byTool" />
 				<div class="box-shadow">
 				<div class="box-shadow">
@@ -92,7 +92,14 @@
 										<div @click="doComfirm" class="el-button el-button--primary el-button--small">确定</div>
 										<div @click="doComfirm" class="el-button el-button--primary el-button--small">确定</div>
 										<div @click="isAdd=false" class="el-button el-button--danger el-button--small">取消</div>
 										<div @click="isAdd=false" class="el-button el-button--danger el-button--small">取消</div>
 									</div>
 									</div>
-									<div><by-table :propConfig="tableConfig" @onChangeRow="getInputValue" ref="table"></by-table></div>
+									<div>
+										<by-table :propConfig="tableConfig" @onChangeRow="getInputValue" ref="table">
+											<template v-slot:stock="{row}">
+												<vxe-input v-if="!isEdit" v-model="row.stock" size="mini" type="integer"></vxe-input>
+												<span v-else>{{ row.stock }}</span>
+											</template>
+										</by-table>
+									</div>
 								</div>
 								</div>
 							</div>
 							</div>
 						</template>
 						</template>
@@ -141,11 +148,6 @@
 		attributeId : any = ''
 		attributeId : any = ''
 		intercept : any = ''
 		intercept : any = ''
 		// tab
 		// tab
-		props = {
-			label: 'name',
-			value: 'id',
-			children: 'children'
-		}
 		toolConfig = {
 		toolConfig = {
 			tools: {
 			tools: {
 				return: true,
 				return: true,
@@ -239,15 +241,7 @@
 					width: '110px',
 					width: '110px',
 					title: '库存',
 					title: '库存',
 					field: 'stock',
 					field: 'stock',
-					slot:true,
-					// component: 'by-input',
-					// compConfig: {
-					// 	attr: {
-					// 		size: 'mini',
-					// 		placeholder: ' ',
-					// 		type: "integer",
-					// 	},
-					// }
+					slot: true,
 				},
 				},
 				{
 				{
 					width: '120px',
 					width: '120px',
@@ -393,14 +387,7 @@
 					width: '80px',
 					width: '80px',
 					title: '库存',
 					title: '库存',
 					field: 'stock',
 					field: 'stock',
-					component: 'by-input',
-					compConfig: {
-						attr: {
-							size: 'mini',
-							placeholder: ' ',
-							type: "number",
-						},
-					}
+					slot: true,
 				},
 				},
 				{
 				{
 					width: '100px',
 					width: '100px',
@@ -493,15 +480,15 @@
 			attr: {
 			attr: {
 				size: 'small',
 				size: 'small',
 				rules: {
 				rules: {
-					// name: [{
-					// 	required: true, message: '请输入名称', trigger: 'blur'
-					// }],
-					// basePrice: [{
-					// 	required: true, message: '请输入基本售价', trigger: 'blur'
-					// }],
-					// categoryName: [{
-					// 	required: true, message: '请输入物料分类', trigger: 'change'
-					// }],
+					name: [{
+						required: true, message: '请输入名称', trigger: 'blur'
+					}],
+					basePrice: [{
+						required: true, message: '请输入基本售价', trigger: 'blur'
+					}],
+					categoryName: [{
+						required: true, message: '请输入物料分类', trigger: 'change'
+					}],
 				}
 				}
 			},
 			},
 			columns: [
 			columns: [
@@ -969,24 +956,26 @@
 					data.maindataMaterial.attributeList = ""
 					data.maindataMaterial.attributeList = ""
 				}
 				}
 				// console.log('data ==> ', data);
 				// console.log('data ==> ', data);
-				// if (this.isEdit) { // 编辑
-				// 	other.updateSpuAndSku(data, 'maindataMaterial').then((res : any) => {
-				// 		if (res.code === 200) {
-				// 			this.isShow = 'home';
-				// 			this.getDataList();
-				// 			this.$message({ type: 'success', message: res.msg })
-				// 		}
-				// 	})
-				// 	// 新增
-				// } else {
-				// 	other.saveSpuAndSku(data, 'maindataMaterial').then((res : any) => {
-				// 		if (res.code === 200) {
-				// 			this.isShow = 'home';
-				// 			this.getDataList();
-				// 			this.$message({ type: 'success', message: res.msg })
-				// 		}
-				// 	})
-				// }
+				if (this.isEdit) { // 编辑
+					other.updateSpuAndSku(data, 'maindataMaterial').then((res : any) => {
+						if (res.code === 200) {
+							this.isShow = 'home';
+							(this as any).$refs.sideTree.request();
+							this.getDataList();
+							this.$message.success('保存成功!');
+						}
+					})
+					// 新增
+				} else {
+					other.saveSpuAndSku(data, 'maindataMaterial').then((res : any) => {
+						if (res.code === 200) {
+							this.isShow = 'home';
+							(this as any).$refs.sideTree.request();
+							this.getDataList();
+							this.$message.success('保存成功!');
+						}
+					})
+				}
 
 
 			});
 			});
 		}
 		}
@@ -1049,16 +1038,7 @@
 							this.selectValue = '' // 物料属性名称
 							this.selectValue = '' // 物料属性名称
 							this.towTable = '' // 表格数据
 							this.towTable = '' // 表格数据
 							this.attributeList = []; // 属性规格
 							this.attributeList = []; // 属性规格
-							let singleTable = (this as any).$lodash.cloneDeep(this.singleTable);
-							singleTable.columns[5] = {
-								width: "80px",
-								field: "stock",
-								title: "库存"
-							};
-
-							console.log(singleTable.columns);
 							setTimeout(() => {
 							setTimeout(() => {
-								(this as any).$refs.singeTable.setConfig(singleTable); // 设置表格配置
 								(this as any).$refs.singeTable.setValue(res.data);
 								(this as any).$refs.singeTable.setValue(res.data);
 							}, 0)
 							}, 0)
 						} else {
 						} else {
@@ -1077,17 +1057,8 @@
 									field: v.field,
 									field: v.field,
 								})
 								})
 							});
 							});
-							tableConfig.columns.map((v : any, i : any) => {
-								if (v.title == '库存') {
-									tableConfig.columns[i] = {
-										width: "80px",
-										field: "stock",
-										title: "库存"
-									}
-								}
-							});
 							this.tableList = (this as any).$lodash.cloneDeep(res.data);
 							this.tableList = (this as any).$lodash.cloneDeep(res.data);
-							console.log('表格配置 ==> ', tableConfig);
+							// console.log('表格配置 ==> ', tableConfig);
 							console.log('skuRuleList ==> ', skuRuleList);
 							console.log('skuRuleList ==> ', skuRuleList);
 							console.log('表格数据 ==> ', this.tableList);
 							console.log('表格数据 ==> ', this.tableList);
 							this.setTableConfig = tableConfig;
 							this.setTableConfig = tableConfig;
@@ -1180,15 +1151,13 @@
 						let tableConfig = (this as any).$lodash.cloneDeep(this.tableConfig);
 						let tableConfig = (this as any).$lodash.cloneDeep(this.tableConfig);
 						let skuRuleList = (this as any).$lodash.cloneDeep(this.skuRuleList);
 						let skuRuleList = (this as any).$lodash.cloneDeep(this.skuRuleList);
 						let newColumns = (this as any).$lodash.cloneDeep(this.attributeList).reverse();
 						let newColumns = (this as any).$lodash.cloneDeep(this.attributeList).reverse();
-						if (this.editInfo) {
-							skuRuleList.map((v : any) => {
-								v.skuTitle = this.editInfo.name;
-								v.skuSubtitle = this.editInfo.shortName;
-							})
-						}
+						let giveInfo = (this as any).$refs.form.getValue();
 						skuRuleList.map((v : any, i : any) => {
 						skuRuleList.map((v : any, i : any) => {
 							v.dataIndex = i;
 							v.dataIndex = i;
 							v.isDeleted = 0;
 							v.isDeleted = 0;
+							v.skuTitle = giveInfo.name;
+							v.skuSubtitle = giveInfo.shortName;
+							v.price = giveInfo.basePrice
 						})
 						})
 						newColumns.map((v : any) => {
 						newColumns.map((v : any) => {
 							tableConfig.columns.unshift({
 							tableConfig.columns.unshift({
@@ -1207,9 +1176,7 @@
 						}, 0)
 						}, 0)
 					}
 					}
 				})
 				})
-			}).catch(() => {
-
-			});
+			}).catch(() => {});
 		}
 		}
 		// 切换商品规格
 		// 切换商品规格
 		changeSingle() {
 		changeSingle() {
@@ -1247,38 +1214,21 @@
 				center: true
 				center: true
 			}).then(() => {
 			}).then(() => {
 				let inputValue = (this as any).$refs['getValue_' + index][0].getValue();
 				let inputValue = (this as any).$refs['getValue_' + index][0].getValue();
-				if (!inputValue) return this.$message({
-					type: 'warning',
-					message: '请输入内容'
-				});
-				if (!/^\S*$/.test(inputValue)) return this.$message({
-					type: 'warning',
-					message: '输入内容不能有空格'
-				});
+				if (!inputValue) return (this as any).$message.warning('请输入内容');
+				if (!/^\S*$/.test(inputValue)) return (this as any).$message.warning('输入内容不能有空格');
 				if (this.attributeList[index].list.indexOf(inputValue) !== -1) return (this as any).$refs['getValue_' + index][0].clearValue();
 				if (this.attributeList[index].list.indexOf(inputValue) !== -1) return (this as any).$refs['getValue_' + index][0].clearValue();
 				if (inputValue) {
 				if (inputValue) {
 					this.attributeList[index].list.push(inputValue);
 					this.attributeList[index].list.push(inputValue);
 				}
 				}
 				(this as any).$refs['getValue_' + index][0].clearValue();
 				(this as any).$refs['getValue_' + index][0].clearValue();
 				this.generateNow();
 				this.generateNow();
-				this.$message({
-					type: 'success',
-					message: '添加成功!'
-				});
-			}).catch(() => {
-				this.$message({
-					type: 'info',
-					message: '已取消添加'
-				});
-			});
+				this.$message.success('添加成功!');
+			}).catch(() => this.$message.info('已取消添加'));
 		}
 		}
 		// 添加sku规格
 		// 添加sku规格
 		doComfirm() {
 		doComfirm() {
-			if (!this.normsValue || !this.norms) return (this as any).$message({ type: "warning", message: '请添加完整的规格!' })
-			if (!/^\S*$/.test(this.normsValue) || !/^\S*$/.test(this.norms)) return this.$message({
-				type: 'warning',
-				message: '输入内容不能有空格'
-			});
+			if (!this.normsValue || !this.norms) return (this as any).$message.warning('请添加完整的规格');
+			if (!/^\S*$/.test(this.normsValue) || !/^\S*$/.test(this.norms)) return this.$message.warning('输入内容不能有空格');
 			this.$confirm('确定添加吗!确定后将可能影响原表格数据', '注意', {
 			this.$confirm('确定添加吗!确定后将可能影响原表格数据', '注意', {
 				confirmButtonText: '确定',
 				confirmButtonText: '确定',
 				cancelButtonText: '取消',
 				cancelButtonText: '取消',
@@ -1295,16 +1245,8 @@
 				this.normsValue = '';
 				this.normsValue = '';
 				this.isAdd = false;
 				this.isAdd = false;
 				this.generateNow();
 				this.generateNow();
-				this.$message({
-					type: 'success',
-					message: '添加成功!'
-				});
-			}).catch(() => {
-				this.$message({
-					type: 'info',
-					message: '已取消添加'
-				});
-			});
+				this.$message.success('添加成功!');
+			}).catch(() => this.$message.info('已取消添加'));
 		}
 		}
 		// 监听表格数据
 		// 监听表格数据
 		getInputValue(e : any) {
 		getInputValue(e : any) {
@@ -1356,16 +1298,8 @@
 				center: true
 				center: true
 			}).then(() => {
 			}).then(() => {
 				this.tagsData.splice(index, 1)
 				this.tagsData.splice(index, 1)
-				this.$message({
-					type: 'success',
-					message: '删除成功!'
-				});
-			}).catch(() => {
-				this.$message({
-					type: 'info',
-					message: '已取消删除'
-				});
-			});
+				this.$message.success('删除成功!');
+			}).catch(() => this.$message.info('已取消删除'));
 		}
 		}
 		// 删除标签
 		// 删除标签
 		handleClose(tag : any, index : any) {
 		handleClose(tag : any, index : any) {
@@ -1377,16 +1311,8 @@
 			}).then(() => {
 			}).then(() => {
 				this.attributeList[index].list.splice(this.attributeList[index].list.indexOf(tag), 1);
 				this.attributeList[index].list.splice(this.attributeList[index].list.indexOf(tag), 1);
 				this.generateNow();
 				this.generateNow();
-				this.$message({
-					type: 'success',
-					message: '删除成功!'
-				});
-			}).catch(() => {
-				this.$message({
-					type: 'info',
-					message: '已取消删除'
-				});
-			});
+				this.$message.success('删除成功!');
+			}).catch(() => this.$message.info('已取消删除'));
 		}
 		}
 		// 删除数组
 		// 删除数组
 		closeGroup(index : any) {
 		closeGroup(index : any) {
@@ -1398,16 +1324,8 @@
 			}).then(() => {
 			}).then(() => {
 				this.attributeList.splice(index, 1)
 				this.attributeList.splice(index, 1)
 				this.generateNow();
 				this.generateNow();
-				this.$message({
-					type: 'success',
-					message: '删除成功!'
-				});
-			}).catch(() => {
-				this.$message({
-					type: 'info',
-					message: '已取消删除'
-				});
-			});
+				this.$message.success('删除成功!');
+			}).catch(() => this.$message.info('已取消删除'));
 		}
 		}
 		// 删除表格数据
 		// 删除表格数据
 		doDeleteTable(item : any) {
 		doDeleteTable(item : any) {
@@ -1425,23 +1343,15 @@
 				})
 				})
 				let filterList = this.tableList.filter((v : any) => v.isDeleted !== 1);
 				let filterList = this.tableList.filter((v : any) => v.isDeleted !== 1);
 				(this as any).$refs.table.setValue(filterList); // 设置表格数据
 				(this as any).$refs.table.setValue(filterList); // 设置表格数据
-				this.$message({
-					type: 'success',
-					message: '删除成功!'
-				});
-			}).catch(() => {
-				this.$message({
-					type: 'info',
-					message: '已取消删除'
-				});
-			});
+				this.$message.success('删除成功!');
+			}).catch(() => this.$message.info('已取消删除'));
 		}
 		}
 		// 获取物料属性
 		// 获取物料属性
 		getAttribute() {
 		getAttribute() {
 			api.pageList({}, 'maindataMaterialAttribute').then((res : any) => {
 			api.pageList({}, 'maindataMaterialAttribute').then((res : any) => {
 				if (res.code === 200) {
 				if (res.code === 200) {
 					this.selectList = res.data.records
 					this.selectList = res.data.records
-				} else this.failHandle(res)
+				} else this.$message.error(res.msg);
 			})
 			})
 		}
 		}
 		// 获取列表数据
 		// 获取列表数据
@@ -1472,7 +1382,7 @@
 						total: res.data.total //总条数
 						total: res.data.total //总条数
 					};
 					};
 					(this.$refs.moduleView as any).setPage(page)
 					(this.$refs.moduleView as any).setPage(page)
-				} else this.failHandle(res)
+				} else this.$message.error(res.msg);
 			})
 			})
 		}
 		}
 		// 工具栏方法
 		// 工具栏方法
@@ -1498,20 +1408,13 @@
 			}).then(() => {
 			}).then(() => {
 				other.deleteSpuAndSku({ ids: item.id }, 'maindataMaterial').then((res : any) => {
 				other.deleteSpuAndSku({ ids: item.id }, 'maindataMaterial').then((res : any) => {
 					if (res.code === 200) {
 					if (res.code === 200) {
-						this.$message({
-							type: 'success',
-							message: '删除成功!'
-						});
+						this.$message.success('删除成功!');
 						this.isShow = 'home';
 						this.isShow = 'home';
+						(this as any).$refs.sideTree.request();
 						this.getDataList();
 						this.getDataList();
-					} else this.failHandle(res)
+					} else this.$message.error(res.msg);
 				})
 				})
-			}).catch(() => {
-				this.$message({
-					type: 'info',
-					message: '已取消删除'
-				});
-			});
+			}).catch(() => this.$message.info('已取消删除'));
 		}
 		}
 		// 工具栏删除
 		// 工具栏删除
 		doDelete() {
 		doDelete() {
@@ -1531,19 +1434,12 @@
 			}).then(() => {
 			}).then(() => {
 				other.deleteSpuAndSku({ ids: ids }, 'maindataMaterial').then((res : any) => {
 				other.deleteSpuAndSku({ ids: ids }, 'maindataMaterial').then((res : any) => {
 					if (res.code === 200) {
 					if (res.code === 200) {
+						(this as any).$refs.sideTree.request();
 						this.getDataList();
 						this.getDataList();
-						this.$message({
-							type: 'success',
-							message: '删除成功!'
-						});
-					} else this.failHandle(res)
+						this.$message.success('删除成功!');
+					} else this.$message.error(res.msg);
 				})
 				})
-			}).catch(() => {
-				this.$message({
-					type: 'info',
-					message: '已取消删除'
-				});
-			});
+			}).catch(() => this.$message.info('已取消删除'));
 		}
 		}
 		// 操作删除
 		// 操作删除
 		doDelete2(item : any) {
 		doDelete2(item : any) {
@@ -1555,19 +1451,12 @@
 			}).then(() => {
 			}).then(() => {
 				other.deleteSpuAndSku({ ids: item.id }, 'maindataMaterial').then((res : any) => {
 				other.deleteSpuAndSku({ ids: item.id }, 'maindataMaterial').then((res : any) => {
 					if (res.code === 200) {
 					if (res.code === 200) {
+						(this as any).$refs.sideTree.request();
 						this.getDataList();
 						this.getDataList();
-						this.$message({
-							type: 'success',
-							message: '删除成功!'
-						});
-					} else this.failHandle(res)
+						this.$message.success('删除成功!');
+					} else this.$message.error(res.msg);
 				})
 				})
-			}).catch(() => {
-				this.$message({
-					type: 'info',
-					message: '已取消删除'
-				});
-			});
+			}).catch(() => this.$message.info('已取消删除'));
 		}
 		}
 		// 刷新
 		// 刷新
 		onRefresh() {
 		onRefresh() {
@@ -1594,12 +1483,6 @@
 				...query
 				...query
 			}, urlArr[urlArr.length - 1] + `_${new Date().getTime()}.xlsx`)
 			}, urlArr[urlArr.length - 1] + `_${new Date().getTime()}.xlsx`)
 		}
 		}
-		// 运行错误
-		failHandle(err : any) {
-			let msg = err.msg ? err.msg : '运行错误!';
-			this.$message.error(msg)
-		}
-
 	}
 	}
 </script>
 </script>
 <style lang="scss" scoped>
 <style lang="scss" scoped>

+ 20 - 48
src/views/audit/virtually/index.vue

@@ -3,7 +3,7 @@
 		<div class="bill-left">
 		<div class="bill-left">
 			<div class="bill-tab">
 			<div class="bill-tab">
 				<div class="tab-title">导航</div>
 				<div class="tab-title">导航</div>
-				<side-tree :propConfig="treeConfig" @onChange="onChangeTree" />
+				<side-tree :propConfig="treeConfig" @onChange="onChangeTree" ref="sideTree" />
 			</div>
 			</div>
 		</div>
 		</div>
 		<div class="bill-main">
 		<div class="bill-main">
@@ -36,10 +36,6 @@
 		data : any = []
 		data : any = []
 		expandedKeys : any = []
 		expandedKeys : any = []
 		parentId : any = ''
 		parentId : any = ''
-		props = {
-			label: 'name',
-			children: 'children'
-		}
 		// 右边
 		// 右边
 		baseURL : any = process.env.VUE_APP_BASE_API
 		baseURL : any = process.env.VUE_APP_BASE_API
 		timeNum = 0;
 		timeNum = 0;
@@ -270,22 +266,18 @@
 				if (this.popTitle === '新增') {
 				if (this.popTitle === '新增') {
 					api.saveList(query, 'maindataMaterialVmcategory').then((res : any) => {
 					api.saveList(query, 'maindataMaterialVmcategory').then((res : any) => {
 						if (res.code === 200) {
 						if (res.code === 200) {
-							this.$message({
-								type: 'success',
-								message: this.popTitle + '成功!'
-							});
+							this.$message.success(this.popTitle + '成功!');
+							(this as any).$refs.sideTree.request();
 							this.getDataList();
 							this.getDataList();
-						} else this.failHandle(res)
+						} else this.$message.error(res.msg);
 					})
 					})
 				} else if (this.popTitle === '编辑') {
 				} else if (this.popTitle === '编辑') {
 					api.updateList(query, 'maindataMaterialVmcategory').then((res : any) => {
 					api.updateList(query, 'maindataMaterialVmcategory').then((res : any) => {
 						if (res.code === 200) {
 						if (res.code === 200) {
-							this.$message({
-								type: 'success',
-								message: this.popTitle + '成功!'
-							});
+							this.$message.success(this.popTitle + '成功!');
+							(this as any).$refs.sideTree.request();
 							this.getDataList();
 							this.getDataList();
-						} else this.failHandle(res)
+						} else this.$message.error(res.msg);
 					})
 					})
 				}
 				}
 			})
 			})
@@ -321,7 +313,7 @@
 						total: res.data.total //总条数
 						total: res.data.total //总条数
 					};
 					};
 					(this.$refs.moduleView as any).setPage(page);
 					(this.$refs.moduleView as any).setPage(page);
-				} else this.failHandle(res)
+				} else this.$message.error(res.msg);
 			})
 			})
 		}
 		}
 		// 工具栏方法
 		// 工具栏方法
@@ -356,13 +348,13 @@
 		}
 		}
 		// 工具栏删除
 		// 工具栏删除
 		onDelete() {
 		onDelete() {
-			let selectData = (this.$refs.moduleView as any).getSelectData()
+			let selectData = (this.$refs.moduleView as any).getSelectData();
 			let ids = '';
 			let ids = '';
 			if (selectData.length > 0) {
 			if (selectData.length > 0) {
 				selectData.map((v : any) => {
 				selectData.map((v : any) => {
 					ids += v.id + ','
 					ids += v.id + ','
 				})
 				})
-			} else return this.$message({ type: 'warning', message: '请选择删除数据' })
+			} else return this.$message.warning('请选择删除数据');
 			ids = ids.slice(0, ids.length - 1);
 			ids = ids.slice(0, ids.length - 1);
 			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
 			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
 				confirmButtonText: '确定',
 				confirmButtonText: '确定',
@@ -372,19 +364,12 @@
 			}).then(() => {
 			}).then(() => {
 				api.deleteList({ ids: ids }, 'maindataMaterialVmcategory').then((res : any) => {
 				api.deleteList({ ids: ids }, 'maindataMaterialVmcategory').then((res : any) => {
 					if (res.code === 200) {
 					if (res.code === 200) {
+						(this as any).$refs.sideTree.request();
 						this.getDataList();
 						this.getDataList();
-						this.$message({
-							type: 'success',
-							message: '删除成功!'
-						});
-					} else this.failHandle(res)
+						this.$message.success('删除成功!');
+					} else this.$message.error(res.msg);
 				})
 				})
-			}).catch(() => {
-				this.$message({
-					type: 'info',
-					message: '已取消删除'
-				});
-			});
+			}).catch(() => this.$message.info('已取消删除'));
 		}
 		}
 		// 操作删除
 		// 操作删除
 		doDelete2(item : any) {
 		doDelete2(item : any) {
@@ -396,24 +381,17 @@
 			}).then(() => {
 			}).then(() => {
 				api.childrenTreeList({ id: item.id }, 'maindataMaterialVmcategory').then((v : any) => {
 				api.childrenTreeList({ id: item.id }, 'maindataMaterialVmcategory').then((v : any) => {
 					if (v.code === 200) {
 					if (v.code === 200) {
-						if (v.data.length > 0) return this.$message({ type: 'error', message: '此数据有子节点,不能进行删除!' })
+						if (v.data.length > 0) return this.$message.error('此数据有子节点,不能进行删除!')
 						api.deleteList({ ids: item.id }, 'maindataMaterialVmcategory').then((res : any) => {
 						api.deleteList({ ids: item.id }, 'maindataMaterialVmcategory').then((res : any) => {
 							if (res.code === 200) {
 							if (res.code === 200) {
+								(this as any).$refs.sideTree.request();
 								this.getDataList();
 								this.getDataList();
-								this.$message({
-									type: 'success',
-									message: '删除成功!'
-								});
-							} else this.failHandle(res)
+								this.$message.success('删除成功!');
+							} else this.$message.error(res.msg);;
 						})
 						})
-					} else this.$message({ type: 'error', message: '删除失败!请稍后再试' })
+					} else this.$message.error('删除失败!请稍后再试');
 				})
 				})
-			}).catch(() => {
-				this.$message({
-					type: 'info',
-					message: '已取消删除'
-				});
-			});
+			}).catch(() => this.$message.info('已取消删除'));
 		}
 		}
 		// 刷新/重置
 		// 刷新/重置
 		onRefresh() {
 		onRefresh() {
@@ -431,12 +409,6 @@
 				...query
 				...query
 			}, urlArr[urlArr.length - 1] + `_${new Date().getTime()}.xlsx`)
 			}, urlArr[urlArr.length - 1] + `_${new Date().getTime()}.xlsx`)
 		}
 		}
-		// 运行错误
-		failHandle(err : any) {
-			let msg = err.msg ? err.msg : '运行错误!';
-			this.$message.error(msg)
-		}
-
 	}
 	}
 </script>
 </script>
 <style lang="scss" scoped>
 <style lang="scss" scoped>