|
@@ -0,0 +1,301 @@
|
|
|
|
+<template>
|
|
|
|
+ <div class="menu6-2">
|
|
|
|
+ <cloudSearch :advance="false" @search="getList()" @reset="reset()">
|
|
|
|
+ <template slot="normal">
|
|
|
|
+ <div class="cloudSearch-item">
|
|
|
|
+ <div class="form-label">学校:</div>
|
|
|
|
+ <el-select v-model="listQuery.sid" filterable placeholder="请选择学校" @change="Schange($event, 'search')">
|
|
|
|
+ <el-option v-for="item in metaData['schools']" :key="item.value" :label="item.name" :value="item.id">
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="cloudSearch-item">
|
|
|
|
+ <div class="form-label">年级:</div>
|
|
|
|
+ <el-select v-model="listQuery.gid" filterable placeholder="请选择年级前先选学校" @change="Gchange($event, 'search')" :disabled="!listQuery.sid">
|
|
|
|
+ <el-option v-for="item in metaData['grades']" :key="item.value" :label="item.name" :value="item.id">
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="cloudSearch-item">
|
|
|
|
+ <div class="form-label">班级:</div>
|
|
|
|
+ <el-select v-model="listQuery.cid" filterable placeholder="请选择班级前先选年级" :disabled="!listQuery.gid">
|
|
|
|
+ <el-option v-for="item in metaData['classes']" :key="item.value" :label="item.name" :value="item.id">
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="cloudSearch-item">
|
|
|
|
+ <div class="form-label" style="width:90px">学生/学号:</div>
|
|
|
|
+ <el-input v-model="listQuery.op_content" placeholder="请输入学生/学号" size="small"></el-input>
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
|
|
+ </cloudSearch>
|
|
|
|
+ <cloudTable :table="dataTable" @refresh-table="getList" @handle="handle" @handleSelectionChange="selRow">
|
|
|
|
+ <!-- <template slot="tableBtn">
|
|
|
|
+ <el-button size="small" @click="batchDel()">批量删除</el-button>
|
|
|
|
+ <el-button class="add" size="small" @click="add('add')">新增班级</el-button>
|
|
|
|
+ </template> -->
|
|
|
|
+ </cloudTable>
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script>
|
|
|
|
+import { WrongApi } from "@/api/wrong";
|
|
|
|
+
|
|
|
|
+import { DictsApi } from "@/api/dict";
|
|
|
|
+import store from "@/store";
|
|
|
|
+
|
|
|
|
+export default {
|
|
|
|
+ name: "menu6-2",
|
|
|
|
+ metaDataType: ["schools", "grades"],
|
|
|
|
+ computed: {},
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ ctime: "",
|
|
|
|
+ listQuery: {
|
|
|
|
+ // op_user_realname: "",
|
|
|
|
+ // op_user_name: "",
|
|
|
|
+ // op_user_ip: "",
|
|
|
|
+ // op_content: "",
|
|
|
|
+ // ctime: "",
|
|
|
|
+ },
|
|
|
|
+ num: 10,
|
|
|
|
+ checked: true,
|
|
|
|
+ dataTable: {
|
|
|
|
+ hasSelect: true,
|
|
|
|
+ columns: [
|
|
|
|
+ {
|
|
|
|
+ label: "姓名",
|
|
|
|
+ prop: "student_name",
|
|
|
|
+ show: true,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ id: "1",
|
|
|
|
+ label: "学号",
|
|
|
|
+ prop: "student_sno",
|
|
|
|
+ show: true,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ id: "2",
|
|
|
|
+ label: "错题数",
|
|
|
|
+ prop: "total_errors",
|
|
|
|
+ show: true,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ id: "3",
|
|
|
|
+ label: "作业错题",
|
|
|
|
+ prop: "work_error_count",
|
|
|
|
+ show: true,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ id: "4",
|
|
|
|
+ label: "考试错题",
|
|
|
|
+ prop: "exam_error_count",
|
|
|
|
+ show: true,
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ id: "5",
|
|
|
|
+ label: "综合错题率",
|
|
|
|
+ prop: "error_ratio",
|
|
|
|
+ show: true,
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ data: [],
|
|
|
|
+ setColShow: false,
|
|
|
|
+ btnShow: true,
|
|
|
|
+ hasOperation: true,
|
|
|
|
+ operation: {
|
|
|
|
+ label: "操作",
|
|
|
|
+ width: "100",
|
|
|
|
+ className: "",
|
|
|
|
+ data: [
|
|
|
|
+ {
|
|
|
|
+ id: "1",
|
|
|
|
+ label: "查看",
|
|
|
|
+ FunName: "handleDetail",
|
|
|
|
+ size: "mini",
|
|
|
|
+ show: true,
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ },
|
|
|
|
+ paginationShow: true,
|
|
|
|
+ paginationOpt: {
|
|
|
|
+ pageIndex: 1,
|
|
|
|
+ pageRows: 10,
|
|
|
|
+ total: 10,
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ dialogType: "",
|
|
|
|
+ dialogConfig: {
|
|
|
|
+ top: "20vh",
|
|
|
|
+ width: "800px",
|
|
|
|
+ title: "新增班级",
|
|
|
|
+ center: true,
|
|
|
|
+ btnTxt: ["取消", "保存"],
|
|
|
|
+ },
|
|
|
|
+ dialogForm: {
|
|
|
|
+ sid: null,
|
|
|
|
+ gid: null,
|
|
|
|
+ amount: 1,
|
|
|
|
+ },
|
|
|
|
+ gradesBySchool: [],
|
|
|
|
+ gradesBySchoolF: [],
|
|
|
|
+ selRows: "",
|
|
|
|
+ };
|
|
|
|
+ },
|
|
|
|
+ created() {
|
|
|
|
+ // this.getList();
|
|
|
|
+ },
|
|
|
|
+ watch: {
|
|
|
|
+ ctime: function (val) {
|
|
|
|
+ if (val instanceof Array) {
|
|
|
|
+ this.listQuery.created_at = val.join(",");
|
|
|
|
+ } else {
|
|
|
|
+ this.listQuery.created_at = "";
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ getList() {
|
|
|
|
+ WrongApi.getListS(
|
|
|
|
+ Object.assign(this.listQuery, {
|
|
|
|
+ page: this.dataTable.paginationOpt.pageIndex,
|
|
|
|
+ size: this.dataTable.paginationOpt.pageRows,
|
|
|
|
+ })
|
|
|
|
+ ).then((res) => {
|
|
|
|
+ this.dataTable.data = res.data;
|
|
|
|
+ this.dataTable.paginationOpt.total = res.total;
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ add(type) {
|
|
|
|
+ if (type == "add") {
|
|
|
|
+ this.dialogType = "add";
|
|
|
|
+ this.dialogForm = {};
|
|
|
|
+ }
|
|
|
|
+ this.$refs.dialog.open((cancel) => {
|
|
|
|
+ ClassApi.add(this.dialogForm).then((res) => {
|
|
|
|
+ this.getList();
|
|
|
|
+ cancel();
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ async handle(name, index, row) {
|
|
|
|
+ let _this = this;
|
|
|
|
+ switch (name) {
|
|
|
|
+ case "handleDetail":
|
|
|
|
+ this.dialogType = "edit";
|
|
|
|
+ await ClassApi.getDetail(row.id).then((res) => {
|
|
|
|
+ this.dialogForm = {
|
|
|
|
+ sid: res.data.school_id,
|
|
|
|
+ gid: res.data.grade_id,
|
|
|
|
+ name: res.data.name,
|
|
|
|
+ id: res.data.id,
|
|
|
|
+ };
|
|
|
|
+ this.schoolChange();
|
|
|
|
+ });
|
|
|
|
+ await this.$refs.dialog.open((cancel) => {
|
|
|
|
+ ClassApi.edit(_this.dialogForm).then((res) => {
|
|
|
|
+ this.getList();
|
|
|
|
+ cancel();
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ break;
|
|
|
|
+ case "handleDel":
|
|
|
|
+ this.$confirm("此操作将删除班级, 是否继续?", "提示", {
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "warning",
|
|
|
|
+ })
|
|
|
|
+ .then(() => {
|
|
|
|
+ ClassApi.del(row.id).then((res) => {
|
|
|
|
+ this.$message({
|
|
|
|
+ type: "success",
|
|
|
|
+ message: "删除成功!",
|
|
|
|
+ });
|
|
|
|
+ this.getList();
|
|
|
|
+ });
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {
|
|
|
|
+ this.$message({
|
|
|
|
+ type: "info",
|
|
|
|
+ message: "已取消删除",
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ selRow(val) {
|
|
|
|
+ this.selRows = val.map((item) => item.id).join(",");
|
|
|
|
+ },
|
|
|
|
+ batchDel() {
|
|
|
|
+ if (!this.selRows) {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: "请选择需要批量操作的数据!",
|
|
|
|
+ type: "warning",
|
|
|
|
+ });
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ this.$confirm("此操作将删除班级, 是否继续?", "提示", {
|
|
|
|
+ confirmButtonText: "确定",
|
|
|
|
+ cancelButtonText: "取消",
|
|
|
|
+ type: "warning",
|
|
|
|
+ })
|
|
|
|
+ .then(() => {
|
|
|
|
+ ClassApi.del(this.selRows).then((res) => {
|
|
|
|
+ this.$message({
|
|
|
|
+ type: "success",
|
|
|
|
+ message: "删除成功!",
|
|
|
|
+ });
|
|
|
|
+ this.getList();
|
|
|
|
+ });
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {
|
|
|
|
+ this.$message({
|
|
|
|
+ type: "info",
|
|
|
|
+ message: "已取消删除",
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ beforeClose() {
|
|
|
|
+ this.resetForm();
|
|
|
|
+ },
|
|
|
|
+ resetForm() {},
|
|
|
|
+ reset() {
|
|
|
|
+ this.listQuery = {};
|
|
|
|
+ this.getList();
|
|
|
|
+ this.gradesBySchoolF = [];
|
|
|
|
+ this.ctime = "";
|
|
|
|
+ this.created_at = "";
|
|
|
|
+ // 这里可以写重置表单的实现
|
|
|
|
+ },
|
|
|
|
+ handleChange() {},
|
|
|
|
+ Schange(e, from) {
|
|
|
|
+ DictsApi.grades({ sid: e }).then((res) => {
|
|
|
|
+ this.metaData["grades"] = res.data;
|
|
|
|
+ if (from == "search") {
|
|
|
|
+ this.$set(this.listQuery, "cid", "");
|
|
|
|
+ this.$set(this.listQuery, "cid", "");
|
|
|
|
+ } else {
|
|
|
|
+ this.$set(this.dialogForm, "gid", "");
|
|
|
|
+ this.$set(this.dialogForm, "cid", "");
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ Gchange(e, from) {
|
|
|
|
+ DictsApi.classes({ gid: e }).then((res) => {
|
|
|
|
+ this.metaData["classes"] = res.data;
|
|
|
|
+ if (from == "search") {
|
|
|
|
+ this.$set(this.listQuery, "cid", "");
|
|
|
|
+ } else {
|
|
|
|
+ this.$set(this.dialogForm, "cid", "");
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+};
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style lang="scss" scoped>
|
|
|
|
+.menu6-2 {
|
|
|
|
+ display: block;
|
|
|
|
+}
|
|
|
|
+</style>
|