Browse Source

Merge branch 'master' of http://94.191.59.107:3000/houwenfeng/ybxf-security-uniapp

liyangzheng 1 year ago
parent
commit
cc514af535

+ 57 - 28
pagesA/fire/fpd_detection/add_detection/add_detection.vue

@@ -8,13 +8,13 @@
 					<u-form-item label="检测项目" prop="detinspect" :required="true"
 						@click="showInspOption = true;hideKeyboard();">
 						<u--input v-model="formData.detinspect" disabled disabledColor="#ffffff"
-							placeholder="请输入检测维保结果"></u--input>
+							placeholder="请输入检测项目"></u--input>
 						<!-- <u-input v-model="formData.detinspect" placeholder="请输入检测项目" /> -->
 					</u-form-item>
 
 					<u-form-item label="预计检测时间" prop="detdate">
 						<uni-datetime-picker :show="unitTime" v-model="formData.detdate" type="datetime"
-							closeOnClickOverlay @confirm="ActiveUnitTime" @cancel="unitTime = false"
+							closeOnClickOverlay @confirm="ActiveUnitTime" @cancel="unitTime = false" 
 							@change="changetime" @close="unitTime = false"></uni-datetime-picker>
 					</u-form-item>
 					<u-form-item label="检测维保结果" prop="detresult" @click="
@@ -32,7 +32,7 @@
 					</u-form-item>
 					<u-form-item label="附件">
 						<!-- 选择文件上传 -->
-						<uni-file-picker v-model="formData.att" del-icon limit="1" auto-upload file-mediatype="all"
+						<uni-file-picker v-model="formData.File" del-icon limit="1" auto-upload file-mediatype="all"
 							@select="select" @delete="deleteFile">
 							<button type="primary" class="selectBtn"
 								style="background-color: rgba(76, 178, 182, 0.5);">选择附件</button>
@@ -132,7 +132,10 @@
 				formData: {
 					status: '0',
 					File: [],
-					detresult:{id:null,name:null}
+					detresult: {
+						id: null,
+						name: null
+					}
 				},
 				// 自定义表单校验规则
 				customRules: {
@@ -148,8 +151,31 @@
 						trigger: ['blur', 'change']
 					},
 					orgName: {
-						type: 'string',
-						message: '请选择所属单位',
+						// pattern: /^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/,
+						// 自定义验证函数
+						validator: (rule, value, callback) => {
+							// 上面有说,返回true表示校验通过,返回false表示不通过
+							// uni.$u.test.mobile()就是返回true或者false的
+							//是否符合正则 且不为空
+							if (!value) {
+								return false
+							}
+						},
+						message: '请输入检测维保结果',
+						trigger: ['blur', 'change']
+					},
+					detresult: {
+						// pattern: /^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/,
+						// 自定义验证函数
+						validator: (rule, value, callback) => {
+							// 上面有说,返回true表示校验通过,返回false表示不通过
+							// uni.$u.test.mobile()就是返回true或者false的
+							//是否符合正则 且不为空
+							if (!value.id) {
+								return false
+							}
+						},
+						message: '请输入检测维保结果',
 						trigger: ['blur', 'change']
 					}
 				}
