<template>
	<view id="page">
		<view class="Width100 Box BorderBox">
			<view class="Content BorderBox Width100">
				<top-title :isCuMethod="true" @skipPage="skipPage" :is-show-left="true" :title="pageTitle"
					:rightWidth='120' class="custom_bg">
					<template slot="right" v-if="pageTitle == '审批' && isSP == 1">
						<view class="btn-right" @click="$refs.approvePopup.open()">
							审批
						</view>
					</template>
				</top-title>
			</view>
			<view class="query-form">
				<view class="tab">
					<view class="tab-item" :class="tab === 1 ? 'active' : ''" @click='handleTabClick(1)'>
						<text>基本信息</text>
					</view>
					<view class="tab-item" v-if="!!chartList.length" :class="tab === 2 ? 'active' : ''"
						@click='handleTabClick(2)'>
						<text>问答记录</text>
					</view>
					<view class="tab-item" :class="tab === 3 ? 'active' : ''" @click='handleTabClick(3)'>
						<text>流程记录</text>
					</view>
				</view>
			</view>
			<view v-if="tab === 1">
				<view class="formBox">
					<uni-forms :modelValue="formData" border>

						<view class="label-box">
							<view class="border"></view> 基本信息
						</view>
						<uni-forms-item label="隐患名称" class="border-top">
							<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
								<view class="Height100">{{ name }}</view>
								<view class="Height100"></view>
							</view>
						</uni-forms-item>
						<uni-forms-item label="所属辖区">
							<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">

								<view class="Height100">{{ formData.xqname }}</view>
								<view class="Height100"></view>
							</view>
						</uni-forms-item>
						<uni-forms-item label="所属街道" class="border-bottom">
							<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">

								<view class="Height100">{{ formData.jdname }}</view>
								<view class="Height100"></view>
							</view>
						</uni-forms-item>

						<view class="" v-for="formItem in formData.basicInfo" :key="formItem.sectionCode">
							<view class="label-box">
								{{getSectionName(formItem.sectionCode) || sectionName}}
							</view>
							<uni-forms-item label="道路类型" label-width="80">
								<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
									<view class="Height100">{{ initDic(formItem.roadType, columnsdlPicker) }}</view>
									<view class="Height100"></view>
								</view>
							</uni-forms-item>
							<uni-forms-item label="道路宽度" label-width="80">
								<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
									<view class="Height100">{{ formItem.roadWidth }}</view>
									<view class="Height100">米</view>
								</view>
							</uni-forms-item>
							<uni-forms-item label="车道数" label-width="80">
								<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
									<view class="Height100">{{ formItem.laneCount }}</view>
									<view class="Height100">车道</view>
								</view>
							</uni-forms-item>
							<uni-forms-item label="设计时速" label-width="80">
								<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
									<view class="Height100">{{ formItem.designSpeed }}</view>
									<view class="Height100">Km/h</view>
								</view>
							</uni-forms-item>
							<uni-forms-item label="限速" label-width="80">
								<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
									<view class="Height100">{{ formItem.limitSpeed }}</view>
									<view class="Height100">Km/h</view>
								</view>
							</uni-forms-item>
							<uni-forms-item label="路面结构">
								<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
									<view class="Height100">{{ initDic(formItem.roadStructure, columnsEnumPicker) }}
									</view>
									<view class="Height100"></view>
								</view>
							</uni-forms-item>
							<uni-forms-item label="路侧防护">
								<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
									<view class="Height100">{{ initDic(formItem.sideProtec, columnsEnum2Picker) }}
									</view>
									<view class="Height100"></view>
								</view>
							</uni-forms-item>
							<uni-forms-item label="中央隔离">
								<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
									<view class="Height100">{{ initDic(formItem.centerSeparate, columnsEnum3Picker) }}
									</view>
									<view class="Height100"></view>
								</view>
							</uni-forms-item>
						</view>

					</uni-forms>
				</view>
				<view class="formBox">
					<uni-forms border>
						<view class="label-box">
							<view class="border"></view> 重点排查
						</view>
						<view v-for="(itemData,indexData) in reversedTroubleshootingData" :key="indexData">
							<view style="margin-bottom:20rpx;font-size:28rpx">{{ indexData + 1 }}.
								{{ itemData.length > 0 ? itemData[0].nname : '' }}
							</view>
							<view v-for="(item,index) in itemData" :key="index" :label="item.itemname"
								v-show="item.extraConfigs">
								<view style="padding: 5px 0px;font-size:28rpx">隐患({{index+1}})：{{item.itemname}}</view>
								<view class="investigation-item" v-for="(it, idx) in item.extraConfigs" :key="idx"
									style="width: 96%; padding: 0">

									<view class="detail-item" v-if="it.type === 'number' || it.type === '1'">
										<uni-forms-item :label="it.name" label-width="450rpx"
											style="display: flex; align-items: center">
											<u-input :disabled="true" placeholder="- -" border="none"
												v-model="it.standar" inputAlign="right" type="number">
												<u-text :text="it.unit" slot="suffix" margin="0 3px 0 0"
													type="tips"></u-text>
											</u-input>
										</uni-forms-item>
									</view>
									<view class="detail-item" v-else-if="it.type === 'text' || it.type === '2'">
										<uni-forms-item :label="it.name" label-width="450rpx"
											style="display: flex; align-items: center">
											<u-input :disabled="true" placeholder="- -" border="none"
												v-model="it.standar" inputAlign="right" />
										</uni-forms-item>
									</view>
									<view class="detail-item" v-else-if="it.type === 'check' || it.type === '3'">
										<uni-forms-item :label="it.name" label-width="450rpx"
											style="display: flex; align-items: center">
											<u-checkbox :disabled="true" v-model="it.standar"
												:customStyle="{ justifyContent: 'space-between' }" :name="'sdfs'" />
										</uni-forms-item>
									</view>
									<view class="detail-item" v-else-if="it.type === 'upload' || it.type === '4'">
										<uni-forms-item :label="it.name" label-width="450rpx"
											style="display: flex; align-items: start;flex-direction:column;">
											<u-upload :disabled="true" :fileList="it.standar" name="1"
												:maxCount="10"></u-upload></uni-forms-item>

									</view>
								</view>
								<view v-if="item.checkedSelect" style="margin-bottom: 30rpx;">
									<view class="investigation-item" style="width: 96%; padding: 0">
										<view class="detail-item">
											<uni-forms-item label="隐患描述" label-position="top" label-width="200px" />
											<u-textarea placeholder="- -" :disabled="true" border="none"
												v-model="item.checkedSelect.hdDesc" style="margin-top: -20rpx;" />
										</view>
									</view>
									<view class="investigation-item" style="width: 96%; padding: 0">
										<view class="detail-item">
											<uni-forms-item label="隐患图片" label-position="top" label-width="200px" />
											<u-upload :fileList="item.checkedSelect.hdPic" :disabled="true"
												style="margin-top: -20rpx;" name="1" :maxCount="10"></u-upload>
										</view>
									</view>
									<view class="investigation-item" style="width: 96%; padding: 0">
										<view class="detail-item">
											<uni-forms-item label="补充信息" label-position="top" label-width="200px" />
											<u-textarea :disabled="true" placeholder="- -" border="none"
												v-model="item.checkedSelect.hdInfo" style="margin-top: -20rpx;" />
										</view>
									</view>
								</view>

							</view>
						</view>
					</uni-forms>
				</view>
				<view class="formBox">
					<uni-forms border>
						<view class="label-box">
							<view class="border"></view> 存在隐患
						</view>
						<view v-for="(itemData,indexData) in hiddenDangerList" :key="indexData">
							<view style="margin-bottom:20rpx;font-size:28rpx">{{ indexData + 1 }}.
								{{ itemData.dangerProblem}}
							</view>

							<view v-if="itemData" style="margin-bottom: 30rpx;">
								<view class="investigation-item" style="width: 96%; padding: 0">
									<view class="detail-item">
										<uni-forms-item label="隐患描述" label-position="top" label-width="200px" />
										<u-textarea placeholder="- -" :disabled="true" border="none"
											v-model="itemData.hdDesc" style="margin-top: -20rpx;" />
									</view>
								</view>
								<view class="investigation-item" style="width: 96%; padding: 0">
									<view class="detail-item">
										<uni-forms-item label="隐患图片" label-position="top" label-width="200px" />
										<u-upload :fileList="itemData.hdPic" :disabled="true"
											style="margin-top: -20rpx;" name="1" :maxCount="10"></u-upload>
									</view>
								</view>
								<view class="investigation-item" style="width: 96%; padding: 0">
									<view class="detail-item">
										<uni-forms-item label="补充信息" label-position="top" label-width="200px" />
										<u-textarea :disabled="true" placeholder="- -" border="none"
											v-model="itemData.hdInfo" style="margin-top: -20rpx;" />
									</view>
								</view>
								<!-- 治理审批详情多展示的开始 -->
								<template v-if="!!itemData.wcTime && pageTitle != '排查'">
									<view class="investigation-item investigation-item-zl"
										style="width: 100%; padding: 0">
										<view class="detail-item ">
											<uni-forms-item label="治理措施" label-position="top" label-width="100px"
												required />
											<u-textarea :disabled="true" placeholder="- -" border="none"
												v-model="itemData.zlMeasure" style="margin-top: -20rpx;" />
											<!-- <upload-file :disabled="true" :fileList="itemData.zlMeasure || []" /> -->
										</view>
									</view>
									<view class="investigation-item investigation-item-zl"
										style="width: 100%; padding: 0">
										<view class="detail-item detail-item-flex">
											<uni-forms-item label="治理单位" label-position="top" label-width="100px"
												required />
											<view class="value"
												:class="itemData.zlUnit ? 'value-date' : 'value-placeholder'">
												{{itemData.zlUnit || '- -'}}
											</view>
										</view>
									</view>
									<view class="investigation-item investigation-item-zl"
										style="width: 100%; padding: 0">
										<view class="detail-item">
											<uni-forms-item label="治理后照片" label-position="top" label-width="100px"
												required />
											<u-upload :fileList="getZlPic(itemData)" style="margin-top: -20rpx;"
												name="1" :disabled="true" :maxCount="9"></u-upload>
										</view>
									</view>
									<view class="investigation-item investigation-item-zl"
										style="width: 100%; padding: 0">
										<view class="detail-item detail-item-flex">
											<uni-forms-item label="完成时间" label-position="top" label-width="100px"
												required />
											<view class="value"
												:class="itemData.wcTime ? 'value-date' : 'value-placeholder'">
												{{itemData.wcTime || '- -'}}
											</view>
										</view>
									</view>

								</template>
								<!-- 治理详情多展示的结束 -->
							</view>
						</view>
						<view>
							<view style="margin-bottom: 30rpx;">
								<!-- 治理审批详情多展示的开始 -->
								<template v-if="!!acceptancePhotos.length && pageTitle != '排查'">
									<view class="investigation-item investigation-item-zl"
										style="width: 100%; padding: 0">
										<view class="detail-item detail-item-flex" style="align-items: baseline;">
											<uni-forms-item label="验收材料" label-position="top" label-width="100px"
												required />
											<upload-file :disabled="true" :fileList="acceptanceData || []" />
										</view>
									</view>
									<view class="investigation-item investigation-item-zl"
										style="width: 100%; padding: 0">
										<view class="detail-item">
											<uni-forms-item label="验收照片" label-position="top" label-width="100px"
												required />
											<u-upload :fileList="acceptancePhotos" style="margin-top: -20rpx;" name="1"
												:disabled="true" :maxCount="9"></u-upload>
										</view>
									</view>
								</template>
								<!-- 治理详情多展示的结束 -->
							</view>

						</view>
					</uni-forms>
				</view>
				<view style="width: 100%;height: 1rpx;"></view>
			</view>
			<!-- <u-empty v-if="tab==3" style="margin-top:100rpx"
			        mode="list"
			>
			</u-empty> -->
			<taskInfo v-if="tab==3" :taskInfoList="taskInfoList" />
			<chartList v-if="tab == 2" :chartList="chartList" />
			<approvePopup ref="approvePopup" @approive-submit="handleShenPi" />
		</view>
	</view>
