Browse Source

表格局部刷新

ymy 1 year ago
parent
commit
ac4b5e31ea
1 changed files with 7 additions and 3 deletions
  1. 7 3
      src/benyun/components/byTable/byTable.vue

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

@@ -20,7 +20,7 @@
       <vxe-column v-if="attrs.checkbox" type="checkbox" width="50" fixed="left" />
       <vxe-column v-if="attrs.radio" type="radio" width="50" fixed="left" />
       <vxe-column v-if="attrs.seq" type="seq" title="序号" :width="attrs.seqWidth?attrs.seqWidth:50" fixed="left" :tree-node="attrs.treeNodeSeq" />
-      <template v-for="(item,index) in columns">
+      <template v-for="(item,index) of columns">
         <vxe-column
           v-if="item.action"
           :key="'action_'+index"
@@ -46,7 +46,7 @@
         </vxe-column>
         <vxe-column
           v-if="!item.action"
-          :key="item.field?item.field:index"
+          :key="item.field?item.field+getUuid():index+getUuid()"
           :field="item.field"
           :title="item.title"
           :width="item.width"
@@ -57,7 +57,7 @@
         >
           <template #default="{ row }">
             <slot v-if="item.slot" :name='item.field' :row='row'></slot>
-            <component v-else-if="item.component" :is="item.component" :ref="item.prop+'Comp'" :propConfig="item.compConfig" :parentValue="row"
+            <component v-else-if="item.component" :is="item.component" :ref="item.field+'Comp'" :propConfig="item.compConfig" :parentValue="row"
               :propValue="row[item.field]" @onChange="onChange($event, row,item.field)" />
             <template v-else>
               <div v-if="item.isDetail" :class="{'ellipsis':item.ellipsis}" :title="row[item.field]" :style="{ 'text-align': item.align }" class="tdCol detail" @click="detail(row)">
@@ -156,6 +156,9 @@ export default class ByTable extends VueViews {
   created(){
     this.initConfig()
   }
+  getUuid(){
+    return (((1 + Math.random()) * 0x10000) | 0).toString(3).substring(1);
+  }
   initConfig(){
     if(this.propConfig){
       this.setConfig(this.propConfig)
@@ -191,6 +194,7 @@ export default class ByTable extends VueViews {
       this.page.pageSize = this.attrs.pageSize;
     }
     this.recalculate();
+    
   }
 
   //设置分页