jy-safe-app/pages/apply/subPages/SE/5newThreeLevelEducateEdit.vue

409 lines
13 KiB
Vue
Raw Permalink Normal View History

2025-10-14 15:17:30 +08:00
<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="开始时间" 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="培训地点:" required prop="TAINNING_ADDR" borderBottom>
<u--input v-model="model.TAINNING_ADDR" border="none" slot="right"
inputAlign="right"></u--input>
</u-form-item>
<u-form-item label="培训时长:" required 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="培训老师:" required prop="TEACHER" borderBottom>
<u--input v-model="model.TEACHER" border="none" slot="right" inputAlign="right"></u--input>
</u-form-item>
<u-form-item label="培训形式:" required 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="培训内容:" 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>
<view class="upload-title">附件</view>
<full-upload v-model="model.Nav_Files" :isShowBtn='true' :listProp='listPropUpload'
:listPropVal='listPropValUpload'></full-upload>
</u--form>
</uni-card>
</view>
<u-sticky offset-top="20">
<view class="sub-form">
<view class="sub-form-wrap">
<u--form labelPosition="left" labelWidth="auto" labelAlign="center" errorType="border-bottom"
ref="sForm">
<uni-collapse>
<uni-card style="margin-bottom: 16px;" margin="0" spacing="0" :is-shadow="false"
v-for="(item, index) in model.Nav_NewUserDetail.filter(i => !i.IS_DELETED)">
<uni-collapse-item title-border="none" :show-arrow="false" :border="false" :open="true">
<view slot="title" class="custom-collapse-title">
<view class="down">
<uni-icons type="bottom"></uni-icons>
</view>
<view class="text">{{index + 1 + '. ' +item.Nav_User.NAME}}</view>
</view>
<u-form-item label="工号:" borderBottom>
<u--input v-model="item.CODE" border="none" inputAlign="right"></u--input>
</u-form-item>
<u-form-item label="姓名:" borderBottom>
<u--input v-if="item.Nav_User" v-model="item.Nav_User.NAME" border="none"
inputAlign="right" disabled></u--input>
</u-form-item>
<u-form-item label="身份证号:" borderBottom>
<u--input v-model="item.ID_CARD_NUMBER" border="none" inputAlign="right"
disabled></u--input>
</u-form-item>
<u-form-item label="入职时间:" borderBottom>
<u--input v-model="item.IN_TIME" border="none" inputAlign="right"
disabled></u--input>
</u-form-item>
<u-form-item required label="分数:" borderBottom>
<u--input v-model="item.SCORE" border="none" inputAlign="right"></u--input>
</u-form-item>
<u-form-item label="部门:" borderBottom>
<u--input v-if="item.Nav_User" v-model="item.Nav_User.NAME" border="none"
inputAlign="right" disabled disabledColor="#ffffff"></u--input>
</u-form-item>
<u-form-item label="岗位:" borderBottom>
<u--input v-if="item.Nav_User" v-model="item.Nav_User.NAME" border="none"
inputAlign="right" disabled disabledColor="#ffffff"></u--input>
</u-form-item>
<u-form-item required label="考核结果:" required 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>
</uni-collapse-item>
</uni-card>
</uni-collapse>
</u--form>
</view>
</view>
</u-sticky>
<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: {
'START_TIME': {
type: 'string',
required: true,
trigger: ['blur', 'change']
},
'END_TIME': {
type: 'string',
required: true,
trigger: ['blur', 'change']
},
'TAINNING_ADDR': {
type: 'string',
required: true,
trigger: ['blur', 'change']
},
'TRAINNING_TIME': {
type: 'string',
required: true,
trigger: ['blur', 'change']
},
'TEACHER': {
type: 'string',
required: true,
trigger: ['blur', 'change']
},
'TRAIN_MODEL': {
type: 'string',
required: true,
trigger: ['blur', 'change']
},
'SCORE': {
type: 'number',
required: true,
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_Files.Nav_ImgFile")
extendInclude(json, "Nav_NewUserDetail.Nav_Files.Nav_ImgFile")
extendInclude(json, "Nav_NewUserDetail.Nav_User")
extendInclude(json, "Nav_NewUserDetail.Nav_Department")
extendInclude(json, "Nav_NewUserDetail.Nav_Post")
extendRule(json, 'ID', 1, this.model.ID)
getRequest(json, "/SE/NewUsers/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 = "合格";
}
} else {
this.model.EXAMINATION_RESULTS_SHOW = "合格";
this.model.EXAMINATION_RESULTS = "1";
}
})
},
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_Files.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/SENewUsers/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>