web-retail-admin/src/views/configManage/bonus/fwbt.vue

207 lines
4.6 KiB
Vue
Raw Normal View History

2025-03-23 10:03:12 +08:00
<template>
<div class="page">
<topBar
v-if="topList.length > 0"
:top-list="topList"
2025-03-23 10:03:12 +08:00
:moren="moren"
/>
2025-03-23 10:03:12 +08:00
<div class="main">
<div class="maintable">
<el-table
:data="tableData"
style="width: 100%"
:header-cell-style="{ background: '#EEEEEE' }"
:row-class-name="tableRowClassName"
>
<el-table-column
width="200px"
align="center"
:formatter="checkTypeList"
prop="serviceType"
2025-05-26 10:41:35 +08:00
:label="'服务类型'"
/>
2025-03-23 10:03:12 +08:00
<el-table-column
align="center"
prop="serviceRadio"
2025-05-26 10:41:35 +08:00
:label="'补贴比例' + '(%)'"
2025-03-23 10:03:12 +08:00
>
<template slot-scope="scope">
<el-input
v-model="scope.row.serviceRadio"
2025-03-23 10:03:12 +08:00
clearable
class="theinput"
:disabled="ifupdate"
/>
2025-03-23 10:03:12 +08:00
</template>
</el-table-column>
<el-table-column
align="center"
prop="assessmentType"
label="考核类型"
>
<template slot-scope="scope">
<el-select
v-model="scope.row.assessmentType"
2025-03-23 10:03:12 +08:00
clearable
:disabled="ifupdate"
>
<el-option
v-for="item in ssessmentTypeList"
:key="item.value"
:label="item.label"
:value="item.value"
/>
2025-03-23 10:03:12 +08:00
</el-select>
</template>
</el-table-column>
</el-table>
</div>
</div>
<div class="footer">
<div style="margin: 0 auto">
<el-button class="thebtn btn1" @click="ifupdate = false">{{
2025-05-26 10:41:35 +08:00
'修改'
2025-03-23 10:03:12 +08:00
}}</el-button>
<el-button class="thebtn btn2" @click="savedate">{{
2025-05-26 10:41:35 +08:00
'保存'
2025-03-23 10:03:12 +08:00
}}</el-button>
</div>
</div>
</div>
</template>
<script>
import topBar from '@/components/topBar'
2025-03-23 10:03:12 +08:00
import {
getServiceList,
updateService,
getServiceTypeList,
getAssessmentType
} from '@/api/bonus'
import { mixin } from './mixins'
2025-03-23 10:03:12 +08:00
export default {
name: 'Fwbt',
2025-03-23 10:03:12 +08:00
components: {
topBar
2025-03-23 10:03:12 +08:00
},
mixins: [mixin],
2025-03-23 10:03:12 +08:00
data() {
return {
moren: 'fwbt',
2025-03-23 10:03:12 +08:00
tableData: [
{
name: 'asads',
put: 2
}
2025-03-23 10:03:12 +08:00
],
ifupdate: true,
serviceTypeList: [],
ssessmentTypeList: []
}
2025-03-23 10:03:12 +08:00
},
created() {
this.getServiceList()
this.getServiceTypeList()
2025-03-23 10:03:12 +08:00
},
methods: {
// 获取服务补贴列表
2025-03-23 10:03:12 +08:00
getServiceList() {
getServiceList().then((res) => {
this.tableData = res.rows
})
2025-03-23 10:03:12 +08:00
},
// 获取服务补贴类型枚举列表
2025-03-23 10:03:12 +08:00
getServiceTypeList() {
getServiceTypeList().then((res) => {
this.serviceTypeList = res.data
})
// 考核类型下拉选
2025-03-23 10:03:12 +08:00
getAssessmentType().then((res) => {
this.ssessmentTypeList = res.data
})
2025-03-23 10:03:12 +08:00
},
// 服务补贴类型对应枚举查询
2025-03-23 10:03:12 +08:00
checkTypeList(row) {
let state = ''
2025-03-23 10:03:12 +08:00
this.serviceTypeList.forEach((item) => {
if (item.value == row.serviceType) {
state = item.label
2025-03-23 10:03:12 +08:00
}
})
return state
2025-03-23 10:03:12 +08:00
},
// 保存
2025-03-23 10:03:12 +08:00
savedate() {
this.ifupdate = true
2025-03-23 10:03:12 +08:00
updateService({ bdBonusServiceList: this.tableData }).then((res) => {
if (res.code == 200) {
this.$message({
message: res.msg,
type: 'success'
})
2025-03-23 10:03:12 +08:00
} else {
this.$message({
message: res.msg,
type: 'warning'
})
2025-03-23 10:03:12 +08:00
}
this.getServiceList()
})
2025-03-23 10:03:12 +08:00
},
tableRowClassName({ row, rowIndex }) {
if (rowIndex % 2 == 1) {
return 'warning-row'
2025-03-23 10:03:12 +08:00
} else if (rowIndex % 2 == 0) {
return 'success-row'
2025-03-23 10:03:12 +08:00
}
return ''
}
}
}
2025-03-23 10:03:12 +08:00
</script>
<style lang="scss" scoped>
::v-deep .el-table thead {
color: #000000;
}
::v-deep .el-table .warning-row {
background: #f9f9f9;
}
::v-deep .theinput .el-input__inner {
width: 30% !important;
}
::v-deep .el-table .success-row {
background: #ffffff;
}
.page {
padding: 20px;
background: #f9f9f9;
font-size: 14px;
.main {
background: #ffffff;
border-radius: 8px;
box-shadow: 0px 2px 20px 0px rgba(238, 238, 238, 0.5);
}
.footer {
display: flex;
margin-top: 20px;
.thebtn {
width: 120px;
height: 48px;
color: #ffffff;
font-size: 14px;
font-weight: bold;
}
.btn1 {
background: #4391fd;
margin-right: 80px;
}
.btn2 {
background: #ffad41;
}
}
}
</style>