家长信息功能,学生信息功能

This commit is contained in:
曹辉 2022-08-03 10:29:12 +08:00
parent 35a5a77690
commit 924f35d7cf
7 changed files with 511 additions and 83 deletions

View File

@ -5,7 +5,7 @@ VUE_APP_TITLE = 幼儿园体质检测管理系统
ENV = 'development' ENV = 'development'
# 若依管理系统/开发环境 # 若依管理系统/开发环境
VUE_APP_BASE_API = 'http://192.168.16.64:8080' VUE_APP_BASE_API = 'http://192.168.16.62:8080'
#'/dev-api' #'/dev-api'
# 路由懒加载 # 路由懒加载

View File

@ -0,0 +1,36 @@
import request from '@/utils/request'
// 查询家长信息列表
export function listParentInfo(query) {
return request({
url: '/system/parentInfo/list',
method: 'get',
params: query
})
}
// 查询家长信息详细
export function getParentInfo(id) {
return request({
url: '/system/parentInfo/' + id,
method: 'get'
})
}
// 修改家长信息
export function updateParentInfo(data) {
return request({
url: '/system/parentInfo/edit',
method: 'post',
data: data
})
}
// 删除家长信息
export function delParentInfo(id) {
return request({
url: '/system/parentInfo/' + id,
method: 'delete'
})
}

View File

