|
@@ -0,0 +1,487 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <splitpanes class="class-theme">
|
|
|
+ <!--部门数据-->
|
|
|
+ <pane size="16">
|
|
|
+ <el-col>
|
|
|
+ <div class="head-container">
|
|
|
+ <el-input v-model="deptName" placeholder="请输入部门名称" clearable prefix-icon="Search"
|
|
|
+ style="margin-bottom: 20px"/>
|
|
|
+ </div>
|
|
|
+ <div class="head-container">
|
|
|
+ <el-tree :data="deptOptions" :props="{ label: 'label', children: 'children' }"
|
|
|
+ :expand-on-click-node="false" :filter-node-method="filterNode" ref="deptTreeRef"
|
|
|
+ node-key="id" highlight-current default-expand-all @node-click="handleNodeClick"/>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ </pane>
|
|
|
+ <pane size="84">
|
|
|
+ <el-col>
|
|
|
+ <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch"
|
|
|
+ label-width="68px">
|
|
|
+ <el-form-item label="年级" prop="gradeYear">
|
|
|
+ <el-select v-model="queryParams.gradeYear" placeholder="请选择年级" clearable
|
|
|
+ style="width: 168px">
|
|
|
+ <el-option
|
|
|
+ v-for="dict in sys_user_grade"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="dict.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="名称" prop="name">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.name"
|
|
|
+ placeholder="请输入名称"
|
|
|
+ clearable
|
|
|
+ @keyup.enter="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="班主任" prop="teacherId">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.teacherId"
|
|
|
+ placeholder="请输入班主任"
|
|
|
+ clearable
|
|
|
+ @keyup.enter="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="班级编码" prop="classCode">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.classCode"
|
|
|
+ placeholder="请输入班级编码"
|
|
|
+ clearable
|
|
|
+ @keyup.enter="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
|
+ <el-button icon="Refresh" @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="Plus"
|
|
|
+ @click="handleAdd"
|
|
|
+ v-hasPermi="['platform:classmanager:add']"
|
|
|
+ >新增
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="success"
|
|
|
+ plain
|
|
|
+ icon="Edit"
|
|
|
+ :disabled="single"
|
|
|
+ @click="handleUpdate"
|
|
|
+ v-hasPermi="['platform:classmanager:edit']"
|
|
|
+ >修改
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ plain
|
|
|
+ icon="Delete"
|
|
|
+ :disabled="multiple"
|
|
|
+ @click="handleDelete"
|
|
|
+ v-hasPermi="['platform:classmanager:remove']"
|
|
|
+ >删除
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="warning"
|
|
|
+ plain
|
|
|
+ icon="Download"
|
|
|
+ @click="handleExport"
|
|
|
+ v-hasPermi="['platform:classmanager:export']"
|
|
|
+ >导出
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="success"
|
|
|
+ plain
|
|
|
+ icon="Edit"
|
|
|
+ @click="handleAddBach"
|
|
|
+ v-hasPermi="['platform:classmanager:bachadd']"
|
|
|
+ >批量增加
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+
|
|
|
+ <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-table v-loading="loading" :data="classmanagerList"
|
|
|
+ @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column type="selection" width="55" align="center"/>
|
|
|
+ <el-table-column label="年级" align="center" prop="gradeYear">
|
|
|
+ <template #default="scope">
|
|
|
+ <dict-tag :options="sys_user_grade" :value="scope.row.gradeYear"/>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="名称" align="center" prop="name"/>
|
|
|
+ <el-table-column label="班主任" align="center" prop="teacherId"/>
|
|
|
+ <el-table-column label="班级编码" align="center" prop="classCode"/>
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
|
|
+ v-hasPermi="['platform:classmanager:edit']">修改
|
|
|
+ </el-button>
|
|
|
+ <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
|
|
+ v-hasPermi="['platform:classmanager:remove']">删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <pagination
|
|
|
+ v-show="total>0"
|
|
|
+ :total="total"
|
|
|
+ v-model:page="queryParams.pageNum"
|
|
|
+ v-model:limit="queryParams.pageSize"
|
|
|
+ @pagination="getList"
|
|
|
+ />
|
|
|
+ </el-col>
|
|
|
+ </pane>
|
|
|
+ </splitpanes>
|
|
|
+ </el-row>
|
|
|
+ <!-- 添加或修改班级管理对话框 -->
|
|
|
+ <el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
|
|
+ <el-form ref="classmanagerRef" :model="form" :rules="rules" label-width="80px">
|
|
|
+ <el-form-item label="学校" prop="officeId">
|
|
|
+ <el-input v-model="form.officeName" placeholder="请选择学校" @click="handleOfficeComponentSelect"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="年级" prop="gradeYear">
|
|
|
+ <el-select v-model="form.gradeYear" placeholder="请选择年级">
|
|
|
+ <el-option
|
|
|
+ v-for="dict in sys_user_grade"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="parseInt(dict.value)"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="名称" prop="name">
|
|
|
+ <el-input v-model="form.name" placeholder="请输入名称"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="班主任" prop="teacherId">
|
|
|
+ <el-input v-model="form.teacherId" placeholder="请输入班主任"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="班级编码" prop="classCode">
|
|
|
+ <el-input v-model="form.classCode" placeholder="请输入班级编码"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <div class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
+ <el-button @click="cancel">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <office-component :isRadio="1" ref="office_component"
|
|
|
+ @onSelected="onOfficeComponentSelect"></office-component>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog title="批量增加班级" v-model="openBach" width="500px" append-to-body>
|
|
|
+ <el-form ref="classmanagerAddBachRef" :model="form" :rules="rules" label-width="80px">
|
|
|
+ <el-form-item label="学校" prop="officeId">
|
|
|
+ <el-input v-model="bachForm.officeName" placeholder="请选择学校" @click="handleOfficeComponentSelect_bach"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="年级" prop="gradeYear">
|
|
|
+ <el-select v-model="bachForm.gradeYear" placeholder="请选择年级">
|
|
|
+ <el-option
|
|
|
+ v-for="dict in sys_user_grade"
|
|
|
+ :key="dict.value"
|
|
|
+ :label="dict.label"
|
|
|
+ :value="parseInt(dict.value)"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="班级数量" prop="classCode">
|
|
|
+ <el-input-number v-model="bachForm.bachaddSum" :min="1" :max="100" placeholder="数量"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <office-component :isRadio="1" ref="office_component_bach"
|
|
|
+ @onSelected="onOfficeComponentSelect_bach"></office-component>
|
|
|
+ <template #footer>
|
|
|
+ <div class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="submitFormBach">确 定</el-button>
|
|
|
+ <el-button @click="cancelBach">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup name="Classmanager">
|
|
|
+ import {
|
|
|
+ listClassmanager,
|
|
|
+ listClassmanagerBy,
|
|
|
+ getClassmanager,
|
|
|
+ delClassmanager,
|
|
|
+ addClassmanager,
|
|
|
+ addClassmanagerBach,
|
|
|
+ updateClassmanager
|
|
|
+ } from "@/api/xjc-platform/classmanager"
|
|
|
+ import officeComponent from '@/views/xjccomponents/office_component.vue'
|
|
|
+
|
|
|
+
|
|
|
+ import {deptTreeSelect, deptTreeSelectDataScope} from "@/api/system/user"
|
|
|
+
|
|
|
+
|
|
|
+ const {proxy} = getCurrentInstance()
|
|
|
+ const {sys_user_grade} = proxy.useDict('sys_user_grade')
|
|
|
+
|
|
|
+ const classmanagerList = ref([])
|
|
|
+ const open = ref(false)
|
|
|
+ const openBach = ref(false)
|
|
|
+ const loading = ref(true)
|
|
|
+ const showSearch = ref(true)
|
|
|
+ const ids = ref([])
|
|
|
+ const single = ref(true)
|
|
|
+ const multiple = ref(true)
|
|
|
+ const total = ref(0)
|
|
|
+ const title = ref("")
|
|
|
+
|
|
|
+ const deptOptions = ref(undefined)
|
|
|
+ const enabledDeptOptions = ref(undefined)
|
|
|
+
|
|
|
+ const data = reactive({
|
|
|
+ form: {},
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ officeId: null,
|
|
|
+ gradeYear: null,
|
|
|
+ name: null,
|
|
|
+ teacherId: null,
|
|
|
+ classCode: null,
|
|
|
+ stageCode: null,
|
|
|
+ studentnumset: null,
|
|
|
+ samesubjects: null
|
|
|
+ },
|
|
|
+ rules: {},
|
|
|
+ //
|
|
|
+ bachForm: {}
|
|
|
+ })
|
|
|
+
|
|
|
+ const {queryParams, form, bachForm, rules} = toRefs(data)
|
|
|
+
|
|
|
+ const office_component = ref(null)
|
|
|
+ const office_component_bach = ref(null)
|
|
|
+
|
|
|
+ //显示学校选择器
|
|
|
+ function handleOfficeComponentSelect() {
|
|
|
+ office_component.value.setIsRadio("1")
|
|
|
+ office_component.value.show()
|
|
|
+ }
|
|
|
+
|
|
|
+ function onOfficeComponentSelect(row) {
|
|
|
+ data.form.officeId = row.id
|
|
|
+ data.form.officeName = row.name
|
|
|
+ }
|
|
|
+ //显示学校选择器_bach
|
|
|
+ function handleOfficeComponentSelect_bach() {
|
|
|
+ office_component_bach.value.setIsRadio("1")
|
|
|
+ office_component_bach.value.show()
|
|
|
+ }
|
|
|
+
|
|
|
+ function onOfficeComponentSelect_bach(row) {
|
|
|
+ data.bachForm.officeId = row.id
|
|
|
+ data.bachForm.officeName = row.name
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 查询班级管理列表 */
|
|
|
+ function getList() {
|
|
|
+ loading.value = true
|
|
|
+ listClassmanagerBy(queryParams.value).then(response => {
|
|
|
+ classmanagerList.value = response.rows
|
|
|
+ total.value = response.total
|
|
|
+ loading.value = false
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ // 取消按钮
|
|
|
+ function cancel() {
|
|
|
+ open.value = false
|
|
|
+ reset()
|
|
|
+ }
|
|
|
+
|
|
|
+ // 表单重置
|
|
|
+ function reset() {
|
|
|
+ form.value = {
|
|
|
+ id: null,
|
|
|
+ officeId: null,
|
|
|
+ gradeYear: null,
|
|
|
+ name: null,
|
|
|
+ teacherId: null,
|
|
|
+ classCode: null,
|
|
|
+ stageCode: null,
|
|
|
+ delFlag: null,
|
|
|
+ updateBy: null,
|
|
|
+ updateTime: null,
|
|
|
+ createBy: null,
|
|
|
+ createTime: null,
|
|
|
+ studentnumset: null,
|
|
|
+ samesubjects: null
|
|
|
+ }
|
|
|
+ proxy.resetForm("classmanagerRef")
|
|
|
+ //
|
|
|
+ }
|
|
|
+
|
|
|
+ function resetAddBach() {
|
|
|
+ bachForm.value = {
|
|
|
+ bachaddSum: 1
|
|
|
+ }
|
|
|
+ proxy.resetForm("classmanagerAddBachRef")
|
|
|
+ //
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 搜索按钮操作 */
|
|
|
+ function handleQuery() {
|
|
|
+ queryParams.value.pageNum = 1
|
|
|
+ getList()
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 重置按钮操作 */
|
|
|
+ function resetQuery() {
|
|
|
+ proxy.resetForm("queryRef")
|
|
|
+ handleQuery()
|
|
|
+ }
|
|
|
+
|
|
|
+ // 多选框选中数据
|
|
|
+ function handleSelectionChange(selection) {
|
|
|
+ ids.value = selection.map(item => item.id)
|
|
|
+ single.value = selection.length != 1
|
|
|
+ multiple.value = !selection.length
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 新增按钮操作 */
|
|
|
+ function handleAdd() {
|
|
|
+ reset()
|
|
|
+ open.value = true
|
|
|
+ title.value = "添加班级管理"
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /** 修改按钮操作 */
|
|
|
+ function handleUpdate(row) {
|
|
|
+ reset()
|
|
|
+ const _id = row.id || ids.value
|
|
|
+ getClassmanager(_id).then(response => {
|
|
|
+ form.value = response.data
|
|
|
+ open.value = true
|
|
|
+ title.value = "修改班级管理"
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 提交按钮 */
|
|
|
+ function submitForm() {
|
|
|
+ proxy.$refs["classmanagerRef"].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ if (form.value.id != null) {
|
|
|
+ updateClassmanager(form.value).then(response => {
|
|
|
+ proxy.$modal.msgSuccess("修改成功")
|
|
|
+ open.value = false
|
|
|
+ getList()
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ addClassmanager(form.value).then(response => {
|
|
|
+ proxy.$modal.msgSuccess("新增成功")
|
|
|
+ open.value = false
|
|
|
+ getList()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /** 删除按钮操作 */
|
|
|
+ function handleDelete(row) {
|
|
|
+ const _ids = row.id || ids.value
|
|
|
+ proxy.$modal.confirm('是否确认删除班级管理编号为"' + _ids + '"的数据项?').then(function () {
|
|
|
+ return delClassmanager(_ids)
|
|
|
+ }).then(() => {
|
|
|
+ getList()
|
|
|
+ proxy.$modal.msgSuccess("删除成功")
|
|
|
+ }).catch(() => {
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 导出按钮操作 */
|
|
|
+ function handleExport() {
|
|
|
+ proxy.download('platform/classmanager/export', {
|
|
|
+ ...queryParams.value
|
|
|
+ }, `classmanager_${new Date().getTime()}.xlsx`)
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 查询部门下拉树结构 */
|
|
|
+ function getDeptTree() {
|
|
|
+ deptTreeSelectDataScope().then(response => {
|
|
|
+ deptOptions.value = response.data
|
|
|
+ enabledDeptOptions.value = filterDisabledDept(JSON.parse(JSON.stringify(response.data)))
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 过滤禁用的部门 */
|
|
|
+ function filterDisabledDept(deptList) {
|
|
|
+ return deptList.filter(dept => {
|
|
|
+ if (dept.disabled) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (dept.children && dept.children.length) {
|
|
|
+ dept.children = filterDisabledDept(dept.children)
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 节点单击事件 */
|
|
|
+ function handleNodeClick(data) {
|
|
|
+ queryParams.value.deptId = data.id
|
|
|
+ handleQuery()
|
|
|
+ }
|
|
|
+
|
|
|
+ onMounted(() => {
|
|
|
+ getDeptTree()
|
|
|
+ getList()
|
|
|
+ })
|
|
|
+
|
|
|
+ //批量增加
|
|
|
+ function handleAddBach() {
|
|
|
+ resetAddBach()
|
|
|
+ openBach.value = true
|
|
|
+ }
|
|
|
+
|
|
|
+ //批量增加
|
|
|
+ function submitFormBach() {
|
|
|
+ addClassmanagerBach(bachForm.value).then(response => {
|
|
|
+ proxy.$modal.msgSuccess("新增成功")
|
|
|
+ openBach.value = false
|
|
|
+ getList()
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ function cancelBach() {
|
|
|
+ openBach.value = false
|
|
|
+ resetAddBach()
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+</script>
|
|
|
+
|
|
|
+<style>
|
|
|
+ .class-theme {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ }
|
|
|
+</style>
|