2021-11-03 16:41:57 +08:00

109 lines
4.4 KiB
Vue

<template>
<a-card :bordered="false" title="项目档案">
<div class="table-page-search-wrapper">
<SearchCom :form="queryParam" :list="queryOptions" @search="handleRefresh" @reset="() => {queryParam = {}, handleRefresh()}"></SearchCom>
<div style="width: 100%; height: 32px; margin-bottom: 8px;">
<a-button type="primary">导出</a-button>
</div>
</div>
<s-table ref="table" size="small" rowKey="id" :columns="columns" :data="loadData" :pageNum="Number(this.$route.query.pageNum) || 1">
<template slot="action" slot-scope="text, record">
<a-dropdown>
<a class="ant-dropdown-link">操作
<a-icon type="down" />
</a>
<a-menu slot="overlay">
<a-menu-item v-if="hasPerm('archives:project:user:list')">
<a href="javascript:;" @click="archivesProjectUser(record)">人员记录</a>
</a-menu-item>
<a-menu-item>
<a href="javascript:;" @click="exportData(record)">导出</a>
</a-menu-item>
</a-menu>
</a-dropdown>
</template>
</s-table>
</a-card>
</template>
<script>
import { STable, SearchCom } from '@/components'
import { getArchivesProjectList } from '@/api/archives/project'
import { classList } from '@/api/project/class'
export default {
components: { STable, SearchCom },
data() {
return {
queryParam: { trainClass: '', trainWay: '', projectName: '' },
columns: [
{ title: '项目ID', width: '60px', align: 'center', dataIndex: 'id', key: 'id' },
{ title: '项目名称', width: 'auto', align: 'center', dataIndex: 'name', key: 'name' },
{ title: '项目时间', width: 'auto', align: 'center', dataIndex: 'time', key: 'time' },
{ title: '项目类别', width: 'auto', align: 'center', dataIndex: 'way', key: 'way' },
{ title: '人数', width: '60px', align: 'center', dataIndex: 'peopleSize', key: 'peopleSize' },
{ title: '创建人', width: 'auto', align: 'center', dataIndex: 'creater', key: 'creater' },
{ title: '创建时间', width: 'auto', align: 'center', dataIndex: 'createTime', key: 'createTime' },
{ title: '项目状态', width: '80px', align: 'center', dataIndex: 'statusName', key: 'statusName' },
{ title: '操作', width: '70px', key: 'operation', align: 'center', scopedSlots: { customRender: 'action' } }
],
loadData: parameter => { return getArchivesProjectList(Object.assign(parameter, this.queryParam)).then(res => { return res }) },
trainClass: []
}
},
created: function () {
classList({ pageNum: 1, pageSize: 9999 }).then(res => {
for (let index in res.rows) {
let item = res.rows[index];
let item_ = {};
item_.id = item.id.toString();
item_.name = item.value;
this.trainClass.push(item_);
}
});
if (this.$route.query.queryParamTrainClass) this.queryParam.trainClass = this.$route.query.queryParamTrainClass;
if (this.$route.query.queryParamTrainWay) this.queryParam.trainWay = this.$route.query.queryParamTrainWay;
if (this.$route.query.queryParamProjectName) this.queryParam.projectName = this.$route.query.queryParamProjectName;
},
computed: {
queryOptions: function () {
return [
{ type: 'select', placeholder: '培训种类', key: 'trainClass', options: [{ id: '', name: '全部' }, ...this.trainClass] },
{
type: 'select', placeholder: '培训方式', key: 'trainWay', options: [
// 培训方式 1-培训 2-考试 3-培训练习 4-培训练习考试
{ id: '', name: '全部' },
{ id: '1', name: '培训' },
{ id: '2', name: '考试' },
{ id: '3', name: '培训练习' },
{ id: '4', name: '培训练习考试' }
]
},
{ type: 'input', placeholder: '项目名称', key: 'projectName' }
]
}
},
methods: {
handleRefresh() {
this.$refs.table.refresh(true)
},
// 培训详情
archivesProjectUser(record) {
this.$router.push({
path: '/archives/project/ProjectUser', query: {
id: record.id,
queryParamTrainClass: this.queryParam.trainClass,
queryParamTrainWay: this.queryParam.trainWay,
queryParamProjectName: this.queryParam.projectName,
pageNum: this.$refs.table.localPagination.current
}
});
},
// 导出
exportData(record) {
}
}
}
</script>