Эх сурвалжийг харах

物料品牌、属性 (√)

AlanWong 2 жил өмнө
parent
commit
1fce4e01fd

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

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

+ 27 - 52
src/views/audit/attribute/index.vue

@@ -273,7 +273,9 @@
 		}
 		// 添加新规格
 		doComfirm() {
-			if (!this.normsValue || !this.norms) return (this as any).$message({ type: "warning", message: '请添加完整的规格!' })
+			this.normsValue = this.normsValue.trim();
+			this.norms = this.norms.trim();
+			if (!this.normsValue || !this.norms) return (this as any).$message({ type: "warning", message: '请添加完整的规格!' });
 			let obj : any = {
 				title: this.norms,
 				field: this.norms + '_field_name',
@@ -292,26 +294,22 @@
 				query.attributeValue = JSON.stringify(this.tableConfig)
 				this.dialogFormVisible = false;
 				console.log(query);
-				
+				let loading = this.$loading({ target: '.main-container' });
 				if (this.popTitle === '新增') {
 					api.saveList(query, 'maindataMaterialAttribute').then((res : any) => {
 						if (res.code === 200) {
-							this.$message({
-								type: 'success',
-								message: this.popTitle + '成功!'
-							});
+							this.$message.success('新增成功');
 							this.getDataList();
-						} else this.failHandle(res)
+							loading.close();
+						} else this.$message.error(res.msg);
 					})
 				} else if (this.popTitle === '编辑') {
 					api.updateList(query, 'maindataMaterialAttribute').then((res : any) => {
 						if (res.code === 200) {
-							this.$message({
-								type: 'success',
-								message: this.popTitle + '成功!'
-							});
+							this.$message.success('编辑成功');
 							this.getDataList();
-						} else this.failHandle(res)
+							loading.close();
+						} else this.$message.error(res.msg);
 					})
 				}
 				
@@ -332,6 +330,7 @@
 			this.getPageList(query)
 		}
 		getPageList(query : any) {
+			let loading = this.$loading({ target: '.main-container' });
 			api.pageList(query, 'maindataMaterialAttribute').then((res : any) => {
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
@@ -340,7 +339,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();
 				} else this.$message.error(res.msg);
 			})
 		}
@@ -355,10 +355,10 @@
 			this.popTitle = '新增'
 			this.dialogFormVisible = true;
 			this.radio = 0
