调整登录学生家长关联
This commit is contained in:
parent
9278dcc610
commit
122392cd45
@ -52,8 +52,8 @@ onLoad(async (data: any) => {
|
||||
})
|
||||
.catch((err) => {});
|
||||
} else {
|
||||
uni.switchTab({
|
||||
url: "/pages/base/message/index",
|
||||
uni.reLaunch({
|
||||
url: "/pages/system/login/login",
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@ -52,17 +52,29 @@
|
||||
<u--form label-width="auto">
|
||||
<u-form-item
|
||||
label="姓名"
|
||||
:prop="`students[${index}].xcxm`"
|
||||
:prop="`students[${index}].xsxm`"
|
||||
required
|
||||
borderBottom
|
||||
>
|
||||
<u--input
|
||||
v-model="student.xcxm"
|
||||
placeholder="请输入子女姓名"
|
||||
v-model="student.xsxm"
|
||||
placeholder="请输入学生姓名"
|
||||
border="none"
|
||||
inputAlign="right"
|
||||
></u--input>
|
||||
</u-form-item>
|
||||
<u-form-item
|
||||
label="与学生关系"
|
||||
:prop="`students[${index}].jzxsgxId`"
|
||||
required
|
||||
borderBottom
|
||||
>
|
||||
<view @click="openDicPicker(student)" class="flex-row flex-1 justify-end">
|
||||
<view v-if="!student.jzxsgxId" style="color: rgb(192, 196, 204);">请选择与学生关系</view>
|
||||
<view v-else>{{ student.jzxsgxmc }}</view>
|
||||
</view>
|
||||
|
||||
</u-form-item>
|
||||
<u-form-item
|
||||
label="身份证号"
|
||||
:prop="`students[${index}].xssfzh`"
|
||||
@ -71,7 +83,7 @@
|
||||
>
|
||||
<u--input
|
||||
v-model="student.xssfzh"
|
||||
placeholder="请输入子女身份证号"
|
||||
placeholder="请输入学生身份证号"
|
||||
border="none"
|
||||
inputAlign="right"
|
||||
></u--input>
|
||||
@ -85,6 +97,9 @@
|
||||
</view>
|
||||
|
||||
<BasicForm @register="register"></BasicForm>
|
||||
|
||||
<BasicPicker ref="dicPickerRef" :range="dicOptions" title="请选择与学生关系"
|
||||
range-key="dictionaryCode" v-model="dicVal" @ok="dicChanged" />
|
||||
</view>
|
||||
|
||||
<template #bottom>
|
||||
@ -110,64 +125,92 @@ import { useUserStore } from "@/store/modules/user";
|
||||
import { useDataStore } from "@/store/modules/data";
|
||||
import {imagUrl} from "@/utils";
|
||||
|
||||
const [register, { getValue }] = useForm({
|
||||
const dicOptions = ref<any>([[[]]]);
|
||||
const dicPickerRef = ref();
|
||||
const dicVal = ref<number[]>([]);
|
||||
|
||||
let formSchema: FormsSchema[] = [
|
||||
{ title: "监护人信息" },
|
||||
// {
|
||||
// field: "jzxsgxId",
|
||||
// label: "与学生关系",
|
||||
// component: "BasicPicker",
|
||||
// componentProps: {
|
||||
// rangeKey: "dictionaryValue",
|
||||
// savaKey: "dictionaryCode",
|
||||
// options: []
|
||||
// },
|
||||
// },
|
||||
{
|
||||
field: "jzxm",
|
||||
label: "家长姓名",
|
||||
component: "BasicInput",
|
||||
required: true,
|
||||
componentProps: {},
|
||||
},
|
||||
{
|
||||
field: "jzsj",
|
||||
label: "家长手机号",
|
||||
component: "BasicInput",
|
||||
required: true,
|
||||
componentProps: {},
|
||||
},
|
||||
{
|
||||
field: "gzdw",
|
||||
label: "家长工作单位",
|
||||
component: "BasicInput",
|
||||
componentProps: {},
|
||||
},
|
||||
{
|
||||
field: "zw",
|
||||
label: "职务",
|
||||
component: "BasicInput",
|
||||
componentProps: {},
|
||||
},
|
||||
{
|
||||
field: "jtzz",
|
||||
label: "家庭地址",
|
||||
component: "BasicInput",
|
||||
componentProps: {},
|
||||
},
|
||||
];
|
||||
|
||||
const [register, { getValue, setSchema }] = useForm({
|
||||
formsProps: { labelWidth: 100 },
|
||||
schema: [
|
||||
{ title: "监护人信息" },
|
||||
{
|
||||
field: "jzxsgxId",
|
||||
label: "与学生关系",
|
||||
component: "BasicPicker",
|
||||
componentProps: {
|
||||
api: dicApi,
|
||||
param: { pid: 1622287061 },
|
||||
rangeKey: "dictionaryValue",
|
||||
savaKey: "dictionaryCode",
|
||||
},
|
||||
},
|
||||
{
|
||||
field: "jzxm",
|
||||
label: "家长姓名",
|
||||
component: "BasicInput",
|
||||
required: true,
|
||||
componentProps: {},
|
||||
},
|
||||
{
|
||||
field: "jzsj",
|
||||
label: "家长手机号",
|
||||
component: "BasicInput",
|
||||
required: true,
|
||||
componentProps: {},
|
||||
},
|
||||
{
|
||||
field: "gzdw",
|
||||
label: "家长工作单位",
|
||||
component: "BasicInput",
|
||||
componentProps: {},
|
||||
},
|
||||
{
|
||||
field: "zw",
|
||||
label: "职务",
|
||||
component: "BasicInput",
|
||||
componentProps: {},
|
||||
},
|
||||
{
|
||||
field: "jtzz",
|
||||
label: "家庭地址",
|
||||
component: "BasicInput",
|
||||
componentProps: {},
|
||||
},
|
||||
],
|
||||
schema: formSchema,
|
||||
});
|
||||
|
||||
const students = ref([
|
||||
{
|
||||
xcxm: "",
|
||||
xsxm: "",
|
||||
xssfzh: "",
|
||||
xstx: "",
|
||||
jzxsgxId: "",
|
||||
jzxsgxmc: ""
|
||||
},
|
||||
]);
|
||||
|
||||
const curXs = ref(students.value[0]);
|
||||
|
||||
const openDicPicker = (xs: any) => {
|
||||
curXs.value = xs;
|
||||
dicVal.value = [0];
|
||||
for (let i = 0; i < dicOptions.value[0].length; i++) {
|
||||
if (xs.jzxsgxId == dicOptions.value[0][i].dictionaryValue) {
|
||||
dicVal.value = [i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
dicPickerRef.value.open();
|
||||
};
|
||||
|
||||
const dicChanged = (dicArr: any) => {
|
||||
console.log(dicArr);
|
||||
const dic = dicOptions.value[0][dicArr[0]];
|
||||
curXs.value.jzxsgxId = dic.dictionaryValue;
|
||||
curXs.value.jzxsgxmc = dic.dictionaryCode;
|
||||
}
|
||||
|
||||
async function afterRead(event: any, index: number) {
|
||||
if (!event.tempFilePaths || event.tempFilePaths.length === 0) {
|
||||
showToast({ title: "图片选择失败", icon: "none" });
|
||||
@ -176,7 +219,8 @@ async function afterRead(event: any, index: number) {
|
||||
const tempFilePath = event.tempFilePaths[0];
|
||||
showLoading({ title: "上传中" });
|
||||
try {
|
||||
const { result } = await attachmentUpload(tempFilePath);
|
||||
const res = await attachmentUpload(tempFilePath);
|
||||
const result = res.result;
|
||||
if (result && result.length > 0 && result[0].filePath) {
|
||||
students.value[index].xstx = result[0].filePath;
|
||||
console.log(`Student ${index} avatar uploaded:`, result[0].filePath);
|
||||
@ -199,9 +243,11 @@ function handleAvatarClose(index: number) {
|
||||
|
||||
function addMoreChildren() {
|
||||
students.value.push({
|
||||
xcxm: "",
|
||||
xsxm: "",
|
||||
xssfzh: "",
|
||||
xstx: "",
|
||||
jzxsgxId: "",
|
||||
jzxsgxmc: ""
|
||||
});
|
||||
}
|
||||
|
||||
@ -237,7 +283,7 @@ async function submit() {
|
||||
showToast({ title: "请上传子女照片", icon: "none" });
|
||||
return;
|
||||
}
|
||||
if (!student.xcxm) {
|
||||
if (!student.xsxm) {
|
||||
showToast({ title: "请输入子女姓名", icon: "none" });
|
||||
return;
|
||||
}
|
||||
@ -266,6 +312,15 @@ async function submit() {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
const resDic = await dicApi({ pid: 1622287061 });
|
||||
dicOptions.value = [resDic.result];
|
||||
formSchema[1].componentProps.options = resDic.result;
|
||||
setSchema(formSchema);
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@ -106,6 +106,7 @@ export const useUserStore = defineStore({
|
||||
logout() {
|
||||
this.setToken('')
|
||||
this.setUser('')
|
||||
this.setCurXs({})
|
||||
this.setAuth([])
|
||||
},
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user