Explorar o código

机构档案父类、电话校验

AlanWong %!s(int64=2) %!d(string=hai) anos
pai
achega
23f5ffdeb7

+ 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 === '新增') {