调整和教师端统一

This commit is contained in:
ywyonui 2025-09-15 22:33:28 +08:00
parent 766e98da1e
commit 3cdb102a51
3 changed files with 31 additions and 20 deletions

View File

@ -20,7 +20,7 @@
<view class="item-right"> <view class="item-right">
<text class="item-time" v-if="approver.approveTime">{{ formatTime(approver.approveTime) }}</text> <text class="item-time" v-if="approver.approveTime">{{ formatTime(approver.approveTime) }}</text>
<text class="item-status" :class="getStatusClass(approver.approveStatus)"> <text class="item-status" :class="getStatusClass(approver.approveStatus)">
{{ getStatusText(approver.approveStatus) }} {{ getStatusText(approver.approveStatus, approver.spType) }}
</text> </text>
</view> </view>
</view> </view>
@ -42,7 +42,7 @@
<script setup lang="ts"> <script setup lang="ts">
import dayjs from "dayjs"; import dayjs from "dayjs";
import { getByYwIdAndYwTypeApi } from "@/api/base/lcglApi"; import { getByYwIdAndYwTypeApi } from "@/api/base/lcglSpApi";
// //
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
@ -106,9 +106,11 @@ const loadApprovalProcess = async () => {
// //
const getDefaultUserName = (spType: string) => { const getDefaultUserName = (spType: string) => {
switch (spType) { switch (spType) {
case 'SQ': return '家长'; case 'SQ': return '申请人';
case 'SP': return '教师'; case 'SP': return '审批人';
case 'CC': return '家长'; case 'CC': return '抄送人';
case 'DK': return '代课老师';
case 'JWC': return '教科处';
default: return '未知'; default: return '未知';
} }
}; };
@ -119,16 +121,18 @@ const getSpTypeText = (spType: string) => {
case 'SQ': return '申请人'; case 'SQ': return '申请人';
case 'SP': return '审批人'; case 'SP': return '审批人';
case 'CC': return '抄送人'; case 'CC': return '抄送人';
case 'DK': return '代课老师';
case 'JWC': return '教科处';
default: return ''; default: return '';
} }
}; };
// //
const getStatusText = (status: string) => { const getStatusText = (spType: string, status: string) => {
switch (status) { switch (status) {
case 'apply': return '已申请'; case 'apply': return '已申请';
case 'pending': return '待处理'; case 'pending': return spType === 'CC' ? '待抄送' : '待处理';
case 'approved': return '已同意'; case 'approved': return spType === 'CC' ? '已抄送' : '已同意';
case 'rejected': return '已拒绝'; case 'rejected': return '已拒绝';
case 'cc_sent': return '已抄送'; case 'cc_sent': return '已抄送';
default: return '未知'; default: return '未知';

View File

@ -46,7 +46,7 @@ import PreviewImage from "@/components/PreviewImage/index.vue";
import { getXkTfDetailByIdApi } from "@/api/base/xkApi"; import { getXkTfDetailByIdApi } from "@/api/base/xkApi";
import { xxtsFindByIdApi } from "@/api/base/xxtsApi"; import { xxtsFindByIdApi } from "@/api/base/xxtsApi";
const { loginByOpenId } = useUserStore(); const { loginByOpenId } = useUserStore();
const { getTf } = useDataStore(); const { getTf, getData } = useDataStore();
const xkTf = ref<any>({}); const xkTf = ref<any>({});
const xkTfQdList = ref<any>([]); const xkTfQdList = ref<any>([]);
@ -68,10 +68,22 @@ const initData = (tf: any, tfQdList: any[]) => {
jfPzList.value = jfPz.split(',') || []; jfPzList.value = jfPz.split(',') || [];
}; };
//
const loadData = async (id: string) => {
const res = await getXkTfDetailByIdApi(id);
if (!res.result) {
uni.showToast({ title: '未找到数据', icon: 'none' });
goHome();
}
nextTick(() => {
initData(res.result.xkTf, res.result.xkTfQdList);
});
};
// //
const loadByDb = async (data: any) => { const loadByDb = async (data: any) => {
// //
const isLoggedIn = await loginByOpenId(data.openId); const isLoggedIn = await loginByOpenId(data.openId);
if (!isLoggedIn) { if (!isLoggedIn) {
console.log("用户未登录,跳过处理"); console.log("用户未登录,跳过处理");
return; return;
@ -81,15 +93,8 @@ const isLoggedIn = await loginByOpenId(data.openId);
const xxtsRes = await xxtsFindByIdApi({ id: data.id }); const xxtsRes = await xxtsFindByIdApi({ id: data.id });
if (xxtsRes && xxtsRes.result) { if (xxtsRes && xxtsRes.result) {
const xxts = xxtsRes.result; const xxts = xxtsRes.result;
// ID // ID
const res = await getXkTfDetailByIdApi(xxts.xxzbId); await loadData(xxts.xxzbId);
if (!res.result) {
uni.showToast({ title: '未找到数据', icon: 'none' });
goHome();
}
nextTick(() => {
initData(res.result.xkTf, res.result.xkTfQdList);
});
} }
} catch (error) { } catch (error) {
console.error("获取待办信息失败", error); console.error("获取待办信息失败", error);
@ -103,6 +108,8 @@ onLoad(async (data: any) => {
} else if (getTf && getTf.xkTf) { } else if (getTf && getTf.xkTf) {
// 退 // 退
initData(getTf.xkTf, getTf.xkTfQdList); initData(getTf.xkTf, getTf.xkTfQdList);
} else if (getData && getData.id) {
await loadData(getData.id);
} }
}); });