4
0
Просмотр исходного кода

修改显示列 拖拽可实现实时变化

gongyb 4 лет назад
Родитель
Сommit
df89d39c96

+ 8 - 4
src/dashoo.cn/frontend_animal/src/pages/biobank/source/animal.vue

@@ -121,7 +121,7 @@
 <!--            <p>{{jstimehandle(scope.row.SurveyDate)}}</p>-->
 <!--          </template>-->
 <!--        </el-table-column>-->
-        <el-table-column :label="item.name" :key="item.name" v-if="item.show" v-for="item in showcolumn"
+        <el-table-column :label="item.name" :key="item" v-if="item.show" v-for="item in showcolumn"
                          :width="item.columnwidth" align="center" show-overflow-tooltip>
           <template slot-scope="scope">
             <template v-if="item.filed === 'Address'">
@@ -415,7 +415,8 @@ export default {
         filed: 'Genus',
         name: '蜂种',
         show: true,
-        kuoz: false
+        kuoz: false,
+        columnwidth: 100
       }, {
         filed: 'InnerNo',
         name: '来源内码',
@@ -435,7 +436,8 @@ export default {
         filed: 'AuditorStatus',
         name: '审核状态',
         show: true,
-        kuoz: false
+        kuoz: false,
+        columnwidth: 100
       }, {
         filed: 'AuditorName',
         name: '审核人',
@@ -1013,7 +1015,9 @@ export default {
         type: 'success',
         message: '自定义显示列设置成功'
       })
-      this.initdata()
+      this.showcolumn = JSON.parse(JSON.stringify(this.showcolumn))
+      // this.$forceUpdate()
+      // this.initdata()
     },
     checkedshowall () {
       let tc = 0

+ 2 - 2
src/dashoo.cn/frontend_animal/src/pages/samples/archived/index.vue

@@ -61,7 +61,7 @@
             </router-link>
           </template>
         </el-table-column>
-        <el-table-column :label="item.name" :key="item.name" v-if="item.show" v-for="item in showcolumn"
+        <el-table-column :label="item.name" :key="item" v-if="item.show" v-for="item in showcolumn"
           :width="item.columnwidth" align="center" show-overflow-tooltip>
           <template slot-scope="scope">
             <template v-if="item.filed === 'SourceName'">
@@ -774,7 +774,7 @@ export default {
         type: 'success',
         message: '自定义显示列设置成功'
       })
-      this.initData()
+      this.showcolumn = JSON.parse(JSON.stringify(this.showcolumn))
     },
     header_dragend (newWidth, oldWidth, column, event) {
       for (var i = 0; i < this.showcolumn.length; i++) {

+ 6 - 3
src/dashoo.cn/frontend_animal/src/pages/samples/prerecorded/index.vue

@@ -72,7 +72,7 @@
             </router-link>
           </template>
         </el-table-column>
-        <el-table-column :label="item.name" :key="item.name" v-if="item.show" v-for="item in showcolumn" :width="item.columnwidth"
+        <el-table-column :label="item.name" :key="item" v-if="item.show" v-for="item in showcolumn" :width="item.columnwidth"
           align="center" show-overflow-tooltip>
           <template slot-scope="scope">
             <template v-if="item.filed === 'SourceName'">
@@ -240,7 +240,7 @@
     <el-dialog title="选中显示列(拖拽可以实现排序)" :visible.sync="columndialogVisible" top="5vh">
       <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange" style="margin-left:15px;">全选</el-checkbox>
       <div style="margin: 10px 0;"></div>
-      <draggable v-model="showcolumn">
+      <draggable v-model="showcolumn" @node-drag-end="handleDragEnd">
         <transition-group class="sampshowfiledsort_ul sampshowfiledsort_ul_tags" tag="ul">
           <li v-for="item in showcolumn" :key="item.filed">
             <el-checkbox v-model="item.show" :label="item.filed" @change="checkedshowall()">{{item.name}}</el-checkbox>
@@ -946,7 +946,7 @@
           type: 'success',
           message: '自定义显示列设置成功'
         })
-        this.initData()
+        this.showcolumn = JSON.parse(JSON.stringify(this.showcolumn))
       },
       header_dragend (newWidth, oldWidth, column, event) {
         for (var i = 0; i < this.showcolumn.length; i++) {
@@ -956,6 +956,9 @@
             return
           }
         }
+      },
+      handleDragEnd () {
+
       },
       // ----------------------------------------------------------------
       // 自定义查询

+ 2 - 2
src/dashoo.cn/frontend_animal/src/pages/samples/stored/index.vue

@@ -94,7 +94,7 @@
             </el-button>
           </template>
         </el-table-column>
-        <el-table-column :label="item.name" :key="item.name" v-if="item.show" v-for="item in showcolumn"
+        <el-table-column :label="item.name" :key="item" v-if="item.show" v-for="item in showcolumn"
           :width="item.columnwidth" align="center" show-overflow-tooltip>
           <template slot-scope="scope">
             <template v-if="item.filed === 'SourceName'">
@@ -787,7 +787,7 @@
           type: 'success',
           message: '自定义显示列设置成功'
         })
-        this.initData()
+        this.showcolumn = JSON.parse(JSON.stringify(this.showcolumn))
       },
       handleCheckAllChange (val) {
         for (var i = 0; i < this.showcolumn.length; i++) {

+ 2 - 2
src/dashoo.cn/frontend_animal/src/pages/samples/waitingstore/index.vue

@@ -69,7 +69,7 @@
             </router-link>
           </template>
         </el-table-column>
-        <el-table-column :label="item.name" :key="item.name" v-if="item.show" v-for="item in showcolumn" :width="item.columnwidth"
+        <el-table-column :label="item.name" :key="item" v-if="item.show" v-for="item in showcolumn" :width="item.columnwidth"
           align="center" show-overflow-tooltip>
           <template slot-scope="scope">
             <template v-if="item.filed === 'SourceName'">
@@ -694,7 +694,7 @@
           type: 'success',
           message: '自定义显示列设置成功'
         })
-        this.initData()
+        this.showcolumn = JSON.parse(JSON.stringify(this.showcolumn))
       },
       header_dragend (newWidth, oldWidth, column, event) {
         for (var i = 0; i < this.showcolumn.length; i++) {