请假详情

This commit is contained in:
yangzhq68909 2025-05-20 18:45:08 +08:00
parent 3c1c9e9b7f
commit d510a9a734
10 changed files with 184 additions and 28 deletions

View File

@ -4,5 +4,5 @@ NODE_ENV = 'development'
VITE_DELETE_CONSOLE = false VITE_DELETE_CONSOLE = false
# 是否开启sourcemap # 是否开启sourcemap
VITE_SHOW_SOURCEMAP = true VITE_SHOW_SOURCEMAP = true
VITE_SERVER_BASEURL = 'http://10.75.15.247:8080/jeecg-boot' VITE_SERVER_BASEURL = 'http://10.75.15.249:8080/jeecg-boot'
#VITE_SERVER_BASEURL = 'https://36.112.48.190/jeecg-boot' #VITE_SERVER_BASEURL = 'https://36.112.48.190/jeecg-boot'

View File

@ -48,3 +48,21 @@ export function countByOrgApi(params : object) {
data: params data: params
}) })
} }
/*通过id查询请假数据*/
export function queryByIdApi(id : string) {
return http({
url: '/CxcQxj/cxcQxj/queryById',
method: 'GET',
data: { id }
})
}
/*销假*/
export function editApi(config : object ) {
return http({
url: '/CxcQxj/cxcQxj/edit',
method: 'PUT',
data: config
})
}

View File

@ -103,8 +103,9 @@
const minEndtime = ref(0) const minEndtime = ref(0)
/**返回的最新一条请假结束时间*/ /**返回的最新一条请假结束时间*/
const resDate = ref('') const resDate = ref('')
const uploadUrl = ref(getEnvBaseUrl() + '/sys/common/upload?appPath=职工请假/' + userStore.userInfo.department + '/' + const loading = ref(false)
userStore.userInfo.realname) const uploadUrl = getEnvBaseUrl() + '/sys/common/upload?appPath=职工请假/' + userStore.userInfo.department + '/' +
userStore.userInfo.realname
const columnChange = ({ const columnChange = ({
selectedItem, selectedItem,
resolve, resolve,
@ -154,6 +155,7 @@
} }
const handleSubmit = () => { const handleSubmit = () => {
if(loading.value) return
form.value.validate().then(({ form.value.validate().then(({
valid, valid,
errors errors
@ -176,6 +178,7 @@
title: '提示', title: '提示',
}) })
.then(() => { .then(() => {
loading.value = true
addApi(submitData).then(res => { addApi(submitData).then(res => {
if (res.success) { if (res.success) {
startMutilProcess(res.message) startMutilProcess(res.message)
@ -184,7 +187,9 @@
} }
}) })
}) })
.catch(() => {}) .catch(() => {
loading.value = false
})
} }
}) })
} }

View File

