|
@@ -1,30 +1,32 @@
|
|
<template>
|
|
<template>
|
|
<m-dialog title="分润认领" ref="dialog" @sure="onSure">
|
|
<m-dialog title="分润认领" ref="dialog" @sure="onSure">
|
|
- <m-divider content-position="left">基准分润</m-divider>
|
|
|
|
- <m-form :items="showItemForm" v-model="itemData"></m-form>
|
|
|
|
- <m-divider content-position="left">新增分润认领</m-divider>
|
|
|
|
- <m-form ref="form" :items="formItems" v-model="formValues" v-loading="loading"></m-form>
|
|
|
|
|
|
+ <m-form ref="form" :items="formItems" v-model="formValues" v-loading="loading">
|
|
|
|
+ <template #customerId>
|
|
|
|
+ <el-tag>{{ itemData.customerId }}</el-tag>
|
|
|
|
+ </template>
|
|
|
|
+ <template #employeeProfitSharingRatio>
|
|
|
|
+ <el-tag>{{ itemData.employeeProfitSharingRatio * 100 }}</el-tag>
|
|
|
|
+ </template>
|
|
|
|
+ <template #[`employeeProfitSharingRatio.append`]>
|
|
|
|
+ %
|
|
|
|
+ </template>
|
|
|
|
+ </m-form>
|
|
</m-dialog>
|
|
</m-dialog>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import { mapGetters } from 'vuex'
|
|
import { mapGetters } from 'vuex'
|
|
-import {
|
|
|
|
- getCustomerProfitSharingClaimDeptAdd,
|
|
|
|
- getCustomerProfitSharingClaimStaffAdd,
|
|
|
|
- getCustomerProfitSharingClaimAdd
|
|
|
|
-} from '@/api/salary'
|
|
|
|
|
|
+// import {
|
|
|
|
+// getCustomerProfitSharingClaimDeptAdd,
|
|
|
|
+// getCustomerProfitSharingClaimStaffAdd,
|
|
|
|
+// getCustomerProfitSharingClaimAdd
|
|
|
|
+// } from '@/api/salary'
|
|
import { getRosterList } from '@/api/system'
|
|
import { getRosterList } from '@/api/system'
|
|
export default {
|
|
export default {
|
|
name: 'ClaimForm',
|
|
name: 'ClaimForm',
|
|
- props: {
|
|
|
|
- staff: {
|
|
|
|
- type: Boolean,
|
|
|
|
- default: false
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
|
|
+ isStaff: false,
|
|
formValues: {
|
|
formValues: {
|
|
serialNumber: null,
|
|
serialNumber: null,
|
|
unifiedCertificationNumber: null,
|
|
unifiedCertificationNumber: null,
|
|
@@ -32,30 +34,11 @@ export default {
|
|
employeeProfitSharingRatio: null
|
|
employeeProfitSharingRatio: null
|
|
},
|
|
},
|
|
itemData: {},
|
|
itemData: {},
|
|
- showItemForm: [{
|
|
|
|
- label: '客户编号',
|
|
|
|
- prop: 'customerId',
|
|
|
|
- type: 'select',
|
|
|
|
- items: [],
|
|
|
|
- options: {
|
|
|
|
- filterable: true,
|
|
|
|
- remote: true,
|
|
|
|
- disabled: true
|
|
|
|
- }
|
|
|
|
- }, {
|
|
|
|
- label: '员工分润比例',
|
|
|
|
- prop: 'ratioShow',
|
|
|
|
- type: 'select',
|
|
|
|
- options: {
|
|
|
|
- filterable: true,
|
|
|
|
- remote: true,
|
|
|
|
- disabled: true
|
|
|
|
- }
|
|
|
|
- }],
|
|
|
|
filterLoading: false,
|
|
filterLoading: false,
|
|
loading: false,
|
|
loading: false,
|
|
empList: [],
|
|
empList: [],
|
|
- items: []
|
|
|
|
|
|
+ items: [],
|
|
|
|
+ submitApi: null
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -68,9 +51,17 @@ export default {
|
|
},
|
|
},
|
|
formItems () {
|
|
formItems () {
|
|
return [
|
|
return [
|
|
|
|
+ {
|
|
|
|
+ label: '客户编号',
|
|
|
|
+ prop: 'customerId'
|
|
|
|
+ }, {
|
|
|
|
+ label: '员工分润比例',
|
|
|
|
+ prop: 'employeeProfitSharingRatio'
|
|
|
|
+ },
|
|
{
|
|
{
|
|
label: '所属机构',
|
|
label: '所属机构',
|
|
prop: 'organizationNo',
|
|
prop: 'organizationNo',
|
|
|
|
+ hidden: !this.isStaff,
|
|
type: 'cascader',
|
|
type: 'cascader',
|
|
rules: [
|
|
rules: [
|
|
{ required: true, message: '请选择所属机构', trigger: 'change' }
|
|
{ required: true, message: '请选择所属机构', trigger: 'change' }
|
|
@@ -93,7 +84,7 @@ export default {
|
|
handles: {
|
|
handles: {
|
|
change: (v) => {
|
|
change: (v) => {
|
|
const nodes = this.$refs.form.$refs.organizationNo.getCheckedNodes()
|
|
const nodes = this.$refs.form.$refs.organizationNo.getCheckedNodes()
|
|
- this.getEmpData(nodes[0]?.data?.organizationNo, nodes[0]?.data?.organizationCategory)
|
|
|
|
|
|
+ this.getEmpData(nodes[0]?.data?.organizationNo)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -102,7 +93,7 @@ export default {
|
|
prop: 'unifiedCertificationNumber',
|
|
prop: 'unifiedCertificationNumber',
|
|
type: 'select',
|
|
type: 'select',
|
|
options: {
|
|
options: {
|
|
- placeholder: '请选择分润员工',
|
|
|
|
|
|
+ placeholder: '请输入员工姓名',
|
|
filterable: true,
|
|
filterable: true,
|
|
remote: true,
|
|
remote: true,
|
|
labelText: 'employeeName',
|
|
labelText: 'employeeName',
|
|
@@ -119,32 +110,44 @@ export default {
|
|
{
|
|
{
|
|
label: '分润比例',
|
|
label: '分润比例',
|
|
prop: 'employeeProfitSharingRatio',
|
|
prop: 'employeeProfitSharingRatio',
|
|
- type: 'number',
|
|
|
|
|
|
+ type: 'input',
|
|
|
|
+ slots: ['append'],
|
|
options: {
|
|
options: {
|
|
- precision: 0,
|
|
|
|
- min: 1,
|
|
|
|
- max: 100,
|
|
|
|
placeholder: '请输入分润比例'
|
|
placeholder: '请输入分润比例'
|
|
},
|
|
},
|
|
rules: [
|
|
rules: [
|
|
- { required: true, message: '请输入分润比例', trigger: 'blur' }
|
|
|
|
|
|
+ {
|
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
|
+ if (!value) {
|
|
|
|
+ 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()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ trigger: ['blur', 'change']
|
|
|
|
+ }
|
|
]
|
|
]
|
|
}
|
|
}
|
|
]
|
|
]
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- async getEmpData (id, organizationCategory) {
|
|
|
|
- if (!id) {
|
|
|
|
|
|
+ async getEmpData (organizationNo) {
|
|
|
|
+ if (!organizationNo) {
|
|
this.empList = []
|
|
this.empList = []
|
|
return
|
|
return
|
|
}
|
|
}
|
|
try {
|
|
try {
|
|
this.filterLoading = true
|
|
this.filterLoading = true
|
|
- const organizationNoKey = organizationCategory === '支行' ? 'parentOrganizationNo' : 'organizationNo'
|
|
|
|
const params = {
|
|
const params = {
|
|
- // entity: { [organizationNoKey]: id },
|
|
|
|
- [organizationNoKey]: id,
|
|
|
|
|
|
+ organizationNo,
|
|
page: { current: 1, size: 9999 }
|
|
page: { current: 1, size: 9999 }
|
|
}
|
|
}
|
|
const { data } = await getRosterList(params)
|
|
const { data } = await getRosterList(params)
|
|
@@ -156,44 +159,56 @@ export default {
|
|
this.filterLoading = false
|
|
this.filterLoading = false
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- async open (item) {
|
|
|
|
|
|
+ async open (item, isStaff, api) {
|
|
|
|
+ this.submitApi = api
|
|
|
|
+ this.isStaff = isStaff
|
|
this.loading = true
|
|
this.loading = true
|
|
this.itemData = item || {}
|
|
this.itemData = item || {}
|
|
- if (item?.employeeProfitSharingRatio) this.itemData.ratioShow = item.employeeProfitSharingRatio * 100
|
|
|
|
|
|
+ this.$refs.dialog.open()
|
|
this.formValues = {
|
|
this.formValues = {
|
|
serialNumber: item.serialNumber,
|
|
serialNumber: item.serialNumber,
|
|
customerId: item.customerId,
|
|
customerId: item.customerId,
|
|
- organizationNo: null,
|
|
|
|
|
|
+ organizationNo: item.organizationNo,
|
|
unifiedCertificationNumber: null,
|
|
unifiedCertificationNumber: null,
|
|
employeeProfitSharingRatio: null
|
|
employeeProfitSharingRatio: null
|
|
}
|
|
}
|
|
- this.$refs.dialog.open()
|
|
|
|
-
|
|
|
|
|
|
+ await this.getEmpData(item.organizationNo)
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
this.$refs.form.clearValidate()
|
|
this.$refs.form.clearValidate()
|
|
this.loading = false
|
|
this.loading = false
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ close () {
|
|
|
|
+ this.$refs.dialog.close()
|
|
|
|
+ },
|
|
|
|
+ setLoading (val) {
|
|
|
|
+ this.loading = val
|
|
|
|
+ },
|
|
onSure () {
|
|
onSure () {
|
|
this.$refs.form.validate(async valid => {
|
|
this.$refs.form.validate(async valid => {
|
|
if (!valid) {
|
|
if (!valid) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- this.loading = true
|
|
|
|
- try {
|
|
|
|
- const api = this.itemData?.isDept ? getCustomerProfitSharingClaimDeptAdd : this.staff ? getCustomerProfitSharingClaimStaffAdd : getCustomerProfitSharingClaimAdd
|
|
|
|
- await api({
|
|
|
|
- ...this.formValues,
|
|
|
|
- employeeProfitSharingRatio: this.formValues.employeeProfitSharingRatio / 100
|
|
|
|
- })
|
|
|
|
- this.$refs.dialog.close()
|
|
|
|
- this.$message.success('操作成功')
|
|
|
|
- this.$emit('success')
|
|
|
|
- } catch (error) {
|
|
|
|
- this.$message.error(error)
|
|
|
|
- } finally {
|
|
|
|
- this.loading = false
|
|
|
|
- }
|
|
|
|
|
|
+ const { employeeProfitSharingRatio, ...query } = this.formValues
|
|
|
|
+ this.$emit('submit', {
|
|
|
|
+ ...query,
|
|
|
|
+ employeeProfitSharingRatio: employeeProfitSharingRatio / 100
|
|
|
|
+ })
|
|
|
|
+ // this.loading = true
|
|
|
|
+ // try {
|
|
|
|
+ // // const api = this.itemData?.isDept ? getCustomerProfitSharingClaimDeptAdd : this.isStaff ? getCustomerProfitSharingClaimStaffAdd : getCustomerProfitSharingClaimAdd
|
|
|
|
+ // await this.submitApi({
|
|
|
|
+ // ...this.formValues,
|
|
|
|
+ // employeeProfitSharingRatio: this.formValues.employeeProfitSharingRatio / 100
|
|
|
|
+ // })
|
|
|
|
+ // this.$refs.dialog.close()
|
|
|
|
+ // this.$message.success('操作成功')
|
|
|
|
+ // this.$emit('success')
|
|
|
|
+ // } catch (error) {
|
|
|
|
+ // this.$message.error(error)
|
|
|
|
+ // } finally {
|
|
|
|
+ // this.loading = false
|
|
|
|
+ // }
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|