xiangpei
2024-06-13 edb23abd0a3b49143b25a2e6f4043de2fb109513
src/views/class-management/Class.vue
@@ -1,24 +1,20 @@
<!-- 班级管理 -->
<template>
  <div class="c">
    <div class="bg">
      <div class="main">
        <div class="main-1">
          <div
            class="main-btn flex"
            style="justify-content:space-between"
          >
            <div>
  <div class="app-container">
    <div style="display: flex;flex-direction: row">
      <div style="margin-right:10px;">
              <el-button
                type="primary"
                size="small"
                style="margin-right:20px;"
                @click="handlerAdd"
              >新增班级</el-button>
        >新增班级
        </el-button>
            </div>
    <div>
            <el-form :inline="true" :model="searchForm" class="demo-form-inline">
              <el-form-item label="班级名称">
                <el-input v-model="searchForm.className" size="small" clearable @clear="page" placeholder="班级名称"></el-input>
          <el-input v-model="searchForm.className" size="small" clearable @clear="page"
                    placeholder="班级名称"></el-input>
              </el-form-item>
              <el-form-item label="班级状态">
                <el-select v-model="searchForm.status" size="small" clearable @change="page" placeholder="班级状态">
@@ -31,8 +27,7 @@
              </el-form-item>
            </el-form>
          </div>
          <div>
            <div>
    </div>
              <el-table
                v-loading="loading"
                :data="tableData"
@@ -93,28 +88,26 @@
                  fixed="right"
                >
                  <template slot-scope="scope">
                    <el-button v-if="scope.row.status !== '解散'" size="small" @click="handlerEdit(scope.row)" type="primary">修改</el-button>
          <el-button v-if="scope.row.status !== '解散'" size="small" @click="handlerEdit(scope.row)"
                     type="primary">修改
          </el-button>
                    <el-button v-if="scope.row.status !== '解散'" size="small" type="warning">班级验证</el-button>
                    <el-button v-if="scope.row.status !== '解散'" size="small" @click="handlerOpenNotify(scope.row)" type="info">通知</el-button>
                    <el-button v-if="scope.row.status !== '解散'" @click="studentManager(scope.row.id)" size="small" type="success">成员管理</el-button>
                    <el-button v-if="scope.row.status !== '解散'" @click="dissolution(scope.row.id)" type="danger" size="small">解散</el-button>
          <el-button v-if="scope.row.status !== '解散'" size="small" @click="handlerOpenNotify(scope.row)"
                     type="info">通知
          </el-button>
          <el-button v-if="scope.row.status !== '解散'" @click="studentManager(scope.row.id)" size="small"
                     type="success">成员管理
          </el-button>
          <el-button v-if="scope.row.status !== '解散'" @click="dissolution(scope.row.id)" type="danger"
                     size="small">解散
          </el-button>
                  </template>
                </el-table-column>
              </el-table>
            </div>
            <div
              class="flex"
              style="justify-content:center;margin-top:20px;"
            >
              <pagination v-show="total>0" :total="total" :page.sync="searchForm.pageIndex" :limit.sync="searchForm.pageSize"
      <pagination v-show="total>0" :total="total" :page.sync="searchForm.pageIndex"
                  :limit.sync="searchForm.pageSize"
                          @pagination="page"/>
            </div>
          </div>
        </div>
      </div>
    </div>
    <el-dialog
      title="班级通知"
      :visible.sync="notifyOpen"
@@ -181,9 +174,10 @@
</template>
<script>
import { addClasses, editClasses, getClassess, dissolution } from "@/api/classes";
import { addClassesNotify } from "@/api/classesNotify";
import Pagination from "@/components/Pagination"
import { addClasses, editClasses, getClassess, dissolution } from '@/api/classes'
import { addClassesNotify } from '@/api/classesNotify'
import Pagination from '@/components/Pagination'
export default {
  components: {Pagination},
  data() {
@@ -197,8 +191,8 @@
      loading: true,
      total: 0,
      open: false,
      title: "",
      value: "",
      title: '',
      value: '',
      searchForm: {
        className:'',
        status: '',
@@ -208,12 +202,12 @@
      },
      form: {
        id: null,
        className: "",
        status: "",
        verifyStatus: "",
        className: '',
        status: '',
        verifyStatus: '',
        startTime: null,
        endTime: null,
        remark: ""
        remark: ''
      },
      notifyRules: {
        notifyContent: [
@@ -233,10 +227,8 @@
          { required: true, message: '请选择班级结束时间', trigger: 'change' },
        ],
      },
      tableData: [
      ],
    };
      tableData: [],
    }
  },
  methods: {
    handlerOpenNotify(row) {
@@ -276,12 +268,12 @@
    resetForm() {
      this.form = {
        id: null,
        className: "",
        status: "",
        verifyStatus: "",
        className: '',
        status: '',
        verifyStatus: '',
        startTime: null,
        endTime: null,
        remark: ""
        remark: ''
      }
    },
    submitForm() {
@@ -289,23 +281,23 @@
        if (valid) {
          if (this.form.id) {
            editClasses(this.form).then(res => {
              this.$message.success("修改成功")
              this.$message.success('修改成功')
              this.resetForm()
              this.open = false
              this.page()
            })
          } else {
            addClasses(this.form).then(res => {
              this.$message.success("添加班级成功")
              this.$message.success('添加班级成功')
              this.resetForm()
              this.open = false
              this.page()
            })
          }
        } else {
          return false;
          return false
        }
      });
      })
    },
    dissolution(id) {
      dissolution(id).then(res => {
@@ -314,7 +306,7 @@
      })
    },
    handlerEdit(row) {
      this.form = row;
      this.form = row
      this.open = true
    },
    handleClose() {
@@ -323,30 +315,32 @@
    },
    handlerAdd() {
      this.open = true
      this.title = "新增班级"
      this.title = '新增班级'
    },
    // 跳转(查看班级人员情况)
    studentManager(classesId) {
      this.$router.push({ path: "class-management/Class-staff", query: { classesId: classesId } });
      this.$router.push({ path: '/classes/class-management/Class-staff', query: { classesId: classesId } })
    },
    // 返回上一个页面
    goBack() {
      this.$router.back();
      this.$router.back()
    },
  },
  created() {
    this.page()
  },
};
}
</script>
<style scoped lang="scss">
.flex {
  display: flex;
}
.mian-1-top {
  margin: 10px 0;
  align-items: center;
  & input {
    height: 30px;
    width: 200px;
@@ -359,10 +353,12 @@
    border-left: 5px solid rgb(16, 71, 247);
    padding-left: 10px;
    margin: 30px 0;
    & p {
      font-weight: 700;
    }
  }
  &-1 {
    width: 1227px;
    // height: 784px;
@@ -371,15 +367,18 @@
    border-radius: 10px;
    padding: 32px 40px;
  }
  &-btn {
    padding-bottom: 10px;
    border-bottom: 3px solid rgb(16, 71, 247);
  }
}
.deepBlue {
  background: rgb(16, 71, 247);
  color: white;
  border: none;
  &:hover {
    background-color: rgb(45, 92, 248);
  }