Browse Source

分润认领

zhengnaiwen_citu 4 months ago
parent
commit
f2bcb934b5

+ 1 - 1
.env.development

@@ -3,7 +3,7 @@ NODE_ENV = 'development'
 
 
 VUE_APP_MODE = 'development'
 VUE_APP_MODE = 'development'
 
 
-# VUE_APP_BASE_API = 'http://[240e:3b4:2f0:f074:b140:2d89:fe86:a6f3]:7654'
+# VUE_APP_BASE_API = 'http://192.168.3.162:7654'
 VUE_APP_BASE_API = '/op/base'
 VUE_APP_BASE_API = '/op/base'
 
 
 VUE_APP_DATA_OPS = 'https://company.citupro.com:18183'
 VUE_APP_DATA_OPS = 'https://company.citupro.com:18183'

+ 5 - 0
src/api/salary.js

@@ -185,3 +185,8 @@ export function getCustomerProfitSharingClaim (data) {
 export function getCustomerProfitSharingClaimStaffAdd (data) {
 export function getCustomerProfitSharingClaimStaffAdd (data) {
   return http.post('/customer/performance/employee/add/claim', data)
   return http.post('/customer/performance/employee/add/claim', data)
 }
 }
+
+// 业绩分润查询当前有的管理机构权限
+export function getAccessOrganization () {
+  return http.post('/customer/performance/current/login/manage/organization')
+}

+ 12 - 10
src/views/salary/claim/components/form.vue

@@ -22,22 +22,18 @@ export default {
   data () {
   data () {
     return {
     return {
       isStaff: false,
       isStaff: false,
-      formValues: {
-        serialNumber: null,
-        unifiedCertificationNumber: null,
-        organizationNo: null,
-        employeeProfitSharingRatio: null
-      },
+      formValues: {},
       itemData: {},
       itemData: {},
       filterLoading: false,
       filterLoading: false,
       loading: false,
       loading: false,
       empList: [],
       empList: [],
       items: [],
       items: [],
+      isDept: false,
       submitApi: null
       submitApi: null
     }
     }
   },
   },
   computed: {
   computed: {
-    ...mapGetters(['organizationTree']),
+    ...mapGetters(['organizationTree', 'employeeInfo']),
     organizationItems () {
     organizationItems () {
       if (this.organizationTree.length > 0) {
       if (this.organizationTree.length > 0) {
         return this.organizationTree[0].child
         return this.organizationTree[0].child
@@ -56,7 +52,7 @@ export default {
         {
         {
           label: '所属机构',
           label: '所属机构',
           prop: 'organizationNo',
           prop: 'organizationNo',
-          hidden: !this.isStaff,
+          hidden: !this.isDept,
           type: 'cascader',
           type: 'cascader',
           rules: [
           rules: [
             { required: true, message: '请选择所属机构', trigger: 'change' }
             { required: true, message: '请选择所属机构', trigger: 'change' }
@@ -155,9 +151,10 @@ export default {
         this.filterLoading = false
         this.filterLoading = false
       }
       }
     },
     },
-    async open (item, isStaff, api) {
+    async open (item, isDept, isStaff, api) {
       this.submitApi = api
       this.submitApi = api
       this.isStaff = isStaff
       this.isStaff = isStaff
+      this.isDept = isDept
       this.loading = true
       this.loading = true
       this.itemData = item || {}
       this.itemData = item || {}
       this.$refs.dialog.open()
       this.$refs.dialog.open()
@@ -168,7 +165,12 @@ export default {
         unifiedCertificationNumber: null,
         unifiedCertificationNumber: null,
         employeeProfitSharingRatio: null
         employeeProfitSharingRatio: null
       }
       }
-      await this.getEmpData(item.organizationNo)
+      if (isStaff) {
+        // 默认获取当前员工所属机构和名称
+        this.formValues.organizationNo = this.employeeInfo.organizationNo
+        this.formValues.unifiedCertificationNumber = this.employeeInfo.personnelCode
+      }
+      await this.getEmpData(this.formValues.organizationNo)
       this.$nextTick(() => {
       this.$nextTick(() => {
         this.$refs.form.clearValidate()
         this.$refs.form.clearValidate()
         this.loading = false
         this.loading = false

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

@@ -1,6 +1,7 @@
 <template>
 <template>
   <div>
   <div>
-    <m-search class="mb-3" :items="searchItems" v-model="searchValues" @search="onSearch"></m-search>
+    <m-empty v-if="!permission.includes('salary:claim:sharingClaim:list')"></m-empty>
+    <m-search v-permission="['salary:claim:sharingClaim:list']" class="mb-3" :items="searchItems" v-model="searchValues" @search="onSearch"></m-search>
     <m-table
     <m-table
       :cardTitle="cardTitle"
       :cardTitle="cardTitle"
       v-loading="loading"
       v-loading="loading"
@@ -11,13 +12,14 @@
       :page-current="pageInfo.current"
       :page-current="pageInfo.current"
       :total="total"
       :total="total"
       @page-change="onPageChange"
       @page-change="onPageChange"
+      @sort-change="onSortChange"
     >
     >
       <template #employeeProfitSharingRatio="{ row }">
       <template #employeeProfitSharingRatio="{ row }">
         {{ row.employeeProfitSharingRatio * 100 + '%' }}
         {{ row.employeeProfitSharingRatio * 100 + '%' }}
       </template>
       </template>
       <template #actions="{ row }">
       <template #actions="{ row }">
-        <m-button type="primary" text @click="onClaim(row, false)" v-permission="['salary:claim:sharingClaim:claim']">分润认领</m-button>
-        <m-button type="primary" text @click="onClaim(row, true)" v-permission="['salary:claim:sharingClaim:allot']">专业部门分配</m-button>
+        <m-button type="primary" text @click="onClaim(row, false)" v-if="!majorOrganization">分润认领</m-button>
+        <m-button type="primary" text @click="onClaim(row, true)" v-if="majorOrganization">专业部门分配</m-button>
       </template>
       </template>
     </m-table>
     </m-table>
 
 
@@ -30,12 +32,14 @@ import { dateFormat } from '@/utils/date'
 import {
 import {
   getProfitSharingClaim,
   getProfitSharingClaim,
   getCustomerProfitSharingClaimDeptAdd,
   getCustomerProfitSharingClaimDeptAdd,
-  getCustomerProfitSharingClaimAdd
+  getCustomerProfitSharingClaimAdd,
+  getAccessOrganization
 } from '@/api/salary'
 } from '@/api/salary'
 import ClaimForm from '../components/form.vue'
 import ClaimForm from '../components/form.vue'
 import {
 import {
   HEADERS
   HEADERS
 } from '../utils'
 } from '../utils'
+import { mapGetters } from 'vuex'
 export default {
 export default {
   name: 'salaryClaimSharing',
   name: 'salaryClaimSharing',
   components: {
   components: {
@@ -43,14 +47,41 @@ export default {
   },
   },
   data () {
   data () {
     return {
     return {
-      searchItems: [
+      searchValues: {
+        manageOrganizationNo: null,
+        subjectName: null,
+        customerId: null,
+        month: dateFormat('YYYY-mm', new Date())
+      },
+      headers: HEADERS,
+      items: [],
+      total: 0,
+      pageInfo: {
+        current: 1,
+        size: 10
+      },
+      orders: [],
+      loading: false,
+      cardTitle: null,
+      isDept: false,
+      organizationItems: [],
+      defaultManageOrganization: {},
+      majorOrganization: false
+    }
+  },
+  computed: {
+    ...mapGetters(['permission']),
+    searchItems () {
+      return [
         {
         {
           label: '机构名称',
           label: '机构名称',
-          prop: 'organizationNo',
+          prop: 'manageOrganizationNo',
           type: 'select',
           type: 'select',
           options: {
           options: {
+            clearable: false,
             placeholder: '请选择机构名称',
             placeholder: '请选择机构名称',
-            items: []
+            items: this.organizationItems,
+            labelValue: 'organizationNo'
           }
           }
         },
         },
         {
         {
@@ -81,22 +112,7 @@ export default {
             placeholder: '请输入科目名称'
             placeholder: '请输入科目名称'
           }
           }
         }
         }
-      ],
-      searchValues: {
-        subjectName: null,
-        customerId: null,
-        month: dateFormat('YYYY-mm', new Date())
-      },
-      headers: HEADERS,
-      items: [],
-      total: 0,
-      pageInfo: {
-        current: 1,
-        size: 10
-      },
-      loading: false,
-      cardTitle: null,
-      isDept: false
+      ]
     }
     }
   },
   },
   methods: {
   methods: {
@@ -104,12 +120,30 @@ export default {
       if (this.cardTitle) {
       if (this.cardTitle) {
         this.cardTitle = cardTitle
         this.cardTitle = cardTitle
       }
       }
+      const data = await this.onGetDeptList()
+      if (!data) {
+        return
+      }
+      this.searchValues.manageOrganizationNo = data[0].organizationNo
+      this.defaultManageOrganization = data[0]
+      this.majorOrganization = data[0].majorOrganization
+      this.getPage()
+    },
+    async getPage () {
+      if (!this.searchValues.manageOrganizationNo) {
+        this.$message.warning('请选择机构')
+        return
+      }
       this.loading = true
       this.loading = true
       try {
       try {
         const { data } = await getProfitSharingClaim({
         const { data } = await getProfitSharingClaim({
-          ...this.pageInfo,
+          page: {
+            ...this.pageInfo,
+            orders: this.orders
+          },
           ...this.searchValues
           ...this.searchValues
         })
         })
+        this.majorOrganization = this.organizationItems.find(e => e.organizationNo === this.searchValues.manageOrganizationNo).majorOrganization
         this.items = data.records
         this.items = data.records
         this.total = data.total
         this.total = data.total
       } catch (error) {
       } catch (error) {
@@ -118,6 +152,23 @@ export default {
         this.loading = false
         this.loading = false
       }
       }
     },
     },
+    async onGetDeptList () {
+      try {
+        const { data } = await getAccessOrganization()
+        if (!data.length) {
+          return
+        }
+        this.organizationItems = data.map(e => {
+          return {
+            ...e,
+            label: `${e.parentOrganizationName} - ${e.organizationName}`
+          }
+        })
+        return data
+      } catch (error) {
+        this.$message.error(error)
+      }
+    },
     onClaim (item, isDept) {
     onClaim (item, isDept) {
       this.isDept = isDept
       this.isDept = isDept
       this.$refs.claimFormRef.open(item, isDept)
       this.$refs.claimFormRef.open(item, isDept)
@@ -129,7 +180,7 @@ export default {
         await submitApi(query)
         await submitApi(query)
         this.$refs.claimFormRef.close()
         this.$refs.claimFormRef.close()
         this.$message.success('操作成功')
         this.$message.success('操作成功')
-        this.onInit()
+        this.getPage()
       } catch (error) {
       } catch (error) {
         this.$message.error(error)
         this.$message.error(error)
       } finally {
       } finally {
@@ -137,12 +188,19 @@ export default {
       }
       }
     },
     },
     onSearch () {
     onSearch () {
+      if (!this.searchValues.manageOrganizationNo) {
+        this.searchValues.manageOrganizationNo = this.defaultManageOrganization.organizationNo
+      }
       this.pageInfo.current = 1
       this.pageInfo.current = 1
-      this.onInit()
+      this.getPage()
     },
     },
     onPageChange (index) {
     onPageChange (index) {
       this.pageInfo.current = index
       this.pageInfo.current = index
-      this.onInit()
+      this.getPage()
+    },
+    onSortChange (v) {
+      this.orders = v
+      this.getPage()
     }
     }
   }
   }
 }
 }

+ 14 - 5
src/views/salary/claim/staff/index.vue

@@ -17,6 +17,7 @@
         :page-current="pageInfo.current"
         :page-current="pageInfo.current"
         :total="total"
         :total="total"
         @page-change="onPageChange"
         @page-change="onPageChange"
+        @sort-change="onSortChange"
       >
       >
         <template #employeeProfitSharingRatio="{ row }">
         <template #employeeProfitSharingRatio="{ row }">
           {{ row.employeeProfitSharingRatio * 100 + '%' }}
           {{ row.employeeProfitSharingRatio * 100 + '%' }}
@@ -90,6 +91,7 @@ export default {
         current: 1,
         current: 1,
         size: 10
         size: 10
       },
       },
+      orders: [],
       loading: false,
       loading: false,
       cardTitle: null
       cardTitle: null
     }
     }
@@ -104,7 +106,10 @@ export default {
       this.loading = true
       this.loading = true
       try {
       try {
         const { data } = await getCustomerProfitSharingClaim({
         const { data } = await getCustomerProfitSharingClaim({
-          ...this.pageInfo,
+          page: {
+            ...this.pageInfo,
+            orders: this.orders
+          },
           ...this.searchValues
           ...this.searchValues
         })
         })
         this.items = data.records
         this.items = data.records
@@ -121,11 +126,11 @@ export default {
       this.customerId = null
       this.customerId = null
       this.searchValues.customerId = null
       this.searchValues.customerId = null
     },
     },
-    onAdd () {
-      this.$refs.templateRefs.open()
-    },
+    // onAdd () {
+    //   this.$refs.templateRefs.open()
+    // },
     onEdit (item) {
     onEdit (item) {
-      this.$refs.claimFormRef.open(item, true)
+      this.$refs.claimFormRef.open(item, true, true)
     },
     },
     onSearch () {
     onSearch () {
       if (!this.searchValues.customerId) return this.$message.warning('请输入要查询的客户编码')
       if (!this.searchValues.customerId) return this.$message.warning('请输入要查询的客户编码')
@@ -136,6 +141,10 @@ export default {
       this.pageInfo.current = index
       this.pageInfo.current = index
       this.initPage()
       this.initPage()
     },
     },
+    onSortChange (v) {
+      this.orders = v
+      this.initPage()
+    },
     async onSubmit (query) {
     async onSubmit (query) {
       this.$refs.claimFormRef.setLoading(true)
       this.$refs.claimFormRef.setLoading(true)
       try {
       try {