deason пре 4 година
родитељ
комит
8e63bc1ef7
1 измењених фајлова са 214 додато и 0 уклоњено
  1. 214 0
      src/modules/basic/view/sys_login_rule_list.vue

+ 214 - 0
src/modules/basic/view/sys_login_rule_list.vue

@@ -0,0 +1,214 @@
+<template>
+  <section style="margin-top: 0px;">
+    <el-form
+      :model="formSearch"
+      :inline="true"
+      style="border-bottom: 1px solid rgb(221, 221, 221);margin-bottom: 10px;"
+    >
+      <el-form-item label="学校">
+        <el-select
+          v-if="isSuperAdmin"
+          v-model="formSearch.rootOrgId"
+          placeholder="请选择"
+          filterable
+          clearable
+          size="small"
+          class="w180"
+        >
+          <el-option
+            v-for="item in rootOrgList"
+            :label="item.name"
+            :value="item.id"
+            :key="item.id"
+          />
+        </el-select>
+      </el-form-item>
+
+      <el-form-item label="规则类型">
+        <el-select
+          v-model="formSearch.type"
+          size="small"
+          class="w180"
+          placeholder="请选择"
+          @clear="clearTypeValue"
+          clearable
+        >
+          <el-option
+            v-for="item in ruleTypes"
+            :label="item.label"
+            :value="item.value"
+            :key="item.value"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+
+      <el-form-item>
+        <el-button
+          size="small"
+          type="primary"
+          icon="el-icon-search"
+          @click="doSearch(1)"
+          >查询
+        </el-button>
+
+        <el-button size="small" icon="el-icon-refresh" @click="resetSearchForm">
+          重置
+        </el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-table
+      v-loading="loading"
+      :data="tableData"
+      element-loading-text="数据加载中"
+      style="width:100%;"
+      border
+      stripe
+    >
+      <el-table-column label="ID" prop="id" width="80px" sortable />
+      <el-table-column label="学校ID" prop="rootOrgId" width="110px" sortable />
+      <el-table-column label="规则类型" prop="type" width="150px" sortable />
+      <el-table-column label="是否例外(白名单)" width="150px">
+        <template slot-scope="scope">{{
+          scope.row.allow ? "是" : "否"
+        }}</template>
+      </el-table-column>
+
+      <el-table-column label="创建时间" prop="creationTime" sortable />
+      <el-table-column label="更新时间" prop="updateTime" sortable />
+
+      <el-table-column label="操作" width="100px">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="danger"
+            icon="el-icon-delete"
+            @click="doDelete(scope.row)"
+            plain
+            >删除
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <div class="page pull-right">
+      <el-pagination
+        @current-change="handlePagerNo"
+        :current-page="formSearch.pageNo"
+        @size-change="handlePagerSize"
+        :page-size="formSearch.pageSize"
+        :page-sizes="[10, 20, 50, 100, 200, 300]"
+        :total="totalElements"
+        layout="total, sizes, prev, pager, next, jumper"
+      ></el-pagination>
+    </div>
+  </section>
+</template>
+
+<script>
+import { mapState } from "vuex";
+import { CORE_API } from "@/constants/constants.js";
+
+export default {
+  data() {
+    return {
+      formSearch: {
+        rootOrgId: null,
+        type: null,
+        pageNo: 1,
+        pageSize: 10
+      },
+      loading: false,
+      tableData: [],
+      totalElements: 0,
+      rootOrgList: [],
+      ruleTypes: [
+        { label: "考生登录", value: "STUDENT_LOGIN" },
+        { label: "考生端登录", value: "STUDENT_CLIENT_LOGIN" },
+        { label: "极验验证码登录", value: "GEETEST_LOGIN" }
+      ]
+    };
+  },
+  methods: {
+    getRootOrgList() {
+      if (this.isSuperAdmin) {
+        this.$httpWithMsg
+          .get(CORE_API + "/org/getRootOrgList")
+          .then(response => {
+            this.rootOrgList = response.data;
+          });
+      }
+    },
+    doSearch(pageNo) {
+      this.formSearch.pageNo = pageNo;
+
+      this.loading = true;
+      let url = CORE_API + "/sys/xlogin/rule/list";
+      this.$http.post(url, this.formSearch).then(
+        response => {
+          this.tableData = response.data.content;
+          this.totalElements = response.data.totalElements;
+          this.loading = false;
+        },
+        error => {
+          console.log(error);
+          this.loading = false;
+        }
+      );
+    },
+    doDelete(row) {
+      this.$confirm("确认删除当前规则?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        let url = CORE_API + "/sys/xlogin/rule/delete?ruleId=" + row.id;
+        this.$http.post(url).then(() => {
+          this.$notify({
+            type: "success",
+            message: "删除成功"
+          });
+          this.doSearch();
+        });
+      });
+    },
+    handlePagerNo(pageNo) {
+      this.doSearch(pageNo);
+    },
+    handlePagerSize(pageSize) {
+      this.formSearch.pageSize = pageSize;
+      this.doSearch(1);
+    },
+    clearTypeValue() {
+      this.formSearch.type = null;
+    },
+    resetSearchForm() {
+      this.formSearch.rootOrgId = null;
+      this.formSearch.type = null;
+      this.doSearch(1);
+    }
+  },
+  computed: {
+    ...mapState({ user: state => state.user }),
+    isSuperAdmin() {
+      return this.user.roleList.some(role => role.roleCode == "SUPER_ADMIN");
+    }
+  },
+  created() {
+    this.getRootOrgList();
+    this.doSearch(1);
+  }
+};
+</script>
+
+<style scoped>
+.page {
+  margin-top: 10px;
+}
+.pull-right {
+  float: right;
+}
+.w180 {
+  width: 180px;
+}
+</style>