308 lines
6.8 KiB
Vue
Raw Normal View History

2025-04-22 10:22:33 +08:00
<template>
<BasicLayout>
2025-05-13 15:39:44 +08:00
<view class="px-15 pb-15">
2025-04-22 10:22:33 +08:00
<BasicForm @register="register"> </BasicForm>
</view>
<template #bottom>
<view class="flex-row items-center pb-10 pt-5">
<u-button
2025-05-13 15:39:44 +08:00
text="下一步"
2025-06-10 16:27:34 +08:00
class="mx-15 "
2025-04-22 10:22:33 +08:00
type="primary"
@click="submit"
/>
</view>
</template>
</BasicLayout>
</template>
<script setup lang="ts">
2025-06-11 23:35:00 +08:00
import {navigateTo} from "@/utils/uniapp";
2025-04-22 10:22:33 +08:00
2025-06-11 23:35:00 +08:00
import {useForm} from "@/components/BasicForm/hooks/useForm";
import {dicApi, findDicTreeByPidApi} from "@/api/system/dic";
import {useDataStore} from "@/store/modules/data";
import {map} from "lodash";
2025-05-13 15:39:44 +08:00
import dayjs from "dayjs";
const { getFile, setFile } = useDataStore();
const jsjg = ref("");
2025-04-22 10:22:33 +08:00
2025-05-13 15:39:44 +08:00
// 计算日期与当前日期相差的年数
const calculateYearDiff = (startDate: string) => {
if (!startDate) return "";
const start = dayjs(startDate);
const now = dayjs();
2025-05-13 15:43:34 +08:00
console.log(now.diff(start, "year"));
2025-05-13 15:39:44 +08:00
return now.diff(start, "year");
};
2025-06-10 16:27:34 +08:00
const [register, { getValue, setValue, setSchema }] = useForm({
2025-04-22 10:22:33 +08:00
schema: [
{
2025-05-13 15:39:44 +08:00
title: "基础信息",
},
{
field: "jsdah",
label: "档案号",
component: "BasicInput",
componentProps: {
disabled: true,
},
},
{
field: "jsxm",
2025-04-22 10:22:33 +08:00
label: "姓名",
component: "BasicInput",
componentProps: {},
},
{
2025-05-13 15:39:44 +08:00
field: "jsxbId",
label: "性别",
component: "BasicPicker",
componentProps: {
api: dicApi,
param: { pid: 13001 },
rangeKey: "dictionaryValue",
savaKey: "dictionaryCode",
},
},
{
field: "jsjgId",
2025-04-22 10:22:33 +08:00
label: "籍贯",
2025-05-13 15:39:44 +08:00
component: "BasicDataPicker",
componentProps: {
api: findDicTreeByPidApi,
param: { pid: 3701 },
rangeKey: "dictionaryValue",
savaKey: "dictionaryCode",
onChange: (e: any) => {
jsjg.value = map(e.detail.value, (item) => {
return item.text;
}).join("");
},
},
},
{
field: "mzId",
label: "民族",
2025-04-22 10:22:33 +08:00
component: "BasicPicker",
2025-05-13 15:39:44 +08:00
componentProps: {
api: dicApi,
param: { pid: 19204295 },
rangeKey: "dictionaryValue",
savaKey: "dictionaryCode",
},
2025-04-22 10:22:33 +08:00
},
{
2025-05-13 15:39:44 +08:00
field: "sfzh",
2025-04-22 10:22:33 +08:00
label: "身份证号",
component: "BasicInput",
componentProps: {},
},
{
2025-05-13 15:39:44 +08:00
field: "age",
2025-04-22 10:22:33 +08:00
label: "年龄",
component: "BasicInput",
componentProps: {},
},
{
2025-05-13 15:39:44 +08:00
field: "cstime",
2025-04-22 10:22:33 +08:00
label: "出生日期",
component: "BasicDateTimes",
componentProps: {},
},
{
2025-05-13 15:39:44 +08:00
field: "zzmmId",
2025-04-22 10:22:33 +08:00
label: "政治面貌",
component: "BasicPicker",
2025-05-13 15:39:44 +08:00
componentProps: {
api: dicApi,
param: { pid: 385536488 },
rangeKey: "dictionaryValue",
savaKey: "dictionaryCode",
},
2025-04-22 10:22:33 +08:00
},
{
2025-05-13 15:39:44 +08:00
field: "rdtime",
2025-04-22 10:22:33 +08:00
label: "入党时间",
2025-06-10 16:27:34 +08:00
component: "BasicDateTime",
componentProps: {
mode: "year-month",
},
2025-04-22 10:22:33 +08:00
},
{
2025-05-13 15:39:44 +08:00
field: "lxdh",
label: "联系电话",
2025-04-22 10:22:33 +08:00
component: "BasicInput",
componentProps: {},
},
{
2025-05-13 15:39:44 +08:00
field: "dzyx",
label: "电子邮箱",
2025-04-22 10:22:33 +08:00
component: "BasicInput",
componentProps: {},
},
2025-06-04 20:52:34 +08:00
{
field: "cgtime",
label: "参加工作时间",
2025-06-10 16:27:34 +08:00
component: "BasicDateTime",
2025-06-04 20:52:34 +08:00
componentProps: {
2025-06-10 16:27:34 +08:00
mode: "year-month",
ok: (e: any) => {
const yearDiff = calculateYearDiff(e.value);
2025-06-04 20:52:34 +08:00
setValue({ jsgl: yearDiff });
},
},
},
{
field: "jsgl",
label: "工龄",
component: "BasicInput",
componentProps: {
disabled: true,
},
},
{
field: "jsTime",
label: "任教开始时间",
2025-06-11 23:35:00 +08:00
component: "BasicDateTime",
2025-06-04 20:52:34 +08:00
componentProps: {
2025-06-11 23:35:00 +08:00
mode: "year-month",
ok: (e: any) => {
2025-06-04 20:52:34 +08:00
const yearDiff = calculateYearDiff(e);
setValue({ jl: yearDiff });
},
},
},
{
field: "jl",
label: "教龄",
component: "BasicInput",
componentProps: {
disabled: true,
placeholder: "请选择教龄时间",
},
},
{
field: "jrdwtime",
label: "进入本单位时间",
2025-06-10 16:27:34 +08:00
component: "BasicDateTime",
2025-06-04 20:52:34 +08:00
componentProps: {
2025-06-10 16:27:34 +08:00
mode: "year-month",
ok: (e: any) => {
const yearDiff = calculateYearDiff(e.value);
2025-06-04 20:52:34 +08:00
setValue({ jrdwnx: yearDiff });
},
},
},
{
field: "jrdwnx",
label: "进入本单位年限",
component: "BasicInput",
componentProps: {
placeholder: "请选择进入本单位时间",
disabled: true,
},
},
2025-05-13 15:39:44 +08:00
2025-06-04 20:52:34 +08:00
{
field: "jrly",
label: "进入来源",
component: "BasicPicker",
componentProps: {
api: dicApi,
param: { pid: 2026977361 },
rangeKey: "dictionaryValue",
savaKey: "dictionaryCode",
},
},
{
field: "bzqkId",
label: "编制情况",
component: "BasicPicker",
componentProps: {
api: dicApi,
param: { pid: 290357612 },
rangeKey: "dictionaryValue",
savaKey: "dictionaryCode",
},
},
{
field: "zdqkId",
label: "在岗情况",
component: "BasicPicker",
componentProps: {
api: dicApi,
param: { pid: 810984651 },
rangeKey: "dictionaryValue",
savaKey: "dictionaryCode",
2025-06-10 16:27:34 +08:00
ok: (e: any, form: any, attrs: any) => {
if (attrs[e].dictionaryValue == "调出") {
setSchema([
{
field: "dcyy",
ifShow: false,
},
]);
}
},
2025-06-04 20:52:34 +08:00
},
},
2025-04-22 10:22:33 +08:00
{
2025-06-10 16:27:34 +08:00
field: "dcyy",
label: "调出原因",
ifShow: true,
2025-04-22 10:22:33 +08:00
component: "BasicInput",
componentProps: {},
},
2025-05-13 15:39:44 +08:00
{
2025-06-04 20:52:34 +08:00
field: "gwjbId",
label: "岗位级别",
component: "BasicPicker",
2025-05-13 15:39:44 +08:00
componentProps: {
2025-06-04 20:52:34 +08:00
api: dicApi,
param: { pid: 260783972 },
rangeKey: "dictionaryValue",
savaKey: "dictionaryCode",
2025-05-13 15:39:44 +08:00
},
},
2025-04-22 10:22:33 +08:00
{
2025-06-04 20:52:34 +08:00
field: "xqxjId",
label: "薪级",
component: "BasicPicker",
2025-05-13 15:39:44 +08:00
componentProps: {
2025-06-04 20:52:34 +08:00
api: dicApi,
param: { pid: 434953981 },
rangeKey: "dictionaryValue",
savaKey: "dictionaryCode",
2025-05-13 15:39:44 +08:00
},
},
{
2025-06-10 16:27:34 +08:00
field: "sbkh",
label: "社保卡号",
2025-04-22 10:22:33 +08:00
component: "BasicInput",
componentProps: {},
},
],
});
2025-05-13 15:39:44 +08:00
setValue(getFile);
2025-04-22 10:22:33 +08:00
2025-05-13 15:39:44 +08:00
async function submit() {
try {
const value = await getValue();
setFile({ ...getFile, ...value, jsjg: jsjg.value });
2025-06-10 16:27:34 +08:00
navigateTo("/pages/view/hr/teacherProfile/education");
2025-05-13 15:39:44 +08:00
} catch (error) {}
2025-04-22 10:22:33 +08:00
}
</script>
<style lang="scss" scoped>
.delete-icon {
position: absolute;
right: 0;
top: 0;
z-index: 1;
}
</style>