<template>
	<view >
		<page-nav :desc="desc" :title="title"></page-nav>
		<view>
			<form @submit="formSubmit" @reset="formReset">
				<!-- 项目信息项 -->
				<view class="uni-form-item">
					<view class="view-flex-rs line-body">
						<view class="view-flex-cc">
							<text class="required-star">*</text>
						</view>
						<view style="width: 200rpx;" class="view-flex-cc item-title">
							<text>当前项目：</text>
						</view>
						<view style="flex-grow: 0.9;" class="view-flex-cc">
							<text>{{projectInfo.title}}</text>
						</view>
						<view style="width: 200rpx;" class="view-flex-cc">
							<button style="height: 80rpx;font-size: medium;" type="primary"
								@click="goto('/pages/checkReport/checkProjectSelect?model=1')">重新选择</button>
						</view>
					</view>
				</view>
				<!-- 检查区域信息项 -->
				<view class="uni-form-item" style="margin-top: 10px;">
					<view class="line-body view-flex-rs">
						<text class="required-star">*</text>
						<text class="item-title">检查区域</text>
					</view>
					<view>
						<uni-list-item @click="selectCheckArea()" :clickable="true" :ellipsis="1"
							:show-extra-icon="true" showArrow
							:extra-icon="{color: '#4cd964',size: '22',type: 'settings'}"
							v-bind:title="checkAreaDict.dictValue" />
					</view>
					<!-- 				<u-cell-item class="line-body" icon="setting-fill" v-bind:title="checkAreaDict.dictValue"
						hover-class="cell-hover-class" @click="selectCheckArea()"></u-cell-item> -->
				</view>
				<!-- 检查点位文本信息项 -->
				<view class="uni-form-item uni-column" style="margin-top: 10rpx;">
					<view class="line-body item-title">
						具体位置
					</view>
					<view class="line-body">
						<uni-easyinput errorMessage v-model="failureCheckPointDesc" placeholder="请输入内容"></uni-easyinput>
					</view>
				</view>
				<!-- 安全隐患问题类型信息项，字典 -->
				<view class="uni-form-item" style="margin-top: 10px;">
					<view class="line-body view-flex-rs">
						<text class="required-star">*</text>
						<text class="item-title">安全问题隐患类型</text>
					</view>
					<view>
						<uni-list-item @click="selectCheckItemType()" :clickable="true" :ellipsis="1"
							:show-extra-icon="true" showArrow
							:extra-icon="{color: '#4cd964',size: '22',type: 'settings'}"
							v-bind:title="checkItemTypeDict.dictValue" />
					</view>

					<!-- 	<u-cell-item class="line-body" icon="setting-fill" v-bind:title="checkItemTypeDict.dictValue"
						hover-class="cell-hover-class" @click="selectCheckItemType()"></u-cell-item> -->
				</view>
				<!-- 安全隐患问题标签信息项,字典 -->
				<view class="uni-form-item" style="margin-top: 10px;">
					<view class="line-body view-flex-rs">
						<text class="required-star">*</text>
						<text class="item-title">检查部位</text>
					</view>
					<view>
						<uni-list-item @click="selectCheckItemLabel()" :clickable="true" :ellipsis="1"
							:show-extra-icon="true" showArrow
							:extra-icon="{color: '#4cd964',size: '22',type: 'settings'}"
							v-bind:title="checkItemLabelDict.dictValue" />
					</view>
					<!-- <u-cell-item class="line-body" icon="setting-fill"  v-bind:title="checkItemLabelDict.dictValue"
						hover-class="cell-hover-class" @click="selectCheckItemLabel()"></u-cell-item> -->
				</view>


				<!-- 安全隐患问题排查标准信息项,字典 -->
				<view class="uni-form-item  uni-column" style="margin-top: 10px;">
					<view class="line-body view-flex-rs">
						<text class="required-star">*</text>
						<text class="item-title">问题隐患标签</text>
					</view>
					<view>
						<uni-list-item @click="selectCheckStandard()" :clickable="true" :ellipsis="1"
							:show-extra-icon="true" showArrow
							:extra-icon="{color: '#4cd964',size: '22',type: 'settings'}"
							v-bind:title="checkStandardDict.dictValue" />
					</view>


					<!-- <u-cell-item class="line-body" icon="setting-fill" v-bind:title="checkStandardDict.dictValue"
						hover-class="cell-hover-class" @click="selectCheckStandard()"></u-cell-item> -->
				</view>
				<view class="uni-form-item uni-column" style="margin-top: 10px;">
					<view class="line-body item-title">
						法律法规
					</view>
					<view class="line-body">
						<textarea disabled v-model="checkItemStandardBasisDict.dictValue" class="mline-text" />

						<!-- <uni-easyinput disabled v-model="checkItemStandardBasisDict.dictValue"></uni-easyinput> -->
					</view>
				</view>

				<!-- 	安全隐患问题描述信息项，文本 -->
				<view class="uni-form-item uni-column" style="margin-top: 10px;">
					<view class="line-body item-title">
						安全问题隐患描述
					</view>
					<view class="line-body">
						<textarea v-model="failureHiddenDangerDesc" name="failureCorrectiveSuggest"
							class="mline-text" />

					</view>
				</view>

				<!-- 隐患等级信息项,字典 -->
				<view class="uni-form-item" style="margin-top: 15px;">
					<view class="view-flex-rs">
						<view class="uni-title line-body"><text class="required-star">*</text><text
								class="item-title">隐患等级</text></view>
						<view class="line-body">
							<radio-group @change="hiddenDangerRadioChange"
								style="display: flex;flex-direction: row;justify-content: flex-start;">
								<label style="margin-top: 2px;margin-right: 5px;" class="view-flex-rs"
									v-for="(item, index) in hiddenDangerRadio.items" :key="item.id">
									<view>
										<radio :value="item.id" :checked="index === hiddenDangerRadio.current" />
									</view>
									<view style="font-size: 12px;">{{item.dictValue}}</view>
								</label>
							</radio-group>
						</view>
					</view>
				</view>
				<!-- 整改建议信息项，文本 -->
				<view class="uni-form-item uni-column" style="margin-top: 10px;">
					<view class="line-body item-title">
						整改建议
					</view>
					<view class="line-body">
						<textarea v-model="failureCorrectiveSuggest" name="failureCorrectiveSuggest"
							class="mline-text" />
					</view>
				</view>
				<!-- 整改期限信息项,字典 -->
				<view class="uni-form-item" style="margin-top: 15px;">
					<view class="view-flex-rs">
						<view class="uni-title line-body"><text class="required-star">*</text><text
								class="item-title">整改期限</text></view>
						<view class="line-body">
							<radio-group @change="planTimeRadioChange"
								style="display: flex;flex-direction: row;justify-content: flex-start;">
								<label style="margin-top: 2px;margin-right: 5px;" class="view-flex-rs"
									v-for="(item, index) in planTimeRadio.items" :key="item.id">
									<view>
										<radio :value="item.id" :checked="index === planTimeRadio.current" />
									</view>
									<view style="font-size: 12px;">{{item.dictValue}}</view>
								</label>
							</radio-group>
						</view>
					</view>
				</view>
				<!-- 图片信息项 -->
				<view class="uni-form-item" style="margin-top: 10px;">
					<view class="view-flex-rs line-body">
						<view class="view-flex-cc" style="height: 40px;">
							<text class="item-title">安全隐患问题图片</text>
						</view>
					</view>
				</view>
				<view class="uni-form-item" style="margin-top: 10px;">
					<view class="img-container">
						<view class="note-image-box">
							<view class="note-image-item" v-for="(item , index) in localImageList" :key="index">
								<view class="close-icon" @click="onDeleteClick(index)">
									<uni-icons type="closeempty" size="18" color="#fff"></uni-icons>
								</view>
								<view class="image-box">
									<image :src="item" mode="widthFix"></image>
								</view>
							</view>
							<view v-if="localImageList.length < 9" class="note-image-item" @click="getPhoto()">
								<view class="image-box">
									<uni-icons type="plusempty" size="50" color="#eee"></uni-icons>
								</view>
							</view>
						</view>
					</view>
				</view>
				<u-gap height="50"></u-gap>
				<view class="uni-form-item uni-column">
					<view class="line-body">
						<button type="primary" form-type="submit">提交</button>
					</view>
					<view class="line-body" style="margin-top: 10px;">
						<button type="default" @click="onSaveClick">保存</button>
					</view>
				</view>
				<u-gap height="50"></u-gap>
			</form>
		</view>
	</view>
