Parcourir la source

Merge branch 'master' of http://47.107.53.207:3000/ymy/oms

ymy il y a 2 ans
Parent
commit
7a2ecacd3e

+ 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() {

+ 20 - 0
src/views/audit/distributor/index.vue

@@ -230,6 +230,20 @@
 						prop: 'contacts',
 						component: 'by-input',
 					},
+					{
+						span: 23,
+						labelWidth: '70px',
+						label: '手机号码',
+						prop: 'telephone',
+						component: 'by-input',
+					},
+					{
+						span: 23,
+						labelWidth: '70px',
+						label: '联系电话',
+						prop: 'phonenum',
+						component: 'by-input',
+					},
 					{
 						span: 23,
 						labelWidth: '70px',
@@ -289,6 +303,12 @@
 				let query = (this as any).$refs.addFormId.getValue();
 				console.log(query);
 				query.status = this.radio;
+				// 手机验证
+				let reg = /^1[3456789]\d{9}$/;
+				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 === '新增') {

+ 54 - 22
src/views/audit/organClassify/index.vue

@@ -39,7 +39,7 @@
 		popTitle : any = ''
 		radio : any = 0
 		dialogFormVisible : boolean = false
-		parentIds: any = '';
+		parentId : any = '';
 		treeConfig = {
 			attr: {
 				retConfig: {
@@ -120,13 +120,13 @@
 					width: 300,
 					title: '备注',
 					field: 'remark',
-				}, 
+				},
 				{
 					width: 80,
 					title: '状态',
 					field: 'status',
 					component: Assembly,
-				}, 
+				},
 				{
 					width: 120,
 					title: '操作',
@@ -151,6 +151,9 @@
 			attr: {
 				size: 'small',
 				rules: {
+					parentName: [{
+						required: true, message: '请输入父级', trigger: 'blur'
+					}],
 					name: [{
 						required: true, message: '请输入名称', trigger: 'blur'
 					}],
@@ -158,6 +161,27 @@
 			},
 			columns: [
 				[
+					{
+						span: 23,
+						label: '父级',
+						labelWidth: '70px',
+						prop: 'parentName',
+						component: 'select-tree',
+						compConfig: {
+							attr: {
+								label: 'name',
+								clearable: true,
+								retConfig: {
+									parentId: 'id',
+									parentName: 'name',
+								},
+								defaultExpandAll: true
+							},
+							request: {
+								url: '/maindata/maindataOrganizationCategory/treeUseList'
+							}
+						}
+					},
 					{
 						span: 23,
 						labelWidth: '70px',
@@ -205,6 +229,7 @@
 			} else {
 				data.parentId = e.id;
 			};
+			this.parentId = e.id;
 			api.childrenTreeList(data, 'maindataOrganizationCategory').then((res : any) => {
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
@@ -254,6 +279,10 @@
 			}
 			clearInterval(this.timer)
 			let query = (this.$refs.moduleView as any).getQuery();
+			if (this.parentId) query.parentId = this.parentId;
+			this.getPageList(query)
+		}
+		getPageList(query : any) {
 			api.pageList(query, 'maindataOrganizationCategory').then((res : any) => {
 				if (res.code === 200) {
 					(this.$refs.moduleView as any).setTableValue(res.data.records);
@@ -283,13 +312,24 @@
 		}
 		// 打开编辑
 		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)
+			let loading = this.$loading({ target: '.main-container' });
+			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 (res.code === 200) {
+							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)
+						}
+					});
+				}
+			});
 		}
 		// 工具栏删除
 		onDelete() {
@@ -337,20 +377,12 @@
 		}
 		// 刷新
 		onRefresh() {
-			this.loading = this.$loading({ target: '.main-container' });
+			let loading = this.$loading({ target: '.main-container' });
 			(this as any).$refs.moduleView.clearSearch();
-			api.pageList({}, 'maindataOrganizationCategory').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);
-			})
+			this.parentId = '';
+			(this as any).$refs.sideTree.request();
+			this.getPageList({});
+			loading.close();
 		}
 		//导出
 		onExport() {

+ 1 - 2
src/views/audit/productClassification/index.vue

@@ -275,7 +275,6 @@
 			(this as any).$refs.addFormId.validate().then(() => {
 				let query = (this as any).$refs.addFormId.getValue();
 				console.log('确认新增/编辑 ==> ', query);
-				if (!query.parentId) query.parentId = 0;
 				query.status = this.radio;
 				this.dialogFormVisible = false;
 				if (this.popTitle === '新增') {
@@ -351,7 +350,7 @@
 			console.log('打开编辑 ==> ', e);
 			this.popTitle = '编辑'
 			this.dialogFormVisible = true;
-			this.radio = e.status
+			this.radio = e.status;
 			api.single({ id: e.parentId }, 'maindataMaterialCategory').then((res : any) => {
 				if (res.code === 200) {
 					e.parentName = res.data.name

+ 19 - 0
src/views/audit/supplier/index.vue

@@ -229,6 +229,20 @@
 						prop: 'contacts',
 						component: 'by-input',
 					},
+					{
+						span: 23,
+						labelWidth: '70px',
+						label: '手机号码',
+						prop: 'telephone',
+						component: 'by-input',
+					},
+					{
+						span: 23,
+						labelWidth: '70px',
+						label: '联系电话',
+						prop: 'phonenum',
+						component: 'by-input',
+					},
 					{
 						span: 23,
 						labelWidth: '70px',
@@ -288,6 +302,11 @@
 				let query = (this as any).$refs.addFormId.getValue();
 				console.log(query);
 				query.status = this.radio;
+				// 手机验证
+				let reg = /^1[3456789]\d{9}$/;
+				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 === '新增') {