jeecgBootUniapp/src/pages-humanResource/absence/index.vue

200 lines
4.9 KiB
Vue
Raw Normal View History

2025-05-20 02:29:29 +00:00
<route lang="json5" type="page">
{
layout: 'default',
style: {
navigationStyle: 'custom',
navigationBarTitleText: '请假信息',
},
}
</route>
2025-05-19 01:52:19 +00:00
<template>
2025-05-20 02:29:29 +00:00
<PageLayout navTitle="请假信息">
2025-05-20 10:45:08 +00:00
<wd-card style="margin-top: 10px;">
<view v-show="!username">
<wd-row>
<wd-col :span="12"><uni-title title="所属单位" align="left" type="h5"></uni-title></wd-col>
<wd-col :span="12"><uni-title title="重置" align="right" type="h5" color="#666666"
@click="reset"></uni-title></wd-col>
</wd-row>
<wd-row>
<wd-col :span="24">
<SelectDept label="" v-model="orgCode" @change="queryLeave" rowKey="orgCode" :multiple="false">
</SelectDept>
</wd-col>
</wd-row>
<wd-row>
<wd-col :span="12"><uni-title title="姓名" align="left" type="h5"></uni-title></wd-col>
<wd-col :span="12"><uni-title title="劳动合同号" align="left" type="h5"></uni-title></wd-col>
</wd-row>
<wd-row>
<wd-col :span="12">
<uni-easyinput v-model="realname" placeholder="姓名模糊查询" @change="queryLeave"
@clear="queryLeave" />
</wd-col>
<wd-col :span="12">
<uni-easyinput v-model="contractNumber" placeholder="劳动合同号查询" @change="queryLeave"
@clear="queryLeave" />
</wd-col>
</wd-row>
</view>
2025-05-20 02:29:29 +00:00
<wd-row>
<wd-col :span="12"><uni-title title="请假时间" align="left" type="h5"></uni-title></wd-col>
2025-05-20 02:29:29 +00:00
<wd-col :span="12"><uni-title title="重置" align="right" type="h5" color="#666666"
@click="reset" v-show="username"></uni-title></wd-col>
2025-05-20 02:29:29 +00:00
</wd-row>
<wd-row>
<wd-col :span="24">
<uni-datetime-picker v-model="range" type="daterange" rangeSeparator="至" @input="queryLeave" />
</wd-col>
</wd-row>
<l-echart ref="chart" />
</wd-card>
2025-05-20 10:45:08 +00:00
<view v-for="(item, i) in list" :key="i" @click="jump(`./detail?id=${item.id}`)">
2025-05-20 02:29:29 +00:00
<wd-card :title="item.username_dictText+'的'+item.type+'申请'">
<view class="card-content">
<view class="meta-info">
<wd-icon name="usergroup" size="14px" color="#999"></wd-icon>
<text class="meta-text">{{item.sysOrgCode_dictText}}</text>
<wd-icon name="time" size="14px" color="#999" style="margin-left: auto;"></wd-icon>
<text class="meta-text">
{{item.begintime}}{{item.endtime}}</text>
</view>
</view>
</wd-card>
</view>
</PageLayout>
2025-05-19 01:52:19 +00:00
</template>
2025-05-20 02:29:29 +00:00
<script setup>
import {
listApi,
countByOrgApi
} from '@/api/humanResource/absence'
import * as echarts from 'echarts';
2025-05-20 10:45:08 +00:00
import SelectDept from '@/components/SelectDept/SelectDept'
2025-05-20 02:29:29 +00:00
const chart = ref(null);
const chartOption = ref({});
const list = ref([]) //请假信息列表
const realname = ref('') //姓名查询
const contractNumber = ref('') //劳动合同号查询
2025-05-22 07:30:36 +00:00
const orgCode = ref('') //单位查询
2025-05-20 02:29:29 +00:00
const type = ref('') //图表点击事件 请假类别
const range = ref([]) //日期查询
const timeout = ref(null)
const username = ref('') //用户名
2025-05-20 02:29:29 +00:00
let pageNo = 1
let pageSize = 10
let loading = false
const queryLeave = (e) => {
let param = {
2025-05-20 10:45:08 +00:00
sysOrgCode: orgCode.value,
2025-05-20 02:29:29 +00:00
begin: range.value[0],
end: range.value[1],
type: type.value,
username: username.value,
2025-05-20 02:29:29 +00:00
realname: realname.value,
contractNumbers: contractNumber.value
}
if (e == 1) { // 下拉刷新时pageNo++
pageNo++;
} else { // list置空pageNo置1
list.value = [];
pageNo = 1;
if (e != 2) {
// 如果不是图表点击事件,更新图表
setChartOption(param);
}
}
// 更新数据
getList(param);
}
const getList = (params = {}) => {
setChartOption(params)
loading = true
listApi({
...params,
pageNo,
pageSize
}).then((res) => {
if (res.success) {
list.value = [...list.value, ...res.result.records]
}
loading = false
}).catch((err) => {})
}
const setChartOption = (e) => {
countByOrgApi(e).then(res => {
chartOption.value = {
tooltip: {
trigger: 'item'
},
series: [{
type: 'pie',
radius: '50%',
data: res.result
}]
}
initChart()
})
}
// 初始化图表
const initChart = () => {
setTimeout(async () => {
if (!chart.value) return;
const myChart = await chart.value.init(echarts);
myChart.setOption(chartOption.value);
myChart.on('click', (params) => {
// 根据 params 处理点击事件
type.value = params.name
queryLeave(2);
});
}, 300);
};
2025-05-19 01:52:19 +00:00
2025-05-20 02:29:29 +00:00
function reset() {
2025-05-20 10:45:08 +00:00
orgCode.value = ''
2025-05-20 02:29:29 +00:00
range.value = []
type.value = ''
realname.value = ''
contractNumber.value = ''
queryLeave()
}
2025-05-20 10:45:08 +00:00
const jump = (url) => {
uni.navigateTo({
url: url
});
}
2025-05-20 02:29:29 +00:00
onLoad((options) => {
if (options.username) {
username.value = options.username
}
queryLeave()
2025-05-20 02:29:29 +00:00
});
2025-05-20 02:29:29 +00:00
onReachBottom(() => {
if (loading) return
queryLeave(1); //下拉刷新传1
})
2025-05-19 01:52:19 +00:00
</script>
2025-05-20 02:29:29 +00:00
<style lang="scss">
.card-content {
padding: 8px 0;
.meta-info {
display: flex;
align-items: center;
font-size: 12px;
color: #666;
.meta-text {
margin-left: 4px;
}
}
}
2025-05-19 01:52:19 +00:00
</style>