</template>

<script>
	import pageNav from '@/components/page-nav/page-nav.vue';
	import http from '@/http/api.js';
	import {
		pathToBase64,
		base64ToPath
	} from '@/js_sdk/mmmm-image-tools/index.js';
	import {
		devUrl,
		prodUrl
	} from '@/common/setting';

	export default {
		components: {
			pageNav
		},
		onLoad(option) {
			this.baseURL = process.env.NODE_ENV === 'development' ? devUrl : prodUrl;
			this.userInfo1 = uni.getStorageSync("userInfo");
			this.checkNo = this.getCheckNo();
			this.initProjectInfo(option.id);

			//查询隐患等级
			var dangerLevelList = [];
			http.request({
				url: '/galaxy-system/dict-biz/dictionary?code=danger_level',
				method: 'GET'
			}).then(res => {
				console.log(res.data)
				if (res.data != null) {
					const dictLength = res.data['length'];
					for (var i = 0; i < dictLength; i++) {
						let dict = res.data['' + i];
						dangerLevelList.push(dict);
					}
				}

			}).catch(err => {
				console.log(err)
			})
			this.hiddenDangerRadio.items = dangerLevelList;
			//查询整改期限
			var planTimeList = [];
			http.request({
				url: '/galaxy-system/dict-biz/dictionary?code=plan_time',
				method: 'GET'
			}).then(res => {
				console.log(res.data)
				if (res.data != null) {
					const dictLength = res.data['length'];
					for (var i = 0; i < dictLength; i++) {
						let dict = res.data['' + i];
						planTimeList.push(dict);
					}
				}

			}).catch(err => {
				console.log(err)
			})
			this.planTimeRadio.items = planTimeList;
		},
		data() {
			return {
				baseURL: '',
				userInfo1: {},
				checkNo: '',
				planTimeRadio: {
					items: [],
					current: 0,
				},
				hiddenDangerRadio: {
					items: [],
					current: 0,
				},
				localImageList: [],
				uploadImageList: [],
				checkAreaDict: {
					id: '',
					dictKey: '',
					dictValue: '请点击选择'
				},
				checkItemTypeDict: {
					id: '',
					dictKey: '',
					dictValue: '请点击选择'
				},
				checkItemLabelDict: {
					id: '',
					dictKey: '',
					dictValue: '请点击选择'
				},
				checkStandardDict: {
					id: '',
					dictKey: '',
					dictValue: '请点击选择'
				},
				checkItemStandardBasisDict: {
					id: '',
					dictKey: '',
					dictValue: ''
				},
				title: '开始检查',
				desc: '',
				projectInfo: {
					'projectId': '',
					'title': ''
				},
				failureHiddenDangerDesc: '',
				failureCheckPointDesc: '',
				failureCorrectiveSuggest: '',
			}
		},
		computed: {
			getIcon() {
				return path => {
					return 'https://cdn.uviewui.com/uview/example/' + path + '.png';
				}
			},
		},
		onShow() {
			uni.setNavigationBarTitle({
				title: ""
			});

			//项目选择结果监听  
			uni.$on("handClickProjectSelect", res => {
				console.log(res);
				this.projectInfo = {
					projectId: res.projectId,
					title: res.title
				}
				// 清除监听
				uni.$off('handClickProjectSelect');
			})

			//检查区域选择结果监听  
			uni.$on("handClickAreaSelect", res => {
				console.log(res);

				this.checkAreaDict = {
					dictValue: res.dictValue,
					dictKey: res.dictKey,
					id: res.id
				}

				// 清除监听
				uni.$off('handClickAreaSelect');
			})

			//安全隐患问题分类选择结果监听  
			uni.$on("handClickItemSelect", res => {
				console.log("callback " + res);


				if (this.checkItemTypeDict.id == null || this.checkItemTypeDict.id.length == 0 || this
					.checkItemTypeDict.id !== res.id) {
					this.checkItemLabelDict = {
						id: '',
						dictKey: '',
						dictValue: '请点击选择'
					}
					this.checkStandardDict = {
						id: '',
						dictKey: '',
						dictValue: '请点击选择'
					}
					this.failureHiddenDangerDesc = "";
					this.checkItemStandardBasisDict = {
						id: '',
						dictKey: '',
						dictValue: ''
					}
				}


				this.checkItemTypeDict = {
					dictValue: res.dictValue,
					dictKey: res.dictKey,
					id: res.id
				}

				// 清除监听
				uni.$off('handClickItemSelect');
			})

			//安全隐患标签选择结果监听  
			uni.$on("handClickItemLabelSelect", res => {
				console.log("handClickItemLabelSelect" + res);

				if (this.checkItemLabelDict.id == null || this.checkItemLabelDict.id.length == 0 || this
					.checkItemLabelDict.id !== res.id) {

					this.checkStandardDict = {
						id: '',
						dictKey: '',
						dictValue: '请点击选择'
					}
					this.failureHiddenDangerDesc = "";
					this.checkItemStandardBasisDict = {
						id: '',
						dictKey: '',
						dictValue: ''
					}
				}

				this.checkItemLabelDict = {
					dictValue: res.dictValue,
					dictKey: res.dictKey,
					id: res.id
				}
				// 清除监听
				uni.$off('handClickItemLabelSelect');
			})

			//安全隐患排查标准选择结果监听
			uni.$on("handClickStandardSelect", res => {
				console.log(res);

				if (this.checkStandardDict.id == null || this.checkStandardDict.id.length == 0 || this
					.checkStandardDict.id !== res.id) {

					this.failureHiddenDangerDesc = "";

					this.checkItemStandardBasisDict = {
						id: '',
						dictKey: '',
						dictValue: ''
					}
				}

				this.checkStandardDict = {
					dictValue: res.dictValue,
					dictKey: res.dictKey,
					id: res.id
				}
				this.failureHiddenDangerDesc = res.dictValue;

				this.checkItemStandardBasisDict = {
					dictValue: res.subDict.dictValue,
					dictKey: res.subDict.dictKey,
					id: res.subDict.id
				}
				// 清除监听
				uni.$off('handClickStandardSelect');
			})
		},
		created() {

		},
		methods: {
			dateFormat(dt) {
				var text = "" + dt.getFullYear();
				text += "-";
				text += ((dt.getMonth() + 1) < 10) ? ("0" + (dt.getMonth() + 1)) : (dt
					.getMonth() +
					1);
				text += "-";
				text += dt.getDate() < 10 ? "0" + dt.getDate() : dt.getDate();
				text += " ";
				text += dt.getHours() < 10 ? "0" + dt.getHours() : dt.getHours();
				text += ":";
				text += dt.getMinutes() < 10 ? "0" + dt.getMinutes() : dt.getMinutes();
				text += ":";
				text += dt.getSeconds() < 10 ? "0" + dt.getSeconds() : dt.getSeconds();
				return text;
			},
			getCheckNo() {
				var dt = new Date();
				var recordNo = "" + dt.getFullYear();
				recordNo = recordNo.substr(2, 2);
				recordNo += ((dt.getMonth() + 1) < 10) ? ("0" + (dt.getMonth() + 1)) : (dt
					.getMonth() +
					1);
				recordNo += dt.getDate() < 10 ? "0" + dt.getDate() : dt.getDate();
				recordNo += dt.getHours() < 10 ? "0" + dt.getHours() : dt.getHours();
				recordNo += dt.getMinutes() < 10 ? "0" + dt.getMinutes() : dt.getMinutes();
				recordNo += dt.getSeconds() < 10 ? "0" + dt.getSeconds() : dt.getSeconds();
				return recordNo;
			},
			initProjectInfo(failureProjectId) {
				const that = this;
				const id = failureProjectId;
				http.request({
					url: '/blade-business/report/projectInfo/detail',
					method: 'GET',
					params: {
						id
					}
				}).then(res => {
					console.log(res.data)
					that.projectInfo = {
						projectId: res.data.id,
						title: res.data.projectName
					}
				}).catch(err => {
					console.log(err)
				})
			},
			onDeleteClick(index) {
				this.localImageList.splice(index, 1);
			},
			planTimeRadioChange: function(evt) {
				for (let i = 0; i < this.planTimeRadio.items.length; i++) {
					if (this.planTimeRadio.items[i].id === evt.detail.value) {
						this.planTimeRadio.current = i;
						break;
					}
				}
			},
			hiddenDangerRadioChange: function(evt) {
				for (let i = 0; i < this.hiddenDangerRadio.items.length; i++) {
					if (this.hiddenDangerRadio.items[i].id === evt.detail.value) {
						this.hiddenDangerRadio.current = i;
						break;
					}
				}
			},
			getPhoto() {
				const that = this;
				if (this.localImageList.length > 9) {
					uni.showModal({
						content: '一次最多上传9张图片，请检查！',
						showCancel: false
					});
				} else {
					uni.chooseImage({
						sourceType: ['album', 'camera'],
						success: (res) => {
							const len = res.tempFilePaths.length;
							if (len > 0) {
								if (len + that.localImageList.length > 9) {
									uni.showModal({
										content: '一次最多上传9张图片，请检查！',
										showCancel: false
									});
								} else {
									let pathList = [];
									res.tempFilePaths.forEach(path => {
										pathList.push(path);
									})
									that.localImageList = that.localImageList.concat(pathList);
								}
							}
						}
					})
				}
			},
			onSaveClick(e) {
				if ((this.projectInfo.projectId != null && this.projectInfo.projectId.length > 0) &&
					(this.checkAreaDict.id != null && this.checkAreaDict.id.length > 0) &&
					(this.checkItemTypeDict.id != null && this.checkItemTypeDict.id.length > 0) &&
					(this.checkItemLabelDict.id != null && this.checkItemLabelDict.id.length > 0) &&
					(this.checkStandardDict.id != null && this.checkStandardDict.id.length > 0)) {
					try {
						var data = {};
						data['failureHiddenDangerDesc'] = this.failureHiddenDangerDesc;
						data['failureCheckPointDesc'] = this.failureCheckPointDesc;
						data['failureCorrectiveSuggest'] = this.failureCorrectiveSuggest;
						data['failureCheckNo'] = this.checkNo;
						data['failureProjectId'] = this.projectInfo.projectId;
						data['failureCheckArea'] = this.checkAreaDict.id;
						data['failureCheckHiddenDangerType'] = this.checkItemTypeDict.id;
						data['failureCheckHiddenDanger'] = this.checkItemLabelDict.id;
						data['failureCheckHiddenDangerItemPoint'] = this.checkStandardDict.id;
						data['failureCheckHiddenDangerStandard'] = this.checkItemStandardBasisDict.id;
						data['failureHiddenDangerLevel'] = this.hiddenDangerRadio.items[this.hiddenDangerRadio.current]
							.id;
						data['failureCorrectivePlanTime'] = this.planTimeRadio.items[this.planTimeRadio.current]
							.id;
						data['createTime'] = this.dateFormat(new Date());
						data['createUserName'] = this.userInfo1.nick_name;

						this.saveLocalFiles();

						console.log("save " + data);
						var list = uni.getStorageSync('check_report_storage_index');
						if (list != null && list.length > 0) {
							list.push(this.checkNo);
							uni.setStorageSync('check_report_storage_index', list);
							uni.setStorageSync('check_report_storage_' + this.checkNo, data);
						} else {
							list = [];
							list.push(this.checkNo);
							uni.setStorageSync('check_report_storage_index', list);
							uni.setStorageSync('check_report_storage_' + this.checkNo, data);
						}

						var that = this;
						uni.showModal({
							title: '流程确认',
							content: '请选择复制或继续检查',
							cancelText: '复制检查单',
							confirmText: '继续检查',
							success: function(res) {
								if (res.confirm) {
									that.onContinunClick();
								} else if (res.cancel) {
									that.onCopyClick();
								}
							}
						});

						//uni.navigateBack();
					} catch (e) {
						console.log(e)
						uni.showModal({
							content: '保存失败！',
							showCancel: false
						});
					}
				} else {
					uni.showModal({
						content: '请检查必填项',
						showCancel: false
					});
				}
			},
			saveLocalFile(paths) {
				var returnFileList = [];
				var count = 0;
				return new Promise((resolve, reject) => {
					paths.forEach(imagePath => {
						console.log("path " + imagePath);
						uni.saveFile({
							tempFilePath: imagePath,
							success: (res) => {
								var savedFilePath = res.savedFilePath;
								returnFileList.push(savedFilePath);
								count += 1;
								if (count == paths.length) {
									resolve(returnFileList);
								}
							},
							fail: (e) => {
								reject('err')
							}
						})
					});

				})

			},
			onCopyClick() {
				this.localImageList = [];
				this.checkNo = this.getCheckNo();
			
			},
			onContinunClick() {
				uni.navigateBack();
			},
			async saveLocalFiles() {
				if (this.localImageList.length > 0) {
					await this.saveLocalFile(this.localImageList).then(files => {
						uni.setStorageSync('check_report_storage_image_' + this
							.checkNo, files);
					});
				}
			},
			async upload(formdata) {
				if (this.localImageList.length > 0) {
					await this.uploadFile(this.localImageList).then(names => {
						names.forEach(name => {
							console.log("image path " + name);
							this.uploadImageList.push(name);
						})

						var photoPaths = [];
						this.uploadImageList.forEach(name => {
							let p = {
								failureCheckNo: this.checkNo,
								photoPath: name
							}
							photoPaths.push(p);
						})

						formdata['photoPaths'] = photoPaths;

						var that = this;
						http.request({
							url: '/blade-business/report/failure/save',
							method: 'POST',
							data: formdata
						}).then(res => {
							if (res.success) {
								uni.showModal({
									content: '上传成功',
									showCancel: false,
									success(res) {
										if (res.confirm) {

											uni.showModal({
												title: '流程确认',
												content: '请选择复制或继续检查',
												cancelText: '复制检查单',
												confirmText: '继续检查',
												confirmColor: '#000000',
												success: function(res) {
													if (res.confirm) {
														that.onContinunClick();
													} else if (res.cancel) {
														that.onCopyClick();
													}
												}
											});

											// uni.redirectTo({
											// 	url: 'pages/checkReport/copyCheckFormConfirm'
											// });
											//uni.navigateBack();
										}
									}
								});
							} else {
								uni.showModal({
									content: '' + res.msg,
									showCancel: false
								});
							}
						}).catch(err => {
							console.log(err)
						})

					})
				} else {
					var that = this;
					http.request({
						url: '/blade-business/report/failure/save',
						method: 'POST',
						data: formdata
					}).then(res => {
						if (res.success) {

							uni.showModal({
								content: '上传成功',
								showCancel: false,
								success(res) {
									if (res.confirm) {
										uni.showModal({
											title: '流程确认',
											content: '请选择复制或继续检查',
											cancelText: '复制检查单',
											confirmText: '继续检查',
											confirmColor: '#000000',
											success: function(res) {
												if (res.confirm) {
													that.onContinunClick();
												} else if (res.cancel) {
													that.onCopyClick();
												}
											}
										});

										//uni.navigateBack();
									}
								}
							});
						} else {
							uni.showModal({
								content: '' + res.msg,
								showCancel: false
							});
						}
					}).catch(err => {
						console.log(err)
					})
				}
			},
			uploadFile(imagePaths) {
				var count = 0;
				var returnImagePathList = [];
				console.log("accessToken:" + uni.getStorageSync('accessToken'));
				return new Promise((resolve, reject) => {
					imagePaths.forEach(imagePath => {
						console.log("path " + imagePath);
						uni.showLoading({
							title: '上传中'
						});
						uni.uploadFile({
							url: this.baseURL +
								'/galaxy-resource/oss/endpoint/put-file-attach?Blade-Auth=' +
								uni.getStorageSync('accessToken'),
							fileType: 'image',
							filePath: imagePath,
							name: 'file',
							success: (uploadFileRes) => {
								console.log(uploadFileRes);
								if (uploadFileRes.statusCode == 200) {
									let data = JSON.parse(uploadFileRes.data);
									if (data.success) {
										let name = data.data['name'];
										returnImagePathList.push(name);
									}
								}
								count += 1;
								if (count == imagePaths.length) {
									resolve(returnImagePathList);
								}
							},
							fail: (err) => {
								console.log(err);
								reject('err')
							},
							complete() {
								uni.hideLoading()
							}
						});
					});
				})
			},
			formSubmit: function(e) {
				console.log('form发生了submit事件，携带数据为：' + JSON.stringify(e.detail.value))
				//var formdata = e.detail.value
				if ((this.projectInfo.projectId != null && this.projectInfo.projectId.length > 0) &&
					(this.checkAreaDict.id != null && this.checkAreaDict.id.length > 0) &&
					(this.checkItemTypeDict.id != null && this.checkItemTypeDict.id.length > 0) &&
					(this.checkItemLabelDict.id != null && this.checkItemLabelDict.id.length > 0) &&
					(this.checkStandardDict.id != null && this.checkStandardDict.id.length > 0)) {

					var formdata = {};
					formdata['failureCheckNo'] = this.checkNo;
					formdata['failureProjectId'] = this.projectInfo.projectId;
					formdata['failureCheckArea'] = this.checkAreaDict.id;

					formdata['failureCheckHiddenDangerType'] = this.checkItemTypeDict.id;
					formdata['failureCheckHiddenDanger'] = this.checkItemLabelDict.id;
					formdata['failureCheckHiddenDangerItemPoint'] = this.checkStandardDict.id;
					formdata['failureCheckHiddenDangerStandard'] = this.checkItemStandardBasisDict.id;

					formdata['failureHiddenDangerDesc'] = this.failureHiddenDangerDesc;
					formdata['failureCheckPointDesc'] = this.failureCheckPointDesc;
					formdata['failureCorrectiveSuggest'] = this.failureCorrectiveSuggest;

					formdata['failureHiddenDangerLevel'] = this.hiddenDangerRadio.items[this.hiddenDangerRadio.current]
						.id;
					formdata['failureCorrectivePlanTime'] = this.planTimeRadio.items[this.planTimeRadio.current]
						.id;

					this.upload(formdata);

				} else {
					uni.showModal({
						content: '请检查必填项',
						showCancel: false
					});
				}

			},
			formReset: function(e) {
				console.log('清空数据')
			},
			selectCheckArea() {
				uni.navigateTo({
					url: '/pages/checkReport/checkAreaSelect'
				})
			},
			selectCheckItemType() {
				uni.navigateTo({
					url: '/pages/checkReport/checkItemSelect'
				})
			},
			selectCheckItemLabel() {
				if (this.checkItemTypeDict.id.length > 0) {
					uni.navigateTo({
						url: '/pages/checkReport/checkItemLabelSelect?id=' + this.checkItemTypeDict.id
					})
				} else {
					uni.showModal({
						content: '请先选择安全隐患问题类型',
						showCancel: false
					});
				}
			},
			selectCheckStandard() {
				if (this.checkItemLabelDict.id.length > 0) {
					uni.navigateTo({
						url: '/pages/checkReport/checkStandardSelect?id=' + this.checkItemLabelDict.id
					})
				} else {
					uni.showModal({
						content: '请先选择安全隐患问题标签',
						showCancel: false
					});
				}
			},
			openPage(path) {
				this.$u.route({
					url: path
				})
			},
			getGroupTitle(item) {
				return item.groupName
			},
			getFieldTitle(item) {
				return item.title
			},
			goto(url) {
				console.log(url);

				uni.navigateTo({
					url: url
				})
			}
		}
	}
