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

消防检测与维护 增删改查完成

liuQiang 1 жил өмнө
parent
commit
650eef447e

+ 4 - 3
pagesA/fire/fpd_detection/add_detection/add_detection.vue

@@ -26,8 +26,8 @@
 					</u-form-item>
 					<u-form-item label="所属单位" @click="
 							showSex5 = true;
-							hideKeyboard();" prop="orgId" :required="true">
-						<u--input v-model="formData.orgId" disabled disabledColor="#ffffff"
+							hideKeyboard();" prop="orgName" :required="true">
+						<u--input v-model="formData.orgName" disabled disabledColor="#ffffff"
 							placeholder="请选择所属单位"></u--input>
 					</u-form-item>
 					<u-form-item label="附件">
@@ -354,9 +354,10 @@
 			},
 			// 所属单位
 			sexSelect5(e) {
+				// console.log('e',e);
 				this.formData.orgId = e.id;
 				this.formData.orgName = e.name;
-				console.log(this.formData.orgId);
+				// console.log(this.formData);
 			},
 			// 检测维保结果select事件
 			setResult(e) {

+ 12 - 22
pagesA/fire/fpd_detection/detection_details/detection_details.vue

@@ -13,8 +13,8 @@
 				<u-form-item label="检测维保结果" prop="detresult" >
 					<u-input v-model="formData.detresult" disabled placeholder="请输入检测维保结果" />
 				</u-form-item>
-				<u-form-item label="所属单位"  prop="orgId" :required="true">
-						<u-input v-model="formData.orgId" disabled placeholder="" />
+				<u-form-item label="所属单位"  prop="orgName" :required="true">
+						<u-input v-model="formData.orgName" disabled placeholder="" />
 				</u-form-item>
 				<u-form-item label="附件">
 					<view class="buju">
@@ -47,9 +47,6 @@
 				formData: {
 					orgName: ''
 				},
-				formData: {
-					orgName: ''
-				},
 				screenHeight: this.$screenHeight,
 				wheight: '',
 			};
@@ -65,12 +62,14 @@
 
 
 			// 接收来自上个页面传递的参数
-			const eventChannel = this.getOpenerEventChannel();
-			eventChannel.on('acceptDataFromOpenerPage', function(val) {
-				that.formData = val;
-				console.log('val+++++++++++++++++++', that.formData);
-			});
-			this.formData.orgName = option.orgName
+			const navData = JSON.parse(option.navData)
+			that.formData = navData;
+			// const eventChannel = this.getOpenerEventChannel();
+			// eventChannel.on('acceptDataFromOpenerPage', function(val) {
+			// 	that.formData = val;
+			// 	console.log('val+++++++++++++++++++', that.formData);
+			// });
+			// this.formData.orgName = option.orgName
 			console.log("option: ", that.formData);
 		},
 
@@ -83,18 +82,9 @@
 			// 传递当前页面数据到 ‘修改信息’
 			gotoEditDetection(val) {
 				// console.log('val',val);
+				const navData = JSON.stringify(this.formData)
 				uni.navigateTo({
-					url: '/pagesA/fire/fpd_detection/edit_detection/edit_detection?id=' + val.id,
-					events: {
-						// 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
-						acceptDataFromOpenedPage: function(val) {
-							this.formData = val;
-						}
-					},
-					success: function(res) {
-						// 通过eventChannel向被打开页面传送数据
-						res.eventChannel.emit('acceptDataFromOpenedPage', val);
-					}
+					url: '/pagesA/fire/fpd_detection/edit_detection/edit_detection?id=' + val.id+'&navData='+navData,
 				});
 			}
 		}

+ 40 - 49
pagesA/fire/fpd_detection/edit_detection/edit_detection.vue

@@ -26,14 +26,14 @@
 					</u-form-item>
 					<u-form-item label="所属单位" @click="
 							showSex5 = true;
-							hideKeyboard();" prop="orgId" :required="true">
-						<u--input v-model="formData.orgId" disabled disabledColor="#ffffff"
+							hideKeyboard();" prop="orgName" :required="true">
+						<u--input v-model="formData.orgName" disabled disabledColor="#ffffff"
 							placeholder="请选择所属单位"></u--input>
 					</u-form-item>
 					<u-form-item label="附件">
 						<!-- 选择文件上传 -->
 						<uni-file-picker
