Răsfoiți Sursa

学习中心重置密码

WANG 5 ani în urmă
părinte
comite
20cd9aeabb
1 a modificat fișierele cu 122 adăugiri și 0 ștergeri
  1. 122 0
      src/modules/examwork/view/student.vue

+ 122 - 0
src/modules/examwork/view/student.vue

@@ -140,9 +140,62 @@
         >
           禁用
         </el-button>
+        <el-button
+          v-if="rolePrivileges.reset_student_password"
+          size="small"
+          type="danger"
+          icon="el-icon-refresh"
+          @click="resetPasswordByOrgId()"
+          >重置学习中心所有学生密码
+        </el-button>
 
         <div style="width: 100%;margin-bottom: 10px;"></div>
 
+        <!-- 重置学习中心所有学生密码-->
+        <el-dialog
+          title="重置学习中心所有学生密码"
+          width="500px"
+          :visible.sync="resetPasswordByOrgIdDialog"
+        >
+          <el-form
+            :model="resetPasswordByOrgIdForm"
+            :inline="true"
+            ref="resetPasswordByOrgIdForm"
+            label-width="80px"
+            :rules="resetPasswordByOrgIdRules"
+          >
+            <el-form-item label="学习中心" prop="orgId">
+              <el-select
+                class="input"
+                :remote-method="getOrgList4RestPassword"
+                :loading="getOrgList4RestPasswordLoading"
+                remote
+                filterable
+                clearable
+                v-model="resetPasswordByOrgIdForm.orgId"
+                placeholder="请选择"
+                :disabled="pureLC"
+              >
+                <el-option
+                  v-for="item in orgList4RestPassword"
+                  :label="item.name + ' - ' + item.code"
+                  :value="item.id"
+                  :key="item.id"
+                >
+                </el-option>
+              </el-select>
+            </el-form-item>
+          </el-form>
+          <div style="text-align: center;margin-top: 20px;">
+            <el-button type="primary" @click="submitResetPasswordByOrgId"
+              >确 定</el-button
+            >
+            <el-button @click="resetPasswordByOrgIdDialog = false"
+              >取 消</el-button
+            >
+          </div>
+        </el-dialog>
+
         <!-- 页面列表 -->
         <el-table
           :data="tableData"
@@ -556,7 +609,13 @@ export default {
       lc_code: null,
       lc_name: null,
       orgList4Search: [],
+      orgList4RestPassword: [],
       getOrgList4SearchLoading: false,
+      getOrgList4RestPasswordLoading: false,
+      resetPasswordByOrgIdDialog: false,
+      resetPasswordByOrgIdForm: {
+        orgId: ""
+      },
       formSearch: {
         orgId: "",
         rootOrgId: null,
@@ -617,6 +676,16 @@ export default {
         infoCollector: "",
         identityNumber: "",
         identityNumberLike: false
+      },
+      resetPasswordByOrgIdRules: {
+        orgId: [
+          {
+            type: "number",
+            required: true,
+            message: "请选择学习中心",
+            trigger: "change"
+          }
+        ]
       }
     };
   },
@@ -641,6 +710,40 @@ export default {
     }
   },
   methods: {
+    resetPasswordByOrgId() {
+      this.orgList4RestPassword = [];
+      this.resetPasswordByOrgIdForm.orgId = null;
+      if (this.pureLC) {
+        this.orgList4RestPassword = [
+          { id: this.lc_id, name: this.lc_name, code: this.lc_code }
+        ];
+        this.resetPasswordByOrgIdForm.orgId = this.lc_id;
+      } else {
+        this.getOrgList4RestPassword("");
+      }
+      this.resetPasswordByOrgIdDialog = true;
+    },
+    submitResetPasswordByOrgId() {
+      this.$refs.resetPasswordByOrgIdForm.validate(valid => {
+        if (valid) {
+          var url =
+            CORE_API +
+            "/student/resetPasswordByOrgId/" +
+            this.resetPasswordByOrgIdForm.orgId;
+          this.$httpWithMsg.put(url).then(response => {
+            console.log(response);
+            this.$notify({
+              type: "success",
+              message: "重置密码成功"
+            });
+            this.searchForm();
+            this.resetPasswordByOrgIdDialog = false;
+          });
+        } else {
+          return false;
+        }
+      });
+    },
     rootOrgChanged() {
       this.getOrgList4Search("");
     },
@@ -663,6 +766,25 @@ export default {
           this.getOrgList4SearchLoading = false;
         });
     },
+    getOrgList4RestPassword(orgName) {
+      this.getOrgList4RestPasswordLoading = true;
+      let url =
+        CORE_API +
+        "/org/query?rootOrgId=" +
+        this.formSearch.rootOrgId +
+        "&name=" +
+        orgName;
+      this.$httpWithMsg
+        .get(url)
+        .then(response => {
+          this.getOrgList4RestPasswordLoading = false;
+          this.orgList4RestPassword = response.data;
+        })
+        .catch(response => {
+          console.log(response);
+          this.getOrgList4RestPasswordLoading = false;
+        });
+    },
     queryExams4Search(name) {
       this.queryExams(name, "search");
     },