zhengnaiwen_citu 4 mēneši atpakaļ
vecāks
revīzija
dbba0d94d1

+ 10 - 0
src/api/bonus.js

@@ -39,3 +39,13 @@ export function getBonusApprovePage (data) {
 export function saveBonusApproveConfirmation (data) {
   return http.post('/employee/performance/confirmation/approve', data)
 }
+
+// 奖金设置 列表
+export function getBonusSettingPage (data) {
+  return http.post('/performance/configuration/page', data)
+}
+
+// 奖金设置 保存
+export function saveBonusSetting (data) {
+  return http.post('/performance/configuration/save', data)
+}

+ 83 - 0
src/views/bonus/setting/bonusSettingEdit.vue

@@ -0,0 +1,83 @@
+<template>
+  <m-dialog title="奖金设置" ref="dialog" @sure="onSure">
+    <m-form ref="form" :items="formItems" v-model="formValues" v-loading="loading"></m-form>
+  </m-dialog>
+</template>
+
+<script>
+import {
+  saveBonusSetting
+} from '@/api/bonus'
+export default {
+  name: 'bonusSettingEdit',
+  data () {
+    return {
+      formItems: [
+        {
+          label: '配置名称',
+          type: 'input',
+          prop: 'configurationTitle',
+          options: {
+            placeholder: '请输入配置名称'
+          },
+          rules: [
+            { required: true, message: '请输入配置名称', trigger: 'blur' }
+          ]
+        },
+        {
+          label: '配置占比',
+          type: 'input',
+          prop: 'configurationValue',
+          options: {
+            placeholder: '请输入配置占比'
+          },
+          rules: [
+            { required: true, message: '请输入配置占比', trigger: 'blur' }
+          ]
+        }
+      ],
+      formValues: {
+        configurationTitle: null,
+        configurationValue: null
+      },
+      itemData: {},
+      loading: false
+    }
+  },
+  methods: {
+    open (item) {
+      this.$refs.dialog.open()
+      if (!item) {
+        return
+      }
+      this.itemData = item
+      this.formValues.configurationTitle = item.configurationTitle
+      this.formValues.configurationValue = item.configurationValue
+    },
+    onSure () {
+      this.$refs.form.validate(async valid => {
+        if (!valid) {
+          return
+        }
+        try {
+          await saveBonusSetting({
+            performanceConfigurationId: this.itemData.performanceConfigurationId,
+            ...this.formValues
+          })
+          this.$message.success('保存成功')
+          this.$refs.dialog.close()
+          this.$emit('success')
+        } catch (error) {
+          this.$message.error(error)
+        } finally {
+          this.loading = false
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 121 - 0
src/views/bonus/setting/index.vue

@@ -0,0 +1,121 @@
+<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>
+      </template>
+    </m-table>
+    <BonusSettingEdit ref="bonusSettingEditRefs" @success="onInit"></BonusSettingEdit>
+  </div>
+</template>
+
+<script>
+import {
+  getBonusSettingPage
+} from '@/api/bonus'
+// import { mapGetters } from 'vuex'
+import BonusSettingEdit from './bonusSettingEdit.vue'
+export default {
+  name: 'bonusSetting',
+  components: { BonusSettingEdit },
+  data () {
+    return {
+      searchValues: {},
+      headers: [
+        // { label: '适用机构', prop: 'organizationName' },
+        // { label: '适用岗位', prop: 'postName' },
+        { label: '配置名称', prop: 'configurationTitle' },
+        { label: '配置占比', prop: 'configurationValue' },
+        { label: '操作', prop: 'actions', fixed: 'right', width: 300 }
+      ],
+      items: [],
+      total: 0,
+      orders: [],
+      pageInfo: {
+        current: 1,
+        size: 10
+      },
+      loading: false
+    }
+  },
+  // computed: {
+  //   ...mapGetters(['organizationTree']),
+  //   searchItems () {
+  //     return [
+  //       {
+  //         label: '机构',
+  //         prop: 'organizationNo',
+  //         type: 'cascader',
+  //         options: {
+  //           placeholder: '请选择机构',
+  //           options: this.organizationTree,
+  //           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 getBonusSettingPage({
+          page: {
+            ...this.pageInfo,
+            orders: this.orders
+          },
+          entity: {
+            ...this.searchValues
+          }
+        })
+        this.items = data.records
+        this.total = data.total
+      } catch (error) {
+        this.$message.error(error)
+      } finally {
+        this.loading = false
+      }
+    },
+    onAdd () {
+      this.$refs.bonusSettingEditRefs.open()
+    },
+    onEdit (item) {
+      this.$refs.bonusSettingEditRefs.open(item)
+    },
+    onSearch () {
+      this.pageInfo.current = 1
+      this.onInit()
+    },
+    onPageChange (index) {
+      this.pageInfo.current = index
+      this.onInit()
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+  /* 自定义样式 */
+</style>