小组管理
parent
6c649ef46d
commit
5a8831b159
|
@ -3,7 +3,7 @@ import request from '@/utils/request'
|
|||
// 查询班级列表
|
||||
export function listClazz(query) {
|
||||
return request({
|
||||
url: '/system/clazz/list',
|
||||
url: '/manage/clazz/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
|
@ -12,7 +12,7 @@ export function listClazz(query) {
|
|||
// 查询班级详细
|
||||
export function getClazz(clazzId) {
|
||||
return request({
|
||||
url: '/system/clazz/' + clazzId,
|
||||
url: '/manage/clazz/' + clazzId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ export function getClazz(clazzId) {
|
|||
// 新增班级
|
||||
export function addClazz(data) {
|
||||
return request({
|
||||
url: '/system/clazz',
|
||||
url: '/manage/clazz',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
|
@ -29,7 +29,7 @@ export function addClazz(data) {
|
|||
// 修改班级
|
||||
export function updateClazz(data) {
|
||||
return request({
|
||||
url: '/system/clazz/'+data.clazzId,
|
||||
url: '/manage/clazz/'+data.clazzId,
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
|
@ -38,7 +38,7 @@ export function updateClazz(data) {
|
|||
// 删除班级
|
||||
export function delClazz(clazzId) {
|
||||
return request({
|
||||
url: '/system/clazz/' + clazzId,
|
||||
url: '/manage/clazz/' + clazzId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询小组列表
|
||||
export function listGroup(query) {
|
||||
return request({
|
||||
url: '/manage/group/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询小组详细
|
||||
export function getGroup(groupId) {
|
||||
return request({
|
||||
url: '/manage/group/' + groupId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增小组
|
||||
export function addGroup(data) {
|
||||
return request({
|
||||
url: '/manage/group',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改小组
|
||||
export function updateGroup(data) {
|
||||
return request({
|
||||
url: '/manage/group/'+data.groupId,
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除小组
|
||||
export function delGroup(groupId) {
|
||||
return request({
|
||||
url: '/manage/group/' + groupId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
//查询小组信息
|
||||
export function selectGroupList(clazzId) {
|
||||
return request({
|
||||
url: '/manage/group/' + clazzId,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
|
@ -31,7 +31,7 @@
|
|||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['system:clazz:add']"
|
||||
v-hasPermi="['manage:clazz:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
|
@ -42,7 +42,7 @@
|
|||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['system:clazz:edit']"
|
||||
v-hasPermi="['manage:clazz:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
|
@ -53,7 +53,7 @@
|
|||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['system:clazz:remove']"
|
||||
v-hasPermi="['manage:clazz:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
|
@ -63,7 +63,7 @@
|
|||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['system:clazz:export']"
|
||||
v-hasPermi="['manage:clazz:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
|
@ -81,15 +81,22 @@
|
|||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:clazz:edit']"
|
||||
v-hasPermi="['manage:clazz:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:clazz:remove']"
|
||||
v-hasPermi="['manage:clazz:remove']"
|
||||
>删除</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-more-outline"
|
||||
@click="queryGroupList(scope.row)"
|
||||
v-hasPermi="['manage:group:selectGroupsList']"
|
||||
>查询小组</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -117,11 +124,48 @@
|
|||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- Table -->
|
||||
<el-dialog title="小组信息" :visible.sync="dialogTableVisible">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleGroupsAdd"
|
||||
v-hasPermi="['manage:group:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-table :data="groupsList">
|
||||
<el-table-column property="groupId" label="编号" width="150"></el-table-column>
|
||||
<el-table-column property="groupName" label="小组名称" width="200"></el-table-column>
|
||||
<el-table-column property="clazzName" label="班级名称"></el-table-column>
|
||||
</el-table>
|
||||
|
||||
</el-dialog>
|
||||
|
||||
<!-- 添加或修改小组对话框 -->
|
||||
<el-dialog title="新增小组" :visible.sync="dialogFormVisible" width="500px" append-to-body>
|
||||
<el-form ref="form" :model="groupsForm" :rules="rules" label-width="80px">
|
||||
<el-form-item label="小组名称" prop="groupName">
|
||||
<el-input v-model="groupsForm.groupName" placeholder="请输入小组名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所属班级" prop="clazzId">
|
||||
<el-input v-model="groupsForm.clazzId" placeholder="请输入所属班级" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitGroupsForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listClazz, getClazz, delClazz, addClazz, updateClazz } from "@/api/system/clazz";
|
||||
import { listClazz, getClazz, delClazz, addClazz, updateClazz } from "@/api/manage/clazz";
|
||||
import {addGroup, selectGroupList} from "@/api/manage/group";
|
||||
|
||||
export default {
|
||||
name: "Clazz",
|
||||
|
@ -139,7 +183,7 @@ export default {
|
|||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 【请填写功能名称】表格数据
|
||||
// 班级表格数据
|
||||
clazzList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
|
@ -154,9 +198,16 @@ export default {
|
|||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
groupsForm: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
},
|
||||
//小组数据
|
||||
groupsList:[],
|
||||
dialogTableVisible: false,
|
||||
formLabelWidth: '120px',
|
||||
dialogFormVisible: false,
|
||||
|
||||
};
|
||||
},
|
||||
created() {
|
||||
|
@ -250,9 +301,35 @@ export default {
|
|||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('system/clazz/export', {
|
||||
this.download('manage/clazz/export', {
|
||||
...this.queryParams
|
||||
}, `clazz_${new Date().getTime()}.xlsx`)
|
||||
},
|
||||
/**
|
||||
* 查询小组信息
|
||||
*/
|
||||
queryGroupList(row){
|
||||
const clazzId = row.clazzId
|
||||
selectGroupList(clazzId).then(
|
||||
res=>{
|
||||
this.groupsList=res.data
|
||||
this.dialogTableVisible = true
|
||||
this.groupsForm.clazzId=clazzId
|
||||
}
|
||||
)
|
||||
},
|
||||
/** 新增小组按钮操作 */
|
||||
handleGroupsAdd() {
|
||||
this.dialogTableVisible = false
|
||||
this.dialogFormVisible = true
|
||||
},
|
||||
/**确认新增*/
|
||||
submitGroupsForm(){
|
||||
addGroup(this.groupsForm).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.dialogFormVisible = false
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
|
@ -1,18 +1,18 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="班级名称" prop="clazzName">
|
||||
<el-form-item label="小组名称" prop="groupName">
|
||||
<el-input
|
||||
v-model="queryParams.clazzName"
|
||||
placeholder="请输入班级名称"
|
||||
v-model="queryParams.groupName"
|
||||
placeholder="请输入小组名称"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="班级状态" prop="clazzState">
|
||||
<el-form-item label="所属班级" prop="clazzId">
|
||||
<el-input
|
||||
v-model="queryParams.clazzState"
|
||||
placeholder="请输入班级状态"
|
||||
v-model="queryParams.clazzId"
|
||||
placeholder="请输入所属班级"
|
||||
clearable
|
||||
@keyup.enter.native="handleQuery"
|
||||
/>
|
||||
|
@ -31,7 +31,7 @@
|
|||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['system:clazz:add']"
|
||||
v-hasPermi="['manage:group:add']"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
|
@ -42,7 +42,7 @@
|
|||
size="mini"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['system:clazz:edit']"
|
||||
v-hasPermi="['manage:group:edit']"
|
||||
>修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
|
@ -53,7 +53,7 @@
|
|||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['system:clazz:remove']"
|
||||
v-hasPermi="['manage:group:remove']"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
|
@ -63,17 +63,17 @@
|
|||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['system:clazz:export']"
|
||||
v-hasPermi="['manage:group:export']"
|
||||
>导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="clazzList" @selection-change="handleSelectionChange">
|
||||
<el-table v-loading="loading" :data="groupList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="班级编号" align="center" prop="clazzId" />
|
||||
<el-table-column label="班级名称" align="center" prop="clazzName" />
|
||||
<el-table-column label="班级状态" align="center" prop="clazzState" />
|
||||
<el-table-column label="小组编号" align="center" prop="groupId" />
|
||||
<el-table-column label="小组名称" align="center" prop="groupName" />
|
||||
<el-table-column label="所属班级" align="center" prop="clazzId" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
|
@ -81,14 +81,14 @@
|
|||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:clazz:edit']"
|
||||
v-hasPermi="['manage:group:edit']"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:clazz:remove']"
|
||||
v-hasPermi="['manage:group:remove']"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
@ -102,14 +102,14 @@
|
|||
@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="clazzName">
|
||||
<el-input v-model="form.clazzName" placeholder="请输入班级名称" />
|
||||
<el-form-item label="小组名称" prop="groupName">
|
||||
<el-input v-model="form.groupName" placeholder="请输入小组名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="班级状态" prop="clazzState">
|
||||
<el-input v-model="form.clazzState" placeholder="请输入班级状态" />
|
||||
<el-form-item label="所属班级" prop="clazzId">
|
||||
<el-input v-model="form.clazzId" placeholder="请输入所属班级" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
|
@ -121,10 +121,10 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { listClazz, getClazz, delClazz, addClazz, updateClazz } from "@/api/system/clazz";
|
||||
import { listGroup, getGroup, delGroup, addGroup, updateGroup } from "@/api/manage/group";
|
||||
|
||||
export default {
|
||||
name: "Clazz",
|
||||
name: "Group",
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
|
@ -139,8 +139,8 @@ export default {
|
|||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 班级表格数据
|
||||
clazzList: [],
|
||||
// 小组表格数据
|
||||
groupList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
|
@ -149,8 +149,8 @@ export default {
|
|||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
clazzName: null,
|
||||
clazzState: null
|
||||
groupName: null,
|
||||
clazzId: null
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
|
@ -163,11 +163,11 @@ export default {
|
|||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询班级列表 */
|
||||
/** 查询小组列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listClazz(this.queryParams).then(response => {
|
||||
this.clazzList = response.data.rows;
|
||||
listGroup(this.queryParams).then(response => {
|
||||
this.groupList = response.data.rows;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
|
@ -180,9 +180,9 @@ export default {
|
|||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
clazzId: null,
|
||||
clazzName: null,
|
||||
clazzState: null
|
||||
groupId: null,
|
||||
groupName: null,
|
||||
clazzId: null
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
|
@ -198,7 +198,7 @@ export default {
|
|||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.clazzId)
|
||||
this.ids = selection.map(item => item.groupId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
|
@ -206,30 +206,30 @@ export default {
|
|||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加班级";
|
||||
this.title = "添加小组";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const clazzId = row.clazzId || this.ids
|
||||
getClazz(clazzId).then(response => {
|
||||
const groupId = row.groupId || this.ids
|
||||
getGroup(groupId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改班级";
|
||||
this.title = "修改小组";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.clazzId != null) {
|
||||
updateClazz(this.form).then(response => {
|
||||
if (this.form.groupId != null) {
|
||||
updateGroup(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addClazz(this.form).then(response => {
|
||||
addGroup(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
|
@ -240,9 +240,9 @@ export default {
|
|||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const clazzIds = row.clazzId || this.ids;
|
||||
this.$modal.confirm('是否确认删除班级编号为"' + clazzIds + '"的数据项?').then(function() {
|
||||
return delClazz(clazzIds);
|
||||
const groupIds = row.groupId || this.ids;
|
||||
this.$modal.confirm('是否确认删除小组编号为"' + groupIds + '"的数据项?').then(function() {
|
||||
return delGroup(groupIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
|
@ -250,9 +250,9 @@ export default {
|
|||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('system/clazz/export', {
|
||||
this.download('manage/group/export', {
|
||||
...this.queryParams
|
||||
}, `clazz_${new Date().getTime()}.xlsx`)
|
||||
}, `group_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue