<template>
	<view>
		<image src="https://cczdsz.cn/app/images/background.png" class="background"></image>
		<view class="project-content">
			<u-form :model="form" ref="form">
				<u-form-item label="用户名称" borderBottom ref="item1" labelWidth="140">
					<u-input    v-model="form.userName" placeholder="请输入用户名称" ></u-input>
				</u-form-item>
				<u-form-item label="用户编号" borderBottom ref="item1" labelWidth="140">
					<u-input    v-model="form.userNumber" placeholder="请输入用户编号" ></u-input>
				</u-form-item>
				<u-form-item label="用户类型" borderBottom ref="item1" placeholder="请输入编号" labelWidth="140">
					<u-radio-group v-model="form.userType"   >
						<u-radio @change="userType" v-for="(item, index) in typelist.users_type" :key="index"
							:name="item.dictValue">
							{{item.dictLabel}}
						</u-radio>
					</u-radio-group>
				</u-form-item>
				<u-form-item label="安检时间" labelWidth="150" borderBottom ref="item1">
					<u-input v-model="form.securityCheckTime" borderBottom disabled
						@click="showtime2=true  "></u-input>
					<u-picker v-model="showtime2" mode="time" :params="params" @confirm="time2()"></u-picker>
				</u-form-item>
				<view class="small-title">阀门井检查</view>
				<u-row gutter="12">
					<u-col>
						<u-form-item label="阀门外观" borderBottom ref="item1" placeholder="请输入编号" labelWidth="140">
							<u-radio-group v-model="form.valveAppearance"   >
								<u-radio @change="valveAppearance" v-for="(item, index) in typelist.exterior" :key="index"
									:name="item.dictValue">
									{{item.dictLabel}}
								</u-radio>
							</u-radio-group>
						</u-form-item>
					</u-col>
					<u-col>
						<u-col>
							<u-form-item label="开关是否灵敏有效" borderBottom ref="item1" placeholder="请输入编号" labelWidth="140">
								<u-radio-group v-model="form.sensitives"   >
									<u-radio @change="sensitives" v-for="(item, index) in typelist.sensitive" :key="index"
										:name="item.dictValue">
										{{item.dictLabel}}
									</u-radio>
								</u-radio-group>
							</u-form-item>
						</u-col>
					</u-col>
					<view class="small-title">调压箱检查</view> 
					<u-col>
						<u-form-item label="类型" borderBottom ref="item1" placeholder="请输入编号" labelWidth="140">
							<u-radio-group v-model="form.type"   >
								<u-radio @change="type" v-for="(item, index) in typelist.box_type" :key="index"
									:name="item.dictValue">
									{{item.dictLabel}}
								</u-radio>
							</u-radio-group>
						</u-form-item>
					</u-col>
					<u-col>
						<u-form-item label="箱体外观" borderBottom ref="item1" placeholder="请输入编号" labelWidth="140">
							<u-radio-group v-model="form.cabinetAppearance"   >
								<u-radio @change="cabinetAppearance" v-for="(item, index) in typelist.exterior" :key="index"
									:name="item.dictValue">
									{{item.dictLabel}}
								</u-radio>
							</u-radio-group>
						</u-form-item>
					</u-col>
					<view class="small-title">用气设施检查-锅炉及直燃机设备</view> 
					<u-col>
						<u-form-item label="运行情况" borderBottom ref="item1" placeholder="请输入编号" labelWidth="140">
							<u-radio-group v-model="form.boilerExterior"   >
								<u-radio @change="boilerExterior" v-for="(item, index) in typelist.catering_status"
									:key="index" :name="item.dictValue">
									{{item.dictLabel}}
								</u-radio>
							</u-radio-group>
						</u-form-item>
					</u-col>
					<u-col>
						<u-form-item label="外观" borderBottom ref="item1" placeholder="请输入编号" labelWidth="140">
							<u-radio-group v-model="form.boilerAppearance"   >
								<u-radio @change="boilerAppearance" v-for="(item, index) in typelist.exterior" :key="index"
									:name="item.dictValue">
									{{item.dictLabel}}
								</u-radio>
							</u-radio-group>
						</u-form-item>
					</u-col>
					<!-- <view class="small-title">用气设施检查-餐饮设施检查</view> 
					<u-col>
						<u-form-item label="运行情况" borderBottom ref="item1" placeholder="请输入编号" labelWidth="140">
							<u-radio-group v-model="form.cateringStatus"   >
								<u-radio @change="cateringStatus" v-for="(item, index) in typelist.catering_status" :key="index"
									:name="item.dictValue">
									{{item.dictLabel}}
								</u-radio>
							</u-radio-group>
						</u-form-item>
					</u-col>
					<u-col>
						<u-form-item label="外观" borderBottom ref="item1" placeholder="请输入编号" labelWidth="140">
							<u-radio-group v-model="form.cateringExterior"   >
								<u-radio @change="cateringExterior" v-for="(item, index) in typelist.exterior"
									:key="index" :name="item.dictValue">
									{{item.dictLabel}}
								</u-radio>
							</u-radio-group>
						</u-form-item>
					</u-col> -->
					<view class="small-title">用气设施检查-餐饮设施检查</view> 
					<u-col>
						<u-form-item label="运行情况" borderBottom ref="item1" placeholder="请输入编号" labelWidth="140">
							<u-radio-group v-model="form.cateringStatus"   >
								<u-radio @change="cateringStatus" v-for="(item, index) in typelist.catering_status" :key="index"
									:name="item.dictValue">
									{{item.dictLabel}}
								</u-radio>
							</u-radio-group>
						</u-form-item>
					</u-col>
					<u-col>
						<u-form-item label="外观" borderBottom ref="item1" placeholder="请输入编号" labelWidth="140">
							<u-radio-group v-model="form.cateringExterior"   >
								<u-radio @change="cateringExterior" v-for="(item, index) in typelist.exterior"
									:key="index" :name="item.dictValue">
									{{item.dictLabel}}
								</u-radio>
							</u-radio-group>
						</u-form-item>
					</u-col>
					<view class="small-title" style="font-size: 32rpx" >燃气管道及设施检查-管道(含公共管道)</view> 
					<u-row>
					<u-col>
						<u-form-item label="管道（含公共管道)" borderBottom ref="item1" placeholder="请输入编号" labelWidth="140">
							<u-radio-group v-model="form.pipeline"   >
								<u-radio @change="pipeline" v-for="(item, index) in typelist.pipeline_type"
									:key="index" :name="item.dictValue">
									{{item.dictLabel}}
								</u-radio>
							</u-radio-group>
						</u-form-item>
					</u-col>
					<u-col>
						<u-form-item label="详情" borderBottom ref="item1" placeholder="请输入编号" labelWidth="120">
							<u-input v-model="form.pipelineLabel" length='20px' placeholder=" "
								   type="digit" :clearable="false" @input="checkinletPressure"></u-input>
						</u-form-item>
					</u-col>
					</u-row>
				</u-row>
				<view class="small-title">燃气管道及设施检查-计量表具</view>
				<u-row>
					<u-col>
						<u-form-item label="计量表具" borderBottom ref="item1" placeholder="" labelWidth="200">
							<u-radio-group v-model="form.measuringInstruments"   >
								<u-radio @change="measuringInstruments"
									v-for="(item, index) in typelist.measuring_instruments" :key="index"
									:name="item.dictValue">
									{{item.dictLabel}}
								</u-radio>
							</u-radio-group>
						</u-form-item>
					</u-col>
					<view class="small-title">燃气管道及设施检查-连接管</view>
					<u-col>
						<u-form-item label="金属软管" borderBottom ref="item1" placeholder="" labelWidth="120" >
							<u-radio-group v-model="form.connectingPipe"   >
								<u-radio @change="connectingPipe"
									v-for="(item, index) in typelist.connecting_pipe_metal_hose" :key="index"
									:name="item.dictValue">
									{{item.dictLabel}}
								</u-radio>
							</u-radio-group>
						</u-form-item>
					</u-col>
					<u-col>
						<u-form-item label="胶管,点火棒" borderBottom ref="item1" placeholder="" labelWidth="120" >
							<u-radio-group v-model="form.connectingPipeB"   >
								<u-radio @change="connectingPipeB"
									v-for="(item, index) in typelist.connecting_pipe_metal_hose" :key="index"
									:name="item.dictValue">
									{{item.dictLabel}}
								</u-radio>
							</u-radio-group>
						</u-form-item>
					</u-col>
				</u-row>
				<view class="small-title">燃气管道及设施检查-凝水杠</view>
				<u-row gutter="12">
					<u-col span="12">
						<u-form-item label="外观" borderBottom ref="item1" placeholder="请输入编号"
							>
							<u-radio-group v-model="form.condensateBar"   >
								<u-radio @change="condensateBar"
									v-for="(item, index) in typelist.condensate_rod_appearance"
									:key="index" :name="item.dictValue">
									{{item.dictLabel}}
								</u-radio>
							</u-radio-group>
						</u-form-item>
					</u-col>
				</u-row>
				<view class="small-title">燃气管道及设施检查-有无私接私改</view>
				<u-row>
					<u-col>
						<u-form-item label="有无私接私改" borderBottom ref="item1" placeholder="请输入编号" labelWidth="200">
							<u-radio-group v-model="form.receptionModification"   >
								<u-radio @change="receptionModification"
									v-for="(item, index) in typelist.there_is_selflessness_and_private_reform"
									:key="index" :name="item.dictValue">
									{{item.dictLabel}}
								</u-radio>
							</u-radio-group>
						</u-form-item>
					</u-col>
					<view class="small-title">安全设施检查-压力表</view>
					<u-col>
						<u-form-item label="运行情况" borderBottom ref="item1" placeholder="请输入编号" labelWidth="200">
							<u-radio-group v-model="form.pressureStatus"   >
								<u-radio @change="pressureStatus"
									v-for="(item, index) in typelist.pressure_gauge_operation" :key="index"
									:name="item.dictValue">
									{{item.dictLabel}}
								</u-radio>
							</u-radio-group>
						</u-form-item>
					</u-col>
					<view class="small-title">安全设施检查-紧急切断阀</view>
					<u-col>
						<u-form-item label="外观" borderBottom ref="item1" placeholder="请输入编号" labelWidth="200">
							<u-radio-group v-model="form.emergencyShut"   >
								<u-radio @change="emergencyShut"
									v-for="(item, index) in typelist.emergency_shutoff_valve_appearance" :key="index"
									:name="item.dictValue">
									{{item.dictLabel}}
								</u-radio>
							</u-radio-group>
						</u-form-item>
					</u-col>
					<u-col>
						<u-form-item label="运行情况" borderBottom ref="item1" placeholder="请输入编号" labelWidth="200">
							<u-radio-group v-model="form.emergencyShutB"   >
								<u-radio @change="emergencyShutB"
									v-for="(item, index) in typelist.emergency_shutdown_valve_operation" :key="index"
									:name="item.dictValue">
									{{item.dictLabel}}
								</u-radio>
							</u-radio-group>
						</u-form-item>
					</u-col>
				</u-row>
				<view class="small-title">安全设施检查-安全阀</view>
				<u-row> </u-row>
				<u-col>
					<u-form-item label="外观" borderBottom ref="item1" placeholder="请输入编号" labelWidth="200">
						<u-radio-group v-model="form.safetyValve"   >
							<u-radio @change="safetyValve"
								v-for="(item, index) in typelist.safety_valve_appearance" :key="index"
								:name="item.dictValue">
								{{item.dictLabel}}
							</u-radio>
						</u-radio-group>
					</u-form-item>
				</u-col>
				<view class="small-title">安全用气环境检查</view>
				<u-row gutter="12">
				<u-col span="8">
					<u-form-item label="流向标识" borderBottom ref="item1" placeholder="请输入编号" labelWidth="140">
						<u-radio-group v-model="form.flowDirection"   >
							<u-radio @change="flowDirection"
								v-for="(item, index) in typelist.yes_and_no" :key="index"
								:name="item.dictValue">
								{{item.dictLabel}}
							</u-radio>
						</u-radio-group>
					</u-form-item>
				</u-col>
				<u-col span="4">
					<u-form-item label=" " borderBottom ref="item1" placeholder="请输入编号" labelWidth="0">
						<u-input v-model="form.flowDirectionLabel" length='15px' placeholder="请输入"
							  ></u-input>
					</u-form-item>
				</u-col>
				</u-row>
				<u-row gutter="12">
				<u-col span="8">
					<u-form-item label="有无易燃物" borderBottom ref="item1" placeholder="" labelWidth="160">
						<u-radio-group v-model="form.flammableMaterials"   >
							<u-radio @change="flammableMaterials"
								v-for="(item, index) in typelist.yes_and_no" :key="index"
								:name="item.dictValue">
								{{item.dictLabel}}
							</u-radio>
						</u-radio-group>
					</u-form-item>
				</u-col>
				<u-col span="4">
					<u-form-item label=" " borderBottom ref="item1" placeholder="" labelWidth="0">
						<u-input v-model="form.flammableMaterialsLabel" length='15px' placeholder="请输入"
							  ></u-input>
					</u-form-item>
				</u-col>
				</u-row>
				<u-row gutter="12">
				<u-col span="8">
					<u-form-item label="有无占压" borderBottom ref="item1" placeholder="" labelWidth="140">
						<u-radio-group v-model="form.pressure"   >
							<u-radio @change="pressure"
								v-for="(item, index) in typelist.yes_and_no" :key="index"
								:name="item.dictValue">
								{{item.dictLabel}}
							</u-radio>
						</u-radio-group>
					</u-form-item>
				</u-col>
				<u-col span="4">
					<u-form-item label=" " borderBottom ref="item1" placeholder="" labelWidth="0">
						<u-input v-model="form.pressureLabel" length='15px' placeholder="请输入"
							  ></u-input>
					</u-form-item>
				</u-col>
				</u-row>
				<u-row gutter="12">
				<u-col span="8">
					<u-form-item label="两气混用" borderBottom ref="item1" placeholder="" labelWidth="140">
						<u-radio-group v-model="form.mixingGases"   >
							<u-radio @change="mixingGases"
								v-for="(item, index) in typelist.yes_and_no" :key="index"
								:name="item.dictValue">
								{{item.dictLabel}}
							</u-radio>
						</u-radio-group>
					</u-form-item>
				</u-col>
				<u-col span="4">
					<u-form-item label=" " borderBottom ref="item1" placeholder="" labelWidth="0">
						<u-input v-model="form.mixingGasesLabel" length='15px' placeholder="请输入"
							  ></u-input>
					</u-form-item>
				</u-col>
				</u-row>
				<u-row gutter="12">
				<u-col span="8">
					<u-form-item label="重物搭挂" borderBottom ref="item1" placeholder="请输入编号" labelWidth="140">
						<u-radio-group v-model="form.heavyHanging"   >
							<u-radio @change="heavyHanging"
								v-for="(item, index) in typelist.yes_and_no" :key="index"
								:name="item.dictValue">
								{{item.dictLabel}}
							</u-radio>
						</u-radio-group>
					</u-form-item>
				</u-col>
				<u-col span="4">
					<u-form-item label=" " borderBottom ref="item1" placeholder="" labelWidth="0">
						<u-input v-model="form.heavyHangingLabel" length='15px' placeholder="请输入"
							  ></u-input>
					</u-form-item>
				</u-col>
				</u-row>
				<u-row gutter="12">
				<u-col span="8">
					<u-form-item label="电线缠绕" borderBottom ref="item1" placeholder="请输入编号" labelWidth="140">
						<u-radio-group v-model="form.wireTangle"   >
							<u-radio @change="wireTangle"
								v-for="(item, index) in typelist.yes_and_no" :key="index"
								:name="item.dictValue">
								{{item.dictLabel}}
							</u-radio>
						</u-radio-group>
					</u-form-item>
				</u-col>
				<u-col span="4">
					<u-form-item label=" " borderBottom ref="item1" placeholder="" labelWidth="0">
						<u-input v-model="form.wireTangleLabel" length='15px' placeholder="请输入"
							  ></u-input>
					</u-form-item>
				</u-col>
				</u-row>
				
				<view class="small-title">其他</view>
				<u-row>
					<u-col>
						<u-form-item label=" " labelWidth="0" borderBottom ref="item1">
							<u-input v-model="form.other" type="textarea" borderBottom placeholder="请填写备注信息内容"
								  ></u-input>
						</u-form-item>
					</u-col>
					<u-col>
						<u-form-item label=" " labelWidth="0" borderBottom ref="item1">
							<u-input v-model="form.WarningColumnInformation" disabled placeholder="请上传照片"></u-input>
							<view class="" style="display: flex; flex-wrap: wrap; margin: 0 55rpx;">
								<image src="https://cczdsz.cn/app/images/chooseimg.png" mode=""
									style="width: 190rpx; height: 190rpx; margin: 0 12rpx; " @click="choose()"
									  ></image>
								<view v-for="(item,index) in imgymxs" :key="index" style="position: relative;">
									<view v-if="item.type == 'image'">
										<image :src="item.url" mode=""
											style="width: 190rpx; height: 190rpx; margin: 0 20rpx;"
											@click="showPhoto(index)">
										</image>
									</view>
									<view v-else>
										<video :src="item"
											style="width: 190rpx; height: 190rpx; margin: 0 20rpx;"></video>
									</view>
									<view @click="remove(index)"   
										style="position: absolute; top: 0; right: 14rpx; border-radius: 50%; background-color: #FF0000;">
										<u-icon name="close" color="#FFFFFF" size="35"   ></u-icon>
									</view>
								</view>
							</view>
						</u-form-item>
					</u-col>
				</u-row>
			</u-form>

			<u-button class="from-but" style="margin: 40rpx 0;" @click="save() " v-if="type!=1"   
				type='primary'>确认上传</u-button>
				<u-button class="from-but" style="margin: 40rpx 0;" @click="update()"   
					type='primary' v-else>确认修改</u-button>
		</view>
		</u-form>
	
	</view>
	</view>
