270 lines
		
	
	
		
			9.5 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			270 lines
		
	
	
		
			9.5 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
<template>
 | 
						|
	<view class="page-wrap" v-bind:style="{paddingBottom:paddingBottom+'px'}">
 | 
						|
		<uni-card margin="0" :is-shadow="true">
 | 
						|
			<u--form labelPosition="left" labelWidth="auto" labelAlign="center" :model="model">
 | 
						|
				<u-form-item label="培训名称:" prop="NAME" borderBottom>
 | 
						|
					<u--input v-model="model.NAME" border="none" slot="right" inputAlign="right" disabled
 | 
						|
						disabledColor="#ffffff"></u--input>
 | 
						|
				</u-form-item>
 | 
						|
				<u-form-item label="发起时间:" prop="LAUNCH_TIME" borderBottom>
 | 
						|
					<u--input v-model="model.LAUNCH_TIME" border="none" slot="right" inputAlign="right" disabled
 | 
						|
						disabledColor="#ffffff"></u--input>
 | 
						|
				</u-form-item>
 | 
						|
				<u-form-item label="发起部门:" prop="Nav_LaunchDepartment.NAME" borderBottom>
 | 
						|
					<u--input v-if="model.Nav_LaunchDepartment" v-model="model.Nav_LaunchDepartment.NAME" border="none"
 | 
						|
						slot="right" inputAlign="right" disabled disabledColor="#ffffff"></u--input>
 | 
						|
				</u-form-item>
 | 
						|
				<u-form-item label="发起人员:" prop="Nav_LaunchUser.NAME" borderBottom>
 | 
						|
					<u--input v-if="model.Nav_LaunchUser" v-model="model.Nav_LaunchUser.NAME" border="none" slot="right"
 | 
						|
						inputAlign="right" disabled disabledColor="#ffffff"></u--input>
 | 
						|
				</u-form-item>
 | 
						|
				<u-form-item label="培训类型:" prop="Nav_LaunchUser.NAME" borderBottom>
 | 
						|
					<u--input v-if="model.Nav_TrainType" v-model="model.Nav_TrainType.NAME" border="none" slot="right"
 | 
						|
						inputAlign="right" disabled disabledColor="#ffffff"></u--input>
 | 
						|
				</u-form-item>
 | 
						|
				<u-form-item label="培训级别:" prop="LEVEL" borderBottom>
 | 
						|
					<u--input v-model="model.LEVEL" border="none" slot="right" inputAlign="right" disabled
 | 
						|
						disabledColor="#ffffff"></u--input>
 | 
						|
				</u-form-item>
 | 
						|
				<u-form-item label="开始时间:" prop="TRAIN_START_TIME" borderBottom>
 | 
						|
					<u--input v-model="model.TRAIN_START_TIME" border="none" inputAlign="right" disabled
 | 
						|
						disabledColor="#ffffff"></u--input>
 | 
						|
				</u-form-item>
 | 
						|
				<u-form-item label="结束时间:" prop="TRAIN_END_TIME" borderBottom>
 | 
						|
					<u--input v-model="model.TRAIN_END_TIME" border="none" inputAlign="right" disabled
 | 
						|
						disabledColor="#ffffff"></u--input>
 | 
						|
				</u-form-item>
 | 
						|
				<u-form-item label="培训地点:" prop="TRAIN_ADDR" borderBottom>
 | 
						|
					<u--input v-model="model.TRAIN_ADDR" border="none" slot="right" inputAlign="right" disabled
 | 
						|
						disabledColor="#ffffff"></u--input>
 | 
						|
				</u-form-item>
 | 
						|
				<u-form-item label="培训学时:" prop="HOURS" borderBottom>
 | 
						|
					<u--input v-model="model.HOURS" border="none" slot="right" inputAlign="right" disabled
 | 
						|
						disabledColor="#ffffff"></u--input>
 | 
						|
				</u-form-item>
 | 
						|
				<u-form-item label="培训老师:" prop="TRAIN_TEACHER" borderBottom>
 | 
						|
					<u--input v-model="model.TRAIN_TEACHER" border="none" slot="right" inputAlign="right" disabled
 | 
						|
						disabledColor="#ffffff"></u--input>
 | 
						|
				</u-form-item>
 | 
						|
				<u-form-item label="培训形式:" prop="" borderBottom>
 | 
						|
					<u--input v-model="model.TRAIN_MODEL" border="none" inputAlign="right" disabled
 | 
						|
						disabledColor="#ffffff"></u--input>
 | 
						|
				</u-form-item>
 | 
						|
				<u-form-item label="考核方式:" prop="Nav_TrainCheckType.NAME" borderBottom>
 | 
						|
					<u--input v-if="model.Nav_TrainCheckType" v-model="model.Nav_TrainCheckType.NAME" border="none"
 | 
						|
						slot="right" inputAlign="right" disabled disabledColor="#ffffff"></u--input>
 | 
						|
				</u-form-item>
 | 
						|
				<u-form-item label="培训内容:" prop="TRAINCONTENT" borderBottom>
 | 
						|
				</u-form-item>
 | 
						|
				<u-textarea autoHeight v-html="model.TRAINCONTENT" border="none" disabled></u-textarea>
 | 
						|
				<u-form-item label="培训安排及要求:" prop="TRAIN_PLAN" borderBottom>
 | 
						|
				</u-form-item>
 | 
						|
				<u--textarea v-model="model.TRAIN_PLAN" border="none" disabled></u--textarea>
 | 
						|
				<u-form-item label="培训人员:" prop="users" borderBottom>
 | 
						|
				</u-form-item>
 | 
						|
				<rich-text v-html="model.users" border="none" disabled></rich-text>
 | 
						|
				<u-form-item label="附件:" prop="" borderBottom>
 | 
						|
					<u-link v-for="item in model.Nav_Files" :href="item.url" :text="item.name" slot="right">
 | 
						|
					</u-link>
 | 
						|
				</u-form-item>
 | 
						|
			</u--form>
 | 
						|
		</uni-card>
 | 
						|
 | 
						|
		<uni-card class="btn-wrap" :is-shadow="true" v-if="isLoadOK&&tableKey==1">
 | 
						|
			<u--form>
 | 
						|
				<view class="btn-wrap">
 | 
						|
					<view>
 | 
						|
						<u--textarea height='3em' v-model="LEAVE_REASON" placeholder="请输入请假理由"></u--textarea>
 | 
						|
					</view>
 | 
						|
					<view class="buttons">
 | 
						|
						<u-button type="primary" class="btn first-btn" @click="onChargeUserAgree(1)"
 | 
						|
							text="参加"></u-button>
 | 
						|
						<u-button type="warning" @click="onChargeUserAgree(2)" text="请假"></u-button>
 | 
						|
					</view>
 | 
						|
				</view>
 | 
						|
			</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: {},
 | 
						|
				TaskID: "",
 | 
						|
				tableKey: '0',
 | 
						|
				isLoadOK: false,
 | 
						|
				paddingBottom: '170',
 | 
						|
				LEAVE_REASON: '',
 | 
						|
				users: '',
 | 
						|
				orgId: uni.getStorageSync('orgId')
 | 
						|
			}
 | 
						|
		},
 | 
						|
		onLoad(option) {
 | 
						|
			this.model.ID = option.ID;
 | 
						|
			this.TaskID = option.taskID;
 | 
						|
			this.tableKey = option.tableKey ? option.tableKey : '0'
 | 
						|
			this.loadData()
 | 
						|
		},
 | 
						|
		methods: {
 | 
						|
			loadData() {
 | 
						|
				const json = initFilter(this.orgId, "", "CODE", 1)
 | 
						|
				extendRule(json, 'ID', 1, this.model.ID);
 | 
						|
				extendInclude(json, 'Nav_LaunchDepartment');
 | 
						|
				extendInclude(json, 'Nav_LaunchUser');
 | 
						|
				extendInclude(json, 'Nav_TrainType');
 | 
						|
				extendInclude(json, 'Nav_TrainCheckType');
 | 
						|
				extendInclude(json, 'Nav_TrainContentList');
 | 
						|
				extendInclude(json, 'Nav_TrainContentList.Nav_Point');
 | 
						|
				extendInclude(json, 'Nav_TrainUserList');
 | 
						|
				extendInclude(json, 'Nav_TrainUserList.Nav_User');
 | 
						|
				extendInclude(json, 'Nav_Files.Nav_ImgFile');
 | 
						|
				getRequest(json, "/SE/TrainNotify/Get").then(res => {
 | 
						|
					this.model = res
 | 
						|
					let trainContent = '';
 | 
						|
					let users = '';
 | 
						|
					let strUserFiles = [{
 | 
						|
						url: '',
 | 
						|
						name: ''
 | 
						|
					}]
 | 
						|
					if (res.Nav_TrainContentList && res.Nav_TrainContentList.length > 0) {
 | 
						|
						for (let i = 0; i < res.Nav_TrainContentList.length; i++) {
 | 
						|
							trainContent += (i + 1) + "." + res.Nav_TrainContentList[i].Nav_Point.NAME + "<br/>"
 | 
						|
						}
 | 
						|
					}
 | 
						|
					if (res.Nav_TrainUserList && res.Nav_TrainUserList.length > 0) {
 | 
						|
						for (let i = 0; i < res.Nav_TrainUserList.length; i++) {
 | 
						|
							if (res.Nav_TrainUserList[i].IS_LEAVE == 0) {
 | 
						|
								users += (users.length > 0 ? " " : "") +
 | 
						|
									"<view style='color:#E35D58;background-color:rgba(227,93,88,0.2);padding:5px;line-height:30px;white-space:nowrap;'>" +
 | 
						|
									res.Nav_TrainUserList[i].Nav_User.NAME + "</view>";
 | 
						|
							} else if (res.Nav_TrainUserList[i].IS_LEAVE == 1) {
 | 
						|
								users += (users.length > 0 ? " " : "") +
 | 
						|
									"<text style='padding:5px;line-height:30px;white-space:nowrap;'>" +
 | 
						|
									res.Nav_TrainUserList[i].Nav_User.NAME + "</text>";
 | 
						|
							} else if (res.Nav_TrainUserList[i].IS_LEAVE == 2) {
 | 
						|
								users += (users.length > 0 ? " " : "") +
 | 
						|
									"<text style='padding:5px;line-height:30px;white-space:nowrap;'>" +
 | 
						|
									res.Nav_TrainUserList[i].Nav_User.NAME + "(请假)</text>";
 | 
						|
							}
 | 
						|
						}
 | 
						|
					}
 | 
						|
					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_source_url + res.Nav_Files[i]
 | 
						|
									.Nav_ImgFile.FILE_PATH,
 | 
						|
								name: res.Nav_Files[i].Nav_ImgFile.FILE_NAME
 | 
						|
							})
 | 
						|
						}
 | 
						|
					}
 | 
						|
					this.model.Nav_Files = strUserFiles;
 | 
						|
					this.model.TRAIN_MODEL = this.returnModel(this.model.TRAIN_MODEL);
 | 
						|
					this.model.LEVEL = this.transLevel(this.model.LEVEL);
 | 
						|
					this.model.TRAINCONTENT = trainContent;
 | 
						|
					this.model.users = users;
 | 
						|
					this.isLoadOK = true;
 | 
						|
				})
 | 
						|
			},
 | 
						|
			returnModel(level) {
 | 
						|
				let str = '';
 | 
						|
				if (level == undefined) {
 | 
						|
					return str;
 | 
						|
				}
 | 
						|
				if (level.indexOf('1') >= 0) {
 | 
						|
					str += '讲授法 ';
 | 
						|
				}
 | 
						|
				if (level.indexOf('2') >= 0) {
 | 
						|
					str += '视听法 ';
 | 
						|
				}
 | 
						|
				if (level.indexOf('3') >= 0) {
 | 
						|
					str += '研讨法 ';
 | 
						|
				}
 | 
						|
				if (level.indexOf('4') >= 0) {
 | 
						|
					str += '演示法 ';
 | 
						|
				}
 | 
						|
				return str;
 | 
						|
			},
 | 
						|
			transLevel(level) {
 | 
						|
				if (level == 0) {
 | 
						|
					return '部门 ';
 | 
						|
				}
 | 
						|
				if (level == 1) {
 | 
						|
					return '车间 ';
 | 
						|
				}
 | 
						|
				if (level == 2) {
 | 
						|
					return '班组 ';
 | 
						|
				}
 | 
						|
				if (level == 3) {
 | 
						|
					return '公司 ';
 | 
						|
				}
 | 
						|
			},
 | 
						|
			onChargeUserAgree(type) {
 | 
						|
				if (type == 2) {
 | 
						|
					if (this.LEAVE_REASON == "" || this.LEAVE_REASON == null) {
 | 
						|
						uni.$showMsgFunc('请填写请假理由!', () => {
 | 
						|
						}, 'error', 1000);
 | 
						|
						return
 | 
						|
					}
 | 
						|
				}
 | 
						|
				let json = {
 | 
						|
					USER_ID: uni.getStorageSync('appInfo').User.ID,
 | 
						|
					ORG_ID: this.ORG_ID,
 | 
						|
					NOTIFY_ID: this.model.ID,
 | 
						|
					LEAVE_REASON: this.LEAVE_REASON,
 | 
						|
					IS_LEAVE: type,
 | 
						|
					TaskID: this.TaskID,
 | 
						|
				};
 | 
						|
				getRequest(json, "/SE/SETrainNotify/TrainPersonStatus").then(res => {
 | 
						|
					if (res) {
 | 
						|
						uni.$showMsgFunc('操作成功!', () => {
 | 
						|
							uni.navigateBack()
 | 
						|
						}, 'success', 1000)
 | 
						|
					}
 | 
						|
				})
 | 
						|
 | 
						|
			}
 | 
						|
		},
 | 
						|
		computed: {
 | 
						|
 | 
						|
		}
 | 
						|
	}
 | 
						|
</script>
 | 
						|
 | 
						|
<style>
 | 
						|
	@import url("@/style/css/editTemplate.css");
 | 
						|
 | 
						|
	.btn-wrap {
 | 
						|
		position: fixed;
 | 
						|
		bottom: 0;
 | 
						|
		left: 0;
 | 
						|
		width: 100%;
 | 
						|
		box-sizing: border-box;
 | 
						|
		padding: 16px;
 | 
						|
		z-index: 1000;
 | 
						|
		background: #fff;
 | 
						|
		box-shadow: 0 -1px 2px 0 rgba(0, 0, 0, .05);
 | 
						|
	}
 | 
						|
 | 
						|
	.buttons {
 | 
						|
		margin-top: 10px;
 | 
						|
		display: flex;
 | 
						|
		justify-content: space-between;
 | 
						|
	}
 | 
						|
 | 
						|
	.buttons .first-btn {
 | 
						|
		margin-right: 20px;
 | 
						|
	}
 | 
						|
</style> |