From c7bc3eb18e1fda4254ca0195e2133d2ed978de11 Mon Sep 17 00:00:00 2001
From: china <527956374@qq.com>
Date: 星期四, 11 五月 2023 17:48:48 +0800
Subject: [PATCH] 样式调整

---
 src/views/components/myTableV3.vue |   60 ++++++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 44 insertions(+), 16 deletions(-)

diff --git a/src/views/components/myTableV3.vue b/src/views/components/myTableV3.vue
index ec86898..9ea4c56 100644
--- a/src/views/components/myTableV3.vue
+++ b/src/views/components/myTableV3.vue
@@ -7,6 +7,7 @@
         v-for="(custom, idx) in myTable.tools.custom"
         :key="idx"
         site="tools"
+        :type="custom.myType"
         :check-permission="custom.checkPermission"
         :name="custom.name"
         @click="custom.click"
@@ -94,8 +95,7 @@
           :sortable="column.sortable"
           :label="column.title"
           :type="column.type"
-          :width="column.width"
-          :min-width="column.minWidth"
+          :min-width="column.width"
           :align="column.align"
           :header-align="column.align"
         >
@@ -122,7 +122,8 @@
             <template v-else>
               <!--鐐瑰嚮寮瑰嚭鍗曞厓鏍煎唴瀹�-->
               <el-popover placement="top-start" trigger="click" :content="getPopoverContent(scope.row, column)">
-                <span slot="reference" class="content-text">{{ scope.row[column.field] }}</span>
+<!--                <span slot="reference" class="content-text">{{ scope.row[column.field] }}</span>-->
+                <span slot="reference" class="content-text">{{ splitField(scope.row, column.field) }}</span>
               </el-popover>
             </template>
           </template>
@@ -134,7 +135,7 @@
         v-if="myTable.operation.show"
         label="鎿嶄綔"
         align="center"
-        :width="myTable.operation.width"
+        :min-width="myTable.operation.width"
         fixed="right"
       >
         <template slot-scope="scope">
@@ -187,13 +188,14 @@
 </template>
 
 <script>
-import myButtonV2 from '@/views/components/myButtonV2'
-import myButton from '@/views/components/myButton'
-import mySwitch from './mySwitch'
-import request from '@/utils/request'
-import * as valid from '@/utils/validate'
-import previewPicture from '@/views/components/previewPicture'
-export default {
+  import myButtonV2 from '@/views/components/myButtonV2'
+  import myButton from '@/views/components/myButton'
+  import mySwitch from './mySwitch'
+  import request from '@/utils/request'
+  import * as valid from '@/utils/validate'
+  import previewPicture from '@/views/components/previewPicture'
+
+  export default {
   components: { myButtonV2, myButton, mySwitch, previewPicture },
   props: {
     table: {
@@ -324,8 +326,6 @@
       return function(row) {
         const arr = []
         that.myTable.operation.attr.map(item => {
-          console.log(item)
-          console.log(!(item.hidden && item.hidden(row)) && item.checkPermission)
           if (!(item.hidden && item.hidden(row)) && item.checkPermission) {
             arr.push(item)
           }
@@ -348,6 +348,28 @@
     this.initTable()
   },
   methods: {
+    /**
+     * 瑙e喅锛歠ield涓睘鎬у灞炴�х殑鎯呭喌銆�2023-04-25
+     * @param row
+     * @param field
+     */
+    splitField(row, field){
+      if(field.indexOf('.') > -1){
+        const arr = field.split('.');
+        let fieldStr = '';
+        for(let i=0, len=arr.length; i<len; i++){
+          if(i == len - 1){
+            fieldStr += arr[i];
+          } else {
+            fieldStr += arr[i] + '.';
+          }
+        }
+        return eval('row.' + fieldStr);
+      } else {
+        return row[field];
+      }
+    },
+
     initTable() {
       if (this.table !== null) {
         Object.assign(this.myTable, this.table)
@@ -403,6 +425,7 @@
             })
           )
           this.myTable.loading = false
+          // this.$refs[this.myTable.ref].doLayout()
         }).catch(() => {
           this.myTable.loading = false
         })
@@ -605,8 +628,11 @@
 </script>
 
 <style scoped>
->>> .el-table__fixed-right {
-  height: 100% !important;
+>>> .el-table__header {
+  width: 100% !important;
+}
+>>> .el-table__body {
+  width: 100% !important;
 }
 
 /*璇︽儏琛ㄥ崟*/
@@ -641,5 +667,7 @@
   text-align: center;
   margin: 0 auto;
 }
-
+.table-tool-bar{
+  margin-bottom: 20px;
+}
 </style>

--
Gitblit v1.9.1