353 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			353 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
<template>
 | 
						|
	<view class="todo-page">
 | 
						|
		<view class="card">
 | 
						|
			<uni-card margin="0" :is-shadow="true">
 | 
						|
				<u--form labelPosition="left" labelWidth="auto" labelAlign="center" :model="model" :rules="rules"
 | 
						|
					ref="wForm" errorType="border-bottom">
 | 
						|
					<u-form-item label="姓名:" borderBottom>
 | 
						|
						<u--input v-if="model.Nav_EDUCard" v-model="model.Nav_EDUCard.Nav_User.NAME" border="none"
 | 
						|
							inputAlign="right" disabled disabledColor="#ffffff"></u--input>
 | 
						|
					</u-form-item>
 | 
						|
					<u-form-item label="身份证号:" borderBottom>
 | 
						|
						<u--input v-if="model.Nav_EDUCard" v-model="model.Nav_EDUCard.Nav_User.ID_CARD" border="none"
 | 
						|
							inputAlign="right" disabled disabledColor="#ffffff"></u--input>
 | 
						|
					</u-form-item>
 | 
						|
					<u-form-item label="入职时间:" borderBottom>
 | 
						|
						<u--input v-if="model.Nav_EDUCard" v-model="model.Nav_EDUCard.Nav_User.ENTRYTIME" border="none"
 | 
						|
							inputAlign="right" disabled disabledColor="#ffffff"></u--input>
 | 
						|
					</u-form-item>
 | 
						|
					<u-form-item label="部门:" borderBottom>
 | 
						|
						<u--input v-if="model.Nav_EDUCard" v-model="model.Nav_EDUCard.Nav_Department.NAME" border="none"
 | 
						|
							inputAlign="right" disabled disabledColor="#ffffff"></u--input>
 | 
						|
					</u-form-item>
 | 
						|
					<u-form-item label="岗位:" borderBottom>
 | 
						|
						<u--input v-if="model.Nav_EDUCard" v-model="model.Nav_EDUCard.Nav_Post.NAME" border="none"
 | 
						|
							inputAlign="right" disabled disabledColor="#ffffff"></u--input>
 | 
						|
					</u-form-item>
 | 
						|
					<u-form-item label="培训内容:" borderBottom>
 | 
						|
					</u-form-item>
 | 
						|
					<u--textarea autoHeight v-if="model.Nav_Content" v-model="model.Nav_Content.NAME" border="none"
 | 
						|
						disabled disabledColor="#ffffff"></u--textarea>
 | 
						|
					<u-form-item label="开始时间" required prop="START_TIME" @click="showCheckDate({ name: 'START_TIME'})">
 | 
						|
						<u--input disabledColor="#fff" v-model="model.START_TIME" disabled placeholder="请选择开始时间"
 | 
						|
							suffixIcon="arrow-down" suffixIconStyle="font-size:14px" fontSize="14px"
 | 
						|
							customStyle="margin:0px;display:flex;padding:3px 9px">
 | 
						|
						</u--input>
 | 
						|
					</u-form-item>
 | 
						|
					<u-form-item label="结束时间" required prop="END_TIME" @click="showCheckDate({name: 'END_TIME'})">
 | 
						|
						<u--input disabledColor="#fff" v-model="model.END_TIME" disabled placeholder="请选择结束时间"
 | 
						|
							suffixIcon="arrow-down" suffixIconStyle="font-size:14px" fontSize="14px"
 | 
						|
							customStyle="margin:0px;display:flex;padding:3px 9px">
 | 
						|
						</u--input>
 | 
						|
					</u-form-item>
 | 
						|
					<u-form-item label="培训地点:" prop="NAME" borderBottom>
 | 
						|
						<u--input v-model="model.TAINNING_ADDR" border="none" slot="right"
 | 
						|
							inputAlign="right"></u--input>
 | 
						|
					</u-form-item>
 | 
						|
					<u-form-item label="培训学时:" prop="TRAINNING_TIME" borderBottom>
 | 
						|
						<u--input v-model="model.TRAINNING_TIME" type="number" border="none" slot="right"
 | 
						|
							inputAlign="right"></u--input>
 | 
						|
					</u-form-item>
 | 
						|
					<u-form-item label="培训老师:" prop="TEACHER" borderBottom>
 | 
						|
						<u--input v-model="model.TEACHER" border="none" slot="right" inputAlign="right"></u--input>
 | 
						|
					</u-form-item>
 | 
						|
					<u-form-item label="培训形式:" prop="TRAIN_MODEL" borderBottom labelWidth="80">
 | 
						|
						<u-checkbox-group v-model="model.TRAIN_MODEL_SHOW" shape="square"
 | 
						|
							@change="checkboxChange($event)" slot="right">
 | 
						|
							<u-checkbox :customStyle="{marginRight: '16px'}" v-for="(item, index) in checkboxList1"
 | 
						|
								:key="index" :label="item.name" :name="item.name">
 | 
						|
							</u-checkbox>
 | 
						|
						</u-checkbox-group>
 | 
						|
					</u-form-item>
 | 
						|
					<u-form-item label="考核结果:" prop="EXAMINATION_RESULTS" borderBottom
 | 
						|
						@click="handleShowSheet({title: '考核结果', name: 'EXAMINATION_RESULTS'})">
 | 
						|
						<u--input :value="model.EXAMINATION_RESULTS_SHOW" placeholder="请选择考核结果" border="none"
 | 
						|
							inputAlign="right" disabled disabledColor="#fff"></u--input>
 | 
						|
						<u-icon style="margin-left: 4px;" slot="right" name="arrow-down"></u-icon>
 | 
						|
					</u-form-item>
 | 
						|
					<u-form-item label="分数:" prop="SCORE" borderBottom>
 | 
						|
						<u--input v-model="model.SCORE" type="number" border="none" slot="right"
 | 
						|
							inputAlign="right"></u--input>
 | 
						|
					</u-form-item>
 | 
						|
					<view class="upload-title">附件:</view>
 | 
						|
					<full-upload v-model="model.Nav_TrainRecordFile" :isShowBtn='true' :listProp='listPropUpload'
 | 
						|
						:listPropVal='listPropValUpload'></full-upload>
 | 
						|
				</u--form>
 | 
						|
			</uni-card>
 | 
						|
		</view>
 | 
						|
		<query-selector :show="showPopup" :lists="Lists" @close="handleClosePopup" @search="handleSearch"
 | 
						|
			@select="handleSelected" />
 | 
						|
		<u-picker :show="comPickerInfo.showSheet" :columns="comPickerInfo.columns" @confirm="onConfirmPicker"
 | 
						|
			:defaultIndex="[0]" @close="closePicker" @cancel="closePicker" keyName="NAME"></u-picker>
 | 
						|
		<u-datetime-picker :show="dateTimePickerInfo.showCheckDate" mode="datetime"
 | 
						|
			v-model='dateTimePickerInfo.defaultDateTime' :formatter="formatter" @confirm="handleCheckDate"
 | 
						|
			@close="dateTimePickerInfo.showCheckDate = false;"
 | 
						|
			@cancel="dateTimePickerInfo.showCheckDate = false;"></u-datetime-picker>
 | 
						|
		<view class="bottom-button">
 | 
						|
			<button type="primary" @click="submit">提交</button>
 | 
						|
		</view>
 | 
						|
	</view>
 | 
						|
