zhengnaiwen_citu il y a 4 mois
Parent
commit
5cd0840b07

+ 15 - 0
src/api/bonus.js

@@ -49,3 +49,18 @@ export function getBonusSettingPage (data) {
 export function saveBonusSetting (data) {
   return http.post('/performance/configuration/save', data)
 }
+
+// 绩效分配管理配置列表
+export function getAllocationConfigList (data) {
+  return http.post('/performance/salary/manage/employee/page', data)
+}
+
+// 绩效分配管理配置 保存
+export function saveAllocationConfig (data) {
+  return http.post('/performance/salary/manage/employee/save', data)
+}
+
+// 绩效分配管理配置 删除
+export function deleteAllocationConfig (data) {
+  return http.post('performance/salary/manage/employee/delete', data)
+}

+ 10 - 1
src/components/ParamsSetting/ParamsSettingEdit.vue

@@ -4,6 +4,9 @@
       <template #configurationTitle>
         <el-tag>{{ formValues.configurationTitle }}</el-tag>
       </template>
+      <template #desc>
+        {{ formValues.desc }}
+      </template>
     </m-form>
   </m-dialog>
 </template>
@@ -31,11 +34,16 @@ export default {
           rules: [
             { required: true, message: '请输入配置占比', trigger: 'blur' }
           ]
+        },
+        {
+          label: '配置描述',
+          prop: 'desc'
         }
       ],
       formValues: {
         configurationTitle: null,
-        configurationValue: null
+        configurationValue: null,
+        desc: null
       },
       itemData: {},
       loading: false
