<template>
	<view class="page-wrap" v-bind:style="{paddingBottom:paddingBottom+'px'}">
		<view class="background"></view>
		<view class="card">
			<!-- <uni-card margin="0" :is-shadow="true"> -->
			<u--form labelPosition="left" labelWidth="auto" labelAlign="center" :model="model" class="demo-ruleForm">
				<view style="position: relative;">
					<view style="position: absolute;left: -10px;color: #3d4b70;top: -3px;">*</view>
				</view>

				<view style="font-size: 15px; font-weight: bold;color: #3d4b70;margin-bottom: 10px;">基本信息</view>

				<u-form-item label="项目名称：" prop="Nav_Project.NAME" borderBottom>
					<u--input v-if="model.Nav_Project" v-model="model.Nav_Project.NAME" border="none" inputAlign="right" disabled disabledColor="#ffffff" fontSize="14px"></u--input>
				</u-form-item>
				<u-form-item label="外包单位名称：" prop="Nav_Project.UNIT_NAME" borderBottom>
					<u--input v-if="model.Nav_Project" v-model="model.Nav_Project.UNIT_NAME" border="none" inputAlign="right" disabled disabledColor="#ffffff" fontSize="14px"></u--input>
				</u-form-item>
				<u-form-item  label="课程名称" prop="NAME" borderBottom>
					<u--input disabledColor="#fff" placeholder="请填写课程名称" disabled v-model="model.NAME" border="none" inputAlign="right" fontSize="14px"></u--input>
				</u-form-item>
				<u-form-item label="培训部门:" prop="Nav_Department.NAME" borderBottom>
					<u--input disabledColor="#fff" disabled v-model="model.Nav_Department.NAME" border="none" inputAlign="right" fontSize="14px"></u--input>
				
				</u-form-item>
				<u-form-item  label="培训讲师:" prop="Nav_User.NAME" borderBottom>
					<u--input disabledColor="#fff" disabled v-model="model.Nav_User.NAME" border="none" inputAlign="right" fontSize="14px"></u--input>
					
				</u-form-item>
				<u-form-item label="最迟培训时间:" prop="END_TIME" borderBottom>
					<u--input disabledColor="#fff" disabled v-model="model.END_TIME" border="none" inputAlign="right" fontSize="14px"></u--input>
					
				</u-form-item>
			</u--form>
		</view>
	</view>
</template>

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

	import {
		getRequest,
	} from '../../../../services/apply/FOServices/FOServices'
	import {
		WBTSGet,
		WBmointerSign
	} from '../../../../services/apply/subPages/scWB';
	import '../../../../utils/showMsg.js'
	import color from '../../../../uni_modules/uview-ui/libs/config/color'
	import config from '../../../../config/common'

	export default {
		data() {
			return {
				model: {
					ID: '',
					ORG_ID: '',
					TaskID: null,
					PROJECT_ID: '',
					Nav_Project: {
						NAME: '',
						UNIT_NAME:''
					},
					NAME:'',
					Nav_Department:{
						NAME: '',
					},
					Nav_User:{
						NAME: '',
					},
					END_TIME:'',
					

				},
				listPropUpload: ['PARENT_ID'],
				listPropValUpload: [],
				paddingBottom: '150',
				TaskID: "",
				tableKey: '0',
				isLoadOK: false,
				isSign: true,
				isAudit: true,
				DEALOPINION: "",
				ORG_ID: uni.getStorageSync('orgId'),
			}
		},
		onLoad(option) {
			this.model.ID = option.ID;
			this.TaskID = option.taskID;
			this.tableKey = option.tableKey ? option.tableKey : '0'
			this.okApi = option.okApi
			this.refuseApi = option.refuseApi
			this.auditModel = {
				...this.$store.state.auditModel,
				TaskID: option.taskID ? option.taskID : ''
			}
			this.loadData()
		},
		methods: {
			transLevel(level) {
				if (level == 0) {
					return '否';
				}
				if (level == 1) {
					return '是 ';
				}
			},
			loadData() {
				const json = initFilter(this.ORG_ID)
				extendRule(json, 'ID', 1, this.model.ID);
				extendInclude(json, 'Nav_Project')
				extendInclude(json, 'Nav_Department')
				extendInclude(json, 'Nav_User')
				WBTSGet(json).then(res => {
					this.model = res
					this.initializeMissingFields();
					// if (this.model.STATUS == 30) {
					// 	this.isSign = true;
					// 	this.isAudit = false;
					// } else if (this.model.STATUS == 20) {
					// 	this.isSign = false;
					// 	this.isAudit = true;
					// }
					this.isLoadOK = true
				})
			},
			initializeMissingFields() {
				const fields = ['Nav_Project', 'Nav_User', 'Nav_Department'];
				fields.forEach(field => {
					if (!this.model[field]) {
						if (field == 'Nav_Project') {
							this.model[field] = {
								NAME: '',
								UNIT_NAME: ''
							};
						} else {
							this.model[field] = {
								NAME: ''
							};
						}

					}
				});
			},


		}
	}
</script>

<style>
	/* @import url("../../../../style/css/editTemplate.css"); */
	@import url("../../../../style/css/newTemplate.css");
</style>