</template>
 | 
						|
 | 
						|
<script>
 | 
						|
	import {
 | 
						|
		extendFilterGroup,
 | 
						|
		extendGroupRule,
 | 
						|
		extendInclude,
 | 
						|
		extendOrder,
 | 
						|
		extendRule,
 | 
						|
		guid,
 | 
						|
		initFilter,
 | 
						|
		initFilterGroup
 | 
						|
	} from '../../../../utils/common'
 | 
						|
	import {
 | 
						|
		getRequest,
 | 
						|
	} from '../../../../services/apply/FOServices/FOServices';
 | 
						|
	export default {
 | 
						|
		data() {
 | 
						|
			return {
 | 
						|
				Lists: [],
 | 
						|
				listPropUpload: ['NOTIFY_ID'],
 | 
						|
				listPropValUpload: [],
 | 
						|
				model: {
 | 
						|
					Nav_TrainUserList: [],
 | 
						|
					ORG_ID: "",
 | 
						|
					Nav_Files: [],
 | 
						|
				},
 | 
						|
				options: [{
 | 
						|
					text: '删除',
 | 
						|
					style: {
 | 
						|
						backgroundColor: '#f56c6c'
 | 
						|
					}
 | 
						|
				}],
 | 
						|
				rules: {
 | 
						|
					'NAME1': {
 | 
						|
						type: 'string',
 | 
						|
						required: false,
 | 
						|
						trigger: ['blur', 'change']
 | 
						|
					}
 | 
						|
				},
 | 
						|
				comPickerInfo: {
 | 
						|
					showSheet: false,
 | 
						|
					columns: [],
 | 
						|
					title: '',
 | 
						|
					dataIndex: undefined,
 | 
						|
					formIndex: undefined,
 | 
						|
					name: ''
 | 
						|
				},
 | 
						|
				dateTimePickerInfo: {
 | 
						|
					showCheckDate: false,
 | 
						|
					dataIndex: undefined,
 | 
						|
					defaultDateTime: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM'),
 | 
						|
					value: '',
 | 
						|
					name: ''
 | 
						|
				},
 | 
						|
				formatter: null,
 | 
						|
				showPopup: false,
 | 
						|
				tableKey: '0',
 | 
						|
				TaskID: '',
 | 
						|
				isLoadOK: false,
 | 
						|
				isAdd: 0,
 | 
						|
				ORG_ID: uni.getStorageSync('orgId'),
 | 
						|
				checkboxList1: [{
 | 
						|
						name: '讲授法',
 | 
						|
					},
 | 
						|
					{
 | 
						|
						name: '视听法',
 | 
						|
					},
 | 
						|
					{
 | 
						|
						name: '研讨法',
 | 
						|
					},
 | 
						|
					{
 | 
						|
						name: '演示法',
 | 
						|
					}
 | 
						|
				]
 | 
						|
			}
 | 
						|
		},
 | 
						|
		onLoad(option) {
 | 
						|
			this.TaskID = option.taskID ? option.taskID : '';
 | 
						|
			this.model.ID = option.ID ? option.ID : '';
 | 
						|
			this.tableKey = option.tableKey ? option.tableKey : '0';
 | 
						|
			this.loadData();
 | 
						|
		},
 | 
						|
		methods: {
 | 
						|
			checkboxChange(arr) {
 | 
						|
				let tempModel = "_" + arr.join("_") + "_";
 | 
						|
				tempModel = tempModel.replaceAll("讲授法", 1);
 | 
						|
				tempModel = tempModel.replaceAll("视听法", 2);
 | 
						|
				tempModel = tempModel.replaceAll("研讨法", 3);
 | 
						|
				tempModel = tempModel.replaceAll("演示法", 4);
 | 
						|
				this.model.TRAIN_MODEL = tempModel;
 | 
						|
			},
 | 
						|
			loadData() {
 | 
						|
				const json = initFilter(this.ORG_ID, "", "")
 | 
						|
				if (this.listPropValUpload.length == 0) {
 | 
						|
					this.listPropValUpload.push(this.model.ID)
 | 
						|
				}
 | 
						|
				extendInclude(json, "Nav_User")
 | 
						|
				extendInclude(json, "Nav_Department")
 | 
						|
				extendInclude(json, "Nav_Content")
 | 
						|
				extendInclude(json, "Nav_EDUCard.Nav_Post")
 | 
						|
				extendInclude(json, "Nav_EDUCard.Nav_Department")
 | 
						|
				extendInclude(json, "Nav_EDUCard.Nav_User")
 | 
						|
				extendInclude(json, "Nav_TrainSignatureFile.Nav_ImgFile.Nav_File")
 | 
						|
				extendInclude(json, "Nav_TrainRecordFile.Nav_ImgFile.Nav_File")
 | 
						|
				// TODO: id 未获取
 | 
						|
				extendRule(json, 'ID', 1, this.model.ID)
 | 
						|
				getRequest(json, "/SE/ThreeLevelSafeTrainRecord/Get").then(res => {
 | 
						|
					this.model = res
 | 
						|
					this.model.Nav_EDUCard.Nav_User.ENTRYTIME = uni.$u.timeFormat(this.model.Nav_EDUCard.Nav_User
 | 
						|
						.ENTRYTIME, 'yyyy-mm-dd');
 | 
						|
					if (this.model.TRAIN_MODEL != null || this.model.TRAIN_MODEL != undefined) {
 | 
						|
						if (this.model.TRAIN_MODEL.indexOf(1) > -1) {
 | 
						|
							this.model.TRAIN_MODEL_SHOW = "讲授法";
 | 
						|
						} else if (this.model.TRAIN_MODEL.indexOf(2) > -1) {
 | 
						|
							this.model.TRAIN_MODEL_SHOW = "视听法";
 | 
						|
						} else if (this.model.TRAIN_MODEL.indexOf(3) > -1) {
 | 
						|
							this.model.TRAIN_MODEL_SHOW = "研讨法";
 | 
						|
						} else if (this.model.TRAIN_MODEL.indexOf(4) > -1) {
 | 
						|
							this.model.TRAIN_MODEL_SHOW = "演示法";
 | 
						|
						}
 | 
						|
					}
 | 
						|
					if (this.model.EXAMINATION_RESULTS != null || this.model.EXAMINATION_RESULTS != undefined) {
 | 
						|
						if (this.model.EXAMINATION_RESULTS == 0) {
 | 
						|
							this.model.EXAMINATION_RESULTS_SHOW = "不合格";
 | 
						|
						} else if (this.model.EXAMINATION_RESULTS == 1) {
 | 
						|
							this.model.EXAMINATION_RESULTS_SHOW = "合格";
 | 
						|
						}
 | 
						|
					}
 | 
						|
				})
 | 
						|
			},
 | 
						|
			closePicker() {
 | 
						|
				this.comPickerInfo = {
 | 
						|
					showSheet: false,
 | 
						|
					columns: [],
 | 
						|
					title: '',
 | 
						|
					name: '',
 | 
						|
					dataIndex: undefined,
 | 
						|
					formIndex: undefined
 | 
						|
				}
 | 
						|
			},
 | 
						|
			async handleShowSheet(p, index) {
 | 
						|
				let column = []
 | 
						|
				this.levelIndex = index;
 | 
						|
				if (p.name === 'EXAMINATION_RESULTS') {
 | 
						|
					column = [{
 | 
						|
							NAME: '合格',
 | 
						|
							ID: 1
 | 
						|
						},
 | 
						|
						{
 | 
						|
							NAME: '不合格',
 | 
						|
							ID: 0
 | 
						|
						}
 | 
						|
					]
 | 
						|
				}
 | 
						|
				if (column.length) {
 | 
						|
					this.comPickerInfo = {
 | 
						|
						showSheet: true,
 | 
						|
						title: p.title,
 | 
						|
						name: p.name,
 | 
						|
						formIndex: p.formIndex,
 | 
						|
						columns: [column]
 | 
						|
					}
 | 
						|
				} else {
 | 
						|
					// 暂无数据
 | 
						|
				}
 | 
						|
			},
 | 
						|
			//显示时间控件
 | 
						|
			showCheckDate(p) {
 | 
						|
				if (p.name === 'START_TIME') {
 | 
						|
					if (this.model.START_TIME == null) {
 | 
						|
						this.model.START_TIME = uni.$u.timeFormat(new Date(),
 | 
						|
							'yyyy-mm-dd hh:MM')
 | 
						|
					}
 | 
						|
					this.dateTimePickerInfo = {
 | 
						|
						showCheckDate: true,
 | 
						|
						dataIndex: p.dataIndex,
 | 
						|
						defaultDateTime: this.model.START_TIME,
 | 
						|
						name: p.name
 | 
						|
					}
 | 
						|
				} else if (p.name === 'END_TIME') {
 | 
						|
					if (this.model.END_TIME == null) {
 | 
						|
						this.model.END_TIME = uni.$u.timeFormat(new Date(),
 | 
						|
							'yyyy-mm-dd hh:MM')
 | 
						|
					}
 | 
						|
					this.dateTimePickerInfo = {
 | 
						|
						showCheckDate: true,
 | 
						|
						dataIndex: p.dataIndex,
 | 
						|
						defaultDateTime: this.model.END_TIME,
 | 
						|
						name: p.name
 | 
						|
					}
 | 
						|
				}
 | 
						|
			},
 | 
						|
			//隐藏控件 显示时间
 | 
						|
			handleCheckDate(e) {
 | 
						|
				const {
 | 
						|
					name,
 | 
						|
					dataIndex
 | 
						|
				} = this.dateTimePickerInfo
 | 
						|
				if (name === 'START_TIME') {
 | 
						|
					this.model.START_TIME = uni.$u.timeFormat(e.value,
 | 
						|
						'yyyy-mm-dd hh:MM')
 | 
						|
				}
 | 
						|
				if (name === 'END_TIME') {
 | 
						|
					this.model.END_TIME = uni.$u.timeFormat(e.value,
 | 
						|
						'yyyy-mm-dd hh:MM')
 | 
						|
				}
 | 
						|
				this.dateTimePickerInfo.showCheckDate = false
 | 
						|
			},
 | 
						|
			onConfirmPicker(e) {
 | 
						|
				const {
 | 
						|
					name,
 | 
						|
					formIndex
 | 
						|
				} = this.comPickerInfo
 | 
						|
				this.model[name] = e.value[0].ID
 | 
						|
				this.model[name + '_SHOW'] = e.value[0].NAME
 | 
						|
				this.comPickerInfo.showSheet = false
 | 
						|
			},
 | 
						|
			submit() {
 | 
						|
				const ele = this.$refs
 | 
						|
				ele['wForm'].validate().then(res => {
 | 
						|
					this.model.PUBLISH = "SaveAndNotify";
 | 
						|
					if (this.TaskID != "") {
 | 
						|
						this.model.TaskID = this.TaskID;
 | 
						|
					}
 | 
						|
					if (this.model.ORG_ID == "") {
 | 
						|
						this.model.ORG_ID = this.ORG_ID;
 | 
						|
					}
 | 
						|
					this.model.START_TIME = uni.$u.timeFormat(this.model.START_TIME,
 | 
						|
						'yyyy-mm-dd hh:MM:ss');
 | 
						|
					this.model.END_TIME = uni.$u.timeFormat(this.model.END_TIME,
 | 
						|
						'yyyy-mm-dd hh:MM:ss');
 | 
						|
					this.model.Nav_TrainRecordFile.forEach(item => {
 | 
						|
						if (item.TRAIN_RECORD_ID == undefined) {
 | 
						|
							item.TRAIN_RECORD_ID = this.model.ID;
 | 
						|
						}
 | 
						|
						if (item.ORG_ID == undefined) {
 | 
						|
							item.ORG_ID = this.model.ORG_ID;
 | 
						|
						}
 | 
						|
					});
 | 
						|
					getRequest(this.model, "/SE/SEThreeLevelSafeTrainRecord/FullUpdate").then(res => {
 | 
						|
						if (res) {
 | 
						|
							uni.$showMsgFunc('操作成功!', () => {
 | 
						|
								uni.navigateBack()
 | 
						|
							}, 'success', 1000)
 | 
						|
						}
 | 
						|
					})
 | 
						|
				}).catch(err => {
 | 
						|
					console.log(err)
 | 
						|
					uni.$showErrorInfo('请检查必填项,必填项不能为空')
 | 
						|
				})
 | 
						|
			},
 | 
						|
 | 
						|
		}
 | 
						|
	}
 | 
						|
</script>
 | 
						|
 | 
						|
<style scoped>
 | 
						|
	@import url("../../../../style/css/editTemplate.css");
 | 
						|
 | 
						|
	.todo-page {
 | 
						|
		padding: 16px 16px 70px;
 | 
						|
	}
 | 
						|
</style> |