-							v-model="formData.att"
+							v-model="formData.File"
 							del-icon
 							limit="1"
 							auto-upload
@@ -56,24 +56,24 @@
 			<u-action-sheet :show="showreOption" :actions="resultOptions" title="请选择检测维保结果"
 				@close="showreOption = false" @select="setResult"></u-action-sheet>
 			<!-- 检测项目选项框 -->
-<!-- 			<u-action-sheet :show="showInspOption" :actions="detinspectOptions" title="请选择检测项目"
+			<!-- 			<u-action-sheet :show="showInspOption" :actions="detinspectOptions" title="请选择检测项目"
 				@close="showInspOption = false" @select="setInsp"></u-action-sheet> -->
 			<!-- ----隐患 -->
 			<u-popup :show="showInspOption" :round="10" @close="showInspOption=false">
 				<view style="width: 70vw;overflow-y: auto;margin-bottom: 80rpx;padding:10px">
 					<text class="text-xl">选择隐患类型:</text>
 					<view class="" class="person-forward">
-						<u-checkbox-group   placement="column"
-							v-model="checkArr" @change="checkboxChange2" activeColor="#4CB2B6"
-							iconSize="red">
-							<u-checkbox  v-for="(items, indexs) in detinspectOptions" :key="indexs" :customStyle="{marginBottom: '60rpx'}" :label="items.name" :name="items.name">
+						<u-checkbox-group placement="column" v-model="checkArr" @change="checkboxChange2"
+							activeColor="#4CB2B6" iconSize="red">
+							<u-checkbox v-for="(items, indexs) in detinspectOptions" :key="indexs"
+								:customStyle="{marginBottom: '60rpx'}" :label="items.name" :name="items.name">
 							</u-checkbox>
 						</u-checkbox-group>
 					</view>
 					<view class="flex flex-direction-row "
 						style="position: fixed;bottom: 10px;left: 50%;transform: translate(-50%);height: 100rpx;width: 80%">
-						<u-button shape="circle" type="primary" color="#4CB2B6" text="确定"
-							@click="checkboxConfirm2()" customStyle="margin-right:20px;padding:0 30px">
+						<u-button shape="circle" type="primary" color="#4CB2B6" text="确定" @click="checkboxConfirm2()"
+							customStyle="margin-right:20px;padding:0 30px">
 						</u-button>
 						<u-button type="primary" plain color="#4CB2B6" text="取消" shape="circle"
 							@click="checkboxCancel2()" customStyle="padding:0 30px">
@@ -94,8 +94,8 @@
 		createFpdDetection, // 更新
 		getOrgId,
 		upload, //上传文件
