deason 4 年之前
父節點
當前提交
3336c7cd5d
共有 1 個文件被更改,包括 13 次插入1 次删除
  1. 13 1
      src/modules/basic/view/sys_login_rule_list.vue

+ 13 - 1
src/modules/basic/view/sys_login_rule_list.vue

@@ -79,12 +79,13 @@
       <el-form :inline="true">
         <span
           v-for="(item, index) in topLoginRuleList"
-          :key="item"
+          :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>
@@ -338,6 +339,17 @@ export default {
         });
       });
     },
+    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("确认删除?", "提示", {
         confirmButtonText: "确定",