소스 검색

个人工资单

zhengnaiwen_citu 4 달 전
부모
커밋
a9562d1a74
1개의 변경된 파일91개의 추가작업 그리고 0개의 파일을 삭제
  1. 91 0
      src/views/payroll/staffWageMine/index.vue

+ 91 - 0
src/views/payroll/staffWageMine/index.vue

@@ -0,0 +1,91 @@
+<template>
+  <div class="pa-3 white">
+    <m-search class="mb-3" :items="searchItems" v-model="searchValues" @search="onSearch"></m-search>
+    <m-card v-loading="loading">
+      <template #header>
+        {{ $route.meta.title }}
+      </template>
+      <m-empty v-if="!item"></m-empty>
+
+      <template v-else>
+        <el-descriptions :column="2" border>
+          <el-descriptions-item
+            v-for="header in headers"
+            :key="header.prop"
+            :label="header.label"
+          >
+            {{ item[header.prop] }}
+          </el-descriptions-item>
+        </el-descriptions>
+      </template>
+    </m-card>
+  </div>
+</template>
+
+<script>
+import {
+  getPayrollPage
+} from '@/api/salary'
+import { dateFormat } from '@/utils/date'
+import {
+  PAYROLL_HEADER
+} from '@/utils/panorama'
+export default {
+  name: 'StaffWageMine',
+  data () {
+    return {
+      headers: PAYROLL_HEADER,
+      loading: false,
+      item: null,
+      searchValues: {
+        month: dateFormat('YYYY-mm', new Date())
+      },
+      searchItems: [
+        {
+          label: '月份',
+          prop: 'month',
+          type: 'datePicker',
+          options: {
+            placeholder: '请选择月份',
+            type: 'month',
+            valueFormat: 'yyyy-MM',
+            format: 'yyyy 年 MM 月'
+          }
+        }
+      ]
+    }
+  },
+  created () {
+    this.onInit()
+  },
+  methods: {
+    async onInit () {
+      this.loading = true
+      try {
+        const { data } = await getPayrollPage({
+          entity: {
+            unifiedCertificationNumber: this.$store.getters.userInfo.employeeCode,
+            ...this.searchValues
+          }
+        })
+        if (!data.records.length) {
+          this.item = null
+          return
+        }
+        this.item = data.records.pop()
+      } catch (error) {
+        this.$message.error(error)
+      } finally {
+        this.loading = false
+      }
+    },
+    onSearch () {
+      this.onInit()
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>