培训计划调整

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 = { const trainPlanAPI = {
add: '/trainPlan/add', add: '/trainPlan/add',
list: '/trainPlan/list'
} }
export function trainPlanAdd(params) { export function trainPlanAdd(params) {
@ -11,3 +12,11 @@ export function trainPlanAdd(params) {
data: params data: params
}) })
} }
export function trainPlanList(params) {
return request({
url: trainPlanAPI.list,
method: 'get',
params: params
})
}

View File

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

View File

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