zhengnaiwen_citu 4 meses atrás
pai
commit
82f3393645

+ 5 - 0
src/api/salary.js

@@ -141,6 +141,11 @@ export function getSalaryFixedList (data) {
   return http.post('/digitizationData/employee/salary/page', data)
 }
 
+// 固定薪资 基础薪资导出
+export function exportSalaryFixedList (data) {
+  return http.download('/digitizationData/employee/basic/salary/download/export', data)
+}
+
 // 薪酬等级字典
 export function getSalaryLevelDict () {
   return http.post('/salary/level/manage/dict')

+ 91 - 0
src/components/ExportByDate/index.vue

@@ -0,0 +1,91 @@
+<template>
+  <el-popover
+    placement="top"
+    width="300"
+    v-model="visible">
+    <p>导出日期选择</p>
+    <m-form ref="exportRefs" label-width="60px" :items="exportItems" v-model="exportValues"></m-form>
+    <div style="text-align: right; margin: 0">
+      <el-button size="mini" @click="visible = false">取消</el-button>
+      <el-button type="orange" size="mini" @click="onClick">导出</el-button>
+    </div>
+    <m-button slot="reference" size="mini" type="orange" icon="el-icon-download" :loading="exportLoading">导出</m-button>
+  </el-popover>
+</template>
+
+<script>
+import { downloadFile } from '@/utils'
+export default {
+  name: 'exportByDate',
+  props: {
+    searchValue: {
+      type: String,
+      default: 'month'
+    },
+    searchType: {
+      type: String,
+      default: 'month'
+    },
+    searchFormat: {
+      type: String,
+      default: 'yyyy-MM'
+    },
+    onExport: {
+      type: Function,
+      default: () => {}
+    }
+  },
+  data () {
+    return {
+      visible: false,
+      exportValues: {
+        [this.searchValue]: null
+      },
+      exportLoading: false
+    }
+  },
+  computed: {
+    exportItems () {
+      return [
+        {
+          label: '时间',
+          type: 'datePicker',
+          prop: this.searchValue,
+          options: {
+            size: 'mini',
+            placeholder: '请选择时间',
+            type: this.searchType,
+            valueFormat: this.searchFormat
+          },
+          rules: [
+            { required: true, message: '请选择时间', trigger: 'change' }
+          ]
+        }
+      ]
+    }
+  },
+  methods: {
+    onClick () {
+      this.$refs.exportRefs.validate(async valid => {
+        if (!valid) {
+          return
+        }
+        this.visible = false
+        this.exportLoading = true
+        try {
+          const { data, name } = await this.onExport(this.exportValues)
+          downloadFile(data, name)
+        } catch (error) {
+          this.$message.error(error)
+        } finally {
+          this.exportLoading = false
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 9 - 0
src/utils/dict.js

@@ -21,3 +21,12 @@ export const APPROVAL_STATUS = [
   { text: '审核拒绝', color: 'danger' },
   { text: '异常结束', color: 'warning' }
 ]
+
+// 员工状态
+export const EMPLOYEE_STATUS = [
+  { text: '在职', color: 'primary', value: 0 },
+  { text: '退休', color: 'info', value: 1 },
+  { text: '离职', color: 'danger', value: 2 },
+  { text: '借调', color: 'warning', value: 3 },
+  { text: '病休', color: 'info', value: 4 }
+]

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

@@ -14,12 +14,16 @@
       @page-change="pageChange"
       @sort-change="sortChange"
     >
+      <template #employeeStatus="{ row }">
+        <el-tag size="small" :type="EMPLOYEE_STATUS.find(e => e.value === row.employeeStatus)?.color">
+          {{ EMPLOYEE_STATUS.find(e => e.value === row.employeeStatus)?.text }}
+        </el-tag>
+      </template>
       <template #card-tools v-if="!$attrs.panorama">
         <m-button type="orange" size="small" icon="el-icon-plus" @click="onAdd">新增</m-button>
         <el-upload class="el-button pa-0" action="#" :show-file-list="false" :http-request="onImport">
           <m-button type="orange" size="small" icon="el-icon-upload2" :loading="importLoading">上传</m-button>
         </el-upload>
-        <!-- <m-button type="orange" size="small" icon="el-icon-download" @click="onExport" :loading="exportLoading">导出</m-button> -->
         <m-button type="orange" size="small" icon="el-icon-download" @click="onDownload" :loading="downloadLoading">下载模板</m-button>
         <m-button type="orange" size="small" icon="el-icon-setting" @click="onChange">变更记录</m-button>
       </template>
@@ -47,12 +51,16 @@ import {
 import {
   dateFormat
 } from '@/utils/date'
+import {
+  EMPLOYEE_STATUS
+} from '@/utils/dict'
 import { mapGetters } from 'vuex'
 export default {
   name: 'sys-roster',
   components: { RosterEdit, RosterVersion },
   data () {
     return {
+      EMPLOYEE_STATUS,
       importLoading: false,
       exportLoading: false,
       downloadLoading: false,
@@ -111,6 +119,7 @@ export default {
         { label: '通行证号', prop: 'passes' },
         { label: '员工名称', prop: 'employeeName' },
         { label: '工行时间', prop: 'tradeUnionsTime' },
+        { label: '员工状态', prop: 'employeeStatus' },
         { label: '人员类别', prop: 'personnelCategory' },
         { label: '岗位名称', prop: 'postName' },
         { label: '岗位序列', prop: 'positionSequence' },

+ 15 - 0
src/views/humanResources/roster/rosterEdit.vue

@@ -17,6 +17,10 @@ import {
   getPositionSequence,
   getJobName
 } from '@/api/dictionary'
+
+import {
+  EMPLOYEE_STATUS
+} from '@/utils/dict'
 export default {
   name: 'roster-edit',
   props: {
@@ -92,6 +96,17 @@ export default {
           options: { disabled: this.isEdit, placeholder: '请选择工行时间' },
           rules: [{ required: true, message: '请选择工行时间', trigger: 'blur' }]
         },
+        {
+          label: '员工状态',
+          prop: 'employeeStatus',
+          type: 'select',
+          options: {
+            placeholder: '请选择员工状态',
+            filterable: true,
+            items: EMPLOYEE_STATUS.map(e => ({ label: e.text, value: e.value }))
+          },
+          rules: { required: true, message: '请输入人员类别', trigger: 'change' }
+        },
         {
           label: '人员类别',
           prop: 'personnelCategory',

+ 11 - 10
src/views/humanResources/roster/rosterVersion.vue

@@ -10,7 +10,7 @@
       <m-table
         v-loading="loading"
         shadow="never"
-        :card-title="`员工变更记录 [ 截止 ${exportTime} ] `"
+        :card-title="`员工变更记录 `"
         :headers="headers"
         :items="items"
         :total="total"
@@ -19,8 +19,9 @@
         @page-change="onPageChange"
       >
         <template #card-tools>
-            <m-button size="mini" type="orange" icon="el-icon-download" :loading="exportLoading" @click="onExport">导出</m-button>
-          </template>
+          <!-- <ExportByDate :on-export="onExport"></ExportByDate> -->
+          <m-button size="mini" type="orange" icon="el-icon-download" :loading="exportLoading" @click="onExport">导出</m-button>
+        </template>
       </m-table>
     </div>
   </el-drawer>
@@ -28,11 +29,12 @@
 
 <script>
 import { getRosterVersion, exportRosterVersion } from '@/api/system'
-import { downloadFile } from '@/utils'
+// import ExportByDate from '@/components/ExportByDate'
 import { mapGetters } from 'vuex'
 import {
   dateFormat
 } from '@/utils/date'
+import { downloadFile } from '@/utils'
 export default {
   name: 'rosterVersion',
   data () {
@@ -50,7 +52,7 @@ export default {
         versionMonth: null,
         employeeName: null
       },
-      exportTime: null,
+      exportQuery: {},
       exportLoading: false
     }
   },
@@ -103,7 +105,6 @@ export default {
       this.show = true
       const time = dateFormat('YYYY-mm', new Date())
       this.searchValues.versionMonth = time
-      this.exportTime = time
       await this.init()
     },
     async init () {
@@ -115,6 +116,9 @@ export default {
           },
           ...this.searchValues
         })
+        this.exportQuery = {
+          ...this.searchValues
+        }
         this.items = data.records.map(e => {
           const date = new Date(e.tradeUnionsTime)
           // 获取年、月、日
@@ -136,9 +140,7 @@ export default {
     async onExport () {
       this.exportLoading = true
       try {
-        const { data, name } = await exportRosterVersion({
-          versionMonth: this.exportTime
-        })
+        const { data, name } = await exportRosterVersion(this.exportQuery)
         downloadFile(data, name)
       } catch (error) {
         this.$message.error(error)
@@ -148,7 +150,6 @@ export default {
     },
     onSearch () {
       this.pageInfo.current = 1
-      this.exportTime = this.searchValues.versionMonth
       this.init()
     },
     onPageChange (index) {

+ 67 - 31
src/views/salaryFixed/salaryFixedCalculation/index.vue

@@ -8,12 +8,13 @@
       :page-size="pageInfo.size"
       :page-current="pageInfo.current"
       :total="total"
+      :fit="true"
       @page-change="onPageChange"
       @sort-change="onSortChange"
     >
-      <!-- <template #card-tools>
-        <m-button type="orange" icon="el-icon-plus" @click="onAdd">新增</m-button>
-      </template> -->
+      <template #card-tools>
+        <m-button type="orange" icon="el-icon-download" :loading="exportLoading" @click="onExport">导出</m-button>
+      </template>
       <!-- <template #actions="{ row }">
         <m-button type="primary" text @click="onEdit(row)">编辑</m-button>
         <m-button type="danger" text @click="onDelete(row)">删除</m-button>
@@ -35,27 +36,36 @@
 
 <script>
 import {
-  getSalaryFixedList
+  getSalaryFixedList,
+  exportSalaryFixedList
 } from '@/api/salary'
+import {
+  downloadFile
+} from '@/utils'
 import { mapGetters } from 'vuex'
 export default {
   name: 'salaryFixedCalculation',
   data () {
     return {
+      exportLoading: false,
       searchValues: {
-        employeeName: null
+        employeeName: null,
+        month: null,
+        organizationNo: null
       },
       headers: [
+        { label: '月份', prop: 'month' },
+        { label: '员工编码', prop: 'passes' },
         { label: '姓名', prop: 'employeeName' },
-        { label: '所在部门名称', prop: 'deptName' },
-        { label: '岗位名称', prop: 'postName' },
+        { label: '所在部门名称', prop: 'deptName', width: 150 },
+        { label: '岗位名称', prop: 'postName', width: 150 },
         { label: '人员类别', prop: 'personnelCategory' },
-        { label: '职务层级', prop: 'jobLevel' },
+        { label: '职务层级', prop: 'jobLevel', width: 150 },
         { label: '工资系数', prop: 'coefficient' },
-        { label: '基础工资系数', prop: 'basicSalary' },
+        { label: '基础工资系数', prop: 'basicSalary', width: 150 },
         { label: '薪酬档次', prop: 'salaryCategory', align: 'center' },
         { label: '薪酬等级', prop: 'salaryLevel', align: 'center' },
-        { label: '固定薪资', prop: 'salaryAmount', align: 'center' }
+        { label: '固定薪资', prop: 'salaryAmount', align: 'center', fixed: 'right', width: 130 }
         // { label: '操作', prop: 'actions', fixed: 'right', width: 150 }
       ],
       items: [],
@@ -65,13 +75,24 @@ export default {
         size: 10
       },
       orders: [],
-      loading: false
+      loading: false,
+      exportOption: {}
     }
   },
   computed: {
     ...mapGetters(['organizationTree']),
     searchItems () {
       return [
+        {
+          label: '月份',
+          type: 'datePicker',
+          prop: 'month',
+          options: {
+            placeholder: '请选择月份',
+            type: 'month',
+            valueFormat: 'yyyy-MM'
+          }
+        },
         {
           label: '姓名',
           prop: 'employeeName',
@@ -108,7 +129,7 @@ export default {
     async onInit () {
       this.loading = true
       try {
-        const { organizationNo, ...param } = this.searchValues
+        const { organizationNo, month, ...param } = this.searchValues
         const { data } = await getSalaryFixedList({
           page: {
             ...this.pageInfo,
@@ -117,8 +138,12 @@ export default {
           entity: {
             ...param
           },
-          organizationNo
+          organizationNo,
+          month
         })
+        this.exportOption = {
+          ...this.searchValues
+        }
         this.items = data.records
         this.total = data.total
       } catch (error) {
@@ -127,24 +152,35 @@ export default {
         this.loading = false
       }
     },
-    onAdd () {
-      this.$refs.fixedSalaryCalculationRefs.open()
-    },
-    onEdit (item) {
-      this.$refs.fixedSalaryCalculationRefs.open(item)
-    },
-    onDelete (row) {
-      this.$confirm('确定删除吗?', '提示')
-        .then(async () => {
-          try {
-            // await ApiName({ id: row.id })
-            this.$message.success('删除成功')
-            this.onInit()
-          } catch (error) {
-            this.$message.error(error)
-          }
-        })
-        .catch(_ => {})
+    // onAdd () {
+    //   this.$refs.fixedSalaryCalculationRefs.open()
+    // },
+    // onEdit (item) {
+    //   this.$refs.fixedSalaryCalculationRefs.open(item)
+    // },
+    // onDelete (row) {
+    //   this.$confirm('确定删除吗?', '提示')
+    //     .then(async () => {
+    //       try {
+    //         // await ApiName({ id: row.id })
+    //         this.$message.success('删除成功')
+    //         this.onInit()
+    //       } catch (error) {
+    //         this.$message.error(error)
+    //       }
+    //     })
+    //     .catch(_ => {})
+    // },
+    async onExport () {
+      this.exportLoading = true
+      try {
+        const { data, name } = await exportSalaryFixedList(this.exportOption)
+        downloadFile(data, name)
+      } catch (error) {
+        this.$message.error(error)
+      } finally {
+        this.exportLoading = false
+      }
     },
     onSearch () {
       this.pageInfo.current = 1