192 lines
4.2 KiB
Vue
Raw Normal View History

2025-06-10 16:27:34 +08:00
<template>
<BasicLayout>
<view class="px-15 pb-15">
<BasicForm @register="register"> </BasicForm>
</view>
<template #bottom>
<view class="flex-row items-center pb-10 pt-5">
2025-07-18 14:20:12 +08:00
<u-button text="上一步" class="ml-15 mr-7" :plain="true" @click="navigateBack" />
<u-button text="下一步" class="mr-15 mr-7" type="primary" @click="submit" />
2025-06-10 16:27:34 +08:00
</view>
</template>
</BasicLayout>
</template>
<script setup lang="ts">
import { navigateBack, navigateTo } from "@/utils/uniapp";
import { useForm } from "@/components/BasicForm/hooks/useForm";
2025-07-18 14:20:12 +08:00
import { useUserStore } from "@/store/modules/user";
2025-08-13 16:35:20 +08:00
import { showLoading, hideLoading } from "@/utils/uniapp";
2025-07-18 14:20:12 +08:00
const { getJs, setJs } = useUserStore();
import { zwGetListByLxApi, findAllXxXqNjTree } from "@/api/base/server";
2025-06-10 16:27:34 +08:00
2025-07-18 14:20:12 +08:00
let dzZwList: any = [];
let qtZwList: any = [];
const formSchema: any = [
{
title: "任职情况",
},
{
field: "dzzw",
label: "党政职务:",
component: "BasicCheckbox",
itemProps: {
labelPosition: "top",
},
componentProps: {
data: [{ label: "书记", value: "1" }],
multiple: true,
onChange(e: any) {
console.log(e);
}
},
},
{
field: "qtzw",
label: "其他职务",
component: "BasicCheckbox",
itemProps: {
labelPosition: "top",
},
componentProps: {
data: [{ label: "书记", value: "1" }],
multiple: true,
onChange(e: any) {
console.log(e);
}
},
},
{
field: "njId",
label: "所属年级",
component: "BasicTree",
componentProps: {
api: findAllXxXqNjTree,
rangeKey: "title",
savaKey: "key",
},
},
// {
// field: "bzrBjId",
// label: "班主任班级",
// component: "BasicTree",
// componentProps: {
// api: findAllNjBjTreeApi,
// rangeKey: "title",
// savaKey: "key",
// },
// },
];
const [register, { getValue, setValue, setSchema }] = useForm({
schema: formSchema
});
let dzZw: any = [];
let qtZw: any = [];
if (getJs.dzzw && typeof getJs.dzzw == "string") {
dzZw = getJs.dzzw.split(",");
}
if (getJs.qtzw && typeof getJs.qtzw == "string") {
qtZw = getJs.qtzw.split(",");
}
async function submit() {
try {
const value = await getValue();
// 处理 dzzw 和 qtzw 字段,将数组转换为字符串
if (Array.isArray(value.dzzw)) {
value.dzzw = value.dzzw.join(',');
}
if (Array.isArray(value.qtzw)) {
value.qtzw = value.qtzw.join(',');
}
2025-08-13 16:35:20 +08:00
// 保存数据
2025-07-18 14:20:12 +08:00
setJs({ ...getJs, ...value });
2025-08-13 16:35:20 +08:00
// 显示加载提示
showLoading("正在加载职称信息...");
// 延迟跳转,让用户看到加载提示
setTimeout(() => {
hideLoading();
navigateTo("/pages/view/hr/teacherProfile/TitleInfo");
}, 500);
} catch (error) {
hideLoading();
console.error("提交失败:", error);
}
2025-07-18 14:20:12 +08:00
}
2025-06-10 16:27:34 +08:00
2025-07-18 14:20:12 +08:00
onMounted(async () => {
const updateSchema: any = [];
{
const res = await zwGetListByLxApi({ zwlx: '党政职务' });
dzZwList = res.result.map((item: any) => {
return {
label: item.zwmc,
value: item.id
};
});
updateSchema.push({
2025-06-10 16:27:34 +08:00
field: "dzzw",
label: "党政职务:",
component: "BasicCheckbox",
itemProps: {
labelPosition: "top",
},
componentProps: {
2025-07-18 14:20:12 +08:00
data: dzZwList,
2025-06-10 16:27:34 +08:00
multiple: true,
2025-07-18 14:20:12 +08:00
onChange(e: any) {
console.log(e);
}
2025-06-10 16:27:34 +08:00
},
2025-07-18 14:20:12 +08:00
})
};
{
const res = await zwGetListByLxApi({ zwlx: '其他职务' });
qtZwList = res.result.map((item: any) => {
return {
label: item.zwmc,
value: item.id
};
});
updateSchema.push({
2025-06-10 16:27:34 +08:00
field: "qtzw",
2025-07-18 14:20:12 +08:00
label: "其他职务:",
2025-06-10 23:40:49 +08:00
component: "BasicCheckbox",
itemProps: {
labelPosition: "top",
},
componentProps: {
2025-07-18 14:20:12 +08:00
data: qtZwList,
2025-06-10 23:40:49 +08:00
multiple: true,
2025-07-18 14:20:12 +08:00
onChange(e: any) {
console.log(e);
}
2025-06-10 16:27:34 +08:00
},
2025-07-18 14:20:12 +08:00
})
};
setSchema(updateSchema);
nextTick(() => {
setValue({
...getJs,
dzzw: dzZw,
qtzw: qtZw
});
2025-06-17 13:25:27 +08:00
});
2025-07-18 14:20:12 +08:00
});
2025-06-10 16:27:34 +08:00
</script>
<style lang="scss" scoped>
.delete-icon {
position: absolute;
right: 0;
top: 0;
z-index: 1;
}
</style>