调整教师请假

This commit is contained in:
ywyonui 2025-07-24 13:34:56 +08:00
parent 48c2f73396
commit 39db11f7fe
7 changed files with 327 additions and 90 deletions

View File

@ -4,23 +4,59 @@
import { get, post } from "@/utils/request";
/**
*
*
*/
export const addQjApi = async (params: any) => {
return await post("/api/jsQj/save", params);
export const jsQjSqApi = async (params: any) => {
return await post("/api/qj/sq", params);
};
/**
*
*/
export const jsQjSpApi = async (params: any) => {
return await post("/api/qj/sp", params);
};
/**
*
*/
export const jsQjJwcQrApi = async (params: any) => {
return await post("/api/qj/jwc/qr", params);
};
/**
*
*/
export const jsQjJwcXtApi = async (params: any) => {
return await post("/api/qj/jwc/xt", params);
};
/**
*
*/
export const jsQjDkQrApi = async (params: any) => {
return await post("/api/qj/dk/qr", params);
};
/**
*
*/
export const findQjById = async (params: any) => {
return await get("/api/jsQj/findById", params);
return await get("/api/qj/findById", params);
};
/**
*
* params: { jsId, startTime, endTime }
*/
export const getPkkbByJsRangeTimeApi = async (params: any) => {
return await get("/mobile/js/pkkb/getListByJsRangeTime", params);
};
/**
*
*/
export const findDkById = async (params: any) => {
export const findDkByIdApi = async (params: any) => {
return await get("/api/qjDk/findById", params);
};
@ -28,7 +64,7 @@ export const findDkById = async (params: any) => {
*
*/
export const findQjListApi = async (params: any) => {
return await get("/api/jsQj/findPage", params);
return await get("/api/qj/findPage", params);
};
/**

View File

@ -6,6 +6,7 @@
<u-radio-group
v-model="newValue"
v-bind="attrs.componentProps"
@change="handleChange"
>
<u-radio
:customStyle="customStyle"
@ -22,6 +23,7 @@
<u-checkbox-group
v-model="newValue"
v-bind="attrs.componentProps"
@change="handleChange"
>
<u-checkbox
:customStyle="customStyle"
@ -113,4 +115,11 @@ initapi()
if (attrs.componentProps) {
attrs.componentProps['activeColor'] = THEMECOLOR
}
function handleChange(e: any) {
newValue.value = e
if (attrs.componentProps.change && isFunction(attrs.componentProps.change)) {
attrs.componentProps.change(e)
}
}
</script>

View File

@ -284,7 +284,7 @@ const sections = reactive<Section[]>([
icon: "draftfill",
text: "请假申请",
show: true,
path: "/pages/view/hr/leaveApplication/index",
path: "/pages/view/hr/qj/index",
},
{
id: "hr2",

View File

@ -0,0 +1,238 @@
<template>
<view class="back-f8f8f8">
<view class="flex-row items-center justify-between py-15 global-bg-color">
<view>
<BasicTitle line title="代课明细" :isBorder="false" />
</view>
<view @click="getPkkbList">
<BasicIcon type="refreshempty" size="25" />
</view>
</view>
<view v-if="dkList.xl.length > 0">
<template v-for="(item, index) in dkList.xl" :key="index">
<view class="dk-card">
<view class="card-header">
<text class="applicant-name">{{ item.dktime }}{{ item.jcmc }}</text>
</view>
<view class="card-body">
<view class="info-row">
<text class="label">排课名称:</text>
<text class="value">{{ item.pkName }}</text>
</view>
<view class="info-row">
<text class="label">上课时间:</text>
<text class="value">{{ item.startTime }}-{{ item.endTime }}</text>
</view>
<view class="info-row" @click="clickChangeJs">
<text class="label">代课老师:</text>
<view class="value">
<text class="data" v-if="item.dkJsId">{{ item.dkJsName }}</text>
<text class="data" style="color: #999;" v-else>请选择代课老师</text>
</view>
<uni-icons type="arrowright" size="16" color="#999"></uni-icons>
</view>
</view>
</view>
</template>
</view>
<view v-else class="p-15 flex-row-center color-9 font-13 white-bg-color">暂无数据</view>
</view>
</template>
<script setup lang="ts">
import { getPkkbByJsRangeTimeApi } from "@/api/base/qjApi";
//
const props = withDefaults(defineProps<{
data: any
}>(), {
data: () => ({
jsId: "",
qjkstime: "", //
qjjstime: "", //
})
});
// const schema = reactive<FormsSchema[]>([
// {
// field: "dktime", // pktime
// label: "",
// component: "BasicInput",
// componentProps: {
// readonly: true,
// },
// },
// {
// field: "pkmc",
// label: "",
// component: "BasicInput",
// componentProps: {
// readonly: true,
// },
// },
// {
// field: "jcmc", // (jcType)+jc
// label: "",
// component: "BasicInput",
// componentProps: {
// readonly: true,
// },
// },
// {
// field: "njbjmx", // bc + bjmc
// label: "",
// component: "BasicInput",
// componentProps: {
// readonly: true,
// },
// },
// {
// field: "startTime", // startTime
// label: "",
// component: "BasicInput",
// componentProps: {
// readonly: true,
// },
// },
// {
// field: "endTime", // endTime
// label: "",
// component: "BasicInput",
// componentProps: {
// readonly: true,
// },
// },
// {
// field: "jsId",
// label: "",
// component: "BasicInput",
// required: true,
// componentProps: {},
// },
// ]);
const dkList = reactive<any>({
xl: [],
});
const jsTypeMc: any = {
"ZAM": '早自习',
"AM": '上午',
"PM": '下午',
};
const getPkkbList = async () => {
const res = await getPkkbByJsRangeTimeApi({
jsId: props.data.jsId,
startTime: props.data.qjkstime.split(" ")[0],
endTime: props.data.qjjstime.split(" ")[0],
});
//
const srcData: any = {};
dkList.xl.map((item: any) => {
const key = item.dktime + item.jcType + item.jc;
srcData[key] = {
dkJsId: item.dkJsId,
dkJsName: item.dkJsName
};
});
dkList.xl = res.result.map((item: any) => {
item.dktime = item.kbtime.split(" ")[0];
item.njbjmx = item.bc + item.bjmc;
item.jcmc = jsTypeMc[item.jcType] + "第" + item.jc + "节";
const key = item.dktime + item.jcType + item.jc;
const src = srcData[key];
if (src) {
item.dkJsId = src.dkJsId;
item.dkJsName = src.dkJsName;
} else {
item.dkJsId = "";
item.dkJsName = "";
}
return item;
});
}
const clickChangeJs = () => {
}
// ref
function getDkList() {
return dkList;
}
//
defineExpose({
getPkkbList,
getDkList
});
</script>
<style lang="scss" scoped>
.dk-card {
background-color: #ffffff;
border-radius: 8px;
margin-bottom: 15px;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
overflow: hidden;
}
.card-header {
padding: 12px 15px;
border-bottom: 1px solid #f0f0f0;
.applicant-name {
font-size: 16px;
font-weight: bold;
color: #333;
}
}
.card-body {
padding: 15px;
.info-row {
display: flex;
margin-bottom: 10px;
&:last-child {
margin-bottom: 0;
}
.label {
font-size: 14px;
color: #666;
width: 70px;
flex-shrink: 0;
margin-right: 8px;
}
.value {
font-size: 14px;
color: #333;
flex: 1;
display: flex;
.data {
flex: 1;
}
}
}
}
.card-footer {
padding: 12px 15px;
border-top: 1px solid #f0f0f0;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 14px;
color: #888;
cursor: pointer;
.arrow {
font-size: 16px;
color: #ccc;
}
}
</style>

View File

@ -3,27 +3,7 @@
<view class="p-15">
<BasicForm @register="register">
<template #dkmx>
<view class="back-f8f8f8">
<view class="flex-row items-center justify-between py-15 global-bg-color">
<view>
<BasicTitle line title="代课明细" :isBorder="false" />
</view>
<view @click="addDk">
<BasicIcon type="icon-tianjia" size="25" />
</view>
</view>
<view v-if="dkList.xl.length > 0">
<template v-for="(item, index) in dkList.xl" :key="index">
<view class="po-re mb-15">
<BasicForm v-model="item.value" :schema="schema" :formsProps="{ labelWidth: 100 }" />
<view @click="delDk(index, item.value)" class="delete-icon">
<BasicIcon type="clear" size="30" />
</view>
</view>
</template>
</view>
<view v-else class="p-15 flex-row-center color-9 font-13 white-bg-color">暂无数据</view>
</view>
<JsQjDkEdit :data="formData" ref="dkRef" v-if="formData.dkfs === 0" />
</template>
</BasicForm>
</view>
@ -39,33 +19,39 @@
</template>
<script setup lang="ts">
import JsQjDkEdit from "./jsQjDkEdit.vue"
import { navigateBack } from "@/utils/uniapp";
import { useForm } from "@/components/BasicForm/hooks/useForm";
import { addQjApi } from "@/api/base/qjApi";
import { jsQjSqApi } from "@/api/base/qjApi";
import { showToast } from "@/utils/uniapp";
import dayjs from "dayjs";
import { cloneDeep } from "lodash";
import { useUserStore } from "@/store/modules/user";
import { useDicStore } from "@/store/modules/dic";
import { update } from "lodash";
const { getJs, getUser } = useUserStore();
const { findByPid } = useDicStore();
//
const props = withDefaults(defineProps<{
data: any
data?: any
}>(), {
data: () => ({
id: "",
qjlx: "事假",
qjkssj: "2025-07-07 09:00:00",
qjjssj: "2025-07-08 10:00:00",
qjkstime: "2025-07-07 09:00:00",
qjjstime: "2025-07-08 10:00:00",
qjsc: "25小时",
qjsy: "我有事情",
dkfs: "1",
dkfs: 0,
})
});
let formData = ref<any>({});
const dkRef = ref<any>(null);
let formData = ref<any>({
...props.data,
jsId: getJs.id,
});
const [register, { setValue, getValue }] = useForm({
schema: [
@ -81,7 +67,6 @@ const [register, { setValue, getValue }] = useForm({
savaKey: "dictionaryCode",
},
},
{ interval: true },
{
field: "qjkstime",
label: "开始时间",
@ -111,7 +96,6 @@ const [register, { setValue, getValue }] = useForm({
placeholder: "请输入选择开始时间和结束时间"
},
},
{ interval: true },
{
field: "qjsy",
label: "请假事由",
@ -149,59 +133,16 @@ const [register, { setValue, getValue }] = useForm({
{ value: 1, text: "教科处协调" },
{ value: 2, text: "无须代课" },
],
change: (value: any) => {
formData.value.dkfs = value;
updateDk();
},
},
},
{ colSlot: "dkmx" },
],
});
const schema = reactive<FormsSchema[]>([
{
field: "dktime",
label: "日期",
component: "BasicDateTimes",
required: true,
componentProps: {},
},
{
field: "nl",
label: "年级班级",
component: "BasicInput",
required: true,
componentProps: {},
},
{
field: "yhzgx",
label: "节次",
component: "BasicInput",
required: true,
componentProps: {},
},
{
field: "yhzgx",
label: "代课老师",
component: "BasicInput",
required: true,
componentProps: {},
},
]);
const dkList = reactive<any>({
xl: [{ value: {} }],
});
function addDk() {
dkList.xl.push({ value: {} });
}
function delDk(index: number, item: any) {
const list = cloneDeep(dkList.xl);
list.splice(index, 1);
dkList.xl = list;
}
setValue(props.data)
const changeKsTime = (selectedTime?: string) => {
if (!selectedTime) {
return;
@ -236,9 +177,22 @@ const validateTime = () => {
//
data.qjsc = Math.round((jsTime - ksTime) / (1000 * 60 * 60)) + "小时";
setValue({ qjsc: data.qjsc });
updateDk();
return true;
}
const updateDk = () => {
if (formData.value.dkfs === 0) {
nextTick(() => {
dkRef.value.getPkkbList();
})
}
};
//
setValue(props.data)
updateDk();
const submit = async () => {
const fd = await getValue();
if (!validateTime()) {
@ -254,7 +208,7 @@ const submit = async () => {
}
params.flag = 2;
uni.showLoading({ title: "提交中..." });
await addQjApi(params).then(() => {
await jsQjSqApi(params).then(() => {
showToast({ title: "提交成功", icon: "success" });
uni.reLaunch({
url: "/pages/base/home/index"

View File

@ -54,7 +54,7 @@ const [register, { reload }] = useLayout({
//
const goToDetail = (item: any | null) => {
setData(item);
let url = '/pages/view/hr/leaveApplication/detail'; // 使
let url = '/pages/view/hr/qj/detail'; // 使
uni.navigateTo({ url });
};
</script>

View File

@ -6,18 +6,18 @@
:current="curTabIndex" @change="switchTab"
/>
<view class="leave-edit" v-if="curTabIndex === 0">
<XsQjEdit />
<JsQjEdit />
</view>
<view class="leave-list" v-else>
<XsQjList />
<JsQjList />
</view>
</view>
</template>
<script setup lang="ts">
import XsQjEdit from "./components/xsQjEdit.vue"
import XsQjList from "./components/xsQjList.vue"
import JsQjEdit from "./components/jsQjEdit.vue"
import JsQjList from "./components/jsQjList.vue"
const tabList = ref([
{ name: "请假申请", id: "leave-edit" },