|
|
@@ -8,9 +8,6 @@
|
|
|
:maxable="true"
|
|
|
@close="cancel"
|
|
|
>
|
|
|
- <div class="training-tip" v-if="trainingProject">
|
|
|
- 培训项目:<b>{{ trainingProject }}</b>
|
|
|
- </div>
|
|
|
<el-form
|
|
|
ref="form"
|
|
|
:model="form"
|
|
|
@@ -19,6 +16,74 @@
|
|
|
class="el-form-box"
|
|
|
v-loading="loading"
|
|
|
>
|
|
|
+ <!-- 培训基本信息(只读,带自培训记录带出) -->
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="培训项目:">
|
|
|
+ <el-input :value="info.trainingProject" disabled placeholder="-" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="地点:">
|
|
|
+ <el-input :value="info.location" disabled placeholder="-" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="培训讲师:">
|
|
|
+ <el-input :value="info.trainingLecturer" disabled placeholder="-" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="讲师资质:">
|
|
|
+ <el-input
|
|
|
+ :value="info.lecturerQualification"
|
|
|
+ disabled
|
|
|
+ placeholder="-"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="计划人数:">
|
|
|
+ <el-input :value="info.plannedCount" disabled placeholder="-" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="实到人数:">
|
|
|
+ <el-input
|
|
|
+ :value="info.actualCount"
|
|
|
+ disabled
|
|
|
+ placeholder="请输入实到人数"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="培训时段:">
|
|
|
+ <el-input :value="trainingPeriod" disabled placeholder="-" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="教学方式:">
|
|
|
+ <el-input :value="info.teachingMethod" disabled placeholder="-" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="培训类别:" prop="trainingCategories">
|
|
|
+ <el-checkbox-group v-model="form.trainingCategories">
|
|
|
+ <el-checkbox
|
|
|
+ v-for="item in trainingCategoryOptions"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.value"
|
|
|
+ >
|
|
|
+ {{ item.label }}
|
|
|
+ </el-checkbox>
|
|
|
+ </el-checkbox-group>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
<el-form-item label="教材:" prop="teachingMaterial">
|
|
|
<el-input
|
|
|
v-model="form.teachingMaterial"
|
|
|
@@ -75,10 +140,17 @@
|
|
|
|
|
|
<script>
|
|
|
import { getById, saveSummary } from '@/api/offlineTraining/index.js';
|
|
|
- import { toValueArray } from '../constants';
|
|
|
+ import {
|
|
|
+ TEACHING_METHOD_OPTIONS,
|
|
|
+ SUMMARY_TRAINING_CATEGORY_OPTIONS,
|
|
|
+ toValueArray,
|
|
|
+ toValueString,
|
|
|
+ toLabelString
|
|
|
+ } from '../constants';
|
|
|
|
|
|
const defForm = {
|
|
|
trainingId: '',
|
|
|
+ trainingCategories: [],
|
|
|
teachingMaterial: '',
|
|
|
evaluationForm: '',
|
|
|
trainingSummary: '',
|
|
|
@@ -86,13 +158,26 @@
|
|
|
summaryAttachments: []
|
|
|
};
|
|
|
|
|
|
+ const defInfo = {
|
|
|
+ trainingProject: '',
|
|
|
+ location: '',
|
|
|
+ trainingLecturer: '',
|
|
|
+ lecturerQualification: '',
|
|
|
+ plannedCount: '',
|
|
|
+ actualCount: '',
|
|
|
+ startTime: '',
|
|
|
+ endTime: '',
|
|
|
+ teachingMethod: ''
|
|
|
+ };
|
|
|
+
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
visible: false,
|
|
|
loading: false,
|
|
|
saving: false,
|
|
|
- trainingProject: '',
|
|
|
+ info: JSON.parse(JSON.stringify(defInfo)),
|
|
|
+ trainingCategoryOptions: SUMMARY_TRAINING_CATEGORY_OPTIONS,
|
|
|
form: JSON.parse(JSON.stringify(defForm)),
|
|
|
rules: {
|
|
|
teachingMaterial: [
|
|
|
@@ -114,26 +199,38 @@
|
|
|
}
|
|
|
};
|
|
|
},
|
|
|
+ computed: {
|
|
|
+ // 培训时段:开始时间 ~ 结束时间
|
|
|
+ trainingPeriod() {
|
|
|
+ const { startTime, endTime } = this.info;
|
|
|
+ if (startTime && endTime) {
|
|
|
+ return `${startTime} ~ ${endTime}`;
|
|
|
+ }
|
|
|
+ return startTime || endTime || '';
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
async open(row) {
|
|
|
this.visible = true;
|
|
|
this.loading = true;
|
|
|
- this.trainingProject = (row && row.trainingProject) || '';
|
|
|
+ this.info = {
|
|
|
+ ...JSON.parse(JSON.stringify(defInfo)),
|
|
|
+ trainingProject: (row && row.trainingProject) || ''
|
|
|
+ };
|
|
|
this.form = { ...JSON.parse(JSON.stringify(defForm)), trainingId: row.id };
|
|
|
try {
|
|
|
const detail = await getById(row.id);
|
|
|
const summary = (detail && detail.summary) || {};
|
|
|
+ this.info = this.mapDetailToInfo(detail);
|
|
|
this.form = {
|
|
|
trainingId: row.id,
|
|
|
+ trainingCategories: toValueArray(summary.trainingCategories),
|
|
|
teachingMaterial: summary.teachingMaterial || '',
|
|
|
evaluationForm: summary.evaluationForm || '',
|
|
|
trainingSummary: summary.trainingSummary || '',
|
|
|
trackingEvaluation: summary.trackingEvaluation || '',
|
|
|
summaryAttachments: toValueArray(summary.summaryAttachments)
|
|
|
};
|
|
|
- if (detail && detail.trainingProject) {
|
|
|
- this.trainingProject = detail.trainingProject;
|
|
|
- }
|
|
|
} catch (error) {
|
|
|
this.$message.error(error.message || '获取培训总结失败');
|
|
|
} finally {
|
|
|
@@ -143,9 +240,33 @@
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+ // 培训记录基本信息(只读展示)
|
|
|
+ mapDetailToInfo(detail) {
|
|
|
+ const data = detail || {};
|
|
|
+ return {
|
|
|
+ trainingProject: data.trainingProject || '',
|
|
|
+ location: data.location || '',
|
|
|
+ trainingLecturer: data.trainingLecturer || '',
|
|
|
+ lecturerQualification: data.lecturerQualification || '',
|
|
|
+ plannedCount:
|
|
|
+ data.plannedCount === undefined || data.plannedCount === null
|
|
|
+ ? ''
|
|
|
+ : data.plannedCount,
|
|
|
+ actualCount:
|
|
|
+ data.actualCount === undefined || data.actualCount === null
|
|
|
+ ? ''
|
|
|
+ : data.actualCount,
|
|
|
+ startTime: data.startTime || '',
|
|
|
+ endTime: data.endTime || '',
|
|
|
+ teachingMethod: toLabelString(
|
|
|
+ TEACHING_METHOD_OPTIONS,
|
|
|
+ data.teachingMethod
|
|
|
+ )
|
|
|
+ };
|
|
|
+ },
|
|
|
cancel() {
|
|
|
this.visible = false;
|
|
|
- this.trainingProject = '';
|
|
|
+ this.info = JSON.parse(JSON.stringify(defInfo));
|
|
|
this.form = JSON.parse(JSON.stringify(defForm));
|
|
|
this.$refs.form && this.$refs.form.clearValidate();
|
|
|
},
|
|
|
@@ -156,6 +277,7 @@
|
|
|
try {
|
|
|
await saveSummary({
|
|
|
trainingId: this.form.trainingId,
|
|
|
+ trainingCategories: toValueString(this.form.trainingCategories),
|
|
|
teachingMaterial: this.form.teachingMaterial,
|
|
|
evaluationForm: this.form.evaluationForm,
|
|
|
trainingSummary: this.form.trainingSummary,
|
|
|
@@ -182,10 +304,4 @@
|
|
|
overflow-y: auto;
|
|
|
padding-right: 10px;
|
|
|
}
|
|
|
-
|
|
|
- .training-tip {
|
|
|
- font-size: 13px;
|
|
|
- color: #303133;
|
|
|
- margin-bottom: 12px;
|
|
|
- }
|
|
|
</style>
|