<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_Parent.Nav_Project.NAME" borderBottom>
					<u--input disabled disabledColor="#ffffff" v-model="model.Nav_Parent.Nav_Project.NAME" border="none" inputAlign="right" fontSize="14px"></u--input>
				</u-form-item>
				<u-form-item label="外包单位名称" prop="Nav_Parent.Nav_Project.UNIT_NAME" borderBottom>
					<u--input disabled disabledColor="#ffffff" v-model="model.Nav_Parent.Nav_Project.UNIT_NAME" border="none" inputAlign="right" fontSize="14px"></u--input>
				</u-form-item>
				<u-form-item label="课程名称" prop="Nav_Parent.NAME" borderBottom>
					<u--input disabled disabledColor="#ffffff" v-model="model.Nav_Parent.NAME" border="none" inputAlign="right" fontSize="14px"></u--input>
				</u-form-item>
				<u-form-item label="培训部门" prop="Nav_Parent.Nav_Department.NAME" borderBottom>
					<u--input disabled disabledColor="#ffffff" v-model="model.Nav_Parent.Nav_Department.NAME" border="none" inputAlign="right" fontSize="14px"></u--input>
				</u-form-item>
				<u-form-item label="培训讲师" prop="Nav_Parent.Nav_User.NAME" borderBottom>
					<u--input disabled disabledColor="#ffffff" v-model="model.Nav_Parent.Nav_User.NAME" border="none" inputAlign="right" fontSize="14px"></u--input>
				</u-form-item>
				<u-form-item label="最迟培训时间" prop="Nav_Parent.END_TIME" borderBottom>
					<u--input disabled disabledColor="#ffffff" v-model="model.Nav_Parent.END_TIME" border="none" inputAlign="right" fontSize="14px"></u--input>
				</u-form-item>
				<u-form-item label="培训开始时间" prop="Nav_Parent.END_TIME" borderBottom>
					<u--input disabled disabledColor="#ffffff" v-model="model.START_TIME" border="none" inputAlign="right" fontSize="14px"></u--input>
				</u-form-item>
				<u-form-item label="培训结束时间" prop="Nav_Parent.END_TIME" borderBottom>
					<u--input disabled disabledColor="#ffffff" v-model="model.END_TIME" border="none" inputAlign="right" fontSize="14px"></u--input>
				</u-form-item>
				<u-form-item label="培训总时长" prop="TOTAL_TIME" borderBottom>
					<u--input disabled disabledColor="#ffffff" v-model="model.TOTAL_TIME" border="none" inputAlign="right" fontSize="14px"></u--input>
				</u-form-item>
				<u-form-item label="培训形式" borderBottom>
					<u--input disabled disabledColor="#ffffff" v-model="model.TRAIN_TYPE_SHOW" border="none" inputAlign="right" fontSize="14px"></u--input>
				</u-form-item>
				<u-form-item label="培训内容">
					<!-- <u--input disabled disabledColor="#ffffff" v-model="model.TRAIN_CONTENT" border="none" inputAlign="right" fontSize="14px"></u--input> -->
				</u-form-item>
				<u--textarea v-model="model.TRAIN_CONTENT" disabled></u--textarea>
				<u-form-item  label="线上培训开始时间" prop="ONLINE_START_TIME" borderBottom >
					<u--input disabled disabledColor="#fff" v-model="model.ONLINE_START_TIME" border="none" inputAlign="right" fontSize="14px"></u--input>
				
				</u-form-item>
				<u-form-item  label="线上培训结束时间" prop="ONLINE_END_TIME" borderBottom >
					<u--input disabled disabledColor="#fff" v-model="model.ONLINE_END_TIME"  border="none" inputAlign="right" fontSize="14px"></u--input>
					
				</u-form-item>
				<u-form-item label="线上培训总时长" prop="Nav_Project.UNIT_NAME" borderBottom>
					<u--input disabled disabledColor="#ffffff" v-model="model.ONLINE_TOTAL_TIME" border="none" inputAlign="right" fontSize="14px"></u--input>
				</u-form-item>
				<u-form-item  label="线下培训开始时间" prop="OFFLINE_START_TIME" borderBottom >
					<u--input disabled disabledColor="#fff" v-model="model.OFFLINE_START_TIME"  border="none" inputAlign="right" fontSize="14px"></u--input>
					
				</u-form-item>
				<u-form-item label="线下培训结束时间" prop="OFFLINE_END_TIME" borderBottom >
					<u--input disabled disabledColor="#fff" v-model="model.OFFLINE_END_TIME" border="none" inputAlign="right" fontSize="14px"></u--input>
					
				</u-form-item>
				<u-form-item label="线下培训总时长" prop="Nav_Project.UNIT_NAME" borderBottom>
					<u--input disabled disabledColor="#ffffff" v-model="model.OFFLINE_TOTAL_TIME" border="none" inputAlign="right" fontSize="14px"></u--input>
				</u-form-item>
				<u-form-item  label="培训地点" prop="TRAIN_ADDR" borderBottom>
					<u--input disabled disabledColor="#ffffff" v-model="model.TRAIN_ADDR" border="none" inputAlign="right" fontSize="14px"></u--input>
				</u-form-item>
			</u--form>
			<u--form labelPosition="left" labelWidth="auto" labelAlign="center" errorType="border-bottom" ref="sForm" class="sub-form" style="margin-top: 10px;">
				<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>

				<uni-collapse :border="false" accordion>
					<view v-for="(item, index) in model.Nav_Users" :key="index">
						<uni-collapse-item title-border="none" :border="false">
							<template v-slot:title>
								<view class="uni-collapse-item__title-box">
									<view class="uni-collapse-item__title-text">
										{{index+1+'.'+item.Nav_User.NAME}}
									</view>

								</view>
							</template>
							<view class="content" style="margin: 0px 10px;">
								<u-form-item label="姓名" prop="Nav_User.NAME" borderBottom >
									<u--input disabled disabledColor="#fff" v-model="item.Nav_User.NAME" border="none" inputAlign="right" fontSize="14px"></u--input>
									
								</u-form-item>
								<u-form-item label="性别" prop="Nav_User.SEX_SHOW" borderBottom>
									<u--input disabled disabledColor="#fff" v-model="item.Nav_User.SEX_SHOW" border="none" inputAlign="right" fontSize="14px"></u--input>
								</u-form-item>
								<u-form-item label="身份证号码" prop="ID_CARD" borderBottom>
									<u--input disabled disabledColor="#fff" v-model="item.Nav_User.ID_CARD" border="none" inputAlign="right" fontSize="14px"></u--input>
								</u-form-item>

								<u-form-item label="分数" prop="SCORE" borderBottom>
									<u--input disabled disabledColor="#fff" v-model="item.SCORE" border="none" inputAlign="right" fontSize="14px"></u--input>
								</u-form-item>
								<u-form-item label="考核结果" prop="EXAMINATION_RESULTS" borderBottom >
									<u--input disabled disabledColor="#fff" v-model="item.EXAMINATION_RESULTS_SHOW" border="none" inputAlign="right" fontSize="14px"></u--input>
									
								</u-form-item>
								<view class="upload-title">附件</view>
								<full-upload v-model="item.Nav_Files" :isShowBtn='false' :listProp='listPropUpload' :listPropVal='listPropValUpload'></full-upload>

							</view>


						</uni-collapse-item>
						<!-- <u-collapse-item :title="item.ROW_NUM + '. ' + item.MEASURE+' - '+transLevel(item.ISORNOT)+' - '+item.REMARK">
						</u-collapse-item> -->
					</view>
				</uni-collapse>
			</u--form>
		</view>

	</view>
