优化员工花名册

pull/653/head
hky 2025-01-03 19:31:42 +08:00
parent 635a7891db
commit 697608b5bb
5 changed files with 246 additions and 84 deletions

View File

@ -3,9 +3,11 @@ import request from '@/config/axios'
// 岗位配置 VO // 岗位配置 VO
export interface StationVO { export interface StationVO {
id: number // 唯一标识符 id: number // 唯一标识符
channelHierarchy: string, //通道层级
stationCode: string // 岗位代码 stationCode: string // 岗位代码
stationName: string // 岗位名称 stationName: string // 岗位名称
professionalSequence: string // 岗位序列 professionalSequence: string // 岗位序列
accordingToQls: string // 比照区联社
} }
// 岗位配置 API // 岗位配置 API

View File

@ -17,19 +17,23 @@
<el-input v-model="formData.empNo" placeholder="请输入工号"/> <el-input v-model="formData.empNo" placeholder="请输入工号"/>
</el-form-item> </el-form-item>
<el-form-item label="岗位" prop="station"> <el-form-item label="岗位" prop="station">
<el-select <el-select v-model="formData.station" placeholder="请选择岗位" style="width: 240px">
v-model="formData.station" <el-option-group
placeholder="请选择岗位" v-for="group in stationOptions"
size="large" :key="group.label"
style="width: 240px" :label="group.label"
clearable >
> <el-option
<el-option v-for="item in group.options"
v-for="item in stationOptions" :key="item.value"
:key="item.value" :value="item.value"
:label="item.label" >
:value="item.value" <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-select>
</el-form-item> </el-form-item>
<el-form-item label="银行卡号" prop="bankNo"> <el-form-item label="银行卡号" prop="bankNo">
@ -173,16 +177,60 @@ 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 () => {
stationOptions.value = (await StationApi.getStationPage({ const response = await StationApi.getStationPage({
pageNo: 1, pageNo: 1,
pageSize: 100 pageSize: 100
})).list.map((item: StationVO) => { });
return { const stationList = response.list;
label: item.stationName,
value: item.stationCode 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 => {
switch (sequence) {
case '0':
return '管理序列';
case '1':
return '专业序列';
case '2':
return '非领导职务';
default:
return '未知序列';
}
} }
const getOrgNo = async () => { const getOrgNo = async () => {
@ -238,3 +286,21 @@ const resetForm = () => {
formRef.value?.resetFields() formRef.value?.resetFields()
} }
</script> </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

@ -27,19 +27,23 @@
/> />
</el-form-item> </el-form-item>
<el-form-item label="岗位" prop="station"> <el-form-item label="岗位" prop="station">
<el-select <el-select v-model="queryParams.station" placeholder="请选择岗位" style="width: 240px">
v-model="queryParams.station" <el-option-group
placeholder="请选择岗位" v-for="group in stationOptions"
size="large" :key="group.label"
style="width: 240px" :label="group.label"
clearable >
> <el-option
<el-option v-for="item in group.options"
v-for="item in stationOptions" :key="item.value"
:key="item.value" :value="item.value"
:label="item.label" >
:value="item.value" <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-select>
</el-form-item> </el-form-item>
<el-form-item label="所属机构" prop="orgNo"> <el-form-item label="所属机构" prop="orgNo">
@ -132,11 +136,13 @@
<el-table-column label="岗位" align="center" prop="station"> <el-table-column label="岗位" align="center" prop="station">
<template #default="scope"> <template #default="scope">
<el-tag <el-tag
v-for="item in stationOptions.filter(option => option.value === scope.row.station)" v-for="item in stationOptions
.flatMap(group => group.options)
.filter(option => option.value === scope.row.station)"
:key="item.value" :key="item.value"
:type="item.value === scope.row.station ? 'primary' : 'info'" :type="item.value === scope.row.station ? 'primary' : 'info'"
> >
{{ item.label }} {{ item.label }}({{ getSequenceLabel(item.key) }})(比照区联社:{{item.accordingToQls}})
</el-tag> </el-tag>
</template> </template>
</el-table-column> </el-table-column>
@ -241,18 +247,68 @@ 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 () => {
stationOptions.value = (await StationApi.getStationPage({ const response = await StationApi.getStationPage({
pageNo: 1, pageNo: 1,
pageSize: 100 pageSize: 100
})).list.map((item: StationVO) => { });
return { const stationList = response.list;
label: item.stationName,
value: item.stationCode 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 => {
switch (sequence) {
case '0':
return '管理序列';
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 = () => {
queryParams.pageNo = 1 queryParams.pageNo = 1
@ -310,3 +366,21 @@ onMounted(() => {
getList() getList()
}) })
</script> </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

@ -7,6 +7,9 @@
label-width="100px" label-width="100px"
v-loading="formLoading" v-loading="formLoading"
> >
<el-form-item label="通道层级" prop="channelHierarchy">
<el-input v-model="formData.channelHierarchy" placeholder="请输入通道层级" />
</el-form-item>
<el-form-item label="岗位代码" prop="stationCode"> <el-form-item label="岗位代码" prop="stationCode">
<el-input v-model="formData.stationCode" placeholder="请输入岗位代码" /> <el-input v-model="formData.stationCode" placeholder="请输入岗位代码" />
</el-form-item> </el-form-item>
@ -23,6 +26,9 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="比照区联社" prop="accordingToQls">
<el-input v-model="formData.accordingToQls" placeholder="请输入比照区联社" />
</el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
<el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button> <el-button @click="submitForm" type="primary" :disabled="formLoading"> </el-button>
@ -46,11 +52,16 @@ const formLoading = ref(false) // 表单的加载中1修改时的数据加
const formType = ref('') // create - update - const formType = ref('') // create - update -
const formData = ref({ const formData = ref({
id: undefined, id: undefined,
channelHierarchy: undefined,
stationCode: undefined, stationCode: undefined,
stationName: undefined, stationName: undefined,
professionalSequence: undefined, professionalSequence: undefined,
accordingToQls: undefined
}) })
const formRules = reactive({ const formRules = reactive({
channelHierarchy: [
{ required: true, message: '通道层级不能为空', trigger: 'blur' }
],
stationCode: [ stationCode: [
{ required: true, message: '岗位代码不能为空', trigger: 'blur' } { required: true, message: '岗位代码不能为空', trigger: 'blur' }
], ],
@ -59,6 +70,9 @@ const formRules = reactive({
], ],
professionalSequence: [ professionalSequence: [
{ required: true, message: '岗位序列不能为空', trigger: 'blur' }, { required: true, message: '岗位序列不能为空', trigger: 'blur' },
],
accordingToQls: [
{ required: true, message: '比照区联社不能为空', trigger: 'blur' }
] ]
}) })
const formRef = ref() // Ref const formRef = ref() // Ref
@ -110,9 +124,11 @@ const submitForm = async () => {
const resetForm = () => { const resetForm = () => {
formData.value = { formData.value = {
id: undefined, id: undefined,
channelHierarchy: undefined,
stationCode: undefined, stationCode: undefined,
stationName: undefined, stationName: undefined,
professionalSequence: undefined, professionalSequence: undefined,
accordingToQls: undefined
} }
formRef.value?.resetFields() formRef.value?.resetFields()
} }

View File

@ -93,6 +93,7 @@
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true"> <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="id" />-->
<el-table-column label="岗位代码" align="center" prop="stationCode"/> <el-table-column label="岗位代码" align="center" prop="stationCode"/>
<el-table-column label="通道层级" align="center" prop="channelHierarchy"/>
<el-table-column label="岗位名称" align="center" prop="stationName"/> <el-table-column label="岗位名称" align="center" prop="stationName"/>
<el-table-column label="岗位序列" align="center" prop="professionalSequence"> <el-table-column label="岗位序列" align="center" prop="professionalSequence">
<template #default="scope"> <template #default="scope">
@ -100,6 +101,7 @@
:value="scope.row.professionalSequence"/> :value="scope.row.professionalSequence"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="比照区联社" align="center" prop="accordingToQls"/>
<el-table-column <el-table-column
label="创建时间" label="创建时间"
align="center" align="center"
@ -160,9 +162,11 @@ const total = ref(0) // 列表的总页数
const queryParams = reactive({ const queryParams = reactive({
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
channelHierarchy: undefined,
stationCode: undefined, stationCode: undefined,
stationName: undefined, stationName: undefined,
professionalSequence: undefined, professionalSequence: undefined,
accordingToQls: undefined,
createTime: [], createTime: [],
}) })
const queryFormRef = ref() // const queryFormRef = ref() //