Browse Source

学生信息增加学习中心筛选

WANG 5 năm trước cách đây
mục cha
commit
743a8843b2
1 tập tin đã thay đổi với 76 bổ sung2 xóa
  1. 76 2
      src/modules/examwork/view/student.vue

+ 76 - 2
src/modules/examwork/view/student.vue

@@ -45,6 +45,27 @@
               class="input"
             ></el-input>
           </el-form-item>
+          <el-form-item label="学习中心">
+            <el-select
+              class="input"
+              :remote-method="getOrgList4Search"
+              :loading="getOrgList4SearchLoading"
+              remote
+              filterable
+              clearable
+              v-model="formSearch.orgId"
+              placeholder="请选择"
+              :disabled="pureLC"
+            >
+              <el-option
+                v-for="item in orgList4Search"
+                :label="item.name + ' - ' + item.code"
+                :value="item.id"
+                :key="item.id"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
           <el-form-item label="照片状态">
             <el-select v-model="formSearch.hasPhoto" class="input">
               <el-option label="未选择" value="UNDEFINED"> </el-option>
@@ -529,7 +550,14 @@ export default {
       rootOrgList: null,
       stuExamLoading: false,
       button: {},
+      pureLC: false,
+      lc_id: null,
+      lc_code: null,
+      lc_name: null,
+      orgList4Search: [],
+      getOrgList4SearchLoading: false,
       formSearch: {
+        orgId: "",
         rootOrgId: null,
         name: "",
         studentCode: "",
@@ -612,6 +640,25 @@ export default {
     }
   },
   methods: {
+    getOrgList4Search(orgName) {
+      this.getOrgList4SearchLoading = true;
+      let url =
+        CORE_API +
+        "/org/query?rootOrgId=" +
+        this.formSearch.rootOrgId +
+        "&name=" +
+        orgName;
+      this.$httpWithMsg
+        .get(url)
+        .then(response => {
+          this.getOrgList4SearchLoading = false;
+          this.orgList4Search = response.data;
+        })
+        .catch(response => {
+          console.log(response);
+          this.getOrgList4SearchLoading = false;
+        });
+    },
     queryExams4Search(name) {
       this.queryExams(name, "search");
     },
@@ -977,13 +1024,40 @@ export default {
     init() {
       this.initPrivileges();
 
+      for (let role of this.user.roleList) {
+        if (role.roleCode == "LC_USER") {
+          this.pureLC = true;
+          continue;
+        }
+      }
+
+      if (1 < this.user.roleList.length) {
+        this.pureLC = false;
+      }
+
+      if (this.pureLC) {
+        var url = CORE_API + "/user/" + this.user.userId;
+        this.$httpWithMsg.get(url).then(response => {
+          var userInfo = response.data;
+          this.lc_id = userInfo.orgId;
+          this.lc_name = userInfo.orgName;
+          this.lc_code = userInfo.orgCode;
+          this.orgList4Search = [
+            { id: this.lc_id, name: this.lc_name, code: this.lc_code }
+          ];
+          this.formSearch.orgId = this.lc_id;
+        });
+      }
+
       var url = CORE_API + "/org/getRootOrgList";
 
       this.$httpWithMsg.get(url).then(response => {
         this.rootOrgList = response.data;
-        this.formSearch.rootOrgId = this.user.rootOrgId;
-        this.searchForm();
       });
+
+      this.formSearch.rootOrgId = this.user.rootOrgId;
+      this.getOrgList4Search("");
+      this.searchForm();
     }
   },
   created() {