</script>

<style>
	/* page {
		background-color: rgb(240, 242, 244);
	} */

	.cell-hover-class {
		background-color: rgb(235, 237, 238);
	}

	.view-flex-rs {
		display: flex;
		flex-direction: row;
		justify-content: flex-start;
	}

	.view-flex-rc {
		display: flex;
		flex-direction: row;
		justify-content: center;
	}

	.view-flex-re {
		display: flex;
		flex-direction: row;
		justify-content: flex-end;
	}

	.view-flex-cs {
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
	}

	.view-flex-cc {
		display: flex;
		flex-direction: column;
		justify-content: center;
	}

	.view-flex-ce {
		display: flex;
		flex-direction: column;
		justify-content: flex-end;
	}

	.line-body {
		padding-left: 10px;
		padding-right: 10px;
	}

	.required-star {
		color: #FF0000;
		font-size: 15px;
		width: 20px;
		text-align: center;
		padding-left: 0px;
		padding-right: 2px;
	}

	.item-title {
		color: #909399;
		font-size: 15px;
	}

	.mline-text {
		padding-left: 2px;
		width: 100%;
		/* background-color:#909399; */
		height: 100px;
		border: 1px solid #FF5A5F;
		border-radius: 5px;
	}
</style>

<style lang="scss" scoped>
	.u-cell-icon {
		width: 36rpx;
		height: 36rpx;
		margin-right: 8rpx;
	}

	.slot-box {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
		align-items: center;
	}

	.slot-image {
		/* #ifndef APP-NVUE */
		display: block;
		/* #endif */
		margin-right: 10px;
		width: 30px;
		height: 30px;
	}

	.slot-text {
		flex: 1;
		font-size: 14px;
		color: #4cd964;
		margin-right: 10px;
	}

	.img-container {
		margin-bottom: 20px;

		.note-image-box {
			margin-top: 5px;
			display: flex;
			flex-wrap: wrap;
			padding: 10px;

			.note-image-item {
				position: relative;
				width: 33.3%;
				height: 0;
				padding-top: 33.3%;
				box-sizing: border-box;
				// background-color: #18B566;


				.close-icon {
					display: flex;
					justify-content: center;
					align-items: center;
					position: absolute;
					right: 0px;
					top: 0px;
					width: 22px;
					height: 22px;
					border-radius: 50%;
					background-color: #d5d5d5;
					z-index: 2;
				}

				.image-box {
					display: flex;
					justify-content: center;

					align-items: center;
					position: absolute;
					top: 5px;
					right: 5px;
					border: 5px;
					left: 5px;
					border: 1px #eee solid;
					border-radius: 5px;
					overflow: hidden;
					width: 95%;
					height: 95%;

				}


			}
		}
	}
</style>