</template>

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

	import {
		GetIni
	} 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,
					START_TIME: '',
					END_TIME: '',
					TOTAL_TIME: '',
					TRAIN_TYPE: '',
					TRAIN_CONTENT: '',
					ONLINE_START_TIME: '',
					ONLINE_END_TIME: '',
					ONLINE_TOTAL_TIME: '',
					OFFLINE_START_TIME: '',
					OFFLINE_END_TIME: '',
					OFFLINE_TOTAL_TIME: '',
					TRAIN_ADDR: '',
					IS_CREATE_TEST: '',
					Nav_Files: [],
					Nav_Parent: {
						NAME: '',
						END_TIME: '',
						Nav_Project: {
							NAME: '',
							UNIT_NAME: ''
						},
						Nav_Department: {
							NAME: ''
						},
						Nav_User: {
							NAME: ''
						},
					},
					Nav_Users: [{
						SCORE: 0,
						EXAMINATION_RESULTS: '',
						EXAMINATION_RESULTS_SHOW: '',
						Nav_User: {
							NAME: '',
							SEX: '',
							SEX_SHOW: '',
							ID_CARD: ''
						},
						Nav_Files: []
					}],
				},
				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_Parent.Nav_Project')
				extendInclude(json, 'Nav_Parent')
				extendInclude(json, 'Nav_Parent.Nav_Department')
				extendInclude(json, 'Nav_Parent.Nav_User')
				extendInclude(json, 'Nav_Users.Nav_User')
				extendInclude(json, 'Nav_Users.Nav_Files.Nav_ImgFile')
				GetIni(json).then(res => {
					this.model = res
					if (this.model.TRAIN_TYPE != null || this.model.TRAIN_TYPE != undefined) {
						let tempModel = this.model.TRAIN_TYPE
						tempModel = tempModel.replaceAll(1,"线上");
						tempModel = tempModel.replaceAll(2,"线下");
						this.model.TRAIN_TYPE_SHOW = tempModel.split('_').filter(Boolean).join('、');;
						
					}
					this.model.Nav_Users.map(item => {
						item.Nav_User.SEX_SHOW = item.Nav_User.SEX == 0 ? '女' : '男'
						if(item.EXAMINATION_RESULTS){
							item.EXAMINATION_RESULTS_SHOW = item.EXAMINATION_RESULTS==0?'不合格':'合格'
						}
						
					})
					this.isLoadOK = true
				})
			},

		}
	}
</script>

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