@@ -50,6 +58,7 @@ export default {
       this.itemData = item
       this.formValues.configurationTitle = item.configurationTitle
       this.formValues.configurationValue = item.configurationValue
+      this.formValues.desc = item.desc
     },
     onSure () {
       this.$refs.form.validate(async valid => {

+ 1 - 0
src/components/ParamsSetting/index.vue

@@ -39,6 +39,7 @@ export default {
       headers: [
         { label: '配置名称', prop: 'configurationTitle' },
         { label: '配置占比', prop: 'configurationValue' },
+        { label: '描述', prop: 'desc' },
         { label: '操作', prop: 'actions', fixed: 'right', width: 300 }
       ],
       items: [],

+ 180 - 0
src/views/bonus/allocationConfig/AllocationConfigEdit.vue

@@ -0,0 +1,180 @@
+<template>
+  <m-dialog :title="isEdit ? '编辑配置' : '新增配置'" ref="dialog" @sure="onSure">
+    <m-form ref="form" :items="formItems" v-model="formValues" v-loading="loading"></m-form>
+
+  </m-dialog>
+</template>
+
+<script>
+import { mapGetters } from 'vuex'
+import {
+  getRosterList
+} from '@/api/system'
+import {
+  saveAllocationConfig
+} from '@/api/bonus'
+export default {
+  name: 'AllocationConfigEdit',
+  data () {
+    return {
+      formValues: {
+        employeeCode: null,
+        employeeName: null,
+        organizationNo: null,
+        organizationName: null
+      },
+      itemData: {},
+      filterLoading: false,
+      loading: false,
+      items: []
+    }
+  },
+  computed: {
+    isEdit () {
+      return Object.keys(this.itemData).length > 0
+    },
+    ...mapGetters(['organizationTree']),
+    organizationItems () {
+      if (this.organizationTree.length > 0) {
+        return this.organizationTree[0].child
+      }
+      return []
+    },
+    formItems () {
+      return [
+        {
+          label: '管理者',
+          prop: 'employeeCode',
+          type: 'select',
+          options: {
+            placeholder: '请选择管理者',
+            filterable: true,
+            remote: true,
+            labelText: 'employeeName',
+            labelValue: 'personnelCode',
+            remoteMethod: this.remoteMethod,
+            valueKey: 'personnelCode',
+            defaultFirstOption: true,
+            loading: this.filterLoading,
+            items: this.items
+          },
+          handles: {
+            change: (v) => {
+              const item = this.items.find(e => e.personnelCode === v)
+              this.formValues.employeeName = item.employeeName
+              this.formValues.employeeCode = item.personnelCode
+            }
+          },
+          rules: [
+            { required: true, message: '请选择管理者', trigger: 'change' }
+          ]
+        },
+        {
+          label: '管理机构',
+          prop: 'organizationNo',
+          type: 'cascader',
+          rules: [
+            { required: true, message: '请选择机构', trigger: 'change' }
+          ],
+          options: {
+            ref: 'organizationNo',
+            filterable: true,
+            clearable: true,
+            placeholder: '请选择机构',
+            options: this.organizationItems,
+            showAllLevels: false,
+            props: {
+              emitPath: false,
+              checkStrictly: true,
+              value: 'organizationNo',
+              label: 'organizationName',
+              children: 'child'
+            }
+          },
+          handles: {
+            change: (v) => {
+              const nodes = this.$refs.form.$refs.organizationNo.getCheckedNodes()
+              this.formValues.organizationNo = nodes[0].data.organizationNo
+              this.formValues.organizationName = nodes[0].data.organizationName
+            }
+          }
+        }
+      ]
+    }
+  },
+  methods: {
+    open (item) {
+      this.loading = true
+      // 默认获取一次
+      this.remoteMethod()
+      if (!item) {
+        this.itemData = {}
+        this.formValues = {
+          employeeCode: null,
+          employeeName: null,
+          organizationNo: null,
+          organizationName: null
+        }
+      } else {
+        this.itemData = item
+        this.formValues = {
+          employeeCode: item.employeeCode,
+          organizationName: item.organizationName,
+          organizationNo: item.organizationNo,
+          employeeName: item.employeeName
+        }
+      }
+      this.$refs.dialog.open()
+      this.$nextTick(() => {
+        this.$refs.form.clearValidate()
+        this.loading = false
+      })
+    },
+    async remoteMethod (str) {
+      this.filterLoading = true
+      try {
+        const { data } = await getRosterList({
+          entity: {
+            employeeName: str
+          },
+          page: {
+            current: 1,
+            size: 99
+          }
+        })
+        this.items = data.records
+      } catch (error) {
+        this.items = []
+        this.$message.error(error)
+      } finally {
+        this.filterLoading = false
+      }
+    },
+    onSure () {
+      this.$refs.form.validate(async valid => {
+        if (!valid) {
+          return
+        }
+        this.loading = true
+        try {
+          await saveAllocationConfig({
+            performanceSalaryManageEmployeeId: this.itemData.performanceSalaryManageEmployeeId,
+            ...this.formValues
+          })
+          this.$refs.dialog.close()
+          this.$message.success('操作成功')
+          this.$emit('success')
+        } catch (error) {
+          this.$message.error(error)
+        } finally {
+          this.loading = false
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 150 - 0
src/views/bonus/allocationConfig/index.vue

@@ -0,0 +1,150 @@
+<template>
+  <div class="pa-3 white">
+    <m-search class="mb-3" :items="searchItems" v-model="searchValues" @search="onSearch"></m-search>
+    <m-table
+      v-loading="loading"
+      :items="items"
+      :headers="headers"
+      :page-size="pageInfo.size"
+      :page-current="pageInfo.current"
+      :total="total"
+      @page-change="onPageChange"
+    >
+      <template #card-tools>
+        <m-button type="orange" icon="el-icon-plus" @click="onAdd">新增</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>
+      </template>
+    </m-table>
+    <AllocationConfigEdit ref="allocationConfigEditRefs" @success="onInit"></AllocationConfigEdit>
+  </div>
+</template>
+
+<script>
+import {
+  getAllocationConfigList,
+  deleteAllocationConfig
+} from '@/api/bonus'
+import AllocationConfigEdit from './AllocationConfigEdit.vue'
+import { mapGetters } from 'vuex'
+export default {
+  name: 'AllocationConfig',
+  components: {
+    AllocationConfigEdit
+  },
+  data () {
+    return {
+      searchValues: {
+        employeeName: null
+      },
+      headers: [
+        { label: '管理者名称', prop: 'employeeName' },
+        { label: '管理机构', prop: 'organizationName' },
+        // { label: '分配占比', prop: 'manageProportion', align: 'center' },
+        { label: '创建时间', prop: 'createDate' },
+        { label: '操作', prop: 'actions' }
+      ],
+      items: [],
+      total: 0,
+      pageInfo: {
+        current: 1,
+        size: 10
+      },
+      loading: false
+    }
+  },
+  computed: {
+    ...mapGetters(['organizationTree']),
+    organizationItems () {
+      if (this.organizationTree.length > 0) {
+        return this.organizationTree[0].child
+      }
+      return []
+    },
+    searchItems () {
+      return [
+        {
+          label: '管理者',
+          prop: 'employeeName',
+          type: 'input',
+          options: {
+            placeholder: '请输入名称'
+          }
+        },
+        {
+          label: '管理机构',
+          prop: 'organizationNo',
+          type: 'cascader',
+          options: {
+            ref: 'organizationNo',
+            filterable: true,
+            clearable: true,
+            placeholder: '请选择机构',
+            options: this.organizationItems,
+            showAllLevels: false,
+            props: {
+              emitPath: false,
+              checkStrictly: true,
+              value: 'organizationNo',
+              label: 'organizationName',
+              children: 'child'
+            }
+          }
+        }
+      ]
+    }
+  },
+  created () {
+    this.onInit()
+  },
+  methods: {
+    async onInit () {
+      this.loading = true
+      try {
+        const { data } = await getAllocationConfigList({
+          ...this.searchValues
+        })
+        this.items = data.records
+        this.total = data.total
+      } catch (error) {
+        this.$message.error(error)
+      } finally {
+        this.loading = false
+      }
+    },
+    onAdd () {
+      this.$refs.allocationConfigEditRefs.open()
+    },
+    onEdit (item) {
+      this.$refs.allocationConfigEditRefs.open(item)
+    },
+    onDelete (row) {
+      this.$confirm('确定删除吗?', '提示')
+        .then(async () => {
+          try {
+            await deleteAllocationConfig({ performanceSalaryManageEmployeeId: row.performanceSalaryManageEmployeeId })
+            this.$message.success('删除成功')
+            this.onInit()
+          } catch (error) {
+            this.$message.error(error)
+          }
+        })
+        .catch(_ => {})
+    },
+    onSearch () {
+      this.pageInfo.current = 1
+      this.onInit()
+    },
+    onPageChange (index) {
+      this.pageInfo.current = index
+      this.onInit()
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+  /* 自定义样式 */
+</style>