<template>
	<view class='container'>
		<view>
			<view class="justify-between">
				<view class="flex-item">任务名称</view>
				<view class="flex-item">{{item.mission?item.mission.name:''}}</view>
			</view>
			<view class="justify-between">
				<view class="flex-item">巡查日期</view>
				<view class="flex-item">{{item.date}}</view>
			</view>
			<view class="justify-between">
				<view class="flex-item">巡查地点</view>
				<view class="flex-item">{{item.site?item.site.name:item.address}}</view>
			</view>
			<view class="justify-between">
				<view class="flex-item">问题类型</view>
				<view class="flex-item">{{item.ask?item.ask.value:''}}</view>
			</view>
			<view class="justify-between">
				<view class="flex-item">建议整改科室</view>
				<view class="flex-item">{{item.ask_department?item.ask_department:''}}</view>
			</view>
			<view class="justify-between justify-column">
				<view class="flex-item">附件</view>
				<view class="flex-item">
				<uni-file-picker v-model="item.files" readonly fileMediatype="image" mode="grid"/>
				</view>
			</view>
			<view class="justify-between justify-column">
				<view class="flex-item">问题描述</view>
				<view class="flex-item">{{item.ask_introduce}}</view>
			</view>
			<view class="justify-between justify-column">
				<view class="flex-item">整改建议</view>
				<view class="flex-item">{{item.tips}}</view>
			</view>
		
			<block v-if='item.status==5'>
				<view class="justify-between">
					<view class="flex-item">计划完成日期</view>
					<view class="flex-item">{{item.plan_end_date?item.plan_end_date:''}}</view>
				</view>
				<view class="justify-between justify-column">
					<view class="flex-item">责任对象</view>
					<view class="flex-item">
						<text v-if="item.accept_admin_ids_details.length>0">
							<text style="margin-right:3px" v-for="item in item.accept_admin_ids_details">
								{{item.name}}
							</text>
						</text>
						<text v-if="item.accept_department_ids_details.length>0">
							<text style="margin-right:3px" v-for="item in item.accept_department_ids_details">
								{{item.name}}
							</text>
						</text>
					</view>
					<!-- <view class="flex-item">{{item.duty_admin?item.duty_admin.name:''}}</view> -->
				</view>
				<view class="justify-between">
					<view class="flex-item">完成情况</view>
					<view class="flex-item">{{item.fix_status==1?'已完成':'已列计划'}}</view>
				</view>
				<view class="justify-between">
					<view class="flex-item">时间</view>
					<view class="flex-item">{{item.fix_end_date?item.fix_end_date:''}}</view>
				</view>

				<view class="justify-between">
					<view class="flex-item">整改说明</view>
					<view class="flex-item">{{item.fix_introduce?item.fix_introduce:''}}</view>
				</view>
				<view class="justify-between justify-column">
					<view class="flex-item">整改附件</view>
					<view class="flex-item">
					<uni-file-picker v-model="item.fix_files" readonly fileMediatype="image" mode="grid"/>
					</view>
				</view>
			</block>
			
			
			
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				id:'',
				item:{}
			}
		},
		onLoad(options) {
			this.id=options.id?options.id:''
			this.getDetail(this.id)
		},
		methods:{
			getDetail(id){
				if(!id){
					uni.showToast({
						title: '暂无相关信息',
						icon: 'none'
					});
					return;
				}
				let that = this
				this.util.request({
					api: '/api/admin/inspection/show',
					data: {
						id:id
					},
					method: 'GET',
					utilSuccess: function(res) {
						that.item = res
					},
					utilFail: function(res) {
						that.util.toast(res)
					}
				})
			}
		}
	}
</script>

<style scoped>
	.container{
		min-height:100vh;
		background-color: #fff;
		padding:30rpx;
		margin-top:-30rpx;
	}
	.justify-between{
		display: flex;
		justify-content: space-between;
		padding:20rpx;
		border-bottom: 1px #DCDCDC solid;
	}
	.justify-between .flex-item{
		padding:0 10rpx
	}
	.justify-between .flex-item:first-child{
		min-width:160rpx
	}
	.justify-between .flex-item:last-child{
		color: rgba(0,0,0,0.5);
	}
	.justify-column{
		display: flex;
	    flex-direction: column;
	}
</style>