|
|
@@ -1,64 +1,97 @@
|
|
|
<template>
|
|
|
- <div class="pa-3 white">
|
|
|
- <m-search :items="searchItems" v-model="searchValues" class="mb-3" @search="onSearch">
|
|
|
- <template #button>
|
|
|
- <div class="ml-3">
|
|
|
- <el-tag v-if="query.month">{{ query.month }}</el-tag>
|
|
|
- <el-tag v-if="query.employeeCategory" class="ml-3">{{ query.employeeCategory }}</el-tag>
|
|
|
- 可发放绩效:<el-tag>{{ totalAllocationPerformanceSalary }}</el-tag>
|
|
|
- 总绩效: <el-tag>{{ totalGrantPerformanceSalary }}</el-tag>
|
|
|
+ <div class="white pa-3">
|
|
|
+ <m-search :items="searchItems" v-model="searchValues" class="mb-3" @search="onSearch"></m-search>
|
|
|
+ <BonusTable ref="bonusTableRefs">
|
|
|
+ <template #header="{ items }">
|
|
|
+ <div class="content">
|
|
|
+ <div>
|
|
|
+ 可发放绩效:<el-tag>{{ totalAllocationPerformanceSalary }}</el-tag>
|
|
|
+ 总绩效: <el-tag>{{ totalGrantPerformanceSalary }}</el-tag>
|
|
|
+ <template v-if="auditStatusList[auditStatus]">
|
|
|
+ 审批状态:<el-tag :type="auditStatusList[auditStatus]?.type ?? 'info'">{{ auditStatusList[auditStatus]?.label ?? '未知状态' }}</el-tag>
|
|
|
+ </template>
|
|
|
+ <el-button
|
|
|
+ class="ml-3"
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ :loading="auditStatusLoading"
|
|
|
+ :disabled="auditStatus === 0 || auditStatus === 1 || !items.length"
|
|
|
+ @click="onSave">
|
|
|
+ 确认分配
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
- </m-search>
|
|
|
- <m-table
|
|
|
+ <template #actions="{ row }">
|
|
|
+ <el-input :disabled="auditStatusLoading" v-model="values[row.employeePerformanceId]" placeholder="请输入绩效" size="small"></el-input>
|
|
|
+ </template>
|
|
|
+ </BonusTable>
|
|
|
+ <!-- <m-table
|
|
|
:items="items"
|
|
|
:headers="headers"
|
|
|
- :loading="loading"
|
|
|
+ v-loading="loading"
|
|
|
:total="total"
|
|
|
:page-size="pageInfo.size"
|
|
|
:page-current="pageInfo.current"
|
|
|
@page-change="onPageChange"
|
|
|
- @expand-change="onExpandChange"
|
|
|
>
|
|
|
+ <template #header>
|
|
|
+ <div class="content">
|
|
|
+ <div>
|
|
|
+ 可发放绩效:<el-tag>{{ totalAllocationPerformanceSalary }}</el-tag>
|
|
|
+ 总绩效: <el-tag>{{ totalGrantPerformanceSalary }}</el-tag>
|
|
|
+ <template v-if="auditStatusList[auditStatus]">
|
|
|
+ 审批状态:<el-tag :type="auditStatusList[auditStatus]?.type ?? 'info'">{{ auditStatusList[auditStatus]?.label ?? '未知状态' }}</el-tag>
|
|
|
+ </template>
|
|
|
+ <el-button
|
|
|
+ class="ml-3"
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ :loading="auditStatusLoading"
|
|
|
+ :disabled="auditStatus === 0 || auditStatus === 1 || !items.length"
|
|
|
+ @click="onSave">
|
|
|
+ 确认分配
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
<template #status="{ row }">
|
|
|
<el-tag :type="statusList[row.status].color">{{ statusList[row.status].text }}</el-tag>
|
|
|
</template>
|
|
|
<template #dataType="{row}">
|
|
|
{{ row.dataType === 1 ? '手工数据' : '系统数据' }}
|
|
|
</template>
|
|
|
- <template #actions-header>
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- size="small"
|
|
|
- :loading="auditStatusLoading"
|
|
|
- :disabled="auditStatus === 0 || auditStatus === 1"
|
|
|
- @click="onSave">
|
|
|
- {{ auditStatusList[auditStatus] ?? '确认分配' }}
|
|
|
- </el-button>
|
|
|
- </template>
|
|
|
<template #actions="{ row }">
|
|
|
<el-input :disabled="auditStatusLoading" v-model="values[row.employeePerformanceId]" placeholder="请输入绩效" size="small"></el-input>
|
|
|
</template>
|
|
|
- </m-table>
|
|
|
+ </m-table> -->
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import BonusTable from '../components/bonusTable.vue'
|
|
|
import { dateFormat } from '@/utils/date'
|
|
|
import Decimal from 'decimal.js'
|
|
|
import {
|
|
|
- getAllocationPage,
|
|
|
+ // getAllocationPage,
|
|
|
saveAllocationGrant,
|
|
|
getAllocationEmployeeCategory,
|
|
|
checkAllocationSubmitStatus,
|
|
|
getAllocationStatistics,
|
|
|
saveAllocation
|
|
|
-} from '@/api/salary'
|
|
|
+} from '@/api/bonus'
|
|
|
+import {
|
|
|
+ getOrganizationTree
|
|
|
+} from '@/utils/dict'
|
|
|
+import { STATUS_LIST } from '../utils'
|
|
|
export default {
|
|
|
- name: 'salary-allocation',
|
|
|
+ name: 'bonusAllocation',
|
|
|
+ components: {
|
|
|
+ BonusTable
|
|
|
+ },
|
|
|
data () {
|
|
|
return {
|
|
|
- auditStatusList: ['审核中', '审核已通过', '审核未通过'],
|
|
|
+ auditStatusList: STATUS_LIST,
|
|
|
auditStatus: null,
|
|
|
auditStatusLoading: true,
|
|
|
values: {},
|
|
|
@@ -78,37 +111,38 @@ export default {
|
|
|
},
|
|
|
searchValues: {
|
|
|
month: dateFormat('YYYY-mm', new Date()),
|
|
|
+ organizationNo: null,
|
|
|
employeeCategory: null
|
|
|
},
|
|
|
query: {
|
|
|
month: dateFormat('YYYY-mm', new Date())
|
|
|
},
|
|
|
- headers: [
|
|
|
- { label: '月份', prop: 'month' },
|
|
|
- { label: '机构名称', prop: 'organizationName', width: 150 },
|
|
|
- { label: '员工姓名', prop: 'employeeName' },
|
|
|
- { label: '分配状态', prop: 'status', align: 'center' },
|
|
|
- { label: '员工类型', prop: 'employeeCategory', align: 'center' },
|
|
|
- { label: '可分配绩效薪资', prop: 'assignablePerformanceSalary', align: 'center', width: 150 },
|
|
|
- { label: '领导分配绩效薪资', prop: 'allocationPerformanceSalary', align: 'center', width: 150 },
|
|
|
- { label: '基础绩效薪资', prop: 'basicPerformanceSalary', align: 'center', width: 120 },
|
|
|
- { label: '总绩效薪资', prop: 'performanceSalary', align: 'center', width: 120 },
|
|
|
- { label: '数据来源', prop: 'dataType', align: 'center' },
|
|
|
- { label: '数据版本', prop: 'version', width: 160 },
|
|
|
- { label: '创建时间', prop: 'createDate', width: 160 },
|
|
|
- { label: '操作', prop: 'actions', width: 160, fixed: 'right' }
|
|
|
- ],
|
|
|
- items: [
|
|
|
- ],
|
|
|
- loading: false,
|
|
|
- total: 0,
|
|
|
- pageInfo: {
|
|
|
- current: 1,
|
|
|
- size: 50
|
|
|
- },
|
|
|
- orders: [],
|
|
|
+ // headers: [
|
|
|
+ // { label: '月份', prop: 'month' },
|
|
|
+ // { label: '机构名称', prop: 'organizationName', width: 150 },
|
|
|
+ // { label: '员工姓名', prop: 'employeeName' },
|
|
|
+ // { label: '分配状态', prop: 'status', align: 'center' },
|
|
|
+ // { label: '员工类型', prop: 'employeeCategory', align: 'center' },
|
|
|
+ // { label: '可分配绩效薪资', prop: 'assignablePerformanceSalary', align: 'center', width: 150 },
|
|
|
+ // { label: '领导分配绩效薪资', prop: 'allocationPerformanceSalary', align: 'center', width: 150 },
|
|
|
+ // { label: '基础绩效薪资', prop: 'basicPerformanceSalary', align: 'center', width: 120 },
|
|
|
+ // { label: '总绩效薪资', prop: 'performanceSalary', align: 'center', width: 120 },
|
|
|
+ // { label: '数据来源', prop: 'dataType', align: 'center' },
|
|
|
+ // { label: '数据版本', prop: 'version', width: 160 },
|
|
|
+ // { label: '创建时间', prop: 'createDate', width: 160 },
|
|
|
+ // { label: '操作', prop: 'actions', width: 160, fixed: 'right' }
|
|
|
+ // ],
|
|
|
+ // items: [],
|
|
|
+ // loading: false,
|
|
|
+ // total: 0,
|
|
|
+ // pageInfo: {
|
|
|
+ // current: 1,
|
|
|
+ // size: 50
|
|
|
+ // },
|
|
|
+ // orders: [],
|
|
|
employeeCategoryItems: [],
|
|
|
- totalGrantPerformanceSalary: 0
|
|
|
+ totalGrantPerformanceSalary: 0,
|
|
|
+ deptItems: []
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -129,9 +163,23 @@ export default {
|
|
|
type: 'month',
|
|
|
valueFormat: 'yyyy-MM',
|
|
|
format: 'yyyy 年 MM 月'
|
|
|
- },
|
|
|
- handles: {
|
|
|
- change: this.getEmployeeCategoryItems
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '机构',
|
|
|
+ prop: 'organizationNo',
|
|
|
+ type: 'cascader',
|
|
|
+ options: {
|
|
|
+ clearable: true,
|
|
|
+ placeholder: '请选择机构',
|
|
|
+ options: this.deptItems,
|
|
|
+ props: {
|
|
|
+ checkStrictly: true,
|
|
|
+ emitPath: false,
|
|
|
+ value: 'organizationNo',
|
|
|
+ label: 'organizationName',
|
|
|
+ children: 'child'
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
{
|
|
|
@@ -147,42 +195,57 @@ export default {
|
|
|
]
|
|
|
}
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ 'searchValues.month': {
|
|
|
+ handler (v) {
|
|
|
+ this.getEmployeeCategoryItems()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
async created () {
|
|
|
this.loading = true
|
|
|
+ this.onGetDept()
|
|
|
await this.getEmployeeCategoryItems()
|
|
|
this.onInit()
|
|
|
},
|
|
|
methods: {
|
|
|
- async onInit () {
|
|
|
- this.loading = true
|
|
|
- try {
|
|
|
- const { data } = await getAllocationPage({
|
|
|
- page: {
|
|
|
- ...this.pageInfo,
|
|
|
- orders: this.orders
|
|
|
- },
|
|
|
- entity: {
|
|
|
- ...this.searchValues
|
|
|
- }
|
|
|
- })
|
|
|
- await this.onCheckStatus()
|
|
|
- await this.onStatistics()
|
|
|
- data.records.forEach(e => {
|
|
|
- if (Object.prototype.hasOwnProperty.call(this.values, e.employeePerformanceId)) {
|
|
|
- return
|
|
|
- }
|
|
|
- this.$set(this.values, e.employeePerformanceId, e.allocationPerformanceSalary || null)
|
|
|
- })
|
|
|
- this.items = data.records.map(e => {
|
|
|
- e.createDate = dateFormat('YYYY-mm-dd HH:MM:SS', new Date(e.createDate))
|
|
|
- return e
|
|
|
- })
|
|
|
- this.total = data.total
|
|
|
- } catch (error) {
|
|
|
- this.$message.error(error)
|
|
|
- } finally {
|
|
|
- this.loading = false
|
|
|
+ // async onInit () {
|
|
|
+ // this.loading = true
|
|
|
+ // try {
|
|
|
+ // const { data } = await getAllocationPage({
|
|
|
+ // page: {
|
|
|
+ // ...this.pageInfo,
|
|
|
+ // orders: this.orders
|
|
|
+ // },
|
|
|
+ // entity: {
|
|
|
+ // ...this.searchValues
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // await this.onCheckStatus()
|
|
|
+ // await this.onStatistics()
|
|
|
+ // data.records.forEach(e => {
|
|
|
+ // if (Object.prototype.hasOwnProperty.call(this.values, e.employeePerformanceId)) {
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // this.$set(this.values, e.employeePerformanceId, e.allocationPerformanceSalary || null)
|
|
|
+ // })
|
|
|
+ // this.items = data.records.map(e => {
|
|
|
+ // e.createDate = dateFormat('YYYY-mm-dd HH:MM:SS', new Date(e.createDate))
|
|
|
+ // return e
|
|
|
+ // })
|
|
|
+ // this.total = data.total
|
|
|
+ // } catch (error) {
|
|
|
+ // this.$message.error(error)
|
|
|
+ // } finally {
|
|
|
+ // this.loading = false
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ async onGetDept () {
|
|
|
+ const data = await getOrganizationTree()
|
|
|
+ if (!data) {
|
|
|
+ return
|
|
|
}
|
|
|
+ this.deptItems = data
|
|
|
},
|
|
|
async getEmployeeCategoryItems () {
|
|
|
try {
|
|
|
@@ -212,9 +275,18 @@ export default {
|
|
|
},
|
|
|
// 领导分配绩效薪资
|
|
|
onSave () {
|
|
|
+ const h = this.$createElement
|
|
|
+ const _el = [
|
|
|
+ h('p', undefined, `更新月份:${this.query.month}`),
|
|
|
+ h('p', undefined, `更新物业线:${this.query.category ?? null}`)
|
|
|
+ ]
|
|
|
try {
|
|
|
if (this.totalGrantPerformanceSalary !== this.totalAllocationPerformanceSalary) {
|
|
|
- this.$confirm('当前非完全配额,是否强制提交', '提示', {
|
|
|
+ const el = h('div', [
|
|
|
+ h('p', undefined, '当前非完全配额,是否强制提交?'),
|
|
|
+ ..._el
|
|
|
+ ])
|
|
|
+ this.$confirm(el, '提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
|
@@ -225,7 +297,11 @@ export default {
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
- this.$confirm('确定提交所有数据?', '提示', {
|
|
|
+ const el = h('div', [
|
|
|
+ h('p', undefined, '确定提交所有数据?'),
|
|
|
+ ..._el
|
|
|
+ ])
|
|
|
+ this.$confirm(el, '提示', {
|
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
|
@@ -237,16 +313,21 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
async onSaveAll (force) {
|
|
|
+ const employeePerformanceGrantItems = Object.keys(this.values).reduce((res, key) => {
|
|
|
+ res.push({
|
|
|
+ employeePerformanceId: key,
|
|
|
+ allocationPerformanceSalary: this.values[key]
|
|
|
+ })
|
|
|
+ return res
|
|
|
+ }, [])
|
|
|
+ if (!employeePerformanceGrantItems.length) {
|
|
|
+ this.$message.error('请先分配金额')
|
|
|
+ return
|
|
|
+ }
|
|
|
try {
|
|
|
await saveAllocationGrant({
|
|
|
...this.query,
|
|
|
- employeePerformanceGrantItems: Object.keys(this.values).reduce((res, key) => {
|
|
|
- res.push({
|
|
|
- employeePerformanceId: key,
|
|
|
- allocationPerformanceSalary: this.values[key]
|
|
|
- })
|
|
|
- return res
|
|
|
- }, [])
|
|
|
+ employeePerformanceGrantItems
|
|
|
})
|
|
|
await saveAllocation({
|
|
|
...this.query,
|
|
|
@@ -279,17 +360,14 @@ export default {
|
|
|
} catch (error) {
|
|
|
this.$message.error(error)
|
|
|
}
|
|
|
- },
|
|
|
- onDetails () {},
|
|
|
- onExpandChange () {},
|
|
|
- onPageChange (index) {
|
|
|
- this.pageInfo.current = index
|
|
|
- this.onInit()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-
|
|
|
+.content {
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-end;
|
|
|
+}
|
|
|
</style>
|