学生请假调整
This commit is contained in:
parent
05f368b32e
commit
88a8c6f3de
10
src/api/base/jsBjApi.ts
Normal file
10
src/api/base/jsBjApi.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { get } from "@/utils/request";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据班级ID获取班主任和副班主任信息
|
||||||
|
* @param bjId 班级ID
|
||||||
|
*/
|
||||||
|
export const getClassLeadersByBjIdApi = (bjId: string) => {
|
||||||
|
return get("/api/jsBj/classLeaders", { bjId });
|
||||||
|
};
|
||||||
|
|
||||||
@ -46,10 +46,14 @@
|
|||||||
<view class="approver-section">
|
<view class="approver-section">
|
||||||
<view class="section-title">审批信息</view>
|
<view class="section-title">审批信息</view>
|
||||||
<view class="approver-list">
|
<view class="approver-list">
|
||||||
<view class="approver-item">
|
<view
|
||||||
<text class="label">审批人:</text>
|
v-for="approver in approverList"
|
||||||
<text class="value">{{ approverName }}</text>
|
:key="approver.id || approver.jsId || approver.jsxm"
|
||||||
<text class="role">(班主任)</text>
|
class="approver-item"
|
||||||
|
>
|
||||||
|
<text class="label">{{ approver.gxId || '审批人' }}:</text>
|
||||||
|
<text class="value">{{ approver.jsxm || '未设置' }}</text>
|
||||||
|
<text class="role" v-if="approver.gxId">({{ approver.gxId }})</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -95,13 +99,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { computed, onMounted, ref } from "vue";
|
||||||
import { useForm } from "@/components/BasicForm/hooks/useForm";
|
import { useForm } from "@/components/BasicForm/hooks/useForm";
|
||||||
import { jzAddXsQjApi } from "@/api/base/xsQjApi";
|
import { jzAddXsQjApi } from "@/api/base/xsQjApi";
|
||||||
|
import { getClassLeadersByBjIdApi } from "@/api/base/jsBjApi";
|
||||||
import { useDicStore } from "@/store/modules/dic";
|
import { useDicStore } from "@/store/modules/dic";
|
||||||
import { showToast } from "@/utils/uniapp";
|
import { showToast } from "@/utils/uniapp";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import { useUserStore } from "@/store/modules/user";
|
import { useUserStore } from "@/store/modules/user";
|
||||||
import { useCommonStore } from "@/store/modules/common";
|
|
||||||
import { useDebounce } from "@/utils/debounce";
|
import { useDebounce } from "@/utils/debounce";
|
||||||
import DatetimePicker from "@/components/BasicPicker/TimePicker/DatetimePicker.vue";
|
import DatetimePicker from "@/components/BasicPicker/TimePicker/DatetimePicker.vue";
|
||||||
|
|
||||||
@ -112,7 +117,6 @@ const emit = defineEmits<{
|
|||||||
|
|
||||||
const { getCurXs, getUser } = useUserStore();
|
const { getCurXs, getUser } = useUserStore();
|
||||||
const { findByPid } = useDicStore();
|
const { findByPid } = useDicStore();
|
||||||
const commonStore = useCommonStore();
|
|
||||||
// 替换 isSubmitting 状态为 useDebounce
|
// 替换 isSubmitting 状态为 useDebounce
|
||||||
const { isProcessing: isSubmitting, debounce } = useDebounce(2000);
|
const { isProcessing: isSubmitting, debounce } = useDebounce(2000);
|
||||||
|
|
||||||
@ -144,7 +148,15 @@ let formData = ref<any>({
|
|||||||
qjjstime: "",
|
qjjstime: "",
|
||||||
qjsc: ""
|
qjsc: ""
|
||||||
});
|
});
|
||||||
let approverName = ref<string>(''); // 审批人姓名(班主任)
|
const approverList = ref<any[]>([]);
|
||||||
|
|
||||||
|
const primaryApprover = computed(() => {
|
||||||
|
return (
|
||||||
|
approverList.value.find((item) => item.gxId === "班主任") ||
|
||||||
|
approverList.value[0] ||
|
||||||
|
null
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
const [register, { getValue, setValue }] = useForm({
|
const [register, { getValue, setValue }] = useForm({
|
||||||
schema: [
|
schema: [
|
||||||
@ -234,14 +246,26 @@ onMounted(async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const getDefaultApprover = async () => {
|
const getDefaultApprover = async () => {
|
||||||
|
approverList.value = [];
|
||||||
try {
|
try {
|
||||||
// 根据学生ID获取班级信息,再获取班主任信息
|
if (getCurXs && getCurXs.bjId) {
|
||||||
if (getCurXs && getCurXs.bzrId) {
|
const res = await getClassLeadersByBjIdApi(getCurXs.bjId);
|
||||||
approverName.value = getCurXs.bzrXm;
|
if (res?.resultCode === 1 && Array.isArray(res.result)) {
|
||||||
|
approverList.value = res.result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取审批人信息失败:', error);
|
console.error("获取审批人信息失败:", error);
|
||||||
approverName.value = '获取失败';
|
}
|
||||||
|
|
||||||
|
if (approverList.value.length === 0 && getCurXs && getCurXs.bzrId) {
|
||||||
|
approverList.value = [
|
||||||
|
{
|
||||||
|
jsId: getCurXs.bzrId,
|
||||||
|
jsxm: getCurXs.bzrXm,
|
||||||
|
gxId: "班主任",
|
||||||
|
},
|
||||||
|
];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -330,8 +354,13 @@ const submit = debounce(async () => {
|
|||||||
params.id = null;
|
params.id = null;
|
||||||
params.xsId = getCurXs.id; // 学生ID
|
params.xsId = getCurXs.id; // 学生ID
|
||||||
params.xsxm = getCurXs.xm; // 学生姓名
|
params.xsxm = getCurXs.xm; // 学生姓名
|
||||||
params.jsId = getCurXs.bzrId; // 班主任ID
|
if (primaryApprover.value) {
|
||||||
params.jsxm = approverName.value; // 教师姓名(班主任姓名)
|
params.jsId = primaryApprover.value.jsId; // 班主任ID
|
||||||
|
params.jsxm = primaryApprover.value.jsxm; // 教师姓名(班主任姓名)
|
||||||
|
} else {
|
||||||
|
params.jsId = getCurXs.bzrId;
|
||||||
|
params.jsxm = getCurXs.bzrXm;
|
||||||
|
}
|
||||||
params.xqId = getCurXs.xqId; // 学期ID
|
params.xqId = getCurXs.xqId; // 学期ID
|
||||||
params.jzId = getUser.jzId; // 家长ID
|
params.jzId = getUser.jzId; // 家长ID
|
||||||
params.jzxm = getUser.jzxm || getUser.xm; // 家长姓名
|
params.jzxm = getUser.jzxm || getUser.xm; // 家长姓名
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user