parent
88a434707a
commit
4528800e2f
@ -0,0 +1,178 @@
|
||||
<template>
|
||||
<div class="honor-list-content-style">
|
||||
<template v-if="pageType === 0">
|
||||
<div class="search-and-add-style">
|
||||
<a-button type="primary" @click="toAdd">新增</a-button>
|
||||
</div>
|
||||
<a-table :columns="tableColumn" :data-source="dataList" :loading="loading" :pagination="false">
|
||||
<span slot="action" slot-scope="text, record">
|
||||
<a @click="toDelete(record)">删除</a>
|
||||
</span>
|
||||
</a-table>
|
||||
<a-pagination v-if="totalPage > 1" v-model="pageNumber" :pageSize="pageSize" :total="totalNum"
|
||||
@change="onPageChange"/>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import InterConfig from '../interConfig';
|
||||
import {Table, Pagination, Button} from 'ant-design-vue';
|
||||
import _ from 'lodash';
|
||||
const tableColumn = [
|
||||
{
|
||||
dataIndex: 'index',
|
||||
key: 'index',
|
||||
title: '序号',
|
||||
width: "80px",
|
||||
align: "center"
|
||||
},
|
||||
{
|
||||
dataIndex: 'honor_person_name',
|
||||
key: 'honorPersonName',
|
||||
title: '人员姓名',
|
||||
align: "center"
|
||||
},
|
||||
{
|
||||
dataIndex: 'category_name',
|
||||
key: 'categoryName',
|
||||
title: '荣誉称号',
|
||||
align: "center"
|
||||
}
|
||||
]
|
||||
export default{
|
||||
props: ["menuId"],
|
||||
data(){
|
||||
return {
|
||||
pageType: 0,//0 列表页面 1 新增页面
|
||||
categoryType: 0,// 5 教师 6 学生
|
||||
pageNumber: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
totalNum: 0,
|
||||
tableColumn: [],
|
||||
dataList: [],
|
||||
loading: false,
|
||||
}
|
||||
},
|
||||
created(){
|
||||
this.categoryType = this.$props.menuId === "studentHonor" ? 6 : 5;
|
||||
this.buildTableColumn();
|
||||
this.getHonorList();
|
||||
},
|
||||
mounted(){
|
||||
|
||||
},
|
||||
watch: {
|
||||
menuId: function (newId) {
|
||||
this.categoryType = newId === "studentHonor" ? 6 : 5;
|
||||
this.buildTableColumn();
|
||||
this.getHonorList();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
buildTableColumn: function () {
|
||||
this.tableColumn = _.cloneDeep(tableColumn);
|
||||
if (this.categoryType === 5) {
|
||||
//教师
|
||||
this.tableColumn.push({
|
||||
dataIndex: 'subject_name',
|
||||
key: 'subjectName',
|
||||
title: '学科',
|
||||
align: "center"
|
||||
})
|
||||
} else if (this.categoryType === 6) {
|
||||
//学生
|
||||
this.tableColumn.push({
|
||||
dataIndex: 'class_name',
|
||||
key: 'className',
|
||||
title: '班级',
|
||||
align: "center"
|
||||
})
|
||||
}
|
||||
this.tableColumn.push(
|
||||
...[{
|
||||
dataIndex: 'create_time',
|
||||
key: 'createTime',
|
||||
title: '创建时间',
|
||||
align: "center"
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
align: "center",
|
||||
scopedSlots: {customRender: 'action'},
|
||||
}]
|
||||
)
|
||||
},
|
||||
getHonorList: function () {
|
||||
let param = {
|
||||
bureau_id: this.BaseConfig.person_info_my.bureau_id,
|
||||
category_type: this.categoryType,
|
||||
category_id: "",
|
||||
page_number: this.pageNumber,
|
||||
page_size: this.pageSize
|
||||
}
|
||||
this.loading = true;
|
||||
this.InterfaceConfig.callInterface([{
|
||||
url: InterConfig.getHonorList.url,
|
||||
params: param,
|
||||
method: InterConfig.getHonorList.method,
|
||||
isTestLogin: InterConfig.getHonorList.isTestLogin,
|
||||
}], (result) => {
|
||||
this.loading = false;
|
||||
let resData = result[0].data;
|
||||
if (resData.code === 2000) {
|
||||
let dataList = resData.data.list;
|
||||
if (dataList && dataList.length > 0) {
|
||||
for (let i = 0, len = dataList.length; i < len; i++) {
|
||||
dataList[i]['index'] = i + 1 + ((this.pageNumber - 1) * 10);
|
||||
}
|
||||
}
|
||||
this.dataList = dataList;
|
||||
this.totalNum = resData.data.total_row;
|
||||
this.totalPage = resData.data.total_page;
|
||||
}
|
||||
})
|
||||
},
|
||||
toAdd: function () {
|
||||
|
||||
},
|
||||
toDelete: function () {
|
||||
|
||||
}
|
||||
},
|
||||
components: {
|
||||
ATable: Table,
|
||||
APagination: Pagination,
|
||||
AButton: Button
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.honor-list-content-style {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
padding: 0.5rem;
|
||||
.search-and-add-style {
|
||||
width: 100%;
|
||||
height: 3.5rem;
|
||||
background-color: white;
|
||||
margin-bottom: 0.5rem;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0 0.5rem;
|
||||
}
|
||||
.ant-table-wrapper {
|
||||
/deep/ .upload-container-style {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
.ant-pagination {
|
||||
margin-top: 0.5rem;
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Reference in new issue