培训计划调整
This commit is contained in:
parent
4c8f3c5df6
commit
289c1263f5
|
@ -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
|
||||
})
|
||||
}
|
|
@ -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() { },
|
||||
// 生命周期 - 创建之前
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
// 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
|
||||
// 例如: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
|
||||
})
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue