Forráskód Böngészése

工资单适配全景

zhengnaiwen_citu 6 hónapja
szülő
commit
9c501fdf42

+ 42 - 12
src/views/humanResources/payroll/index.vue

@@ -1,7 +1,7 @@
 <template>
-  <div class="white" :class="{ 'pa-3': !panorama.organizationNo }">
+  <div class="white" :class="{ 'pa-3': !$attrs.panorama }">
     <m-search :items="searchItems" v-model="searchValues" class="mb-3" @search="onSearch">
-      <template #button>
+      <template #button v-if="!$attrs.panorama">
         <m-button type="primary" icon="el-icon-download" :loading="exportLoading" plain @click="onExport">导出报表</m-button>
       </template>
     </m-search>
@@ -32,13 +32,8 @@ export default {
   name: 'salary-payroll',
   data () {
     return {
-      panorama: {},
       exportLoading: false,
-      searchValues: {
-        month: null,
-        organizationName: null,
-        employeeName: null
-      },
+      searchValues: {},
       headers: PAYROLL_HEADER,
       items: [],
       loading: false,
@@ -63,24 +58,59 @@ export default {
             format: 'yyyy 年 MM 月'
           }
         },
-        { label: '部门', prop: 'organizationName', type: 'input', options: { placeholder: '请输入部门' } },
-        { label: '姓名', prop: 'employeeName', type: 'input', options: { placeholder: '请输入姓名' } }
+        { label: '部门', prop: 'organizationName', type: 'input', options: { placeholder: '请输入部门' }, hidden: this.$attrs.panorama },
+        { label: '姓名', prop: 'employeeName', type: 'input', options: { placeholder: '请输入姓名' }, hidden: this.$attrs.panorama }
       ]
     }
   },
   created () {
+    // 全景视图终止自动调用
+    if (this.$attrs.panorama) {
+      return
+    }
     this.init()
   },
   methods: {
     // 执行全景初始化操作
     onInitPanorama (organizationNo, employeeNo) {
-      this.panorama = { organizationNo, employeeNo }
+      if (employeeNo) {
+        this.searchValues = {
+          month: null,
+          employeeNo
+        }
+      } else {
+        this.searchValues = {
+          month: null,
+          organizationNo
+        }
+      }
+      this.init()
     },
     async init () {
+      const query = {
+        entity: {
+          month: this.searchValues.month
+        }
+      }
+      if (this.$attrs.panorama) {
+        if (this.searchValues.employeeNo) {
+          Object.assign(query.entity, {
+            unifiedCertificationNumber: this.searchValues.employeeNo
+          })
+        } else {
+          Object.assign(query, {
+            organizationNo: this.searchValues.organizationNo
+          })
+        }
+      } else {
+        Object.assign(query, {
+          entity: this.searchValues
+        })
+      }
       try {
         const { data } = await getPayrollPage({
           page: this.pageInfo,
-          entity: this.searchValues
+          ...query
         })
         this.items = data.records
         this.total = data.total

+ 1 - 2
src/views/humanResources/roster/index.vue

@@ -47,7 +47,6 @@ export default {
   components: { rosterEdit },
   data () {
     return {
-      panorama: {},
       importLoading: false,
       exportLoading: false,
       downloadLoading: false,
@@ -139,7 +138,7 @@ export default {
     async init () {
       this.loading = true
       const query = {}
-      if (Object.keys(this.panorama).length > 0) {
+      if (this.$attrs.panorama) {
         if (this.searchValues.personnelCode) {
           query.entity = {
             personnelCode: this.searchValues.personnelCode