feat(wms/bonus): 新增奖金模板管理功能,优化奖金池页面

1. 新增奖金模板CRUD API和管理组件
2. 重构奖金池页面:替换产线输入为下拉选择,新增时间范围查询和钢卷重量自动计算
3. 优化岗位系数配置页面,仅查询当前用户创建的配置
4. 重构员工选择器组件,改用穿梭框实现多选逻辑
5. 为奖金分配页面新增模板导入导出功能
This commit is contained in:
2026-05-12 13:44:13 +08:00
parent 778b51fd76
commit 59ace7c186
6 changed files with 1165 additions and 258 deletions

View File

@@ -3,12 +3,9 @@
<!-- 搜索表单 -->
<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-select v-model="queryParams.productionLine" placeholder="请选择产线" clearable>
<el-option v-for="item in productionLineList" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
@@ -25,6 +22,10 @@
<el-button type="warning" plain icon="el-icon-setting" size="mini"
@click="handlePostCoeffConfig">岗位系数配置</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" plain icon="el-icon-document" size="mini"
@click="handleTemplateManagement">模板管理</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@@ -32,10 +33,20 @@
<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">
<!-- <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="bonusStartTime" width="120">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.bonusStartTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="结束时间" align="center" prop="bonusEndTime" width="120">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.bonusEndTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="总金额(元)" align="center" prop="totalBonus" width="120">
<template slot-scope="scope">
@@ -65,14 +76,39 @@
<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="请输入产线" />
<muti-select v-model="form.productionLine" placeholder="请选择产线" clearable filterable
:options="productionLineList">
<el-option v-for="item in productionLineList" :key="item.value" :label="item.label" :value="item.value" />
</muti-select>
</el-form-item>
<el-form-item label="奖金时间" prop="bonusTime">
<el-date-picker v-model="form.bonusTime" type="date" placeholder="选择奖金时间" value-format="yyyy-MM-dd"
<el-form-item label="开始时间" prop="bonusStartTime">
<el-date-picker v-model="form.bonusStartTime" type="date" placeholder="选择开始时间" value-format="yyyy-MM-dd"
style="width: 100%" />
</el-form-item>
<el-form-item label="结束时间" prop="bonusEndTime">
<el-date-picker v-model="form.bonusEndTime" type="date" placeholder="选择结束时间" value-format="yyyy-MM-dd"
style="width: 100%" />
</el-form-item>
<el-form-item label="查询重量">
<el-button type="primary" @click="queryCoilWeight"
:disabled="!form.bonusStartTime || !form.bonusEndTime || !form.productionLine"
:loading="queryLoading">查询钢卷总重量</el-button>
</el-form-item>
<el-form-item label="总重量(吨)">
<el-input v-model="totalWeight" disabled placeholder="请先查询钢卷重量" style="width: 100%" />
</el-form-item>
<el-form-item label="系数" prop="coeff">
<el-input-number v-model="form.coeff" :precision="4" :step="0.0001" :min="0" placeholder="请输入系数"
style="width: 100%" @change="calculateTotalBonus" />
</el-form-item>
<el-form-item label="总金额" prop="totalBonus">
<el-input-number v-model="form.totalBonus" :precision="2" :step="0.01" :min="0" placeholder="请输入总金额"
<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">
@@ -89,17 +125,18 @@
<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="开始时间">{{ parseTime(bonusPoolDetail.bonusStartTime, '{y}-{m}-{d}')
}}</el-descriptions-item>
<el-descriptions-item label="结束时间">{{ parseTime(bonusPoolDetail.bonusEndTime, '{y}-{m}-{d}')
}}</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" />
<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>
@@ -112,6 +149,14 @@
<el-button @click="postCoeffConfigOpen = false"> </el-button>
</div>
</el-dialog>
<!-- 模板管理对话框 -->
<el-dialog title="模板管理" :visible.sync="templateManagementOpen" width="1200px" append-to-body>
<BonusTemplateManagement :show="templateManagementOpen" />
<div slot="footer" class="dialog-footer">
<el-button @click="templateManagementOpen = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
@@ -119,13 +164,17 @@
import { listBonusPool, getBonusPool, delBonusPool, addBonusPool, updateBonusPool } from "@/api/wms/bonusPool";
import BonusConfig from "./components/BonusConfig.vue";
import PostCoeffConfig from "./components/PostCoeffConfig.vue";
import BonusTemplateManagement from "./components/BonusTemplateManagement.vue";
import { getConfigKey } from '@/api/system/config'
import { listPendingAction } from '@/api/wms/pendingAction'
import { getCoilStatisticsList } from "@/api/wms/coil";
export default {
name: "Bonus",
components: {
BonusConfig,
PostCoeffConfig
PostCoeffConfig,
BonusTemplateManagement
},
data() {
return {
@@ -140,11 +189,14 @@ export default {
open: false,
detailOpen: false,
currentPoolId: null,
totalWeight: null,
queryLoading: false,
queryParams: {
pageNum: 1,
pageSize: 10,
productionLine: null,
bonusTime: null,
createBy: this.$store.getters.name,
},
maxAdjustCoeff: 10.0,
form: {},
@@ -156,13 +208,58 @@ export default {
bonusTime: [
{ required: true, message: "奖金时间不能为空", trigger: "change" }
],
bonusStartTime: [
{ required: true, message: "开始时间不能为空", trigger: "change" }
],
bonusEndTime: [
{ required: true, message: "结束时间不能为空", trigger: "change" }
],
totalBonus: [
{ required: true, message: "总金额不能为空", trigger: "blur" }
]
},
postCoeffConfigOpen: false,
productionLineList: [
{
label: '酸轧线',
value: '酸轧线',
actions: '11,200,520'
},
{
label: '镀锌线',
value: '镀锌线',
actions: '206,501,521'
},
{
label: '拉矫线',
value: '拉矫线',
actions: '204,503,523'
},
{
label: '双机架',
value: '双机架',
actions: '205,504,524'
},
{
label: '镀铬线',
value: '镀铬线',
actions: '206,505,525'
},
{
label: '脱脂线',
value: '脱脂线',
actions: '203,502,522'
},
],
templateManagementOpen: false,
};
},
// computed: {
// currentUserName() {
// console.log(this.$store.getters.name, '计算属性');
// return this.$store.getters.name;
// }
// },
created() {
this.getList();
this.getMaxAdjustCoeff();
@@ -176,7 +273,7 @@ export default {
this.loading = false;
});
},
getMaxAdjustCoeff() {
getConfigKey('hrm.bonus.maxAdjust').then(res => {
this.maxAdjustCoeff = Number(res.msg);
@@ -188,20 +285,52 @@ export default {
this.reset();
},
reset() {
this.totalWeight = null;
this.form = {
poolId: null,
productionLine: null,
bonusTime: null,
totalBonus: 0,
remark: null,
createBy: null,
createBy: this.$store.getters.name,
createTime: null,
updateBy: null,
updateTime: null,
delFlag: null
delFlag: null,
coeff: null
};
this.resetForm("form");
},
async queryCoilWeight() {
this.queryLoading = true;
try {
const productionLines = this.form.productionLine.split(',');
// 从productionLineList中获取productionLines对应的actions
const productionLineActions = productionLines.map(line => this.productionLineList.find(item => item.value === line).actions);
const pendingActions = await listPendingAction({
startTime: this.form.bonusStartTime + ' 00:00:00',
endTime: this.form.bonusEndTime + ' 23:59:59',
actionTypes: productionLineActions.join(','),
pageNum: 1,
pageSize: 1000000,
})
const coilIds = pendingActions.rows.map(item => item.processedCoilIds);
const coilStatistics = await getCoilStatisticsList({
coilIds: coilIds.join(','),
})
this.totalWeight = coilStatistics.data.total_net_weight;
this.calculateTotalBonus();
this.queryLoading = false;
} catch (error) {
this.$modal.msgError(error.message);
this.queryLoading = false;
}
},
calculateTotalBonus() {
if (this.totalWeight && this.form.coeff) {
this.form.totalBonus = (this.totalWeight * this.form.coeff).toFixed(2);
}
},
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
@@ -272,6 +401,9 @@ export default {
},
handlePostCoeffConfig() {
this.postCoeffConfigOpen = true;
},
handleTemplateManagement() {
this.templateManagementOpen = true;
}
}
};