<template>
|
<div class="custom-box">
|
<v-header
|
title="服务类型管理"
|
></v-header>
|
<div class="serachContent">
|
<el-form :inline="true" class="demo-form-inline">
|
<el-form-item label="关键词">
|
<el-input v-model="search.keyWord" style="width:350px" size="small" placeholder="请输入 请输入类型名称进行查找"></el-input>
|
</el-form-item>
|
<el-form-item>
|
<el-button size="small" type="primary" @click="onSearch()">查询</el-button>
|
<el-button size="small" @click="Reset()">重置</el-button>
|
</el-form-item>
|
</el-form>
|
</div>
|
<div class="addBtn">
|
<el-button size="small" type="primary" @click="add">新增</el-button>
|
</div>
|
<div class="tableBox">
|
<my-eltable
|
id="printTable"
|
ref="mt"
|
:paginationDataSource="tableData"
|
:tabheight="tabheight"
|
:tableHeader="tableHeader"
|
:loading="loading"
|
:checkbox="checkboxTable"
|
:isIndex="isIndex"
|
@onPageSizeChange="onPageSizeChange"
|
@onPaginationChange="onPaginationChange"
|
>
|
<template v-slot:btn="{ scope }">
|
<el-button type="text" @click="edit(scope)">编辑</el-button>
|
<el-button type="text" @click="deletes(scope)">删除</el-button>
|
</template>
|
</my-eltable>
|
</div>
|
<!-- 弹框模板 -->
|
<AddServer v-model="isShow" :serverData="serverData" @change="isShow = false" @success="onAddSuccess"></AddServer>
|
</div>
|
</template>
|
<script>
|
|
// import * as organizationServicer from '@/services/organizationServicer';
|
import MyEltable from '@/components/table/table2';
|
import AddServer from './com/AddServer'
|
export default {
|
components: { MyEltable, AddServer },
|
props: [],
|
data() {
|
return {
|
isShow: false,
|
tableData: {},
|
loading: false,
|
checkboxTable: false,
|
isIndex: true,
|
tabheight: '100%',
|
tableHeader: [
|
{ label: '类型名称', prop: 'name' },
|
{ label: '备注', prop: 'remark' },
|
{ label: '创建人', prop: 'createByName' },
|
{ label: '创建时间', prop: 'createAt' },
|
{ label: '操作', slot: 'btn' }
|
],
|
search: {
|
keyWord: ''
|
},
|
/** 分页参数 */
|
paginationParams: {
|
currentPage: 1,
|
pageSize: 10,
|
total: 0
|
},
|
serverData: {}
|
};
|
},
|
|
mounted() {
|
this.init();
|
},
|
methods: {
|
add() {
|
this.isShow = true;
|
},
|
edit(d) {
|
this.serverData = d;
|
this.isShow = true;
|
},
|
onAddSuccess() {
|
this.isShow = false;
|
this.init()
|
},
|
deletes(d) {
|
this.$confirm('确定要删除该服务类型吗?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(async () => {
|
this.$api.get('volunteer/service/type/delete',d,res=>{
|
this.$message('删除成功');
|
this.init();
|
})
|
// return
|
// await organizationServicer.deleteservice(d)
|
|
}).catch((res) => {
|
this.$message(res.message)
|
});
|
},
|
/** pageSize 改变时会触发 */
|
onPageSizeChange (pageSize) {
|
this.paginationParams.pageSize = pageSize;
|
this.init();
|
},
|
/** 分页 */
|
onPaginationChange (page) {
|
this.paginationParams.currentPage = page;
|
this.init();
|
},
|
|
onSearch() {
|
this.init();
|
},
|
Reset() {
|
this.search = {
|
status: '',
|
keyword: ''
|
};
|
this.init();
|
},
|
|
async init() {
|
const params = {
|
pageNum: this.paginationParams.currentPage,
|
pageSize: this.paginationParams.pageSize,
|
...this.search
|
}
|
this.$api.post('volunteer/service/type/page',params,res=>{
|
this.tableData = res;
|
})
|
// return
|
// const res = await organizationServicer.servicepage(params)
|
// this.tableData = res;
|
}
|
}
|
};
|
</script>
|
<style lang="less" scoped>
|
/*@import '../../../styles/table.less';*/
|
|
</style>
|