学生请假调整

This commit is contained in:
hebo 2025-10-29 10:30:13 +08:00
parent 409f9f5108
commit 05f368b32e
3 changed files with 114 additions and 16 deletions

View File

@ -16,7 +16,7 @@
</picker-view-column> </picker-view-column>
</picker-view> </picker-view>
</view> </view>
<view class="button" style="width: 90%;margin: 5px auto;" @click="confirm">确定</view> <view class="confirm-button" @click="confirm">确定</view>
</view> </view>
</uni-popup> </uni-popup>
</template> </template>
@ -487,10 +487,27 @@ export default {
.center { .center {
padding-bottom: var(--window-bottom); padding-bottom: var(--window-bottom);
} }
.picker-view { .picker-view {
height: 400rpx; height: 400rpx;
} }
.confirm-button {
width: 90%;
margin: 10px auto;
padding: 12px 0;
background-color: #007bff;
color: #fff;
text-align: center;
border-radius: 8px;
font-size: 16px;
font-weight: 500;
cursor: pointer;
transition: background-color 0.3s;
&:active {
background-color: #0056b3;
}
}
</style> </style>

View File

@ -53,8 +53,16 @@ const [register, { reload }] = useLayout({
// //
const goToDetail = (item: any | null) => { const goToDetail = (item: any | null) => {
setData(item); if (!item || !item.id) {
let url = '/pages/base/qj/detail'; uni.showToast({
title: '请假ID不存在',
icon: 'none'
});
return;
}
// ID
let url = `/pages/base/qj/detail?id=${item.id}`;
uni.navigateTo({ url }); uni.navigateTo({ url });
}; };
</script> </script>

View File

@ -8,6 +8,14 @@
</view> </view>
<view class="divider"></view> <view class="divider"></view>
<view class="card-body"> <view class="card-body">
<view class="info-row">
<text class="label">学生姓名:</text>
<text class="value">{{ qjData.xsxm }}</text>
</view>
<view class="info-row">
<text class="label">所在班级:</text>
<text class="value">{{ qjData.bc }}</text>
</view>
<view class="info-row"> <view class="info-row">
<text class="label">请假类型:</text> <text class="label">请假类型:</text>
<text class="value">{{ qjData.qjlx }}</text> <text class="value">{{ qjData.qjlx }}</text>
@ -54,40 +62,105 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onLoad } from "@dcloudio/uni-app";
import { navigateBack } from "@/utils/uniapp"; import { navigateBack } from "@/utils/uniapp";
import { useDataStore } from "@/store/modules/data";
import { getXsQjDetailApi } from "@/api/base/xsQjApi"; import { getXsQjDetailApi } from "@/api/base/xsQjApi";
import { xxtsFindByIdApi } from "@/api/base/xxtsApi";
import LcglSp from "@/components/LcglSp/index.vue"; import LcglSp from "@/components/LcglSp/index.vue";
const { getData } = useDataStore(); // IDyfzc_xs_qj id
const qjId = ref<string>('');
// URLID
const pages = getCurrentPages();
const qjId = getData.id || '';
// //
const qjData = ref<any>({}); const qjData = ref<any>({});
// //
const loadQjDetail = async () => { const loadQjDetail = async (xsQjId: string) => {
if (!qjId) { if (!xsQjId) {
console.error('请假ID不能为空'); console.error('请假ID不能为空');
return; return;
} }
try { try {
const res = await getXsQjDetailApi(qjId); uni.showLoading({ title: '加载中...' });
const res = await getXsQjDetailApi(xsQjId);
if (res.resultCode === 1 && res.result) { if (res.resultCode === 1 && res.result) {
qjData.value = res.result; qjData.value = res.result;
qjId.value = xsQjId;
} else {
uni.showToast({
title: res.message || '获取请假详情失败',
icon: 'none'
});
} }
} catch (error) { } catch (error) {
console.error('获取请假详情失败:', error); console.error('获取请假详情失败:', error);
uni.showToast({
title: '获取请假详情失败',
icon: 'none'
});
} finally {
uni.hideLoading();
} }
}; };
// //
onMounted(() => { onLoad(async (options: any) => {
loadQjDetail(); console.log('detail.vue onLoad 接收到的参数:', options);
try {
// id
if (!options || !options.id) {
uni.showToast({
title: '缺少参数',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack();
}, 1500);
return;
}
uni.showLoading({ title: '加载中...' });
//
// 1. from=dbid yfzc_xxts id xxzbId
// 2. id yfzc_xs_qj id
if (options.from === 'db') {
console.log('从待办消息过来,需要先查询待办信息');
// id idxxzbId
const xxtsRes = await xxtsFindByIdApi({ id: options.id });
if (xxtsRes && xxtsRes.result && xxtsRes.result.xxzbId) {
const xxzbId = xxtsRes.result.xxzbId;
console.log('从待办信息获取到请假ID:', xxzbId);
uni.hideLoading();
// 使 id
await loadQjDetail(xxzbId);
} else {
throw new Error('获取待办信息失败或缺少主表ID');
}
} else {
console.log('从请假记录列表过来,直接查询请假详情');
// 使 id
uni.hideLoading();
await loadQjDetail(options.id);
}
} catch (error: any) {
console.error('加载请假详情失败:', error);
uni.hideLoading();
uni.showToast({
title: error.message || '加载失败',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack();
}, 1500);
}
}); });
</script> </script>
@ -132,7 +205,7 @@ onMounted(() => {
.label { .label {
font-size: 14px; font-size: 14px;
color: #bbb; color: #bbb;
width: 70px; width: 80px;
flex-shrink: 0; flex-shrink: 0;
margin-right: 8px; margin-right: 8px;
} }