Explorar el Código

Merge branch 'product' of http://1.116.113.26:8088/zhuliu/xiaoshi_system into product

zhuliu hace 1 año
padre
commit
cd981a2b8a

+ 8 - 6
src/views/event/components/view/table.vue

@@ -1,8 +1,8 @@
 <template>
-  <div class="eventTable height_100">
-    <el-table :data="tableData" header-row-class-name="custom-table-header" @sort-change="sortChange"
-      v-el-table-infinite-scroll="getList" :infinite-scroll-distance="10" :infinite-scroll-disabled="disabled"
-      :height="row ? '300' : ''">
+  <div class="eventTable height_100" v-DivHeight="getDivHeight" >
+    <el-table :data="tableData" header-row-class-name="custom-table-header" @sort-change="sortChange"   
+    v-if="showTable" :maxHeight="tableHeight" v-el-table-infinite-scroll="getList" :infinite-scroll-distance="10" 
+    :infinite-scroll-disabled="disabled" :height="row ? '300' : ''">
       <el-table-column label="#" width="60" type="index" align="center">
         <template slot-scope="scope">
           <span>{{ (scope.$index + 1) + ((queryParams.current - 1) * queryParams.size) }}</span>
@@ -49,9 +49,10 @@
 </template>
 
 <script>
+import { getTableHeight } from '@/views/components/mixins'
 import mixins from '../mixins';
 export default {
-  mixins: [mixins],
+  mixins: [mixins,getTableHeight],
   props: {
     isOperate: {//控制显示
       type: String,
@@ -119,7 +120,7 @@ export default {
       //禁用懒加载
       disabled: true,
       params: {
-        size: 10,
+        size: 5,
         current: 0
       },
       // 排序数组
@@ -144,6 +145,7 @@ export default {
       })
       if (a != -1) {
         this.tableData.splice(a, 1)
+        console.log(this.tableData);
         // 分组时若删除当前分组最后一条数据时重新请求分组接口
         if (this.tableData.length==0) {
           this.$emit('getData',true)

+ 4 - 2
src/views/product/components/framework/view/table.vue

@@ -1,6 +1,6 @@
 <template>
-  <div class="frameworkTable">
-    <el-table :data="tableData"  header-row-class-name="custom-table-header">
+  <div class="frameworkTable height_100" v-DivHeight="getDivHeight">
+    <el-table :data="tableData"  header-row-class-name="custom-table-header" v-if="showTable" :maxHeight="tableHeight">
       <el-table-column label="#" width="60" type="index" align="center">
         <template slot-scope="scope">
           <span>{{ (scope.$index + 1) + ((queryParams.current - 1) * queryParams.size) }}</span>
@@ -35,7 +35,9 @@
 </template>
 
 <script>
+import { getTableHeight } from '@/views/components/mixins'
 export default {
+  mixins:[getTableHeight],
   props: {
     tableData: {
       type: Array,

+ 12 - 7
src/views/product/components/framework/viewIndex.vue

@@ -214,7 +214,10 @@ export default {
           "createTime": "2023-05-11 17:28:06"
         }
       ],
+      // 节点的展开
       expandedKeys:[],
+      // 当前节点下的所有数据
+      nodeChildrenData:[],
     }
   },
   mounted() {
@@ -302,8 +305,9 @@ export default {
     handleNodeClick(data, node) { 
       // console.log(data, node);
       if (data.children && data.children.length>0) {
-        this.tableData = data.children
-        this.handleCurrent(data.children)
+        // this.tableData = 
+        this.nodeChildrenData = data.children
+        this.handleCurrent()
       }
     },
     // 请求数据(tree)
@@ -314,8 +318,8 @@ export default {
       this.$api.queryList(params).then(res => {
         if (res.code == 200 ) {
           this.treeData = res.data
-          this.tableData = res.data.children
-          this.handleCurrent(res.data.children)
+          this.nodeChildrenData = res.data.children
+          this.handleCurrent()
         }
       })
     },
@@ -333,13 +337,14 @@ export default {
     // 分页
     handleCurrentChange(val) { 
       this.queryParams.current = val;
+      this.handleCurrent()
     },
     // 分页处理
-    handleCurrent(nodeData) {
-      this.total=nodeData.length
+    handleCurrent() {
+      this.total=this.nodeChildrenData.length
       let start = this.queryParams.size * (this.queryParams.current - 1)
       let end =this.queryParams.size * this.queryParams.current
-      this.tableData = nodeData.slice(start, end)
+      this.tableData = this.nodeChildrenData.slice(start, end)
     },
   },
 }