调整请假

This commit is contained in:
ywyonui 2025-08-27 21:02:29 +08:00
parent 1c395099e5
commit e638279fc2
12 changed files with 170 additions and 119 deletions

6
src/api/base/jsApi.ts Normal file
View File

@ -0,0 +1,6 @@
import { get, post } from "@/utils/request";
// 根据教师ID查询教师信息
export const jsFindByIdApi = async (param: { id: string }) => {
return await get("/api/js/findById", param);
};

View File

@ -105,20 +105,6 @@ export const relayFinishApi = async (params: any) => {
return await post('/mobile/jl/relay/finish', params);
};
/**
*
*/
export const jzAddXsQjApi = async (params: any) => {
return await post("/api/xsQj/save", params);
};
/**
*
*/
export const jzXsQjListApi = async (params: any) => {
return await get("/api/xsQj/findPage", params);
};
/**
*
*/

View File

@ -3,92 +3,73 @@ import { get, post } from "@/utils/request";
// 学生请假相关接口
/**
*
* /
* @param data
*/
export const jzAddXsQjApi = (data: any) => {
return post("/xsQj/jzAdd", data);
return post("/api/xsQj/save", data);
};
/**
*
*
* @param data
*/
export const approveXsQjApi = (data: any) => {
return post("/api/xsQj/sp", data);
};
/**
*
* @param params
*/
export const findXsQjPageApi = (params: any) => {
return get("/api/xsQj/findPage", params);
};
/**
*
* @param params
*/
export const exportXsQjApi = (params: any) => {
return post("/api/xsQj/export", params);
};
/**
*
*/
export const getExportFieldChooseApi = () => {
return get("/api/xsQj/exportFieldChoose");
};
/**
*
* @param file
*/
export const importXsQjDataApi = (file: any) => {
return post("/api/xsQj/importData", file);
};
/**
*
* @param params
*/
export const jzXsQjListApi = (params: any) => {
return get("/xsQj/jzList", params);
return get("/api/xsQj/findPage", params);
};
/**
*
* @param id ID
*/
export const getXsQjDetailApi = (id: string) => {
return get("/xsQj/detail", { id });
return get("/api/xsQj/findById", { id });
};
/**
*
* @param ywId ID
* @param ywType
*/
export const getXsQjApprovalProcessApi = (ywId: string, ywType: string = 'XS_QJ') => {
return get("/gzlSp/getByYwIdAndYwType", { ywId, ywType });
};
/**
*
*/
export const approveXsQjApi = (data: any) => {
return post("/xsQj/approve", data);
};
/**
*
*/
export const getQjTypeListApi = () => {
return get("/xsQj/qjTypeList");
};
/**
*
*/
export const getQjStatisticsApi = (params: any) => {
return get("/xsQj/statistics", params);
};
/**
*
*/
export const exportXsQjApi = (params: any) => {
return get("/xsQj/export", params);
};
/**
*
*/
export const batchOperateXsQjApi = (data: any) => {
return post("/xsQj/batchOperate", data);
};
/**
*
*/
export const getXsQjApprovalHistoryApi = (qjId: string) => {
return get("/xsQj/approvalHistory", { qjId });
};
/**
*
*/
export const getXsQjTodoListApi = (params: any) => {
return get("/xsQj/todoList", params);
};
/**
*
*/
export const getXsQjDoneListApi = (params: any) => {
return get("/xsQj/doneList", params);
};
/**
*
*/
export const getXsQjCcListApi = (params: any) => {
return get("/xsQj/ccList", params);
return get("/api/gzlSp/getByYwIdAndYwType", { ywId, ywType });
};

View File

@ -115,7 +115,6 @@ import { attachmentUpload } from "@/api/system/upload";
import CustomUpload from "/src/components/BasicUpload/CustomUpload.vue";
import { useForm } from "@/components/BasicForm/hooks/useForm";
import { dicApi } from "@/api/system/dic";
import { glxsApi } from "@/api/base/server";
import { useUserStore } from "@/store/modules/user";
import { useDataStore } from "@/store/modules/data";

View File