</template>

<script>
	import NoData from "../../components/no-data.vue";
	import Tabbar from "../../components/tabbar.vue";
	import TopTitle from "../../components/top-title";
	import $ from "../../common/globalJs/globalJs";
	import taskInfo from "../../components/task-info.vue";
	import uploadFile from "../../components/upload-file.vue";
	import approvePopup from "../approve/approve-popup.vue";
	import chartList from "./chart-list.vue";
	export default {
		// 组件
		components: {
			TopTitle,
			NoData,
			taskInfo,
			uploadFile,
			approvePopup,
			chartList
		},
		data() {
			return {

				tab: 1,
				businessId: "",
				name: "",
				$: this.$,
				boxHeight: 773,
				formData: {},
				investigationSelectList: [],
				troubleshootingData: [],
				checked: [],
				investigationSelectList: [],
				investigationSelectList: [],
				hiddenDangerList: [],

				showEnumPicker: false,
				columnsEnumPicker: [
					[]
				],
				showEnum2Picker: false,
				columnsEnum2Picker: [
					[]
				],
				columnsdlPicker: [
					[]
				],
				showEnum3Picker: false,
				columnsEnum3Picker: [
					[]
				],
				sectionNameList: [],
				sectionName: '',
				sectionType: '',
				taskInfoList: [],
				pageTitle: '',
				approveStatus: '',
				isSP: 2,
				acceptanceData: [],
				acceptancePhotos: [],
				zlPic: [],
				chartList: []
			}
		},
		// 页面加载
		onLoad(e) {

			this.boxHeight = uni.getSystemInfoSync().windowHeight;
			this.getEnumValues1()
			this.getRoadTypes()
			this.getEnumValues2()
			this.getEnumValues3()
			console.log(e.pageName)
			this.pageTitle = e.pageName || '排查'
			this.approveStatus = e.approveStatus
			this.isSP = e.isSP || 2
			if (e.id) {
				this.businessId = e.id;
				this.name = e.taskName
				this.sectionName = e.sectionName
				this.type = e.type;
				this.sectionType = e.sectionType
				this.getBaseData(e.id);
				this.getSectionNameList(e.sectionCode, e.taskName)
				this.getTaskInfo()
				this.getFileData()
				this.getChartList()
				// this.getStreetCommunity()
			}
			if (this.pageTitle == '审批' && this.isSP == 1) {
				this.$nextTick(() => {
					this.$refs.approvePopup.open()
				})
			}


		},
		computed: {

			reversedTroubleshootingData() {
				const array = Array.from({
					length: this.investigationSelectList.length
				}, (_, i) => []);
				let nidname = this.investigationSelectList.length > 0 ? this.investigationSelectList[0].name : ''
				let nx = 0
				this.troubleshootingData.map(r => {
					this.investigationSelectList.map(m => {
						if (r.nid == m.nid) {
							r.nname = m.name
							if (r.nname == nidname) {
								array[nx].push(r)
							} else {
								nidname = r.nname
								nx++
								array[nx].push(r)
							}
						}
					})
				})
				console.log(array)
				return array
			}
		},
		onShow() {

		},

		// 方法
		methods: {
			async getChartList() {
				const [err, res] = await uni.request({
					// url: 'http://10.16.3.159:8777/api/local_doc_qa/local_doc_chat',
					url: $.chatUrl + "/getChatHistory",
					dataType: "json",
					method: "POST",
					// responseType: 'arraybuffer',
					headers: {
						// 'Accept': 'text/event-stream',
						"content-type": "application/json",
					},
					data: {
						userId: this.$.getData('token'),
						taskId: this.businessId
					},
				});
				if (res.data.code === 200) {
					this.chartList = res.data.result
				}
				console.log('getChatHistory', res)
			},
			handleShenPi(form) {
				this.$.showLoading()
				this.$request.globalRequest('/hiddenDanger/approve/SubmitHigDangerApproval', {
						businessId: this.businessId,
						nuserid: this.$.getData("token"),
						status: this.approveStatus,
						...form
					}, 'post')
					.then(res => {
						if (res.code === 200) {
							this.$.toast('审批完成')
							setTimeout(() => {
								this.$.back(1)
							}, 500)
						}
					}).finally(() => {
						this.$.hideLoading()
					})
			},
			getTaskInfo() {
				this.$request.globalRequest('/hiddenDanger/highDanger/getProcessRecord', {
						businessId: this.businessId
					})
					.then(res => {
						if (res.code === 200) {
							this.taskInfoList = res.result
						}
					})
			},
			getFileData() {
				this.$request.globalRequest('/hiddenDanger/government/getAttachsByGov', {
						businessId: this.businessId
					})
					.then(res => {
						if (res.code === 200) {
							console.log('file', res)
							const acceptanceData = res.result.acceptanceData
							this.acceptanceData = acceptanceData ? [{
								filePath: acceptanceData.attach_url,
								fileName: acceptanceData.attach_name,
							}] : []
							this.acceptancePhotos = (res.result.acceptancePhotos || []).map(item => ({
								url: item.attach_url
							}))
							this.zlPic = res.result.zlPic
						}
					})
			},
			getZlPic(data) {
				const findData = this.zlPic.find(item => data.hdTerm === item.hdTerm)
				if (findData) {
					return findData.attach_url.split(',')
				}
				return []
			},
			getSectionName(sectionCode) {
				return this.sectionNameList.find(item => item.sectionCode == sectionCode)?.sectionName
			},
			getSectionNameList(crossingCode, sectionName) {
				console.log(crossingCode, sectionName)
				if (this.sectionType == 1) {
					this.$request
						.globalRequest(
							"/hiddenDanger/highDanger/getSectionByCrossing", {
								crossingCode
							},
							"GET"
						).then((res) => {
							if (res.code === 200) {
								this.sectionNameList = res.result
							}
						})
				} else {
					this.sectionNameList = [{
						sectionCode: crossingCode,
						sectionName
					}]
					console.log(this.sectionNameList)
				}
			},
			getEnumValues1() {
				this.$request
					.globalRequest(
						"/hiddenDanger/highDanger/getEnumValues", {
							enumType: '3119'
						},
						"GET"
					)
					.then((res) => {
						if (res.code === 200) {
							console.log(res.result)
							// console.log(res)
							let arr = res.result
							for (let item of arr) {
								item.label = item.enumName
							}
							this.columnsEnumPicker = [arr]
						}
					});
			},
			// 数据回显
			initDic(val, arr, label = 'label', value = 'enumvalue') {
				// console.log(val==0)
				let str = '- -'
				for (let item of arr[0]) {
					if (item[value] == val) {
						str = item[label]
					}
				}
				return str
			},
			getRoadTypes() {
				this.$request
					.globalRequest(
						"/hiddenDanger/highDanger/getRoadTypes", {
							enumType: '303'
						},
						"GET"
					)
					.then((res) => {
						if (res.code === 200) {
							console.log(res.result)
							// console.log(res)
							let arr = res.result
							for (let item of arr) {
								item.label = item.enumName
							}
							this.columnsdlPicker = [arr]
						}
					});
			},
			getEnumValues2() {
				this.$request
					.globalRequest(
						"/hiddenDanger/highDanger/getEnumValues", {
							enumType: '3127'
						},
						"GET"
					)
					.then((res) => {
						if (res.code === 200) {
							console.log(res.result)
							// console.log(res)
							let arr = res.result
							for (let item of arr) {
								item.label = item.enumName
							}
							this.columnsEnum2Picker = [arr]
						}
					});
			},
			getEnumValues3() {
				this.$request
					.globalRequest(
						"/hiddenDanger/highDanger/getEnumValues", {
							enumType: '3121'
						},
						"GET"
					)
					.then((res) => {
						if (res.code === 200) {
							console.log(res.result)
							// console.log(res)
							let arr = res.result
							for (let item of arr) {
								item.label = item.enumName
							}
							this.columnsEnum3Picker = [arr]
						}
					});
			},
			handleTabClick(tab) {
				this.tab = tab;

				// this.getList()
			},
			skipPage() {
				if (this.pageTitle !== '排查') {
					this.$.back(1)
				} else {
					this.$.setData('pageStatus', 3)
					this.$.setData('pageType', '3')
					this.$.openTab('/pages/investigation/index')
				}

			},
			initTroubleshootingData(id, index) {
				this.troubleshootingData[index].extraConfigs = []
				this.$request
					.globalRequest(
						"/hiddenDanger/highDanger/getImportDangerDisplayDetail", {
							dangerId: id,
							businessId: this.businessId,
						},
						"GET"
					)
					.then((res) => {
						if (res.code == 200) {
							// res.result=[{type:4,standar:'https://img-cdn-tx.dcloud.net.cn/stream/plugin_screens/map-plugin_0.jpg?&v=1630404859'}]
							for (let item of res.result) {
								if (item.type == 4) {
									let arr = item.standar.split(',')
									let hdPic = []
									for (let it of arr) {
										if (it) {
											hdPic.push({
												url: it
											})
										}
									}
									item.standar = hdPic
								}
							}
							this.troubleshootingData[index].extraConfigs.push(...res.result)
							console.log(this.troubleshootingData[index].extraConfigs, 11111)
						}

						console.log('this.checked', this.checked, index)
						if (this.checked.length - 1 == index) {
							// alert(1111)
							// this.initCheckedSelect(index)
						}

					});
				// this.$request.globalRequest('/hiddenDanger/highDanger/getImportDangers', {}, 'GET').then(res => {
				// 	if (res.code == 200) {
				// 		this.investigationList = res.result
				// 	}
				// })
			},
			initCheckedSelect() {
				this.$request
					.globalRequest(
						"/hiddenDanger/highDanger/getUserHiddenDangerList", {
							nuserid: this.$.getData("token"),
							pcType: 1,
							businessId: this.businessId
						},
						"GET"
					)
					.then((res) => {
						if (res.code === 200) {
							this.hiddenDangerList.push(...res.result)
							console.log('hdpic', this.troubleshootingData, res.result)
							for (let i in this.troubleshootingData) {
								for (let j in res.result) {
									if (this.troubleshootingData[i].id == res.result[j].hdTerm) {
										let arr = res.result[j].hdPic.split(',')
										let hdPic = []
										for (let item of arr) {
											if (item) {
												hdPic.push({
													url: item
												})
											}
										}
										this.$set(this.troubleshootingData[i], "checkedSelect", {
											hdInfo: res.result[j].hdInfo,
											hdPic: hdPic,
											hdDesc: res.result[j].hdDesc,
											hdTerm: res.result[j].hdTerm,
											pcType: 1
										})
									}
								}
							}
							console.log(this.hiddenDangerList, 11111)
						}
					});
			},
			getBaseData(businessId) {
				this.$request
					.globalRequest(
						"/hiddenDanger/highDanger/getSectionInfo", {
							nuserid: this.$.getData("token"),
							businessId
						},
						"GET"
					)
					.then((res) => {
						if (res.code === 200) {
							for (let k in res.result) {
								if (res.result[k] == 0) {
									res.result[k] = ""
								}
							}
							this.formData = {
								...this.formData,
								jdname: res.result[0].jdname,
								jdcode: res.result[0].jdcode,
								xqcode: res.result[0].xqcode,
								xqname: res.result[0].xqname,
								basicInfo: res.result
							};

						}
					});
				// return false
				this.$request
					.globalRequest(
						"/hiddenDanger/highDanger/getSectionTraffic", {
							nuserid: this.$.getData("token"),
							businessId
						},
						"GET"
					)
					.then((res) => {
						if (res.code === 200) {
							// todo 无数据结构
							this.formData = {
								...this.formData,
								...res.result
							};
						}
					});
				this.$request
					.globalRequest(
						"/hiddenDanger/highDanger/getImportDangerDisplay", {
							sid: "02",
							businessId
						},
						"GET"
					)
					.then((res) => {
						if (res.code === 200) {
							// todo 无数据结构
							for (let items of res.result) {
								for (let item of items.dangerItems) {
									item.nid = items.nid
								}
							}
							// console.log(res.result,11111)
							this.investigationSelectList = res.result;
							this.investigationSelectList.map((r) => {
								this.troubleshootingData = [...this.troubleshootingData, ...r.dangerItems]
							});
							// console.log(this.troubleshootingData, 11111)
							this.checked = this.troubleshootingData.map(r => {
								if (r.checked == 1) {
									return r.id
								}
							})
							this.checked = this.checked.filter(item => item !== undefined);
							console.log('troubleshootingData', this.troubleshootingData)
							for (let i in this.troubleshootingData) {
								if (this.troubleshootingData[i].checked == 1) {
									// alert(111)

									this.initTroubleshootingData(this.troubleshootingData[i].id, i)
								}

							}
							// console.log(this.troubleshootingData)
							// this.$request
							// 	.globalRequest(
							// 		"/hiddenDanger/highDanger/getImportDangerDisplayDetail", {
							// 		nuserid: this.$.getData("token"),
							// 		businessId,
							// 		dangerId: '26'
							// 	},
							// 		"GET"
							// 	)
							// 	.then((res) => {
							// 		if (res.code === 200) {
							// 			this.investigationSelectList.map((r) => {
							// 				r.extraConfigs = [];
							// 				res.result.map((m) => {
							// 					if (r.nid == m.scenesId) {
							// 						r.extraConfigs.push(m);
							// 					}
							// 				});
							// 			});
							// 		}
							// 	});
						}
					});
				// this.$request
				// 	.globalRequest(
				// 		"/hiddenDanger/highDanger/getImportDangers", {
				// 			nuserid: this.$.getData("token"),
				// 			businessId
				// 		},
				// 		"GET"
				// 	)
				// 	.then((res) => {
				// 		if (res.code === 200) {
				// 			this.investigationList = res.result;
				// 		}
				// 	});
				Promise.all([
					this.$request
					.globalRequest(
						"/hiddenDanger/highDanger/getUserHiddenDangerList", {
							pcType: 1,
							businessId: businessId
						},
						"GET"
					),
					this.$request
					.globalRequest(
						"/hiddenDanger/highDanger/getUserHiddenDangerList", {
							pcType: 2,
							businessId: businessId
						},
						"GET"
					)
				]).then((resArr) => {
					console.log('resARR', resArr)
					this.hiddenDangerList = resArr.reduce((arr, item) => {
						if (item.code === 200) {
							const itemResArr = item.result.map(item => ({
								...item,
								hdPic: item.hdPic ? item.hdPic.split(',').map((item, index) =>
									({
										url: item
									})) : [],
								zlPic: item.zlPic ? item.zlPic.split(',').map((item, index) =>
									({
										status: "success",
										id: index,
										url: item
									})) : []
							}))
							arr.push(...itemResArr)
						}
						return arr
					}, [])
				})
				// this.$request
				// 	.globalRequest(
				// 		"/hiddenDanger/highDanger/getUserHiddenDangerList", {
				// 			// nuserid: this.$.getData("token"),
				// 			pcType: 2,
				// 			businessId
				// 		},
				// 		"GET"
				// 	)
				// 	.then((res) => {
				// 		if (res.code === 200) {
				// 			this.hiddenDangerList = res.result.map(item => ({
				// 				...item,
				// 				hdPic: item.hdPic ? item.hdPic.split(',').map((item, index) =>
				// 					({
				// 						url: item
				// 					})) : [],
				// 				zlMeasure: item.zlMeasure ? item.zlMeasure.split(',').map((item, index) =>
				// 					({
				// 						fileName: item,
				// 						id: index
				// 					})) : [],
				// 				zlPic: item.zlPic ? item.zlPic.split(',').map((item, index) => ({
				// 					status: "success",
				// 					id: index,
				// 					url: item
				// 				})) : []
				// 			}))
				// 		}
				// 	});

				this.$request
					.globalRequest(
						"/hiddenDanger/highDanger/getDangerItems", {
							nuserid: this.$.getData("token"),
							businessId
						},
						"GET"
					)
					.then((res) => {
						if (res.code === 200) {
							this.problemTreeSelectConfirmList = res.result;
						}
					});
			},


		},
		onReady() {},
		// 页面卸载
		onUnload() {

		},


	}
