<template>
	<view class="container uni-container">
		<view class=" flex  flex-direction width100">
				<text class="text-xl font-weight-700">任务介绍</text> 
				<!-- 注意，如果需要兼容微信小程序，最好通过setRules方法设置rules规则 -->
				<u--form ref="uForm" :model="formData" labelPosition="left" labelWidth="70" labelAlign="left">
					<u-form-item label="检查项目" prop="name" ref="item1">
						<text class="text-cut padding-sm">{{formData.name}}</text>
					</u-form-item>
					<u-form-item label="检查人" prop="people" ref="item1">
						<text class="text-cut padding-sm">{{formData.people}}</text>
					</u-form-item>
					<u-form-item label="检查位置" prop="position" ref="item1">
						<text class="text-cut padding-sm"> {{formData.position}}</text>
					</u-form-item>
					<u-form-item label="检查时间" prop="time" ref="item1">
						<text class="text-cut padding-sm"> {{formData.time}} </text>
					</u-form-item>
					<u-form-item label="详情描述" prop="description" ref="item1">
						<text class="  padding-sm"> {{formData.description}}</text>
					</u-form-item>
					<u-form-item label="设备扫码" prop="status" ref="item1">
						<text class="text-cut padding-sm"
							:style="{color:(formData.status==='0'||formData.status==='3'?'red':formData.status==='1'?'green':'blue')}">
							{{statusListTran(formData.status)}}</text>
					</u-form-item> 
					<u-form-item label="现场图片"  prop="imgurl" ref="item1">
						<u-album :urls="formData.imgurl"></u-album>
						
					</u-form-item> 
				</u--form>
		<!-- 	 <uni-row :gutter="20">
			 	<uni-col :span="12">
			 		<u-button @click="submit('customForm')" shape="circle" size="small" color="#2563EB" text="立即整改"></u-button>
			 	</uni-col>
			 	<uni-col :span="12">
			 		<u-button @click="submit('customForm')" shape="circle" size="small" color="#2563EB" text="生成隐患"></u-button>
			 	</uni-col>
			 </uni-row> -->
			</view>
		</view>
	</view>
</template>
<script>
	import {
		getCheckActiveHistoryDetails, // 主动检查详情
	} from "@/api/check_active";
	import {
		uploadAvatar
	} from "@/api/system/user"
	let that = null;
	export default {
		data() {
			return {
				statusList:{
					0: "设备未扫码" ,
					1: "设备已扫码" , 
				},
				// 自定义表单数据
				formData: {
					id:'',
					name:'',
					position:'',
					time:'', 
					description:'',
					status:'',
					people:'',
					imgurl:[], 
				}, 
				fileList1: [],
				limitstatus: ['png', 'jpg', 'jpeg'], // 允许的图片后缀 
			}
		},
		computed: {},
	//目的页面接收
	//这里用onshow()也可以
	onLoad(options) {
	    var data = options.id;
		this.getData(data)
	},
	// onLoad: function(option) {
	// 	that = this;
	// 	const eventChannel = this.getOpenerEventChannel();
	// 	// eventChannel.emit('acceptDataFromOpenedPage', {
	// 	// 监听acceptDataFromOpenerPage事件，获取上一页面通过eventChannel传送到当前页面的数据
	// 	eventChannel.on('acceptDataFromOpenerPage', function(val) {
	// 		console.log(' val', val) 
	// 		that.getData(val.id)
	// 	})
	// },
		onReady() {},
		methods: {
			// =================数据转换==================
			statusListTran(val) { //status状态转换
				return this.statusList[val]
			},
			// =============获取数据===================s
		// =============获取数据===================s
		// 获取数据
		getData(id) {
			this.loading = true
			getCheckActiveHistoryDetails({
				id: id
			}).then(response => {
				// 为数据赋值：通过展开运算符的形式，进行新旧数据的拼接 
				this.formData = response.data
				this.loading = false;
			});
		},
		// ==============================
		}
	}
</script>
<style lang="scss">
	.buttomBorder {
		height: 0px;
		border: 1px dashed #CBD5E1;
	}
</style>
