<template>
	<view id="page" :style="{ height: boxHeight + 'px' }">
		<view class="Width100 Box BorderBox">
			<view class="Content BorderBox Width100">
				<top-title :is-show-left="true" :title="'排查'" :rightWidth="40" class="custom_bg">
					<!-- <template slot="right">
						<image :src="$.imgSrc + '/mine/search.png'" @click="$.open('/pages/mine/setting')"
							mode="aspectFit" class="InlineBlock imgIcon" style="width: 32rpx"></image>
					</template> -->
				</top-title>
			</view>
			<view class="stepBox">
				<view class="step-item-box step PositionR" v-for="(item, index) in tablist" :key="index">
					<view class="step-item" v-if="item.type === 'item'">
						<view class="stepItem">
							<view :class="{
                  stepCircleActive: item.i === active,
                  stepCircle: true,
                }">
								{{ item.i == 3 ? item.i - 1 : item.i }}
							</view>
							<view class="stepText PositionA"
								:style="{ color: item.i === active ? '#000000' : '#bcc3cd' }">
								{{ item.title }}
							</view>
						</view>
					</view>
					<view v-else class="circles">
						<view :class="{ circleActive: index < active, circle: index >= active }" v-for="i in 16"
							:key="i" />
					</view>
				</view>
			</view>
			<view class="formBox" v-if="active === 1">
				<uni-forms :modelValue="formData" border :rules="rules">

					<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; ">

							<!-- <input v-if="isEdit" type="text" class="BorderNone Height100 formInput"
								v-model="formData.roadType" placeholder="请输入所属辖区" @focus="focus" /> -->
							<view class="Height100" :class="formData.xqname?'':'gary'" v-if="isEdit"
								@click="showxqPicker=true">{{ formData.xqname?formData.xqname:'请选择所属辖区' }} </view>
							<view class="Height100" v-else>{{ 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" :class="formData.jdname?'':'gary'" v-if="isEdit"
								@click="showjdPicker=true">{{ formData.jdname?formData.jdname:'请选择所属街道' }} </view>
							<view class="Height100" v-else>{{ formData.jdname }}</view>
							<view class="Height100"></view>
						</view>
					</uni-forms-item>
					<view class="label-box">
						<view class="border"></view> {{sectionName}}
					</view>

					<uni-forms-item label="道路类型" name="roadType" required label-width="80">
						<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
							<!-- <input v-if="isEdit" type="text" class="BorderNone Height100 formInput"
								v-model="formData.roadType" placeholder="请输入道路类型" @focus="focus" /> -->
							<view class="Height100" :class="formData.roadTypeName?'':'gary'" v-if="isEdit"
								@click="showdlPicker=true">{{ formData.roadTypeName?formData.roadTypeName:'请选择道路类型' }} </view>
							<view class="Height100" v-else>{{ formData.roadTypeName }}</view>
							<view class="Height100"></view>
						</view>
					</uni-forms-item>
					<uni-forms-item label="道路宽度" name="roadWidth" required label-width="80">
						<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
							<input v-if="isEdit" type="number" class="BorderNone Height100 formInput"
								v-model="formData.roadWidth" placeholder="请输入道路宽度" @focus="focus" @blur="blur" />
							<view class="Height100" v-else>{{ formData.roadWidth }}</view>
							<view class="Height100">米</view>
						</view>
					</uni-forms-item>
					<uni-forms-item label="车道数" name="laneCount" required label-width="80">
						<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
							<input v-if="isEdit" type="number" class="BorderNone Height100 formInput"
								v-model="formData.laneCount" placeholder="请输入车道数" @focus="focus" @blur="blur" />
							<view class="Height100" v-else>{{ formData.laneCount }}</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; ">
							<input v-if="isEdit" type="text" class="BorderNone Height100 formInput"
								v-model="formData.roadStructure" placeholder="请输入路面结构" @focus="focus" @blur="blur" />
							<view class="Height100" v-else>{{ formData.roadStructure }}</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; ">
							<input v-if="isEdit" type="text" class="BorderNone Height100 formInput"
								v-model="formData.sideProtec" placeholder="请输入路侧防护" @focus="focus" @blur="blur" />
							<view class="Height100" v-else>{{ formData.sideProtec }}</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; ">
							<input v-if="isEdit" type="text" class="BorderNone Height100 formInput"
								v-model="formData.centerSeparate" placeholder="请输入中央隔离" @focus="focus" @blur="blur" />
							<view class="Height100" v-else>{{ formData.centerSeparate }}</view>
							<view class="Height100"></view>
						</view>
					</uni-forms-item>
					<uni-forms-item label="设计时速" name="designSpeed" required label-width="80">
						<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
							<input v-if="isEdit" type="number" class="BorderNone Height100 formInput"
								v-model="formData.designSpeed" placeholder="请输入设计时速" @focus="focus" @blur="blur" />
							<view class="Height100" v-else>{{ formData.designSpeed }}</view>
							<view class="Height100">Km/h</view>
						</view>
					</uni-forms-item>
					<uni-forms-item label="限速" name="limitSpeed" required label-width="80">
						<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
							<input v-if="isEdit" type="number" class="BorderNone Height100 formInput"
								v-model="formData.limitSpeed" placeholder="请输入限速" @focus="focus" @blur="blur" />
							<view class="Height100" v-else>{{ formData.limitSpeed }}</view>
							<view class="Height100">Km/h</view>
						</view>
					</uni-forms-item>
				</uni-forms>
				<!-- 	<view class="photo">
					<image src="/static/base.jpg" mode="widthFix"></image>
				</view> -->
			</view>
			<u-picker :show="showdlPicker" :columns="columnsdlPicker" keyName="label" @cancel="pickerdlCancel"
				@confirm="pickerdlConfirm"></u-picker>
			<u-picker :show="showxqPicker" :columns="columnsxqPicker" keyName="label" @cancel="pickerxqCancel"
				@confirm="pickerxqConfirm"></u-picker>
			<u-picker :show="showjdPicker" :columns="columnsjdPicker" keyName="label" @cancel="pickerjdCancel"
				@confirm="pickerjdConfirm"></u-picker>
			<u-picker :show="showtimePicker" :columns="columnstimePicker" keyName="label" @cancel="pickertimeCancel"
				@confirm="pickertimeConfirm"></u-picker>
			<!-- 	<view class="echarts" v-if="active === 2">
				<qiun-data-charts type="area" :opts="opts" :chartData="chartData" />
			</view> -->
			<view class="formBox form-step-2" v-if="active === 2">
				<view class="label-box label-box2">
					<view class="border"></view> 交通流量（7天）
				</view>
				<qiun-data-charts type="area" :opts="opts" :chartData="chartData" :ontouch="true" />
				<uni-forms :modelValue="formData" border label-width="120">
					<uni-forms-item label="最大流量">
						<view class="Height100 Flex Flex_end Flex_C_S-Center" style="line-height: 37px; ">
							<input v-if="isEditStep2" type="number" class="BorderNone Height100 formInput"
								v-model="formData.maxTraffic" placeholder="请输入最大流量" @focus="focus2" @blur="blur2" />
							<view class="Height100" v-else>{{ formData.maxTraffic }}</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; ">
							<input v-if="isEditStep2" type="number" class="BorderNone Height100 formInput"
								v-model="formData.peakTraffic" placeholder="请输入高峰流量" @focus="focus2" @blur="blur2" />
							<view class="Height100" v-else>{{ formData.peakTraffic }}</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 v-if="isEditStep2" class="Height100" :class="formData.peakHours?'':'gary'"
								@click="showtimePicker=true">
								{{ formData.peakHours?formData.peakHours:'请选择高峰时段' }}
							</view>
							<!-- <input v-if="isEditStep2" type="number" class="BorderNone Height100 formInput"
								v-model="formData.peakHours" placeholder="请输入高峰时段" @focus="focus2" /> -->
							<view class="Height100" v-else>{{ formData.peakHours }}</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; ">
							<input v-if="isEditStep2" type="number" class="BorderNone Height100 formInput"
								v-model="formData.normalTraffic" placeholder="请输入高峰时段" @focus="focus2" @blur="blur2" />
							<view class="Height100" v-else>{{ formData.normalTraffic }}</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; ">
							<input v-if="isEditStep2" type="number" class="BorderNone Height100 formInput"
								v-model="formData.largeVehicleRate" placeholder="请输入大车占比" @focus="focus2" @blur="blur2" />
							<view class="Height100" v-else>{{ formData.largeVehicleRate }}</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; ">
							<input v-if="isEditStep2" type="number" class="BorderNone Height100 formInput"
								v-model="formData.nonvehicleTraffic" placeholder="请输入非机动车流量" @focus="focus2" @blur="blur2" />
							<view class="Height100" v-else>{{ formData.nonvehicleTraffic }}</view>
							<view class="Height100">辆</view>
						</view>
					</uni-forms-item>

				</uni-forms>
			</view>
			<view class="formBox form-step-2" v-if="active === 2">
				<view class="label-box label-box2">
					<view class="border"></view> 违法情况（7天）
				</view>
				<view class="label-box label-box2 label-box-small">
					违法数量
				</view>
				<qiun-data-charts type="area" :opts="opts2" :chartData="chartData2" v-if="chartData2.series.length>0"
					:ontouch="true" />
				<view v-else class="nodata">暂无数据</view>
				<view class="label-box label-box2 label-box-small">
					违法占比
				</view>
				<qiun-data-charts type="rose" :opts="opts3" :chartData="chartData3" v-if="chartData3.series.length>0" />
				<view v-else class="nodata">暂无数据</view>
			</view>
			<view class="formBox form-step-2" v-if="active === 2">
				<view class="label-box label-box2">
					<view class="border"></view> 事故情况（3年）
				</view>
				<view class="label-box label-box2 label-box-small">
					事故数量
				</view>
				<qiun-data-charts type="area" :opts="opts2" :chartData="chartData4" v-if="chartData4.series.length>0"
					:ontouch="true" />
				<view v-else class="nodata">暂无数据</view>
				<!-- <view class="label-box label-box2 label-box-small">
					事故分布
				</view>
				<map id="maps" style="width: 100%; height: 400rpx" :latitude="latitude" :longitude="longitude"
					:markers="covers">
				</map> -->

			</view>
			<view class="formBox form-step-3" v-if="active === 3">
				<view class="point">
					<view class="title">重点排查</view>
					<view class='row' style="display: flex; flex-wrap: wrap; justify-content: space-between;">
						<view style="width: 300rpx;" v-for="item in investigationSelectList" :key="item"
							@longpress="onLongPressZD(item)">

							<view class="item">{{ item.name }}
								<image style="width: 30px;height: 30px;margin-left: 10px;"
									src="../../static/task/3879.png" v-show="nidZD == item.nid" @click.stop="delZD">
								</image>
							</view>
						</view>
						<view style="width: 300rpx;" v-show="type!='view'">
							<view class="item add" @click="showInvestigation = true">
								<uni-icons type="plusempty" size="24" style="margin-right: 10rpx; color: #2663bf" />
								新增排查
							</view>
						</view>
					</view>
				</view>
				<u-checkbox-group v-model="checked" iconPlacement="right" placement="column">

					<view v-for="(itemData,indexData) in reversedTroubleshootingData" :key="indexData">
						{{ indexData + 1 }}.
						{{ itemData.length > 0 ? itemData[0].nname : '' }}
						<u-checkbox :isSel="false" v-for="(item,index) in itemData" :key="index" :label="item.itemname"
							activeColor="#2663BF" :name="item.id" @click="showInvestigationTag2(item)"
							style="padding: 8px 12px;"></u-checkbox>
					</view>

				</u-checkbox-group>
				<u-popup :show="showInvestigation" @close="showInvestigation = false">
					<InvestigationItem :type="type" @select="select2"></InvestigationItem>
				</u-popup>
				<u-popup :show="showInvestigation2" @close="showInvestigation2 = false">
					<InvestigationItem2 :type="type" :json="showInvestigation2Item" :businessId="this.businessId"
						@show="showInvestigation2 = false" @select="select3"></InvestigationItem2>
				</u-popup>
				<!-- <u-popup :show="showInvestigation" @close="showInvestigation = false">
          <view class="custom-pop-head">
            <view class="left" @click="showInvestigation = false">取消</view>
            <view class="title">重点排查</view>
            <view class="right" @click="investigationHandle1">确认</view>
          </view>
          <view  class="investigation-item"
                 :class="investigationSelect === index ? 'active' : ''"
                 v-for="(item, index) in investigationList"
                 :key="item.name"
                 @click="investigationSelect = index"
          >
            <text>{{ item.name }}</text>
            <uni-icons type="checkmarkempty" size="24" :style="{color: '#2663BF', visibility: investigationSelect === index ? 'visible' : 'hidden'}"/>
          </view>
          <view class="blank" />
        </u-popup> -->
				<u-popup :show="showInvestigationDetail" @close="showInvestigationDetail = false">
					<view class="custom-pop-head">
						<view class="left" @click="showInvestigationDetail = false">取消</view>
						<view class="title">{{ investigationDetailTitle }}</view>
						<view class="right" @click="investigationDetailHandle">确认</view>
					</view>
					<view class="investigation-item" v-for="(item, index) in investigationDetailList" :key="index"
						style="width: 96%; padding: 0">
						<view class="detail-item" v-if="item.type === 'number'">
							<uni-forms-item label="平峰流量" label-width="100px" style="display: flex; align-items: center">
								<u-input placeholder="请输入" border="none" v-model="formData.roadMet" inputAlign="right"
									type="number">
									<u-text text="km/h" slot="suffix" margin="0 3px 0 0" type="tips"></u-text>
								</u-input>
							</uni-forms-item>
						</view>
						<view class="detail-item" v-else-if="item.type === 'text'">
							<uni-forms-item label="平峰流量" label-width="100px" style="display: flex; align-items: center">
								<u-input placeholder="请输入" border="none" v-model="formData.roadMet"
									inputAlign="right" />
							</uni-forms-item>
						</view>
						<view class="detail-item" v-else-if="item.type === 'check'">
							<uni-forms-item label="平峰流量" label-width="100px" style="display: flex; align-items: center">
								<u-checkbox v-model="formData.roadMet" 
									:customStyle="{ justifyContent: 'space-between' }" :name="'sdfs'" />
							</uni-forms-item>
						</view>
						<view class="detail-item" v-else-if="item.type === 'upload'">
							<uni-forms-item label="平峰流量" label-position="top" label-width="100px"
								style="display: flex; align-items: center" />
							<u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1"
								:maxCount="10"></u-upload>
						</view>
					</view>
					<view class="blank" />
				</u-popup>
			</view>
			<view class="formBox form-step-3" v-if="active === 3">
				<view class="point">
					<view class="title">存在隐患</view>

					<u-row :gutter="0" justify="flex-start" style="flex-wrap: wrap">
						<scroll-view style="max-height: 400px;" :scroll-top="0" scroll-y="true" show-scrollbar="true">
							<!-- <view>
								{{ hiddenDangerList }}
							</view> -->
							<view v-for="(item,index) in hiddenDangerList" :key="item" v-show="item.pcType!=1"
								style="width: 100%" @longpress="onLongPressYH(item)">
								<view class="problem-item">
									<view style="display: flex; justify-content: space-between">
										<view style="width: 80%;line-height: 30px;">
											{{ item.dangerProblem }}
										</view>
										<image style="width: 30px;height: 30px;" src="../../static/task/3879.png"
											v-show="nidYH == item.nid" @click.stop="delYH"></image>
										<view v-show="!(nidYH == item.nid)">
											<view class="check" @click="onHiddenDangerList(item,index)">
												<image style="width: 10px; height: 16px"
													src="../../static/scimg/right6.png"></image>
												<!-- <uni-icons
                        type="right"
                        size="24"
                        style="color: #2663bf"
                      /> -->
											</view>
										</view>
									</view>
									<!-- <view class="text">{{ item.hdTerm }}</view> -->
									<!-- <view class="text">{{ item.hdDesc }}</view> -->
								</view>
							</view>

						</scroll-view>
						<u-col :span="12" v-show="type!='view'">
							<view class="problem-item add" @click="add">
								<uni-icons type="plusempty" size="24" style="margin-right: 10rpx; color: #2663bf" />
								新增隐患
							</view>
						</u-col>
					</u-row>
				</view>
				<u-popup :show="showProblem" @close="showProblem = false">
					<view class="custom-pop-head">
						<view class="left" @click="
							showProblem = false;
							hiddenDangerList2 = [];
							describe.hdDesc = '';
							describe.hdInfo = '';
						  ">取消
						</view>
						<view class="title">存在隐患</view>
						<view class="right" @click="investigationHandle2">确认</view>
					</view>
					<view class="problem-box">
						<view class="detail-item" @click="addFL">
							<uni-forms-item label="隐患问题" label-position="top" label-width="100px"
								style="display: flex; align-items: center" />
							<view v-if="hiddenDangerList2.length > 0">{{ hiddenDangerList2[0].itemname }}/{{
								hiddenDangerList2[1].itemname
								}}/{{ hiddenDangerList2[2].itemname }}</view>

							<!-- <u-input
                  placeholder="请选择"
                  border="none"
                  type="textarea"
                  v-else
                  /> -->
							<view v-else-if="dangerProblem">{{
								dangerProblem
								}}</view>
							<view v-else>请选择</view>
							<!--  -->
						</view>
						<view class="detail-item">
							<uni-forms-item label="隐患描述" label-position="top" label-width="200px" />
							<u-textarea :disabled="type=='view'" placeholder="请输入" border="none"
								v-model="describe.hdDesc" />
						</view>
						<view class="detail-item">
							<uni-forms-item label="隐患图片" label-position="top" label-width="200px" />

							<u-upload :disabled="type=='view'" :fileList="fileList"
								@afterRead="(e) => afterRead(e, 'fileList')" @delete="(e) => deletePic(e, 'fileList')"
								name="1" :maxCount="9"></u-upload>
						</view>
						<view class="detail-item">
							<uni-forms-item label="补充信息" label-position="top" label-width="200px" />
							<u-textarea :disabled="type=='view'" placeholder="请输入" border="none"
								v-model="describe.hdInfo" />
						</view>
					</view>
					<view class="blank" />
				</u-popup>

				<u-popup :show="showProblemTreeSelect" @close="showProblemTreeSelect = false" height="70vh">
					<view class="custom-pop-head">
						<view class="left" @click="
                showProblemTreeSelect = false;
                showProblem = true;
              ">取消</view>
						<view class="title">选择隐患</view>
						<view class="right" @click="showProblemTreeSelectHandle">确认</view>
					</view>
					<ProblemTreeItem :hiddenDangerList2="hiddenDangerList2" @select="select"></ProblemTreeItem>
				</u-popup>
			</view>
			<view class="blank" />
		</view>
		<bottom-button-two :type="type" v-if="active === 1" @cancel="isEdit = !isEdit" :cancelText="isEdit?'取消':'更改'"
			@confirm="bottomButtonTwo" />
		<!-- 
		<bottom-button-two :type="type" v-else-if="active === 2" :secondText="isEditStep2?'取消':'更改'"
			@second="isEditStep2 = !isEditStep2" @first="active = 1" @last="active = 3" />
		 -->
		 
		<bottom-button :type="type" v-else-if="active === 2" :secondText="isEditStep2?'取消':'更改'"
			@second="isEditStep2 = !isEditStep2" @first="active = 1" @last="active = 3" />
		<!-- 下面原本active = 2 -->
		<bottom-button isSubmit :type="type" v-else-if="active === 3" :secondText="'暂存'" @first="active = 1"
			@second="submit(false)" @last="submit(true)" />
		<u-modal :show="modalShow" content="您未录入任何隐患问题，该点段将以“无隐患”结论提交结果，请确认是否提交？" confirm-text="确定" cancel-text="取消"
			:showConfirmButton="true" :showCancelButton="true" @confirm="postSaveManualInvestigation"
			@cancel="modalShow = false" :closeOnClickOverlay="false"></u-modal>

	</view>
</template>

<script>
	import BottomButton from "../../components/bottom-button/three.vue";
	import BottomButton2 from "../../components/bottom-button/three2.vue";
	import BottomButtonTwo from "../../components/bottom-button/index.vue";
	import NoData from "../../components/no-data.vue";
	import TopTitle from "../../components/top-title.vue";
	import {
		wgs84LL2gcjLL2
	} from "../map/c.js";
	import InvestigationItem from "./components/investigation-item.vue";
	import InvestigationItem2 from "./components/investigation-item2.vue";
	import ProblemTreeItem from "./components/problem-tree-item.vue";
	import ProblemBox from "./components/problem-box.vue";
	import $ from '@/common/globalJs/globalJs.js'
	export default {
		components: {
			TopTitle,
			NoData,
			BottomButton,
			BottomButton2,
			BottomButtonTwo,

			InvestigationItem,
			InvestigationItem2,
			ProblemTreeItem,
			ProblemBox,
		},
		onReady() {
			this.getChartsData();
			this.getChartsData2()
		},
		async onLoad(e) {
			this.boxHeight = uni.getSystemInfoSync().windowHeight;
			if (e.id) {
				this.businessId = e.id;
				this.sectionCode = e.sectionCode
				this.name = e.taskName
				this.sectionName = e.sectionName
				this.type = e.type;
				
				await this.getRoadTypes()
				await this.getBaseData(e.id);
				await this.getStreetCommunity()
			}
			this.getLocationInfo();
			this.getSystemInfo()
		},
		data() {
			return {
				businessId: "",
				name: "",
				sectionName: '',
				sectionCode: '',
				$: this.$,
				fileList1: [],
				fileList: [],
				showInvestigation: false,
				showInvestigation2: false,
				showInvestigation2Item: {},
				investigationSelectList: [],
				investigationSelectIDList: [],
				investigationList: [{
						name: "基本信息基本信息基本信息基本信息基本信息基本信息基本信息基本信息基本信息基本信息基本信息基本信息",
						value: 1,
					},
					{
						name: "xxxxx",
						value: 2
					},
				],
				investigationSelect: 1,
				showInvestigationDetail: false,
				investigationDetailList: [{
						type: "check",
						value: ""
					},
					{
						type: "text",
						value: ""
					},
					{
						type: "number",
						value: ""
					},
					{
						type: "upload",
						value: ""
					},
				],
				columnstimePicker: [
					['0时', '1时', '2时', '3时', '4时', '5时', '6时', '7时', '8时', '9时', '10时', '11时', '12时', '13时', '14时',
						'15时', '16时', '17时',
						'18时', '19时', '20时', '21时', '22时', '23时', '24'
					],
					['0时', '1时', '2时', '3时', '4时', '5时', '6时', '7时', '8时', '9时', '10时', '11时', '12时', '13时', '14时',
						'15时', '16时', '17时',
						'18时', '19时', '20时', '21时', '22时', '23时', '24时'
					],
				],
				investigationDetailTitle: "title",
				isEdit: false,
				isEditStep2: false,
				active: 1,
				tablist: [{
						title: "基本信息",
						type: "item",
						i: 1
					},
					{
						title: "基本信息",
						type: "point"
					},
					// {
					// 	title: "统计信息",
					// 	type: "item",
					// 	i: 2
					// },
					// {
					// 	title: "统计信息",
					// 	type: "point"
					// },
					{
						title: "隐患排查",
						type: "item",
						i: 3
					},

				],
				formData: {
					roadType: "",
					roadWidth: "",
					laneCount: "",
					roadStructure: "",
					sideProtec: "",
					centerSeparate: "",
					designSpeed: "",
					limitSpeed: "",
				},
				rules: {
					// 对name字段进行必填验证
					roadType: {
						rules: [{
								required: true,
								errorMessage: '请选择道路类型',
							},

						]
					},

				},
				describe: {
					bigCategory: "",
					smallCategory: "",
					hdTerm: "",
					hdDesc: "",
					hdPic: "",
					hdInfo: "",
				},
				latitude: 39.909,
				longitude: 116.39742,
				covers: [],
				chartData: {},
				//您可以通过修改 config-ucharts.js 文件中下标为 ['area'] 的节点来配置全局默认参数，如都是默认参数，此处可以不传 opts 。实际应用过程中 opts 只需传入与全局默认参数中不一致的【某一个属性】即可实现同类型的图表显示不同的样式，达到页面简洁的需求。
				opts: {
					enableScroll: false,
					color: [
						"#1890FF",
						"#FAC858",
						"#91CB74",
						"#EE6666",
						"#73C0DE",
						"#3CA272",
						"#FC8452",
						"#9A60B4",
						"#ea7ccc",
					],
					padding: [0, 10, 15, 10],
					enableScroll: false,
					legend: {
						icon: "rect",
						position: "top",
						float: "right",
						padding: 10,
					},
					xAxis: {
						disableGrid: true,
						itemCount: 12,
						scrollShow: true,
						// rotateLabel:true,
						// rotateAngle:-45,
						// axisLabels:{
						// 	rotate :true,
						// 	rotateAngle :-45
						// }
					},
					yAxis: {
						gridType: "dash",
						dashLength: 2,
					},
					extra: {
						area: {
							type: "straight",
							opacity: 0.2,
							addLine: true,
							width: 2,
							gradient: true,
							activeType: "hollow",
						},
					},
				},
				opts2: {
					color: [
						"#1890FF",
						"#FAC858",
						"#91CB74",
						"#EE6666",
						"#73C0DE",
						"#3CA272",
						"#FC8452",
						"#9A60B4",
						"#ea7ccc",
					],
					padding: [15, 15, 15, 15],
					enableScroll: false,
					legend: {
						icon: "rect",
						position: "top",
						float: "right",
						padding: 10,
						show: false,
					},
					xAxis: {
						disableGrid: true,
						itemCount: 12,
						scrollShow: true,
					},
					yAxis: {
						gridType: "dash",
						dashLength: 2,
					},
					extra: {
						area: {
							type: "straight",
							opacity: 0.2,
							addLine: true,
							width: 2,
							gradient: true,
							activeType: "hollow",
						},
					},
				},
				chartData2: {
					categories: ["0", "2", "4", "6", "8", "10", "12", "14", "16", "18", "20", "22", "24"],
					series: []
				},
				opts3: {
					color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4",
						"#ea7ccc"
					],
					padding: [5, 5, 5, 5],
					enableScroll: false,
					legend: {
						show: true,
						position: "right",
						lineHeight: 25
					},
					extra: {
						rose: {
							type: "radius",
							minRadius: 50,
							activeOpacity: 0.5,
							activeRadius: 10,
							offsetAngle: 0,
							labelWidth: 15,
							border: true,
							borderWidth: 2,
							borderColor: "#FFFFFF",
							linearType: "custom"
						}
					}
				},
				chartData3: {
					series: []
				},
				chartData4: {
					categories: ["0", "2", "4", "6", "8", "10", "12", "14", "16", "18", "20", "22", "24"],
					series: [{
							name: "总量",
							legendShape: "line",
							data: [],
						},

					]
				},
				showProblem: false,
				showProblemTreeSelect: false,
				problemTreeSelect: 0,
				problemTreeSelectList: [{
						name: "ashfjshfjsd1"
					},
					{
						name: "ashfjshfjsd2"
					},
					{
						name: "ashfjshfjs3d"
					},
					{
						name: "ashfjshfjsd4"
					},
					{
						name: "ashfjshfjsd5"
					},
					{
						name: "ashfjshfjsd6"
					},
					{
						name: "ashfjshfjsd8"
					},
					{
						name: "ashfjshfjsd7"
					},
				],
				problemTreeSelectConfirmList: [],
				hiddenDangerList: [],
				hiddenDangerList2: [],
				hiddenDangerList3: [],
				dangerProblem: "",
				//隐患新增或者编辑判断标识
				addInvestigationInfo: {
					type: '',
					index: 0
				},
				//选中排查数据
				troubleshootingData: [],
				checked: [],
				modalShow: false,
				extraConfigs: [],
				describeArr: [],
				temporary: '',
				type: 'edit',
				boxHeight: 773,
				showxqPicker: false,
				columnsxqPicker: [

				],
				showjdPicker: false,
				columnsjdPicker: [

				],
				showdlPicker: false,
				showtimePicker: false,
				columnsdlPicker: [

				],
				nidZD: '',
				lockZD: false,
				nidYH: '',
				lockYH: false
			};
		},
		watch: {
			isEdit(t) {
				if (!t) {
					this.boxHeight = uni.getSystemInfoSync().windowHeight;
				}
			},
			isEditStep2(t) {
				if (!t) {
					this.boxHeight = uni.getSystemInfoSync().windowHeight;
				}
			}
		},
		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)
							}
						}
					})
				})
				return array
			}
		},
		methods: {
			// 确认授权后，获取用户位置
			getLocationInfo() {
				uni.getLocation({
					type: "wgs84",
					success: (res) => {
						console.log(res);
						const coord = wgs84LL2gcjLL2(res.longitude, res.latitude);
						this.longitude = coord[0]; //118.787575;
						this.latitude = coord[1]; //32.05024;
						//   this.longitude = 120.38771;
						//   this.latitude = 36.110146;

					},
				});
			},
			getSystemInfo() {
				// #ifdef APP-PLUS
				// 在 App 端执行的代码
				// 获取系统信息
				uni.getSystemInfo({
					success: function(res) {
						// 判断运行环境是否为 App
						// if (res.platform === 'android' || res.platform === 'ios') {
						// 在 App 端执行获取定位信息的逻辑
						uni.getLocation({
							success: function(locationRes) {
								console.log('已获取定位信息', locationRes);
								// 在这里处理定位成功的逻辑
							},
							fail: function(error) {
								console.error('获取定位信息失败', error);
								if (error.errMsg.indexOf('auth deny') !== -1) {
									// 用户拒绝授权定位权限，可以引导用户打开权限设置页面
									uni.showModal({
										title: '提示',
										content: '请授权使用您的定位服务',
										confirmText: '去授权',
										success: function(modalRes) {
											if (modalRes.confirm) {
												uni.openSetting({
													success: (settingRes) => {
														console.log(
															'openSetting success',
															settingRes
															.authSetting
														);
														// 在这里可以处理打开设置页面后的逻辑
														this
															.getLocationInfo();
													},
													fail: (settingError) => {
														console.log(
															'openSetting fail',
															settingError
														);
														// 打开设置页面失败的处理逻辑
													}
												});
											}
										}
									});
								}
							}
						});
						// } else {
						//     console.log('当前不在 App 环境中');
						//     // 在非 App 环境中的处理逻辑
						// }
					}
				});
				// #endif
			},
			showInvestigationTag(v) {
				console.log(v)
				this.showInvestigation2 = true;
				this.showInvestigation2Item = v;
			},

			showInvestigationTag2(v) {
				console.log('gxh查看1', v, this.investigationSelectList, this.hiddenDangerList)
				if (this.checked.includes(v.id)) {
					this.showInvestigation2 = true;
					this.showInvestigation2Item = v
					for (let item of this.hiddenDangerList) {
						if (v.id == item.hdTerm) {
							this.$set(this.showInvestigation2Item, 'checkedSelect', item)
						}
					}
				}

			},
			pickerxqCancel(e) {
				this.showxqPicker = false
			},
			pickerxqConfirm(e) {
				this.showxqPicker = false
				this.formData.jdcode = null
				this.formData.xqcode = e.value[0].xqcode
				this.$set(this.formData, 'jdname', null)
				this.$set(this.formData, 'xqname', e.value[0].xqname)
				this.getStreetCommunityByXq()

			},
			pickerjdCancel(e) {
				this.showjdPicker = false
			},
			pickerjdConfirm(e) {
				this.showjdPicker = false
				this.formData.jdcode = e.value[0].jdcode
				// this.formData.xqcode = e.value[0].xqcode
				this.$set(this.formData, 'jdname', e.value[0].jdname)
				// this.$set(this.formData, 'xqname', e.value[0].xqname)

			},
			pickerdlConfirm(e) {
				console.log(e)
				this.showdlPicker = false
				this.$set(this.formData, 'roadType', e.value[0].enumvalue)
				this.$set(this.formData, 'roadTypeName', e.value[0].label)
			},
			pickerdlCancel(e) {
				this.showdlPicker = false
			},
			pickertimeConfirm(e) {
				this.showtimePicker = false
				this.$set(this.formData, 'peakHours', e.value[0] + ' - ' + e.value[1])
			},
			pickertimeCancel(e) {
				this.showtimePicker = false
			},
			openPicker() {

				this.showPicker = true
			},
			select2(v, list, list2) {
				console.log('select2')
				list.dangerItems.forEach(item => {
					// 假设this.troubleshootingData中没有与当前item.id相同的id  
					let found = false;

					// 遍历this.troubleshootingData数组来查找id  
					this.troubleshootingData.forEach(item2 => {
						if (item.id === item2.id) {
							// 如果找到了，设置found为true并退出循环  
							found = true;
							return;
						}
					});

					// 如果在this.troubleshootingData中没有找到相同的id，则将其添加到result数组中  
					if (!found) {
						this.troubleshootingData.push(item);
					}
				});
				// this.troubleshootingData = result
				this.showInvestigation = false
				let isId = this.investigationSelectList.some(item => item.nid === list.nid);
				if (!isId) {
					this.investigationSelectList.push(list)
				} else {
					this.$.toast("已添加");
				}
				// this.showInvestigation = false;
				// let id = 0;
				// this.investigationSelectList.map((r) => {
				// 	if (r.nid == v.nid) {
				// 		id = r.nid;
				// 	}
				// });
				// if (!id) {
				// 	v.extraConfigs = list;
				// 	this.investigationSelectList.push(v);
				// 	this.showInvestigation = false;

				// 	list2.dangerItems.forEach(item => {
				// 	// 假设this.troubleshootingData中没有与当前item.id相同的id  
				// 	let found = false;

				// 	// 遍历this.troubleshootingData数组来查找id  
				// 	this.troubleshootingData.forEach(item2 => {
				// 		if (item.id === item2.id) {
				// 			// 如果找到了，设置found为true并退出循环  
				// 			found = true;
				// 			return;
				// 		}
				// 	});

				// 	// 如果在this.troubleshootingData中没有找到相同的id，则将其添加到result数组中  
				// 	if (!found) {
				// 		this.troubleshootingData.push(item);
				// 	}
				// });
				// // this.troubleshootingData = result
				// // let isId = this.investigationSelectList.some(item => item.nid === list.nid);
				// // if (!isId) {
				// // 	this.investigationSelectList.push(list)
				// // }
				// } else {
				// 	this.$.toast("已添加");
				// }

			},
			select3(v) {
				console.log('select3')
				// this.investigationSelectList.map((r) => {
				// 	if (r.nid == v.nid) {
				// 		r = v;
				// 	}
				// });
				// console.log(v)
				this.showInvestigation2Item = {};
				this.showInvestigation2 = false;
				this.troubleshootingData.map(r => {
					if (r.id == v.id) {
						r.checkedSelect = v.checkedSelect
						r.extraConfigs = v.extraConfigs
					}
				})
			},
			onHiddenDangerList(v, index) {
				this.addInvestigationInfo = {
					type: 'edit',
					index: index
				}
				this.showProblem = true;
				this.dangerProblem = v.dangerProblem;
				this.describe = {
					bigCategory: v.bigCategory,
					smallCategory: v.smallCategory,
					hdTerm: v.hdTerm,
					hdDesc: v.hdDesc,
					hdPic: v.hdPic,
					hdInfo: v.hdInfo,
				};
				console.log(v)
				let newArr = []
				try {
					newArr = v.dangerProblem.split('/')
				} catch (e) {
					newArr = ['', '', '']
				}
				this.hiddenDangerList2 = [{
						id: v.bigCategory,
						itemname: newArr[0]
					},
					{
						id: v.smallCategory,
						itemname: newArr[1]
					},
					{
						id: v.hdTerm,
						itemname: newArr[2]
					}
				]
				// console.log(this.hiddenDangerList2)

				if (v.hdPic) {
					this.fileList = [];
					let arr = []
					try {
						arr = v.hdPic.split(',')
					} catch (error) {
						console.error(error)
					}
					for (let item of arr) {
						this.fileList.push({
							url: item,
							name: ''
						})
					}
				} else {
					this.fileList = [];
				}

			},
			add() {
				// this.addInvestigationInfo.type='add'
				this.$set(this.addInvestigationInfo, 'type', 'add')
				this.showProblem = true;
				this.hiddenDangerList2 = [];
				this.dangerProblem = '';
				this.describe = {
					bigCategory: "",
					smallCategory: "",
					hdTerm: "",
					hdDesc: "",
					hdPic: "",
					hdInfo: ""
				};
				this.fileList = [];
				console.log('123123', this.describe)
			},
			addFL() {
				if (this.type == 'add') {
					return false
				}
				this.showProblemTreeSelect = true;
				this.showProblem = false;
				// this.describe = {
				//   bigCategory: "",
				//   smallCategory: "",
				//   hdTerm: "",
				//   hdDesc: "",
				//   hdPic: "",
				//   hdInfo: "",
				// };
				// this.fileList = [];
			},
			getStreetCommunity() {
				this.$request
					.globalRequest(
						"/hiddenDanger/config/getStreetCommunity", {

						},
						"GET"
					)
					.then((res) => {
						if (res.code === 200) {
							let arr = res.result
							for (let item of arr) {
								item.label = item.xqname
							}
							// 使用 reduce 方法根据 xqcode 去重  
							const uniqueByXqcode = res.result.reduce((acc, current) => {
								// 检查累加器（acc）中是否已经有当前元素的 xqcode  
								const existing = acc.find(item => item.xqcode === current.xqcode);
								if (!existing) {
									// 如果没有，将当前元素添加到累加器中  
									acc.push(current);
								}
								// 无论是否添加，都返回累加器供下一次迭代使用  
								return acc;
							}, []);
							this.columnsxqPicker = [uniqueByXqcode]
						}
					});
			},
			getStreetCommunityByXq() {
				if (!this.formData.xqcode) {
					return false
				}
				this.$request
					.globalRequest(
						"/hiddenDanger/config/getStreetCommunityByXq", {
							xqcode: this.formData.xqcode
						},
						"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.jdname
							}
							this.columnsjdPicker = [arr]
						}
					});
			},
			getRoadTypes() {

				this.$request
					.globalRequest(
						"/hiddenDanger/highDanger/getRoadTypes", {

						},
						"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]
						}
					});
			},

			getBaseDefaultData() {
				this.$request
					.globalRequest(
						"/hiddenDanger/config/getDangerBaseData", {
							nuserid: this.$.getData("token"),
							sectionCode: this.sectionCode,
							businessId: this.businessId
						},
						"GET"
					)
					.then((res) => {
						if (res.code === 200) {
							// console.log(res,11111)
							if (!this.formData.roadType) {
								console.log('123123', res.result.sectionType)
								this.$set(this.formData, 'roadType', res.result.sectionType)
								// this.columnsdlPicker.forEach(item => {
								// 	if(item.enumvalue == res.result.sectionType) {
								// 		this.$set(this.formData, 'roadType', item.enumName)
								// 	}
								// })
								this.columnsdlPicker[0].forEach(item => {
									if(item.enumvalue == res.result.sectionType) {
										this.$set(this.formData, 'roadTypeName', item.enumName)
									}
								})
							}
							if (!this.formData.roadWidth) {
								this.$set(this.formData, 'roadWidth', res.result.width)
							}
							if (!this.formData.laneCount) {
								this.$set(this.formData, 'laneCount', res.result.laneNum)
							}
							if (!this.formData.limitSpeed) {
								this.$set(this.formData, 'limitSpeed', res.result.speed)
							}

							// for (let k in res.result) {
							// 	if (res.result[k] == 0) {
							// 		res.result[k] = ""
							// 	}
							// }
							// this.formData = {
							// 	...this.formData,
							// 	...res.result
							// };
						}
					});
			},
			// "/hiddenDanger/highDanger/getSectionInfo",
			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,
							...res.result
						};
						console.log('this.columnsdlPicker', this.columnsdlPicker)
						this.columnsdlPicker[0]?.forEach(item => {
							if(item.enumvalue == this.formData.roadType) {
								this.$set(this.formData, 'roadTypeName', item.enumName)
							}
						})
						this.getStreetCommunityByXq()
						this.getBaseDefaultData()
					}
				});
				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', this.troubleshootingData)
						// 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);
						for (let i in this.troubleshootingData) {
							if (this.troubleshootingData[i].checked == 1) {
								// alert(111)

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

						}
						this.initCheckedSelect()
						// 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;
					}
				});
				this.$request.globalRequest("/hiddenDanger/highDanger/getUserHiddenDangerList", {pcType: 2, businessId}, "GET").then((res) => {
					if (res.code === 200) {
						this.hiddenDangerList.push(...res.result)
					}
				});

				this.$request.globalRequest("/hiddenDanger/highDanger/getDangerItems", {nuserid: this.$.getData("token"), businessId}, "GET")
				.then((res) => {
					if (res.code === 200) {
						this.problemTreeSelectConfirmList = res.result;
					}
				});
			},
			handleSelectProblem(item, index) {
				// this.problemTreeSelectConfirmList.push(item)
			},
			showProblemTreeSelectHandle() {
				if (this.hiddenDangerList3.length == 3) {
					this.showProblemTreeSelect = false;
					this.showProblem = true;
					this.hiddenDangerList2 = JSON.parse(
						JSON.stringify(this.hiddenDangerList3)
					);
				}
			},
			initCheckedSelect() {
				this.$request
					.globalRequest(
						"/hiddenDanger/highDanger/getUserHiddenDangerList", {
							nuserid: this.$.getData("token"),
							pcType: 1,
							businessId: this.businessId
						},
						"GET"
					)
					.then((res) => {
						if (res.code === 200 && res.result.length != 0) {
							// this.hiddenDangerList.push(...res.result)
							console.log(this.troubleshootingData, 123)
							console.log(res.result, 321)

							for (let i in this.troubleshootingData) {
								for (let j in res.result) {
									if (this.troubleshootingData[i].id == res.result[j].hdTerm) {
										this.$set(this.troubleshootingData[i], "checkedSelect", {
											hdInfo: res.result[j].hdInfo,
											hdPic: res.result[j].hdPic,
											hdDesc: res.result[j].hdDesc,
											hdTerm: res.result[j].hdTerm,
											pcType: 1
										})
									}
								}
							}
						}
					});
			},
			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) {
							this.troubleshootingData[index].extraConfigs.push(...res.result)
							// console.log('656666666666666666666666666666666', this.troubleshootingData)
						}
						console.log('222333333333333333334444444444', 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
				// 	}
				// })
			},
			select(v) {
				this.hiddenDangerList3 = v;
			},
			// 删除图片
			deletePic(event) {
				this[`fileList${event.name}`].splice(event.index, 1);
			},
			// 新增图片
			uploadFilePromise(url) {
				return new Promise((resolve, reject) => {
					let a = uni.uploadFile({
						url: "http://192.168.2.21:7001/upload", // 仅为示例，非真实的接口地址
						filePath: url,
						name: "file",
						formData: {
							user: "test",
						},
						success: (res) => {
							setTimeout(() => {
								resolve(res.data.data);
							}, 1000);
						},
					});
				});
			},
			investigationHandle1() {
				let id = 0;
				this.investigationSelectList.map((r) => {
					if (r.nid == this.investigationList[this.investigationSelect].nid) {
						id = r.id;
					}
				});
				if (!id) {
					this.investigationSelectList.push(
						this.investigationList[this.investigationSelect]
					);
					this.showInvestigation = false;
				} else {
					this.$.toast("已添加");
				}
			},
			investigationHandle2() {
				let hdPic = ''
				for (let i = 0; i < this.fileList.length; i++) {
					if (i == this.fileList.length - 1) {
						hdPic += this.fileList[i].url
					} else {
						hdPic += this.fileList[i].url + ','
					}

				}
				if (this.hiddenDangerList2.length > 0) {
					let form = {
						bigCategory: this.hiddenDangerList2[0].id,
						bigCategoryName: this.hiddenDangerList2[0].itemname,
						smallCategory: this.hiddenDangerList2[1].id,
						smallCategoryName: this.hiddenDangerList2[1].itemname,
						hdTerm: this.hiddenDangerList2[2].id,
						hdTermName: this.hiddenDangerList2[2].itemname,
						hdDesc: this.describe.hdDesc,
						hdPic: hdPic,
						nid: $.createUUID(),
						hdInfo: this.describe.hdInfo,
						dangerProblem: this.hiddenDangerList2[0].itemname + '/' + this.hiddenDangerList2[1].itemname +
							'/' + this.hiddenDangerList2[2].itemname
					}
					if (this.addInvestigationInfo.type == 'add') {
						this.hiddenDangerList.push(form);
					} else {
						this.$set(this.hiddenDangerList, this.addInvestigationInfo.index, form)
					}
					console.log(this.hiddenDangerList)
				}

				this.showProblem = false;
			},
			investigationDetailHandle() {
				this.showInvestigationDetail = true;
			},
			getChartsData() {
				//模拟服务器返回数据，如果数据格式和标准格式不同，需自行按下面的格式拼接
				let res = {
					categories: ["0", "2", "4", "6", "8", "10", "12", "14", "16", "18", "20", "22", "24"],
					series: [{
							name: "总量",
							legendShape: "line",
							data: [],
						},
						{
							name: "大车",
							legendShape: "line",
							data: [],
						},
						{
							name: "小车",
							legendShape: "line",
							data: [],
						},
					],
				};
				this.chartData = JSON.parse(JSON.stringify(res));
			},
			getChartsData2() {
				//模拟服务器返回数据，如果数据格式和标准格式不同，需自行按下面的格式拼接
				let res = {
					categories: ["0", "2", "4", "6", "8", "10", "12", "14", "16", "18", "20", "22", "24"],
					series: [{
						name: "总量",
						legendShape: "line",
						data: [],
					}],
				};
				this.chartData2 = JSON.parse(JSON.stringify(res));
			},
			// 删除图片
			deletePic(event, key) {
				this[key].splice(event.index, 1);
			},
			//获取随机id
			uuid(len, binary) {
				len = !len ? 36 : len;
				binary = !binary ? 16 : binary;
				return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"
					.replace(/[xy]/g, function(c) {
						var r = (Math.random() * binary) | 0,
							v = c == "x" ? r : (r & 0x3) | 0x8;
						return v.toString(binary);
					})
					.substring(0, len);
			},
			uploadFilePromise(url) {
				return new Promise((resolve, reject) => {
					let a = uni.uploadFile({
						url: this.$.baseUrl + "/hiddenDanger/ftp/uploadFileToFtp", // 仅为示例，非真实的接口地址
						filePath: url,
						name: "file",
						success: (res) => {
							resolve(res.data);
						},
					});
				});
			},
			async afterRead(event, key) {
				// console.log(key)
				// 当设置 multiple 为 true 时, file 为数组格式，否则为对象格式
				const id = this.uuid();
				this[key].push({
					id,
					...event.file,
					status: "uploading",
					message: "上传中",
				});
				console.log(event.file)
				const result = await this.uploadFilePromise(event.file.url);
				const resultInfo = JSON.parse(result);
				const index = this[key].findIndex((v) => v.id === id);
				if (resultInfo.code == 200) {
					this[key].splice(
						index,
						1,
						Object.assign(event.file, {
							status: "success",
							message: "",
							result: resultInfo,
							url: resultInfo.result,

						})
					);
					console.log(this[key])
				} else {
					this.$.toast("上传失败");
					this[key].splice(
						index,
						1,

					);
				}
			},
			bottomButtonTwo() {
				console.log(this.type)
				if (!this.type) {
					if (!this.formData.roadType) {
						return this.$.toast("请输入道路类型");
					}
					if (!this.formData.roadWidth) {
						return this.$.toast("请输入道路宽度");
					}
					if (!this.formData.laneCount) {
						return this.$.toast("请输入车道数");
					}
					if (!this.formData.designSpeed) {
						return this.$.toast("请输入设计时速");
					}
					if (!this.formData.limitSpeed) {
						return this.$.toast("请输入限速");
					}
				}

				this.isEdit = false;
				this.active = 3;
			},
			submit(temporary) {
				//查看情况下 直接返回上一页
				if (this.type == 'view') {
					return uni.navigateBack();
				}
				console.log('this.checkedthis.checked', this.checked)
				let checkedArr = this.troubleshootingData.filter(r => this.checked.includes(r.id))
				console.log(11111111, checkedArr)

				let extraConfigs = [];
				checkedArr.map((r) => {
					if (!r.extraConfigs) return
					r.extraConfigs.map((s) => {
						// let arr = []
						// let standar=''
						// for (let i = 0; i < s.fileList.length; i++) {
						// 	arr.push(s.fileList[i].url)
						// }
						s.scenesId = r.nid;
						s.dangerId = r.id;
						// if (s.type == 4) {
						// 	s.standar=arr.toString();
						// 	// s.standar =
						// 	// 	s.fileList && s.fileList.length > 0 ? s.fileList[0].url : "";
						// }
						delete s.fileList;
						delete s.nid;
						extraConfigs.push(s);
					});
				});

				console.log('this.hiddenDangerListthis.hiddenDangerList', this.hiddenDangerList)
				let describe = JSON.parse(JSON.stringify(this.hiddenDangerList))
				console.log('describedescribedescribedescribedescribedescribedescribe', describe)
				try {
					for (let item of describe) {
						if (item.nid) {
							delete item.nid
						}
						if (item.businessId) {
							delete item.businessId
						}
						if (item.pcCount || item.pcCount == null) {
							delete item.pcCount
						}
						if (item.dangerProblem) {
							delete item.dangerProblem
						}
						item.pcType = 2
					}
				} catch (e) {
					//TODO handle the exception
				}
				setTimeout(() => {
					// let describe = [{ hdTerm: 1 }, { hdTerm: 2 }, { hdTerm: 3 }];
					// let checkedArr = [{ id: 1 }, { hdTerm: 5 }, { hdTerm: 3 }];

					// 用于存储不存在于checkedArr.id中的describe元素的副本  
					let notFoundIncheckedArr = [];

					// 用于记录describe和checkedArr中元素的索引  
					let indexes = [];
					if (describe.length <= 0) {
						checkedArr.map(r => {
							describe.push({
								hdTerm: r.id,
								hdDesc: r.checkedSelect ? r.checkedSelect.hdDesc : '',
								hdPic: r.checkedSelect ? r.checkedSelect.hdPic : '',
								hdInfo: r.checkedSelect ? r.checkedSelect.hdInfo : '',
								pcType: 1
							})
						})
					} else {
						checkedArr.forEach((item2, index2) => {
							let idToFind = item2.id;
							let foundIndex = describe.findIndex(item1 => item1.hdTerm === idToFind);

							if (foundIndex === -1) {
								if (item2.checkedSelect) {
									describe.push({
										...item2.checkedSelect,
										pcType: 1,
										hdTerm: item2.id,
									});
								}
								// 如果在describe中找不到对应的hdTerm，将item2添加到describe中

								// console.log(`添加: ${idToFind} 到 describe`);
							} else {
								let obj = {
									hdTerm: item2.id,
									hdDesc: item2.checkedSelect ? item2.checkedSelect.hdDesc : '',
									hdPic: item2.checkedSelect ? item2.checkedSelect.hdPic : '',
									hdInfo: item2.checkedSelect ? item2.checkedSelect.hdInfo : '',
									pcType: 1
								}
								// console.log(obj, 111111)
								describe[foundIndex] = obj;
								// 如果找到匹配的hdTerm，替换describe中的对应项
								// describe[foundIndex] = { hdTerm: idToFind };
								// console.log(`替换: describe[${foundIndex}] = ${idToFind}`);
							}

							// console.log(`describe:`, describe);
						});
						// describe.forEach((item1, index1) => {
						// 	let found = false;
						// 	checkedArr.forEach((item2, index2) => {
						// 		if (item1.hdTerm === item2.id) {
						// 			found = true;
						// 			let obj = {
						// 				hdTerm: item2.id,
						// 				hdDesc: item2.checkedSelect ? item2.checkedSelect.hdDesc : '',
						// 				hdPic: item2.checkedSelect ? item2.checkedSelect.hdPic : '',
						// 				hdInfo: item2.checkedSelect ? item2.checkedSelect.hdInfo : '',
						// 				pcType: 1
						// 			}
						// 			describe.splice(index1, 1, obj);
						// 			// indexes.push({ describeIndex: index1, checkedArrIndex: index2 });
						// 		}
						// 		if (!found) {
						// 		// 注意：这里不直接push到arr1，而是到notFoundIncheckedArr  
						// 		describe.push({ ...item2 }); // 创建副本以避免直接修改arr1  
						// 	}
						// 	});

						// });
					}

					console.log("Not found in checkedArr:", notFoundIncheckedArr);
					console.log("Indexes of matching elements:", indexes);

					// 如果确实需要将这些元素添加到arr1（虽然通常不推荐），可以这样做：  
					// arr1.push(...notFoundInArr2); // 但这里我们没有做，因为可能改变原始意图

					// console.log(describe)
					// return false
					// console.log(this.investigationSelectList);
					// console.log(this.troubleshootingData);
					// console.log({
					// 	...this.formData,
					// 	businessId: this.businessId,
					// 	extraConfigs: extraConfigs,
					// 	describe: describe,
					// });
					this.extraConfigs = extraConfigs
					this.describeArr = describe
					this.temporary = temporary
					console.log('describeArrdescribeArrdescribeArr', this.extraConfigs, this.describeArr)
					if (!temporary) {
						this.postSaveManualInvestigation()
						return
					}
					if (this.extraConfigs.length <= 0 || this.describeArr.length <= 0) {
						this.modalShow = true
					} else {
						this.postSaveManualInvestigation()
					}
				}, 1);

			},
			postSaveManualInvestigation() {
				this.$request
					.globalRequest(
						"/hiddenDanger/highDanger/saveManualInvestigation", {
							...this.formData,
							operator: this.$.getData("token"),
							businessId: this.businessId,
							extraConfigs: this.extraConfigs,
							describe: this.describeArr,
							temporary: this.temporary,
							// 							describe: [{
							//     "bigCategory": "1",
							//     "bigCategoryName": "道路线性断面",
							//     "smallCategory": "2",
							//     "smallCategoryName": "平面线形",
							//     "hdTerm": "4",
							//     "hdTermName": "急弯接桥、隧道、涵洞的",
							//     "hdDesc": "",
							//     "hdPic": "",
							//     "hdInfo": ""
							// }],
							lastModeUser: this.$.getData('userInfo').username
						},
						"POST"
					)
					.then((res) => {
						console.log(res);
						if (res.code === 200) {
							if (this.temporary) {
								this.$.toast("保存成功");
							} else {
								this.$.toast("暂存成功");
							}
							setTimeout(() => {
								uni.navigateBack({
									delta: 2, // 默认值是1，表示返回的页面层数
								});
							}, 1000);

							// this.data = res.result;
							// this.rname = this.data[0].name;
							// this.polyline = [
							//   {
							//     name: "xian1",
							//     arrowLine: true,
							//     color: "#CC2936",
							//     width: 8,
							//     id: 1,
							//     points: this.data[0].position,
							//   },
							// ];
						} else {
							this.$.toast(res.msg);
						}
					});
			},
			// watchKeyBoardHeight() {
			// 	uni.onKeyboardHeightChange(res => {
			// 		if(res.height) {
			// 			const query = uni.createSelectorQuery().in(this);
						
			// 			// 选择我们想要的元素
			// 			query.select('#page').boundingClientRect(data => {
			// 				// data是选中元素的大小及位置信息
			// 				if (data) {
			// 					// 元素的高度
			// 					const height = data.height;
			// 					this.boxHeight = height + res.height
			// 					console.log('盒子的高度:', height);
			// 				}
			// 			}).exec(); // 执行查询
			// 		}
			// 	})
			// },
			focus() {
				// const query = uni.createSelectorQuery().in(this);

				// // 选择我们想要的元素
				// query.select('#page').boundingClientRect(data => {
				// 	// data是选中元素的大小及位置信息
				// 	if (data) {
				// 		// 元素的高度
				// 		const height = data.height;
				// 		if (this.isEdit) {
				// 			uni.onKeyboardHeightChange((res) => {
				// 			    if (res.height) {
				// 					this.boxHeight = height + res.height
				// 			        // this.inputTop = res.height;
				// 			    }
				// 			});
				// 		}
				// 		// uni.onKeyboardHeightChange((res) => {
				// 		//     if (res.height) {
				// 		// 		this.boxHeight = height - res.height
				// 		//         // this.inputTop = res.height;
				// 		//     }
				// 		// });
				// 		console.log('盒子的高度:', height);
				// 	}
				// }).exec(); // 执行查询
			},
			blur() {
				// const query = uni.createSelectorQuery().in(this);
				
				// // 选择我们想要的元素
				// query.select('#page').boundingClientRect(data => {
				// 	// data是选中元素的大小及位置信息
				// 	if (data) {
				// 		// 元素的高度
				// 		const height = data.height;
				// 		if (this.isEdit) {
				// 			uni.onKeyboardHeightChange((res) => {
				// 			    if (res.height) {
				// 					this.boxHeight = height - res.height
				// 			        // this.inputTop = res.height;
				// 			    }
				// 			});
				// 		}
				// 		// uni.onKeyboardHeightChange((res) => {
				// 		//     if (res.height) {
				// 		// 		this.boxHeight = height - res.height
				// 		//         // this.inputTop = res.height;
				// 		//     }
				// 		// });
				// 		console.log('盒子的高度:', height);
				// 	}
				// }).exec(); // 执行查询
			},
			focus2() {
				// const query = uni.createSelectorQuery().in(this);

				// // 选择我们想要的元素
				// query.select('#page').boundingClientRect(data => {
				// 	// data是选中元素的大小及位置信息
				// 	if (data) {
				// 		// 元素的高度
				// 		const height = data.height;
				// 		if (this.isEditStep2) {
				// 			uni.onKeyboardHeightChange((res) => {
				// 			    if (res.height) {
				// 					this.boxHeight = height + res.height
				// 			        // this.inputTop = res.height;
				// 			    }
				// 			});
				// 		}
				// 		console.log('盒子的高度:', height);
				// 	}
				// }).exec(); // 执行查询
			},
			blur2() {
				// const query = uni.createSelectorQuery().in(this);
				
				// // 选择我们想要的元素
				// query.select('#page').boundingClientRect(data => {
				// 	// data是选中元素的大小及位置信息
				// 	if (data) {
				// 		// 元素的高度
				// 		const height = data.height;
				// 		if (this.isEditStep2) {
				// 			uni.onKeyboardHeightChange((res) => {
				// 			    if (res.height) {
				// 					this.boxHeight = height - res.height
				// 			        // this.inputTop = res.height;
				// 			    }
				// 			});						}
				// 		console.log('盒子的高度:', height);
				// 	}
				// }).exec(); // 执行查询
			},
			onLongPressZD(item) {
				if (this.nidZD == item.nid) {
					if (this.lockZD) {
						this.lockZD = false
						this.nidZD = ''
					} else {
						this.lockZD = true
						this.nidZD = item.nid
					}
				} else {
					this.lockZD = true
					this.nidZD = item.nid
				}
			},
			delZD() {
				this.troubleshootingData = this.troubleshootingData.filter(r => {
					if (r.nid != this.nidZD) {
						return r
					}
				})
				this.investigationSelectList = this.investigationSelectList.filter(r => {
					if (r.nid != this.nidZD) {
						return r
					}
				})
				this.nidZD = ''
			},
			onLongPressYH(item) {
				if (this.nidYH == item.nid) {
					if (this.lockYH) {
						this.lockYH = false
						this.nidYH = ''
					} else {
						this.lockYH = true
						this.nidYH = item.nid
					}
				} else {
					this.lockYH = true
					this.nidYH = item.nid
				}
			},
			delYH() {
				console.log('this.hiddenDangerList', this.hiddenDangerList, this.nidYH)
				this.hiddenDangerList = this.hiddenDangerList.filter(r => {
					if (r.nid != this.nidYH) {
						return r
					}
				})
				this.nidYH = ''
				console.log('this.hiddenDangerList', this.hiddenDangerList)
			}
		},
	};
