培训计划调整
This commit is contained in:
parent
289c1263f5
commit
feff92f79e
|
@ -2,7 +2,9 @@ import request from '@/utils/request'
|
||||||
|
|
||||||
const trainPlanAPI = {
|
const trainPlanAPI = {
|
||||||
add: '/trainPlan/add',
|
add: '/trainPlan/add',
|
||||||
list: '/trainPlan/list'
|
list: '/trainPlan/list',
|
||||||
|
get: '/trainPlan/get',
|
||||||
|
del: '/trainPlan/del'
|
||||||
}
|
}
|
||||||
|
|
||||||
export function trainPlanAdd(params) {
|
export function trainPlanAdd(params) {
|
||||||
|
@ -19,4 +21,20 @@ export function trainPlanList(params) {
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: params
|
params: params
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function trainPlanGet(params) {
|
||||||
|
return request({
|
||||||
|
url: trainPlanAPI.get,
|
||||||
|
method: 'get',
|
||||||
|
params: params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function trainPlanDel(params) {
|
||||||
|
return request({
|
||||||
|
url: trainPlanAPI.del,
|
||||||
|
method: 'delete',
|
||||||
|
params: params
|
||||||
|
})
|
||||||
}
|
}
|
|
@ -2,20 +2,20 @@
|
||||||
<a-card :bordered="false" :title="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" :disabled="disabled" />
|
||||||
</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="--请选择--">
|
<a-select v-model="form.year" placeholder="--请选择--" :disabled="disabled">
|
||||||
<a-select-option v-for="entity in years" :key="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 v-if="!disabled" type="primary" size="default" icon="plus" @click="showDrawer" style="margin-right: 8px;">选择项目</a-button>
|
||||||
<a-table v-if="selectedRows.length > 0" rowKey="id" :columns="columns" :data-source="selectedRows" :pagination="false"></a-table>
|
<a-table v-if="selectedRows.length > 0" rowKey="id" :columns="columns" :data-source="selectedRows" :pagination="false"></a-table>
|
||||||
<a-form-model-item label="备注">
|
<a-form-model-item label="备注">
|
||||||
<a-input v-model="form.remark" type="textarea" />
|
<a-input v-model="form.remark" type="textarea" :disabled="disabled" />
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
<a-col :span="24" style="text-align: center;">
|
<a-col :span="24" style="text-align: center;">
|
||||||
<a-button type="primary" size="default" @click="handleSave" style="margin-right: 8px;">保存</a-button>
|
<a-button v-if="!disabled" type="primary" size="default" @click="handleSave" style="margin-right: 8px;">保存</a-button>
|
||||||
<a-button type="danger" size="default" @click="showConfirm">关闭</a-button>
|
<a-button type="danger" size="default" @click="showConfirm">关闭</a-button>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-form-model>
|
</a-form-model>
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
// 例如:import 《组件名称》 from '《组件路径》'
|
// 例如:import 《组件名称》 from '《组件路径》'
|
||||||
import { STable } from '@/components'
|
import { STable } from '@/components'
|
||||||
import { getProjectList } from '@/api/project/project'
|
import { getProjectList } from '@/api/project/project'
|
||||||
import { trainPlanAdd } from '@/api/trainplan';
|
import { trainPlanAdd, trainPlanGet } from '@/api/trainplan';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
// import引入的组件需要注入到对象中才能使用
|
// import引入的组件需要注入到对象中才能使用
|
||||||
|
@ -41,6 +41,7 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
// 这里存放数据
|
// 这里存放数据
|
||||||
return {
|
return {
|
||||||
|
disabled: false,
|
||||||
title: '年度培训计划',
|
title: '年度培训计划',
|
||||||
queryParam: {
|
queryParam: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
|
@ -56,7 +57,6 @@ export default {
|
||||||
projectIds: [],
|
projectIds: [],
|
||||||
status: 1, //未发布
|
status: 1, //未发布
|
||||||
},
|
},
|
||||||
rowSelection: {},
|
|
||||||
selectedRows: [],
|
selectedRows: [],
|
||||||
selectedRowKeys: [],
|
selectedRowKeys: [],
|
||||||
rules: {
|
rules: {
|
||||||
|
@ -120,10 +120,19 @@ export default {
|
||||||
|
|
||||||
/** 提示框 START */
|
/** 提示框 START */
|
||||||
showConfirm() {
|
showConfirm() {
|
||||||
|
|
||||||
this.$confirm({
|
this.$confirm({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
content: h => <span style="color:red;font-size:15px;">关闭后当前未保存的数据将丢失! 确认关闭吗?</span>,
|
content: h => <span style="color:red;font-size:15px;">关闭后当前未保存的数据将丢失! 确认关闭吗?</span>,
|
||||||
onOk() { console.log('OK'); },
|
onOk() {
|
||||||
|
this.$router.push({
|
||||||
|
path: '/trainPlan/list/' + this.$route.query.t,
|
||||||
|
query: {
|
||||||
|
t: this.queryParam.type, //自主项目还是系统项目,控制路由跳转
|
||||||
|
trainPlanPageNum: this.$route.query.trainPlanPageNum, //当前页
|
||||||
|
},
|
||||||
|
})
|
||||||
|
},
|
||||||
onCancel() { console.log('Cancel'); },
|
onCancel() { console.log('Cancel'); },
|
||||||
class: 'test',
|
class: 'test',
|
||||||
});
|
});
|
||||||
|
@ -183,9 +192,20 @@ export default {
|
||||||
},
|
},
|
||||||
// 生命周期 - 创建完成(可以访问当前this实例)
|
// 生命周期 - 创建完成(可以访问当前this实例)
|
||||||
created() {
|
created() {
|
||||||
|
let id = this.$route.query.trainPlanId;
|
||||||
|
|
||||||
this.initYears();
|
this.initYears();
|
||||||
|
if (id) {
|
||||||
|
trainPlanGet({ id: id }).then((res) => {
|
||||||
|
this.form = res.data;
|
||||||
|
this.selectedRows = res.data.projects;
|
||||||
|
this.selectedRowKeys = res.data.projectIds;
|
||||||
|
this.disabled = this.$route.query.showDetail === 'true' ? true : false;
|
||||||
|
})
|
||||||
|
}
|
||||||
if (this.$route.query.t != 'year') {
|
if (this.$route.query.t != 'year') {
|
||||||
this.queryParam.type = 3; //修改为单位培训计划
|
this.queryParam.type = 3; //修改为单位培训计划
|
||||||
|
this.form.type = 3;
|
||||||
this.title = '单位培训计划'
|
this.title = '单位培训计划'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -23,9 +23,13 @@
|
||||||
</span>
|
</span>
|
||||||
<span slot="action" slot-scope="text, record">
|
<span slot="action" slot-scope="text, record">
|
||||||
<template>
|
<template>
|
||||||
<a-popconfirm title="是否发布?" @confirm="() => handledRelease(record)">
|
<a-popconfirm title="确定要删除当前培训计划吗?" @confirm="() => handledDelete(record)">
|
||||||
<a href="javascript:;">发布</a>
|
<a v-if="year < record.year" href="javascript:;">删除</a>
|
||||||
</a-popconfirm>
|
</a-popconfirm>
|
||||||
|
<a-divider type="vertical" v-if="year < record.year" />
|
||||||
|
<a v-if="year < record.year" href="javascript:;" @click="handledCreate(record)">编辑</a>
|
||||||
|
<a-divider type="vertical" v-if="year < record.year" />
|
||||||
|
<a href="javascript:;" @click="handledCreate(record,true)">详情</a>
|
||||||
</template>
|
</template>
|
||||||
</span>
|
</span>
|
||||||
</s-table>
|
</s-table>
|
||||||
|
@ -36,7 +40,7 @@
|
||||||
// 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
|
// 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
|
||||||
// 例如:import 《组件名称》 from '《组件路径》'
|
// 例如:import 《组件名称》 from '《组件路径》'
|
||||||
import { STable } from '@/components'
|
import { STable } from '@/components'
|
||||||
import { trainPlanList } from '@/api/trainplan'
|
import { trainPlanList, trainPlanDel } from '@/api/trainplan'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
// import引入的组件需要注入到对象中才能使用
|
// import引入的组件需要注入到对象中才能使用
|
||||||
|
@ -53,30 +57,13 @@ export default {
|
||||||
year: '',
|
year: '',
|
||||||
type: '',
|
type: '',
|
||||||
},
|
},
|
||||||
|
year: new Date().getFullYear(),
|
||||||
|
|
||||||
// 表头
|
// 表头
|
||||||
columns: [
|
columns: [
|
||||||
{ title: '序号', key: 'id', dataIndex: 'id', width: 60, scopedSlots: { customRender: 'serial' } },
|
{ title: '序号', key: 'id', dataIndex: 'id', width: 60, scopedSlots: { customRender: 'serial' } },
|
||||||
{ title: '计划名称', dataIndex: 'name', key: 'name' },
|
{ title: '计划名称', dataIndex: 'name', key: 'name' },
|
||||||
{ title: '年度', dataIndex: 'year', key: 'year', customRender: (text, record, index) => { return record.year + ' 年度 ' } },
|
{ 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: 'createName', dataIndex: 'createName' },
|
||||||
{ title: '创建时间', key: 'createTime', dataIndex: 'createTime' },
|
{ 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' }, },
|
||||||
|
@ -102,7 +89,7 @@ export default {
|
||||||
// 方法集合
|
// 方法集合
|
||||||
methods: {
|
methods: {
|
||||||
// 增改
|
// 增改
|
||||||
handledCreate(record) {
|
handledCreate(record,showDetail) {
|
||||||
console.log(this.queryParam)
|
console.log(this.queryParam)
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
path: '/project/trainPlan/TrainPlanForm',
|
path: '/project/trainPlan/TrainPlanForm',
|
||||||
|
@ -110,9 +97,21 @@ export default {
|
||||||
t: this.queryParam.type, //自主项目还是系统项目,控制路由跳转
|
t: this.queryParam.type, //自主项目还是系统项目,控制路由跳转
|
||||||
trainPlanId: record.id, //项目id
|
trainPlanId: record.id, //项目id
|
||||||
trainPlanPageNum: this.$refs.table.localPagination.current, //当前页
|
trainPlanPageNum: this.$refs.table.localPagination.current, //当前页
|
||||||
|
showDetail: showDetail || false, //显示详情使用,bool值 true是详情,false不是详情
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
//删除
|
||||||
|
handledDelete(record) {
|
||||||
|
trainPlanDel({ id: record.id }).then(res => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
this.$notification['success']({
|
||||||
|
message: '培训计划《'+ record.name +'删除成功!',
|
||||||
|
});
|
||||||
|
this.$refs.table.refresh(true);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
//变更类型
|
//变更类型
|
||||||
changeType(path) {
|
changeType(path) {
|
||||||
console.log('变更路由:', path)
|
console.log('变更路由:', path)
|
||||||
|
|
Loading…
Reference in New Issue