子女信息管理移动端

This commit is contained in:
=
2025-09-08 14:05:41 +08:00
parent 15143a34ba
commit eaf1748cf9
10 changed files with 744 additions and 11 deletions
@@ -65,6 +65,7 @@ public class ChildManageManageController {
Integer year,
String searchName,
String searchKeyword,
String childrenName,
String childrenSex,
String unionId,
String unitId,
@@ -100,7 +101,10 @@ public class ChildManageManageController {
cnd.and(Cnd.exps("info.guardianUnitId1", "=", unitId)
.or("info.guardianUnitId2", "=", unitId));
}
// 姓名筛选
if (childrenName != null && !childrenName.isEmpty()) {
cnd.and("info.childrenName", "like","%" + childrenName + "%" );
}
cnd.andEX("YEAR(info.applyTime)", "=", year);
cnd.andEX("info.childrenSex", "=", childrenSex);
cnd.andEX("info.childrenGrade", "=", childrenGrade);
@@ -0,0 +1,20 @@
package com.budwk.app.zhgh.user.childManage.h5controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import lombok.extern.slf4j.Slf4j;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
@IocBean
@At("/platform/h5/childManage/manage")
@Ok("json:full")
@Slf4j
public class H5ChildManageManageController {
@At("")
@Ok("beetl:/platform/zhghh5/staffmanage/childManage/manage/index.html")
@SaCheckPermission("h5.childManage.manage")
public void index() {}
}
@@ -0,0 +1,40 @@
package com.budwk.app.zhgh.user.childManage.h5controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.budwk.app.base.annotation.SLog;
import com.budwk.app.base.page.Pagination;
import com.budwk.app.base.param.PageForm;
import com.budwk.app.base.result.Result;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.zhgh.user.childManage.models.ChildManage;
import com.budwk.app.zhgh.user.childManage.service.ChildManageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.nutz.aop.interceptor.ioc.TransAop;
import org.nutz.dao.Cnd;
import org.nutz.dao.Sqls;
import org.nutz.dao.sql.Sql;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
@IocBean
@At("/platform/h5/childManage/mine")
@Ok("json:full")
@Slf4j
public class H5ChildManageMineController {
@Inject
private ChildManageService childManageService;
@At("")
@Ok("beetl:/platform/zhghh5/staffmanage/childManage/mine/index.html")
@SaCheckPermission("h5.childManage.mine")
public void index() {}
}
@@ -2,6 +2,8 @@ package com.budwk.app.zhgh.user.childManage.h5controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;
@@ -16,12 +18,13 @@ import org.nutz.mvc.annotation.Ok;
@Slf4j
@IocBean
@Ok("json")
@At("/platform/childManage/manage/h5")
public class H5ChildManageController {
@At("/platform/h5/childManage/write")
public class H5ChildManageWriteController {
@At("")
@Ok("beetl:/platform/zhghh5/staffmanage/childmanage/")
@SaCheckPermission("h5.childManage")
@Ok("beetl:/platform/zhghh5/staffmanage/childManage/write/index.html")
@SaCheckPermission("h5.childManage.write")
public void index() {
}
}
@@ -12,7 +12,6 @@ layout("/layouts/platform_h5.html"){
</van-dropdown-menu>
</van-sticky>
<table-list api="/platform/enrollmentRegistration/applyList/pageData" :page_form.sync="pageForm" ref="tableListRef"
@ready="doSearch" title="taskName">
<template v-slot="{index,row}">
@@ -0,0 +1,56 @@
const childManageInfo = {
template:
/*language=HTML*/`
<div>
<div class="process-title">子女信息</div>
<van-cell-group>
<van-cell title="姓名">{{ viewData.childrenName }}</van-cell>
<van-cell title="就读年级">
<dict-tag :options="dict.type.CHILD_MANAGE_GRADE"
:value="viewData.childrenGrade">
</dict-tag></van-cell>
<van-cell title="入学年份">{{ viewData.childrenYear }}</van-cell>
<van-cell title="身份证号">{{ viewData.childrenIdCard }}</van-cell>
<van-cell title="出生日期">{{ viewData.childrenBirthday }}</van-cell>
<van-cell title="性别">{{ viewData.childrenSex }}</van-cell>
<van-cell title="国籍">{{ viewData.childrenCountry }}</van-cell>
<van-cell title="就读学校">{{ viewData.childrenCurrentSchool }}</van-cell>
<van-cell title="中考总成绩">{{ viewData.childrenMiddleScore }}</van-cell>
<van-cell title="学科组合">{{ viewData.childrenSubjectCombination }}</van-cell>
<van-cell title="户籍所在地">{{ viewData.childrenHuKouAddress }}</van-cell>
<div class="process-title">监护人信息</div>
<van-cell title="监护人1">{{ viewData.guardianUserName1 }}</van-cell>
<van-cell title="联系电话">{{ viewData.guardianMobile1 }}</van-cell>
<van-cell title="工作单位">{{ viewData.guardianUnitName1 }}</van-cell>
<van-cell title="监护人2">{{ viewData.guardianUserName2 }}</van-cell>
<van-cell title="联系电话">{{ viewData.guardianMobile2 }}</van-cell>
<van-cell title="工作单位">{{ viewData.guardianUnitName2 }}</van-cell>
<van-cell title="备注">{{ viewData.note }}</van-cell>
<template slot="default">
<van-image :src="viewData.avatar"></van-image>
</template>
</van-cell>
</van-cell-group>
</div>
`,
dicts: ["CHILD_MANAGE_GRADE"],
data() {
return {
viewData: {},
activeName: "first",
isScrollNow: "0"
}
},
methods: {
onOpen(row) {
this.$axios.post("/platform/childManage/write/findOne", { id: row.id }).then((res) => {
if (res.code === 0) {
this.viewData = res.data
}
})
}
},
style: /*language=CSS*/ `
`
}
@@ -0,0 +1,164 @@
<!--#
layout("/layouts/platform_h5.html"){
#-->
<div id="app">
<van-nav-bar @click-left="historyBack" left-arrow left-text="返回" title="信息管理" placeholder fixed></van-nav-bar>
<van-sticky offset-top="46px">
<van-search
:reverse-color="false"
:show-action="false"
@search="doSearch"
input-align="left"
placeholder="请输入子女名称搜索"
v-model="pageForm.childrenName"
></van-search>
<van-dropdown-menu :close-on-click-outside="false" :close-on-click-overlay="false">
<van-dropdown-item :options="yearList" @change="doSearch" v-model="pageForm.year"></van-dropdown-item>
</van-dropdown-menu>
</van-sticky>
<table-list api="/platform/childManage/manage/pageData" :page_form.sync="pageForm" ref="tableListRef"
@ready="doSearch" title="taskName">
<template v-slot="{index,row}">
<table-column label="子女姓名">{{row.childrenName}}</table-column>
<table-column label="性别">{{row.childrenSex}}</table-column>
<table-column label="年龄">{{calculateAge(row.childrenBirthday)}}</table-column>
<table-column label="年级">
<dict-tag :options="dict.type.CHILD_MANAGE_GRADE"
:value="row.childrenGrade">
</dict-tag>
</table-column>
<table-column label="入学年份">{{row.childrenYear}}</table-column>
<!-- <table-column label="监护人1姓名">{{row.guardianUserName1}}</table-column>-->
<!-- <table-column label="手机号码">{{row.guardianMobile1}}</table-column>-->
<!-- <table-column label="所属单位">{{row.guardianUnitName1}}</table-column>-->
<!-- <table-column label="监护人2姓名">{{row.guardianUserName2}}</table-column>-->
<!-- <table-column label="手机号码">{{row.guardianMobile2}}</table-column>-->
<!-- <table-column label="所属单位">{{row.guardianUnitName2}}</table-column>-->
<!-- <table-column label="填报时间">{{row.applyTime}}</table-column>-->
</template>
<template #actions="{index,row}">
<div class="action-btn" @click="onView(row)">
<i class="fa fa-eye"></i>
<span>查看</span>
</div>
<div class="action-btn" @click="onEdit(row)">
<i class="fa fa-edit"></i>
<span>编辑</span>
</div>
<div class="action-btn delete" @click="onDelete(row)">
<i class="fa fa-trash"></i>
<span>删除</span>
</div>
</template>
</table-list>
<van-popup :style="{ height: '100%',width: '100%'}" position="right" safe-area-inset-bottom v-model="viewShow">
<van-sticky>
<van-nav-bar @click-left="viewShow = false" left-arrow left-text="返回" title="详细信息"></van-nav-bar>
</van-sticky>
<div style="height: calc(100vh - 44px); overflow-y: auto">
<info ref="infoRef"></info>
</div>
</van-popup>
</div>
<script>
<!--#include('../info.js'){}#-->
const vue = new Vue({
el: "#app",
store,
dicts: ["CHILD_MANAGE_GRADE"],
components: {
info:childManageInfo
},
data() {
return {
viewShow: false,
yearList: [],
pageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
year: "",
},
}
},
methods: {
onView(row) {
this.viewShow = true
this.$nextTick(() => {
this.$refs.infoRef.onOpen(row)
})
},
onEdit(row) {
window.location.href = '/platform/h5/childManage/write?bizId=' + row.id
},
onDelete(id) {
this.$dialog.confirm({
title: '温馨提示',
message: '您确定要删除吗?',
}).then(() => {
this.$axios.post("/platform/childManage/manage/doDelete", {id}).then((res) => {
if (res.code === 0) {
this.$toast.success(res.msg)
this.doSearch()
} else {
this.$toast.fail(res.msg)
}
})
}).catch(() => {
// on cancel
});
},
doSearch() {
this.$nextTick(() => {
this.pageForm.pageNumber = 1
this.pageForm.totalCount = 0
this.$refs.tableListRef.doSearch()
})
},
initData() {
for (let i = new Date().getFullYear() - 10; i <= new Date().getFullYear(); i++) {
this.yearList.unshift({value: i, text: i + "年"})
}
this.$set(this.pageForm, "year", this.yearList[0].value)
},
// 计算年龄的方法
calculateAge(birthday) {
if (!birthday) return '';
try {
// 解析日期字符串 (YYYY-MM-DD格式)
const birthDate = new Date(birthday);
const today = new Date();
let age = today.getFullYear() - birthDate.getFullYear();
const monthDiff = today.getMonth() - birthDate.getMonth();
// 如果还没过生日,则年龄减1
if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {
age--;
}
return age > 0 ? age + '岁' : '0岁';
} catch (error) {
console.error('计算年龄出错:', error);
return '';
}
},
},
created() {
this.initData()
}
})
</script>
<!--#
}
#-->
@@ -0,0 +1,157 @@
<!--#
layout("/layouts/platform_h5.html"){
#-->
<div id="app">
<van-nav-bar @click-left="historyBack" left-arrow left-text="返回" title="我的子女" placeholder fixed></van-nav-bar>
<van-sticky offset-top="46px">
<van-dropdown-menu :close-on-click-outside="false" :close-on-click-overlay="false">
<van-dropdown-item :options="yearList" @change="doSearch" v-model="pageForm.year"></van-dropdown-item>
</van-dropdown-menu>
</van-sticky>
<table-list api="/platform/childManage/mine/pageData" :page_form.sync="pageForm" ref="tableListRef"
@ready="doSearch" title="taskName">
<template v-slot="{index,row}">
<table-column label="子女姓名">{{row.childrenName}}</table-column>
<table-column label="性别">{{row.childrenSex}}</table-column>
<table-column label="年龄">{{calculateAge(row.childrenBirthday)}}</table-column>
<table-column label="年级">
<dict-tag :options="dict.type.CHILD_MANAGE_GRADE"
:value="row.childrenGrade">
</dict-tag>
</table-column>
<table-column label="入学年份">{{row.childrenYear}}</table-column>
<!-- <table-column label="监护人1姓名">{{row.guardianUserName1}}</table-column>-->
<!-- <table-column label="手机号码">{{row.guardianMobile1}}</table-column>-->
<!-- <table-column label="所属单位">{{row.guardianUnitName1}}</table-column>-->
<!-- <table-column label="监护人2姓名">{{row.guardianUserName2}}</table-column>-->
<!-- <table-column label="手机号码">{{row.guardianMobile2}}</table-column>-->
<!-- <table-column label="所属单位">{{row.guardianUnitName2}}</table-column>-->
<!-- <table-column label="填报时间">{{row.applyTime}}</table-column>-->
</template>
<template #actions="{index,row}">
<div class="action-btn" @click="onView(row)">
<i class="fa fa-eye"></i>
<span>查看</span>
</div>
<div class="action-btn" @click="onEdit(row)">
<i class="fa fa-edit"></i>
<span>编辑</span>
</div>
<div class="action-btn delete" @click="onDelete(row)">
<i class="fa fa-trash"></i>
<span>删除</span>
</div>
</template>
</table-list>
<van-popup :style="{ height: '100%',width: '100%'}" position="right" safe-area-inset-bottom v-model="viewShow">
<van-sticky>
<van-nav-bar @click-left="viewShow = false" left-arrow left-text="返回" title="详细信息"></van-nav-bar>
</van-sticky>
<div style="height: calc(100vh - 44px); overflow-y: auto">
<info ref="infoRef"></info>
</div>
</van-popup>
</div>
<script>
<!--#include('../info.js'){}#-->
const vue = new Vue({
el: "#app",
store,
dicts: ["CHILD_MANAGE_GRADE"],
components: {
info:childManageInfo
},
data() {
return {
viewShow: false,
yearList: [],
pageForm: {
pageNumber: 1,
pageSize: 10,
totalCount: 0,
year: "",
},
}
},
methods: {
onView(row) {
this.viewShow = true
this.$nextTick(() => {
this.$refs.infoRef.onOpen(row)
})
},
onEdit(row) {
window.location.href = '/platform/h5/childManage/write?bizId=' + row.id
},
onDelete(id) {
this.$dialog.confirm({
title: '温馨提示',
message: '您确定要删除吗?',
}).then(() => {
this.$axios.post("/platform/childManage/mine/doDelete", {id}).then((res) => {
if (res.code === 0) {
this.$toast.success(res.msg)
this.doSearch()
} else {
this.$toast.fail(res.msg)
}
})
}).catch(() => {
// on cancel
});
},
doSearch() {
this.$nextTick(() => {
this.pageForm.pageNumber = 1
this.pageForm.totalCount = 0
this.$refs.tableListRef.doSearch()
})
},
initData() {
for (let i = new Date().getFullYear() - 10; i <= new Date().getFullYear(); i++) {
this.yearList.unshift({value: i, text: i + "年"})
}
this.$set(this.pageForm, "year", this.yearList[0].value)
},
// 计算年龄的方法
calculateAge(birthday) {
if (!birthday) return '';
try {
// 解析日期字符串 (YYYY-MM-DD格式)
const birthDate = new Date(birthday);
const today = new Date();
let age = today.getFullYear() - birthDate.getFullYear();
const monthDiff = today.getMonth() - birthDate.getMonth();
// 如果还没过生日,则年龄减1
if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birthDate.getDate())) {
age--;
}
return age > 0 ? age + '岁' : '0岁';
} catch (error) {
console.error('计算年龄出错:', error);
return '';
}
},
},
created() {
this.initData()
}
})
</script>
<!--#
}
#-->
@@ -1,23 +1,313 @@
<!--#
layout("/layouts/platform_h5.html"){
#-->
<style scoped>
#app {
background-color: #f7f8fa;
height: 100vh;
overflow-y: auto;
}
</style>
<div id="app">
<van-nav-bar title="信息填报" left-text="返回" left-arrow @click-left="historyBack" placeholder fixed></van-nav-bar>
<van-nav-bar title="子女信息填报" left-text="返回" left-arrow @click-left="historyBack" placeholder fixed></van-nav-bar>
<!-- 表单容器 -->
<van-form ref="formRef" class="form-container">
<!-- 子女信息 -->
<van-cell-group title="子女信息" class="form-section">
<van-field label="姓名" :rules="[{ required: true }]" v-model="formData.childrenName" placeholder="请输入姓名" required></van-field>
<van-field
v-model="formData.childrenGrade"
name="childrenGrade"
label="就读年级"
readonly
placeholder="请点击就读年级"
@click="showChildrenGradePicker = true"
clickable
></van-field>
<van-popup position="bottom" round v-model:show="showChildrenGradePicker">
<van-picker :columns="childrenGradeColumns" @cancel="showChildrenGradePicker = false" @confirm="onChildrenGradeConfirm" show-toolbar></van-picker>
</van-popup>
<van-field
label="入学年份"
v-model="formData.childrenYear"
placeholder="请选择入学年份"
readonly
@click="showYearPicker = true"
clickable
></van-field>
<van-popup position="bottom" round v-model="showYearPicker">
<van-picker
:columns="yearColumns"
@cancel="showYearPicker = false"
@confirm="onYearConfirm"
show-toolbar
></van-picker>
</van-popup>
<van-field label="身份证号" v-model="formData.childrenIdCard" placeholder="请输入身份证号"></van-field>
<van-field
label="出生年月"
v-model="formData.childrenBirthday"
placeholder="请选择出生年月"
readonly
@click="showBirthdayPicker = true"
clickable
></van-field>
<van-popup v-model="showBirthdayPicker" position="bottom">
<van-datetime-picker
v-model="currentDate"
type="date"
title="选择年月日"
:min-date="minDate"
:max-date="maxDate"
@confirm="onBirthdayConfirm"
@cancel="showBirthdayPicker = false"
/>
</van-popup>
<van-field
label="性别"
v-model="formData.childrenSex"
placeholder="请选择性别"
readonly
@click="showSexPicker = true"
clickable
></van-field>
<van-popup position="bottom" round v-model="showSexPicker">
<van-picker
:columns="sexColumns"
@cancel="showSexPicker = false"
@confirm="onSexConfirm"
show-toolbar
></van-picker>
</van-popup>
<van-field label="国籍" v-model="formData.childrenCountry" placeholder="请输入国籍"></van-field>
<van-field label="就读学校" v-model="formData.childrenCurrentSchool" placeholder="请输入就读学校"></van-field>
<van-field label="中考总成绩" v-model="formData.childrenMiddleScore" placeholder="请输入中考总成绩"></van-field>
<van-field label="学科组合" v-model="formData.childrenSubjectCombination" placeholder="请输入学科组合"></van-field>
<van-field label="户籍所在地" v-model="formData.childrenHuKouAddress" placeholder="请输入户籍所在地"></van-field>
</van-cell-group>
<!-- 监护人信息 -->
<van-cell-group title="监护人信息" class="form-section">
<van-field label="监护人1" v-model="formData.guardianUserName1" readonly placeholder="读取信息中心数据"></van-field>
<van-field label="工号" v-model="formData.guardianLoginName1" readonly placeholder="读取信息中心数据"></van-field>
<van-field label="手机号码" v-model="formData.guardianMobile1" readonly placeholder="读取信息中心数据"></van-field>
<van-field label="所在单位" v-model="formData.guardianUnitName1" readonly placeholder="读取信息中心数据"></van-field>
<van-field
label="监护人2"
v-model="formData.guardianUserName2"
placeholder="请输入监护人姓名"
></van-field>
<van-field label="工号" v-model="formData.guardianLoginName2" placeholder="没有则不填" ></van-field>
<van-field label="手机号码" v-model="formData.guardianMobile2" placeholder="请输入手机号码"></van-field>
<van-field label="所在单位" v-model="formData.guardianUnitName2" placeholder="请输入所在单位"></van-field>
<van-field
label="备注"
v-model="formData.note"
placeholder="请输入备注"
type="textarea"
rows="4"
autosize
></van-field>
</van-cell-group>
<!-- 提交按钮 -->
<div class="form-actions">
<van-button @click="onSave" round type="info">保存申请</van-button>
</div>
</van-form>
</div>
<script>
new Vue({
store,
el: '#app',
dicts: ["CHILD_MANAGE_GRADE"],
data() {
return {
bizId: GetQueryString("bizId"),
formData: {
childrenName: '',
childrenGrade: '',
childrenYear: '',
childrenIdCard: '',
childrenBirthday: '',
childrenSex: '',
childrenCountry: '',
childrenCurrentSchool: '',
childrenMiddleScore: '',
childrenSubjectCombination: '',
childrenHuKouAddress: '',
guardianUserName1: '',
guardianLoginName1: '',
guardianMobile1: '',
guardianUnitName1: '',
guardianUserName2: '',
guardianLoginName2: '',
guardianMobile2: '',
guardianUnitName2: '',
// 添加监护人ID和工会信息
guardianUserId1: '',
guardianUnionId1: '',
guardianUnionName1: '',
guardianUnitId1: '',
guardianUserId2: '',
guardianUnionId2: '',
guardianUnionName2: '',
guardianUnitId2: ''
},
//就读年级
showChildrenGradePicker: false,
childrenGradeColumns: [],
//入学年份
showYearPicker: false,
yearColumns: [],
//性别选择
showSexPicker: false,
sexColumns: [
{ text: '男', value: '男' },
{ text: '女', value: '女' }
],
//监护人1
showGuardian1Picker: false,
guardian1SearchKeyword: '',
guardian1Options: [],
showManualGuardian1Dialog: false,
manualGuardian1Name: '',
//监护人2
showGuardian2Picker: false,
guardian2SearchKeyword: '',
guardian2Options: [],
showManualGuardian2Dialog: false,
manualGuardian2Name: '',
//出生年月
showBirthdayPicker: false,
currentDate: new Date(), // 添加这一行
minDate: new Date(1900, 0, 1),
maxDate: new Date(),
}
},
methods: {
historyBack,
onSave() {
this.$dialog.confirm({
title: "提示",
message: "您确定保存吗?"
}).then(() => {
// 创建提交数据的副本
const submitData = {...this.formData};
// 如果有年级代码值,则使用代码值提交
if (this.formData.childrenGradeCode) {
submitData.childrenGrade = this.formData.childrenGradeCode;
}
this.$axios.post("/platform/childManage/write/save", { data: JSON.stringify(submitData) }).then(res => {
if (res.code === 0) {
this.$toast(res.msg)
this.$pjaxReplace('/platform/h5/childManage/mine')
}
})
})
},
onChildrenGradeConfirm(o) {
// 显示名称给用户看
this.$set(this.formData, "childrenGrade", o.text);
// 同时保存代码值用于提交到数据库
this.$set(this.formData, "childrenGradeCode", o.value);
this.showChildrenGradePicker = false;
},
// 入学年份确认选择
onYearConfirm(o) {
this.$set(this.formData, "childrenYear", o.value)
this.showYearPicker = false
},
// 初始化年份选项
initYearOptions() {
const currentYear = new Date().getFullYear();
const years = [];
// 生成近20年的年份选项
for (let i = currentYear - 20; i <= currentYear + 3; i++) {
years.push({ text: i + '年', value: i.toString() });
}
this.yearColumns = years;
},
// 性别确认选择
onSexConfirm(o) {
this.$set(this.formData, "childrenSex", o.value)
this.showSexPicker = false
},
// 出生年月确认选择
onBirthdayConfirm(value) {
try {
// 格式化日期为 YYYY-MM-DD
const year = value.getFullYear();
const month = String(value.getMonth() + 1).padStart(2, '0');
const day = String(value.getDate()).padStart(2, '0');
this.$set(this.formData, "childrenBirthday", year + "-" + month + "-" + day);
this.showBirthdayPicker = false;
} catch (error) {
this.$toast.fail('日期格式化失败');
console.error('日期格式化错误:', error);
}
},
async initDictOptions() {
// 就读年级
const childrenGradeData = await this.$businessTool.getDictOptions('CHILD_MANAGE_GRADE')
this.childrenGradeColumns = childrenGradeData.map(item => {
return {value: item.code, text: item.name}
})
// 初始化年份选项
this.initYearOptions();
},
init() {
this.bizId = GetQueryString("bizId")
if (this.bizId) {
this.$axios.post("/platform/childManage/write/findOne", { id: this.bizId }).then((res) => {
if (res.code === 0) {
this.formData = res.data
// 修复:正确处理年级显示
if (this.childrenGradeColumns.length > 0) {
const matchedGrade = this.childrenGradeColumns.find(item =>
item.value === this.formData.childrenGrade
)
if (matchedGrade) {
// 显示名称给用户看
this.$set(this.formData, "childrenGrade", matchedGrade.text)
// 保存代码值用于提交
this.$set(this.formData, "childrenGradeCode", matchedGrade.value)
}
}
}
})
} else {
const user = this.$store.state.user
this.$set(this.formData, "guardianUserId1", user.id)
this.$set(this.formData, "guardianUserName1", user.username)
this.$set(this.formData, "guardianLoginName1", user.loginname)
this.$set(this.formData, "guardianUnitId1", user.unit ? user.unit.id : null)
this.$set(this.formData, "guardianUnitName1", user.unit ? user.unit.name : null)
this.$set(this.formData, "guardianUnionId1", user.union ? user.union.id : null)
this.$set(this.formData, "guardianUnionName1", user.union ? user.union.name : null)
this.$set(this.formData, "guardianMobile1", user.mobile)
}
}
},
created() {
this.initDictOptions();
this.init();
}
});
</script>