<template>
	<view class="todo-page">
		<uni-card margin="0" :is-shadow="true">
			<u--form labelPosition="left" labelWidth="auto" labelAlign="center" :model="model">
				<u-form-item label="考核年度：" prop="YEAR" borderBottom>
					<u--input v-model="model.YEAR" border="none" slot="right" inputAlign="right" disabled
						disabledColor="#fff"></u--input>
				</u-form-item>
				<u-form-item label="考核周期：" prop="ASSESSMENT_CYCLE" borderBottom>
					<u--input v-model="model.ASSESSMENT_CYCLE" border="none" slot="right" inputAlign="right" disabled
						disabledColor="#fff"></u--input>
				</u-form-item>
				<u-form-item label="被考核部门：" prop="Nav_Department.NAME" borderBottom>
					<u--input v-model="model.Nav_Department.NAME" border="none" inputAlign="right" disabled
						disabledColor="#fff"></u--input>
				</u-form-item>
				<u-form-item label="被考核人员：" prop="Nav_User.NAME" borderBottom>
					<u--input v-model="model.Nav_User.NAME" border="none" slot="right" inputAlign="right" disabled
						disabledColor="#fff"></u--input>
				</u-form-item>
				<u-form-item label="考核人员：" prop="CHARGE_NAME" borderBottom>
					<u--input v-model="model.CHARGE_NAME" border="none" slot="right" inputAlign="right" disabled
						disabledColor="#fff"></u--input>
				</u-form-item>
				<u-form-item label="考核内容" prop="Contents" borderBottom>
				</u-form-item>
				<u--textarea autoHeight type="textarea" disabled v-model="model.Contents" border="none"
					style="line-height: 100;"
					inputAlign="right">
				</u--textarea>
			</u--form>
		</uni-card>
	</view>
</template>

<script>
	import {
		initFilter,
		extendRule,
		extendInclude
	} from '../../../../utils/common'

	import {
		getRequest,
	} from '../../../../services/apply/FOServices/FOServices'

	import '../../../../utils/showMsg.js'
	import color from '../../../../uni_modules/uview-ui/libs/config/color'
	import config from '../../../../config/common'

	export default {
		data() {
			return {
				model: {
					Nav_User: {
						NAME:"",
					},
					Nav_Department:{
						NAME:""
					}
				},
			}
		},
		onLoad(option) {
			this.model.ID = option.ID;
			this.loadData()
		},
		methods: {
			loadData() {
				const orgId = uni.getStorageSync('orgId')
				const json = initFilter(orgId, "", "CREATE_TIME", 1)
				extendRule(json, 'ID', 1, this.model.ID);
				extendInclude(json, 'Nav_User');
				extendInclude(json, 'Nav_Department');
				extendInclude(json, 'Nav_Contents');
				getRequest(json,"/PT/AssessmentPlanAuditTempDetail/Get").then(res => {
					this.model = res
					//数据组装
					let strContents = ''
					if (res.Nav_Contents && res.Nav_Contents.length > 0) {
						for (let i = 0; i < res.Nav_Contents.length; i++) {
								strContents += (strContents.length > 0 ? "\n" : "")+ "考核项目:"+res.Nav_Contents[i].NAME 
								+",分数:"+ res.Nav_Contents[i].SCORE +",评分办法:"+res.Nav_Contents[i].METHOD;
						}
					}
					if (res.ASSESSMENT_CYCLE == 10) {
						res.ASSESSMENT_CYCLE = "年度";
					} else if (res.ASSESSMENT_CYCLE == 20) {
						res.ASSESSMENT_CYCLE = "季度";
					} else if (res.ASSESSMENT_CYCLE == 30) {
						res.ASSESSMENT_CYCLE = "月度";
					}
					this.model.Contents = strContents
					this.isLoadOK = true
				})
			},
		},
	}
</script>

