<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="CREATE_TIME" borderBottom>
					<u--input v-model="model.CREATE_TIME" border="none" slot="right" inputAlign="right" disabled
						disabledColor="#fff"></u--input>
				</u-form-item>
				<u-form-item label="发起部门：" prop="Nav_User.Nav_Department.NAME" borderBottom>
					<u--input v-model="model.Nav_User.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="NAME" borderBottom>
					<u--input v-model="model.NAME" border="none" slot="right" inputAlign="right" disabled
						disabledColor="#fff"></u--input>
				</u-form-item>
				<u-form-item label="制度编号：" prop="CODE" borderBottom>
					<u--input v-model="model.CODE" border="none" slot="right" inputAlign="right" disabled
						disabledColor="#fff"></u--input>
				</u-form-item>

				<u-form-item label="制定要求：" prop="FORMULATE" borderBottom>
					<u--input v-model="model.FORMULATE" border="none" slot="right" inputAlign="right" disabled
						disabledColor="#fff"></u--input>
				</u-form-item>
				<u-form-item label="修订/废除时间：" prop="UPDATE_TIME" borderBottom>
					<u--input v-model="model.UPDATE_TIME" border="none" slot="right" inputAlign="right" disabled
						disabledColor="#fff"></u--input>
				</u-form-item>
				<u-form-item label="修订/废除原因：" prop="REASON" borderBottom>
					<u--input v-model="model.REASON" border="none" slot="right" inputAlign="right" disabled
						disabledColor="#fff"></u--input>
				</u-form-item>
				<u-form-item label="修订概要：" prop="PROFILE" borderBottom>
					<u--input v-model="model.PROFILE" border="none" slot="right" inputAlign="right" disabled
						disabledColor="#fff"></u--input>
				</u-form-item>
				<u-form-item label="责任制岗位：" prop="POST_NAME" borderBottom>
					<u--input v-model="model.Nav_Post.NAME" border="none" slot="right" inputAlign="right" disabled
						disabledColor="#fff"></u--input>
				</u-form-item>
				<u-form-item label="责任制说明：" prop="NOTE" borderBottom>
					<u--input v-model="model.NOTE" border="none" slot="right" inputAlign="right" disabled
						disabledColor="#fff"></u--input>
				</u-form-item>
				<u-form-item label="文件名称：" prop="FILE_NAME" borderBottom>
					<u--input v-model="model.FILE_NAME" border="none" slot="right" inputAlign="right" disabled
						disabledColor="#fff"></u--input>
				</u-form-item>
				<u-form-item label="文件内容：" prop="FILE_CONTENT" borderBottom>
					<u--input v-model="model.FILE_CONTENT" border="none" slot="right" inputAlign="right" disabled
						disabledColor="#fff"></u--input>
				</u-form-item>
				<u-form-item label="附件" prop="UserFiles" borderBottom>
				</u-form-item>
				<u-link v-for="item in model.UserFiles" :href="item.url" :text="item.name">
				</u-link>
			</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_Post:[],
					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, "", "CODE", 1)
				extendRule(json, 'ID', 1, this.model.ID);
				extendInclude(json, 'Nav_User.Nav_Department');
				extendInclude(json, 'Nav_Post');
				extendInclude(json, 'Nav_Files');
				extendInclude(json, 'Nav_Files.Nav_ImgFile.Nav_File');
				getRequest(json,"/SC/StandardCreate/Get").then(res => {
					this.model = res
					//数据组装
					let strUserFiles = [{
						url: '',
						name:''
					}]
					if (res.Nav_Files && res.Nav_Files.length > 0) {
						for (let i = 0; i < res.Nav_Files.length; i++) {
							strUserFiles.push({
								url: config.uni_app_web_local_api_url+res.Nav_Files[i].Nav_ImgFile.Nav_File.FILE_PATH,
								name:res.Nav_Files[i].Nav_ImgFile.FILE_NAME
							})
						}
					}
					if(!res.Nav_Post)
					{
						res.Nav_Post=[]
					}
					this.model.UserFiles = strUserFiles
					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>