<template>
|
<a-modal
|
:title="title"
|
:width="1200"
|
:visible="visible"
|
:confirmLoading="confirmLoading"
|
@ok="handleOk"
|
@cancel="handleCancel">
|
<template slot="footer">
|
<a-popconfirm title="确定放弃编辑?" @confirm="handleCancel" okText="确定" cancelText="取消">
|
<a-button style="margin-right: .8rem">取消</a-button>
|
</a-popconfirm>
|
|
<a-button type="primary" :loading="confirmLoading" @click="handleOk()">
|
保存
|
</a-button>
|
</template>
|
|
<a-spin :spinning="confirmLoading">
|
<a-form-model ref="form" :label-col="labelCol" :wrapper-col="wrapperCol" :model="model" :rules="validatorRules">
|
<!-- 主表单区域 -->
|
<a-row class="form-row" :gutter="16">
|
|
|
<a-col :lg="8">
|
<a-form-model-item label="技术类别" prop="jslb">
|
<j-dict-select-tag disabled v-model="model.jslb" placeholder=""
|
dictCode="bonus_jsfl" />
|
</a-form-model-item>
|
</a-col>
|
|
|
<a-col v-if="showTechType1" :lg="8">
|
<a-form-model-item label="发放进度" prop="ffjd">
|
<j-dict-select-tag @input="changeProgress" v-model="model.ffjd" placeholder="请选择发放进度"
|
dictCode="bonus_ffjd_gx" />
|
</a-form-model-item>
|
</a-col>
|
<a-col v-if="showTechType2" :lg="8">
|
<a-form-model-item label="发放进度" prop="ffjd">
|
<j-dict-select-tag @input="changeProgress" v-model="model.ffjd" placeholder="请选择发放进度"
|
dictCode="bonus_ffjd_gx_2" />
|
</a-form-model-item>
|
</a-col>
|
<a-col v-if="showTechType3" :lg="8">
|
<a-form-model-item label="发放进度" prop="ffjd">
|
<j-dict-select-tag @input="changeProgress" v-model="model.ffjd" placeholder="请选择发放进度"
|
dictCode="bonus_ffjd_gx_3" />
|
</a-form-model-item>
|
</a-col>
|
<a-col v-if="showTechType4" :lg="8">
|
<a-form-model-item label="发放进度" prop="ffjd">
|
<j-dict-select-tag @input="changeProgress" v-model="model.ffjd" placeholder="请选择发放进度"
|
dictCode="bonus_ffjd_gx_4" />
|
</a-form-model-item>
|
</a-col>
|
<a-col :lg="8">
|
<a-form-model-item label="成本系数" prop="tcxs">
|
<a-input disabled v-model="model.tcxs" placeholder="成本系数" />
|
</a-form-model-item>
|
</a-col>
|
<a-col :lg="8">
|
<a-form-model-item label="销售实绩" prop="sale">
|
<a-input-number @change="changeSale" style="width: 200px" :min="1" v-model="model.xse"
|
placeholder="销售实绩" />
|
</a-form-model-item>
|
</a-col>
|
|
|
<a-col :lg="24">
|
<div style="margin-left: 40px;">
|
<p style="color: red">技术研发贡献奖金发放标准、发放期限</p>
|
<p>A类:<label style="color: #00A0E9">发放标准-</label>销售实绩×1.5%×标准成本系数; <label style="color: #00A0E9"> 发放期限-</label>实际销售后的四年。前三年100%,第四年50%
|
</p>
|
<p>B类:<label style="color: #00A0E9">发放标准-</label>销售实绩×1%×标准成本系数; <label style="color: #00A0E9"> 发放期限-</label>实际销售后的三年。前两年100%,第三年50%
|
</p>
|
<p>C类:<label style="color: #00A0E9">发放标准-</label>销售实绩×0.5%×标准成本系数; <label style="color: #00A0E9"> 发放期限-</label>实际销售后的二年。前一年100%,第二年50%
|
</p>
|
<p>D类:<label style="color: #00A0E9">发放标准-</label>销售实绩×0.5%×标准成本系数; <label style="color: #00A0E9"> 发放期限-</label>实际销售后的一年
|
</p>
|
|
</div>
|
<p style="margin-left: 40px;margin-top: 30px">提成额:<label style="color: red">{{model.sfje}}</label></p>
|
|
</a-col>
|
|
</a-row>
|
|
</a-form-model>
|
</a-spin>
|
|
</a-modal>
|
</template>
|
|
<script>
|
import JSelectUserByDepModal from '@/components/jeecgbiz/modal/JSelectUserByDepModal'
|
import { httpAction, getAction, postAction, putAction } from '@/api/manage'
|
|
export default {
|
name: 'HsGxModal',
|
components: {
|
JSelectUserByDepModal
|
},
|
data() {
|
|
return {
|
title: '操作',
|
visible: false,
|
form: this.$form.createForm(this),
|
base: 0,
|
coe: 0.0,
|
part1: 0,
|
part2: 0,
|
part3: 0,
|
part4: 0,
|
model: {},
|
labelCol: {
|
xs: { span: 24 },
|
sm: { span: 5 }
|
},
|
wrapperCol: {
|
xs: { span: 24 },
|
sm: { span: 16 }
|
},
|
confirmLoading: false,
|
validatorRules: {
|
jslb: [
|
{ required: true, message: '技术类别不能为空', trigger: 'blur' }
|
], type: [
|
{ required: true, message: '项目类型不能为空', trigger: 'blur' }
|
],
|
xse: [
|
{ required: true, message: '销售额不能为空', trigger: 'blur' }
|
],
|
tcxs: [
|
{ required: true, message: '提成系数不能为空', trigger: 'blur' }
|
],
|
ffjd: [
|
{ required: true, message: '请选择发放进度', trigger: 'blur' }
|
],
|
|
sfje: [
|
{ required: true, message: '奖金不能为空', trigger: 'blur' }
|
],
|
|
|
},
|
url: {
|
add: '/bon/item/addgx',
|
edit: '/bon/item/editgx',
|
}
|
}
|
},
|
created() {
|
},
|
watch: {},
|
|
mounted() {
|
|
},
|
computed: {
|
showTechType1: function() {
|
return this.model.jslb == 1
|
},
|
showTechType2: function() {
|
return this.model.jslb == 2
|
},
|
showTechType3: function() {
|
return this.model.jslb == 3
|
},
|
showTechType4: function() {
|
return this.model.jslb == 4
|
}
|
},
|
methods: {
|
add() {
|
this.edit({})
|
},
|
edit(record) {
|
|
this.form.resetFields()
|
this.visible = true
|
this.model = Object.assign({}, record)
|
this.$nextTick(() => {
|
if (this.model.id) {
|
let progress = this.model.ffjd
|
//获取每年应该多少系数
|
this.initBase(progress)
|
//根据技术产品类型确定发放标准
|
this.initCoe(this.model.jslb)
|
this.changeSale(this.model.xse)
|
}
|
|
})
|
|
},
|
|
handleCancel() {
|
this.close()
|
},
|
handleOk() {
|
|
let that = this
|
this.$refs.form.validate(valid => {
|
if (valid) {
|
that.confirmLoading = true
|
//add
|
if (!this.model.id) {
|
postAction(this.url.add, that.model).then((res) => {
|
that.confirmLoading = false
|
if (res.success) {
|
that.close()
|
that.$message.success(res.message)
|
that.$emit('ok', res.result)
|
that.close()
|
} else {
|
that.$message.warning(res.message)
|
}
|
}).finally(() => {
|
that.confirmLoading = false
|
|
})
|
|
//edit
|
} else {
|
putAction(this.url.edit, that.model).then((res) => {
|
that.confirmLoading = false
|
if (res.success) {
|
that.close()
|
that.$message.success(res.message)
|
that.$emit('ok', res.result)
|
that.close()
|
} else {
|
that.$message.warning(res.message)
|
}
|
}).finally(() => {
|
that.confirmLoading = false
|
|
})
|
|
}
|
|
}
|
|
})
|
|
},
|
close() {
|
this.$emit('close')
|
this.visible = false
|
},
|
changeSale(e) {
|
if (typeof e != 'number') {
|
return false
|
}
|
|
if (this.base == 0) {
|
this.$message.warning('请先选择发放进度')
|
return false
|
}
|
this.initCoe(this.model.jslb)
|
|
console.info('年基数')
|
console.info(this.base)
|
console.info('类别基数')
|
console.info(this.coe)
|
console.info('定额')
|
console.info(this.model.tcxs)
|
|
this.model.sfje = e * this.base * this.coe * this.model.tcxs / 100
|
|
this.model.sfje = Number(this.model.sfje.toFixed(2))
|
|
},
|
changeProgress(e) {
|
|
this.initBase(e)
|
//当计算后再修改发放进度时(修改系数) 需要重新计算
|
if (this.model.xse > 0) {
|
this.changeSale(this.model.xse)
|
}
|
|
},
|
initBase(e) {
|
/* 4.2.3.3.1 A类新技术产品
|
实际销售后的四年。前三年100%,第四年50%
|
4.2.3.3.2 B类新产品
|
实际销售后的三年。前两年100%,第三年50%
|
4.2.3.3.3 C类新产品
|
实际销售后的二年。前一年100%,第二年50%
|
4.2.3.3.4 D类新产品
|
实际销售后的一年。*/
|
console.info(this.model.jslb)
|
console.info(e)
|
switch (this.model.jslb) {
|
case 1:
|
if (e < 44) {
|
this.base = 1
|
} else {
|
this.base = 0.5
|
}
|
|
break
|
case 2:
|
if (e < 43) {
|
this.base = 1
|
} else if (e == 43) {
|
this.base = 0.5
|
}
|
|
break
|
case 3:
|
if (e == 41) {
|
this.base = 1
|
} else if (e == 42) {
|
this.base = 0.5
|
}
|
|
break
|
case 4:
|
if (e == 41) {
|
this.base = 1
|
}
|
|
break
|
|
}
|
|
},
|
initCoe(value) {
|
if (value == 1) {
|
this.coe = 1.5
|
} else if (value == 2) {
|
this.coe = 1.0
|
} else if (value == 3 || value == 4) this.coe = 0.5
|
|
},
|
handleChangeUserCommon(v) {
|
|
}
|
|
}
|
}
|
</script>
|
|
<style scoped>
|
|
</style>
|