培训计划调整

This commit is contained in:
Yjhon 2022-03-12 16:54:19 +08:00
parent 4c8f3c5df6
commit 289c1263f5
3 changed files with 63 additions and 37 deletions

View File

@ -2,6 +2,7 @@ import request from '@/utils/request'
const trainPlanAPI = {
add: '/trainPlan/add',
list: '/trainPlan/list'
}
export function trainPlanAdd(params) {
@ -10,4 +11,12 @@ export function trainPlanAdd(params) {
method: 'post',
data: params
})
}
export function trainPlanList(params) {
return request({
url: trainPlanAPI.list,
method: 'get',
params: params
})
}

View File

@ -1,12 +1,12 @@
<template>
<a-card :bordered="false" title="培训计划">
<a-card :bordered="false" :title="title">
<a-form-model ref="form" :rules="rules" :model="form" :layout="'horizontal'">
<a-form-model-item label="培训计划名称" prop="name">
<a-input v-model="form.name" />
</a-form-model-item>
<a-form-model-item label="培训计划年度" prop="year">
<a-select v-model="form.year" placeholder="--请选择--" defaultValue=''>
<a-select-option v-for="entity in years" :key="Number(entity)"> {{ entity }}年度 </a-select-option>
<a-select v-model="form.year" placeholder="--请选择--">
<a-select-option v-for="entity in years" :key="entity"> {{ entity }}年度 </a-select-option>
</a-select>
</a-form-model-item>
<a-button type="primary" size="default" icon="plus" @click="showDrawer" style="margin-right: 8px;">选择项目</a-button>
@ -41,6 +41,7 @@ export default {
data() {
//
return {
title: '年度培训计划',
queryParam: {
pageNum: 1,
pageSize: 20
@ -49,8 +50,9 @@ export default {
visible: false,
years: [],
form: {
type: 2, //
name: '',
year: Number,
year: '',
projectIds: [],
status: 1, //
},
@ -89,14 +91,22 @@ export default {
console.log('form', this.form)
trainPlanAdd(Object.assign({}, this.form)).then((res) => {
if (res.code == 200) {
this.$router.push({
path: '/trainPlan/list/'+this.$route.query.t,
query: {
t: this.queryParam.type, //
trainPlanPageNum: this.$route.query.trainPlanPageNum, //
},
})
} else{
this.$notification['success']({
message: '保存成功',
description:
'稍后返回列表页面',
});
setTimeout(() => {
this.$router.push({
path: '/trainPlan/list/' + this.$route.query.t,
query: {
t: this.queryParam.type, //
trainPlanPageNum: this.$route.query.trainPlanPageNum, //
},
})
}, 1200)
} else {
this.$message.error('保存失败!')
}
})
@ -168,10 +178,17 @@ export default {
for (let i = 0; i < 5; i++) {
this.years.push(new Date().getFullYear() - 2 + i);
}
console.log('YEARS', this.years)
}
},
// - 访this
created() { this.initYears() },
created() {
this.initYears();
if (this.$route.query.t != 'year') {
this.queryParam.type = 3; //
this.title = '单位培训计划'
}
},
// - 访DOM
mounted() { },
// -

View File

@ -36,7 +36,7 @@
// jsjsjson
// import from ''
import { STable } from '@/components'
import { getProjectList, releaseProject, projectDel } from '@/api/project/project'
import { trainPlanList } from '@/api/trainplan'
export default {
// import使
@ -57,33 +57,33 @@ export default {
//
columns: [
{ title: '序号', key: 'id', dataIndex: 'id', width: 60, scopedSlots: { customRender: 'serial' } },
{ title: '计划名称', dataIndex: 'projectName', key: 'projectName' },
{ title: '年度', dataIndex: 'startDate', key: 'startDate', customRender: (text, record, index) => { return record.year + ' 年度 ' } },
{
title: '项目状态', key: 'status', dataIndex: 'status',
customRender: (text, record, index) => {
// 1- 2- 3- 4-
if (text == 1) {
return '未发布'
}
if (text == 2) {
return '未开始'
}
if (text == 3) {
return '进行中'
}
if (text == 4) {
return '已结束'
}
},
},
{ title: '创建人员', key: 'createBy', dataIndex: 'createBy' },
{ title: '创建时间', key: 'createDate', dataIndex: 'createDate' },
{ title: '计划名称', dataIndex: 'name', key: 'name' },
{ title: '年度', dataIndex: 'year', key: 'year', customRender: (text, record, index) => { return record.year + ' 年度 ' } },
// {
// title: '', key: 'status', dataIndex: 'status',
// customRender: (text, record, index) => {
// // 1- 2- 3- 4-
// if (text == 1) {
// return ''
// }
// if (text == 2) {
// return ''
// }
// if (text == 3) {
// return ''
// }
// if (text == 4) {
// return ''
// }
// },
// },
{ title: '创建人员', key: 'createName', dataIndex: 'createName' },
{ title: '创建时间', key: 'createTime', dataIndex: 'createTime' },
{ title: '操作', width: 200, key: 'action', align: 'center', scopedSlots: { customRender: 'action' }, },
],
// Promise
loadData: (parameter) => {
return getProjectList(Object.assign(parameter, this.queryParam)).then((res) => {
return trainPlanList(Object.assign(parameter, this.queryParam)).then((res) => {
return res
})
},