优化员工花名册岗位下拉显示,优化缴存比例配置显示,新增艰苦补贴
parent
697608b5bb
commit
965079d252
|
|
@ -0,0 +1,41 @@
|
||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
// 艰苦补贴配置 VO
|
||||||
|
export interface HardshipAllowanceConfVO {
|
||||||
|
id: number // 序号
|
||||||
|
stationName: string // 岗位名称
|
||||||
|
subsidyAmount: number // 补贴金额
|
||||||
|
}
|
||||||
|
|
||||||
|
// 艰苦补贴配置 API
|
||||||
|
export const HardshipAllowanceConfApi = {
|
||||||
|
// 查询艰苦补贴配置分页
|
||||||
|
getHardshipAllowanceConfPage: async (params: any) => {
|
||||||
|
return await request.get({ url: `/salary/hardship-allowance-conf/page`, params })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 查询艰苦补贴配置详情
|
||||||
|
getHardshipAllowanceConf: async (id: number) => {
|
||||||
|
return await request.get({ url: `/salary/hardship-allowance-conf/get?id=` + id })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 新增艰苦补贴配置
|
||||||
|
createHardshipAllowanceConf: async (data: HardshipAllowanceConfVO) => {
|
||||||
|
return await request.post({ url: `/salary/hardship-allowance-conf/create`, data })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 修改艰苦补贴配置
|
||||||
|
updateHardshipAllowanceConf: async (data: HardshipAllowanceConfVO) => {
|
||||||
|
return await request.put({ url: `/salary/hardship-allowance-conf/update`, data })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 删除艰苦补贴配置
|
||||||
|
deleteHardshipAllowanceConf: async (id: number) => {
|
||||||
|
return await request.delete({ url: `/salary/hardship-allowance-conf/delete?id=` + id })
|
||||||
|
},
|
||||||
|
|
||||||
|
// 导出艰苦补贴配置 Excel
|
||||||
|
exportHardshipAllowanceConf: async (params) => {
|
||||||
|
return await request.download({ url: `/salary/hardship-allowance-conf/export-excel`, params })
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
v-for="item in group.options"
|
v-for="item in group.options"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:value="item.value"
|
:value="item.value"
|
||||||
|
:label="`${item.label} (${getSequenceLabel(item.key)})`"
|
||||||
>
|
>
|
||||||
<span class="custom-option">
|
<span class="custom-option">
|
||||||
<span class="label">{{ item.label }}({{ getSequenceLabel(item.key) }})</span>
|
<span class="label">{{ item.label }}({{ getSequenceLabel(item.key) }})</span>
|
||||||
|
|
@ -161,7 +162,6 @@ const open = async (type: string, id?: number) => {
|
||||||
if (id) {
|
if (id) {
|
||||||
formLoading.value = true
|
formLoading.value = true
|
||||||
try {
|
try {
|
||||||
// formData.value = await EmployeeApi.getEmployee(id)
|
|
||||||
const employeeData = await EmployeeApi.getEmployee(id)
|
const employeeData = await EmployeeApi.getEmployee(id)
|
||||||
// 处理 workTime 数组
|
// 处理 workTime 数组
|
||||||
if (Array.isArray(employeeData.workTime)) {
|
if (Array.isArray(employeeData.workTime)) {
|
||||||
|
|
@ -177,17 +177,6 @@ const open = async (type: string, id?: number) => {
|
||||||
defineExpose({open}) // 提供 open 方法,用于打开弹窗
|
defineExpose({open}) // 提供 open 方法,用于打开弹窗
|
||||||
|
|
||||||
// 获取岗位下拉框
|
// 获取岗位下拉框
|
||||||
// const getStationOptions = async () => {
|
|
||||||
// stationOptions.value = (await StationApi.getStationPage({
|
|
||||||
// pageNo: 1,
|
|
||||||
// pageSize: 100
|
|
||||||
// })).list.map((item: StationVO) => {
|
|
||||||
// return {
|
|
||||||
// label: item.stationName,
|
|
||||||
// value: item.stationCode
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
const getStationOptions = async () => {
|
const getStationOptions = async () => {
|
||||||
const response = await StationApi.getStationPage({
|
const response = await StationApi.getStationPage({
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
|
|
@ -221,16 +210,9 @@ const getStationOptions = async () => {
|
||||||
|
|
||||||
/** 根据 professionalSequence 获取序列标签 */
|
/** 根据 professionalSequence 获取序列标签 */
|
||||||
const getSequenceLabel = (sequence: string): string => {
|
const getSequenceLabel = (sequence: string): string => {
|
||||||
switch (sequence) {
|
const dictOptions = getStrDictOptions(DICT_TYPE.ARCB_POSITION_CATEGORY);
|
||||||
case '0':
|
const dictOption = dictOptions.find(option => option.value === sequence);
|
||||||
return '管理序列';
|
return dictOption ? dictOption.label : '未知序列';
|
||||||
case '1':
|
|
||||||
return '专业序列';
|
|
||||||
case '2':
|
|
||||||
return '非领导职务';
|
|
||||||
default:
|
|
||||||
return '未知序列';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const getOrgNo = async () => {
|
const getOrgNo = async () => {
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@
|
||||||
v-for="item in group.options"
|
v-for="item in group.options"
|
||||||
:key="item.value"
|
:key="item.value"
|
||||||
:value="item.value"
|
:value="item.value"
|
||||||
|
:label="`${item.label} (${getSequenceLabel(item.key)})`"
|
||||||
>
|
>
|
||||||
<span class="custom-option">
|
<span class="custom-option">
|
||||||
<span class="label">{{ item.label }}({{ getSequenceLabel(item.key) }})</span>
|
<span class="label">{{ item.label }}({{ getSequenceLabel(item.key) }})</span>
|
||||||
|
|
@ -238,7 +239,6 @@ const getList = async () => {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
try {
|
try {
|
||||||
const data = await EmployeeApi.getEmployeePage(queryParams)
|
const data = await EmployeeApi.getEmployeePage(queryParams)
|
||||||
console.log(data)
|
|
||||||
await getStationOptions()
|
await getStationOptions()
|
||||||
list.value = data.list
|
list.value = data.list
|
||||||
total.value = data.total
|
total.value = data.total
|
||||||
|
|
@ -247,18 +247,6 @@ const getList = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// const getStationOptions = async () => {
|
|
||||||
// stationOptions.value = (await StationApi.getStationPage({
|
|
||||||
// pageNo: 1,
|
|
||||||
// pageSize: 100
|
|
||||||
// })).list.map((item: StationVO) => {
|
|
||||||
// return {
|
|
||||||
// label: item.stationName,
|
|
||||||
// value: item.stationCode
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
|
|
||||||
const getStationOptions = async () => {
|
const getStationOptions = async () => {
|
||||||
const response = await StationApi.getStationPage({
|
const response = await StationApi.getStationPage({
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
|
|
@ -292,22 +280,10 @@ const getStationOptions = async () => {
|
||||||
|
|
||||||
/** 根据 professionalSequence 获取序列标签 */
|
/** 根据 professionalSequence 获取序列标签 */
|
||||||
const getSequenceLabel = (sequence: string): string => {
|
const getSequenceLabel = (sequence: string): string => {
|
||||||
switch (sequence) {
|
const dictOptions = getStrDictOptions(DICT_TYPE.ARCB_POSITION_CATEGORY);
|
||||||
case '0':
|
const dictOption = dictOptions.find(option => option.value === sequence);
|
||||||
return '管理序列';
|
return dictOption ? dictOption.label : '未知序列';
|
||||||
case '1':
|
|
||||||
return '专业序列';
|
|
||||||
case '2':
|
|
||||||
return '非领导职务';
|
|
||||||
default:
|
|
||||||
return '未知序列';
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// const getSequenceLabel = (sequence: string): string => {
|
|
||||||
// const dictOptions = getStrDictOptions(DICT_TYPE.ARCB_POSITION_CATEGORY);
|
|
||||||
// const dictOption = dictOptions.find(option => option.value === sequence);
|
|
||||||
// return dictOption ? dictOption.label : '未知序列';
|
|
||||||
// }
|
|
||||||
|
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
const handleQuery = () => {
|
const handleQuery = () => {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,9 @@
|
||||||
<el-input v-model="formData.expenseName" placeholder="请输入缴存名称" clearable/>
|
<el-input v-model="formData.expenseName" placeholder="请输入缴存名称" clearable/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="缴存比例" prop="expenseProportion">
|
<el-form-item label="缴存比例" prop="expenseProportion">
|
||||||
<el-input v-model="formData.expenseProportion" placeholder="请输入缴存比例" clearable/>
|
<el-input v-model="formData.expenseProportion" placeholder="请输入缴存比例" clearable>
|
||||||
|
<template #append>%</template>
|
||||||
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,11 @@
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="缴存名称" align="center" prop="expenseName"/>
|
<el-table-column label="缴存名称" align="center" prop="expenseName"/>
|
||||||
<el-table-column label="缴存比例" align="center" prop="expenseProportion"/>
|
<el-table-column label="缴存比例" align="center" prop="expenseProportion">
|
||||||
|
<template #default="scope">
|
||||||
|
{{ scope.row.expenseProportion }}%
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column
|
||||||
label="创建时间"
|
label="创建时间"
|
||||||
align="center"
|
align="center"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,180 @@
|
||||||
|
<template>
|
||||||
|
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
||||||
|
<el-form
|
||||||
|
ref="formRef"
|
||||||
|
:model="formData"
|
||||||
|
:rules="formRules"
|
||||||
|
label-width="100px"
|
||||||
|
v-loading="formLoading"
|
||||||
|
>
|
||||||
|
<el-form-item label="岗位" prop="stationName">
|
||||||
|
<el-select v-model="formData.stationName" placeholder="请选择岗位" style="width: 240px">
|
||||||
|
<el-option-group
|
||||||
|
v-for="group in stationOptions"
|
||||||
|
:key="group.label"
|
||||||
|
:label="group.label"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in group.options"
|
||||||
|
:key="item.value"
|
||||||
|
:value="item.value"
|
||||||
|
:label="`${item.label} (${getSequenceLabel(item.key)})`"
|
||||||
|
>
|
||||||
|
<span class="custom-option">
|
||||||
|
<span class="label">{{ item.label }}({{ getSequenceLabel(item.key) }})</span>
|
||||||
|
<span class="according-to-qls">比照区联社: {{ item.accordingToQls }}</span>
|
||||||
|
</span>
|
||||||
|
</el-option>
|
||||||
|
</el-option-group>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="补贴金额" prop="subsidyAmount">
|
||||||
|
<el-input v-model="formData.subsidyAmount" placeholder="请输入补贴金额"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||||
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
|
</template>
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
import {getStrDictOptions, DICT_TYPE} from '@/utils/dict'
|
||||||
|
import {
|
||||||
|
HardshipAllowanceConfApi,
|
||||||
|
HardshipAllowanceConfVO
|
||||||
|
} from '@/api/arcb/salary/hardshipallowanceconf'
|
||||||
|
import {StationApi, StationVO} from '@/api/arcb/salary/station'
|
||||||
|
|
||||||
|
/** 艰苦补贴配置 表单 */
|
||||||
|
defineOptions({name: 'HardshipAllowanceConfForm'})
|
||||||
|
|
||||||
|
const {t} = useI18n() // 国际化
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
|
const dialogTitle = ref('') // 弹窗的标题
|
||||||
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||||
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||||
|
let stationOptions = ref([])
|
||||||
|
const formData = ref({
|
||||||
|
id: undefined,
|
||||||
|
stationName: undefined,
|
||||||
|
subsidyAmount: undefined,
|
||||||
|
})
|
||||||
|
const formRules = reactive({
|
||||||
|
stationName: [{required: true, message: '岗位名称不能为空', trigger: 'blur'}],
|
||||||
|
subsidyAmount: [{required: true, message: '补贴金额不能为空', trigger: 'blur'}],
|
||||||
|
})
|
||||||
|
const formRef = ref() // 表单 Ref
|
||||||
|
|
||||||
|
/** 打开弹窗 */
|
||||||
|
const open = async (type: string, id?: number) => {
|
||||||
|
dialogVisible.value = true
|
||||||
|
dialogTitle.value = t('action.' + type)
|
||||||
|
await getStationOptions()
|
||||||
|
formType.value = type
|
||||||
|
resetForm()
|
||||||
|
// 修改时,设置数据
|
||||||
|
if (id) {
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
formData.value = await HardshipAllowanceConfApi.getHardshipAllowanceConf(id)
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defineExpose({open}) // 提供 open 方法,用于打开弹窗
|
||||||
|
|
||||||
|
// 获取岗位下拉框
|
||||||
|
const getStationOptions = async () => {
|
||||||
|
const response = await StationApi.getStationPage({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 100
|
||||||
|
});
|
||||||
|
const stationList = response.list;
|
||||||
|
|
||||||
|
const groupedStations = stationList.reduce((acc, item: StationVO) => {
|
||||||
|
const group = item.channelHierarchy;
|
||||||
|
if (!acc[group]) {
|
||||||
|
acc[group] = [];
|
||||||
|
}
|
||||||
|
acc[group].push({
|
||||||
|
label: item.stationName,
|
||||||
|
value: item.stationCode,
|
||||||
|
key: item.professionalSequence,
|
||||||
|
accordingToQls: item.accordingToQls
|
||||||
|
});
|
||||||
|
return acc;
|
||||||
|
}, {} as Record<string, { label: string, value: string, key: string, accordingToQls: string }[]>);
|
||||||
|
|
||||||
|
stationOptions.value = Object.keys(groupedStations).map(group => ({
|
||||||
|
label: `通道层级: ${group}`,
|
||||||
|
options: groupedStations[group].map(option => ({
|
||||||
|
...option,
|
||||||
|
key: option.key,
|
||||||
|
accordingToQls: option.accordingToQls
|
||||||
|
}))
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 根据 professionalSequence 获取序列标签 */
|
||||||
|
const getSequenceLabel = (sequence: string): string => {
|
||||||
|
const dictOptions = getStrDictOptions(DICT_TYPE.ARCB_POSITION_CATEGORY);
|
||||||
|
const dictOption = dictOptions.find(option => option.value === sequence);
|
||||||
|
return dictOption ? dictOption.label : '未知序列';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 提交表单 */
|
||||||
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||||
|
const submitForm = async () => {
|
||||||
|
// 校验表单
|
||||||
|
await formRef.value.validate()
|
||||||
|
// 提交请求
|
||||||
|
formLoading.value = true
|
||||||
|
try {
|
||||||
|
const data = formData.value as unknown as HardshipAllowanceConfVO
|
||||||
|
if (formType.value === 'create') {
|
||||||
|
await HardshipAllowanceConfApi.createHardshipAllowanceConf(data)
|
||||||
|
message.success(t('common.createSuccess'))
|
||||||
|
} else {
|
||||||
|
await HardshipAllowanceConfApi.updateHardshipAllowanceConf(data)
|
||||||
|
message.success(t('common.updateSuccess'))
|
||||||
|
}
|
||||||
|
dialogVisible.value = false
|
||||||
|
// 发送操作成功的事件
|
||||||
|
emit('success')
|
||||||
|
} finally {
|
||||||
|
formLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置表单 */
|
||||||
|
const resetForm = () => {
|
||||||
|
formData.value = {
|
||||||
|
id: undefined,
|
||||||
|
stationName: undefined,
|
||||||
|
subsidyAmount: undefined,
|
||||||
|
}
|
||||||
|
formRef.value?.resetFields()
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style scoped>.custom-option {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
white-space: normal;
|
||||||
|
word-break: break-all;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.according-to-qls {
|
||||||
|
margin-left: auto;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,281 @@
|
||||||
|
<template>
|
||||||
|
<ContentWrap>
|
||||||
|
<!-- 搜索工作栏 -->
|
||||||
|
<el-form
|
||||||
|
class="-mb-15px"
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryFormRef"
|
||||||
|
:inline="true"
|
||||||
|
label-width="68px"
|
||||||
|
>
|
||||||
|
<el-form-item label="岗位名称" prop="stationName">
|
||||||
|
<el-select v-model="queryParams.stationName" placeholder="请选择岗位" style="width: 240px">
|
||||||
|
<el-option-group
|
||||||
|
v-for="group in stationOptions"
|
||||||
|
:key="group.label"
|
||||||
|
:label="group.label"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in group.options"
|
||||||
|
:key="item.value"
|
||||||
|
:value="item.value"
|
||||||
|
:label="`${item.label} (${getSequenceLabel(item.key)})`"
|
||||||
|
>
|
||||||
|
<span class="custom-option">
|
||||||
|
<span class="label">{{ item.label }}({{ getSequenceLabel(item.key) }})</span>
|
||||||
|
<span class="according-to-qls">比照区联社: {{ item.accordingToQls }}</span>
|
||||||
|
</span>
|
||||||
|
</el-option>
|
||||||
|
</el-option-group>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="补贴金额" prop="subsidyAmount">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.subsidyAmount"
|
||||||
|
placeholder="请输入补贴金额"
|
||||||
|
clearable
|
||||||
|
@keyup.enter="handleQuery"
|
||||||
|
class="!w-240px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="创建时间" prop="createTime">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="queryParams.createTime"
|
||||||
|
value-format="YYYY-MM-DD HH:mm:ss"
|
||||||
|
type="daterange"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||||
|
class="!w-220px"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||||
|
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
@click="openForm('create')"
|
||||||
|
v-hasPermi="['salary:hardship-allowance-conf:create']"
|
||||||
|
>
|
||||||
|
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
@click="handleExport"
|
||||||
|
:loading="exportLoading"
|
||||||
|
v-hasPermi="['salary:hardship-allowance-conf:export']"
|
||||||
|
>
|
||||||
|
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||||
|
</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
|
<!-- 列表 -->
|
||||||
|
<ContentWrap>
|
||||||
|
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||||
|
<!-- <el-table-column label="序号" align="center" prop="id" />-->
|
||||||
|
<el-table-column label="岗位名称" align="center" prop="stationName" >
|
||||||
|
<template #default="scope">
|
||||||
|
<el-tag
|
||||||
|
v-for="item in stationOptions
|
||||||
|
.flatMap(group => group.options)
|
||||||
|
.filter(option => option.value === scope.row.stationName)"
|
||||||
|
:key="item.value"
|
||||||
|
:type="item.value === scope.row.stationName ? 'primary' : 'info'"
|
||||||
|
>
|
||||||
|
{{ item.label }}({{ getSequenceLabel(item.key) }})(比照区联社:{{item.accordingToQls}})
|
||||||
|
</el-tag>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="补贴金额" align="center" prop="subsidyAmount" />
|
||||||
|
<el-table-column
|
||||||
|
label="创建时间"
|
||||||
|
align="center"
|
||||||
|
prop="createTime"
|
||||||
|
:formatter="dateFormatter"
|
||||||
|
width="180px"
|
||||||
|
/>
|
||||||
|
<el-table-column label="操作" align="center" min-width="120px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="primary"
|
||||||
|
@click="openForm('update', scope.row.id)"
|
||||||
|
v-hasPermi="['salary:hardship-allowance-conf:update']"
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
link
|
||||||
|
type="danger"
|
||||||
|
@click="handleDelete(scope.row.id)"
|
||||||
|
v-hasPermi="['salary:hardship-allowance-conf:delete']"
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
<!-- 分页 -->
|
||||||
|
<Pagination
|
||||||
|
:total="total"
|
||||||
|
v-model:page="queryParams.pageNo"
|
||||||
|
v-model:limit="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
</ContentWrap>
|
||||||
|
|
||||||
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
|
<HardshipAllowanceConfForm ref="formRef" @success="getList" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { dateFormatter } from '@/utils/formatTime'
|
||||||
|
import download from '@/utils/download'
|
||||||
|
import { HardshipAllowanceConfApi, HardshipAllowanceConfVO } from '@/api/arcb/salary/hardshipallowanceconf'
|
||||||
|
import HardshipAllowanceConfForm from './HardshipAllowanceConfForm.vue'
|
||||||
|
import {DICT_TYPE, getStrDictOptions} from "@/utils/dict";
|
||||||
|
import {StationApi, StationVO} from "@/api/arcb/salary/station";
|
||||||
|
|
||||||
|
/** 艰苦补贴配置 列表 */
|
||||||
|
defineOptions({ name: 'HardshipAllowanceConf' })
|
||||||
|
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
|
||||||
|
const loading = ref(true) // 列表的加载中
|
||||||
|
const list = ref<HardshipAllowanceConfVO[]>([]) // 列表的数据
|
||||||
|
const total = ref(0) // 列表的总页数
|
||||||
|
const queryParams = reactive({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
stationName: undefined,
|
||||||
|
subsidyAmount: undefined,
|
||||||
|
createTime: [],
|
||||||
|
})
|
||||||
|
const queryFormRef = ref() // 搜索的表单
|
||||||
|
const exportLoading = ref(false) // 导出的加载中
|
||||||
|
let stationOptions = ref([])
|
||||||
|
|
||||||
|
/** 查询列表 */
|
||||||
|
const getList = async () => {
|
||||||
|
loading.value = true
|
||||||
|
try {
|
||||||
|
const data = await HardshipAllowanceConfApi.getHardshipAllowanceConfPage(queryParams)
|
||||||
|
await getStationOptions()
|
||||||
|
list.value = data.list
|
||||||
|
total.value = data.total
|
||||||
|
} finally {
|
||||||
|
loading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const getStationOptions = async () => {
|
||||||
|
const response = await StationApi.getStationPage({
|
||||||
|
pageNo: 1,
|
||||||
|
pageSize: 100
|
||||||
|
});
|
||||||
|
const stationList = response.list;
|
||||||
|
|
||||||
|
const groupedStations = stationList.reduce((acc, item: StationVO) => {
|
||||||
|
const group = item.channelHierarchy;
|
||||||
|
if (!acc[group]) {
|
||||||
|
acc[group] = [];
|
||||||
|
}
|
||||||
|
acc[group].push({
|
||||||
|
label: item.stationName,
|
||||||
|
value: item.stationCode,
|
||||||
|
key: item.professionalSequence,
|
||||||
|
accordingToQls: item.accordingToQls
|
||||||
|
});
|
||||||
|
return acc;
|
||||||
|
}, {} as Record<string, { label: string, value: string, key: string, accordingToQls: string }[]>);
|
||||||
|
|
||||||
|
stationOptions.value = Object.keys(groupedStations).map(group => ({
|
||||||
|
label: `通道层级: ${group}`,
|
||||||
|
options: groupedStations[group].map(option => ({
|
||||||
|
...option,
|
||||||
|
key: option.key,
|
||||||
|
accordingToQls: option.accordingToQls
|
||||||
|
}))
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
const getSequenceLabel = (sequence: string): string => {
|
||||||
|
const dictOptions = getStrDictOptions(DICT_TYPE.ARCB_POSITION_CATEGORY);
|
||||||
|
const dictOption = dictOptions.find(option => option.value === sequence);
|
||||||
|
return dictOption ? dictOption.label : '未知序列';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
const handleQuery = () => {
|
||||||
|
queryParams.pageNo = 1
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
const resetQuery = () => {
|
||||||
|
queryFormRef.value.resetFields()
|
||||||
|
handleQuery()
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 添加/修改操作 */
|
||||||
|
const formRef = ref()
|
||||||
|
const openForm = (type: string, id?: number) => {
|
||||||
|
formRef.value.open(type, id)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
const handleDelete = async (id: number) => {
|
||||||
|
try {
|
||||||
|
// 删除的二次确认
|
||||||
|
await message.delConfirm()
|
||||||
|
// 发起删除
|
||||||
|
await HardshipAllowanceConfApi.deleteHardshipAllowanceConf(id)
|
||||||
|
message.success(t('common.delSuccess'))
|
||||||
|
// 刷新列表
|
||||||
|
await getList()
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
const handleExport = async () => {
|
||||||
|
try {
|
||||||
|
// 导出的二次确认
|
||||||
|
await message.exportConfirm()
|
||||||
|
// 发起导出
|
||||||
|
exportLoading.value = true
|
||||||
|
const data = await HardshipAllowanceConfApi.exportHardshipAllowanceConf(queryParams)
|
||||||
|
download.excel(data, '艰苦补贴配置.xlsx')
|
||||||
|
} catch {
|
||||||
|
} finally {
|
||||||
|
exportLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 初始化 **/
|
||||||
|
onMounted(() => {
|
||||||
|
getList()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<style scoped>.custom-option {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
white-space: normal;
|
||||||
|
word-break: break-all;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.according-to-qls {
|
||||||
|
margin-left: auto;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
Reference in New Issue