-			this.tableConfig = []
-			setTimeout(() => {
-				if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue({});
-			}, 0)
+			this.tableConfig = [];
+			this.$nextTick(() => {
+				if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue();
+			});
 		}
 		// 打开编辑
 		openEdit(e : any) {
@@ -367,9 +367,9 @@
 			this.dialogFormVisible = true;
 			this.radio = e.status
 			this.tableConfig = JSON.parse(e.attributeValue);
-			setTimeout(() => {
+			this.$nextTick(() => {
 				if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue(e);
-			}, 0)
+			})
 		}
 		// 工具栏删除
 		onDelete() {
@@ -390,18 +390,10 @@
 				api.deleteList({ ids: ids }, 'maindataMaterialAttribute').then((res : any) => {
 					if (res.code === 200) {
 						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) {
@@ -414,26 +406,15 @@
 				api.deleteList({ ids: item.id }, 'maindataMaterialAttribute').then((res : any) => {
 					if (res.code === 200) {
 						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() {
-			let loading = this.$loading({ target: '.main-container' });
 			(this as any).$refs.moduleView.clearSearch();
-			(this as any).$refs.sideTree.request();
-			this.getPageList({});
-			loading.close();
+			this.getDataList();
 		}
 		//导出
 		onExport() {
@@ -441,14 +422,8 @@
 			let query = (this.$refs.moduleView as any).getQuery();
 			(this as any).$download(urlArr + '/export', {
 				...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>
 <style lang="scss" scoped>

+ 30 - 40
src/views/audit/brand/index.vue

@@ -123,7 +123,7 @@
 					title: '状态',
 					field: 'status',
 					component: Assembly,
-				}, 
+				},
 				{
 					width: 120,
 					title: '操作',
@@ -193,7 +193,7 @@
 							attr: {
 								size: 'mini',
 								placeholder: '请输入备注',
-								type:'textarea'
+								type: 'textarea'
 							},
 						}
 					},
@@ -212,21 +212,21 @@
 				console.log(query);
 				query.status = this.radio;
 				this.dialogFormVisible = false;
+				let loading = this.$loading({ target: '.main-container' });
 				if (this.popTitle === '新增') {
 					api.saveList(query, 'maindataMaterialBrand').then((res : any) => {
 						if (res.code === 200) {
-							this.$message.success(this.popTitle + '成功!');
+							this.$message.success('新增成功');
 							this.getDataList();
+							loading.close();
 						} else this.$message.error(res.msg);
 					})
 				} else if (this.popTitle === '编辑') {
 					api.updateList(query, 'maindataMaterialBrand').then((res : any) => {
 						if (res.code === 200) {
-							this.$message({
-								type: 'success',
-								message: this.popTitle + '成功!'
-							});
+							this.$message.success('编辑成功');
 							this.getDataList();
+							loading.close();
 						} else this.$message.error(res.msg);
 					})
 				}
@@ -246,6 +246,7 @@
 			this.getPageList(query);
 		}
 		getPageList(query : any) {
+			let loading = this.$loading({ target: '.main-container' });
 			api.pageList(query, 'maindataMaterialBrand').then((res : any) => {
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
@@ -254,8 +255,12 @@
 						pageSize: res.data.size, //每页条数
 						total: res.data.total //总条数
 					};
-					(this.$refs.moduleView as any).setPage(page)
-				} else this.$message.error(res.msg);
+					(this.$refs.moduleView as any).setPage(page);
+					loading.close();
+				} else {
+					loading.close();
+					this.$message.error(res.msg);
+				}
 			})
 		}
 		// 工具栏方法
@@ -266,21 +271,22 @@
 		}
 		// 打开新增
 		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(() => {
+				if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue();
+			});
 		}
 		// 打开编辑
 		openEdit(e : any) {
-			this.popTitle = '编辑'
+			this.popTitle = '编辑';
 			this.dialogFormVisible = true;
-			this.radio = e.status
-			setTimeout(() => {
+			this.radio = e.status;
+			this.$nextTick(() => {
 				if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue(e);
-			}, 0)
+			})
+
 		}
 		// 工具栏删除
 		onDelete() {
@@ -301,18 +307,10 @@
 				api.deleteList({ ids: ids }, 'maindataMaterialBrand').then((res : any) => {
 					if (res.code === 200) {
 						this.getDataList();
-						this.$message({
-							type: 'success',
-							message: '删除成功!'
-						});
+						this.$message.success('删除成功');
 					} else this.$message.error(res.msg);
 				})
-			}).catch(() => {
-				this.$message({
-					type: 'info',
-					message: '已取消删除'
-				});
-			});
+			}).catch(() => this.$message.info('已取消删除'));
 		}
 		// 操作删除
 		doDelete2(item : any) {
@@ -325,23 +323,15 @@
 				api.deleteList({ ids: item.id }, 'maindataMaterialBrand').then((res : any) => {
 					if (res.code === 200) {
 						this.getDataList();
-						this.$message({
-							type: 'success',
-							message: '删除成功!'
-						});
+						this.$message.success('删除成功');
 					} else this.$message.error(res.msg);
 				})
-			}).catch(() => {
-				this.$message.info('已取消删除');
-			});
+			}).catch(() => this.$message.info('已取消删除'));
 		}
 		// 刷新/重置
-		onRefresh(){
-			let loading = this.$loading({ target: '.main-container' });
+		onRefresh() {
 			(this as any).$refs.moduleView.clearSearch();
-			(this as any).$refs.sideTree.request();
-			this.getPageList({});
-			loading.close();
+			this.getDataList();
 		}
 		//导出
 		onExport() {