Przeglądaj źródła

店铺管理+计算表格高度

ymy 1 rok temu
rodzic
commit
299827f767

+ 7 - 3
src/benyun/components/byTable/byTable.vue

@@ -164,9 +164,13 @@ export default class ByTable extends VueViews {
     })
   }
   recalculate(){
-    if(this.$refs.table){
-      (this.$refs.table as any).recalculate();
-    }
+    this.$forceUpdate();
+    this.$nextTick(()=>{
+      if(this.$refs.table){
+        (this.$refs.table as any).recalculate(true);
+      }
+    })
+    
   }
   loadTableData(data:Array<any>){
     if(this.$refs.table){

+ 11 - 8
src/benyun/components/moduleView/moduleView.vue

@@ -10,8 +10,8 @@
     <div class="search" v-if="searchConfig" v-show="!hideSearch">
       <by-form :propConfig="searchConfig" :ref="searchID"></by-form>
       <div class="search-btn">
-        <el-button type="primary" size="mini" icon="el-icon-search" @click="search">搜索</el-button>
-        <el-button size="mini" icon="el-icon-refresh" @click="resert">重置</el-button>
+        <el-button type="primary" size="small" icon="el-icon-search" @click="search">搜索</el-button>
+        <el-button size="small" icon="el-icon-refresh" @click="resert">重置</el-button>
       </div>
     </div>
     <div class="tool-box" v-if="toolConfig">
@@ -99,8 +99,8 @@ export default class ModuleView extends ModuleViewHandle {
     let fHeight = 0;
     let tHeight = 0;
     let vHeight = (this as any).$el.offsetHeight;
-    if(this.$refs[this.searchID]){
-      fHeight = (this.$refs[this.searchID] as any).$el.offsetHeight + 28 + 8;
+    if(this.$refs[this.searchID] && !this.hideSearch){
+      fHeight = (this.$refs[this.searchID] as any).$el.offsetHeight + 32 + 8;
     }
     if(this.$refs[this.toolID]){
       tHeight = (this.$refs[this.toolID] as any).$el.offsetHeight + 16;
@@ -133,10 +133,7 @@ export default class ModuleView extends ModuleViewHandle {
     this.resertHandle()
   }
   clickHandle(e:string){
-    if(e == 'toggleSearch'){
-      this.calculateCount=0;
-      this.initTable()
-    }
+    
     if(e == 'onAdd'){
       this.modalShow = true;
     }
@@ -145,6 +142,12 @@ export default class ModuleView extends ModuleViewHandle {
     }else{
       this.$emit('clickHandle',e)
     }
+    if(e == 'toggleSearch'){
+      this.calculateCount=0;
+      setTimeout(()=>{
+        this.initTable()
+      },100)
+    }
   }
   //弹窗工具栏
   modalHandle(e:string){

+ 10 - 2
src/views/oms/shop/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="shop">
-    <module-view :propConfig="config" ref="view" v-loading="load" style="height:100%" @pagination="pagination" @modalHandle="modalHandle" @onRefresh="getList" 
+    <module-view :propConfig="config" ref="view" v-loading="load" @pagination="pagination" @modalHandle="modalHandle" @onRefresh="getList" 
     @resert="queryList" @search="queryList" @clickHandle="clickHandle" @detail="detail" />
   </div>
 </template>
@@ -693,6 +693,7 @@ export default class Shop extends Vue {
       this.getList()
     })
   }
+  //删除
   del(item:any){
     this.$confirm('此操作将永久删除 “'+item.shopName+'” 店铺, 是否继续?', '提示', {
       confirmButtonText: '确定',
@@ -713,6 +714,7 @@ export default class Shop extends Vue {
     }).catch(() => {});
     
   }
+  //分页
   pagination(){
     if(this.isSearch){
       this.queryList();
@@ -720,6 +722,7 @@ export default class Shop extends Vue {
       this.getList()
     }
   }
+  //列表请求(只有分页,不包含搜素条件)
   getList(){
     if(!this.$refs.view){
       if(this.timeNum > 5){
@@ -735,7 +738,7 @@ export default class Shop extends Vue {
     let data = (this.$refs.view as any).getPage();
     this.requestList(data);
   }
-  
+  //列表请求(包含分页和搜素条件)
   queryList(){
     this.isSearch = true;
     let data = (this.$refs.view as any).getQuery();
@@ -757,6 +760,7 @@ export default class Shop extends Vue {
       this.load = false;
     })
   }
+  //修改店铺数据
   onSave(){
     let data = (this.$refs.view as any).getFormValue();
     this.load = true;
@@ -772,6 +776,7 @@ export default class Shop extends Vue {
       this.load = false;
     })
   }
+  //表单工具栏按钮事件
   modalHandle(n:string){
     if(n == 'onAdd'){
       (this.$refs.view as any).getFormValidate(this.addShop)
@@ -781,6 +786,7 @@ export default class Shop extends Vue {
       this.onSave();
     }
   }
+  //表格工具栏按钮事件
   clickHandle(n:string){ 
     if(n == 'onAdd'){
       this.config.modal.tool.tools.add = true;
@@ -788,6 +794,7 @@ export default class Shop extends Vue {
       (this.$refs.view as any).initFormTool();
     }
   }
+  //添加店铺
   addShop(){
     let value = (this.$refs.view as any).getFormValue();
     if(value){
@@ -805,6 +812,7 @@ export default class Shop extends Vue {
       })
     }
   }
+  //点击详情
   detail(){
     this.config.modal.tool.tools.save = true;
     delete this.config.modal.tool.tools.add;