|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<div class="white pa-3">
|
|
|
<m-search :items="searchItems" v-model="searchValues" class="mb-3" @search="onSearch"></m-search>
|
|
|
- <BonusTable ref="bonusTableRefs" :filter-header="auditStatus !== 0 && auditStatus !== 1 ? [] : ['actions']">
|
|
|
+ <BonusTable v-loading="loading" ref="bonusTableRefs" :filter-header="auditStatus !== 0 && auditStatus !== 1 ? [] : ['actions']">
|
|
|
<template #card-tools="{ items }">
|
|
|
<div class="content">
|
|
|
<div>
|
|
@@ -38,7 +38,8 @@ import Decimal from 'decimal.js'
|
|
|
import {
|
|
|
// getAllocationPage,
|
|
|
saveAllocationGrant,
|
|
|
- getAllocationEmployeeCategory,
|
|
|
+ // getAllocationEmployeeCategory,
|
|
|
+ getAllocationOrganizationCategory,
|
|
|
checkAllocationSubmitStatus,
|
|
|
getAllocationStatistics,
|
|
|
saveAllocation
|
|
@@ -58,17 +59,16 @@ export default {
|
|
|
values: {},
|
|
|
searchValues: {
|
|
|
month: dateFormat('YYYY-mm', new Date()),
|
|
|
- organizationNo: null,
|
|
|
- employeeCategory: null
|
|
|
+ organizationCategory: null
|
|
|
},
|
|
|
query: {},
|
|
|
- employeeCategoryItems: [],
|
|
|
+ organizationCategoryItems: [],
|
|
|
totalGrantPerformanceSalary: 0,
|
|
|
loading: false
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapGetters(['employeeInfo', 'organizationTree']),
|
|
|
+ ...mapGetters(['organizationTree']),
|
|
|
totalAllocationPerformanceSalary () {
|
|
|
return Object.values(this.values).reduce((r, v) => {
|
|
|
return new Decimal(r).plus(v || 0)
|
|
@@ -86,46 +86,30 @@ export default {
|
|
|
type: 'month',
|
|
|
valueFormat: 'yyyy-MM',
|
|
|
format: 'yyyy 年 MM 月'
|
|
|
- },
|
|
|
- handles: {
|
|
|
- change: this.getEmployeeCategoryItems
|
|
|
}
|
|
|
+ // handles: {
|
|
|
+ // change: this.getEmployeeCategoryItems
|
|
|
+ // }
|
|
|
},
|
|
|
{
|
|
|
- label: '员工类型',
|
|
|
- prop: 'employeeCategory',
|
|
|
+ label: '机构类型',
|
|
|
+ prop: 'organizationCategory',
|
|
|
type: 'select',
|
|
|
options: {
|
|
|
clearable: false,
|
|
|
- placeholder: '请选择员工类型',
|
|
|
- items: this.employeeCategoryItems
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- label: '部门',
|
|
|
- prop: 'organizationNo',
|
|
|
- type: 'cascader',
|
|
|
- options: {
|
|
|
- filterable: true,
|
|
|
- clearable: true,
|
|
|
- placeholder: '请选择部门',
|
|
|
- options: this.organizationTree,
|
|
|
- showAllLevels: false,
|
|
|
- props: {
|
|
|
- emitPath: false,
|
|
|
- value: 'organizationNo',
|
|
|
- label: 'organizationName',
|
|
|
- children: 'child'
|
|
|
- }
|
|
|
+ placeholder: '请选择机构类型',
|
|
|
+ items: this.organizationCategoryItems
|
|
|
}
|
|
|
}
|
|
|
]
|
|
|
}
|
|
|
},
|
|
|
async mounted () {
|
|
|
- this.loading = true
|
|
|
- await this.getEmployeeCategoryItems()
|
|
|
- this.searchValues.organizationNo = this.employeeInfo.organizationNo
|
|
|
+ await this.getOrganizationCategoryItems()
|
|
|
+ if (!this.organizationCategoryItems.length) {
|
|
|
+ this.$message.error('没有操作权限')
|
|
|
+ return
|
|
|
+ }
|
|
|
this.query = { ...this.searchValues }
|
|
|
this.$nextTick(() => {
|
|
|
this.$refs.bonusTableRefs && this.onInit()
|
|
@@ -137,9 +121,7 @@ export default {
|
|
|
await this.onCheckStatus()
|
|
|
await this.onStatistics()
|
|
|
if (!this.$refs.bonusTableRefs) {
|
|
|
- return
|
|
|
- }
|
|
|
- if (!this.query.employeeCategory) {
|
|
|
+ this.loading = false
|
|
|
return
|
|
|
}
|
|
|
const data = await this.$refs.bonusTableRefs.onInit(this.query, pageInfo)
|
|
@@ -152,29 +134,30 @@ export default {
|
|
|
return res
|
|
|
}, {})
|
|
|
},
|
|
|
- async getEmployeeCategoryItems () {
|
|
|
+ async getOrganizationCategoryItems () {
|
|
|
+ this.loading = true
|
|
|
try {
|
|
|
- const { data } = await getAllocationEmployeeCategory({
|
|
|
- month: this.searchValues.month
|
|
|
- })
|
|
|
- this.employeeCategoryItems = data.map(e => {
|
|
|
+ const { data } = await getAllocationOrganizationCategory()
|
|
|
+ this.organizationCategoryItems = data.map(e => {
|
|
|
return {
|
|
|
- label: e,
|
|
|
- value: e
|
|
|
+ value: e,
|
|
|
+ label: e
|
|
|
}
|
|
|
})
|
|
|
- if (!data.length) {
|
|
|
- this.searchValues.employeeCategory = null
|
|
|
- return
|
|
|
+ if (this.organizationCategoryItems.length > 0) {
|
|
|
+ this.searchValues.organizationCategory = this.organizationCategoryItems[0].value
|
|
|
}
|
|
|
- this.searchValues.employeeCategory = this.employeeCategoryItems[0].value
|
|
|
- return data
|
|
|
} catch (error) {
|
|
|
- this.employeeCategoryItems = []
|
|
|
+ this.organizationCategoryItems = []
|
|
|
this.$message.error(error)
|
|
|
+ } finally {
|
|
|
+ this.loading = false
|
|
|
}
|
|
|
},
|
|
|
async onSearch () {
|
|
|
+ if (!this.organizationCategoryItems.length) {
|
|
|
+ return
|
|
|
+ }
|
|
|
this.query = { ...this.searchValues }
|
|
|
this.onInit({ current: 1 })
|
|
|
},
|
|
@@ -182,8 +165,7 @@ export default {
|
|
|
onSave () {
|
|
|
const h = this.$createElement
|
|
|
const _el = [
|
|
|
- h('p', undefined, `提交月份:${this.query.month}`),
|
|
|
- h('p', undefined, `提交员工类型:${this.query.employeeCategory ?? null}`)
|
|
|
+ h('p', undefined, `提交月份:${this.query.month}`)
|
|
|
]
|
|
|
try {
|
|
|
if (this.totalGrantPerformanceSalary !== this.totalAllocationPerformanceSalary) {
|