Jelajahi Sumber

登录失败时,loading未关闭修复

王涛 3 tahun lalu
induk
melakukan
ead6b0b9c5
2 mengubah file dengan 27 tambahan dan 4 penghapusan
  1. 2 0
      src/views/login/index.vue
  2. 25 4
      src/views/system/organization/index.vue

+ 2 - 0
src/views/login/index.vue

@@ -176,6 +176,8 @@ export default {
             this.$router.push('/index?name='+this.loginForm.username)
             window.localStorage.setItem('key',this.loginForm.username)
             this.loading=false
+          }).catch(()=>{
+            this.loading=false
           })
         }
       });

+ 25 - 4
src/views/system/organization/index.vue

@@ -15,7 +15,6 @@
         <el-button type="primary" icon="el-icon-search"  size="mini" @click="query()">搜索</el-button>
         <el-button type="primary" icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
         <el-button
-          disabled
           icon="el-icon-plus"
           type="success"
           size="mini"
@@ -33,6 +32,7 @@
       :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
       @selection-change="handleSelectionChange"
       style="margin-top:10px"
+      :max-height="tableHeight"
     >
       <el-table-column prop="deptName" label="部门名称" align="left"></el-table-column>
       <!-- <el-table-column prop="leader" label="负责人" ></el-table-column>
@@ -42,14 +42,17 @@
       <el-table-column label="操作" >
         <template slot-scope="scope">
           <el-button
-            disabled
             icon="el-icon-edit"
             style="color: #406CE5"
             @click="handleUpdate(scope.row)"
             >编辑</el-button
           >
           <el-button
-            disabled
+            icon="el-icon-plus"
+            @click="handleAdd(scope.row)"
+            style="color: #406CE5"
+          >新增</el-button>
+          <el-button
             icon="el-icon-delete"
             style="color: #F27979"
             @click="handleDelete(scope.$index, scope.row)"
@@ -201,6 +204,8 @@ export default {
       },
       // 状态数据字典
       statusOptions: [],
+      //表格自适应高度
+      tableHeight:undefined,
     };
   },
   components: { Treeselect },
@@ -210,6 +215,19 @@ export default {
     // this.fetchData();
     this.getData()
   },
+   mounted() {
+    // table高度
+    if(window.innerWidth <1920){
+      this.tableHeight = window.innerHeight - 200
+    }else{
+      this.tableHeight = window.innerHeight - 205
+    }
+    // 监听窗口大小变化
+    let self = this;
+    window.onresize = function() {
+      self.tableHeight = window.innerHeight - 200
+    }
+  },
 
   methods: {
     //初始化
@@ -284,9 +302,12 @@ export default {
       });
     },
     /** 新增按钮操作 */
-    handleAdd() {
+    handleAdd(row) {
       this.dialogFormVisible = true
       this.reset();
+      if (row != undefined) {
+        this.form.parentId = row.deptId;
+      }
       this.title = "添加部门";
       listDept().then(response => {
 	      this.deptOptions = response.data;