|
@@ -1,8 +1,17 @@
|
|
|
<template>
|
|
|
<div class="white pa-3">
|
|
|
<m-search :items="searchItems" v-model="searchValues" class="mb-3" @search="onSearch"></m-search>
|
|
|
- <BonusTable v-loading="loading" ref="bonusTableRefs" :filter-header="auditStatus !== 0 && auditStatus !== 1 ? [] : ['actions']">
|
|
|
- <template #card-tools="{ items }">
|
|
|
+ <m-table
|
|
|
+ :items="items"
|
|
|
+ :headers="headers"
|
|
|
+ v-loading="loading"
|
|
|
+ :total="total"
|
|
|
+ :page-size="pageInfo.size"
|
|
|
+ :page-current="pageInfo.current"
|
|
|
+ max-height="600px"
|
|
|
+ @page-change="onPageChange"
|
|
|
+ >
|
|
|
+ <template #card-tools>
|
|
|
<div class="content">
|
|
|
<div>
|
|
|
<!-- 绩效合计:<el-tag>{{ totalAllocationPerformanceSalary }}</el-tag> -->
|
|
@@ -11,55 +20,71 @@
|
|
|
class="ml-3"
|
|
|
type="orange"
|
|
|
:loading="auditStatusLoading"
|
|
|
- v-show="auditStatus !== 0 && auditStatus !== 1 && items.length"
|
|
|
+ v-show="!auditStatus && items.length"
|
|
|
@click="onSave">
|
|
|
确认分配
|
|
|
</m-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
- <template #actions="{ row, items }">
|
|
|
- <el-input v-show="auditStatus !== 0 && auditStatus !== 1 && items.length" v-model="values[row.employeePerformanceId]" placeholder="请输入绩效" size="small"></el-input>
|
|
|
+ <template #actions="{ row }">
|
|
|
+ <el-input v-show="!auditStatus && items.length" v-model="values[row.employeePerformanceId]" placeholder="请输入绩效" size="small"></el-input>
|
|
|
</template>
|
|
|
<template #actions-header>
|
|
|
合计:<el-tag>{{ totalAllocationPerformanceSalary }}</el-tag>
|
|
|
</template>
|
|
|
- </BonusTable>
|
|
|
+ <template #status="{ row }">
|
|
|
+ <el-tag :type="BONUS_ALLOCATION_STATUS[row.status].color">{{ BONUS_ALLOCATION_STATUS[row.status].text }}</el-tag>
|
|
|
+ </template>
|
|
|
+ <template #branchStatus="{ row }">
|
|
|
+ <el-tag :type="BONUS_ALLOCATION_STATUS[row.branchStatus].color">{{ BONUS_ALLOCATION_STATUS[row.branchStatus].text }}</el-tag>
|
|
|
+ </template>
|
|
|
+ <template #dataType="{row}">
|
|
|
+ {{ row.dataType === 1 ? '手工数据' : '系统数据' }}
|
|
|
+ </template>
|
|
|
+ </m-table>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import BonusTable from '../components/bonusTable.vue'
|
|
|
import { dateFormat } from '@/utils/date'
|
|
|
import Decimal from 'decimal.js'
|
|
|
import {
|
|
|
- // getAllocationPage,
|
|
|
saveAllocationGrant,
|
|
|
- // getAllocationEmployeeCategory,
|
|
|
- getAllocationOrganizationCategory,
|
|
|
+ getAllocationOrganizationList,
|
|
|
checkAllocationSubmitStatus,
|
|
|
+ getAllocationPage,
|
|
|
getAllocationStatistics,
|
|
|
saveAllocation
|
|
|
} from '@/api/bonus'
|
|
|
+import {
|
|
|
+ BONUS_ALLOCATION_STATUS
|
|
|
+} from '@/utils/dict'
|
|
|
import { mapGetters } from 'vuex'
|
|
|
export default {
|
|
|
name: 'bonusAllocation',
|
|
|
- components: {
|
|
|
- BonusTable
|
|
|
- },
|
|
|
data () {
|
|
|
return {
|
|
|
- auditStatus: null,
|
|
|
+ BONUS_ALLOCATION_STATUS,
|
|
|
+ auditStatus: false,
|
|
|
auditStatusLoading: false,
|
|
|
values: {},
|
|
|
searchValues: {
|
|
|
month: dateFormat('YYYY-mm', new Date()),
|
|
|
- organizationCategory: null
|
|
|
+ organizationNo: null
|
|
|
},
|
|
|
query: {},
|
|
|
organizationCategoryItems: [],
|
|
|
totalGrantPerformanceSalary: 0,
|
|
|
- loading: false
|
|
|
+ loading: false,
|
|
|
+ items: [],
|
|
|
+ total: 0,
|
|
|
+ pageInfo: {
|
|
|
+ current: 1,
|
|
|
+ size: 50
|
|
|
+ },
|
|
|
+ orders: [],
|
|
|
+ checkBranch: false // 区分分配机构类型
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -82,21 +107,46 @@ export default {
|
|
|
valueFormat: 'yyyy-MM',
|
|
|
format: 'yyyy 年 MM 月'
|
|
|
}
|
|
|
- // handles: {
|
|
|
- // change: this.getEmployeeCategoryItems
|
|
|
- // }
|
|
|
},
|
|
|
{
|
|
|
- label: '分配类型',
|
|
|
- prop: 'organizationCategory',
|
|
|
+ label: '分配机构',
|
|
|
+ prop: 'organizationNo',
|
|
|
type: 'select',
|
|
|
options: {
|
|
|
clearable: false,
|
|
|
placeholder: '请选择机构类型',
|
|
|
- items: this.organizationCategoryItems
|
|
|
+ items: this.organizationCategoryItems,
|
|
|
+ labelValue: 'organizationNo',
|
|
|
+ labelText: 'organizationName'
|
|
|
}
|
|
|
+ // handles: {
|
|
|
+ // change: (v) => {
|
|
|
+ // this.checkBranch = this.organizationCategoryItems.find(e => e.organizationNo === v).checkBranch
|
|
|
+ // }
|
|
|
+ // }
|
|
|
}
|
|
|
]
|
|
|
+ },
|
|
|
+ headers () {
|
|
|
+ const headers = [
|
|
|
+ { label: '月份', prop: 'month' },
|
|
|
+ { label: '机构名称', prop: 'organizationName', width: 150 },
|
|
|
+ { label: '员工姓名', prop: 'employeeName', width: 80, align: 'center' },
|
|
|
+ { label: '分配状态', prop: this.checkBranch ? 'branchStatus' : 'status', align: 'center', width: 100 },
|
|
|
+ { label: '员工岗位', prop: 'employeeCategory', align: 'center' },
|
|
|
+ { label: '可分配绩效薪资', prop: 'assignablePerformanceSalary', align: 'center', width: 150 },
|
|
|
+ { label: '直属机构分配绩效薪资', prop: 'allocationPerformanceSalary', align: 'center', width: 160 },
|
|
|
+ { label: '支行分配绩效薪资', prop: 'branchAllocationPerformanceSalary', align: 'center', width: 150 },
|
|
|
+ { label: '基础绩效薪资', prop: 'basicPerformanceSalary', align: 'center', width: 120 },
|
|
|
+ { label: '总绩效薪资', prop: 'performanceSalary', align: 'center', minWidth: 120 },
|
|
|
+ { label: '数据来源', prop: 'dataType', align: 'center' },
|
|
|
+ { label: '数据版本', prop: 'version', width: 160 },
|
|
|
+ { label: '创建时间', prop: 'createDate', width: 160 }
|
|
|
+ ]
|
|
|
+ if (this.items.length && !this.auditStatus) {
|
|
|
+ headers.push({ label: '操作', prop: 'actions', width: 160, fixed: 'right' })
|
|
|
+ }
|
|
|
+ return headers
|
|
|
}
|
|
|
},
|
|
|
async mounted () {
|
|
@@ -106,21 +156,14 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
this.query = { ...this.searchValues }
|
|
|
- this.$nextTick(() => {
|
|
|
- this.$refs.bonusTableRefs && this.onInit()
|
|
|
- })
|
|
|
+ this.onInit()
|
|
|
},
|
|
|
methods: {
|
|
|
- async onInit (pageInfo) {
|
|
|
+ async onInit () {
|
|
|
this.loading = true
|
|
|
await this.onCheckStatus()
|
|
|
await this.onStatistics()
|
|
|
- if (!this.$refs.bonusTableRefs) {
|
|
|
- this.loading = false
|
|
|
- return
|
|
|
- }
|
|
|
- const data = await this.$refs.bonusTableRefs.onInit(this.query, pageInfo)
|
|
|
- this.loading = false
|
|
|
+ const data = await this.getPage()
|
|
|
if (!data) {
|
|
|
return
|
|
|
}
|
|
@@ -129,18 +172,42 @@ export default {
|
|
|
return res
|
|
|
}, {})
|
|
|
},
|
|
|
- async getOrganizationCategoryItems () {
|
|
|
+ async getPage () {
|
|
|
this.loading = true
|
|
|
+ const { organizationNo, ...query } = this.query
|
|
|
try {
|
|
|
- const { data } = await getAllocationOrganizationCategory()
|
|
|
- this.organizationCategoryItems = data.map(e => {
|
|
|
- return {
|
|
|
- value: e,
|
|
|
- label: e
|
|
|
- }
|
|
|
+ const { data } = await getAllocationPage({
|
|
|
+ page: {
|
|
|
+ ...this.pageInfo,
|
|
|
+ orders: this.orders
|
|
|
+ },
|
|
|
+ entity: {
|
|
|
+ ...query
|
|
|
+ },
|
|
|
+ organizationNo
|
|
|
})
|
|
|
- if (this.organizationCategoryItems.length > 0) {
|
|
|
- this.searchValues.organizationCategory = this.organizationCategoryItems[0].value
|
|
|
+ this.items = data.records
|
|
|
+ this.total = data.total
|
|
|
+ this.checkBranch = this.organizationCategoryItems.find(e => e.organizationNo === organizationNo).checkBranch
|
|
|
+ return data
|
|
|
+ } catch (error) {
|
|
|
+ this.$message.error(error)
|
|
|
+ } finally {
|
|
|
+ this.loading = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onPageChange (index) {
|
|
|
+ this.pageInfo.current = index
|
|
|
+ this.getPage()
|
|
|
+ },
|
|
|
+ async getOrganizationCategoryItems () {
|
|
|
+ this.loading = true
|
|
|
+ try {
|
|
|
+ const { data } = await getAllocationOrganizationList()
|
|
|
+ this.organizationCategoryItems = data
|
|
|
+ if (data.length > 0) {
|
|
|
+ this.searchValues.organizationNo = this.organizationCategoryItems[0].organizationNo
|
|
|
+ this.checkBranch = this.organizationCategoryItems[0].checkBranch
|
|
|
}
|
|
|
} catch (error) {
|
|
|
this.organizationCategoryItems = []
|
|
@@ -153,8 +220,12 @@ export default {
|
|
|
if (!this.organizationCategoryItems.length) {
|
|
|
return
|
|
|
}
|
|
|
+ if (!this.searchValues.organizationNo) {
|
|
|
+ this.searchValues.organizationNo = this.organizationCategoryItems[0].organizationNo
|
|
|
+ }
|
|
|
this.query = { ...this.searchValues }
|
|
|
- this.onInit({ current: 1 })
|
|
|
+ this.pageInfo.current = 1
|
|
|
+ this.onInit()
|
|
|
},
|
|
|
// 领导分配绩效薪资
|
|
|
onSave () {
|
|
@@ -163,6 +234,16 @@ export default {
|
|
|
h('p', undefined, `提交月份:${this.query.month}`)
|
|
|
]
|
|
|
try {
|
|
|
+ if (this.totalGrantPerformanceSalary !== this.totalAllocationPerformanceSalary) {
|
|
|
+ const el = h('div', [
|
|
|
+ h('p', undefined, '当前非完全配额,是否强制提交?'),
|
|
|
+ ..._el
|
|
|
+ ])
|
|
|
+ this.$confirm(el, '提示').then(() => {
|
|
|
+ this.onSaveAll(true)
|
|
|
+ }).catch(_ => {})
|
|
|
+ return
|
|
|
+ }
|
|
|
const el = h('div', [
|
|
|
h('p', undefined, '确定提交所有数据?'),
|
|
|
..._el
|
|
@@ -208,8 +289,10 @@ export default {
|
|
|
async onCheckStatus () {
|
|
|
this.auditStatusLoading = true
|
|
|
try {
|
|
|
- const { data } = await checkAllocationSubmitStatus(this.query)
|
|
|
- this.auditStatus = data?.status ?? null
|
|
|
+ const { data } = await checkAllocationSubmitStatus({
|
|
|
+ ...this.query
|
|
|
+ })
|
|
|
+ this.auditStatus = data
|
|
|
} catch (error) {
|
|
|
this.$message.error(error)
|
|
|
} finally {
|