</script>

<style lang="scss">
	#page {
		background: #f6f8fa;
	}

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

		.Content {
			padding-bottom: 88rpx;
		}
	}

	.stepBox {
		width: 100%;
		box-sizing: border-box;
		padding: 40rpx 40rpx 100rpx 40rpx;
		display: flex;
		justify-content: space-around;
		align-items: center;
		background-color: #ffffff;
		box-shadow: 0 2px 8px #cccccc;

		.step {
			display: flex;
			justify-content: space-around;
			align-items: center;
			height: 100rpx;

			.stepItem {
				display: flex;
				flex-direction: column;
				align-items: center;
				zoom: 1.2;
			}

			.circles {
				display: flex;
				// justify-content: space-between;
				padding: 22px 0;

				.circle {
					width: 4rpx;
					height: 4rpx;
					border-radius: 50%;
					background-color: #e9edf5;
					margin: 0 1px;
				}

				.circleActive {
					width: 4rpx;
					height: 4rpx;
					border-radius: 50%;
					background-color: #ccc;
					margin: 0 1px;
				}
			}

			.stepCircle {
				width: 60rpx;
				height: 60rpx;
				line-height: 60rpx;
				border-radius: 50%;
				background-color: #e9edf5;
				color: #a0abbd;
				text-align: center;
				margin-bottom: 10rpx;
			}

			.stepCircleActive {
				zoom: 1.5;
				width: 50rpx;
				height: 50rpx;
				line-height: 50rpx;
				border-radius: 50%;
				background-color: #295cbc;
				color: #ffffff;
				text-align: center;
				margin-bottom: 4rpx;
				border: 5px solid #c6d8fc;
			}

			.stepText {
				font-size: 14px;
				color: #bcc3cd;
				width: 120rpx;
				text-align: center;
				bottom: -60rpx;
			}
		}
	}

	.blank {
		width: 100%;
		height: 100rpx;
	}

	.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%;
			}
		}
	}

	.echarts {
		background: #ffffff;
		width: calc(100% - 40rpx);
		margin: 20rpx;
		box-sizing: border-box;
		border: 1px solid #e6e6e6;
	}

	.point {
		width: 100%;
		padding: 20rpx;
		box-sizing: border-box;

		.title {
			font-size: 20px;
			position: relative;
			margin-bottom: 20rpx;
		}

		.title::after {
			content: " ";
			position: absolute;
			left: -20rpx;
			top: 50%;
			transform: translateY(-50%);
			width: 8rpx;
			height: 80%;
			vertical-align: middle;
			background: #2663bf;
			z-index: 90;
		}

		.item {
			background: #f0f3f7;
			padding: 20rpx;
			text-align: center;
			display: flex;
			align-items: center;
			justify-content: center;
			border-radius: 8rpx;
			margin-bottom: 20rpx;
			height: 100rpx;
			box-sizing: border-box;
			overflow: hidden;

			&.add {
				background: #dfebf8;
				color: #2663bf;
			}
		}

		.problem-item {
			background: #f0f3f7;
			padding: 20rpx;
			border-radius: 8rpx;
			margin-bottom: 20rpx;

			.check {
				background: #dce4f2;
				border-radius: 20rpx;
				width: 60rpx;
				height: 60rpx;
				display: flex;
				justify-content: center;
				align-items: center;
			}

			&.add {
				background: #dfebf8;
				color: #2663bf;
				display: flex;
				align-items: center;
				justify-content: center;
			}
		}
	}

	.row {
		display: block;
	}

	.row::after {
		content: "";
		display: table;
		clear: both;
	}

	.custom-pop-head {
		width: 100%;
		padding: 20rpx;
		box-sizing: border-box;
		display: flex;
		align-items: center;
		justify-content: space-between;
		border-bottom: 1px solid #e6e6e6;
		margin-bottom: 20rpx;

		.left {
			color: #666666;
		}

		.title {
			font-size: 16px;
		}

		.right {
			color: #2663bf;
		}
	}

	.investigation-item {
		margin: 0 auto 20rpx;
		width: 90%;
		border-radius: 8rpx;
		padding: 20rpx;
		box-sizing: border-box;
		display: flex;
		justify-content: space-between;
		align-items: center;
		overflow: hidden;

		&.active {
			background: #dfebf8;
		}
	}

	.detail-item {
		width: 100%;
		background: #f0f3f7;
		padding: 20rpx 30rpx;
		border-radius: 8rpx;
		box-sizing: border-box;

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

		/deep/ .uni-forms-item {
			margin-bottom: 0;
		}

		/deep/ .uni-forms-item__label {
			font-size: 16px;
		}
	}

	.problem-box {
		width: 100%;
		padding: 20rpx;
		box-sizing: border-box;
		max-height: calc(100vh - 100px);
		overflow: auto;

		.detail-item {
			margin-bottom: 20rpx;
		}
	}

	.breadcrumb {
		padding: 0 20rpx;
		overflow-x: auto;
	}

	.u-checkbox-group--row {
		flex-direction: column;
		padding: 0 20rpx;

		.u-checkbox {
			margin-bottom: 30rpx;
		}
	}

	::v-deep ::-webkit-scrollbar {
		// 滚动条整体样式
		display: block;
		width: 16rpx !important;
		height: 16rpx !important;
		-webkit-appearance: auto !important;
		background: transparent;
		overflow: auto !important;
	}

	::v-deep ::-webkit-scrollbar-thumb {
		// 滚动条里面小方块
		border-radius: 16rpx !important;
		box-shadow: inset 0 0 5rpx rgba(0, 0, 0, 0.2) !important;
		background-color: #f7f7f7 !important;
	}

	::v-deep ::-webkit-scrollbar-track {
		// 滚动条
		border-radius: 16rpx !important;
		box-shadow: inset 0 0 5rpx rgba(0, 0, 0, 0.2) !important;
		background-color: #dad8d8 !important;
	}

	.formInput {
		width: 90%;
		margin-right: 4px;
		font-size: 14px;
	}

	.gary {
		color: #B4BAC9;
	}

	.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;
	}

	// .uni-forms-item__labe{
	// 	width: ;
	// }
	.nodata {
		width: 100%;
		text-align: center;
		height: 300rpx;
		line-height: 300rpx;
		font-size: 28rpx;
		color: #ccc;
	}
</style>