@ -0,0 +1,128 @@
<route lang="json5" type="page">
{
layout: 'default',
style: {
navigationStyle: 'custom',
navigationBarTitleText: '请假详情',
},
}
</route>
<template>
<PageLayout navTitle="请假详情">
<wd-cell-group border>
<wd-cell title="职工姓名" :value="info.username_dictText" />
<wd-cell title="所属单位" :value="info.sysOrgCode_dictText" />
<wd-cell title="联系方式" :value="info.phone" />
<wd-cell title="请假类型" :value="info.type" />
<wd-cell title="请假开始时间" :value="info.begintime" />
<wd-cell title="请假结束时间" :value="info.endtime" />
<wd-cell title="请假天数" :value="info.days + '天'" />
<wd-cell title="出发地" :value="info.departure" />
<wd-cell title="目的地" :value="info.destination" />
<wd-cell title="请假原因" :value="info.reason" />
<wd-cell title="附件" v-if="info.path">
<template v-for="(img, index) in joy" :key="index">
<wd-img :width="100" :height="100" :src="img" :enable-preview="true" />
</template>
</wd-cell>
<wd-cell title="销假时间" :value="info.resumptiontime" v-if="info.resumptiontime && info.bpmStatus == '3'" />
<view v-if="!info.resumptiontime && info.bpmStatus == '3'">
<wd-calendar label="销假时间" prop="resumptiontime" v-model="resumptiontime" :min-date="minDate"/>
<view class="footer">
<wd-button type="primary" size="large" @click="handleSubmit" block>销假</wd-button>
</view>
</view>
</wd-cell-group>
</PageLayout>
</template>
<script setup>
import {
useMessage,
useToast
} from 'wot-design-uni'
import {
queryByIdApi,
editApi
} from '@/api/humanResource/absence'
import {
imgUrl
} from '@/utils/index'
import {
useUserStore
} from '@/store/user'
const message = useMessage()
const toast = useToast()
const userStore = useUserStore();
const info = ref({})
const path = ref([])
const joy = ref([])
const resumptiontime = ref(0)
const minDate = ref(0)
const queryById = (e) => {
queryByIdApi(e).then((res) => {
if (res.success) {
info.value = res.result.records[0]
minDate.value = dateStringToTimestamp(info.value.begintime)
joy.value = info.value.path.split(',').map(path => imgUrl(path))
}
})
}
const handleSubmit = () => {
if (!resumptiontime.value) return toast.warning('请选择销假时间!')
editApi({
id: info.value.id,
begintime: formatDate(info.value.begintime),
endtime: formatDate(info.value.endtime),
resumptiontime: formatDate(resumptiontime.value),
type: info.value.type
}).then((res) => {
if (res.success) {
toast.success(res.message)
setTimeout(() => {
uni.navigateBack()
}, 1000)
} else {
toast.warning(res.message)
}
})
}
function formatDate(date) {
date = new Date(date)
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0')
const day = String(date.getDate()).padStart(2, '0')
return `${year}-${month}-${day}`
}
/**
* 将日期字符串转换为13位时间戳支持yyyymmdd和yyyy-mm-dd格式
* @param {string} dateStr
* @returns {number} 13位时间戳毫秒
*/
function dateStringToTimestamp(dateStr) {
const date = new Date();
const normalized = dateStr.replace(/-/g, '');
date.setFullYear(
parseInt(normalized.substring(0, 4)),
parseInt(normalized.substring(4, 6)) - 1,
parseInt(normalized.substring(6, 8))
);
date.setHours(0, 0, 0, 0);
return date.getTime();
}
onLoad((options) => {
queryById(options.id)
})
</script>
<style lang="scss" scoped>
.footer {
padding: 12px;
}
</style>

View File

