<template>
	<view class="page">
		<view class="top_container" style="padding-right: 30upx;clear: both;overflow: auto;" v-show="num==2">
			<view class="btn"   @click="sendMsg()">回复</view>
		</view>
		<view class="detail_name_container">
			<view :class="[current_num==1?'current':'']" @click="changecurrent(1)">月报信息</view>
			<view :class="[current_num==2?'current':'']" @click="changecurrent(2)">回复消息</view>
		</view>
		<view v-if="current_num==1">
			<view class="myContainer myContentBox">
				<view class="top_container">基本信息</view>
				<view class="list_item">
					<view class="list_item_name">姓名</view>
					<view class="list_item_content content_right">{{info.createByName}}</view>
				</view>
				<view class="list_item">
					<view class="list_item_name">部门</view>
					<view class="list_item_content content_right">{{info.createDeptName}}</view>
				</view>
				<view class="list_item">
					<view class="list_item_name">创建时间</view>
					<view class="list_item_content content_right">{{info.create_time}}</view>
				</view>
			</view>
			<!-- <view class="myContainer myContentBox">
				<view class="list_item" style="padding: 20upx 0px">
					<view class="list_item_name" style="color:#333;">
						<view>工作月报</view>
						<view>{{info.create_time||'-'}}</view>
					</view>
					<view class="list_item_content content_right">
						<view>姓名：{{info.createByName||'-'}}</view>
						<view>部门：{{info.createDeptName||'-'}}</view>
					</view>
				</view>
			</view> -->
			<view class="myContainer redMi acceptTitle">本月完成工作</view>
			<view class="myContainer myContentBox">
				<view class="resultContent">{{info.com_content||''}}</view>
			</view>
			<view class="myContainer acceptTitle">本月未完成工作</view>
			<view class="myContainer myContentBox">
				<view class="resultContent">{{info.uncom_content||''}}</view>
			</view>
			<view class="myContainer acceptTitle">本月需协调工作</view>
			<view class="myContainer myContentBox">
				<view class="resultContent">{{info.need_concert_content||''}}</view>
			</view>
			<view class="myContainer acceptTitle">本月必做事项</view>
			<view class="myContainer myContentBox">
				<view class="resultContent">{{info.must_contet||''}}</view>
			</view>
			<view class="myContainer acceptTitle">本月待定事项</view>
			<view class="myContainer myContentBox">
				<view class="resultContent">{{info.wait_contet||''}}</view>
			</view>
			<view v-if="initFileList.length>0">
				<view class="myContainer acceptTitle">图片</view>
				<view class="myCon myContentBox">
					<view class="resultContent" style="height: 26upx; padding: 0px;"></view>
					<view class="img-wrap" v-for="(items,index) in initFileList" :key='index'>
						<view class="img-box">
							<img :src="config.imgURL+'/'+items.filePath" />
						</view>
					</view>
				</view>
			</view>
		</view>
		<view v-else-if="current_num==2">
			<view class="myCon myContentBox" v-if="approvalList.length>0">
				<uni-steps :options="approvalList" :active="approvalList.length" direction="column" />
			</view>
		</view> 
		<view class="goHome" @click='goMain("dailyInfo")'>
			<img src="../../static/img/gohome.png">
		</view>
	</view>
</template>

<script>
	import {
		config
	} from '../../request/js/config.js'
	import uniSteps from '@/components/uni-steps/uni-steps.vue'
	export default{
		components: {
			uniSteps
		},
		data(){
			return {
				current_num:1,
				config:config,
				info:{},
				initFileList:[],
				id:'',
				approvalList:[],
				num:''
			}
		},
		onLoad(option) {
			this.id=option.id;
			this.num = option.num;
			if(this.id==undefined){
				uni.reLaunch({
				    url: 'month'
				});
				return false;
			}
		    var _this = this;
		    this.$http.request({
				 url: '/apis/monthReport/detail',
				 params: {
				   id:_this.id
				 },
		   }).then(res=>{
			if(res.data.code == 0){
				this.info = res.data.monthReport;
				this.initFileList = res.data.initFileList;
				if(res.data.commentList && res.data.commentList.length>0){
					res.data.commentList.forEach(function(val,index){
						var myjson = {
							title: val.createByName+':'+val.comment,
							desc: val.createTime?('时间：'+val.createTime):'时间：'
						}
						// if(val.isDealed){
						// 	_this.active = index;
						// }
						_this.approvalList.push(myjson);
					});
				}
			}else{
				uni.showToast({
					title: '获取信息失败',
					duration: 	1000,
					icon:"none"
				});
			}
		   }).catch(err=>{
			   console.log(err)
		   });
			
		},
		methods:{
			changecurrent(num){
				this.current_num=num;
			},
			sendMsg(){
				uni.redirectTo({
				    url: "sendMsg?id="+this.id
				});
			},
		}
	}
</script>
<style scoped>
	.btn{
		width: 160upx;
		height:68upx;
		text-align: center;
		line-height: 68upx;
		border-radius: 10upx;
		background-color: #3382FF;
		color: #fff;
		font-size: 28upx;
		float: left;
		margin-right: 30upx;
		float:right
	}
</style>