|
@@ -7,7 +7,6 @@
|
|
|
>
|
|
|
<el-form-item label="学校">
|
|
|
<el-select
|
|
|
- v-if="isSuperAdmin"
|
|
|
v-model="searchForm.rootOrgId"
|
|
|
placeholder="请选择"
|
|
|
filterable
|
|
@@ -71,9 +70,29 @@
|
|
|
size="small"
|
|
|
type="primary"
|
|
|
icon="el-icon-refresh"
|
|
|
+ v-show="false"
|
|
|
@click="doRefreshRule"
|
|
|
>刷新
|
|
|
</el-button>
|
|
|
+
|
|
|
+ <div class="page pull-right">
|
|
|
+ <el-form :inline="true">
|
|
|
+ <span
|
|
|
+ v-for="(item, index) in topLoginRuleList"
|
|
|
+ :key="index"
|
|
|
+ style="padding: 0px 15px"
|
|
|
+ >
|
|
|
+ <el-form-item :label="'开放' + getTypeTitle(item.type)">
|
|
|
+ <el-switch
|
|
|
+ v-model="switchModels[index].allow"
|
|
|
+ @change="updateTopRule(item.type, index)"
|
|
|
+ active-color="#13ce66"
|
|
|
+ inactive-color="#ff4949"
|
|
|
+ ></el-switch>
|
|
|
+ </el-form-item>
|
|
|
+ </span>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
|
|
|
<el-table
|
|
@@ -84,7 +103,6 @@
|
|
|
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="规则类型" width="150px">
|
|
@@ -110,7 +128,7 @@
|
|
|
icon="el-icon-edit"
|
|
|
@click="loginRuleDialogOpen(scope.row)"
|
|
|
plain
|
|
|
- >编辑
|
|
|
+ >修改
|
|
|
</el-button>
|
|
|
|
|
|
<el-button
|
|
@@ -138,7 +156,7 @@
|
|
|
</div>
|
|
|
|
|
|
<el-dialog
|
|
|
- title="规则新增"
|
|
|
+ :title="this.isCreate ? '规则新增' : '规则修改'"
|
|
|
width="380px"
|
|
|
:visible.sync="loginRuleDialog"
|
|
|
@close="loginRuleDialogClose"
|
|
@@ -148,13 +166,13 @@
|
|
|
ref="loginRuleForm"
|
|
|
:rules="formRules"
|
|
|
label-position="right"
|
|
|
- label-width="120px"
|
|
|
+ label-width="110px"
|
|
|
inline-message
|
|
|
>
|
|
|
- <el-form-item label="学校">
|
|
|
+ <el-form-item label="学校" prop="rootOrgId">
|
|
|
<el-select
|
|
|
- v-if="isSuperAdmin"
|
|
|
v-model="loginRuleForm.rootOrgId"
|
|
|
+ :disabled="!isCreate"
|
|
|
placeholder="请选择"
|
|
|
filterable
|
|
|
clearable
|
|
@@ -170,9 +188,10 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="规则类型">
|
|
|
+ <el-form-item label="规则类型" prop="type">
|
|
|
<el-select
|
|
|
v-model="loginRuleForm.type"
|
|
|
+ :disabled="!isCreate"
|
|
|
size="small"
|
|
|
class="w180"
|
|
|
placeholder="请选择"
|
|
@@ -187,15 +206,15 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="是否白名单">
|
|
|
- <el-radio-group v-model="loginRuleForm.allow">
|
|
|
- <el-radio label="true">是</el-radio>
|
|
|
- <el-radio label="false">否</el-radio>
|
|
|
+ <el-form-item label="是否白名单" prop="allow">
|
|
|
+ <el-radio-group v-model="loginRuleForm.allow" class="w180">
|
|
|
+ <el-radio :label="true">是</el-radio>
|
|
|
+ <el-radio :label="false">否</el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
|
|
|
<div style="text-align: center">
|
|
|
- <el-button type="primary" @click="doAddRule">确 定</el-button>
|
|
|
+ <el-button type="primary" @click="doSaveRule">确 定</el-button>
|
|
|
<el-button @click="loginRuleDialogClose">取 消</el-button>
|
|
|
</div>
|
|
|
</el-form>
|
|
@@ -226,20 +245,26 @@ export default {
|
|
|
{ label: "考生端登录", value: "STUDENT_CLIENT_LOGIN" },
|
|
|
{ label: "极验验证码登录", value: "GEETEST_LOGIN" }
|
|
|
],
|
|
|
+ isCreate: true,
|
|
|
loginRuleDialog: false,
|
|
|
loginRuleForm: {
|
|
|
rootOrgId: null,
|
|
|
type: null,
|
|
|
- allow: null
|
|
|
+ allow: false
|
|
|
},
|
|
|
formRules: {
|
|
|
rootOrgId: [
|
|
|
- { required: true, message: "学校不能为空!", trigger: "change" }
|
|
|
+ { required: true, message: "请选择学校!", trigger: "change" }
|
|
|
],
|
|
|
type: [
|
|
|
- { required: true, message: "规则类型不能为空!", trigger: "change" }
|
|
|
+ { required: true, message: "请选择规则类型!", trigger: "change" }
|
|
|
+ ],
|
|
|
+ allow: [
|
|
|
+ { required: true, message: "请选择是否白名单!", trigger: "change" }
|
|
|
]
|
|
|
- }
|
|
|
+ },
|
|
|
+ topLoginRuleList: [],
|
|
|
+ switchModels: []
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
@@ -252,6 +277,18 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
+ getTopLoginRuleList() {
|
|
|
+ this.$httpWithMsg
|
|
|
+ .post(CORE_API + "/sys/xlogin/rule/top/list")
|
|
|
+ .then(response => {
|
|
|
+ this.topLoginRuleList = response.data;
|
|
|
+
|
|
|
+ for (let n = 0; n < this.topLoginRuleList.length; n++) {
|
|
|
+ let value = this.topLoginRuleList[n].allow;
|
|
|
+ this.switchModels.push({ allow: value });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
doSearch(pageNo) {
|
|
|
this.searchForm.pageNo = pageNo;
|
|
|
|
|
@@ -271,30 +308,48 @@ export default {
|
|
|
},
|
|
|
loginRuleDialogOpen(row) {
|
|
|
if (row) {
|
|
|
+ this.isCreate = false;
|
|
|
this.loginRuleForm.rootOrgId = row.rootOrgId;
|
|
|
this.loginRuleForm.type = row.type;
|
|
|
this.loginRuleForm.allow = row.allow;
|
|
|
} else {
|
|
|
+ this.isCreate = true;
|
|
|
this.loginRuleForm.rootOrgId = null;
|
|
|
this.loginRuleForm.type = null;
|
|
|
- this.loginRuleForm.allow = null;
|
|
|
+ this.loginRuleForm.allow = false;
|
|
|
}
|
|
|
this.loginRuleDialog = true;
|
|
|
},
|
|
|
loginRuleDialogClose() {
|
|
|
this.loginRuleDialog = false;
|
|
|
},
|
|
|
- doAddRule() {
|
|
|
+ doSaveRule() {
|
|
|
this.$refs.loginRuleForm.validate(valid => {
|
|
|
if (!valid) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- this.loginRuleDialogClose();
|
|
|
+ let url = CORE_API + "/sys/xlogin/rule/save";
|
|
|
+ this.$http.post(url, this.loginRuleForm).then(() => {
|
|
|
+ this.$notify({
|
|
|
+ type: "success",
|
|
|
+ message: "保存成功"
|
|
|
+ });
|
|
|
+ this.doSearch();
|
|
|
+ this.loginRuleDialogClose();
|
|
|
+ });
|
|
|
});
|
|
|
},
|
|
|
- doEditRule() {
|
|
|
- this.loginRuleDialogClose();
|
|
|
+ updateTopRule(type, index) {
|
|
|
+ let allow = this.switchModels[index].allow;
|
|
|
+ let params = { rootOrgId: -1, type: type, allow: allow };
|
|
|
+ let url = CORE_API + "/sys/xlogin/rule/save";
|
|
|
+ this.$http.post(url, params).then(() => {
|
|
|
+ this.$notify({
|
|
|
+ type: "success",
|
|
|
+ message: "更新成功"
|
|
|
+ });
|
|
|
+ });
|
|
|
},
|
|
|
doDeleteRule(row) {
|
|
|
this.$confirm("确认删除?", "提示", {
|
|
@@ -359,6 +414,7 @@ export default {
|
|
|
},
|
|
|
created() {
|
|
|
this.getRootOrgList();
|
|
|
+ this.getTopLoginRuleList();
|
|
|
this.doSearch(1);
|
|
|
}
|
|
|
};
|