优化员工花名册岗位下拉显示,优化缴存比例配置显示,新增艰苦补贴

pull/653/head
hky 2025-01-06 19:19:44 +08:00
parent 697608b5bb
commit 965079d252
7 changed files with 518 additions and 52 deletions

View File

@ -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 })
},
}

View File

@ -27,6 +27,7 @@
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>
@ -161,7 +162,6 @@ const open = async (type: string, id?: number) => {
if (id) {
formLoading.value = true
try {
// formData.value = await EmployeeApi.getEmployee(id)
const employeeData = await EmployeeApi.getEmployee(id)
// workTime
if (Array.isArray(employeeData.workTime)) {
@ -177,17 +177,6 @@ const open = async (type: string, id?: number) => {
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 response = await StationApi.getStationPage({
pageNo: 1,
@ -221,16 +210,9 @@ const getStationOptions = async () => {
/** 根据 professionalSequence 获取序列标签 */
const getSequenceLabel = (sequence: string): string => {
switch (sequence) {
case '0':
return '管理序列';
case '1':
return '专业序列';
case '2':
return '非领导职务';
default:
return '未知序列';
}
const dictOptions = getStrDictOptions(DICT_TYPE.ARCB_POSITION_CATEGORY);
const dictOption = dictOptions.find(option => option.value === sequence);
return dictOption ? dictOption.label : '未知序列';
}
const getOrgNo = async () => {

View File

@ -37,6 +37,7 @@
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>
@ -238,7 +239,6 @@ const getList = async () => {
loading.value = true
try {
const data = await EmployeeApi.getEmployeePage(queryParams)
console.log(data)
await getStationOptions()
list.value = data.list
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 response = await StationApi.getStationPage({
pageNo: 1,
@ -292,22 +280,10 @@ const getStationOptions = async () => {
/** 根据 professionalSequence 获取序列标签 */
const getSequenceLabel = (sequence: string): string => {
switch (sequence) {
case '0':
return '管理序列';
case '1':
return '专业序列';
case '2':
return '非领导职务';
default:
return '未知序列';
}
const dictOptions = getStrDictOptions(DICT_TYPE.ARCB_POSITION_CATEGORY);
const dictOption = dictOptions.find(option => option.value === sequence);
return dictOption ? dictOption.label : '未知序列';
}
// 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 = () => {

View File

@ -21,7 +21,9 @@
<el-input v-model="formData.expenseName" placeholder="请输入缴存名称" clearable/>
</el-form-item>
<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>
<template #footer>

View File

@ -97,7 +97,11 @@
</template>
</el-table-column>
<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
label="创建时间"
align="center"

View File

@ -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) // 12
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>

View File

@ -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>