<template>
	<view class="appWrapper archiveDetail">
		<form action="">
			<view class="form-item">
				<view class="title">
					户号:
				</view>
				<view class="sub">{{detailInfo.account_number}}</view>
			</view>
			<view class="form-item">
				<view class="title">流变变比:</view>
				<view class="sub">{{detailInfo.rheological_change}}</view>
			</view>
			<view class="form-item">
				<view class="title" style="width:240rpx">单路电源容量:</view>
				<view class="sub">{{detailInfo.power_capacity}}</view>
			</view>
			<view class="form-item">
				<view class="title">线路:</view>
				<view class="sub">{{detailInfo.route_name}}</view>
			</view>
			<view class="form-item">
				<view class="title">站点名称:</view>
				<view class="sub">{{detailInfo.site_name}}</view>
			</view>
			<view class="form-item">
				<view class="title">监察:</view>
				<view class="sub">{{detailInfo.supervision_name}}</view>
			</view>
			<view class="form-item">
				<view class="title">电试报告时间:</view>
				<view class="sub">{{detailInfo.electric_test_overdue}}</view>
			</view>
			<view class="eleTime">
				<image src="/static/noteIcon.png"></image>
				<view>距离电试超期还有 <span>{{detailInfo.electric_test_overdue_bz}}</span> 天</view>
			</view>

			<view class="info-tit margin-left-xs">
				<text class="cuIcon-titles margin-right-xs"></text>
				现场问题
			</view>
			<block v-for="(item,index) in  problem_one">
				<view class="form-item  flex justify-between">
					<view class="title" style="width:70%">{{item.name}}:</view>
					<view class="margin-right flex align-center">
						<label class="margin-right-xl">
							<radio disabled="true" value="是" checked /><text>是</text>
						</label>
						<view @click="previewImage(item)">
							<image :src="item.picture?item.picture:'/static/cameraIcon2.png'" mode="aspectFit"></image>
						</view>

					</view>
				</view>
			</block>
			<block v-if="!this.control">
				<view class="info-tit margin-left-xs">
					<text class="cuIcon-titles margin-right-xs"></text>
					其他
				</view>

				<view class="form-item  flex justify-between" v-for="(item,index) in problem_two">
					<view class="title" style="width:70%">{{item.name}}:</view>
					<view class="margin-right flex align-center">
						<label class="" v-if="item.where==0">
							<radio disabled="true" value="否" checked /><text>否</text>
						</label>
						<label class="" v-if="item.where==2">
							<radio disabled="true" value="其他" checked /><text>其他</text>
						</label>
					</view>
				</view>


				<view class="form-item remark">
					<view class="title">备注:</view>
					<textarea name="" id="" disabled="true" v-model="detailInfo.remarks"></textarea>
				</view>
			</block>

			<view v-if="this.control&&Object.keys(this.detailInfo).length!=0"
				class="btn-area submitBottomBtn padding-lr-sm  " style="position:static">
				<button class="bg-blue round  margin-top" @click="goArchiveEdit()">编 辑 </button>
			</view>

			<br>
		</form>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				detailInfo: {},
				control: '',
				id: '',
				problem_one: [],
				problem_two: [],
			}
		},
		onLoad: function(option) {
			if (option.siteId) {
				this.getDataList({
					"site_id": option.siteId
				})
			} else {
				this.getDataList({
					"id": option.id
				})
			}
			this.control = option.mark;

			this.id = option.id;

		},
		methods: {
			previewImage(item) {
				// alert(1)
				uni.previewImage({
					urls: [item.picture ? item.picture : "/static/cameraIcon2.png"]
				});

			},
			goArchiveEdit() {
				uni.navigateTo({
					url: '/pages/siteArchive/siteArchiveAdd/siteArchiveAdd?id=' + this.id,
				});
			},
			//数据请求
			async getDataList(params = {}) {
				const res = await this.$myRequest({
					url: 'Archives/getArchivesList1',
					showLoading: true,
					data: params
				})
				this.detailInfo = res.data.data[0];
				this.problem_one = this.detailInfo.problem_one;
				this.problem_two = this.detailInfo.problem_two
				if (!this.detailInfo.account_number) {
					uni.showToast({
						title: "暂无档案信息!",
						icon: "none"
					});
				}
			},
		}
	}
</script>

<style lang="scss">
	.form-item .title {
		width: 242rpx
	}
</style>
