|
@@ -2,7 +2,12 @@
|
|
|
<div class="pa-3 white">
|
|
|
<m-search :items="searchItems" v-model="searchValues" class="mb-3" @search="onSearch">
|
|
|
<template #button>
|
|
|
- <div class="ml-3">可发放绩效:{{ statisticObj.residue + ' / ' + statisticObj.total }}</div>
|
|
|
+ <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>
|
|
|
</template>
|
|
|
</m-search>
|
|
|
<m-table
|
|
@@ -40,6 +45,7 @@
|
|
|
|
|
|
<script>
|
|
|
import { dateFormat } from '@/utils/date'
|
|
|
+import Decimal from 'decimal.js'
|
|
|
import {
|
|
|
getAllocationPage,
|
|
|
saveAllocationGrant,
|
|
@@ -102,13 +108,15 @@ export default {
|
|
|
},
|
|
|
orders: [],
|
|
|
employeeCategoryItems: [],
|
|
|
- statisticObj: {
|
|
|
- residue: null,
|
|
|
- total: null
|
|
|
- }
|
|
|
+ totalGrantPerformanceSalary: 0
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
+ totalAllocationPerformanceSalary () {
|
|
|
+ return Object.values(this.values).reduce((r, v) => {
|
|
|
+ return new Decimal(r).plus(v || 0)
|
|
|
+ }, 0).toFixed(2)
|
|
|
+ },
|
|
|
searchItems () {
|
|
|
return [
|
|
|
{
|
|
@@ -204,42 +212,42 @@ export default {
|
|
|
},
|
|
|
// 领导分配绩效薪资
|
|
|
onSave () {
|
|
|
- this.$confirm('确定提交所有数据?', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- }).then(async () => {
|
|
|
- try {
|
|
|
- await saveAllocationGrant({
|
|
|
- ...this.query,
|
|
|
- employeePerformanceGrantItems: Object.keys(this.values).reduce((res, key) => {
|
|
|
- res.push({
|
|
|
- employeePerformanceId: key,
|
|
|
- allocationPerformanceSalary: this.values[key]
|
|
|
- })
|
|
|
- return res
|
|
|
- }, [])
|
|
|
- })
|
|
|
- if (this.statisticObj.residue !== this.statisticObj.total) {
|
|
|
- this.$confirm('当前非完全配额,是否强制提交', '提示', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- }).then(() => {
|
|
|
- this.onSaveAll(true)
|
|
|
- }).catch(_ => {
|
|
|
- this.onSaveAll(false)
|
|
|
- })
|
|
|
- } else {
|
|
|
+ try {
|
|
|
+ if (this.totalGrantPerformanceSalary !== this.totalAllocationPerformanceSalary) {
|
|
|
+ this.$confirm('当前非完全配额,是否强制提交', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.onSaveAll(true)
|
|
|
+ }).catch(_ => {
|
|
|
this.onSaveAll(false)
|
|
|
- }
|
|
|
- } catch (error) {
|
|
|
- this.$message.error(error)
|
|
|
+ })
|
|
|
+ return
|
|
|
}
|
|
|
- }).catch(_ => {})
|
|
|
+ this.$confirm('确定提交所有数据?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.onSaveAll(false)
|
|
|
+ }).catch(_ => {})
|
|
|
+ } catch (error) {
|
|
|
+ this.$message.error(error)
|
|
|
+ }
|
|
|
},
|
|
|
async onSaveAll (force) {
|
|
|
try {
|
|
|
+ await saveAllocationGrant({
|
|
|
+ ...this.query,
|
|
|
+ employeePerformanceGrantItems: Object.keys(this.values).reduce((res, key) => {
|
|
|
+ res.push({
|
|
|
+ employeePerformanceId: key,
|
|
|
+ allocationPerformanceSalary: this.values[key]
|
|
|
+ })
|
|
|
+ return res
|
|
|
+ }, [])
|
|
|
+ })
|
|
|
await saveAllocation({
|
|
|
...this.query,
|
|
|
force: force ? 1 : 0
|
|
@@ -266,9 +274,8 @@ export default {
|
|
|
async onStatistics () {
|
|
|
try {
|
|
|
const { data } = await getAllocationStatistics(this.query)
|
|
|
- const { totalAllocationPerformanceSalary, totalGrantPerformanceSalary } = data
|
|
|
- this.statisticObj.residue = totalGrantPerformanceSalary - totalAllocationPerformanceSalary
|
|
|
- this.statisticObj.total = totalGrantPerformanceSalary || 0
|
|
|
+ const { totalGrantPerformanceSalary } = data
|
|
|
+ this.totalGrantPerformanceSalary = totalGrantPerformanceSalary
|
|
|
} catch (error) {
|
|
|
this.$message.error(error)
|
|
|
}
|