@ -236,7 +236,6 @@ export default {
}, },
/** 转换部门数据结构 */ /** 转换部门数据结构 */
normalizer(node) { normalizer(node) {
// console.log(node);
if (node.children && !node.children.length) { if (node.children && !node.children.length) {
delete node.children; delete node.children;
} }
@ -249,13 +248,11 @@ export default {
/** 查询区域管理列表 */ /** 查询区域管理列表 */
getList() { getList() {
this.loading = true; this.loading = true;
// console.log(this.queryParams);
listArea(this.queryParams).then((response) => { listArea(this.queryParams).then((response) => {
// this.areaList = response.data.forEach((e) => { // this.areaList = response.data.forEach((e) => {
// e.code = Number(e.code); // e.code = Number(e.code);
// }); // });
this.areaList = this.handleTree(response.data); this.areaList = this.handleTree(response.data);
console.log(this.areaList);
this.loading = false; this.loading = false;
}); });
}, },
@ -291,10 +288,8 @@ export default {
}, },
/** 项目新增按钮操作 */ /** 项目新增按钮操作 */
handleAdd2(row) { handleAdd2(row) {
console.log(row);
this.reset(); this.reset();
this.form.parentId = row.id; this.form.parentId = row.id;
console.log(this.form);
this.open = true; this.open = true;
this.title = "添加区域管理"; this.title = "添加区域管理";
}, },
@ -303,7 +298,6 @@ export default {
this.reset(); this.reset();
listArea(this.queryParams).then((response) => { listArea(this.queryParams).then((response) => {
this.areaList = this.handleTree(response.data); this.areaList = this.handleTree(response.data);
// console.log(this.areaList);
}); });
this.open = true; this.open = true;
this.title = "添加区域管理"; this.title = "添加区域管理";
@ -312,7 +306,6 @@ export default {
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
this.form2.id = row.id; this.form2.id = row.id;
// console.log(this.form2);
const id = row.id || this.ids; const id = row.id || this.ids;
getArea(id).then((response) => { getArea(id).then((response) => {
response.data.code = Number(response.data.code); response.data.code = Number(response.data.code);
@ -323,7 +316,6 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
console.log(this.form);
this.form2.name = this.form.name; this.form2.name = this.form.name;
this.form2.code = this.form.code; this.form2.code = this.form.code;
this.form2.sort = this.form.sort; this.form2.sort = this.form.sort;

View File

@ -115,7 +115,7 @@
> >
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column <el-table-column
label="班级所在幼儿园" label="所属幼儿园"
align="center" align="center"
prop="kindergartenName" prop="kindergartenName"
/> />
@ -168,7 +168,7 @@
<!-- 添加或修改班级信息对话框 --> <!-- 添加或修改班级信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="所幼儿园" prop="kindergartenId"> <el-form-item label="所幼儿园" prop="kindergartenId">
<el-button <el-button
type="" type=""
@click="innerVisible = true" @click="innerVisible = true"
@ -229,6 +229,44 @@
:visible.sync="innerVisible" :visible.sync="innerVisible"
append-to-body append-to-body
> >
<el-form
:model="queryParams2"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="90px"
>
<el-form-item label="幼儿园名称" prop="kindergartenName">
<el-input
v-model="queryParams2.kindergartenName"
placeholder="请输入幼儿园名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="幼儿园地址" prop="kindergartenAddress">
<el-input
v-model="queryParams2.kindergartenAddress"
placeholder="请输入幼儿园地址"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery2"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<el-table <el-table
:data="kindergartenInfoList" :data="kindergartenInfoList"
@row-click="kindergartenNameclick" @row-click="kindergartenNameclick"
@ -292,8 +330,8 @@
<pagination <pagination
v-show="total2 > 0" v-show="total2 > 0"
:total="total2" :total="total2"
:page.sync="queryParams.pageNum" :page.sync="queryParams2.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams2.pageSize"
@pagination="getList" @pagination="getList"
/> />
</el-dialog> </el-dialog>
@ -369,6 +407,13 @@ export default {
className: null, className: null,
classType: null, classType: null,
}, },
queryParams2: {
pageNum: 1,
pageSize: 10,
kindergartenId: null,
className: null,
classType: null,
},
// //
form: {}, form: {},
// //
@ -401,8 +446,6 @@ export default {
this.kindergartenid2 = row.id; this.kindergartenid2 = row.id;
this.form.kindergartenId = row.id; this.form.kindergartenId = row.id;
this.innerVisible = false; this.innerVisible = false;
console.log(row);
console.log(this.form);
}, },
normalizer(node) { normalizer(node) {
if (node.children && !node.children.length) { if (node.children && !node.children.length) {
@ -420,15 +463,12 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
listKindergartenInfo(this.queryParams).then((response) => { listKindergartenInfo(this.queryParams2).then((response) => {
this.kindergartenInfoList = response.rows; this.kindergartenInfoList = response.rows;
this.total2 = response.total; this.total2 = response.total;
console.log(this.total2);
console.log(this.kindergartenInfoList);
}); });
listClassinfo(this.queryParams).then((response) => { listClassinfo(this.queryParams).then((response) => {
this.classinfoList = response.rows; this.classinfoList = response.rows;
console.log(this.classinfoList);
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
}); });
@ -437,12 +477,6 @@ export default {
this.dictValue2 = res.data[1].dictValue; this.dictValue2 = res.data[1].dictValue;
this.dictValue3 = res.data[2].dictValue; this.dictValue3 = res.data[2].dictValue;
this.dictValue4 = res.data[3].dictValue; this.dictValue4 = res.data[3].dictValue;
console.log(
this.dictValue1,
this.dictValue2,
this.dictValue3,
this.dictValue4
);
}); });
}, },
// //
@ -462,22 +496,21 @@ export default {
phone: undefined, phone: undefined,
kindergartenName: null, kindergartenName: null,
}; };
// this.form2 = {
// kindergartenId: null,
// className: null,
// classType: null,
// classTeacher: null,
// phone: null,
// kindergartenName: null,
// };
this.resetForm("form"); this.resetForm("form");
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery2() {
this.queryParams2.pageNum = 1;
listKindergartenInfo(this.queryParams2).then((response) => {
this.kindergartenInfoList = response.rows;
this.total2 = response.total;
});
},
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
listClassinfo(this.queryParams).then((response) => { listClassinfo(this.queryParams).then((response) => {
this.classinfoList = response.rows; this.classinfoList = response.rows;
console.log(this.classinfoList);
}); });
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
@ -489,7 +522,15 @@ export default {
className: null, className: null,
classType: null, classType: null,
}; };
this.queryParams2 = {
pageNum: 1,
pageSize: 10,
kindergartenId: null,
className: null,
classType: null,
};
this.handleQuery(); this.handleQuery();
this.handleQuery2();
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
@ -500,8 +541,6 @@ export default {
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
console.log(this.kindergartenName);
console.log(this.kindergartenid2);
this.open = true; this.open = true;
this.kindergartenid2 = ""; this.kindergartenid2 = "";
this.title = "添加班级信息"; this.title = "添加班级信息";
@ -509,11 +548,8 @@ export default {
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
console.log(row);
this.kindergartenid2 = row.kindergartenId; this.kindergartenid2 = row.kindergartenId;
this.reset(); this.reset();
console.log(this.kindergartenName);
console.log(this.kindergartenid2);
const id = row.id || this.ids; const id = row.id || this.ids;
getClassinfo(id).then((response) => { getClassinfo(id).then((response) => {
response.data.phone = Number(response.data.phone); response.data.phone = Number(response.data.phone);
@ -521,9 +557,6 @@ export default {
this.kindergartenName = this.form.kindergartenName; this.kindergartenName = this.form.kindergartenName;
this.open = true; this.open = true;
this.title = "修改班级信息"; this.title = "修改班级信息";
console.log(this.form);
// console.log(this.kindergartenName);
console.log(this.kindergartenid2);
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */

View File

@ -215,8 +215,12 @@
<el-form-item label="联系人" prop="contacts"> <el-form-item label="联系人" prop="contacts">
<el-input v-model="form.contacts" placeholder="请输入联系人姓名" /> <el-input v-model="form.contacts" placeholder="请输入联系人姓名" />
</el-form-item> </el-form-item>
<el-form-item label="联系人电话" prop=""> <el-form-item label="联系人电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入联系人电话" /> <el-input
v-model="form.phone"
maxlength="11"
placeholder="请输入联系人电话"
/>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -237,6 +241,18 @@ export default {
components: { Treeselect }, components: { Treeselect },
name: "areas", name: "areas",
data() { data() {
//
var checkMobile = (rule, value, cb) => {
//
const regMobile =
/^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/;
if (regMobile.test(value)) {
return cb();
}
cb(new Error("请输入合法的手机号"));
};
return { return {
// //
loading: true, loading: true,
@ -282,6 +298,14 @@ export default {
}, },
// //
rules: { rules: {
phone: [
{
required: true,
validator: checkMobile,
trigger: "blur",
message: "请输入正确的手机号",
},
],
code: [ code: [
{ required: true, message: "区域编码不能为空" }, { required: true, message: "区域编码不能为空" },
{ type: "number", message: "区域编码必须为数字值", trigger: "blur" }, { type: "number", message: "区域编码必须为数字值", trigger: "blur" },
@ -343,7 +367,6 @@ export default {
}; };
}, },
normalizer(node) { normalizer(node) {
// console.log(node);
if (node.children && !node.children.length) { if (node.children && !node.children.length) {
delete node.children; delete node.children;
} }
@ -357,10 +380,8 @@ export default {
getList() { getList() {
listArea(this.queryParams).then((response) => { listArea(this.queryParams).then((response) => {
this.areaList = this.handleTree(response.data); this.areaList = this.handleTree(response.data);
console.log(this.areaList);
}); });
this.loading = true; this.loading = true;
console.log(this.queryParams);
list(this.queryParams).then((response) => { list(this.queryParams).then((response) => {
this.List = this.handleTree(response.data); this.List = this.handleTree(response.data);
this.List2 = this.List; this.List2 = this.List;
@ -414,11 +435,9 @@ export default {
}, },
/** 项目新增按钮操作 */ /** 项目新增按钮操作 */
handleAdd2(row) { handleAdd2(row) {
console.log(row);
this.reset(); this.reset();
this.form.areaId = row.areaId; this.form.areaId = row.areaId;
this.form.parentId = row.id; this.form.parentId = row.id;
console.log(this.form);
this.open = true; this.open = true;
this.title = "添加区域管理"; this.title = "添加区域管理";
}, },
@ -427,12 +446,10 @@ export default {
this.reset(); this.reset();
list(this.queryParams).then((response) => { list(this.queryParams).then((response) => {
this.List = this.handleTree(response.data); this.List = this.handleTree(response.data);
console.log(this.List);
}); });
this.reset(); this.reset();
listArea(this.queryParams).then((response) => { listArea(this.queryParams).then((response) => {
this.areaList = this.handleTree(response.data); this.areaList = this.handleTree(response.data);
console.log(this.areaList);
}); });
this.open = true; this.open = true;
this.title = "添加区域管理"; this.title = "添加区域管理";
@ -442,14 +459,12 @@ export default {
this.reset(); this.reset();
const id = row.id || this.ids; const id = row.id || this.ids;
getinfo(id).then((response) => { getinfo(id).then((response) => {
console.log(response);
if (response.data.phone == 0) { if (response.data.phone == 0) {
response.data.phone = ""; response.data.phone = "";
} }
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = "修改区域管理"; this.title = "修改区域管理";
console.log(this.form);
}); });
}, },
@ -505,5 +520,4 @@ export default {
}; };
</script> </script>
<style lang='scss'> <style lang='scss'>
</style> </style>

View File

@ -220,7 +220,11 @@
<el-input v-model="form.contacts" placeholder="请输入联系人" /> <el-input v-model="form.contacts" placeholder="请输入联系人" />
</el-form-item> </el-form-item>
<el-form-item label="联系电话" prop="phone"> <el-form-item label="联系电话" prop="phone">
<el-input v-model="form.phone" placeholder="请输入联系电话" /> <el-input
v-model="form.phone"
maxlength="11"
placeholder="请输入联系电话"
/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -247,6 +251,18 @@ export default {
name: "KindergartenInfo", name: "KindergartenInfo",
components: { Treeselect }, components: { Treeselect },
data() { data() {
//
var checkMobile = (rule, value, cb) => {
//
const regMobile =
/^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/;
if (regMobile.test(value)) {
return cb();
}
cb(new Error("请输入合法的手机号"));
};
return { return {
// //
loading: true, loading: true,
@ -308,6 +324,14 @@ export default {
form: {}, form: {},
// //
rules: { rules: {
phone: [
{
required: true,
validator: checkMobile,
trigger: "blur",
message: "请输入正确的手机号",
},
],
kindergartenType: [{ required: true, message: "请选择幼儿园类型" }], kindergartenType: [{ required: true, message: "请选择幼儿园类型" }],
kindergartenAddress: [ kindergartenAddress: [
{ required: true, message: "请输入幼儿园地址", trigger: "blur" }, { required: true, message: "请输入幼儿园地址", trigger: "blur" },
@ -352,11 +376,9 @@ export default {
this.infolist = this.handleTree(response.data); this.infolist = this.handleTree(response.data);
this.infolist2 = response.data; this.infolist2 = response.data;
this.loading = false; this.loading = false;
console.log(this.infolist2);
}); });
listKindergartenInfo(this.queryParams).then((response) => { listKindergartenInfo(this.queryParams).then((response) => {
this.kindergartenInfoList = response.rows; this.kindergartenInfoList = response.rows;
console.log(this.kindergartenInfoList);
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
}); });
@ -365,8 +387,6 @@ export default {
this.type2 = res.data[1].dictValue; this.type2 = res.data[1].dictValue;
this.types[0].id = res.data[0].dictValue; this.types[0].id = res.data[0].dictValue;
this.types[1].id = res.data[1].dictValue; this.types[1].id = res.data[1].dictValue;
console.log(this.types);
console.log(this.queryParams);
}); });
}, },
// //
@ -389,10 +409,8 @@ export default {
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
console.log(this.queryParams);
listKindergartenInfo(this.queryParams).then((response) => { listKindergartenInfo(this.queryParams).then((response) => {
this.kindergartenInfoList = response.rows; this.kindergartenInfoList = response.rows;
console.log(this.kindergartenInfoList);
this.total = response.total; this.total = response.total;
}); });
}, },
@ -434,29 +452,23 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
console.log(this.form); this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.phone == "" || this.form.phone.toString().length == 11) { if (this.form.id != null) {
this.$refs["form"].validate((valid) => { updateKindergartenInfo(this.form).then((response) => {
if (valid) { this.$modal.msgSuccess("修改成功");
if (this.form.id != null) { this.open = false;
updateKindergartenInfo(this.form).then((response) => { this.getList();
this.$modal.msgSuccess("修改成功"); });
this.open = false; } else {
this.getList(); addKindergartenInfo(this.form).then((response) => {
}); this.$modal.msgSuccess("新增成功");
} else { this.open = false;
addKindergartenInfo(this.form).then((response) => { this.getList();
this.$modal.msgSuccess("新增成功"); });
this.open = false;
this.getList();
});
}
} }
}); }
} else { });
this.$message.error("请输入正确的手机号码");
}
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {

View File

@ -0,0 +1,341 @@
<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="100px"
>
<el-form-item label="家长姓名" prop="parentName">
<el-input
v-model="queryParams.parentName"
placeholder="请输入家长姓名"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="联系电话" prop="phone">
<el-input
v-model="queryParams.phone"
placeholder="请输入联系电话"
clearable
maxlength="11"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:parentInfo:edit']"
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:parentInfo:remove']"
>删除</el-button
>
</el-col>
<!-- <el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:parentInfo:export']"
>导出</el-button>
</el-col> -->
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
v-loading="loading"
:data="parentInfoList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="家长姓名" align="center" prop="parentName" />
<el-table-column label="家长性别" align="center" prop="parentSex">
<template slot-scope="scope">
{{ scope.row.parentSex == "MALE" ? "男" : "女" }}
</template>
</el-table-column>
<el-table-column label="联系电话" align="center" prop="phone" />
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime" />
<el-table-column label="修改人" align="center" prop="updateBy" />
<el-table-column label="修改时间" align="center" prop="updateTime" />
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:parentInfo:edit']"
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:parentInfo:remove']"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 修改家长信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="家长姓名" prop="parentName">
<el-input v-model="form.parentName" placeholder="请输入家长姓名" />
</el-form-item>
<el-form-item label="家长性别" prop="parentSex">
<el-radio-group v-model="form.parentSex">
<el-radio :label="male"></el-radio>
<el-radio :label="female"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="联系电话" prop="phone">
<el-input
maxlength="11"
v-model="form.phone"
placeholder="请输入联系电话"
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
listParentInfo,
getParentInfo,
delParentInfo,
updateParentInfo,
} from "@/api/system/parentInfo";
export default {
name: "ParentInfo",
data() {
//
var checkMobile = (rule, value, cb) => {
//
const regMobile =
/^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/;
if (regMobile.test(value)) {
return cb();
}
cb(new Error("请输入合法的手机号"));
};
return {
//
male: "MALE",
female: "FEMALE",
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
parentInfoList: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
parentName: null,
parentSex: null,
phone: null,
},
//
form: {},
//
rules: {
parentSex: [{ required: true, message: "请选择家长性别" }],
parentName: [{ required: true, message: "请输入家长姓名" }],
phone: [
{
required: true,
validator: checkMobile,
trigger: "blur",
message: "请输入正确的手机号",
},
],
},
};
},
created() {
this.getList();
},
methods: {
/** 查询家长信息列表 */
getList() {
this.loading = true;
listParentInfo(this.queryParams).then((response) => {
this.parentInfoList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
parentName: null,
parentSex: null,
phone: null,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
listParentInfo(this.queryParams).then((response) => {
this.parentInfoList = response.rows;
this.total = response.total;
this.loading = false;
});
this.queryParams.parentName = null;
this.queryParams.phone = null;
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加家长信息";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
getParentInfo(id).then((response) => {
this.form = response.data;
this.open = true;
this.title = "修改家长信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != null) {
updateParentInfo(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal
.confirm('是否确认删除家长信息编号为"' + ids + '"的数据项?')
.then(function () {
return delParentInfo(ids);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download(
"system/parentInfo/export",
{
...this.queryParams,
},
`parentInfo_${new Date().getTime()}.xlsx`
);
},
},
};
</script>