feat(奖金管理): 新增奖金池管理功能及相关配置模块
新增奖金池管理功能,包括奖金池列表、新增、修改、删除和详情查看 添加岗位系数配置组件,支持岗位系数的增删改查 实现奖金分配明细组件,支持员工选择、系数配置和金额计算 添加奖金分配和岗位系数配置的API接口 在WmsBonusPoolBo中添加日期格式化注解
This commit is contained in:
44
klp-ui/src/api/wms/bonusConfig.js
Normal file
44
klp-ui/src/api/wms/bonusConfig.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询奖金分配列表
|
||||
export function listBonusConfig(query) {
|
||||
return request({
|
||||
url: '/wms/bonusConfig/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询奖金分配详细
|
||||
export function getBonusConfig(configId) {
|
||||
return request({
|
||||
url: '/wms/bonusConfig/' + configId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增奖金分配
|
||||
export function addBonusConfig(data) {
|
||||
return request({
|
||||
url: '/wms/bonusConfig',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改奖金分配
|
||||
export function updateBonusConfig(data) {
|
||||
return request({
|
||||
url: '/wms/bonusConfig',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除奖金分配
|
||||
export function delBonusConfig(configId) {
|
||||
return request({
|
||||
url: '/wms/bonusConfig/' + configId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
44
klp-ui/src/api/wms/bonusPool.js
Normal file
44
klp-ui/src/api/wms/bonusPool.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询奖金池列表
|
||||
export function listBonusPool(query) {
|
||||
return request({
|
||||
url: '/wms/bonusPool/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询奖金池详细
|
||||
export function getBonusPool(poolId) {
|
||||
return request({
|
||||
url: '/wms/bonusPool/' + poolId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增奖金池
|
||||
export function addBonusPool(data) {
|
||||
return request({
|
||||
url: '/wms/bonusPool',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改奖金池
|
||||
export function updateBonusPool(data) {
|
||||
return request({
|
||||
url: '/wms/bonusPool',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除奖金池
|
||||
export function delBonusPool(poolId) {
|
||||
return request({
|
||||
url: '/wms/bonusPool/' + poolId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
44
klp-ui/src/api/wms/postCoeffConfig.js
Normal file
44
klp-ui/src/api/wms/postCoeffConfig.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询岗位系数配置列表
|
||||
export function listPostCoeffConfig(query) {
|
||||
return request({
|
||||
url: '/wms/postCoeffConfig/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询岗位系数配置详细
|
||||
export function getPostCoeffConfig(configId) {
|
||||
return request({
|
||||
url: '/wms/postCoeffConfig/' + configId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增岗位系数配置
|
||||
export function addPostCoeffConfig(data) {
|
||||
return request({
|
||||
url: '/wms/postCoeffConfig',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改岗位系数配置
|
||||
export function updatePostCoeffConfig(data) {
|
||||
return request({
|
||||
url: '/wms/postCoeffConfig',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除岗位系数配置
|
||||
export function delPostCoeffConfig(configId) {
|
||||
return request({
|
||||
url: '/wms/postCoeffConfig/' + configId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
409
klp-ui/src/views/wms/bonus/components/BonusConfig.vue
Normal file
409
klp-ui/src/views/wms/bonus/components/BonusConfig.vue
Normal file
@@ -0,0 +1,409 @@
|
||||
<template>
|
||||
<div class="bonus-config">
|
||||
<!-- 警告提示 -->
|
||||
<el-alert
|
||||
v-if="adjustCoeffSum !== 0"
|
||||
title="警告"
|
||||
type="warning"
|
||||
:description="`主任加减系数总和为 ${adjustCoeffSum.toFixed(2)},必须为 0`"
|
||||
show-icon
|
||||
style="margin-bottom: 16px"
|
||||
:closable="false"
|
||||
/>
|
||||
|
||||
<el-alert
|
||||
title="提示"
|
||||
type="info"
|
||||
:description="`主任加减系数的最大值为 ${maxAdjustCoeff},最小值为 ${-maxAdjustCoeff}`"
|
||||
show-icon
|
||||
style="margin-bottom: 16px"
|
||||
/>
|
||||
|
||||
<!-- 新增按钮 -->
|
||||
<EmployeeSelector
|
||||
ref="employeeSelector"
|
||||
:multiple="true"
|
||||
@change="handleBatchAdd"
|
||||
title="选择员工"
|
||||
>
|
||||
<el-button
|
||||
icon="el-icon-plus"
|
||||
size="small"
|
||||
slot="trigger"
|
||||
style="margin-bottom: 16px; width: 100%"
|
||||
>
|
||||
点击此处新增更多员工参与奖金分配
|
||||
</el-button>
|
||||
</EmployeeSelector>
|
||||
|
||||
<!-- 可编辑表格 -->
|
||||
<el-table :data="bonusConfigList" v-loading="loading" border style="width: 100%" height="300px">
|
||||
<!-- 员工姓名 -->
|
||||
<el-table-column label="姓名" width="60">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.empName }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 岗位 -->
|
||||
<el-table-column label="岗位" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-select
|
||||
v-model="scope.row.postName"
|
||||
size="small"
|
||||
style="width: 100%"
|
||||
@change="handlePostChange(scope.row)"
|
||||
clearable
|
||||
>
|
||||
<el-option
|
||||
v-for="post in postCoeffList"
|
||||
:key="post.configId"
|
||||
:label="post.postName"
|
||||
:value="post.postName"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 职务系数 -->
|
||||
<el-table-column label="职务系数">
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
v-model="scope.row.dutyCoeff"
|
||||
size="small"
|
||||
style="width: 100%"
|
||||
@blur="handleCellBlur(scope.row, 'dutyCoeff')"
|
||||
@keyup.enter="handleCellBlur(scope.row, 'dutyCoeff')"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 基本系数 -->
|
||||
<el-table-column label="基本系数">
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
v-model="scope.row.baseCoeff"
|
||||
size="small"
|
||||
style="width: 100%"
|
||||
@blur="handleCellBlur(scope.row, 'baseCoeff')"
|
||||
@keyup.enter="handleCellBlur(scope.row, 'baseCoeff')"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 主任加减系数 -->
|
||||
<el-table-column label="主任加减系数">
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
v-model="scope.row.adjustCoeff"
|
||||
:max="maxAdjustCoeff"
|
||||
:min="-maxAdjustCoeff"
|
||||
size="small"
|
||||
style="width: 100%"
|
||||
@blur="handleAdjustCoeffBlur(scope.row)"
|
||||
@keyup.enter="handleAdjustCoeffBlur(scope.row)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 分配基数 -->
|
||||
<el-table-column label="分配基数">
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
v-model="scope.row.allocBase"
|
||||
size="small"
|
||||
style="width: 100%"
|
||||
@blur="handleCellBlur(scope.row, 'allocBase')"
|
||||
@keyup.enter="handleCellBlur(scope.row, 'allocBase')"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 个人总系数 -->
|
||||
<el-table-column label="个人总系数" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ calculatePersonalTotalCoeff(scope.row).toFixed(2) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 分配金额 -->
|
||||
<el-table-column label="分配金额(元)">
|
||||
<template slot-scope="scope">
|
||||
<el-input
|
||||
v-model="scope.row.bonusAmount"
|
||||
size="small"
|
||||
style="width: 100%"
|
||||
disabled
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 备注 -->
|
||||
<el-table-column label="备注" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.remark || '-' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<!-- 操作 -->
|
||||
<el-table-column label="操作" width="100" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
size="small"
|
||||
@click="handleDelete(scope.row)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listBonusConfig, addBonusConfig, updateBonusConfig, delBonusConfig } from "@/api/wms/bonusConfig";
|
||||
import { listPostCoeffConfig } from "@/api/wms/postCoeffConfig";
|
||||
|
||||
import EmployeeSelector from "@/components/EmployeeSelector";
|
||||
|
||||
export default {
|
||||
name: "BonusConfig",
|
||||
components: {
|
||||
EmployeeSelector
|
||||
},
|
||||
props: {
|
||||
poolId: {
|
||||
type: [String, Number],
|
||||
default: null
|
||||
},
|
||||
maxAdjustCoeff: {
|
||||
type: Number,
|
||||
default: 10.0
|
||||
},
|
||||
totalBonus: {
|
||||
type: [String, Number],
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
bonusConfigList: [],
|
||||
originalData: new Map(),
|
||||
postCoeffList: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
adjustCoeffSum() {
|
||||
return this.bonusConfigList.reduce((sum, row) => {
|
||||
return sum + Number(row.adjustCoeff || 0);
|
||||
}, 0);
|
||||
},
|
||||
totalCoeff() {
|
||||
// 计算所有人的总系数 = 职务系数 + 基本系数 + 主任加减系数
|
||||
return this.bonusConfigList.reduce((sum, row) => {
|
||||
return sum + this.calculatePersonalTotalCoeff(row);
|
||||
}, 0);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
poolId: {
|
||||
handler(newVal) {
|
||||
if (newVal) {
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
bonusConfigList: {
|
||||
handler() {
|
||||
this.calculateAllBonusAmount();
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
totalBonus: {
|
||||
handler() {
|
||||
this.calculateAllBonusAmount();
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 处理主任加减系数输入验证
|
||||
handleAdjustCoeffBlur(row) {
|
||||
const original = this.originalData.get(row.configId);
|
||||
const originalValue = original ? Number(original.adjustCoeff || 0) : 0;
|
||||
const currentValue = Number(row.adjustCoeff || 0);
|
||||
|
||||
// 检查绝对值是否超过限制
|
||||
if (Math.abs(currentValue) > this.maxAdjustCoeff) {
|
||||
this.$message.warning(`主任加减系数绝对值不能超过${this.maxAdjustCoeff}`);
|
||||
// 恢复原始值
|
||||
row.adjustCoeff = originalValue;
|
||||
return;
|
||||
}
|
||||
|
||||
// 验证通过,继续保存
|
||||
this.handleCellBlur(row, 'adjustCoeff');
|
||||
},
|
||||
|
||||
|
||||
|
||||
// 根据岗位名称查找岗位系数配置
|
||||
findPostCoeff(postName) {
|
||||
return this.postCoeffList.find(post => post.postName === postName);
|
||||
},
|
||||
// 处理岗位变化,自动填充系数
|
||||
handlePostChange(row) {
|
||||
if (!row.postName) {
|
||||
return;
|
||||
}
|
||||
const postCoeff = this.findPostCoeff(row.postName);
|
||||
if (postCoeff) {
|
||||
row.dutyCoeff = postCoeff.dutyCoeff;
|
||||
row.baseCoeff = postCoeff.baseCoeff;
|
||||
}
|
||||
// 岗位变化后也保存数据
|
||||
this.handleCellBlur(row, 'postName');
|
||||
},
|
||||
// 计算个人总系数
|
||||
calculatePersonalTotalCoeff(row) {
|
||||
const dutyCoeff = Number(row.dutyCoeff || 0);
|
||||
const baseCoeff = Number(row.baseCoeff || 0);
|
||||
const adjustCoeff = Number(row.adjustCoeff || 0);
|
||||
return dutyCoeff + baseCoeff + adjustCoeff;
|
||||
},
|
||||
// 计算所有人的分配金额
|
||||
calculateAllBonusAmount() {
|
||||
if (this.totalCoeff <= 0) {
|
||||
this.bonusConfigList.forEach(row => {
|
||||
row.bonusAmount = 0;
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
this.bonusConfigList.forEach(row => {
|
||||
const personalTotalCoeff = this.calculatePersonalTotalCoeff(row);
|
||||
row.bonusAmount = ((personalTotalCoeff / this.totalCoeff) * Number(this.totalBonus || 0)).toFixed(2);
|
||||
});
|
||||
},
|
||||
getList() {
|
||||
this.loading = true;
|
||||
|
||||
// 并行获取奖金配置和岗位系数列表
|
||||
Promise.all([
|
||||
this.poolId ? listBonusConfig({ poolId: this.poolId }) : Promise.resolve({ rows: [] }),
|
||||
listPostCoeffConfig({})
|
||||
]).then(([bonusResponse, postResponse]) => {
|
||||
this.bonusConfigList = (bonusResponse.rows || []).map(row => ({
|
||||
...row
|
||||
}));
|
||||
this.postCoeffList = postResponse.rows || [];
|
||||
this.originalData.clear();
|
||||
this.bonusConfigList.forEach(row => {
|
||||
this.originalData.set(row.configId, { ...row });
|
||||
});
|
||||
// 获取数据后计算一次分配金额
|
||||
this.calculateAllBonusAmount();
|
||||
this.loading = false;
|
||||
}).catch(() => {
|
||||
this.bonusConfigList = [];
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
refresh() {
|
||||
this.getList();
|
||||
},
|
||||
async handleBatchAdd(employees) {
|
||||
if (!employees || employees.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.loading = true;
|
||||
|
||||
try {
|
||||
// 批量添加员工
|
||||
const addPromises = employees.map(employee => {
|
||||
const postName = employee.jobType || '';
|
||||
// 查找匹配的岗位系数
|
||||
const postCoeff = this.findPostCoeff(postName);
|
||||
|
||||
const newRow = {
|
||||
poolId: this.poolId,
|
||||
empId: employee.infoId,
|
||||
empName: employee.name,
|
||||
postName: postName,
|
||||
dutyCoeff: postCoeff ? postCoeff.dutyCoeff : 0,
|
||||
baseCoeff: postCoeff ? postCoeff.baseCoeff : 0,
|
||||
adjustCoeff: 0,
|
||||
allocBase: 0,
|
||||
remark: ''
|
||||
};
|
||||
return addBonusConfig(newRow);
|
||||
});
|
||||
|
||||
await Promise.all(addPromises);
|
||||
this.$message.success(`成功添加 ${employees.length} 名员工`);
|
||||
|
||||
// 重新获取列表
|
||||
this.getList();
|
||||
} catch (error) {
|
||||
console.error('批量添加失败:', error);
|
||||
this.$message.error('批量添加失败');
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
async handleCellBlur(row, field) {
|
||||
// 只保存变更的字段
|
||||
try {
|
||||
const original = this.originalData.get(row.configId);
|
||||
const hasChanges = original && this.hasChanges(original, row);
|
||||
|
||||
if (hasChanges) {
|
||||
// 创建一个新对象,不包含 bonusAmount 字段
|
||||
const { bonusAmount, ...saveData } = row;
|
||||
await updateBonusConfig(saveData);
|
||||
this.originalData.set(row.configId, { ...row });
|
||||
this.$message.success('更新成功');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('保存失败:', error);
|
||||
// 恢复原始数据
|
||||
const original = this.originalData.get(row.configId);
|
||||
if (original) {
|
||||
row[field] = original[field];
|
||||
}
|
||||
this.$message.error('保存失败');
|
||||
}
|
||||
},
|
||||
hasChanges(original, current) {
|
||||
const numFields = ['dutyCoeff', 'baseCoeff', 'adjustCoeff', 'allocBase'];
|
||||
const strFields = ['postName'];
|
||||
const numChanged = numFields.some(field => Number(original[field] || 0) !== Number(current[field] || 0));
|
||||
const strChanged = strFields.some(field => original[field] !== current[field]);
|
||||
return numChanged || strChanged;
|
||||
},
|
||||
handleDelete(row) {
|
||||
this.$modal.confirm('是否确认删除该员工的奖金分配?').then(() => {
|
||||
delBonusConfig(row.configId).then(() => {
|
||||
const index = this.bonusConfigList.indexOf(row);
|
||||
if (index > -1) {
|
||||
this.bonusConfigList.splice(index, 1);
|
||||
this.originalData.delete(row.configId);
|
||||
}
|
||||
this.$message.success('删除成功');
|
||||
}).catch(() => {
|
||||
this.$message.error('删除失败');
|
||||
});
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.bonus-config {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
187
klp-ui/src/views/wms/bonus/components/PostCoeffConfig.vue
Normal file
187
klp-ui/src/views/wms/bonus/components/PostCoeffConfig.vue
Normal file
@@ -0,0 +1,187 @@
|
||||
<template>
|
||||
<div class="post-coeff-config">
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table :data="postCoeffConfigList" v-loading="loading" border>
|
||||
<el-table-column label="岗位名称" align="center" prop="postName" width="150" />
|
||||
<el-table-column label="职务系数" align="center" prop="dutyCoeff" width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ Number(scope.row.dutyCoeff).toFixed(2) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="基本系数" align="center" prop="baseCoeff" width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ Number(scope.row.baseCoeff).toFixed(2) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" show-overflow-tooltip />
|
||||
<el-table-column label="操作" align="center" width="150" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 新增/修改弹窗 -->
|
||||
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="600px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="岗位名称" prop="postName">
|
||||
<el-input v-model="form.postName" placeholder="请输入岗位名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="职务系数" prop="dutyCoeff">
|
||||
<el-input-number v-model="form.dutyCoeff" :precision="2" :step="0.01" :min="0" placeholder="请输入职务系数" style="width: 100%" />
|
||||
</el-form-item>
|
||||
<el-form-item label="基本系数" prop="baseCoeff">
|
||||
<el-input-number v-model="form.baseCoeff" :precision="2" :step="0.01" :min="0" placeholder="请输入基本系数" style="width: 100%" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注">
|
||||
<el-input type="textarea" v-model="form.remark" placeholder="请输入备注" :rows="4" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
<el-button type="primary" @click="handleSubmit" :loading="submitLoading">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listPostCoeffConfig, getPostCoeffConfig, delPostCoeffConfig, addPostCoeffConfig, updatePostCoeffConfig } from "@/api/wms/postCoeffConfig";
|
||||
|
||||
export default {
|
||||
name: "PostCoeffConfig",
|
||||
props: {
|
||||
show: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
postCoeffConfigList: [],
|
||||
dialogVisible: false,
|
||||
dialogTitle: "",
|
||||
submitLoading: false,
|
||||
form: {},
|
||||
rules: {
|
||||
postName: [
|
||||
{ required: true, message: "岗位名称不能为空", trigger: "blur" }
|
||||
],
|
||||
dutyCoeff: [
|
||||
{ required: true, message: "职务系数不能为空", trigger: "blur" }
|
||||
],
|
||||
baseCoeff: [
|
||||
{ required: true, message: "基本系数不能为空", trigger: "blur" }
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
show: {
|
||||
handler(newVal) {
|
||||
if (newVal) {
|
||||
this.getList();
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listPostCoeffConfig({}).then(response => {
|
||||
this.postCoeffConfigList = response.rows || [];
|
||||
this.loading = false;
|
||||
}).catch(() => {
|
||||
this.postCoeffConfigList = [];
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
handleAdd() {
|
||||
this.resetForm();
|
||||
this.dialogTitle = "新增岗位系数配置";
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
handleUpdate(row) {
|
||||
this.loading = true;
|
||||
getPostCoeffConfig(row.configId).then(response => {
|
||||
this.loading = false;
|
||||
this.form = response.data;
|
||||
this.dialogTitle = "修改岗位系数配置";
|
||||
this.dialogVisible = true;
|
||||
});
|
||||
},
|
||||
handleDelete(row) {
|
||||
this.$modal.confirm('是否确认删除岗位系数配置编号为"' + row.configId + '"的数据项?').then(() => {
|
||||
return delPostCoeffConfig(row.configId);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
this.$emit("refresh");
|
||||
}).catch(() => {});
|
||||
},
|
||||
resetForm() {
|
||||
this.form = {
|
||||
configId: null,
|
||||
postName: null,
|
||||
dutyCoeff: 0,
|
||||
baseCoeff: 0,
|
||||
remark: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
delFlag: null
|
||||
};
|
||||
},
|
||||
handleSubmit() {
|
||||
this.$refs.form.validate(valid => {
|
||||
if (!valid) return;
|
||||
|
||||
this.submitLoading = true;
|
||||
const api = this.form.configId != null ? updatePostCoeffConfig : addPostCoeffConfig;
|
||||
api(this.form).then(() => {
|
||||
this.$modal.msgSuccess(this.form.configId != null ? "修改成功" : "新增成功");
|
||||
this.dialogVisible = false;
|
||||
this.getList();
|
||||
this.$emit("refresh");
|
||||
}).finally(() => {
|
||||
this.submitLoading = false;
|
||||
});
|
||||
});
|
||||
},
|
||||
refresh() {
|
||||
this.getList();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.post-coeff-config {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
278
klp-ui/src/views/wms/bonus/index.vue
Normal file
278
klp-ui/src/views/wms/bonus/index.vue
Normal file
@@ -0,0 +1,278 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 搜索表单 -->
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="60px">
|
||||
<el-form-item label="产线" prop="productionLine">
|
||||
<el-input v-model="queryParams.productionLine" placeholder="请输入产线" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="奖金时间" prop="bonusTime">
|
||||
<el-date-picker v-model="queryParams.bonusTime" type="date" placeholder="选择奖金时间" value-format="yyyy-MM-dd"
|
||||
clearable style="width: 100%" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<!-- 操作按钮 -->
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-setting" size="mini"
|
||||
@click="handlePostCoeffConfig">岗位系数配置</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<!-- 奖金池列表 -->
|
||||
<el-table v-loading="loading" :data="bonusPoolList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="产线" align="center" prop="productionLine" width="150" />
|
||||
<el-table-column label="奖金时间" align="center" prop="bonusTime" width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.bonusTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="总金额(元)" align="center" prop="totalBonus" width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ Number(scope.row.totalBonus).toFixed(2) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" show-overflow-tooltip />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-view" @click="handleDetail(scope.row)">详情</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 分页 -->
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
|
||||
<!-- 新增/修改奖金池对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="产线" prop="productionLine">
|
||||
<el-input v-model="form.productionLine" placeholder="请输入产线" />
|
||||
</el-form-item>
|
||||
<el-form-item label="奖金时间" prop="bonusTime">
|
||||
<el-date-picker v-model="form.bonusTime" type="date" placeholder="选择奖金时间" value-format="yyyy-MM-dd"
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
<el-form-item label="总金额" prop="totalBonus">
|
||||
<el-input-number v-model="form.totalBonus" :precision="2" :step="0.01" :min="0" placeholder="请输入总金额"
|
||||
style="width: 100%" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" :rows="4" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 详情对话框 -->
|
||||
<el-dialog title="奖金池详情" :visible.sync="detailOpen" width="1000px" append-to-body>
|
||||
<el-descriptions :column="2" border style="margin-bottom: 20px">
|
||||
<el-descriptions-item label="产线">{{ bonusPoolDetail.productionLine }}</el-descriptions-item>
|
||||
<el-descriptions-item label="奖金时间">{{ parseTime(bonusPoolDetail.bonusTime, '{y}-{m}-{d}')
|
||||
}}</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">{{ parseTime(bonusPoolDetail.createTime) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="总金额(元)">{{ Number(bonusPoolDetail.totalBonus).toFixed(2) }}</el-descriptions-item>
|
||||
<el-descriptions-item label="备注" :span="2">{{ bonusPoolDetail.remark || '无' }}</el-descriptions-item>
|
||||
|
||||
</el-descriptions>
|
||||
|
||||
<el-divider>奖金分配明细</el-divider>
|
||||
<BonusConfig ref="bonusConfigRef" :pool-id="currentPoolId" :total-bonus="bonusPoolDetail.totalBonus" :max-adjust-coeff="maxAdjustCoeff" />
|
||||
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="detailOpen = false">关 闭</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 岗位系数配置对话框 -->
|
||||
<el-dialog title="岗位系数配置" :visible.sync="postCoeffConfigOpen" width="900px" append-to-body>
|
||||
<PostCoeffConfig ref="postCoeffConfigRef" :show="postCoeffConfigOpen" @refresh="getList" />
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="postCoeffConfigOpen = false">关 闭</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listBonusPool, getBonusPool, delBonusPool, addBonusPool, updateBonusPool } from "@/api/wms/bonusPool";
|
||||
import BonusConfig from "./components/BonusConfig.vue";
|
||||
import PostCoeffConfig from "./components/PostCoeffConfig.vue";
|
||||
import { getConfigKey } from '@/api/system/config'
|
||||
|
||||
export default {
|
||||
name: "Bonus",
|
||||
components: {
|
||||
BonusConfig,
|
||||
PostCoeffConfig
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
detailLoading: false,
|
||||
buttonLoading: false,
|
||||
ids: [],
|
||||
showSearch: true,
|
||||
total: 0,
|
||||
bonusPoolList: [],
|
||||
title: "",
|
||||
open: false,
|
||||
detailOpen: false,
|
||||
currentPoolId: null,
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
productionLine: null,
|
||||
bonusTime: null,
|
||||
},
|
||||
maxAdjustCoeff: 10.0,
|
||||
form: {},
|
||||
bonusPoolDetail: {},
|
||||
rules: {
|
||||
productionLine: [
|
||||
{ required: true, message: "产线不能为空", trigger: "blur" }
|
||||
],
|
||||
bonusTime: [
|
||||
{ required: true, message: "奖金时间不能为空", trigger: "change" }
|
||||
],
|
||||
totalBonus: [
|
||||
{ required: true, message: "总金额不能为空", trigger: "blur" }
|
||||
]
|
||||
},
|
||||
postCoeffConfigOpen: false,
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
this.getMaxAdjustCoeff();
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listBonusPool(this.queryParams).then(response => {
|
||||
this.bonusPoolList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
|
||||
getMaxAdjustCoeff() {
|
||||
getConfigKey('hrm.bonus.maxAdjust').then(res => {
|
||||
this.maxAdjustCoeff = Number(res.msg);
|
||||
})
|
||||
},
|
||||
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
reset() {
|
||||
this.form = {
|
||||
poolId: null,
|
||||
productionLine: null,
|
||||
bonusTime: null,
|
||||
totalBonus: 0,
|
||||
remark: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
delFlag: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.poolId);
|
||||
},
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加奖金池";
|
||||
},
|
||||
handleUpdate(row) {
|
||||
this.loading = true;
|
||||
this.reset();
|
||||
getBonusPool(row.poolId).then(response => {
|
||||
this.loading = false;
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改奖金池";
|
||||
});
|
||||
},
|
||||
handleDetail(row) {
|
||||
this.bonusPoolDetail = row;
|
||||
this.currentPoolId = row.poolId;
|
||||
this.detailOpen = true;
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.bonusConfigRef) {
|
||||
this.$refs.bonusConfigRef.refresh();
|
||||
}
|
||||
});
|
||||
},
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.poolId != null) {
|
||||
updateBonusPool(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addBonusPool(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
handleDelete(row) {
|
||||
this.$modal.confirm('是否确认删除奖金池编号为"' + row.poolId + '"的数据项?').then(() => {
|
||||
return delBonusPool(row.poolId);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => { });
|
||||
},
|
||||
handlePostCoeffConfig() {
|
||||
this.postCoeffConfigOpen = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -8,6 +8,7 @@ import javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* 奖金池业务对象 wms_bonus_pool
|
||||
@@ -33,6 +34,8 @@ public class WmsBonusPoolBo extends BaseEntity {
|
||||
/**
|
||||
* 奖金时间/统计时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date bonusTime;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user