@@ -183,7 +209,7 @@
 				pageSize: this.pageSize,
 				userId: this.$store.state.user.id
 			}).then(response => {
-				console.log(response, 'response');
+				// console.log(response, 'response');
 				// 取到用户对应的单位名称与id
 				response.data.map(v => {
 					this.actions5.push({
@@ -203,7 +229,7 @@
 			this.resultOptions = [...trueArr]
 			//初始化检测项目选项
 			const trueArr1 = []
-			console.log('detinspectOptions', this.detinspectOptions);
+			// console.log('detinspectOptions', this.detinspectOptions);
 			this.detinspectOptions.forEach(item => {
 				trueArr1.push({
 					id: item.value,
@@ -218,7 +244,7 @@
 
 		methods: {
 			submit(ref) {
-				console.log(this.formData, 'alertalertalert');
+				// console.log(this.formData, 'alertalertalert');
 				// if (!this.formData.orgName) {
 				// 	return this.$modal.msgError('请选择所属单位')
 				// }
@@ -229,23 +255,23 @@
 					.validate()
 					.then(res => {
 						this.formData['status'] = 0;
-						console.log('this.formData', this.formData);
+						// console.log('this.formData', this.formData);
 						if (this.formData.File.length > 0) {
 							this.formData.att = this.formData.File[0].url.toString();
 						} else {
 							this.formData.att = ''
 						}
 						//对要提交的数据进行处理 {id,name}只保存name
-						this.$set(this.formData,'detresult',this.formData.detresult.id)
+						this.$set(this.formData, 'detresult', this.formData.detresult.id)
 						var jsdata = JSON.stringify(this.formData);
-						console.log(jsdata, 'jsdatajsdatajsdata');
+						// console.log(jsdata, 'jsdatajsdatajsdata');
 						createFpdDetection(jsdata).then(response => {
-							console.log('response.data.msg,', response.data);
+							// console.log('response.data.msg,', response.data);
 							uni.showLoading({
 								title: response.data.msg
 							});
 							setTimeout(() => {
-								console.log('新增成功!');
+								// console.log('新增成功!');
 								uni.hideLoading();
 								uni.navigateBack({
 									delta: 1
@@ -284,7 +310,7 @@
 						Authorization: 'Bearer ' + getAccessToken()
 					}, //请求token
 					success: res => {
-						console.log('uploadres', res);
+						// console.log('uploadres', res);
 						let data = JSON.parse(res.data);
 						// 返回的url
 						var fileLink = data.data;
@@ -305,7 +331,7 @@
 
 					},
 					fail: () => {
-						console.log('err');
+						// console.log('err');
 						uni.showToast({
 							icon: 'error',
 							title: '文件上传失败!'
@@ -315,13 +341,13 @@
 			},
 			// 移出图片函数
 			async deleteFile(e) {
-				console.log(e);
+				// console.log(e);
 				this.formData.attId = [];
-				console.log('移除了:', this.formData.attId);
+				// console.log('移除了:', this.formData.attId);
 			},
 			//检测项目多选框选中
 			checkboxChange2(arr) { //勾选的事件
-				console.log('arr', arr);
+				// console.log('arr', arr);
 				this.checkArr = [...arr]
 
 			},
@@ -332,12 +358,12 @@
 			},
 			checkboxCancel2() {
 				this.showInspOption = false
-				if(this.formData.detinspect){
-					
-				const nowArr = this.formData.detinspect.split(',')
-				this.checkArr = [...nowArr]
+				if (this.formData.detinspect) {
+
+					const nowArr = this.formData.detinspect.split(',')
+					this.checkArr = [...nowArr]
 				}
-				
+
 			},
 			// 隐藏键盘
 			hideKeyboard() {
@@ -357,14 +383,17 @@
 			},
 			// 检测维保结果select事件
 			setResult(e) {
-				console.log('e', e);
-				this.formData.detresult = {id:e.id,name:e.name};
+				// console.log('e', e);
+				this.formData.detresult = {
+					id: e.id,
+					name: e.name
+				};
 				// this.formData.orgName = e.name;
-				// console.log(this.formData.orgId);
+				console.log(this.formData);
 			},
 			// 检测检测项目select事件
 			setInsp(e) {
-				console.log('e', e);
+				// console.log('e', e);
 				this.formData.detinspect = e.name;
 				// this.formData.orgName = e.name;
 				// console.log(this.formData.orgId);

+ 7 - 7
pagesA/fire/fpd_detection/detection_details/detection_details.vue

@@ -94,7 +94,7 @@
 		onShow() {
 			if (this.thisId) {
 				getFpdDetection(this.thisId).then(res => {
-					console.log('thisform', res);
+					// console.log('thisform', res);
 					//对检测结果进行初始化
 					const reArr = getDictDatas(DICT_TYPE.BACKEND_DET_RESULT)
 					// console.log('reArr',reArr);
@@ -116,7 +116,7 @@
 						pageSize: this.pageSize,
 						userId: this.$store.state.user.id
 					}).then(response => {
-						console.log(response, 'response');
+						// console.log(response, 'response');
 						// 取到用户对应的单位名称与id
 						response.data.forEach(v => {
 							if (this.formData.orgId === v.dwid) {
@@ -129,7 +129,7 @@
 
 						uni.createSelectorQuery().in(this).select('.heigthButton').boundingClientRect(
 							data => {
-								console.log('data', data);
+								// console.log('data', data);
 								this.wheight = data.height
 							}).exec()
 					})
@@ -144,7 +144,7 @@
 			this.thisId = option.id
 			//获取当前表单数据
 			getFpdDetection(option.id).then(res => {
-				console.log('thisform', res);
+				// console.log('thisform', res);
 				//对检测结果进行初始化
 				const reArr = getDictDatas(DICT_TYPE.BACKEND_DET_RESULT)
 				// console.log('reArr',reArr);
@@ -166,7 +166,7 @@
 					pageSize: this.pageSize,
 					userId: this.$store.state.user.id
 				}).then(response => {
-					console.log(response, 'response');
+					// console.log(response, 'response');
 					// 取到用户对应的单位名称与id
 					response.data.forEach(v => {
 						if (this.formData.orgId === v.dwid) {
@@ -187,7 +187,7 @@
 				// 	console.log('data',data);
 				// 	this.wheight = data.height
 				// }).exec()
-				console.log('edit页面的val的值', this.formData);
+				// console.log('edit页面的val的值', this.formData);
 			})
 
 			// 接收来自上个页面传递的参数
@@ -207,7 +207,7 @@
 			},
 			// 下载附件
 			down(attId) {
-				console.log(attId, 'sdf');
+				// console.log(attId, 'sdf');
 				downSee(attId)
 			},
 			// 传递当前页面数据到 ‘修改信息’

+ 33 - 25
pagesA/fire/fpd_detection/edit_detection/edit_detection.vue

@@ -136,7 +136,10 @@
 				formData: {
 					status: '0',
 					File: [],
-					detresult: {id:null,name:null}
+					detresult: {
+						id: null,
+						name: null
+					}
 				},
 				// 自定义表单校验规则
 				customRules: {
@@ -173,25 +176,25 @@
 			// 	this.wheight = data.height
 			// }).exec()
 			const query = uni.createSelectorQuery().in(this)
-			console.log('query',query);
+			// console.log('query',query);
 			const thisNode = query.select('.heigthButton')
-			console.log('thisNode',thisNode);
+			// console.log('thisNode',thisNode);
 			thisNode.boundingClientRect(data => {
-				console.log('data',data);
+				// console.log('data',data);
 				this.wheight = data.height
 			}).exec()
 		},
 		// 在 vue页面,向起始页通过事件传递数据
 		// 在 vue页面,向起始页通过事件传递数据
 		onLoad: function(option) {
-			console.log('op', option);
+			// console.log('op', option);
 			this.actions2.map(i => {
 				i.name = i.label;
 				i.id = i.value;
 			});
 			//获取当前表单数据
 			getFpdDetection(option.id).then(res => {
-				console.log('thisform', res);
+				// console.log('thisform', res);
 				//对检测结果进行初始化
 				const reArr = getDictDatas(DICT_TYPE.BACKEND_DET_RESULT)
 				// console.log('reArr',reArr);
@@ -207,6 +210,11 @@
 
 
 				this.formData = res.data
+				if (this.formData.detinspect) {
+
+					const nowArr = this.formData.detinspect.split(',')
+					this.checkArr = [...nowArr]
+				}
 				var File = this.formData.File = []
 				if (this.formData.att != '') {
 					File.push({
@@ -222,7 +230,7 @@
 					pageSize: this.pageSize,
 					userId: this.$store.state.user.id
 				}).then(response => {
-					console.log(response, 'response');
+					// console.log(response, 'response');
 					// 取到用户对应的单位名称与id
 					response.data.forEach(v => {
 						if (this.formData.orgId === v.dwid) {
@@ -230,7 +238,7 @@
 						}
 					});
 				});
-				console.log('edit页面的val的值', this.formData);
+				// console.log('edit页面的val的值', this.formData);
 			})
 			// const navData = JSON.parse(option.navData)
 			// console.log('navdata', navData);
@@ -252,7 +260,7 @@
 				pageSize: this.pageSize,
 				userId: this.$store.state.user.id
 			}).then(response => {
-				console.log(response, 'response');
+				// console.log(response, 'response');
 				// 取到用户对应的单位名称与id
 				response.data.map(v => {
 					this.actions5.push({
@@ -272,7 +280,7 @@
 			this.resultOptions = [...trueArr]
 			//初始化检测项目选项
 			const trueArr1 = []
-			console.log('detinspectOptions', this.detinspectOptions);
+			// console.log('detinspectOptions', this.detinspectOptions);
 			this.detinspectOptions.forEach(item => {
 				trueArr1.push({
 					id: item.value,
@@ -287,7 +295,7 @@
 
 		methods: {
 			submit(ref) {
-				console.log(this.formData, 'alertalertalert');
+				// console.log(this.formData, 'alertalertalert');
 				// if (!this.formData.orgName) {
 				// 	return this.$modal.msgError('请选择所属单位')
 				// }
@@ -298,7 +306,7 @@
 					.validate()
 					.then(res => {
 						this.formData['status'] = 0;
-						console.log(this.formData);
+						// console.log(this.formData);
 						// if (this.formData.File.length > 0) {
 						// 	this.formData.attId = this.formData.File[0].url.toString();
 						// } else {
@@ -307,17 +315,17 @@
 						//对提交的数据进行处理
 						this.$set(this.formData, 'detresult', this.formData.detresult.id)
 						var jsdata = JSON.stringify(this.formData);
-						console.log(jsdata, 'jsdatajsdatajsdata');
+						// console.log(jsdata, 'jsdatajsdatajsdata');
 						updateFpdDetection(jsdata).then(response => {
-							console.log('response.data.msg,', response.data);
+							// console.log('response.data.msg,', response.data);
 							uni.showLoading({
 								title: response.data.msg
 							});
 							setTimeout(() => {
-								console.log('修改成功!');
+								// console.log('修改成功!');
 								uni.hideLoading();
 								uni.navigateBack({
-									delta: 1
+									delta: 2
 								})
 								// uni.navigateTo({
 								// 	url: '/pagesA/fire/fpd_detection/detection_details/detection_details?id='+this.formData.id
@@ -356,7 +364,7 @@
 						Authorization: 'Bearer ' + getAccessToken()
 					}, //请求token
 					success: res => {
-						console.log('res', res);
+						// console.log('res', res);
 						let data = JSON.parse(res.data);
 						// 返回的url
 						var fileLink = data.data;
@@ -377,7 +385,7 @@
 
 					},
 					fail: () => {
-						console.log('err');
+						// console.log('err');
 						uni.showToast({
 							icon: 'error',
 							title: '文件上传失败!'
@@ -387,13 +395,13 @@
 			},
 			// 移出图片函数
 			async deleteFile(e) {
-				console.log(e);
+				// console.log(e);
 				this.formData.attId = [];
-				console.log('移除了:', this.formData.attId);
+				// console.log('移除了:', this.formData.attId);
 			},
 			//检测项目多选框选中
 			checkboxChange2(arr) { //勾选的事件
-				console.log('arr', arr);
+				// console.log('arr', arr);
 				this.checkArr = [...arr]
 
 			},
@@ -419,17 +427,17 @@
 			},
 
 			changetime(e) {
-				console.log('change', e);
+				// console.log('change', e);
 			},
 			// 所属单位
 			sexSelect5(e) {
 				this.formData.orgId = e.id;
 				this.formData.orgName = e.name;
-				console.log(this.formData.orgId);
+				// console.log(this.formData.orgId);
 			},
 			// 检测维保结果select事件
 			setResult(e) {
-				console.log('e', e);
+				// console.log('e', e);
 				// this.formData.detresult.id = e.id;
 				// this.formData.detresult.name = e.name;
 				this.$set(this.formData, 'detresult', {
@@ -441,7 +449,7 @@
 			},
 			// 检测检测项目select事件
 			setInsp(e) {
-				console.log('e', e);
+				// console.log('e', e);
 				this.formData.detinspect = e.name;
 				// this.formData.orgName = e.name;
 				// console.log(this.formData.orgId);

+ 9 - 9
pagesA/fire/fpd_detection/fpd_detection.vue

@@ -130,11 +130,11 @@
 		methods: {
 			//搜索
 			search() {
-				console.log('keyword', this.keyword);
+				// console.log('keyword', this.keyword);
 				getFpdDetectionPage({
 					detinspect: this.keyword
 				}).then(res => {
-					console.log('res', res);
+					// console.log('res', res);
 					if (res.data) {
 						//对检测结果进行初始化
 						const reArr = getDictDatas(DICT_TYPE.BACKEND_DET_RESULT)
@@ -163,15 +163,15 @@
 			showModal(val) {
 				this.show = true;
 				this.id = val.id;
-				console.log('val', this.id);
+				// console.log('val', this.id);
 			},
 			close() {
 				this.show = false;
-				console.log('close');
+				// console.log('close');
 			},
 			cancel() {
 				this.show = false;
-				console.log('cancel');
+				// console.log('cancel');
 			},
 			// 隐藏键盘
 			hideKeyboard() {
@@ -185,7 +185,7 @@
 					this.isLoaded = false
 					this.tableData = []
 					this.getData();
-					console.log(this.tableData, '删除后重新获取');
+					// console.log(this.tableData, '删除后重新获取');
 				});
 			},
 			sexSelect(e) {
@@ -223,7 +223,7 @@
 					}
 					this.isLoaded = true
 					this.loading = false;
-					console.log('tableData', this.tableData);
+					// console.log('tableData', this.tableData);
 
 				}).catch(err => {
 						this.isLoaded = true
@@ -234,11 +234,11 @@
 			},
 			// 传递数据
 			onClick(val, orgName) {
-				console.log(val.orgName, val, 'val');
+				// console.log(val.orgName, val, 'val');
 				const navData = JSON.stringify({
 					...val
 				})
-				console.log('navData', navData);
+				// console.log('navData', navData);
 				this.isLoaded = false
 				uni.navigateTo({
 					url: '/pagesA/fire/fpd_detection/detection_details/detection_details?id=' + val.id