调整请假
This commit is contained in:
parent
1c395099e5
commit
e638279fc2
6
src/api/base/jsApi.ts
Normal file
6
src/api/base/jsApi.ts
Normal 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);
|
||||
};
|
||||
@ -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);
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询学生请假流程处理历史
|
||||
*/
|
||||
|
||||
@ -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 });
|
||||
};
|
||||
|
||||
@ -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";
|
||||
|
||||
@ -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 '已拒绝';
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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();
|
||||
|
||||
// 从URL参数获取请假ID
|
||||
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);
|
||||
|
||||
@ -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",
|
||||
|
||||
37
src/store/modules/common.ts
Normal file
37
src/store/modules/common.ts
Normal 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
38
src/store/modules/dic.ts
Normal 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
|
||||
},
|
||||
});
|
||||
@ -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: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user