dedsudiyu 2 mesiacov pred
rodič
commit
4b8cdab68b

+ 15 - 2
src/views/safetyEducationExam/safeLearning/el_course/edit.vue

@@ -53,7 +53,7 @@
             @change="deptFun"
             v-model="infoForm.deptId"
             :options="deptOptions"
-            :props="{value: 'deptId', label: 'deptName',children:'child',multiple: true,emitPath:false,checkStrictly: true}"
+            :props="{value: 'deptId', label: 'deptName',children:'child',checkStrictly: false}"
             placeholder="请选择适用学院"
             collapse-tags></el-cascader>
           <!--<el-select v-model="infoForm.deptId" placeholder="请选择适用学院" @change="deptFun" style="width:400px;">-->
@@ -620,7 +620,20 @@
       /* 查询学院列表 */
       getDeptList() {
         systemDeptOrganizeStructure({}).then(response => {
-          this.$set(this, 'deptOptions', response.data)
+          let list = JSON.parse(JSON.stringify(response.data));
+          pushNode(list,false)
+          function pushNode(list,type){
+            for(let i=0;i<list.length;i++){
+              if(!list[i].child[0]){
+                delete list[i].child;
+              }else if(type){
+                delete list[i].child;
+              }else{
+                pushNode(list[i].child,true)
+              }
+            }
+          }
+          this.$set(this, 'deptOptions', list)
         })
       },
       //步骤条下一步按钮

+ 15 - 2
src/views/safetyEducationExam/securityExam/exam/addExamPage.vue

@@ -275,7 +275,7 @@
             ref="cascader"
             v-model="form.deptIds"
             :options="deptOptions"
-            :props="{value: 'deptId', label: 'deptName',children:'child',multiple: true,emitPath:false,checkStrictly: true}"
+            :props="{value: 'deptId', label: 'deptName',children:'child',checkStrictly: false}"
             placeholder="请选择适用学院"
             collapse-tags
             ></el-cascader>
@@ -1006,7 +1006,20 @@ export default {
     /** 查询部门下拉树结构 */
     getTreeselect() {
       systemDeptOrganizeStructure({}).then(response => {
-        this.deptOptions = response.data;
+        let list = JSON.parse(JSON.stringify(response.data));
+        pushNode(list,false)
+        function pushNode(list,type){
+          for(let i=0;i<list.length;i++){
+            if(!list[i].child[0]){
+              delete list[i].child;
+            }else if(type){
+              delete list[i].child;
+            }else{
+              pushNode(list[i].child,true)
+            }
+          }
+        }
+        this.$set(this, 'deptOptions', list)
       });
     },
     backPage(){