Browse Source

奖金分配

zhengnaiwen_citu 6 tháng trước cách đây
mục cha
commit
58425bab52

+ 1 - 1
src/components/AutoComponents/MTable/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <m-card :shadow="shadow" title="11">
+  <m-card :shadow="shadow">
     <template v-if="cardTitle" slot="header">
       <span>{{ cardTitle }}</span>
     </template>

+ 12 - 6
src/views/bonus/allocation/index.vue

@@ -146,12 +146,18 @@ export default {
       if (!data) {
         return
       }
-      data.records.forEach(e => {
-        if (Object.prototype.hasOwnProperty.call(this.values, e.employeePerformanceId)) {
-          return
-        }
-        this.$set(this.values, e.employeePerformanceId, e.allocationPerformanceSalary || null)
-      })
+      this.values = data.records.reduce((res, item) => {
+        res[item.employeePerformanceId] = item.allocationPerformanceSalary || null
+        return res
+      }, {})
+      // this.values =
+      // data.records.forEach(e => {
+      //   if (Object.prototype.hasOwnProperty.call(this.values, e.employeePerformanceId)) {
+      //     return
+      //   }
+      //   this.values[e.employeePerformanceId] = e.allocationPerformanceSalary || null
+      //   // this.$set(this.values, e.employeePerformanceId, e.allocationPerformanceSalary || null)
+      // })
     },
     async onGetDept () {
       const data = await getOrganizationTree()

+ 1 - 1
src/views/bonus/approve/approveDetails.vue

@@ -31,7 +31,7 @@
 
       </div>
     </div>
-    <BonusTable ref="bonusTableRefs" :filter-header="filterHeader" shadow="never"></BonusTable>
+    <BonusTable ref="bonusTableRefs" :filter-header="filterHeader" :show-summary="true" shadow="never"></BonusTable>
   </m-dialog>
 </template>
 

+ 41 - 12
src/views/bonus/approve/index.vue

@@ -23,10 +23,12 @@
 
 <script>
 import {
-  getBonusApprovePage
+  getBonusApprovePage,
+  getAllocationEmployeeCategory
 } from '@/api/bonus'
 import ApproveDetails from './approveDetails.vue'
 import { STATUS_LIST } from '../utils'
+
 export default {
   name: 'bonusAllocationApprove',
   components: {
@@ -52,7 +54,8 @@ export default {
         current: 1,
         size: 10
       },
-      searchValues: {}
+      searchValues: {},
+      employeeCategoryItems: []
     }
   },
   computed: {
@@ -68,22 +71,26 @@ export default {
             type: 'month',
             valueFormat: 'yyyy-MM',
             format: 'yyyy 年 MM 月'
+          },
+          handles: {
+            change: this.getEmployeeCategoryItems
           }
         },
-        {
-          label: '发起机构',
-          prop: 'organizationName',
-          type: 'input',
-          options: {
-            placeholder: '请输入发起机构'
-          }
-        },
+        // {
+        //   label: '发起机构',
+        //   prop: 'organizationName',
+        //   type: 'input',
+        //   options: {
+        //     placeholder: '请输入发起机构'
+        //   }
+        // },
         {
           label: '员工类型',
           prop: 'employeeCategory',
-          type: 'input',
+          type: 'select',
           options: {
-            placeholder: '请输入员工类型'
+            placeholder: '请输入员工类型',
+            items: this.employeeCategoryItems
           }
         }
       ]
@@ -111,6 +118,28 @@ export default {
       this.pageInfo.current = page
       this.onInit()
     },
+    async getEmployeeCategoryItems () {
+      try {
+        const { data } = await getAllocationEmployeeCategory({
+          month: this.searchValues.month
+        })
+        this.employeeCategoryItems = data.map(e => {
+          return {
+            label: e,
+            value: e
+          }
+        })
+        if (!data.length) {
+          this.searchValues.employeeCategory = null
+          return
+        }
+        this.searchValues.employeeCategory = this.employeeCategoryItems[0].value
+        return data
+      } catch (error) {
+        this.employeeCategoryItems = []
+        this.$message.error(error)
+      }
+    },
     onSearch () {
       this.pageInfo.current = 1
       this.onInit()