zhengnaiwen_citu 5 mēneši atpakaļ
vecāks
revīzija
7e97789f3b
2 mainītis faili ar 58 papildinājumiem un 14 dzēšanām
  1. 5 0
      src/api/salary.js
  2. 53 14
      src/views/sandbox/sandboxCalculate.vue

+ 5 - 0
src/api/salary.js

@@ -240,3 +240,8 @@ export function sendSalaryRelease (data) {
 export function getSandboxResultList (data) {
   return http.post('/sanbox/data/analysis/datas', data)
 }
+
+// 测算结果列表明细
+export function getSandboxResultPage (data) {
+  return http.post('/sanbox/data/analysis/page', data)
+}

+ 53 - 14
src/views/sandbox/sandboxCalculate.vue

@@ -1,15 +1,15 @@
 <template>
-  <m-dialog title="测算"  ref="dialog" v-loading="loading">
+  <m-dialog title="绩效测算"  ref="dialog" v-loading="loading" width="1200px">
     <div v-if="!isCalculate && !isSuccess" class="d-flex align-center justify-center">
       正在测算中,请稍后...
     </div>
     <el-result v-if="isCalculate" icon="success" title="测算完成"></el-result>
     <template v-if="isSuccess">
-      <el-radio-group v-model="choose">
+      <el-radio-group v-model="choose" @input="getList">
         <el-radio
           v-for="item in radioItems"
           :key="item.id"
-          :label="item.name"
+          :label="item.id"
         >
           {{ item.name }}
         </el-radio>
@@ -20,6 +20,11 @@
         clearHeader
         :items="tableItems"
         :headers="tableHeaders"
+        :page-size="tablePageInfo.size"
+        :page-current="tablePageInfo.current"
+        :total="tableTotal"
+        @page-change="onPageChange"
+        @sort-change="onSortChange"
       ></m-table>
     </template>
   </m-dialog>
@@ -27,7 +32,8 @@
 
 <script>
 import {
-  getSandboxResultList
+  getSandboxResultList,
+  getSandboxResultPage
 } from '@/api/salary'
 export default {
   name: 'sandboxCalculate',
@@ -38,12 +44,14 @@ export default {
       isCalculate: false,
       isSuccess: false,
       radioItems: [],
+      tableTotal: 0,
+      tableOrders: [],
+      tablePageInfo: {
+        size: 10,
+        current: 1
+      },
       tableItems: [],
-      tableHeaders: [
-        { label: '姓名', prop: 'name' },
-        { label: '部门', prop: 'department' },
-        { label: '岗位', prop: 'position' }
-      ]
+      tableHeaders: []
     }
   },
   methods: {
@@ -58,18 +66,49 @@ export default {
         })
         this.radioItems = data || []
         if (this.radioItems.length) {
-          this.choose = this.radioItems[0].name
+          this.choose = this.radioItems[0].id
         }
         this.isCalculate = true
-        setTimeout(() => {
-          this.isCalculate = false
-          this.isSuccess = true
-        }, 1000)
+        await this.getList()
+        this.isCalculate = false
+        this.isSuccess = true
       } catch (error) {
         this.$message.error(error)
       } finally {
         this.loading = false
       }
+    },
+    async getList () {
+      this.loading = true
+      try {
+        const { data } = await getSandboxResultPage({
+          page: {
+            ...this.tablePageInfo,
+            orders: this.tableOrders
+          },
+          id: this.choose
+        })
+        this.tableHeaders = data.dataColumn.map(e => {
+          return {
+            label: e.name,
+            prop: e.enName
+          }
+        })
+        this.tableItems = data.page.records
+        this.tableTotal = data.page.total
+      } catch (error) {
+        this.$message.error(error)
+      } finally {
+        this.loading = false
+      }
+    },
+    onPageChange (index) {
+      this.tablePageInfo.current = index
+      this.getList()
+    },
+    onSortChange (v) {
+      this.tableOrders = v
+      this.getList()
     }
   }
 }