<template>
	<view class="bodyContainer">
		<uni-nav-bar @clickLeft="goBack()" class="nav-bar" height="110rpx" leftWidth="200rpx" leftText="作业详情"
			leftIcon="left" border backgroundColor="#2cade8" color="#fff" fixed statusBar shadow></uni-nav-bar>
		<view class="wrap-view wrap-top">
			<view class="item title"> <text class="blueLine"></text>项目信息：</view>
			<view class="item">
				<view class="title">作业简介</view>
				<view class="content">
					<text>{{formData.name}}</text>
				</view>
			</view>
			<view class="item">
				<view class="title">作业状态</view>
				<view class="content">
					<text>{{stateOptions[formData.state]}}</text>
				</view>
			</view>
			<view class="item">
				<view class="title">具体地点</view>
				<view class="content">
					<text>{{formData.place}}</text>
				</view>
			</view>
			<view class="item">
				<view class="title">开始时间</view>
				<view class="content">
					<text>{{formData.start_time}}</text>
				</view>
			</view>
			<view class="item">
				<view class="title">结束时间</view>
				<view class="content">
					<text>{{formData.end_time}}</text>
				</view>
			</view>
			<view class="item">
				<view class="title">生产状态</view>
				<view class="content">
					<text>{{formData.state_work}}</text>
				</view>
			</view>
			<view class="item">
				<view class="title">作业区域</view>
				<view class="content">
					<text>{{formData.area_.name}}</text>
				</view>
			</view>
			<view class="item">
				<view class="title">业务部门</view>
				<view class="content">
					<text>{{formData.dept_bus_.name}}</text>
				</view>
			</view>
			<view class="item">
				<view class="title">部门协调员</view>
				<view class="content">
					<text>{{formData.coordinator_.name}}</text>
				</view>
			</view>
			<view class="item">
				<view class="title">属地部门</view>
				<view class="content">
					<text>{{formData.dept_ter_.name}}</text>
				</view>
			</view>
			<view class="item">
				<view class="title">监控设备</view>
				<view class="content">
					<text v-if="formData.vchannels_"><span v-for="item in formData.vchannels_" :key="item.id">
							{{ item.name}}({{item.code}})/
						</span></text>
				</view>
			</view>
		</view>
		<view class="wrap-view wrap-top">
			<view class="item title"> <text class="blueLine"></text>作业证书列表：</view>
			<view class="visitorsWrap">
				<view class="visitorsItem itemTitle">
					<text class="visitorCell">种类</text>
					<text class="visitorCell">级别</text>
					<text class="visitorCell">状态</text>
					<text class="visitorCell">操作</text>
				</view>
				<view class="visitorsItem" v-for="item in oplList" :key="item.id">
					<text class="visitorCell">{{item.cate_name}}</text>
					<text class="visitorCell">{{item.level}}</text>
					<text class="visitorCell"> 
						<text v-if="item.ticket_&&item.ticket_.state_">
						{{item.ticket_.state_.name }}-{{act_states[item.ticket_.act_state]}}
						</text>
					</text>
					<view class="visitorCell">
						<!-- <text class="bindBtn">绑卡</text> -->
						<text class="bindBtn" @click="oplDetail(item.id)">查看</text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "operationDetail",
		data() {
			return {
				formData:{
					name:'',
					place:'',
					start_time:'',
					end_time:'',
					state_work:'',
					place:'',
					area_:{},
					dept_bus_:{},
					coordinator_:{},
					dept_ter_:{},
				},
				oplList:[],
				act_states: {
					0: "草稿中",
					1: "进行中",
					2: "被退回",
					3: "被撤回",
					4: "已完成",
					5: "已关闭",
				},
				stateOptions: {
					10: "创建中",
					20: "审批中",
					30: "待作业",
					40: "作业中",
					50: "已关闭",
				},
			}
		},
		onLoad(params) {
			this.operationId = params.operationId;
			this.getOperation();
		},
		onShow() {
			this.getOplList();
		},
		methods: {
			//获取工作operation
			getOperation() {
				debugger;
				let that = this;
				that.$u.api.operationItem(that.operationId).then((res) => {
					that.formData ={...res} ; 
					debugger;
				});
			},
			//
			//获取已有证书
			getOplList() {
				let that = this;
				that.$u.api.oplLists({operation: that.operationId,page:0}).then(res => {
					that.oplList =res;
				})
			},
			oplDetail(id){
				const params = `?oplId=${id}`;
				uni.navigateTo({
					url: '/pages/workSpace/operation/oplDetail' + params,
				})
			},
			goBack() {
				uni.navigateBack({
					delta: 1
				})
			},

		}
	}
</script>

<style scoped>
	uni-page-body {
	    color: #303133;
	    font-size: 15px;
	    height: 100%;
	    background: #f3fbff;
	}
	.bodyContainer {
	    background-color: #f3fbff;
	}
	>>>.uni-navbar__header,
	>>>.uni-status-bar {
		background-image: linear-gradient(254deg,
				#0ca7ee 0%,
				#005aff 100%,
				#2a8cff 100%,
				#54bdff 100%),
			linear-gradient(#e60012,
				#e60012);
	}
>>>uni-image{
	height: 200upx;
	width: 200upx;
}
	.my-data {
		background-color: #f3fbff;
		padding-bottom: 227rpx;
	}

	.nav-bar>>>.uni-navbar-btn-text text {
		font-size: 32rpx !important;
	}

	.wrap-view {
		width: 720rpx;
		margin: 0 auto;
		background-color: #ffffff;
		border-radius: 10rpx;
		line-height: 94rpx;
		font-family: PingFang-SC-Medium;
		font-size: 30rpx;
		padding-bottom: 30upx;
	}
	.wrap-top{
		line-height: 60upx;
		margin-top: 20upx;
	}
	.item {
		margin: 0rpx 32rpx;
		display: flex;
		margin-top: 10rpx;
	}
	.item.title{
		    height: 100upx;
		    line-height: 100upx;
		    border-bottom: 1upx solid #dddddd;
	}
	.item_bottom_border{
		border-bottom: 1rpx solid #eeeeee;
	}
	
	.title {
		color: #212121;
		flex: 1;
	}

	.content {
		flex: 3;
		color: #666666;

	}
	.visitorsWrap{
		
	}
	
	.visitorsItem{
		display: flex;
		font-size: 28upx;
	}
	
	.itemTitle{
		height: 80upx;
		font-size: 32upx;
		line-height: 80upx;
	}
	.itemTitle>.visitorCell{
		color: #212121;
	}
	.visitorCell{
		flex: 1;
		color: #666666;
		text-align: center;
	}
	.blueLine{
		height: 24upx;
		width: 10upx;
		background: #2a8cff;
		margin-top: 39upx;
		margin-right: 12upx;
	}
	.bindBtn{
		    width: 80upx;
		    height: 50upx;
		    line-height: 50upx;
		    background: #2a8cff;
		    display: inline-block;
		    border-radius: 16upx;
		    color: #ffffff;
		    font-size: 25upx;
	}
</style>