<style>
	.todo-page {
		padding: 16px;
	}

	.todo-page .status-bar {
		height: 120px;
		background-image: linear-gradient(to right, #CFECFF, #6EB6FF);
		position: absolute;
		top: 0;
		left: 0;
		z-index: -10;
	}

	.todo-page .main {
		padding: 62px 8px;
		position: relative;
		z-index: 10;
		background-size: 100% 120px;
		background-repeat: no-repeat;
	}

	.todo-page .swiper-wrap {
		margin-bottom: 16px;
	}

	.tabs-bar {
		display: flex;
		flex-direction: row;
	}

	.tabs-bar .tab {
		display: flex;
		align-items: center;
		position: relative;
		margin-right: 20px;
		padding-bottom: 6px;
	}

	.tabs-bar .tab .t {
		position: relative
	}

	.tabs-bar .tab .t .name {
		font-size: 18px;
		line-height: 22px;
		color: #999;
	}

	.tabs-bar .tab .bottom-widget {
		width: 20px;
		height: 3px;
		background-color: #004F9D;
	}

	.content-list {
		padding: 10px 0;
	}

	.content-list .card {
		border-radius: 8px;
		margin-bottom: 12px;
		font-size: 14px;
		overflow: hidden;
		/*display: flex;*/
		/*flex-direction: row;*/
		padding: 14px;
		/*box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.1);*/
		/*box-sizing: border-box;*/
		/* #ifndef APP-NVUE */
		box-shadow: 0 0 4px 0 rgba(0, 0, 0, 0.1);
		/* #endif */
		/*#ifdef APP-NVUE */
		border: 1px solid rgba(0, 0, 0, 0.1);
		/*#endif */
	}

	.content-list .card .card-body {
		display: flex;
		flex-direction: row;
	}

	.content-list .card .card-body .left {
		margin-right: 4px;
		width: 20px;
		padding-top: 4px;
	}

	.content-list .card .card-body .left .todo-icon {
		width: 16px;
		height: 16px;
	}

	.content-list .card .card-body .contain {
		flex: 1;
	}

	.content-list .card .card-body .content {
		margin-bottom: 6px;
		display: flex;
		flex-direction: row;
	}

	.content-list .card .card-body .content-text {
		color: #333333;
		line-height: 24px;
		font-weight: bold;
		font-size: 16px;
		flex: 1;
	}

	.content-list .card .card-body .content-bottom {
		display: flex;
		flex-direction: row;
		align-items: flex-end;
	}

	.content-list .card .card-body .date-time {
		flex: 1
	}

	.content-list .card .card-body .content-status {
		width: 56px;
	}

	.content-list .card .card-body .status {
		background: rgba(255, 87, 51, 0.2);
		color: rgba(255, 87, 51, 1);
		text-align: center;
		font-size: 12px;
		width: 56px;
		height: 18px;
		line-height: 18px;
		border-radius: 2px;
	}

	.content-list .card .card-body .status.normal {
		background: rgba(0, 161, 64, 0.2);
		color: rgba(0, 161, 64, 1);
	}

	.content-list .card .card-body .status.warn {
		background: rgba(202, 158, 3, 0.2);
		color: rgba(202, 158, 3, 1);
	}

	.content-list .card .card-body .time {
		font-weight: 400;
		line-height: 18px;
		color: #333333;
		display: flex;
		flex-direction: row;
		margin-top: 4px;
		align-items: center;
	}

	.content-list .card .card-body .time .point {
		width: 8px;
		height: 8px;
		border-radius: 50%;
		margin-right: 4px;
	}

	.content-list .card .card-body .time .point.green {
		background: #00A140;
	}

	.content-list .card .card-body .time .point.red {
		background: #EE0A24;
	}

	.content-list .card .card-body .label {
		color: #666666;
		font-size: 12px;
	}

	.content-list .card .card-body .value {
		font-size: 12px;
	}

	.bottom {
		position: fixed;
		bottom: 0;
		display: block;
		margin-left: auto;
		margin-right: auto;
		padding-left: 14px;
		padding-right: 14px;
		box-sizing: border-box;
		font-size: 18px;
		text-align: center;
		text-decoration: none;
		line-height: 2.55555556;
		border-radius: 5px;
		-webkit-tap-highlight-color: transparent;
		overflow: hidden;
		color: #000;
		background-color: #f8f8f8;
		cursor: pointer;
		color: #fff;
		background-color: #007aff;
		width: 92%;
	}
</style>