@ -53,11 +53,8 @@ const loadApprovalProcess = async () => {
const res = await getXsQjApprovalProcessApi(props.qjId, 'XS_QJ');
if (res.resultCode === 1 && res.result) {
// sort
const sortedList = res.result.sort((a: any, b: any) => a.sort - b.sort);
//
approvalList.value = sortedList.map((item: any) => ({
// sort
approvalList.value = res.result.map((item: any) => ({
userName: item.userName || getDefaultUserName(item.spType),
spType: item.spType,
approveStatus: item.approveStatus,
@ -121,6 +118,7 @@ const getSpTypeText = (spType: string) => {
//
const getStatusText = (status: string) => {
switch (status) {
case 'apply': return '已申请';
case 'pending': return '待处理';
case 'approved': return '已同意';
case 'rejected': return '已拒绝';

View File

@ -39,12 +39,16 @@
<script setup lang="ts">
import { navigateBack } from "@/utils/uniapp";
import { useForm } from "@/components/BasicForm/hooks/useForm";
import { dicApi } from "@/api/system/dic";
import { jzAddXsQjApi } from "@/api/base/xsQjApi";
import { useDicStore } from "@/store/modules/dic";
import { showToast } from "@/utils/uniapp";
import dayjs from "dayjs";
import { useUserStore } from "@/store/modules/user";
import { useCommonStore } from "@/store/modules/common";
const { getCurXs, getUser } = useUserStore();
const { findByPid } = useDicStore();
const commonStore = useCommonStore();
//
const props = withDefaults(defineProps<{
@ -72,7 +76,7 @@ const [register, { getValue, setValue }] = useForm({
required: true,
component: "BasicPicker",
componentProps: {
api: dicApi,
api: findByPid,
param: { pid: 1007011432 },
rangeKey: "dictionaryValue",
savaKey: "dictionaryCode",
@ -136,16 +140,16 @@ const [register, { getValue, setValue }] = useForm({
],
},
},
{
field: "qjtp",
label: "请假图片",
component: "BasicUpload",
required: true,
itemProps: {
labelPosition: "top",
},
componentProps: {},
},
// {
// field: "qjtp",
// label: "",
// component: "BasicUpload",
// required: true,
// itemProps: {
// labelPosition: "top",
// },
// componentProps: {},
// },
],
});
@ -159,19 +163,12 @@ onMounted(async () => {
const getDefaultApprover = async () => {
try {
// ID
// API
if (getCurXs && getCurXs.bzrId) {
// API
// const response = await this.$api.getTeacherInfo(getCurXs.bzrId);
// if (response.success) {
// approverName.value = response.data.teacherName;
// }
// ID
approverName.value = getCurXs.bzrId;
approverName.value = getCurXs.bzrXm;
}
} catch (error) {
console.error('获取审批人信息失败:', error);
approverName.value = '获取失败';
}
};
@ -225,8 +222,10 @@ const submit = async () => {
params.xsId = getCurXs.id; // ID
params.xsxm = getCurXs.xm; //
params.jsId = getCurXs.bzrId; // ID
params.jsxm = approverName.value; //
params.xqId = getCurXs.xqId; // ID
params.jzId = getUser.jzId; // ID
params.jzxm = getUser.jzxm || getUser.xm; //
}
params.flag = 2;

View File

@ -34,7 +34,7 @@
<script setup lang="ts">
import { useLayout } from "@/components/BasicListLayout/hooks/useLayout";
import { jzXsQjListApi } from "@/api/base/server";
import { jzXsQjListApi } from "@/api/base/xsQjApi";
import { useUserStore } from "@/store/modules/user";
import { useDataStore } from "@/store/modules/data";
const { getCurXs } = useUserStore();

View File

@ -56,15 +56,14 @@
<script setup lang="ts">
import { navigateBack } from "@/utils/uniapp";
import { useDataStore } from "@/store/modules/data";
import { jzXsQjListApi } from "@/api/base/xsQjApi";
import { getXsQjDetailApi } from "@/api/base/xsQjApi";
import ProgressList from "./components/progressList.vue";
const { getData } = useDataStore();
// URLID
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
const qjId = (currentPage as any).options?.id || '';
const qjId = getData.id || '';
//
const qjData = ref<any>({});
@ -77,9 +76,9 @@ const loadQjDetail = async () => {
}
try {
const res = await jzXsQjListApi({ id: qjId });
if (res.resultCode === 1 && res.result && res.result.length > 0) {
qjData.value = res.result[0];
const res = await getXsQjDetailApi(qjId);
if (res.resultCode === 1 && res.result) {
qjData.value = res.result;
}
} catch (error) {
console.error('获取请假详情失败:', error);

View File

@ -125,16 +125,17 @@ import { attachmentUpload } from "@/api/system/upload";
import CustomUpload from "/src/components/BasicUpload/CustomUpload.vue";
import { useForm } from "@/components/BasicForm/hooks/useForm";
import { dicApi } from "@/api/system/dic";
import { loginRegisterJzApi } from "@/api/base/server";
import { useUserStore } from "@/store/modules/user";
import { useDataStore } from "@/store/modules/data";
import { useDicStore } from "@/store/modules/dic";
import { imagUrl } from "@/utils";
import { refreshPermissionCache } from "@/utils/permission";
const dicOptions = ref<any>([[[]]]);
const dicPickerRef = ref();
const dicVal = ref<number[]>([]);
const { findByPid } = useDicStore();
let formSchema: FormsSchema[] = [
{ title: "监护人信息" },
@ -143,7 +144,7 @@ let formSchema: FormsSchema[] = [
label: "与学生关系",
component: "BasicPicker",
componentProps: {
api: dicApi,
api: findByPid,
param: { pid: 1622287061 },
rangeKey: "dictionaryValue",
savaKey: "dictionaryCode",

View File

@ -0,0 +1,37 @@
import { defineStore } from "pinia";
import { jsFindByIdApi } from "@/api/base/jsApi";
interface CommonState {
data: any;
}
export const useCommonStore = defineStore({
id: "app-common",
state: (): CommonState => ({
// 字典数据
data: {}
}),
getters: {
getData(): any {
return this.data;
}
},
actions: {
setData(data: any) {
this.data = data;
},
// 根据教师ID获取教师信息带缓存机制
async getJsById(params: any): Promise<any> {
if (!this.data.js || !this.data.js[params.id]) {
this.data.js = this.data.js || {};
this.data.js[params.id] = await jsFindByIdApi(params);
}
return Promise.resolve(this.data.js[params.id]);
},
},
persist: {
enabled: true,
detached: true,
H5Storage: localStorage
},
});

38
src/store/modules/dic.ts Normal file
View File

@ -0,0 +1,38 @@
import { defineStore } from "pinia";
import { dicApi } from "@/api/system/dic";
interface DicState {
data: any;
}
export const useDicStore = defineStore({
id: "app-dic",
state: (): DicState => ({
// 字典数据
data: {}
}),
getters: {
getData(): any {
return this.data;
}
},
actions: {
setData(data: any) {
this.data = data;
},
async findByPid(params: any): Promise<any> {
if (!params || !params.pid) {
return Promise.resolve();
}
if (!this.data[params.pid]) {
this.data[params.pid] = await dicApi(params);
}
return Promise.resolve(this.data[params.pid]);
},
},
persist: {
enabled: true,
detached: true,
H5Storage: localStorage
},
});

View File

@ -6,6 +6,8 @@ import { jcGetJcBzListApi } from "@/api/base/jcApi";
import { AUTH_KEY } from "@/config";
import { imagUrl } from "@/utils";
import { useWebSocket } from '@/utils/webSocket/webSocket'
import { useDicStore } from "@/store/modules/dic";
import { useCommonStore } from "@/store/modules/common";
const defWsCallback = (type: string, data: any) => {
console.log('接收到 WebSocket 消息, 默认处理函数:', type, data);
@ -187,6 +189,9 @@ export const useUserStore = defineStore({
*/
afterLoginAction(value: any) {
this.setUser(value)
// 为了避免数据加载异常。这里清理一下缓存
useDicStore().setData({});
useCommonStore().setData({});
if (value.xsList && value.xsList.length > 0) {
for (let i = 0; i < value.xsList.length; i++) {
const xs = value.xsList[i];
@ -549,6 +554,8 @@ export const useUserStore = defineStore({
this.ws = null;
}
this.wsCallback = defWsCallback;
useDicStore().setData({});
useCommonStore().setData({});
},
},
persist: {