zhengnaiwen_citu hai 4 meses
pai
achega
e6da3847a5

+ 12 - 6
src/components/TabsTemplate/index.vue

@@ -48,12 +48,18 @@ export default {
   },
   methods: {
     onComponentMounted () {
-      // 初始只渲染当前页面
-      if (this.isRender) {
-        return
-      }
-      this.isRender = true
-      this.$refs[this.activeName][0].onInit && this.$refs[this.activeName][0].onInit(this.name)
+      this.$nextTick(() => {
+        if (!this.$refs[this.activeName]) {
+          return
+        }
+
+        // 初始只渲染当前页面
+        if (this.isRender) {
+          return
+        }
+        this.isRender = true
+        this.$refs[this.activeName][0].onInit && this.$refs[this.activeName][0].onInit(this.name)
+      })
     },
     handleClick () {
       this.$router.push(`${this.$route.path}?name=${this.activeName}`)

+ 1 - 1
src/views/bonus/process/network/index.vue

@@ -16,7 +16,7 @@
         {{ row.organization?.organizationCategory }}
       </template>
       <template #status="{ row }">
-        {{ row.status !== 'null' && row.status !=='undefined' ? (row.status ? '已发放' : '发放') : '' }}
+        {{ row.status !== 'null' && row.status !=='undefined' ? (row.status ? '已发放' : '发放') : '' }}
       </template>
       <template #performanceSalaryManageEmployees="{ row }">
         {{ row.performanceSalaryManageEmployees && row.performanceSalaryManageEmployees?.length ? row.performanceSalaryManageEmployees.map(e => e.employeeName).join(',') : '' }}

+ 1 - 1
src/views/bonus/process/subBranch/components/detail.vue

@@ -16,7 +16,7 @@
         {{ row.organization?.organizationCategory }}
       </template>
       <template #status="{ row }">
-        {{ row.status !== 'null' && row.status !=='undefined' ? (row.status ? '已发放' : '发放') : '' }}
+        {{ row.status !== 'null' && row.status !=='undefined' ? (row.status ? '已发放' : '发放') : '' }}
       </template>
       <template #performanceSalaryManageEmployees="{ row }">
         {{ row.performanceSalaryManageEmployees && row.performanceSalaryManageEmployees?.length ? row.performanceSalaryManageEmployees.map(e => e.employeeName).join(',') : '' }}

+ 1 - 1
src/views/bonus/process/subBranch/index.vue

@@ -16,7 +16,7 @@
         {{ row.organization?.organizationCategory }}
       </template>
       <template #status="{ row }">
-        {{ row.status !== 'null' && row.status !=='undefined' ? (row.status ? '已发放' : '发放') : '' }}
+        {{ row.status !== 'null' && row.status !=='undefined' ? (row.status ? '已发放' : '发放') : '' }}
       </template>
       <template #performanceSalaryManageEmployees="{ row }">
         {{ row.performanceSalaryManageEmployees && row.performanceSalaryManageEmployees?.length ? row.performanceSalaryManageEmployees.map(e => e.employeeName).join(',') : '' }}

+ 2 - 18
src/views/salary/claim/sharingClaim/sharingClaimDetails.vue

@@ -41,6 +41,7 @@ import {
   getProfitSharingClaim,
   getClaimRatioMax
 } from '@/api/salary'
+import { HEADERS } from '../utils'
 import SharingClaimDetailsClaim from './sharingClaimDetailsClaim'
 import SharingClaimDetailsClaimByDept from './sharingClaimDetailsClaimByDept.vue'
 export default {
@@ -51,24 +52,7 @@ export default {
   },
   data () {
     return {
-      headers: [
-        { 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: 'amount', align: 'center', width: 105 },
-        { label: '认领比例', prop: 'employeeProfitSharingRatio', align: 'center', width: 105 },
-        { label: '分润金额', prop: 'residualAmount', align: 'center', width: 105 },
-        { label: '分润比例', prop: 'alreadyDistributedRatio', align: 'center', width: 105 },
-        { label: '管户层级标识', prop: 'customerLevelIdentifier', width: 140 },
-        { label: '客户类别标识', prop: 'customerCategoryIdentifier', width: 140 },
-        { label: '统一认证号1', prop: 'unifiedCertificationNumber1', width: 150 },
-        { label: '员工姓名1', prop: 'employeeName1', width: 120 },
-        { label: '统一认证号2', prop: 'unifiedCertificationNumber2', width: 150 },
-        { label: '员工姓名2', prop: 'employeeName2', width: 120 },
-        { label: '操作', prop: 'actions', fixed: 'right', width: 180 }
-      ],
+      headers: HEADERS,
       items: [],
       total: 0,
       pageInfo: {

+ 1 - 0
src/views/salary/claim/sharingClaim/sharingClaimDetailsClaimByDept.vue

@@ -135,6 +135,7 @@ export default {
         maxRatio: item.maxRatio - item.alreadyDistributedRatio * 100
       }
       this.formQuery.items = [{ ...defaultItem }]
+      this.$refs.form.clearValidate()
       this.$refs.dialog.open()
       this.getEmployeeItems()
     },

+ 27 - 31
src/views/salary/claim/staff/index.vue

@@ -28,21 +28,19 @@
       </m-table>
     </template>
 
-    <ClaimForm ref="claimFormRef"  @submit="onSubmit" />
+    <StaffForm ref="staffFormRefs"  @success="initPage" />
   </div>
 </template>
 
 <script>
 import { dateFormat } from '@/utils/date'
-import { getCustomerProfitSharingClaim, getCustomerProfitSharingClaimStaffAdd } from '@/api/salary'
-import ClaimForm from '../components/form.vue'
-import {
-  HEADERS
-} from '../utils'
+import { getCustomerProfitSharingClaim, getClaimRatioMax } from '@/api/salary'
+import StaffForm from './staffForm'
+import { HEADERS } from '../utils'
 export default {
   name: 'salaryClaimStaff',
   components: {
-    ClaimForm
+    StaffForm
   },
   data () {
     return {
@@ -93,15 +91,32 @@ export default {
       },
       orders: [],
       loading: false,
-      cardTitle: null
+      cardTitle: null,
+      maxRatio: 0
     }
   },
   methods: {
+    async onInit (cardTitle) {
+      this.cardTitle = cardTitle
+      this.customerIdModel = null
+      this.customerId = null
+      this.searchValues.customerId = null
+    },
     async onSearchCustomer () {
       this.customerId = this.customerIdModel
       this.searchValues.customerId = this.customerIdModel
+      this.loading = true
+      await this.getRatioMax()
       this.initPage()
     },
+    async getRatioMax () {
+      try {
+        const { data } = await getClaimRatioMax()
+        this.maxRatio = data
+      } catch (error) {
+        this.$message.error(error)
+      }
+    },
     async initPage () {
       this.loading = true
       try {
@@ -120,17 +135,11 @@ export default {
         this.loading = false
       }
     },
-    async onInit (cardTitle) {
-      this.cardTitle = cardTitle
-      this.customerIdModel = null
-      this.customerId = null
-      this.searchValues.customerId = null
-    },
-    // onAdd () {
-    //   this.$refs.templateRefs.open()
-    // },
     onEdit (item) {
-      this.$refs.claimFormRef.open(item, false, true)
+      this.$refs.staffFormRefs.open({
+        ...item,
+        maxRatio: this.maxRatio
+      })
     },
     onSearch () {
       if (!this.searchValues.customerId) return this.$message.warning('请输入要查询的客户编码')
@@ -144,19 +153,6 @@ export default {
     onSortChange (v) {
       this.orders = v
       this.initPage()
-    },
-    async onSubmit (query) {
-      this.$refs.claimFormRef.setLoading(true)
-      try {
-        await getCustomerProfitSharingClaimStaffAdd(query)
-        this.$refs.claimFormRef.close()
-        this.$message.success('操作成功')
-        this.initPage()
-      } catch (error) {
-        this.$message.error(error)
-      } finally {
-        this.$refs.claimFormRef.setLoading(false)
-      }
     }
   }
 }

+ 35 - 84
src/views/salary/claim/components/form.vue → src/views/salary/claim/staff/staffForm.vue

@@ -2,10 +2,16 @@
   <m-dialog title="分润认领" ref="dialog" @sure="onSure">
     <m-form ref="form" :items="formItems" v-model="formValues" v-loading="loading">
       <template #customerId>
-        <el-tag>{{ itemData.customerId }}</el-tag>
+        <el-tag>{{ formValues.customerId }}</el-tag>
       </template>
       <template #employeeProfitSharingRatio>
-        <el-tag>{{ itemData.employeeProfitSharingRatio * 100 }}</el-tag>
+        <el-tag>{{ formValues.employeeProfitSharingRatio * 100 }} %</el-tag>
+      </template>
+      <template #maxRatio>
+        <el-tag>{{ formValues.maxRatio }} %</el-tag>
+      </template>
+      <template #unifiedCertificationNumber>
+        <el-tag>{{ employeeInfo.employeeName }}</el-tag>
       </template>
       <template #[`employeeProfitSharingRatio.append`]>
         %
@@ -17,13 +23,12 @@
 <script>
 import { mapGetters } from 'vuex'
 import { getRosterList } from '@/api/system'
+import { getCustomerProfitSharingClaimStaffAdd } from '@/api/salary'
 export default {
   name: 'ClaimForm',
   data () {
     return {
-      isStaff: false,
       formValues: {},
-      itemData: {},
       filterLoading: false,
       loading: false,
       empList: [],
@@ -33,71 +38,20 @@ export default {
     }
   },
   computed: {
-    ...mapGetters(['organizationTree', 'employeeInfo']),
-    organizationItems () {
-      if (this.organizationTree.length > 0) {
-        return this.organizationTree[0].child
-      }
-      return []
-    },
+    ...mapGetters(['employeeInfo']),
     formItems () {
       return [
         {
           label: '客户编号',
           prop: 'customerId'
-        }, {
-          label: '员工分润比例',
-          prop: 'employeeProfitSharingRatio'
         },
         {
-          label: '所属机构',
-          prop: 'organizationNo',
-          hidden: !this.isDept,
-          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.getEmpData(nodes[0]?.data?.organizationNo)
-            }
-          }
+          label: '分润员工',
+          prop: 'unifiedCertificationNumber'
         },
         {
-          label: '分润员工',
-          prop: 'unifiedCertificationNumber',
-          type: 'select',
-          options: {
-            disabled: this.isStaff,
-            placeholder: '请输入员工姓名',
-            filterable: true,
-            remote: true,
-            labelText: 'employeeName',
-            labelValue: 'personnelCode',
-            valueKey: 'personnelCode',
-            defaultFirstOption: true,
-            loading: this.filterLoading,
-            items: this.empList
-          },
-          rules: [
-            { required: true, message: '请选择分润员工', trigger: 'change' }
-          ]
+          label: '可分润比例',
+          prop: 'maxRatio'
         },
         {
           label: '分润比例(%)',
@@ -152,24 +106,16 @@ export default {
         this.filterLoading = false
       }
     },
-    async open (item, isDept, isStaff, api) {
-      this.submitApi = api
-      this.isStaff = isStaff
-      this.isDept = isDept
+    async open (item) {
       this.loading = true
-      this.itemData = item || {}
       this.$refs.dialog.open()
       this.formValues = {
         serialNumber: item.serialNumber,
         customerId: item.customerId,
-        organizationNo: item.organizationNo,
-        unifiedCertificationNumber: null,
-        employeeProfitSharingRatio: null
-      }
-      if (isStaff) {
-        // 默认获取当前员工所属机构和名称
-        this.formValues.organizationNo = this.employeeInfo.organizationNo
-        this.formValues.unifiedCertificationNumber = this.employeeInfo.personnelCode
+        organizationNo: this.employeeInfo.organizationNo,
+        unifiedCertificationNumber: this.employeeInfo.personnelCode,
+        employeeProfitSharingRatio: null,
+        maxRatio: item.maxRatio - item.alreadyDistributedRatio * 100
       }
       await this.getEmpData(this.formValues.organizationNo)
       this.$nextTick(() => {
@@ -177,22 +123,27 @@ export default {
         this.loading = false
       })
     },
-    close () {
-      this.$refs.dialog.close()
-    },
-    setLoading (val) {
-      this.loading = val
-    },
     onSure () {
       this.$refs.form.validate(async valid => {
         if (!valid) {
           return
         }
-        const { employeeProfitSharingRatio, ...query } = this.formValues
-        this.$emit('submit', {
-          ...query,
-          employeeProfitSharingRatio: employeeProfitSharingRatio / 100
-        })
+        const { employeeProfitSharingRatio, serialNumber, unifiedCertificationNumber } = this.formValues
+        this.loading = true
+        try {
+          await getCustomerProfitSharingClaimStaffAdd({
+            serialNumber,
+            unifiedCertificationNumber,
+            employeeProfitSharingRatio: employeeProfitSharingRatio / 100
+          })
+          this.$refs.dialog.close()
+          this.$message.success('操作成功')
+          this.$emit('success')
+        } catch (error) {
+          this.$message.error(error)
+        } finally {
+          this.loading = false
+        }
       })
     }
   }

+ 7 - 5
src/views/salary/claim/utils/index.js

@@ -1,11 +1,13 @@
 export const HEADERS = [
-  { label: '机构名称', prop: 'organizationName', width: 120, sortable: false },
-  { label: '数据日期', prop: 'dataDate', width: 120 },
-  { label: '客户编号', prop: 'customerId', align: 'center', width: 120 },
+  { 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: 'amount' },
-  { label: '员工分润比例', prop: 'employeeProfitSharingRatio', align: 'center', width: 140 },
+  { label: '认领金额', prop: 'amount', align: 'center', width: 105 },
+  { label: '认领比例', prop: 'employeeProfitSharingRatio', align: 'center', width: 105 },
+  { 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: '统一认证号1', prop: 'unifiedCertificationNumber1', width: 150 },