zhuliu 9 月之前
父節點
當前提交
f8a1a21117

+ 17 - 5
src/views/backStageManage/organization/department/components/department.vue

@@ -51,6 +51,9 @@
 </template>
   
 <script>
+const defaultSearchForm = {
+    name:''
+}
 export default {
     components: {},
     props: {},
@@ -65,7 +68,7 @@ export default {
             queryParams: {
                 current: 1,
                 size: 10,
-                name:''
+                ...defaultSearchForm
             },
         };
     },
@@ -161,7 +164,10 @@ export default {
 
         /** 重置按钮操作 */
         resetQuery() {
-            this.queryParams.name = '';
+            this.queryParams={
+                ...this.queryParams,
+                ...defaultSearchForm
+            }
             this.handleQuery();
         },
 
@@ -171,16 +177,22 @@ export default {
                 cancelButtonText: '取消',
                 type: 'warning'
             }).then(() => {
-                    this.loading = true
-                    this.$api.deleteDepartment({ id: row.id }).then(response => {
+                this.loading = true
+                this.$api.deleteDepartment({ id: row.id }).then(response => {
                     this.$message.success('删除成功')
                     this.loading = false
-                    this.getList()
+                    this.delFinish()
                 }).catch(error => {
                     this.loading = false
                 })
             })
         },
+        delFinish(){
+            if(this.tableData.length == 1){
+                this.queryParams.current -= 1
+            }
+            this.getList()
+        },
        
     },
 };

+ 19 - 6
src/views/backStageManage/organization/position/components/position.vue

@@ -59,6 +59,10 @@
 </template>
 
 <script>
+const defaultSearchForm = {
+    name:'',
+    tenant:''
+}
 export default {
     components: {},
     props: {
@@ -74,8 +78,7 @@ export default {
             queryParams: {
                 current: 1,
                 size: 10,
-                name:'',
-                tenant:''
+                ...defaultSearchForm
             },
         };
     },
@@ -137,17 +140,24 @@ export default {
                 cancelButtonText: '取消',
                 type: 'warning'
             }).then(() => {
-                    this.loading = true
-                    this.$api.deletePosition({ id: row.id }).then(response => {
+                this.loading = true
+                this.$api.deletePosition({ id: row.id }).then(response => {
                     this.$message.success('删除成功')
                     this.loading = false
-                    this.resetQuery()
+                    this.delFinish()
                 }).catch(error => {
                     this.loading = false
                 })
             })
         },
 
+        delFinish(){
+            if(this.tableData.length == 1){
+                this.queryParams.current -= 1
+            }
+            this.getList()
+        },
+
         /** 搜索按钮操作 */
         handleQuery() {
             this.queryParams.current = 1;
@@ -156,7 +166,10 @@ export default {
 
         /** 重置按钮操作 */
         resetQuery() {
-            this.queryParams.name = '';
+            this.queryParams={
+                ...this.queryParams,
+                ...defaultSearchForm
+            }
             this.handleQuery();
         }
     },