zhengnaiwen_citu 3 maanden geleden
bovenliggende
commit
eb2935d38d

+ 5 - 0
src/api/salary.js

@@ -215,3 +215,8 @@ export function claimPerformanceMore (data) {
 export function claimPerformanceMoreByBatch (data) {
   return http.post('/customer/performance/major/dept/batch/add/claim', data)
 }
+
+// 绩效分布图
+export function getCustomerClaimStatistics (data) {
+  return http.get('/customer/performance/claim/statistics', data)
+}

+ 2 - 1
src/components/Analysis/AnalysisChart.vue

@@ -1,5 +1,5 @@
 <template>
-  <m-card shadow="never" :bodyStyle="{ position: 'relative' }">
+  <m-card :shadow="shadow ?? 'never'" :bodyStyle="{ position: 'relative' }">
     <e-charts ref="chart" :style="`height: ${height ?? 400}px;`"></e-charts>
     <el-drawer
       :visible.sync="drawer"
@@ -25,6 +25,7 @@ export default {
   props: {
     height: [Number, String],
     init: Function,
+    shadow: String,
     option: {
       type: Object,
       default: () => ({})

+ 25 - 0
src/views/dataChart/claimStatistics/index.vue

@@ -0,0 +1,25 @@
+<template>
+  <div class="white pa-3">
+    <StatisticsCard :api="getCustomerClaimStatistics"></StatisticsCard>
+  </div>
+</template>
+
+<script>
+import StatisticsCard from '../components/StatisticsCard.vue'
+import { getCustomerClaimStatistics } from '@/api/salary'
+export default {
+  name: 'claimStatistics',
+  components: {
+    StatisticsCard
+  },
+  data () {
+    return {
+      getCustomerClaimStatistics
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 60 - 0
src/views/dataChart/components/StatisticsCard.vue

@@ -0,0 +1,60 @@
+<template>
+  <div>
+    <m-search class="mb-3" :items="searchItems" v-model="searchValues"></m-search>
+    <AnalysisChart shadow="always" :option="option" height="800" v-loading="loading"></AnalysisChart>
+  </div>
+</template>
+
+<script>
+import AnalysisChart from '@/components/Analysis/AnalysisChart'
+import { dateFormat } from '@/utils/date'
+export default {
+  name: 'StatisticsCard',
+  components: {
+    AnalysisChart
+  },
+  props: {
+    api: Function
+  },
+  data () {
+    return {
+      loading: false,
+      option: {},
+      searchItems: [
+        {
+          label: '月份',
+          prop: 'month',
+          type: 'datePicker',
+          options: {
+            placeholder: '请选择月份',
+            clearable: false,
+            type: 'month',
+            valueFormat: 'yyyy-MM',
+            format: 'yyyy 年 MM 月'
+          }
+        }
+      ],
+      searchValues: {
+        month: dateFormat('YYYY-mm', new Date())
+      }
+    }
+  },
+  async created () {
+    this.loading = true
+    try {
+      const { data } = await this.api({
+        ...this.searchValues
+      })
+      this.option = data
+    } catch (error) {
+      this.$message.error(error)
+    } finally {
+      this.loading = false
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 26 - 27
src/views/salary/claim/sharingClaim/index.vue

@@ -13,8 +13,8 @@
       @sort-change="onSortChange"
     >
       <template #actions="{ row }">
-        <!-- <m-button type="primary" text @click="onDetails(row)">查看明细</m-button> -->
-        <m-button
+        <m-button type="primary" text @click="onDetails(row)">查看明细</m-button>
+        <!-- <m-button
           v-if="!majorOrganization"
           type="primary"
           text
@@ -23,12 +23,12 @@
         >
           分润
         </m-button>
-        <m-button v-else type="primary" text @click="onClaimByDept(row)" >专业部门分配</m-button>
+        <m-button v-else type="primary" text @click="onClaimByDept(row)" >专业部门分配</m-button> -->
       </template>
     </m-table>
-    <!-- <SharingClaimDetails ref="sharingClaimDetailsRefs" /> -->
-    <SharingClaimDetailsClaim ref="sharingClaimDetailsClaimRefs" @success="getPage"></SharingClaimDetailsClaim>
-    <SharingClaimDetailsClaimByDept ref="sharingClaimDetailsClaimByDeptRefs" @success="getPage"></SharingClaimDetailsClaimByDept>
+    <SharingClaimDetails ref="sharingClaimDetailsRefs" />
+    <!-- <SharingClaimDetailsClaim ref="sharingClaimDetailsClaimRefs" @success="getPage"></SharingClaimDetailsClaim>
+    <SharingClaimDetailsClaimByDept ref="sharingClaimDetailsClaimByDeptRefs" @success="getPage"></SharingClaimDetailsClaimByDept> -->
   </div>
 </template>
 
@@ -40,15 +40,14 @@ import {
   // getCustomerProfitSharingClaimAdd,
   getAccessOrganization
 } from '@/api/salary'
-// import SharingClaimDetails from './sharingClaimDetails.vue'
-import SharingClaimDetailsClaim from './sharingClaimDetailsClaim.vue'
-import SharingClaimDetailsClaimByDept from './sharingClaimDetailsClaimByDept.vue'
+import SharingClaimDetails from './sharingClaimDetails.vue'
+// import SharingClaimDetailsClaim from './sharingClaimDetailsClaim.vue'
+// import SharingClaimDetailsClaimByDept from './sharingClaimDetailsClaimByDept.vue'
 import { mapGetters } from 'vuex'
 export default {
   name: 'salaryClaimSharing',
   components: {
-    SharingClaimDetailsClaimByDept,
-    SharingClaimDetailsClaim
+    SharingClaimDetails
   },
   data () {
     return {
@@ -134,10 +133,10 @@ export default {
           }
         }
       ]
-    },
-    majorOrganization () {
-      return this.organizationItems.find(e => e.organizationNo === this.queryValues.manageOrganizationNo)?.majorOrganization ?? false
     }
+    // majorOrganization () {
+    //   return this.organizationItems.find(e => e.organizationNo === this.queryValues.manageOrganizationNo)?.majorOrganization ?? false
+    // }
   },
   methods: {
     async onInit (cardTitle) {
@@ -192,20 +191,20 @@ export default {
         this.$message.error(error)
       }
     },
-    // onDetails (item) {
-    //   this.$refs.sharingClaimDetailsRefs.open({
-    //     month: this.queryValues.month,
-    //     majorOrganization: this.organizationItems.find(e => e.organizationNo === this.queryValues.manageOrganizationNo)?.majorOrganization ?? false,
-    //     manageOrganizationNo: item.organizationNo,
-    //     ...item
-    //   })
-    // },
-    onClaim (item) {
-      this.$refs.sharingClaimDetailsClaimRefs.open(item)
-    },
-    onClaimByDept (item) {
-      this.$refs.sharingClaimDetailsClaimByDeptRefs.open(item)
+    onDetails (item) {
+      this.$refs.sharingClaimDetailsRefs.open({
+        month: this.queryValues.month,
+        majorOrganization: this.organizationItems.find(e => e.organizationNo === this.queryValues.manageOrganizationNo)?.majorOrganization ?? false,
+        manageOrganizationNo: item.organizationNo,
+        ...item
+      })
     },
+    // onClaim (item) {
+    //   this.$refs.sharingClaimDetailsClaimRefs.open(item)
+    // },
+    // onClaimByDept (item) {
+    //   this.$refs.sharingClaimDetailsClaimByDeptRefs.open(item)
+    // },
     // async onSubmit (query) {
     //   this.$refs.claimFormRef.setLoading(true)
     //   const submitApi = this.isDept ? getCustomerProfitSharingClaimDeptAdd : getCustomerProfitSharingClaimAdd

+ 68 - 32
src/views/salary/claim/sharingClaim/sharingClaimDetails.vue

@@ -1,36 +1,52 @@
 <template>
   <m-dialog title="分润明细" ref="dialog" width="1360px">
-    <m-table
-      clearHeader
-      shadow="never"
-      v-loading="loading"
-      :items="items"
-      :headers="headers"
-      :page-size="pageInfo.size"
-      :page-current="pageInfo.current"
-      :total="total"
-      @page-change="onPageChange"
-      @sort-change="onSortChange"
-    >
-      <template #alreadyDistributedRatio="{ row }">
-        {{ row.alreadyDistributedRatio * 100 }} %
+    <m-form :items="formItems">
+      <template #msg>
+        <el-descriptions :column="3" border >
+          <el-descriptions-item label="机构名称">{{ itemData.organizationName }}</el-descriptions-item>
+          <el-descriptions-item label="数据日期">{{ itemData.month }}</el-descriptions-item>
+          <el-descriptions-item label="客户编号">{{ itemData.customerId }}</el-descriptions-item>
+          <el-descriptions-item label="一级科目编码/名称">{{ itemData.oneLevelSubject }}</el-descriptions-item>
+          <el-descriptions-item label="二级科目编码/名称">{{ itemData.twoLevelSubject }}</el-descriptions-item>
+          <el-descriptions-item label="管户层级标识">{{ itemData.customerLevelIdentifier }}</el-descriptions-item>
+          <el-descriptions-item label="客户类别标识">{{ itemData.customerCategoryIdentifier }}</el-descriptions-item>
+        </el-descriptions>
       </template>
-      <template #employeeProfitSharingRatio="{ row }">
-        {{ row.employeeProfitSharingRatio * 100 }} %
-      </template>
-      <template #actions="{ row }">
-        <m-button
-          v-if="!majorOrganization"
-          type="primary"
-          text
-          @click="onClaim(row)"
-          :disabled="row.alreadyDistributedRatio * 100 >= maxRatio"
+      <template #list>
+        <m-table
+          clearHeader
+          shadow="never"
+          v-loading="loading"
+          :items="items"
+          :headers="headers"
+          :page-size="pageInfo.size"
+          :page-current="pageInfo.current"
+          :total="total"
+          @page-change="onPageChange"
+          @sort-change="onSortChange"
         >
-          {{ row.alreadyDistributedRatio * 100 >= maxRatio ? '已分完' : '分润'}}
-        </m-button>
-        <m-button v-else type="primary" text @click="onClaimByDept(row)" >专业部门分配</m-button>
+          <template #employeeProfitSharingRatio="{ row }">
+            {{ row.employeeProfitSharingRatio * 100 }} %
+          </template>
+          <!-- <template #employeeProfitSharingRatio="{ row }">
+            {{ row.employeeProfitSharingRatio * 100 }} %
+          </template> -->
+          <template #actions="{ row }">
+            <m-button
+              v-if="!itemData.majorOrganization"
+              type="primary"
+              text
+              @click="onClaim(row)"
+              :disabled="row.alreadyDistributedRatio * 100 >= maxRatio"
+            >
+              {{ row.alreadyDistributedRatio * 100 >= maxRatio ? '已分完' : '分润'}}
+            </m-button>
+            <m-button v-else type="primary" text @click="onClaimByDept(row)" >专业部门分配</m-button>
+          </template>
+        </m-table>
       </template>
-    </m-table>
+    </m-form>
+
     <SharingClaimDetailsClaim ref="sharingClaimDetailsClaimRefs" @success="getPage"></SharingClaimDetailsClaim>
     <SharingClaimDetailsClaimByDept ref="sharingClaimDetailsClaimByDeptRefs" @success="getPage"></SharingClaimDetailsClaimByDept>
   </m-dialog>
@@ -41,7 +57,6 @@ import {
   getProfitSharingClaim,
   getClaimRatioMax
 } from '@/api/salary'
-import { HEADERS } from '../utils'
 import SharingClaimDetailsClaim from './sharingClaimDetailsClaim'
 import SharingClaimDetailsClaimByDept from './sharingClaimDetailsClaimByDept.vue'
 export default {
@@ -52,7 +67,28 @@ export default {
   },
   data () {
     return {
-      headers: HEADERS,
+      formItems: [
+        { label: '分润数据信息', prop: 'msg' },
+        { label: '分润明细', prop: 'list' }
+      ],
+      headers: [
+        { label: '统一认证号1', prop: 'unifiedCertificationNumber1', width: 180 },
+        { label: '员工姓名1', prop: 'employeeName1', width: 150 },
+        // { label: '机构名称', prop: 'organizationName', sortable: false },
+        // { label: '数据日期', prop: 'dataDate', width: 105 },
+        // { label: '客户编号', prop: 'customerId', align: 'center', width: 105 },
+        // { label: '一级科目编码/名称', prop: 'oneLevelSubject', width: 180 },
+        // { label: '二级科目编码/名称', prop: 'twoLevelSubject', width: 180 },
+        { label: '总金额', prop: 'residualAmount', align: 'center', width: 150 },
+        { label: '认领比例', prop: 'employeeProfitSharingRatio', align: 'center', width: 150 },
+        // { label: '已分润金额', prop: 'residualAmount', align: 'center', width: 120 },
+        // { label: '已分润比例', prop: 'alreadyDistributedRatio', align: 'center', width: 120 },
+        // { label: '管户层级标识', prop: 'customerLevelIdentifier', width: 140 },
+        // { label: '客户类别标识', prop: 'customerCategoryIdentifier', width: 140 },
+        { label: '统一认证号2', prop: 'unifiedCertificationNumber2' },
+        { label: '员工姓名2', prop: 'employeeName2' },
+        { label: '操作', prop: 'actions', fixed: 'right', width: 180 }
+      ],
       items: [],
       total: 0,
       pageInfo: {
@@ -70,13 +106,13 @@ export default {
         customerLevelIdentifier: null,
         customerCategoryIdentifier: null
       },
-      majorOrganization: false, // 是否是专业机构分润
+      itemData: {},
       maxRatio: 0 // 最大可分润比例
     }
   },
   methods: {
     async open (item) {
-      this.majorOrganization = item.majorOrganization
+      this.itemData = item
       Object.keys(this.searchValues).forEach(key => {
         this.searchValues[key] = item[key]
       })

+ 77 - 61
src/views/salary/claim/sharingClaim/sharingClaimDetailsClaim.vue

@@ -1,17 +1,14 @@
 <template>
   <m-dialog title="分润认领" ref="dialog" append-to-body @sure="onSure">
+
     <m-form :items="formItems" v-model="formValues" v-loading="loading" label-width="140px">
-      <template #customerId>
-        <el-tag>{{ formValues.customerId }}</el-tag>
-      </template>
-      <template #organizationName>
-        <el-tag>{{ formValues.organizationName }}</el-tag>
-      </template>
-      <template #amount>
-        <el-tag>{{ formValues.amount }} %</el-tag>
-      </template>
-      <template #nowRatio>
-        <el-tag>{{ nowRatio }} %</el-tag>
+      <template #msg>
+        <el-descriptions :column="2" border>
+          <el-descriptions-item label="客户编号">{{ formValues.customerId }}</el-descriptions-item>
+          <el-descriptions-item label="机构名称">{{ formValues.organizationName }}</el-descriptions-item>
+          <el-descriptions-item label="总金额">{{ formValues.residualAmount }}</el-descriptions-item>
+          <el-descriptions-item label="当前已分配">{{ count }}</el-descriptions-item>
+        </el-descriptions>
       </template>
       <template #sharing>
         <el-form ref="form" :model="formQuery">
@@ -26,28 +23,46 @@
                 :prop="`items.${scope.$index}.unifiedCertificationNumber`"
                 :rules="{ required: true, message: '请选择员工', trigger: 'change' }"
               >
-                <el-select v-model="scope.row.unifiedCertificationNumber" filterable placeholder="请选择员工">
+                <el-cascader
+                  v-model="scope.row.unifiedCertificationNumber"
+                  placeholder="请选择员工"
+                  filterable
+                  :options="employeeItems"
+                  :props="{
+                    emitPath: false,
+                    value: 'id',
+                    label: 'title',
+                    children: 'child'
+                  }"
+                ></el-cascader>
+                <!-- <el-select v-model="scope.row.unifiedCertificationNumber" filterable placeholder="请选择员工">
                   <el-option
                     v-for="item in employeeItems"
                     :key="item.personnelCode"
                     :label="item.employeeName"
                     :value="item.personnelCode">
                   </el-option>
-                </el-select>
+                </el-select> -->
               </el-form-item>
             </template>
-            <template #employeeProfitSharingRatio="scope">
+            <template #amount="scope">
               <el-form-item
-                :prop="`items.${scope.$index}.employeeProfitSharingRatio`"
+                :prop="`items.${scope.$index}.amount`"
                 :rules="employeeProfitSharingRatioRules"
               >
-                <el-input v-model="scope.row.employeeProfitSharingRatio" placeholder="请输入分配比例">
-                  <template #append>
+                <el-input v-model="scope.row.amount" placeholder="请输入分配金额">
+                  <!-- <template #append>
                     %
-                  </template>
+                  </template> -->
                 </el-input>
               </el-form-item>
             </template>
+            <template #actions="{ $index }">
+              <m-button v-if="formQuery.items.length > 1" type="danger" text size="small" @click="removeItem($index)">移除</m-button>
+            </template>
+            <!-- <template #employeeProfitSharingRatio="{ row }">
+              <el-tag>{{ row.employeeProfitSharingRatio }} %</el-tag>
+            </template> -->
             <div class="d-flex justify-center pa-3">
               <m-button size="small" type="orange" icon="el-icon-plus" @click="addItem">新增一个分润</m-button>
             </div>
@@ -59,13 +74,13 @@
 </template>
 
 <script>
-import { getRosterList } from '@/api/system'
+import { getOrganizationAtlasAll } from '@/api/system'
 import {
   claimPerformanceMore
 } from '@/api/salary'
 const defaultItem = {
-  unifiedCertificationNumber: null,
-  employeeProfitSharingRatio: null
+  unifiedCertificationNumber: null
+  // employeeProfitSharingRatio: null
 }
 export default {
   name: 'sharingClaimDetailsClaim',
@@ -79,24 +94,14 @@ export default {
       },
       headers: [
         { label: '员工姓名', prop: 'unifiedCertificationNumber' },
-        { label: '分润比例 ( % )', prop: 'employeeProfitSharingRatio' }
+        { label: '分润金额', prop: 'amount' },
+        { label: '操作', prop: 'actions' }
+        // { label: '分润占比', prop: 'employeeProfitSharingRatio' }
       ],
       formItems: [
         {
-          label: '客户编号',
-          prop: 'customerId'
-        },
-        {
-          label: '机构名称',
-          prop: 'organizationName'
-        },
-        {
-          label: '总金额',
-          prop: 'amount'
-        },
-        {
-          label: '当前已分配',
-          prop: 'nowRatio'
+          label: '分润信息',
+          prop: 'msg'
         },
         {
           label: '分润',
@@ -107,16 +112,12 @@ export default {
         {
           validator: (rule, value, callback) => {
             if (!value) {
-              return callback(new Error('请输入分润比例'))
+              return callback(new Error('请输入分润金额'))
             }
             if (isNaN(value) || isNaN(parseFloat(value))) {
               callback(new Error('请输入数字值'))
             } else {
-              if (value > 100 || value < 0) {
-                callback(new Error('请输入0-100的数字值'))
-              } else {
-                callback()
-              }
+              callback()
             }
           },
           trigger: ['blur', 'change']
@@ -125,38 +126,30 @@ export default {
     }
   },
   computed: {
-    nowRatio () {
+    count () {
       return this.formQuery.items.reduce((sum, e) => {
-        return sum + +(e.employeeProfitSharingRatio || 0)
+        return sum + +(e.amount || 0)
       }, 0)
     }
   },
   methods: {
     open (item) {
-      console.log(item)
       this.formValues = {
         organizationName: item.organizationName,
         customerId: item.customerId,
         serialNumber: item.serialNumber,
-        amount: item.amount
+        residualAmount: item.residualAmount
       }
       this.formQuery.items = [{ ...defaultItem }]
       this.$refs.dialog.open()
-      this.getEmployeeItems(item.organizationNo)
+      this.getEmployeeItems()
+      // this.getEmployeeItems(item.organizationNo)
     },
-    async getEmployeeItems (organizationNo) {
-      if (!organizationNo) {
-        this.employeeItems = []
-        return
-      }
+    async getEmployeeItems () {
       this.loading = true
       try {
-        const params = {
-          organizationNo,
-          page: { current: 1, size: 9999 }
-        }
-        const { data } = await getRosterList(params)
-        this.employeeItems = data.records
+        const { data } = await getOrganizationAtlasAll({ type: 0 })
+        this.employeeItems = [data]
       } catch (error) {
         this.employeeItems = []
         this.$message.error(error)
@@ -164,6 +157,29 @@ export default {
         this.loading = false
       }
     },
+    removeItem (index) {
+      this.formQuery.items.splice(index, 1)
+    },
+    // async getEmployeeItems (organizationNo) {
+    //   if (!organizationNo) {
+    //     this.employeeItems = []
+    //     return
+    //   }
+    //   this.loading = true
+    //   try {
+    //     const params = {
+    //       organizationNo,
+    //       page: { current: 1, size: 9999 }
+    //     }
+    //     const { data } = await getRosterList(params)
+    //     this.employeeItems = data.records
+    //   } catch (error) {
+    //     this.employeeItems = []
+    //     this.$message.error(error)
+    //   } finally {
+    //     this.loading = false
+    //   }
+    // },
     addItem () {
       this.formQuery.items.push({ ...defaultItem })
     },
@@ -173,8 +189,8 @@ export default {
           this.$message.error('请填写完整')
           return
         }
-        if (this.nowRatio > this.formValues.maxRatio) {
-          this.$message.error('分润比例不能超过可分配比例')
+        if (this.count > this.formValues.residualAmount) {
+          this.$message.error('分润金额不能超过可分配金额')
           return
         }
         try {
@@ -183,7 +199,7 @@ export default {
             items: this.formQuery.items.map(e => {
               return {
                 serialNumber: this.formValues.serialNumber,
-                employeeProfitSharingRatio: e.employeeProfitSharingRatio / 100,
+                amount: e.amount,
                 unifiedCertificationNumber: e.unifiedCertificationNumber
               }
             })