</template>
<script>
	import service from '@/api/index.js'
	export default {
		data() {
			return {
				params: {
					year: true,
					month: true,
					day: true,
					hour: true,
					minute: true,
					second: false
				},
				showtime2:false,
				action: this.$HTTP.webUrl + `/obs`,
				headers: {
					MAuthorization: "wxBearer " + uni.getStorageSync('token')
				},
				url: [],
				showadministrativeOffice:false,
				uploading: false,
				imgArr: [],
				PhotoList: [],
				community: '',
				building: '',
				unit: '',
				imgymxs: [],
				progress: 0, //图片或视频上传百分比
				showxtv: false,
				showvalveWellCondition: false,
				form: {
					userType: 1,
					valveAppearance: 0,
					sensitives: 0,
					type: 0,
					cabinetAppearance: 0,
					boilerAppearance: 0,
					boilerExterior: 0,
					pipeline: 0,
					measuringInstruments: 0,
					cateringStatus: 0,
					cateringExterior: 0,
					connectingPipe: 1,
					connectingPipeB: 1,
					condensateBar: 1,
					receptionModification: 1,
					pressureStatus: 1,
					combustibleGas: 1,
					emergencyShut: 1,
					emergencyShutB: 1,
					safetyValve: 1,
					flowDirectionLabel: '',
					flowDirection: 0,
					flammableMaterials: 0,
					pressure: 0,
					mixingGases: 0,
					heavyHanging: 0,
					wireTangle: 0,
					securityCheckOne: 0,
					securityCheckTwo: 0,
					representative: 0,
					phone: '',
					flammableMaterialsLabel: '',
					pressureLabel: '',
					mixingGasesLabel: '',
					heavyHangingLabel: '',
					wireTangleLabel: ''
				},
				xtvLabel: null,
				valveWellConditioLabel: null,
				// 表单校验
				communityName: '',
				communityId:'',
				time: '',
				showrepairType: false,
				showrepairType: null,
				checked: true,
				typelist: {},
				dictlist: ['yes_and_no','exterior','sensitive','box_type','pipeline_type','measuring_instruments',
    'catering_status','other_operating_conditions','other_appearance','pressure_gauge_operation','alarm_operation_a','alarm_operation_b',
    'emergency_shutoff_valve_appearance','emergency_shutdown_valve_operation','safety_valve_appearance','users_type','pressure_regulator_check_type'
  ,'pipelines_include_public_pipelines','measuring_instrument','connecting_pipe_metal_hose','connect_the_tube_the_glue_tube_ignition_rod','condensate_rod_appearance'
  ,'there_is_selflessness_and_private_reform'
				],
				type: 2,
				id: null,
				AdministrativeOfficeList:[],
				AdministrativeOfficeLabel:null,
				userId:null,createBy:null,
				administrativeOffice:null,
				code:null,
				name:null,
				showBoxDetails:false,
				managementOfficeId:null,
				boxform:{},
				pressureRegulatingBoxDetailsBo:{},
				team:null

			}
		},
		// onReady() {
		// 		uni.setNavigationBarTitle({
		// 			title: '调压箱表单'
		// 		});
		// 	},
		showPhoto(index) {
			uni.previewImage({
				current: index,
				urls: this.imgArr,
			})
		},

		showPhotos(index) {
			uni.previewImage({
				current: index,
				urls: this.photo,
			})
		},
		onLoad(e) {

			uni.setNavigationBarTitle({
				title: '非居民用户'
			});
			uni.setNavigationBarColor({
				frontColor: '#ffffff',
				backgroundColor: '#2d95f4',
			})
			let time1 = new Date()
			console.log(time1.toLocaleString())
			var year = time1.getFullYear(); //得到年份
			var month = time1.getMonth() + 1; //得到月份
			var date = time1.getDate(); //得到日期
			var hours = time1.getHours(); //获取系统时
			var Min = time1.getMinutes(); //分
			this.type = e.type
			this.id = e.id
			this.managementOfficeId=e.managementOfficeId
			this.time = year + "/" + month + "/" + date + "-" + hours + ":" + Min
			this.getdictsysinfo()
			this.getUserName()
			
			//this.getAdministrativeOffice(this.userId)

		},
		methods: {
			time2(e) {
				console.log(`${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}`)
				this.form.securityCheckTime = `${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}`
			},
			checkinletPressure(e) {
				console.log(e)
							//正则表达试
							e = (e.match(/^\d*(\.?\d{0,2})/g)[0]) || null
							//重新赋值给input
							this.$nextTick(() => {
								this.form.inletPressure= e
							})
						},
						checkexportPressureMain(e) {
							console.log(e)
										//正则表达试
										e = (e.match(/^\d*(\.?\d{0,2})/g)[0]) || null
										//重新赋值给input
										this.$nextTick(() => {
											this.form.exportPressureMain= e
										})
									},
									checkclosingPressureAccessory(e) {
										console.log(e)
													//正则表达试
													e = (e.match(/^\d*(\.?\d{0,2})/g)[0]) || null
													//重新赋值给input
													this.$nextTick(() => {
														this.form.closingPressureAccessory= e
													})
												},
												checkexportPressureAccessory(e) {
													console.log(e)
																//正则表达试
																e = (e.match(/^\d*(\.?\d{0,2})/g)[0]) || null
																//重新赋值给input
																this.$nextTick(() => {
																	this.form.exportPressureAccessory= e
																})
															},
															checkclosingPressureMain(e) {
																console.log(e)
																			//正则表达试
																			e = (e.match(/^\d*(\.?\d{0,2})/g)[0]) || null
																			//重新赋值给input
																			this.$nextTick(() => {
																				this.form.closingPressureMain= e
																			})
																		},
	checkcutOffPressureMain(e) {
		console.log(e)
					//正则表达试
					e = (e.match(/^\d*(\.?\d{0,2})/g)[0]) || null
					//重新赋值给input
					this.$nextTick(() => {
						this.form.cutOffPressureMain= e
					})
				},
				checkcutOffPressureAccessory(e) {
					console.log(e)
								//正则表达试
								e = (e.match(/^\d*(\.?\d{0,2})/g)[0]) || null
								//重新赋值给input
								this.$nextTick(() => {
									this.form.cutOffPressureAccessory= e
								})
							},
							checkreleasePressure(e) {
								console.log(e)
											//正则表达试
											e = (e.match(/^\d*(\.?\d{0,2})/g)[0]) || null
											//重新赋值给input
											this.$nextTick(() => {
												this.form.releasePressure= e
											})
										},
			getUserName(){
				service.getUserName().then(res=>{
					this.userId=res.id
					this.createBy=res.name
					this.team=res.ranks
					//this.getAdministrativeOffice(res.id)
					console.log(this.communityName)
				})
			},
		
			getdictsysinfo() {
				let _this = this
				service.getDictInfoList({
					type: this.dictlist
				}).then(res => {
					_this.typelist = res
					if (this.type == 1) {
						service.getpipelineGasUser(this.id).then(res => {
							// this.communityName = res.name
							// this.time = res.createTime
							if (null != res.photoList) {
								res.photoList.forEach(item => {
									let url = {}
									url.url = item
									url.type = 'image'
									this.imgymxs.push(url)
									this.imgArr.push(item)
								})
							}
							// let list = []
							// list = _this.typelist.xtv
							// list.forEach((item) => {
							// 	if (item.dictValue == res.xtv) {
							// 		_this.xtvLabel = item.dictLabel
							// 	}
							// })
							// let list2 = []
							// list2 = _this.typelist.valve_well_condition
							// list2.forEach((item) => {
							// 	if (item.dictValue == res.valveWellCondition) {
							// 		_this.valveWellConditioLabel = item.dictLabel
							// 	}
							// })
							// let list3 = []
							// list3 = _this.typelist.administrative_office
							// list3.forEach((item) => {
							// 	if (item.dictValue == res.administrativeOffice) {
							// 		_this.AdministrativeOfficeLabel = item.dictLabel
							// 	}
							// })
							this.form = res
							// this.managementOfficeId=this.form.parentId
						})
						console.log(res)
					}
				})
			},
			//外观
			userType(e) {
				this.$refs.form.userType = e
				console.log(e)
			},
			valveAppearance(e)
			{
				this.$refs.form.valveAppearance = e
				console.log(e)
			},
			sensitives(e)
			{
				this.$refs.form.sensitives = e
				console.log(e)
			},
			type(e)
			{
				this.$refs.form.type = e
				console.log(e)
			},
			//方砖
			boilerExterior(e) {
				this.$refs.form.boilerExterior = e
				console.log(e)
			},
			//护栏
			boilerAppearance(e) {
				this.$refs.form.boilerAppearance = e
				console.log(e)
			},
			//基础
			cateringStatus(e) {
				this.$refs.form.cateringStatus = e
				console.log(e)
			},
			//压力表
			cateringExterior(e) {
				this.$refs.form.cateringExterior = e
				console.log(e)
			},
			//阀门
			pipeline(e) {
				this.$refs.form.pipeline = e
				console.log(e)
			},
			//调压器
			measuringInstruments(e) {
				this.$refs.form.measuringInstruments = e
				console.log(e)
			},
			connectingPipe(e)
			{
				this.$refs.form.connectingPipe = e
				console.log(e)
			},
			//切断器(放散阀)测试情况
			connectingPipeB(e) {
				this.$refs.form.connectingPipeB = e
				console.log(e)
			},
			condensateBar(e)
			{
				this.$refs.form.condensateBar = e
				console.log(e)
			},
			//过滤器
			receptionModification(e) {
				this.$refs.form.receptionModification = e
				console.log(e)
			},
			pressureStatus(e)
			{
				this.$refs.form.pressureStatus = e
				console.log(e)
			},
			emergencyShut(e) {
				this.$refs.form.emergencyShut = e
				console.log(e)
			},
			emergencyShutB(e) {
				this.$refs.form.emergencyShutB = e
				console.log(e)
			},
			safetyValve(e) {
				this.$refs.form.safetyValve = e
				console.log(e)
			},
			flowDirection(e) {
				this.$refs.form.flowDirection = e
				// this.form.xtv = e[0].value
				// this.xtvLabel = e[0].label
				// console.log(this.xtvLabel)
			},
			flammableMaterials(e)
			{
				this.$refs.form.flammableMaterials = e
				console.log('11111',e)
			},
			pressure(e)
			{
				this.$refs.form.pressure = e
				console.log('11111',e)
			},
			mixingGases(e)
			{
				this.$refs.form.mixingGases = e
				console.log('11111',e)
			},
			heavyHanging(e)
			{
				this.$refs.form.heavyHanging = e
				console.log('11111',e)
			},
			wireTangle(e)
			{
				this.$refs.form.wireTangle = e
				console.log('11111',e)
			},
			update()
			{
				 let _this = this
				 this.form.pressureStatus = null
				// if(this.imgArr.length==0)
				// {
				// 	this.$UTILS.showPrompt('请上传照片或视频！')
				// 	return
				// }
				this.form.photoList = this.imgArr
				this.form.team=this.team
				// this.form.unitId = this.unit
				// this.form.areaId =  this.id
				//  this.form.userId=this.userId
				//  this.form.createBy=this.userId
				//  this.form.name=this.name
				 // this.form.administrativeOffice=this.administrativeOffice
				 // this.form.code=this.code
				 // this.form.name=this.name
				 // this.form.number=this.code
				service.updatepipelineGasUser(this.form).then(res => {
					console.log(res)
					_this.$UTILS.showPrompt('修改成功！')
					// setTimeout(() => {
					// 	console.log('跳')
					// 	uni.switchTab({
					// 		url: '/pages/index/index'
					// 	})
					// }, 2000)
				// 	this.form={businessService:0,
				// 	administrativeOffice:0,
				
				// 	businessService:0,
				// 	isNotXtv:0,
				// 	appearance:0,
				// 	squareBrick:0,
				// 	foundation:0,
				// 	pressureGage:0,
				// 	valve:0,
				// 	isThereALeak:0,
				// 	voltageRegulator:0,
				// 	xtv:0,
				// 	thermostat:0,
				// 	explosionProofSwitch:0,
				// 	cutterTested:0,
				// 	manOfAccessoryAlternating:0,
				// 	filter:0,
				// 	specialCaseOfPressureRegulatingFacilities:0,
				// 	overdueInspectionDays:3,
				// 	valveWellTesting:true,
				// 	guardrail:0}
				// 	this.AdministrativeOfficeLabel=this.AdministrativeOfficeList.filter(item=>item.value==this.administrativeOffice)[0].name
				// 	this.valveWellConditioLabel=''
				// 	this.xtvLabel=''
				// 	this.valveWellConditioLabel=''
				// 	//this.AdministrativeOfficeLabel=''
				// 	this.form.administrativeOffice=this.administrativeOffice
				// 	 this.form.number=this.code
					// this.imgArr=[]
					// this.imgymxs=[]
				})
			},

			save() {
				let _this = this
				// if(this.imgArr.length==0)
				// {
				// 	this.$UTILS.showPrompt('请上传照片或视频！')
				// 	return
				// }
				this.form.photoList = this.imgArr
				// this.form.unitId = this.unit
				// this.form.areaId =  this.id
			     this.form.userId=this.userId
				 this.form.createBy=this.userId
				 this.form.team=this.team
				 // this.form.parentId=this.managementOfficeId
				 // this.form.name=this.name
				 // this.form.administrativeOffice=this.administrativeOffice
				 // this.form.code=this.code
				 // this.form.name=this.name
				 // this.form.number=this.code
				service.setpipelineGasUser(this.form).then(res => {
					console.log(res)
					_this.$UTILS.showPrompt('上报成功！')
					// setTimeout(() => {
					// 	console.log('跳')
					// 	uni.switchTab({
					// 		url: '/pages/index/index'
					// 	})
					// }, 2000)
					this.form={
       userType: 1,
       valveAppearance: 0,
       sensitives: 0,
       type: 0,
       cabinetAppearance: 0,
       boilerAppearance: 0,
       boilerExterior: 0,
       pipeline: 0,
       measuringInstruments: 0,
       cateringStatus: 0,
       cateringExterior: 0,
       connectingPipe: 1,
       connectingPipeB: 1,
       condensateBar: 1,
       receptionModification: 1,
       pressureStatus: 1,
       combustibleGas: 1,
       emergencyShut: 1,
       emergencyShutB: 1,
       safetyValve: 1,
       flowDirectionLabel: '',
       flowDirection: 0,
       flammableMaterials: 0,
       pressure: 0,
       mixingGases: 0,
       heavyHanging: 0,
       wireTangle: 0,
       securityCheckOne: 0,
       securityCheckTwo: 0,
       representative: 0,
       phone: '',
       flammableMaterialsLabel: '',
       pressureLabel: '',
       mixingGasesLabel: '',
       heavyHangingLabel: '',
       wireTangleLabel: ''}
					// this.AdministrativeOfficeLabel=this.AdministrativeOfficeList.filter(item=>item.value==this.administrativeOffice)[0].name
					// this.valveWellConditioLabel=''
					// this.xtvLabel=''
					// this.valveWellConditioLabel=''
					// //this.AdministrativeOfficeLabel=''
					// this.form.administrativeOffice=this.administrativeOffice
					//  this.form.parentId=this.managementOfficeId
					//  this.form.number=this.code
					// this.imgArr=[]
					// this.imgymxs=[]
				})
			},
			choose() {
				let _this = this;
				uni.showActionSheet({
					title: '上传',
					itemList: ['图片', '视频'],
					success: (res) => {
						// console.log(res)
						if (res.tapIndex == 0) {
							this.chooseimage()
						} else {
							this.choosevideo()
						}
					}
				})
			},
			showPhoto(index) {
				uni.previewImage({
					current: index,
					urls: this.imgArr,
				})
			},
			showPhotos(index) {
				uni.previewImage({
					current: index,
					urls: this.photo,
				})
			},
			chooseimage() {
				console.log('图片')
				let _this = this;
				uni.chooseImage({
					sourceType: ['camera'],
					success(resp) {
						console.log('res--uni.chooseMedia', resp);
						resp.tempFiles.forEach((item, index) => {
							const task = uni.uploadFile({
								url: _this.$HTTP.webUrl + `/obs`,
								filePath: item.path,
								name: 'file',
								formData: {},
								header: _this.headers,
								success: res => {
									// 判断是否json字符串，将其转为json格式
									let data = _this.$u.test.jsonString(res.data) ? JSON.parse(
										res.data) : res.data;
									if (![200, 201, 204].includes(res.statusCode)) {
										// this.uploadError(index, data);
										_this.$UTILS.showPrompt('选取失败！')
									} else {
										// 上传成功
										// this.lists[index].response = data;
										// this.lists[index].progress = 100;
										// this.lists[index].error = false;
										// this.$emit('on-success', data, index, this.lists, this
										// 	.index);
										if (_this.progress === 100) {
											// console.log('_this.progress', _this.progress)
											// console.log('data----', data)
											// console.log('res--', res)
											_this.imgymxs.push({
												url: data.data.url,
												type: 'image'
											})
											_this.imgArr.push(data.data.url)
											// console.log('imgArr', _this.imgArr)
											_this.$UTILS.showPrompt('选取成功！')
										}
									}
								},
								fail: e => {
									_this.$UTILS.showPrompt('选取失败！')
									this.uploadError(index, e);
								},
								complete: res => {
									_this.uploading = false;
									// _this.uploadFile(index + 1);
									// this.$emit('on-change', res, index, this.lists, this
									// .index);
								}
							});
							task.onProgressUpdate(res => {
								// if (res.progress > 0) {
								// 	this.lists[index].progress = res.progress;
								// 	this.$emit('on-progress', res, index, this.lists, this.index);
								// }
								_this.progress = res.progress;
								console.log('onProgressUpdate', res)
								uni.showLoading({
									title: '选取中'
								})
							});
						})
					},
				})
			},
			choosevideo() {
				let _this = this;
				console.log('视频')
				uni.chooseVideo({
					sourceType: ['camera'],
					maxDuration: 30,
					success(resp) {
						const task = uni.uploadFile({
							url: _this.$HTTP.webUrl + `/obs`,
							filePath: resp.tempFilePath,
							name: 'file',
							formData: {},
							header: _this.headers,
							success: res => {
								// 判断是否json字符串，将其转为json格式
								let data = _this.$u.test.jsonString(res.data) ? JSON.parse(res.data) :
									res.data;
								if (![200, 201, 204].includes(res.statusCode)) {
									this.uploadError(index, data);
								} else {
									// 上传成功
									// this.lists[index].response = data;
									// this.lists[index].progress = 100;
									// this.lists[index].error = false;
									// this.$emit('on-success', data, index, this.lists, this
									// 	.index);
									if (_this.progress === 100) {
										console.log('_this.progress', _this.progress)
										console.log('data----', data)
										console.log('res--', res)
										// _this.imgArr.push(data.data.url)
										_this.imgymxs.push({
											url: data.data.url,
											type: 'video'
										})
										_this.imgArr.push(data.data.url)
										console.log('imgArr', _this.imgArr)
										_this.$UTILS.showPrompt('选取成功！')
									}
								}
							},
							fail: e => {
								_this.$UTILS.showPrompt('选取失败！')
								this.uploadError(index, e);
							},
							complete: res => {
								uni.hideLoading();
								_this.uploading = false;
								// _this.uploadFile(index + 1);
								// this.$emit('on-change', res, index, this.lists, this
								// .index);
							}
						});
						task.onProgressUpdate(res => {
							// if (res.progress > 0) {
							// 	this.lists[index].progress = res.progress;
							// 	this.$emit('on-progress', res, index, this.lists, this.index);
							// }
							_this.progress = res.progress;
							console.log('onProgressUpdate', res)
							uni.showLoading({
								title: '选取中'
							})
						});
					},
				})
			},
			remove(index) {
				uni.showModal({
					title: '提示',
					content: '是否删除该图片或视频？',
					success: (res) => {
						if (res.confirm) {
							this.imgArr.splice(index, 1);
							this.imgymxs.splice(index, 1);
							console.log('this.imgArr', this.imgArr)
						}
					}
				})
			},
		}
	}
</script>
<style>
	.project-content {
		padding: 0rpx 20rpx;
		border-radius: 20rpx;
		width: 90%;
		margin: 0 auto;
		background: #fff;
	}

	.background {
		z-index: -1;
		position: fixed;
		width: 100%;
		height: 100%;
		background-size: 100% 100%;
	}

	.top-left {
		display: flex;
		align-items: center;
	}

	.small-title {
		font-size: 38rpx;
		color: #2d95f4;
		margin: 20rpx 0;
	}

	.form-item {
		display: flex;
		align-items: center;
		font-size: 32rpx;
		border: none;
	}

	.danwei {
		text-align: center;
		line-height: 110rpx;
	}

	.un-row {
		text-align: left;
	}

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

	.top-icon {
		font-size: 40rpx;
		color: #2d95f4;
	}
</style>