-		getFpdDetection,//根据id拿数据
-		updateFpdDetection//更新消防设备维护和检测台账
+		getFpdDetection, //根据id拿数据
+		updateFpdDetection //更新消防设备维护和检测台账
 	} from '@/api/fpdDetection/index.js';
 	import {
 		DICT_TYPE,
@@ -183,39 +183,30 @@
 		// 在 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);
-				this.formData = res.data
-			})
-			// 在 vue页面,向起始页通过事件传递数据
-			// var data = option.id;	
-			// that = this;
-			// const eventChannel = this.getOpenerEventChannel();
-			// eventChannel.on('acceptDataFromOpenedPage', function(val) {
-			// 	that.formData = val;
-			// 	console.log(val,'val33333333333');
-			// 	var File = 	that.formData.File = []
-			// 	if(that.formData.att !='' ){
-			// 		File.push({
-			// 			url: that.formData.att,
-			// 			name: that.formData.att
-			// 		});		
-			// 	}else{
-			// 		File =null
-			// 	}
-			// 	console.log('edit页面的val的值', that.formData);
-				// if(that.formData.drillType == 1){
-				// 	that.formData.drillTypeName = '培训'
-				// }else if(that.formData.drillType == 2){
-				// 	that.formData.drillTypeName = '演练'
-				// }
-			// });
+			// getFpdDetection(option.id).then(res => {
+			// 	console.log('thisform', res);
+			// 	this.formData = res.data
+			// })
+			const navData = JSON.parse(option.navData)
+			console.log('navdata', navData);
+			this.formData = navData;
+			var File = this.formData.File = []
+			if (this.formData.att != '') {
+				File.push({
+					url: this.formData.att,
+					name: this.formData.att
+				});
+			} else {
+				File = null
+			}
+			console.log('edit页面的val的值', this.formData);
+			
 			// 获取单位id
 			getOrgId({
 				pageNo: this.pageNo,
@@ -358,23 +349,23 @@
 			},
 			//检测项目多选框选中
 			checkboxChange2(arr) { //勾选的事件
-				console.log('arr',arr);
+				console.log('arr', arr);
 				this.checkArr = [...arr]
-				
+
 			},
-			checkboxConfirm2(){
+			checkboxConfirm2() {
 				this.showInspOption = false
 				this.formData.detinspect = this.checkArr.join(',')
 				// console.log('detinspect',this.formData.detinspect);
 			},
-			checkboxCancel2(){
+			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() {

+ 31 - 18
pagesA/fire/fpd_detection/fpd_detection.vue

@@ -4,7 +4,7 @@
 		<uni-row class="demo-uni-row padding-tb-sm" :gutter="20" width="100%">
 			<uni-col :span="24">
 				<view class="u-page__tag-item">
-					<u-search placeholder="请输入培训演练名称" bgColor="#edf6f9" borderColor="#4cb2b6" v-model="keyword"
+					<u-search placeholder="请输入检测项目名称" bgColor="#edf6f9" borderColor="#4cb2b6" v-model="keyword"
 						:show-action="true" @custom="search"></u-search>
 				</view>
 			</uni-col>
@@ -36,7 +36,7 @@
 					</view>
 					<view style="display: flex;margin-bottom: 15rpx; color: #728f90;">
 						<text class="name-align-drill">所属单位:</text>
-						<text class="conts">{{ item.orgId }}</text>
+						<text class="conts">{{ item.orgName }}</text>
 					</view>
 					<view style="display: flex;margin-bottom: 15rpx; color: #728f90;">
 						<text class="name-align-drill"> 检测维保结果:</text>
@@ -132,7 +132,7 @@
 					console.log('res', res);
 					if (res.data) {
 						this.tableData = res.data.list
-					}else{
+					} else {
 						this.tableData = []
 					}
 				})
@@ -173,32 +173,45 @@
 					console.log(this.tableData, '删除后重新获取');
 				});
 			},
+			sexSelect(e) {
+				this.formData.orgId = e.id;
+				this.formData.orgName = e.name;
+				// 获取培训演练信息详细信息
+				getFpdDetectionPage({
+					pageNo: this.pageNo,
+					pageSize: this.pageSize,
+					orgId: this.formData.orgId
+				}).then(response => {
+					this.tableData = response.data.list;
+				});
+			},
 			//获取表格数据
 			getData() {
 				this.loading = true;
 				getFpdDetectionPage(this.queryParams).then(response => {
-					this.tableData = response.data.list;
+					if (response.data) {
+
+						this.tableData = response.data.list;
+					}
 					this.isLoaded = true
 					this.loading = false;
 					console.log('tableData', this.tableData);
-				});
+
+				}).catch(err => {
+						this.isLoaded = true
+						this.loading = false;
+					}
+
+				);
 			},
 			// 传递数据
 			onClick(val, orgName) {
-				console.log(val, orgName, 'val');
+				console.log(val.orgName, val, 'val');
+				const navData = JSON.stringify({...val})
+				console.log('navData',navData);
 				this.isLoaded = false
 				uni.navigateTo({
-					url: '/pagesA/fire/fpd_detection/detection_details/detection_details?id=' + val.id,
-					events: {
-						// 为指定事件添加一个监听器,获取被打开页面传送到当前页面的数据
-						acceptDataFromOpenedPage: function(val) {
-							console.log(val, '打开页面传送到当前页面的数据');
-						}
-					},
-					success: function(res) {
-						// 通过eventChannel向被打开页面传送数据
-						res.eventChannel.emit('acceptDataFromOpenerPage', val);
-					}
+					url: '/pagesA/fire/fpd_detection/detection_details/detection_details?id=' + val.id+'&navData='+navData,
 				});
 			},
 		},
@@ -231,7 +244,7 @@
 				this.formData.orgId = response.data[0].dwid;
 				this.tableData = []
 				this.getData();
-			
+
 			}).catch(err => {
 				this.loading = false
 				this.$modal.msg(err)