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

View File

@ -760,7 +760,7 @@ export default {
//
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 isTel = reg.test(value);