This commit is contained in:
曹辉 2023-07-13 18:01:18 +08:00
parent 079718538d
commit 1251cf0714
2 changed files with 38 additions and 69 deletions

View File

@ -26,16 +26,8 @@
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
type="primary" <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
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-item>
</el-form> </el-form>
@ -48,8 +40,7 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['system:parentInfo:add']" v-hasPermi="['system:parentInfo:add']"
>新增</el-button >新增</el-button>
>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -60,8 +51,7 @@
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['system:parentInfo:edit']" v-hasPermi="['system:parentInfo:edit']"
>修改</el-button >修改</el-button>
>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -72,8 +62,7 @@
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['system:parentInfo:remove']" v-hasPermi="['system:parentInfo:remove']"
>删除</el-button >删除</el-button>
>
</el-col> </el-col>
<!-- <el-col :span="1.5"> <!-- <el-col :span="1.5">
<el-button <el-button
@ -84,36 +73,23 @@
@click="handleExport" @click="handleExport"
v-hasPermi="['system:parentInfo:export']" v-hasPermi="['system:parentInfo:export']"
>导出</el-button> >导出</el-button>
</el-col> --> </el-col>-->
<right-toolbar <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row> </el-row>
<el-table <el-table v-loading="loading" :data="parentInfoList" @selection-change="handleSelectionChange">
v-loading="loading"
:data="parentInfoList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="家长姓名" align="center" prop="parentName" /> <el-table-column label="家长姓名" align="center" prop="parentName" />
<el-table-column label="家长性别" align="center" prop="parentSex"> <el-table-column label="家长性别" align="center" prop="parentSex">
<template slot-scope="scope"> <template slot-scope="scope">{{ scope.row.parentSex == "MALE" ? "男" : "女" }}</template>
{{ scope.row.parentSex == "MALE" ? "男" : "女" }}
</template>
</el-table-column> </el-table-column>
<el-table-column label="联系电话" align="center" prop="phone" /> <el-table-column label="联系电话" align="center" prop="phone" />
<el-table-column label="创建人" align="center" prop="createBy" /> <el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime" /> <el-table-column label="创建时间" align="center" prop="createTime" />
<!-- <el-table-column label="修改人" align="center" prop="updateBy" /> <!-- <el-table-column label="修改人" align="center" prop="updateBy" />
<el-table-column label="修改时间" align="center" prop="updateTime" /> --> <el-table-column label="修改时间" align="center" prop="updateTime" />-->
<el-table-column <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
@ -121,16 +97,14 @@
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['system:parentInfo:edit']" v-hasPermi="['system:parentInfo:edit']"
>修改</el-button >修改</el-button>
>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['system:parentInfo:remove']" v-hasPermi="['system:parentInfo:remove']"
>删除</el-button >删除</el-button>
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -147,7 +121,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="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="家长姓名" prop="parentName"> <el-form-item label="家长姓名" prop="parentName">
<el-input v-model="form.parentName" placeholder="请输入家长姓名" maxlength="10"/> <el-input v-model="form.parentName" placeholder="请输入家长姓名" maxlength="10" />
</el-form-item> </el-form-item>
<el-form-item label="家长性别" prop="parentSex"> <el-form-item label="家长性别" prop="parentSex">
@ -158,11 +132,7 @@
</el-form-item> </el-form-item>
<el-form-item label="联系电话" prop="phone"> <el-form-item label="联系电话" prop="phone">
<el-input <el-input maxlength="11" v-model="form.phone" placeholder="请输入联系电话" />
maxlength="11"
v-model="form.phone"
placeholder="请输入联系电话"
/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -179,7 +149,7 @@ import {
getParentInfo, getParentInfo,
delParentInfo, delParentInfo,
updateParentInfo, updateParentInfo,
addParentInfo, addParentInfo
} from "@/api/system/parentInfo"; } from "@/api/system/parentInfo";
export default { export default {
@ -188,8 +158,7 @@ export default {
// //
var checkMobile = (rule, value, cb) => { var checkMobile = (rule, value, cb) => {
// //
const regMobile = const regMobile = /^(0|86|17951)?(13[0-9]|16[0-9]|15[0-9]|17[0-9]|18[0-9]|14[0-9]|19[0-9])[0-9]{8}$/;
/^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57]|19[0-9])[0-9]{8}$/;
if (regMobile.test(value)) { if (regMobile.test(value)) {
return cb(); return cb();
} }
@ -223,7 +192,7 @@ export default {
pageSize: 10, pageSize: 10,
parentName: null, parentName: null,
parentSex: null, parentSex: null,
phone: null, phone: null
}, },
// //
form: {}, form: {},
@ -236,10 +205,10 @@ export default {
required: true, required: true,
validator: checkMobile, validator: checkMobile,
trigger: "blur", trigger: "blur",
message: "请输入正确的手机号", message: "请输入正确的手机号"
}, }
], ]
}, }
}; };
}, },
created() { created() {
@ -250,13 +219,13 @@ export default {
if (to.path == "/baseInfo/parentInfo") { if (to.path == "/baseInfo/parentInfo") {
this.getList(); this.getList();
} }
}, }
}, },
methods: { methods: {
/** 查询家长信息列表 */ /** 查询家长信息列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listParentInfo(this.queryParams).then((response) => { listParentInfo(this.queryParams).then(response => {
this.parentInfoList = response.rows; this.parentInfoList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
@ -273,14 +242,14 @@ export default {
id: null, id: null,
parentName: null, parentName: null,
parentSex: null, parentSex: null,
phone: null, phone: null
}; };
this.resetForm("form"); this.resetForm("form");
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
listParentInfo(this.queryParams).then((response) => { listParentInfo(this.queryParams).then(response => {
this.parentInfoList = response.rows; this.parentInfoList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
@ -295,7 +264,7 @@ export default {
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id); this.ids = selection.map(item => item.id);
this.single = selection.length !== 1; this.single = selection.length !== 1;
this.multiple = !selection.length; this.multiple = !selection.length;
}, },
@ -309,7 +278,7 @@ export default {
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const id = row.id || this.ids; const id = row.id || this.ids;
getParentInfo(id).then((response) => { getParentInfo(id).then(response => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = "修改家长信息"; this.title = "修改家长信息";
@ -317,16 +286,16 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate((valid) => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.id != null) { if (this.form.id != null) {
updateParentInfo(this.form).then((response) => { updateParentInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
}else { } else {
addParentInfo(this.form).then((response) => { addParentInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
@ -340,7 +309,7 @@ export default {
const ids = row.id || this.ids; const ids = row.id || this.ids;
this.$modal this.$modal
.confirm("是否确认删除该家长信息吗?") .confirm("是否确认删除该家长信息吗?")
.then(function () { .then(function() {
return delParentInfo(ids); return delParentInfo(ids);
}) })
.then(() => { .then(() => {
@ -354,11 +323,11 @@ export default {
this.download( this.download(
"system/parentInfo/export", "system/parentInfo/export",
{ {
...this.queryParams, ...this.queryParams
}, },
`parentInfo_${new Date().getTime()}.xlsx` `parentInfo_${new Date().getTime()}.xlsx`
); );
}, }
}, }
}; };
</script> </script>

View File

@ -760,7 +760,7 @@ export default {
// //
var checkMobile = (rule, value, cb) => { 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}$/; const regMobile = /^(0|86|17951)?(13[0-9]|16[0-9]|15[0-9]|17[0-9]|18[0-9]|14[0-9]|19[0-9])[0-9]{8}$/;
const reg = /^(0[0-9]{2,3}\-)([2-9][0-9]{6,7})+(\-[0-9]{1,4})?$/; const reg = /^(0[0-9]{2,3}\-)([2-9][0-9]{6,7})+(\-[0-9]{1,4})?$/;
const isTel = reg.test(value); const isTel = reg.test(value);