parent
0d2fe87dca
commit
42df376ced
@ -1,17 +1,120 @@
|
||||
<!--
|
||||
* @Author: BINGWU
|
||||
* @Date: 2024-04-11 17:21:16
|
||||
* @LastEditors: BINGWU HuJiaCheng2003@163.com
|
||||
* @LastEditTime: 2024-05-22 22:20:20
|
||||
* @FilePath: \employee-information-management-system\app\src\views\RewardManageView.vue
|
||||
* @Describe:
|
||||
* @Mark: ૮(˶ᵔ ᵕ ᵔ˶)ა
|
||||
-->
|
||||
<template>
|
||||
<div class="reward-manage">
|
||||
<el-button type="primary">添加绩效</el-button>
|
||||
<el-button type="primary" @click="openDialog">添加绩效</el-button>
|
||||
<div clase="table">
|
||||
<BaseTableCom></BaseTableCom>
|
||||
<BaseTableCom
|
||||
:column-data="columnData"
|
||||
:dropdown-data="dropdownData"
|
||||
:table-data="tableData"
|
||||
:total="total"
|
||||
:show-pagination="true"
|
||||
:page-sizes="[5, 8]"
|
||||
@update-table-data="updateTableData"
|
||||
ref="baseTableComRef"
|
||||
></BaseTableCom>
|
||||
</div>
|
||||
<RewardFormCom></RewardFormCom>
|
||||
<RewardFormCom
|
||||
ref="rewardFormComRef"
|
||||
:title="title"
|
||||
@update-table-data="getTableData"
|
||||
></RewardFormCom>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import BaseTableCom from '@/components/table/BaseTableCom.vue'
|
||||
import { deleteReward, getAllReward } from '@/api/reward'
|
||||
import RewardFormCom from './components/form/RewardFormCom.vue'
|
||||
const rewardFormComRef = ref(null)
|
||||
|
||||
const columnData = [
|
||||
{
|
||||
prop: 'employeeId',
|
||||
label: '职工ID'
|
||||
},
|
||||
{
|
||||
prop: 'employeeName',
|
||||
label: '职工名'
|
||||
},
|
||||
{
|
||||
prop: 'rewardType',
|
||||
label: '类型'
|
||||
},
|
||||
{
|
||||
prop: 'contentType',
|
||||
label: '绩效类型'
|
||||
}
|
||||
]
|
||||
const total = ref(0)
|
||||
const title = ref('')
|
||||
const tableData = ref([])
|
||||
const baseTableComRef = ref(null)
|
||||
const dropdownData = [
|
||||
{
|
||||
command: 'command1',
|
||||
handleAction: (row) => {
|
||||
returnData(row, '查看')
|
||||
},
|
||||
icon: 'View',
|
||||
actionName: '查看'
|
||||
},
|
||||
{
|
||||
command: 'command2',
|
||||
handleAction: (row) => {
|
||||
returnData(row, '修改')
|
||||
},
|
||||
icon: 'Edit',
|
||||
actionName: '修改'
|
||||
},
|
||||
{
|
||||
command: 'command3',
|
||||
handleAction: async (row) => {
|
||||
const { _id } = row
|
||||
const res = await deleteReward({ _ids: [_id] })
|
||||
const { msg } = res.data
|
||||
await getTableData()
|
||||
ElMessage({
|
||||
message: msg,
|
||||
type: 'success'
|
||||
})
|
||||
},
|
||||
icon: 'Delete',
|
||||
actionName: '删除'
|
||||
}
|
||||
]
|
||||
const getTableData = async (params = null) => {
|
||||
if (!params) {
|
||||
const { currentPage, pageSize } = baseTableComRef.value.getPaginationData()
|
||||
params = { pageIndex: currentPage, pageSize }
|
||||
}
|
||||
const res = await getAllReward(params)
|
||||
tableData.value = res.data.data
|
||||
total.value = res.data.total
|
||||
}
|
||||
const returnData = (row, newTiltle) => {
|
||||
title.value = newTiltle
|
||||
rewardFormComRef.value.openDialog(row)
|
||||
}
|
||||
const updateTableData = async (pageSize, pageIndex) => {
|
||||
await getTableData({ pageSize, pageIndex })
|
||||
}
|
||||
const openDialog = () => {
|
||||
title.value = '添加'
|
||||
rewardFormComRef.value.openDialog()
|
||||
}
|
||||
onMounted(async () => {
|
||||
await getTableData({ pageSize: 5, pageIndex: 1 })
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
|
Loading…
Reference in new issue