|
@@ -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
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
}
|