|
@@ -1,6 +1,10 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <m-search :items="searchItems" v-model="searchValues" @search="search" class="mb-3"></m-search>
|
|
|
+ <m-search :items="searchItems" v-model="searchValues" @search="onSearch" class="mb-3">
|
|
|
+ <template #button>
|
|
|
+ <m-button type="primary" icon="el-icon-plus" @click="onAdd">新增</m-button>
|
|
|
+ </template>
|
|
|
+ </m-search>
|
|
|
<m-table
|
|
|
:items="items"
|
|
|
:headers="headers"
|
|
@@ -9,38 +13,42 @@
|
|
|
:page-size="pageInfo.size"
|
|
|
:page-current="pageInfo.current"
|
|
|
@page-change="onPageChange"
|
|
|
- ></m-table>
|
|
|
+ >
|
|
|
+ <template #actions="{ row }">
|
|
|
+ <m-button text type="primary" size="small" @click="onEdit(row)">编辑</m-button>
|
|
|
+ <m-button text type="danger" size="small" @click="onDelete(row)">删除</m-button>
|
|
|
+ </template>
|
|
|
+ </m-table>
|
|
|
+ <welfareListEdit ref="welfareListEditRefs" :title="title"></welfareListEdit>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import {
|
|
|
- getWelfarePage
|
|
|
+ getWelfarePage,
|
|
|
+ getWelfareDetail
|
|
|
} from '@/api/salary'
|
|
|
+import welfareListEdit from './welfareListEdit.vue'
|
|
|
export default {
|
|
|
name: 'welfare-list',
|
|
|
+ components: {
|
|
|
+ welfareListEdit
|
|
|
+ },
|
|
|
data () {
|
|
|
return {
|
|
|
+ title: '',
|
|
|
searchItems: [
|
|
|
{
|
|
|
- label: '业务类别',
|
|
|
+ label: '福利名称',
|
|
|
name: 'name',
|
|
|
type: 'input',
|
|
|
option: {
|
|
|
- placeholder: '请输入业务类别'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- label: '职务/岗位',
|
|
|
- name: 'jobNumber',
|
|
|
- type: 'input',
|
|
|
- option: {
|
|
|
- placeholder: '请输入职务/岗位'
|
|
|
+ placeholder: '请输入补助名称'
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
- label: '补助分类',
|
|
|
- name: 'jobNumber',
|
|
|
+ label: '福利类别',
|
|
|
+ name: 'subsidyPersonnelCategoryId',
|
|
|
type: 'autocomplete',
|
|
|
option: {
|
|
|
placeholder: '请输入补助分类',
|
|
@@ -51,16 +59,24 @@ export default {
|
|
|
searchValues: {},
|
|
|
headers: [
|
|
|
{
|
|
|
- label: '姓名',
|
|
|
- name: 'name'
|
|
|
+ label: '福利名称',
|
|
|
+ prop: 'name'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '福利类别',
|
|
|
+ prop: 'subsidyPersonnelCategoryId'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '金额(元 / 月)',
|
|
|
+ prop: 'subsidySalary'
|
|
|
},
|
|
|
{
|
|
|
- label: '工号',
|
|
|
- name: 'jobNumber'
|
|
|
+ label: '描述',
|
|
|
+ prop: 'subsidyTag'
|
|
|
},
|
|
|
{
|
|
|
- label: '部门',
|
|
|
- name: 'department'
|
|
|
+ label: '操作',
|
|
|
+ prop: 'actions'
|
|
|
}
|
|
|
],
|
|
|
items: [],
|
|
@@ -69,27 +85,52 @@ export default {
|
|
|
pageInfo: {
|
|
|
current: 1,
|
|
|
size: 10
|
|
|
- }
|
|
|
-
|
|
|
+ },
|
|
|
+ orders: []
|
|
|
}
|
|
|
},
|
|
|
+ created () {
|
|
|
+ this.init()
|
|
|
+ },
|
|
|
methods: {
|
|
|
async init () {
|
|
|
try {
|
|
|
- const { data } = await getWelfarePage()
|
|
|
- console.log(data)
|
|
|
+ const { data } = await getWelfarePage({
|
|
|
+ entity: this.searchValues,
|
|
|
+ page: {
|
|
|
+ ...this.pageInfo,
|
|
|
+ orders: this.orders
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.items = data.records
|
|
|
+ this.total = data.total
|
|
|
} catch (error) {
|
|
|
- this.$snackbar.error(error)
|
|
|
+ this.$message.error(error)
|
|
|
}
|
|
|
},
|
|
|
- search () {
|
|
|
- console.log(this.searchValues)
|
|
|
+ onSearch () {
|
|
|
+ this.pageInfo.current = 1
|
|
|
+ this.init()
|
|
|
},
|
|
|
onPageChange (page) {
|
|
|
this.pageInfo.current = page
|
|
|
this.init()
|
|
|
},
|
|
|
- fetchSuggestions () {}
|
|
|
+ fetchSuggestions (str, cb) {},
|
|
|
+ onAdd () {
|
|
|
+ this.title = '新增福利'
|
|
|
+ this.$refs.welfareListEditRefs.open()
|
|
|
+ },
|
|
|
+ async onEdit (item) {
|
|
|
+ this.title = '编辑福利'
|
|
|
+ try {
|
|
|
+ const { data } = await getWelfareDetail({ id: item.subsidyCategoryId })
|
|
|
+ this.$refs.welfareListEditRefs.open(data)
|
|
|
+ } catch (error) {
|
|
|
+ this.$message.error(error)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onDelete () {}
|
|
|
}
|
|
|
}
|
|
|
</script>
|