</script>

<style>
</style>
<style lang="scss" scoped>
	page {
		background: #F6F8FA;
	}


	.query-form {

		font-size: 16px;
		height: 44px;
		background: #ffffff;
		box-shadow: 3px 0px 10px #ccc;
		color: #666666;
		position: sticky;
		// top: var(--status-bar-height + 88rpx);
		top: calc(var(--status-bar-height) + 88rpx);
		z-index: 10;

		.tab {
			display: flex;
			align-items: center;
			justify-content: space-around;

			.tab-item {
				position: relative;
				height: 41px;
				line-height: 41px;
				padding: 0 30rpx 0 30rpx;
				border-bottom: 3px solid #fff;
				display: flex;
				align-items: center;

				&.active {
					color: rgb(60, 109, 195);
					border-color: rgb(60, 109, 195);
				}

				.number {
					font-weight: bold;
					font-size: 18px;
					margin-left: 10rpx;
				}
			}
		}

		.search-box {
			padding: 10px 10px 3px;
		}
	}

	.formBox {
		margin: 30rpx 20rpx;
		border: 1px solid #e6e6e6;
		background: #ffffff;
		padding: 0 20rpx 20rpx;
		box-sizing: border-box;

		/deep/ .uni-forms-item--border .uni-forms-item__content {
			justify-content: flex-end;
			text-align: right;
		}

		.photo {
			width: 100%;

			image {
				width: 100%;
			}
		}
	}

	.Box {
		padding-top: var(--status-bar-height);

		.Content {
			width: calc(100% - 48rpx);
			padding-bottom: 88rpx;
		}

		.Unit {
			padding: 12rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			position: relative;
			box-shadow: 1px 1px 3px #ccc;

			.trapezoidal {
				position: absolute;
				top: -0px;
				right: 0px;
				color: #ffffff;
				font-size: 22rpx;
				font-weight: normal;
				z-index: 1;
			}

			image {
				width: 200rpx;
			}

			.right {
				flex: 1;
				padding-left: 30rpx;

				.title {
					font-size: 16px;
					width: 380rpx;
					min-height: 80rpx;
					overflow: hidden;
					text-overflow: ellipsis;
					display: -webkit-box;
					-webkit-line-clamp: 2;
					-webkit-box-orient: vertical;
				}

				.type {
					font-size: 14px;
					color: #666;
					font-weight: normal;

					text {
						margin-right: 20rpx;
					}
				}
			}
		}
	}

	.label-box {
		display: flex;
		align-items: center;
		height: 110rpx;
		font-size: 30rpx;
		font-weight: 600;

		.border {
			background-color: #2663BF;
			height: 35rpx;
			width: 6rpx;
			margin-right: 14rpx;
		}
	}

	.label-box2 {
		height: 100rpx;


	}

	.label-box-small {
		font-size: 28rpx;
		margin-top: -25rpx;
		font-weight: 500;
	}

	.border-bottom {
		border-bottom: 1px #eee solid;
	}

	.border-top {
		border-top: 1px #eee solid;
	}

	/deep/ .uni-forms-item__label {
		font-size: 28rpx;
		height: auto;
		margin-bottom: 20rpx;
	}

	/deep/ .u-input {
		background-color: #ffffff !important;
	}

	.detail-item-flex {
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.investigation-item-zl {
		.uni-forms-item--border {
			border: none;
		}

		border-top: 1px solid #eee;
	}

	.btn-right {
		width: 100%;
		text-align: right;
	}
</style>