@ -9,7 +9,7 @@
</route> </route>
<template> <template>
<PageLayout navTitle="请假信息"> <PageLayout navTitle="请假信息">
<wd-card> <wd-card style="margin-top: 10px;">
<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-col :span="12"><uni-title title="重置" align="right" type="h5" color="#666666" <wd-col :span="12"><uni-title title="重置" align="right" type="h5" color="#666666"
@ -17,7 +17,8 @@
</wd-row> </wd-row>
<wd-row> <wd-row>
<wd-col :span="24"> <wd-col :span="24">
<SelectDept label="" v-model="orgCode" @change="Search" rowKey="orgCode" :multiple="false">
</SelectDept>
</wd-col> </wd-col>
</wd-row> </wd-row>
<wd-row> <wd-row>
@ -42,7 +43,7 @@
</wd-row> </wd-row>
<l-echart ref="chart" /> <l-echart ref="chart" />
</wd-card> </wd-card>
<view v-for="(item, i) in list" :key="i"> <view v-for="(item, i) in list" :key="i" @click="jump(`./detail?id=${item.id}`)">
<wd-card :title="item.username_dictText+'的'+item.type+'申请'"> <wd-card :title="item.username_dictText+'的'+item.type+'申请'">
<view class="card-content"> <view class="card-content">
<view class="meta-info"> <view class="meta-info">
@ -58,15 +59,12 @@
</PageLayout> </PageLayout>
</template> </template>
<script setup> <script setup>
import {
onLoad,
onReachBottom
} from '@dcloudio/uni-app'
import { import {
listApi, listApi,
countByOrgApi countByOrgApi
} from '@/api/humanResource/absence' } from '@/api/humanResource/absence'
import * as echarts from 'echarts'; import * as echarts from 'echarts';
import SelectDept from '@/components/SelectDept/SelectDept'
const chart = ref(null); const chart = ref(null);
const chartOption = ref({}); const chartOption = ref({});
const list = ref([]) // const list = ref([]) //
@ -75,13 +73,14 @@
const type = ref('') // const type = ref('') //
const range = ref([]) // const range = ref([]) //
const timeout = ref(null) const timeout = ref(null)
const orgCode = ref('')
let pageNo = 1 let pageNo = 1
let pageSize = 10 let pageSize = 10
let loading = false let loading = false
const queryLeave = (e) => { const queryLeave = (e) => {
let param = { let param = {
// sysOrgCode: orgCode.value, sysOrgCode: orgCode.value,
begin: range.value[0], begin: range.value[0],
end: range.value[1], end: range.value[1],
type: type.value, type: type.value,
@ -158,7 +157,7 @@
} }
function reset() { function reset() {
// orgCode.value = null orgCode.value = ''
range.value = [] range.value = []
type.value = '' type.value = ''
// username.value = '' // username.value = ''
@ -167,6 +166,12 @@
queryLeave() queryLeave()
} }
const jump = (url) => {
uni.navigateTo({
url: url
});
}
onLoad((options) => { onLoad((options) => {
getList() getList()
}); });

View File

@ -25,12 +25,6 @@
</template> </template>
<script setup> <script setup>
import {
ref
} from 'vue'
import {
onLoad
} from '@dcloudio/uni-app';
import { import {
useAppStore useAppStore
} from '@/store' } from '@/store'

View File

@ -39,8 +39,7 @@
<script setup> <script setup>
import { import {
onLoad, onLoad,
onReachBottom, onReachBottom
onPullDownRefresh
} from '@dcloudio/uni-app' } from '@dcloudio/uni-app'
import { import {
queryDocumentApi, queryDocumentApi,
@ -202,13 +201,6 @@
getList(1) getList(1)
}) })
onPullDownRefresh(() => {
pageNo = 1
list.value = []
getList(1)
uni.stopPullDownRefresh()
})
onLoad((options) => { onLoad((options) => {
type.value = options.title type.value = options.title
getList(1) getList(1)

View File

@ -336,6 +336,15 @@
"navigationBarTitleText": "请假申请" "navigationBarTitleText": "请假申请"
} }
}, },
{
"path": "absence/detail",
"type": "page",
"layout": "default",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "请假详情"
}
},
{ {
"path": "absence/index", "path": "absence/index",
"type": "page", "type": "page",

View File

@ -32,6 +32,7 @@ interface NavigateToOptions {
"/pages-operate/file/index" | "/pages-operate/file/index" |
"/pages-operate/sc/index" | "/pages-operate/sc/index" |
"/pages-humanResource/absence/add" | "/pages-humanResource/absence/add" |
"/pages-humanResource/absence/detail" |
"/pages-humanResource/absence/index" | "/pages-humanResource/absence/index" |
"/pages-integrated/duty/index" | "/pages-integrated/duty/index" |
"/pages-politics/health/add" | "/pages-politics/health/add" |

View File

@ -421,3 +421,7 @@ function weatherRequest(params : { lat ?: number; lon ?: number; q ?: string })
// } // }
}); });
} }
export const imgUrl = (url : string) => {
return getEnvBaseUrl() + '/sys/common/static/' + `/${url}`
}