班级信息管理
This commit is contained in:
parent
78fa8f95e5
commit
35a5a77690
44
src/api/system/classinfo.js
Normal file
44
src/api/system/classinfo.js
Normal file
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询班级信息列表
|
||||
export function listClassinfo(query) {
|
||||
return request({
|
||||
url: '/system/classInfo/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询班级信息详细
|
||||
export function getClassinfo(id) {
|
||||
return request({
|
||||
url: '/system/classInfo/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增班级信息
|
||||
export function addClassinfo(data) {
|
||||
return request({
|
||||
url: '/system/classInfo/add',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改班级信息
|
||||
export function updateClassinfo(data) {
|
||||
return request({
|
||||
url: '/system/classInfo/edit',
|
||||
method: 'POST',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除班级信息
|
||||
export function delClassinfo(id) {
|
||||
return request({
|
||||
url: '/system/classInfo/' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
576
src/views/system/classinfo/index.vue
Normal file
576
src/views/system/classinfo/index.vue
Normal file
@ -0,0 +1,576 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form
|
||||
:model="queryParams"
|
||||
ref="queryForm"
|
||||
size="small"
|
||||
:inline="true"
|
||||
v-show="showSearch"
|
||||
label-width="90px"
|
||||
>
|
||||
<el-form-item label="所属幼儿园" prop="kindergartenId">
|
||||
<treeselect
|
||||
:normalizer="normalizer"
|
||||
:options="kindergartenInfoList"
|
||||
placeholder="请选择所属幼儿园"
|
||||
v-model="queryParams.kindergartenId"
|
||||
style="width: 208px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="班级名称" prop="className">
|
||||
<el-input
|
||||
v-model="queryParams.className"
|
||||
placeholder="请输入班级名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="班主任姓名" prop="classTeacher">
|
||||
<el-input
|
||||
v-model="queryParams.classTeacher"
|
||||
placeholder="请输入班主任姓名"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系电话" prop="phone">
|
||||
<el-input
|
||||
v-model="queryParams.phone"
|
||||
placeholder="请输入联系电话"
|
||||
clearable
|
||||
@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="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['system:classinfo:add']"
|
||||
>新增</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="el-icon-edit"
|
||||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['system:classinfo: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:classinfo: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:classinfo:export']"
|
||||
>导出</el-button
|
||||
>
|
||||
</el-col> -->
|
||||
<right-toolbar
|
||||
:showSearch.sync="showSearch"
|
||||
@queryTable="getList"
|
||||
></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
v-loading="loading"
|
||||
:data="classinfoList"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column
|
||||
label="班级所在幼儿园"
|
||||
align="center"
|
||||
prop="kindergartenName"
|
||||
/>
|
||||
<el-table-column label="班级名称" align="center" prop="className" />
|
||||
<el-table-column label="班级类型" align="center" prop="classType">
|
||||
<template slot-scope="scope">
|
||||
<!-- {{scope.row.classType}} -->
|
||||
{{ scope.row.classType == dictValue1 ? "大班" : "" }}
|
||||
{{ scope.row.classType == dictValue2 ? "中班" : "" }}
|
||||
{{ scope.row.classType == dictValue3 ? "小班" : "" }}
|
||||
{{ scope.row.classType == dictValue4 ? "毕业" : "" }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="班主任姓名" align="center" prop="classTeacher" />
|
||||
<el-table-column label="联系电话" align="center" prop="phone" />
|
||||
<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:classinfo:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:classinfo: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="100px">
|
||||
<el-form-item label="所在幼儿园" prop="kindergartenId">
|
||||
<el-button
|
||||
type=""
|
||||
@click="innerVisible = true"
|
||||
style="
|
||||
width: 360px;
|
||||
text-align: left;
|
||||
height: 36px;
|
||||
color: #c0c4cc;
|
||||
padding-left: -10px;
|
||||
"
|
||||
v-if="kindergartenName == '请选择所在幼儿园'"
|
||||
>{{ kindergartenName }}</el-button
|
||||
>
|
||||
|
||||
<el-button
|
||||
type=""
|
||||
@click="innerVisible = true"
|
||||
style="width: 360px; text-align: left; height: 36px"
|
||||
v-else
|
||||
>{{ kindergartenName }}</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
<el-form-item label="班级名称" prop="className">
|
||||
<el-input v-model="form.className" placeholder="请输入班级名称" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="班级类型" prop="classType">
|
||||
<el-radio-group v-model="form.classType">
|
||||
<el-radio :label="dictValue1">大班</el-radio>
|
||||
<el-radio :label="dictValue2">中班</el-radio>
|
||||
<el-radio :label="dictValue3">小班</el-radio>
|
||||
<el-radio :label="dictValue4">毕业</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="班主任姓名" prop="classTeacher">
|
||||
<el-input
|
||||
v-model="form.classTeacher"
|
||||
placeholder="请输入班主任姓名"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="联系电话" prop="phone">
|
||||
<el-input
|
||||
v-model.number="form.phone"
|
||||
placeholder="请输入联系电话"
|
||||
maxlength="11"
|
||||
/>
|
||||
</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
|
||||
width="850px"
|
||||
title="选择所属幼儿园"
|
||||
:visible.sync="innerVisible"
|
||||
append-to-body
|
||||
>
|
||||
<el-table
|
||||
:data="kindergartenInfoList"
|
||||
@row-click="kindergartenNameclick"
|
||||
>
|
||||
<el-table-column label="请选择" width="70" align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
type="primary"
|
||||
v-if="kindergartenid2 == scope.row.id"
|
||||
style="width: 15px; height: 15px"
|
||||
circle
|
||||
@click="kindergartenNameclick(scope.row)"
|
||||
></el-button>
|
||||
|
||||
<el-button
|
||||
v-else
|
||||
style="width: 15px; height: 15px"
|
||||
circle
|
||||
@click="kindergartenNameclick(scope.row)"
|
||||
></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column
|
||||
property="kindergartenName"
|
||||
label="幼儿园名字"
|
||||
width="150"
|
||||
align="center"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
property="kindergartenAddress"
|
||||
label="幼儿园地址"
|
||||
width="150"
|
||||
align="center"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="幼儿园所在组织"
|
||||
align="center"
|
||||
prop="organizeName"
|
||||
width="150"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
property="contacts"
|
||||
label="联系人"
|
||||
width="150"
|
||||
align="center"
|
||||
>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
property="phone"
|
||||
label="联系电话"
|
||||
width="150"
|
||||
align="center"
|
||||
>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total2 > 0"
|
||||
:total="total2"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</el-dialog>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
listClassinfo,
|
||||
getClassinfo,
|
||||
delClassinfo,
|
||||
addClassinfo,
|
||||
updateClassinfo,
|
||||
} from "@/api/system/classinfo";
|
||||
import {
|
||||
listKindergartenInfo,
|
||||
tKindergartenInfo,
|
||||
} from "@/api/system/kindergartenInfo";
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
export default {
|
||||
components: { Treeselect },
|
||||
name: "Classinfo",
|
||||
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 {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
innerVisible: false,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
total2: 0,
|
||||
// 班级信息表格数据
|
||||
classinfoList: [],
|
||||
ClassType: "class_type",
|
||||
kindergartenInfoList: [],
|
||||
dictValue1: "",
|
||||
dictValue2: "",
|
||||
dictValue3: "",
|
||||
dictValue4: "",
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
kindergartenName: "请选择所在幼儿园",
|
||||
kindergartenid: "",
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
kindergartenId: null,
|
||||
className: null,
|
||||
classType: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
kindergartenId: [{ required: true, message: "请选择所属幼儿园" }],
|
||||
className: [
|
||||
{ required: true, message: "请输入班级名称", trigger: "blur" },
|
||||
],
|
||||
classType: [{ required: true, message: "请选择幼儿园类型" }],
|
||||
classTeacher: [
|
||||
{ required: true, message: "请输入班主任姓名", trigger: "blur" },
|
||||
],
|
||||
phone: [
|
||||
{
|
||||
required: true,
|
||||
validator: checkMobile,
|
||||
trigger: "blur",
|
||||
message: "请输入正确的手机号",
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
kindergartenNameclick(row) {
|
||||
this.kindergartenName = row.kindergartenName;
|
||||
this.kindergartenid2 = row.id;
|
||||
this.form.kindergartenId = row.id;
|
||||
this.innerVisible = false;
|
||||
console.log(row);
|
||||
console.log(this.form);
|
||||
},
|
||||
normalizer(node) {
|
||||
if (node.children && !node.children.length) {
|
||||
delete node.children;
|
||||
}
|
||||
return {
|
||||
kindergartenId: node.id,
|
||||
label: node.kindergartenName,
|
||||
children: node.children,
|
||||
};
|
||||
},
|
||||
//信息表ID
|
||||
|
||||
/** 查询班级信息列表 */
|
||||
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listKindergartenInfo(this.queryParams).then((response) => {
|
||||
this.kindergartenInfoList = response.rows;
|
||||
this.total2 = response.total;
|
||||
console.log(this.total2);
|
||||
console.log(this.kindergartenInfoList);
|
||||
});
|
||||
listClassinfo(this.queryParams).then((response) => {
|
||||
this.classinfoList = response.rows;
|
||||
console.log(this.classinfoList);
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
tKindergartenInfo(this.ClassType).then((res) => {
|
||||
this.dictValue1 = res.data[0].dictValue;
|
||||
this.dictValue2 = res.data[1].dictValue;
|
||||
this.dictValue3 = res.data[2].dictValue;
|
||||
this.dictValue4 = res.data[3].dictValue;
|
||||
console.log(
|
||||
this.dictValue1,
|
||||
this.dictValue2,
|
||||
this.dictValue3,
|
||||
this.dictValue4
|
||||
);
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
this.kindergartenName = "请选择所在幼儿园";
|
||||
this.kindergartenid2 = "";
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
kindergartenId: null,
|
||||
className: null,
|
||||
classType: null,
|
||||
classTeacher: null,
|
||||
phone: undefined,
|
||||
kindergartenName: null,
|
||||
};
|
||||
// this.form2 = {
|
||||
// kindergartenId: null,
|
||||
// className: null,
|
||||
// classType: null,
|
||||
// classTeacher: null,
|
||||
// phone: null,
|
||||
// kindergartenName: null,
|
||||
// };
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
listClassinfo(this.queryParams).then((response) => {
|
||||
this.classinfoList = response.rows;
|
||||
console.log(this.classinfoList);
|
||||
});
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.queryParams = {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
kindergartenId: null,
|
||||
className: null,
|
||||
classType: null,
|
||||
};
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map((item) => item.id);
|
||||
this.single = selection.length !== 1;
|
||||
this.multiple = !selection.length;
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
console.log(this.kindergartenName);
|
||||
console.log(this.kindergartenid2);
|
||||
this.open = true;
|
||||
this.kindergartenid2 = "";
|
||||
this.title = "添加班级信息";
|
||||
this.kindergartenName = "请选择所在幼儿园";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
console.log(row);
|
||||
this.kindergartenid2 = row.kindergartenId;
|
||||
this.reset();
|
||||
console.log(this.kindergartenName);
|
||||
console.log(this.kindergartenid2);
|
||||
const id = row.id || this.ids;
|
||||
getClassinfo(id).then((response) => {
|
||||
response.data.phone = Number(response.data.phone);
|
||||
this.form = response.data;
|
||||
this.kindergartenName = this.form.kindergartenName;
|
||||
this.open = true;
|
||||
this.title = "修改班级信息";
|
||||
console.log(this.form);
|
||||
// console.log(this.kindergartenName);
|
||||
console.log(this.kindergartenid2);
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate((valid) => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateClassinfo(this.form).then((response) => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addClassinfo(this.form).then((response) => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
this.kindergartenid2 = "";
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal
|
||||
.confirm("是否确认删除数据?")
|
||||
.then(function () {
|
||||
return delClassinfo(ids);
|
||||
})
|
||||
.then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
// handleExport() {
|
||||
// this.download(
|
||||
// "system/classinfo/export",
|
||||
// {
|
||||
// ...this.queryParams,
|
||||
// },
|
||||
// `classinfo_${new Date().getTime()}.xlsx`
|
||||
// );
|
||||
// },
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@ -197,7 +197,6 @@
|
||||
v-model="form.organizeId"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="幼儿园名称" prop="kindergartenName">
|
||||
<el-input
|
||||
v-model="form.kindergartenName"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user