Parcourir la source

优化自动计算列宽

xiaohaizhao il y a 1 an
Parent
commit
451b905bf2
49 fichiers modifiés avec 239 ajouts et 184 suppressions
  1. 2 1
      src/HDrpManagement/competitor/detail/modules/competeProjects/components/table.vue
  2. 2 2
      src/HDrpManagement/contractManage/components/productClassList/table.vue
  3. 2 2
      src/HDrpManagement/orderManage/details/tabs/table.vue
  4. 2 1
      src/HDrpManagement/payvoucher/components/table.vue
  5. 2 2
      src/HDrpManagement/productMoneyOdd/components/table.vue
  6. 9 8
      src/HDrpManagement/projectChange/modules/modules/andEnterprise/components/table.vue
  7. 2 2
      src/HDrpManagement/projectData/components/table.vue
  8. 2 1
      src/HDrpManagement/recvoucher/components/table.vue
  9. 2 1
      src/HDrpManagement/salerpriceData/components/table.vue
  10. 2 1
      src/HDrpManagement/writeoffbill/modules/order/selectOrder.vue
  11. 2 2
      src/HManagement/roleManage/modules/table.vue
  12. 9 8
      src/SDrpManagement/QuotedPrice/detail/components/table.vue
  13. 2 1
      src/SDrpManagement/salerPrivatecustomer/components/table.vue
  14. 2 1
      src/SManagement/project_target/modules/components/projectAdd/table.vue
  15. 2 2
      src/SManagement/sales_forecast/components/mergeTable.vue
  16. 2 2
      src/SManagement/sales_forecast/components/readHeaderTable.vue
  17. 2 1
      src/components/dynamic-newTable/index.vue
  18. 2 1
      src/components/dynamic-newTable/index1.vue
  19. 111 57
      src/components/dynamic-newTable/index2.vue
  20. 2 2
      src/components/dynamic-table-detail/index.vue
  21. 2 1
      src/components/dynamic-table-merge/index.vue
  22. 2 1
      src/components/dynamic-table/index.vue
  23. 2 1
      src/components/dynamic-table/index1.vue
  24. 2 1
      src/components/dynamic-table/index2.vue
  25. 2 1
      src/components/dynamic-table/index3.vue
  26. 2 2
      src/components/normal-basic-layout-new/modules/table.vue
  27. 2 2
      src/components/normal-basic-layout-new/modules/tableBook.vue
  28. 2 2
      src/components/normal-basic-layout/modules/table.vue
  29. 2 2
      src/components/selectTable/index.vue
  30. 2 2
      src/components/table/index.vue
  31. 2 2
      src/components/table/index10.vue
  32. 2 2
      src/components/table/index2.vue
  33. 2 2
      src/components/table/index3.vue
  34. 2 2
      src/components/table/index5.vue
  35. 2 2
      src/components/table/index6.vue
  36. 2 2
      src/components/table/index7.vue
  37. 2 2
      src/components/table/index8.vue
  38. 2 2
      src/components/table/index9.vue
  39. 2 1
      src/optionSystem/FProductManage/modules/table.vue
  40. 2 2
      src/template/addProduct/table.vue
  41. 2 2
      src/template/addProductContract/table.vue
  42. 2 2
      src/template/addTool/table.vue
  43. 2 2
      src/template/popoverTable/table.vue
  44. 2 2
      src/template/prediction/table.vue
  45. 2 2
      src/template/tableMainLayout/index.vue
  46. 2 2
      src/template/tableTemplate/index.vue
  47. 2 2
      src/template/tableTemplate/index1.vue
  48. 20 36
      src/utils/tool.js
  49. 2 2
      src/views/salesData/components/table.vue

+ 2 - 1
src/HDrpManagement/competitor/detail/modules/competeProjects/components/table.vue

@@ -1,6 +1,7 @@
 <template>
   <div>
     <el-table ref="tables"
+              :fit="tool.calculatedColumnWidth($refs.tables,layout)"
               :row-class-name="tableClassName"
               v-loading="loading" highlight-current-row
               :data="data"
@@ -13,7 +14,7 @@
           type="selection"
           width="55" @handleSelectionChange="handleSelectionChange"  v-if="checkbox">
       </el-table-column>
-      <el-table-column :show-overflow-tooltip="col.title == '来源' || col.title == '地址' || col.title == '备注'" v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.tables,layout,index)">
+      <el-table-column :show-overflow-tooltip="col.title == '来源' || col.title == '地址' || col.title == '备注'" v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150">
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->
           <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

+ 2 - 2
src/HDrpManagement/contractManage/components/productClassList/table.vue

@@ -1,13 +1,13 @@
 <template>
   <div>
-    <el-table ref="tables"  @select="aaaa" @select-all="selectAll" v-loading="loading" highlight-current-row :data="data"  size="mini" :height="height" style="width:100%"  >
+    <el-table ref="tables" :fit="tool.calculatedColumnWidth($refs.tables,layout)"  @select="aaaa" @select-all="selectAll" v-loading="loading" highlight-current-row :data="data"  size="mini" :height="height" style="width:100%"  >
         <el-table-column
         type="selection"
         width="45"
         align="center"
         fixed>
       </el-table-column>
-      <el-table-column :show-overflow-tooltip="col.title == '来源' || col.title == '地址' || col.title == '备注'" v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.tables,layout,index)" :fixed="col.columnname === fixedName?'right':false">
+      <el-table-column :show-overflow-tooltip="col.title == '来源' || col.title == '地址' || col.title == '备注'" v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150" :fixed="col.columnname === fixedName?'right':false">
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->
           <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

+ 2 - 2
src/HDrpManagement/orderManage/details/tabs/table.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <!-- :header-cell-style="{background:'#EEEEEE',color:'#333'}" -->
-    <el-table  ref="table" :row-class-name="tableClassName" highlight-current-row :data="data"  size="mini"  :height="height" @row-click="rowClick" style="width:100%" :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}"
+    <el-table  ref="table" :fit="tool.calculatedColumnWidth($refs.table,layout)" :row-class-name="tableClassName" highlight-current-row :data="data"  size="mini"  :height="height" @row-click="rowClick" style="width:100%" :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}"
               :cell-style="{height:'40px',color:'#666666',fontWeight:'400'}" border @selection-change="selectionChange">
       <el-table-column
           type="selection"
@@ -11,7 +11,7 @@
         v-for="(col,index) in layout" :key="col.tablecolid"
         :prop="col.columnname"
         :label="col.title"
-        :min-width="tool.calcTableColWidth($refs.table,layout,index)"
+        :min-width="col.width || 150"
         :fixed="fixedCalc(col.columnname)"
       >
         <template :slot="headerOptions ? headerOptions.includes(col.columnname) ? 'header' : '' : ''" slot-scope="scope">

+ 2 - 1
src/HDrpManagement/payvoucher/components/table.vue

@@ -1,6 +1,7 @@
 <template>
   <div>
     <el-table ref="tables"
+              :fit="tool.calculatedColumnWidth($refs.tables,layout)"
               :row-class-name="tableClassName"
               v-loading="loading" highlight-current-row
               :data="data"
@@ -13,7 +14,7 @@
           type="selection"
           width="55" @handleSelectionChange="handleSelectionChange"  v-if="checkbox">
       </el-table-column>
-      <el-table-column :show-overflow-tooltip="col.title == '来源' || col.title == '地址' || col.title == '备注'" v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.tables,layout,index)">
+      <el-table-column :show-overflow-tooltip="col.title == '来源' || col.title == '地址' || col.title == '备注'" v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150">
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->
           <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

+ 2 - 2
src/HDrpManagement/productMoneyOdd/components/table.vue

@@ -1,13 +1,13 @@
 <template>
   <div>
-    <el-table ref="tables"  @select="aaaa" @select-all="selectAll" v-loading="loading" highlight-current-row :data="data" :header-cell-style="{background:'#EEEEEE',color:'#333'}" size="mini" :height="height" style="width:100%"  border>
+    <el-table ref="tables" :fit="tool.calculatedColumnWidth($refs.tables,layout)"  @select="aaaa" @select-all="selectAll" v-loading="loading" highlight-current-row :data="data" :header-cell-style="{background:'#EEEEEE',color:'#333'}" size="mini" :height="height" style="width:100%"  border>
         <el-table-column
         type="selection"
         width="45"
         align="center"
         fixed>
       </el-table-column>
-      <el-table-column :show-overflow-tooltip="col.title == '来源' || col.title == '地址' || col.title == '备注'" v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.tables,layout,index)" :fixed="col.columnname === fixedName?'right':false">
+      <el-table-column :show-overflow-tooltip="col.title == '来源' || col.title == '地址' || col.title == '备注'" v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150" :fixed="col.columnname === fixedName?'right':false">
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->
           <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

+ 9 - 8
src/HDrpManagement/projectChange/modules/modules/andEnterprise/components/table.vue

@@ -1,19 +1,20 @@
 <template>
   <div>
     <el-table ref="tables"
-              :row-class-name="tableClassName"
-              v-loading="loading" highlight-current-row
-              :data="data"
-              :header-cell-style="{background:'#EEEEEE',color:'#333'}" size="mini"
-              :height="height" @row-click="rowClick" style="width:100%"
-               border
-              @select="select"
+      :fit="tool.calculatedColumnWidth($refs.tables,layout)"
+      :row-class-name="tableClassName"
+      v-loading="loading" highlight-current-row
+      :data="data"
+      :header-cell-style="{background:'#EEEEEE',color:'#333'}" size="mini"
+      :height="height" @row-click="rowClick" style="width:100%"
+        border
+      @select="select"
       >
       <el-table-column
           type="selection"
           width="55" @handleSelectionChange="handleSelectionChange"  v-if="checkbox">
       </el-table-column>
-      <el-table-column :show-overflow-tooltip="col.title == '来源' || col.title == '地址' || col.title == '备注'" v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.tables,layout,index)">
+      <el-table-column :show-overflow-tooltip="col.title == '来源' || col.title == '地址' || col.title == '备注'" v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150">
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->
           <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

+ 2 - 2
src/HDrpManagement/projectData/components/table.vue

@@ -1,13 +1,13 @@
 <template>
   <div>
     <!-- :header-cell-style="{background:'#EEEEEE',color:'#333'}" -->
-    <el-table ref="table" :row-class-name="tableClassName" highlight-current-row :data="data" style="height:100%"  size="mini" :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}"
+    <el-table ref="table" :fit="tool.calculatedColumnWidth($refs.table,layout)" :row-class-name="tableClassName" highlight-current-row :data="data" style="height:100%"  size="mini" :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}"
               :cell-style="{height:'40px',color:'#666666',fontWeight:'400'}" border @selection-change="selectionChange">
       <el-table-column
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.table,layout,index)" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?redirect ? redirect : 'right' :false : false">
+      <el-table-column v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?redirect ? redirect : 'right' :false : false">
         <template v-slot:header="{ column,$index }" v-if="customHeader">
           <slot name="header" :data="column"></slot>
         </template>

+ 2 - 1
src/HDrpManagement/recvoucher/components/table.vue

@@ -3,6 +3,7 @@
     <el-table
       ref="tables"
       :row-class-name="tableClassName"
+      :fit="tool.calculatedColumnWidth($refs.tables,layout)"
       v-loading="loading"
       highlight-current-row
       :data="data"
@@ -29,7 +30,7 @@
         :key="col.tablecolid"
         :prop="col.columnname"
         :label="col.title"
-        :min-width="tool.calcTableColWidth($refs.tables,layout,index)"
+        :min-width="col.width || 150"
       >
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->

+ 2 - 1
src/HDrpManagement/salerpriceData/components/table.vue

@@ -4,6 +4,7 @@
     <el-table
       :loading="loading"
       ref="table"
+      :fit="tool.calculatedColumnWidth($refs.table,layout)"
       :row-class-name="tableClassName"
       highlight-current-row
       :data="data"
@@ -28,7 +29,7 @@
         :key="col.tablecolid"
         :prop="col.columnname"
         :label="col.title"
-        :min-width="tool.calcTableColWidth($refs.table,layout,index)"
+        :min-width="col.width || 150"
         :fixed="
           fixedName
             ? fixedName.indexOf(col.columnname) != -1

+ 2 - 1
src/HDrpManagement/writeoffbill/modules/order/selectOrder.vue

@@ -4,6 +4,7 @@
       ref="tables"
       @select="aaaa"
       @select-all="selectAll"
+      :fit="tool.calculatedColumnWidth($refs.table,layout)"
       v-loading="loading"
       highlight-current-row
       :data="data"
@@ -20,7 +21,7 @@
         :key="col.tablecolid"
         :prop="col.columnname"
         :label="col.title"
-        :min-width="tool.calcTableColWidth($refs.tables,layout,index)"
+        :min-width="col.width || 150"
         :fixed="col.columnname === fixedName ? 'right' : false"
       >
         <template slot-scope="scope">

+ 2 - 2
src/HManagement/roleManage/modules/table.vue

@@ -1,13 +1,13 @@
 <template>
   <div>
-    <el-table ref="tables"  @select="aaaa" @select-all="selectAll" v-loading="loading" highlight-current-row :data="data" :header-cell-style="{background:'#EEEEEE',color:'#333'}" size="mini" :height="height" style="width:100%"  border>
+    <el-table ref="tables" :fit="tool.calculatedColumnWidth($refs.tables,layout)"  @select="aaaa" @select-all="selectAll" v-loading="loading" highlight-current-row :data="data" :header-cell-style="{background:'#EEEEEE',color:'#333'}" size="mini" :height="height" style="width:100%"  border>
         <el-table-column
         type="selection"
         width="45"
         align="center"
         fixed>
       </el-table-column>
-      <el-table-column :show-overflow-tooltip="col.title == '来源' || col.title == '地址' || col.title == '备注'" v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.tables,layout,index)" :fixed="col.columnname === fixedName?'right':false">
+      <el-table-column :show-overflow-tooltip="col.title == '来源' || col.title == '地址' || col.title == '备注'" v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150" :fixed="col.columnname === fixedName?'right':false">
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->
           <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

+ 9 - 8
src/SDrpManagement/QuotedPrice/detail/components/table.vue

@@ -1,19 +1,20 @@
 <template>
   <div>
     <el-table ref="tables"
-              :row-class-name="tableClassName"
-              v-loading="loading" highlight-current-row
-              :data="data"
-              :header-cell-style="{background:'#EEEEEE',color:'#333'}" size="mini"
-              :height="height" @row-click="rowClick" style="width:100%"
-               border
-              @select="select"
+      :fit="tool.calculatedColumnWidth($refs.tables,layout)"
+      :row-class-name="tableClassName"
+      v-loading="loading" highlight-current-row
+      :data="data"
+      :header-cell-style="{background:'#EEEEEE',color:'#333'}" size="mini"
+      :height="height" @row-click="rowClick" style="width:100%"
+      border
+      @select="select"
       >
       <el-table-column
           type="selection"
           width="55" @handleSelectionChange="handleSelectionChange"  v-if="checkbox">
       </el-table-column>
-      <el-table-column :show-overflow-tooltip="col.title == '来源' || col.title == '地址' || col.title == '备注'" v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.tables,layout,index)">
+      <el-table-column :show-overflow-tooltip="col.title == '来源' || col.title == '地址' || col.title == '备注'" v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150">
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->
           <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

+ 2 - 1
src/SDrpManagement/salerPrivatecustomer/components/table.vue

@@ -2,6 +2,7 @@
   <div>
     <el-table
       ref="tables"
+      :fit="tool.calculatedColumnWidth($refs.tables,layout)"
       :row-class-name="tableClassName"
       v-loading="loading"
       highlight-current-row
@@ -29,7 +30,7 @@
         :key="col.tablecolid"
         :prop="col.columnname"
         :label="$t(col.title)"
-        :min-width="tool.calcTableColWidth($refs.tables,layout,index)"
+        :min-width="col.width || 150"
       >
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->

+ 2 - 1
src/SManagement/project_target/modules/components/projectAdd/table.vue

@@ -1,6 +1,7 @@
 <template>
   <div>
     <el-table ref="tables"
+    :fit="tool.calculatedColumnWidth($refs.tables,layout)"
               :row-class-name="tableClassName"
               v-loading="loading" highlight-current-row
               :data="data"
@@ -13,7 +14,7 @@
           type="selection"
           width="55" @handleSelectionChange="handleSelectionChange"  v-if="checkbox">
       </el-table-column>
-      <el-table-column :show-overflow-tooltip="col.title == '来源' || col.title == '地址' || col.title == '备注'" v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.tables,layout,index)">
+      <el-table-column :show-overflow-tooltip="col.title == '来源' || col.title == '地址' || col.title == '备注'" v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150">
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->
           <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

+ 2 - 2
src/SManagement/sales_forecast/components/mergeTable.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
-    <el-table ref="table" :span-method="arraySpanMethod" :row-class-name="tableClassName" v-loading="loading" highlight-current-row :data="data1" :header-cell-style="{background:'#EEEEEE',color:'#333'}" size="mini" :height="height" @row-click="rowClick" style="width:100%"  border>
-      <el-table-column v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.table,layout,index)">
+    <el-table ref="table" :fit="tool.calculatedColumnWidth($refs.table,layout)" :span-method="arraySpanMethod" :row-class-name="tableClassName" v-loading="loading" highlight-current-row :data="data1" :header-cell-style="{background:'#EEEEEE',color:'#333'}" size="mini" :height="height" @row-click="rowClick" style="width:100%"  border>
+      <el-table-column v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150">
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->
           <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

+ 2 - 2
src/SManagement/sales_forecast/components/readHeaderTable.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
-    <el-table ref="table" :row-class-name="tableClassName" v-loading="loading" highlight-current-row :data="data" :header-cell-style="{background:'#EEEEEE',color:'#333'}" size="mini" :height="height" @row-click="rowClick" style="width:100%"  border>
-      <el-table-column :render-header="(h,obj) => readHeaderFun1(h, obj, col.columnname)" v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.table,layout,index)">
+    <el-table ref="table" :fit="tool.calculatedColumnWidth($refs.table,layout)" :row-class-name="tableClassName" v-loading="loading" highlight-current-row :data="data" :header-cell-style="{background:'#EEEEEE',color:'#333'}" size="mini" :height="height" @row-click="rowClick" style="width:100%"  border>
+      <el-table-column :render-header="(h,obj) => readHeaderFun1(h, obj, col.columnname)" v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150">
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->
           <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

+ 2 - 1
src/components/dynamic-newTable/index.vue

@@ -9,6 +9,7 @@
       size="mini"
       :height="height ? height : data.length <= 5?'280px':'calc(100vh - 268px)'"
       @row-click="rowClick"
+      :fit="tool.calculatedColumnWidth($refs.table,layout)"
       :style="{width:'100%',minHeight:minHeight?minHeight:''}"
       :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}"
       :cell-style="{height:'40px',color:'#666666',fontWeight:'400'}"
@@ -23,7 +24,7 @@
         :prop="col.columnname"
         :label="col.title"
         :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?redirect ? redirect : 'right' :false : false"
-        :min-width="tool.calcTableColWidth($refs.table,layout,index)"
+        :min-width="col.width || 150"
       >
         <template v-slot:header="{ column,$index }" v-if="customHeader">
           <slot name="header" :data="column"></slot>

+ 2 - 1
src/components/dynamic-newTable/index1.vue

@@ -9,6 +9,7 @@
       size="mini"
       :height="height ? height : data.length <= 5?'280px':'calc(100vh - 268px)'"
       @row-click="rowClick"
+      :fit="tool.calculatedColumnWidth($refs.table,layout)"
       style="width:100%;"
       :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}"
       :cell-style="{height:'40px',color:'#666666',fontWeight:'400'}"
@@ -22,7 +23,7 @@
         :key="col.tablecolid"
         :prop="col.columnname"
         :label="col.title"
-        :min-width="tool.calcTableColWidth($refs.table,layout,index)"
+        :min-width="col.width || 150"
         :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?redirect ? redirect : 'right' :false : false"
       >
         <template

+ 111 - 57
src/components/dynamic-newTable/index2.vue

@@ -1,26 +1,67 @@
 <template>
   <div>
     <!-- :header-cell-style="{background:'#EEEEEE',color:'#333'}" -->
-    <el-table ref="table" :row-class-name="tableClassName" highlight-current-row :data="data"  size="mini"  :height="height ? height : data.length <= 5?'280px':'calc(100vh - 268px)'"  @row-click="rowClick" :style="{width:'100%',minHeight:minHeight?minHeight:''}" :header-cell-style="{background:'#fafafafa',height:'40px',color:'#000000',fontSize:'12px'}"
-              :cell-style="{height:'40px',color:'#666666',fontWeight:'400'}" border @selection-change="selectionChange"
-              :row-key="rowKey"
-            >
-      <el-table-column
-          type="selection"
-          width="35" fixed v-if="checkbox">
+    <el-table
+      ref="table"
+      :row-class-name="tableClassName"
+      highlight-current-row
+      :data="data"
+      size="mini"
+      :height="
+        height ? height : data.length <= 5 ? '280px' : 'calc(100vh - 268px)'
+      "
+      :fit="tool.calculatedColumnWidth($refs.table, layout)"
+      @row-click="rowClick"
+      :style="{ width: '100%', minHeight: minHeight ? minHeight : '' }"
+      :header-cell-style="{
+        background: '#fafafafa',
+        height: '40px',
+        color: '#000000',
+        fontSize: '12px',
+      }"
+      :cell-style="{ height: '40px', color: '#666666', fontWeight: '400' }"
+      border
+      @selection-change="selectionChange"
+      :row-key="rowKey"
+    >
+      <el-table-column type="selection" width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column show-overflow-tooltip v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.table,layout,index)" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?redirect ? redirect : 'right' :false : false">
-        <template v-slot:header="{ column,$index }" v-if="customHeader">
+      <el-table-column
+        show-overflow-tooltip
+        v-for="(col, index) in layout"
+        :key="col.tablecolid"
+        :prop="col.columnname"
+        :label="col.title"
+        :min-width="col.width || 150"
+        :fixed="
+          fixedName
+            ? fixedName.indexOf(col.columnname) != -1
+              ? redirect
+                ? redirect
+                : 'right'
+              : false
+            : false
+        "
+      >
+        <template v-slot:header="{ column, $index }" v-if="customHeader">
           <slot name="header" :data="column"></slot>
         </template>
         <template slot-scope="scope">
           <div class="table-panel">
             <!-- 自定义表格显示内容 -->
-            <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>
+            <slot
+              v-if="custom"
+              name="customcol"
+              :column="{ data: scope.row, columnname: col.columnname }"
+            ></slot>
             <!-- 否则就是默认 -->
-            <span v-else>{{scope.row[col.columnname]}}</span>
+            <span v-else>{{ scope.row[col.columnname] }}</span>
             <!-- 操作结构内容 -->
-            <slot v-if="col.columnname === 'operation'" name="opreation" :data="scope.row"></slot>
+            <slot
+              v-if="col.columnname === 'operation'"
+              name="opreation"
+              :data="scope.row"
+            ></slot>
           </div>
         </template>
       </el-table-column>
@@ -29,8 +70,8 @@
 </template>
 
 <script>
-import {mapGetters} from "vuex"
-import Sortable from 'sortablejs'
+import { mapGetters } from "vuex";
+import Sortable from "sortablejs";
 export default {
   /*
     layout:表结构数据;
@@ -38,63 +79,76 @@ export default {
     custom:是否启用自定义结构;
     opwidth:操作列宽度
   */
-  props:['layout','data','custom','height','fixedName','width','checkbox','redirect','customHeader','minHeight','rowKey'],
-  data () {
+  props: [
+    "layout",
+    "data",
+    "custom",
+    "height",
+    "fixedName",
+    "width",
+    "checkbox",
+    "redirect",
+    "customHeader",
+    "minHeight",
+    "rowKey",
+  ],
+  data() {
     return {
-      list:[],
-      isCopy:true,
-      isRowSort:true,
-      highlightCurrentRow:[],
-      isShowTreeStyle:true
-    }
+      list: [],
+      isCopy: true,
+      isRowSort: true,
+      highlightCurrentRow: [],
+      isShowTreeStyle: true,
+    };
   },
-  computed:{
+  computed: {
     ...mapGetters({
-      loading:'loading'
-    })
+      loading: "loading",
+    }),
   },
-  watch:{
-    data(val){
-      this.doLayout()
-    }
+  watch: {
+    data(val) {
+      this.doLayout();
+    },
   },
-  methods:{
-    rowClick (row) {
-      this.$emit('rowClick',row)
+  methods: {
+    rowClick(row) {
+      this.$emit("rowClick", row);
     },
-    tableClassName ({row,rowIndex}) {
-      row.index = rowIndex
+    tableClassName({ row, rowIndex }) {
+      row.index = rowIndex;
     },
-    selectionChange(row){
-      this.$emit('selectionChange',row)
+    selectionChange(row) {
+      this.$emit("selectionChange", row);
     },
-    doLayout(){
-      if (this.$refs.table){
-        this.$nextTick(()=>{
-          this.$refs.table.doLayout()
-        })
+    doLayout() {
+      if (this.$refs.table) {
+        this.$nextTick(() => {
+          this.$refs.table.doLayout();
+        });
       }
     },
     initSort() {
-      if (!this.isRowSort) return
-      const el = this.$refs['table'].$el.querySelector('.el-table__body-wrapper > table > tbody')
+      if (!this.isRowSort) return;
+      const el = this.$refs["table"].$el.querySelector(
+        ".el-table__body-wrapper > table > tbody"
+      );
       new Sortable(el, {
         animation: 150, // 动画
-        onEnd: evt => {
-          const curRow = this.data.splice(evt.oldIndex, 1)[0]
-          this.$nextTick(()=>{
-            this.data.splice(evt.newIndex, 0, curRow)
-            this.$emit('rowSort', this.data)
-          })
-        }
-      })
-    }
+        onEnd: (evt) => {
+          const curRow = this.data.splice(evt.oldIndex, 1)[0];
+          this.$nextTick(() => {
+            this.data.splice(evt.newIndex, 0, curRow);
+            this.$emit("rowSort", this.data);
+          });
+        },
+      });
+    },
   },
-  mounted () {
-    this.initSort()
-  }
-}
-
+  mounted() {
+    this.initSort();
+  },
+};
 </script>
 <style>
 </style>

+ 2 - 2
src/components/dynamic-table-detail/index.vue

@@ -1,13 +1,13 @@
 <template>
   <div>
     <!-- :header-cell-style="{background:'#EEEEEE',color:'#333'}" -->
-    <el-table ref="table" :row-class-name="tableClassName" highlight-current-row :data="data"  size="mini"  :height="height"  @row-click="rowClick" :style="{width:'100%',minHeight:minHeight?minHeight:''}" :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}"
+    <el-table ref="table" :fit="tool.calculatedColumnWidth($refs.table,layout)" :row-class-name="tableClassName" highlight-current-row :data="data"  size="mini"  :height="height"  @row-click="rowClick" :style="{width:'100%',minHeight:minHeight?minHeight:''}" :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}"
               :cell-style="{height:'40px',color:'#666666',fontWeight:'400'}" border @selection-change="selectionChange">
       <el-table-column
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column show-overflow-tooltip v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.table,layout,index)" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?redirect ? redirect : 'right' :false : false">
+      <el-table-column show-overflow-tooltip v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?redirect ? redirect : 'right' :false : false">
         <template v-slot:header="{ column,$index }" v-if="customHeader">
           <slot name="header" :data="column"></slot>
         </template>

+ 2 - 1
src/components/dynamic-table-merge/index.vue

@@ -6,6 +6,7 @@
       :row-class-name="tableClassName"
       :data="data"
       size="mini"
+      :fit="tool.calculatedColumnWidth($refs.table,layout)"
       :height="height ? height : data.length <= 4?'260px':data.length <= 20?'calc(100vh - 420px)':'calc(100vh - 420px)'"
       @row-click="rowClick"
       style="width:100%"
@@ -21,7 +22,7 @@
         :key="col.tablecolid"
         :prop="col.columnname"
         :label="col.title"
-        :min-width="tool.calcTableColWidth($refs.table,layout,index)"
+        :min-width="col.width || 150"
         :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?redirect ? redirect : 'right' :false : false"
       >
         <template v-slot:header="{ column,$index }" v-if="customHeader">

+ 2 - 1
src/components/dynamic-table/index.vue

@@ -7,6 +7,7 @@
       highlight-current-row
       :data="data"
       size="mini"
+      :fit="tool.calculatedColumnWidth($refs.table,layout)"
       :height="height ? height : data.length <= 4?'260px':data.length <= 20?'calc(100vh - 420px)':'calc(100vh - 420px)'"
       @row-click="rowClick"
       style="width:100%;min-height:260px;max-height: calc(100vh - 420px)"
@@ -21,7 +22,7 @@
         :key="col.tablecolid"
         :prop="col.columnname"
         :label="col.title"
-        :min-width="tool.calcTableColWidth($refs.table,layout,index)"
+        :min-width="col.width || 150"
         :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?redirect ? redirect : 'right' :false : false"
       >
         <template v-slot:header="{ column,$index }" v-if="customHeader">

+ 2 - 1
src/components/dynamic-table/index1.vue

@@ -3,6 +3,7 @@
     <!-- :header-cell-style="{background:'#EEEEEE',color:'#333'}" -->
     <el-table
       ref="table"
+      :fit="tool.calculatedColumnWidth($refs.table,layout)"
       :row-class-name="tableClassName"
       highlight-current-row
       :data="data"
@@ -21,7 +22,7 @@
         :key="col.tablecolid"
         :prop="col.columnname"
         :label="col.title"
-        :min-width="tool.calcTableColWidth($refs.table,layout,index)"
+        :min-width="col.width || 150"
         :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?redirect ? redirect : 'right' :false : false"
       >
         <template v-slot:header="{ column,$index }" v-if="customHeader">

+ 2 - 1
src/components/dynamic-table/index2.vue

@@ -3,6 +3,7 @@
     <!-- :header-cell-style="{background:'#EEEEEE',color:'#333'}" -->
     <el-table
       ref="table"
+      :fit="tool.calculatedColumnWidth($refs.table,layout)"
       :row-class-name="tableClassName"
       highlight-current-row
       :data="data"
@@ -21,7 +22,7 @@
         :key="col.tablecolid"
         :prop="col.columnname"
         :label="col.title"
-        :min-width="tool.calcTableColWidth($refs.table,layout,index)"
+        :min-width="col.width || 150"
         :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?redirect ? redirect : 'right' :false : false"
       >
         <template v-slot:header="{ column,$index }" v-if="customHeader">

+ 2 - 1
src/components/dynamic-table/index3.vue

@@ -4,6 +4,7 @@
     <el-table
       ref="table"
       :row-class-name="tableClassName"
+      :fit="tool.calculatedColumnWidth($refs.table,layout)"
       highlight-current-row
       :data="data"
       size="mini"
@@ -21,7 +22,7 @@
         :key="col.tablecolid"
         :prop="col.columnname"
         :label="col.title"
-        :min-width="tool.calcTableColWidth($refs.table,layout,index)"
+        :min-width="col.width || 150"
         :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?redirect ? redirect : 'right' :false : false"
       >
         <template

+ 2 - 2
src/components/normal-basic-layout-new/modules/table.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="bs-table" :style="{height:height?height:'calc(100vh - 330px)'}">
-    <el-table :data="data"  border stripe ref="tables" :row-class-name="tableClassName" :header-cell-style="{background:'#fafafafa',height:'40px','color':'#000000'}" highlight-current-row  size="mini" @row-click="rowClick" height="100%" style="width:100%;" @selection-change="handleSelectionChange" >
+    <el-table :data="data"  border stripe ref="tables" :fit="tool.calculatedColumnWidth($refs.tables,layout)" :row-class-name="tableClassName" :header-cell-style="{background:'#fafafafa',height:'40px','color':'#000000'}" highlight-current-row  size="mini" @row-click="rowClick" height="100%" style="width:100%;" @selection-change="handleSelectionChange" >
       <!-- <div slot="empty">
         <el-empty :image="require('../../../assets/empty.svg')" :image-size="250">
         </el-empty>
@@ -11,7 +11,7 @@
         align="center"
         @handleSelectionChange="handleSelectionChange">
       </el-table-column>
-      <el-table-column show-overflow-tooltip v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.tables,layout,index)" :fixed="checkFixed(col.columnname)">
+      <el-table-column show-overflow-tooltip v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150" :fixed="checkFixed(col.columnname)">
         <template slot-scope="scope">
 
           <slot v-if="col.columnname !== 'operation'" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

+ 2 - 2
src/components/normal-basic-layout-new/modules/tableBook.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="bs-table" :style="{height:height?height:'calc(100vh - 330px)'}">
-    <el-table :data="data"  border stripe ref="tables" :row-class-name="tableClassName" :header-cell-style="{background:'#fafafafa',height:'40px','color':'#000000'}" highlight-current-row  size="mini" @row-click="rowClick" height="100%" style="width:100%;" @selection-change="handleSelectionChange" >
+    <el-table :data="data"  border stripe ref="tables" :fit="tool.calculatedColumnWidth($refs.tables,layout)" :row-class-name="tableClassName" :header-cell-style="{background:'#fafafafa',height:'40px','color':'#000000'}" highlight-current-row  size="mini" @row-click="rowClick" height="100%" style="width:100%;" @selection-change="handleSelectionChange" >
       <!-- <div slot="empty">
         <el-empty :image="require('../../../assets/empty.svg')" :image-size="250">
         </el-empty>
@@ -11,7 +11,7 @@
         align="center"
         @handleSelectionChange="handleSelectionChange">
       </el-table-column>
-      <el-table-column show-overflow-tooltip v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title"  :min-width="tool.calcTableColWidth($refs.tables,layout,index)" :fixed="checkFixed(col.columnname)">
+      <el-table-column show-overflow-tooltip v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title"  :min-width="col.width || 150" :fixed="checkFixed(col.columnname)">
         <template slot-scope="scope">
 
           <slot v-if="col.columnname !== 'operation'" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

+ 2 - 2
src/components/normal-basic-layout/modules/table.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="bs-table" :style="{height:height?height:'calc(100vh - 330px)'}">
-    <el-table border stripe ref="tables" :row-class-name="tableClassName" :header-cell-style="{background:'#fafafafa',height:'40px','color':'#000000'}" highlight-current-row :data="data" size="mini" @row-click="rowClick" height="100%" style="width:100%;" @selection-change="handleSelectionChange" >
+    <el-table border stripe ref="tables" :fit="tool.calculatedColumnWidth($refs.tables,layout)" :row-class-name="tableClassName" :header-cell-style="{background:'#fafafafa',height:'40px','color':'#000000'}" highlight-current-row :data="data" size="mini" @row-click="rowClick" height="100%" style="width:100%;" @selection-change="handleSelectionChange" >
       <!-- <div slot="empty">
         <el-empty :image="require('../../../assets/empty.svg')" :image-size="250">
         </el-empty>
@@ -11,7 +11,7 @@
         align="center"
         @handleSelectionChange="handleSelectionChange">
       </el-table-column>
-      <el-table-column show-overflow-tooltip v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :min-width="tool.calcTableColWidth($refs.tables,layout,index)" :label="$t(col.title)" :fixed="checkFixed(col.columnname)">
+      <el-table-column show-overflow-tooltip v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :min-width="col.width || 150" :label="$t(col.title)" :fixed="checkFixed(col.columnname)">
         <template slot-scope="scope">
 
           <slot v-if="col.columnname !== 'operation'" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

+ 2 - 2
src/components/selectTable/index.vue

@@ -1,13 +1,13 @@
 <template>
   <div>
-    <el-table ref="tables"  @select="aaaa" @select-all="selectAll" v-loading="loading" highlight-current-row :data="data" size="mini" :height="height" style="width:100%"  border>
+    <el-table ref="tables" :fit="tool.calculatedColumnWidth($refs.tables,layout)"  @select="aaaa" @select-all="selectAll" v-loading="loading" highlight-current-row :data="data" size="mini" :height="height" style="width:100%"  border>
         <el-table-column
         type="selection"
         width="45"
         align="center"
         fixed>
       </el-table-column>
-      <el-table-column v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.tables,layout,index)" :fixed="col.columnname === fixedName?'right':false">
+      <el-table-column v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150" :fixed="col.columnname === fixedName?'right':false">
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->
           <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

+ 2 - 2
src/components/table/index.vue

@@ -1,11 +1,11 @@
 <template>
   <div>
-    <el-table ref="tables" :row-class-name="tableClassName" v-loading="loading" highlight-current-row :data="data" :header-cell-style="{background:'#EEEEEE',color:'#333'}" size="mini" :height="height" @row-click="rowClick" style="width:100%" @selection-change="handleSelectionChange"  border>
+    <el-table ref="tables" :fit="tool.calculatedColumnWidth($refs.tables,layout)" :row-class-name="tableClassName" v-loading="loading" highlight-current-row :data="data" :header-cell-style="{background:'#EEEEEE',color:'#333'}" size="mini" :height="height" @row-click="rowClick" style="width:100%" @selection-change="handleSelectionChange"  border>
       <el-table-column
         type="selection"
         width="55" @handleSelectionChange="handleSelectionChange" v-if="checkbox" :selectable="isCheck">
       </el-table-column>
-      <el-table-column :show-overflow-tooltip="col.title == '来源' || col.title == '地址' || col.title == '备注'" v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.tables,layout,index)">
+      <el-table-column :show-overflow-tooltip="col.title == '来源' || col.title == '地址' || col.title == '备注'" v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150">
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->
           <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

+ 2 - 2
src/components/table/index10.vue

@@ -1,14 +1,14 @@
 <template>
   <div>
     <!-- :header-cell-style="{background:'#EEEEEE',color:'#333'}" -->
-    <el-table ref="table" :row-class-name="tableClassName" highlight-current-row :data="data"  size="small"    @row-click="rowClick" show-summary
+    <el-table ref="table" :fit="tool.calculatedColumnWidth($refs.table,layout)" :row-class-name="tableClassName" highlight-current-row :data="data"  size="small"    @row-click="rowClick" show-summary
               style="width:100%;" :header-cell-style="{height:'60px',fontWeight:'400',fontSize:'22px',color:'#333333',background:'#ddebf7'}"
               :cell-style="{height:'40px',fontWeight:'400',fontSize:'18px'}" border @selection-change="selectionChange" >
       <el-table-column
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="$t(col.title)" :min-width="tool.calcTableColWidth($refs.table,layout,index)" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
+      <el-table-column v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="$t(col.title)" :min-width="col.width || 150" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
         <template :slot="headerOptions ? headerOptions.includes(col.columnname) ? 'header' : '' : ''" slot-scope="scope">
           <slot name="header" :column="{data:scope.row,columnname:col.columnname}"></slot>
         </template>

+ 2 - 2
src/components/table/index2.vue

@@ -1,11 +1,11 @@
 <template>
   <div>
-    <el-table ref="tables" :row-class-name="tableClassName" v-loading="loading" highlight-current-row :data="data" :header-cell-style="{background:'#EEEEEE',color:'#333'}" size="mini" :height="height" @row-click="rowClick" style="width:100%" @selection-change="handleSelectionChange"  border>
+    <el-table ref="tables" :fit="tool.calculatedColumnWidth($refs.tables,layout)" :row-class-name="tableClassName" v-loading="loading" highlight-current-row :data="data" :header-cell-style="{background:'#EEEEEE',color:'#333'}" size="mini" :height="height" @row-click="rowClick" style="width:100%" @selection-change="handleSelectionChange"  border>
       <el-table-column
         type="selection"
         width="55" @handleSelectionChange="handleSelectionChange" v-if="checkbox">
       </el-table-column>
-      <el-table-column :show-overflow-tooltip="col.title == '来源' || col.title == '地址' || col.title == '备注'" v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.tables,layout,index)">
+      <el-table-column :show-overflow-tooltip="col.title == '来源' || col.title == '地址' || col.title == '备注'" v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150">
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->
           <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

+ 2 - 2
src/components/table/index3.vue

@@ -1,11 +1,11 @@
 <template>
   <div>
-    <el-table ref="tables" :row-class-name="tableClassName" v-loading="loading" highlight-current-row :data="data" :header-cell-style="{background:'#EEEEEE',color:'#333'}" size="mini" :height="height" @row-click="rowClick" style="width:100%" @selection-change="handleSelectionChange"  border>
+    <el-table ref="tables" :fit="tool.calculatedColumnWidth($refs.tables,layout)" :row-class-name="tableClassName" v-loading="loading" highlight-current-row :data="data" :header-cell-style="{background:'#EEEEEE',color:'#333'}" size="mini" :height="height" @row-click="rowClick" style="width:100%" @selection-change="handleSelectionChange"  border>
       <el-table-column
         type="selection"
         width="55" @handleSelectionChange="handleSelectionChange"  v-if="checkbox">
       </el-table-column>
-      <el-table-column :show-overflow-tooltip="col.title == '来源' || col.title == '地址' || col.title == '备注'" v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.tables,layout,index)">
+      <el-table-column :show-overflow-tooltip="col.title == '来源' || col.title == '地址' || col.title == '备注'" v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150">
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->
           <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

+ 2 - 2
src/components/table/index5.vue

@@ -1,14 +1,14 @@
 <template>
   <div>
     <!-- :header-cell-style="{background:'#EEEEEE',color:'#333'}" -->
-    <el-table ref="table" :row-class-name="tableClassName" highlight-current-row :data="data"  size="mini"  :height="height ==''?data.length <= 4?'260px':data.length <= 20?'':'calc(100vh - 420px)':height"  @row-click="rowClick"
+    <el-table ref="table" :fit="tool.calculatedColumnWidth($refs.table,layout)" :row-class-name="tableClassName" highlight-current-row :data="data"  size="mini"  :height="height ==''?data.length <= 4?'260px':data.length <= 20?'':'calc(100vh - 420px)':height"  @row-click="rowClick"
               style="width:100%;min-height:260px;max-height: calc(100vh - 420px)" :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}"
               :cell-style="{height:'40px',color:'#666666',fontWeight:'400'}" border @selection-change="selectionChange" >
       <el-table-column
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.table,layout,index)" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
+      <el-table-column v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
         <template :slot="headerOptions ? headerOptions.includes(col.columnname) ? 'header' : '' : ''" slot-scope="scope">
           <slot name="header" :column="{data:scope.row,columnname:col.columnname}"></slot>
         </template>

+ 2 - 2
src/components/table/index6.vue

@@ -1,14 +1,14 @@
 <template>
   <div>
     <!-- :header-cell-style="{background:'#EEEEEE',color:'#333'}" -->
-    <el-table ref="table" :row-class-name="tableClassName" highlight-current-row :data="data"  size="mini"  :height="height ==''?data.length <= 4?'260px':data.length <= 20?'calc(100vh - 420px)':'calc(100vh - 420px)':height"  @row-click="rowClick"
+    <el-table ref="table" :fit="tool.calculatedColumnWidth($refs.table,layout)" :row-class-name="tableClassName" highlight-current-row :data="data"  size="mini"  :height="height ==''?data.length <= 4?'260px':data.length <= 20?'calc(100vh - 420px)':'calc(100vh - 420px)':height"  @row-click="rowClick"
               style="width:100%;" :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}" tooltip-effect="dark"
               :cell-style="{height:'40px',color:'#666666',fontWeight:'400'}" border @selection-change="selectionChange" >
       <el-table-column
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column  v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.table,layout,index)" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
+      <el-table-column  v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
         <template :slot="headerOptions ? headerOptions.includes(col.columnname) ? 'header' : '' : ''" slot-scope="scope">
           <slot name="header" :column="{data:scope.row,columnname:col.columnname}"></slot>
         </template>

+ 2 - 2
src/components/table/index7.vue

@@ -1,14 +1,14 @@
 <template>
   <div>
     <!-- :header-cell-style="{background:'#EEEEEE',color:'#333'}" -->
-    <el-table ref="table" :row-class-name="tableClassName" highlight-current-row :data="data"  size="mini"  :height="data.length <= 4?'260px':''"  @row-click="rowClick"
+    <el-table ref="table" :fit="tool.calculatedColumnWidth($refs.table,layout)" :row-class-name="tableClassName" highlight-current-row :data="data"  size="mini"  :height="data.length <= 4?'260px':''"  @row-click="rowClick"
               style="width:100%;min-height:260px;max-height: calc(100vh - 420px)" :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}"
               :cell-style="{height:'40px',color:'#666666',fontWeight:'400'}" border @selection-change="selectionChange" >
       <el-table-column
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.table,layout,index)" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
+      <el-table-column v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
         <template slot-scope="scope">
           <div class="table-panel">
             <!-- 自定义表格显示内容 -->

+ 2 - 2
src/components/table/index8.vue

@@ -1,14 +1,14 @@
 <template>
   <div>
     <!-- :header-cell-style="{background:'#EEEEEE',color:'#333'}" -->
-    <el-table ref="table" :row-class-name="tableClassName" highlight-current-row :data="data"  size="mini"  :height="data.length <= 4?'260px':height"  @row-click="rowClick"
+    <el-table ref="table" :fit="tool.calculatedColumnWidth($refs.table,layout)" :row-class-name="tableClassName" highlight-current-row :data="data"  size="mini"  :height="data.length <= 4?'260px':height"  @row-click="rowClick"
               style="width:100%;" :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}"
               :cell-style="{height:'40px',color:'#666666',fontWeight:'400'}" border @selection-change="selectionChange" >
       <el-table-column
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.table,layout,index)" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
+      <el-table-column v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
         <template slot-scope="scope">
           <div class="table-panel">
             <!-- 自定义表格显示内容 -->

+ 2 - 2
src/components/table/index9.vue

@@ -1,14 +1,14 @@
 <template>
   <div>
     <!-- :header-cell-style="{background:'#EEEEEE',color:'#333'}" -->
-    <el-table ref="table" :row-class-name="tableClassName" highlight-current-row :data="data"  size="mini"  :height="height ==''?data.length <= 4?'260px':data.length <= 20?'441px':'441px':height"  @row-click="rowClick"
+    <el-table ref="table" :fit="tool.calculatedColumnWidth($refs.table,layout)" :row-class-name="tableClassName" highlight-current-row :data="data"  size="mini"  :height="height ==''?data.length <= 4?'260px':data.length <= 20?'441px':'441px':height"  @row-click="rowClick"
               style="width:100%;" :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}" tooltip-effect="dark"
               :cell-style="{height:'40px',color:'#666666',fontWeight:'400'}" border @selection-change="selectionChange" >
       <el-table-column
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column  v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.table,layout,index)" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
+      <el-table-column  v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
         <template :slot="headerOptions ? headerOptions.includes(col.columnname) ? 'header' : '' : ''" slot-scope="scope">
           <slot name="header" :column="{data:scope.row,columnname:col.columnname}"></slot>
         </template>

+ 2 - 1
src/optionSystem/FProductManage/modules/table.vue

@@ -4,6 +4,7 @@
     <el-table
       v-loading="loading"
       ref="table"
+      :fit="tool.calculatedColumnWidth($refs.table,layout)"
       :row-class-name="tableClassName"
       highlight-current-row
       :data="data != undefined ? data : list"
@@ -33,7 +34,7 @@
         :key="col.tablecolid"
         :prop="col.columnname"
         :label="col.title"
-        :min-width="tool.calcTableColWidth($refs.table, layout, index)"
+        :min-width="col.width || 150"
         :fixed="
           fixedName
             ? fixedName == col.columnname

+ 2 - 2
src/template/addProduct/table.vue

@@ -1,11 +1,11 @@
 <template>
   <div>
-    <el-table ref="table" @selection-change="selectionChange" :header-cell-style="{height:'40px','color':'#333333'}" :row-class-name="tableClassName" highlight-current-row :data="data"  size="mini" :height="height" @row-click="rowClick" style="width:100%;min-height:300px;"  border >
+    <el-table ref="table" :fit="tool.calculatedColumnWidth($refs.table,layout)" @selection-change="selectionChange" :header-cell-style="{height:'40px','color':'#333333'}" :row-class-name="tableClassName" highlight-current-row :data="data"  size="mini" :height="height" @row-click="rowClick" style="width:100%;min-height:300px;"  border >
       <el-table-column
           type="selection"
           width="55"  fixed>
       </el-table-column>
-      <el-table-column v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.table,layout,index)" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
+      <el-table-column v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
         <template slot-scope="scope">
           <div class="table-panel" style="color: #333333">
             <!-- 自定义表格显示内容 -->

+ 2 - 2
src/template/addProductContract/table.vue

@@ -1,11 +1,11 @@
 <template>
   <div>
-    <el-table ref="table" @selection-change="selectionChange" :header-cell-style="{height:'40px','color':'#333333'}" :row-class-name="tableClassName" highlight-current-row :data="data"  size="mini" :height="height" @row-click="rowClick" style="width:100%;min-height:300px;"  border >
+    <el-table ref="table" :fit="tool.calculatedColumnWidth($refs.table,layout)" @selection-change="selectionChange" :header-cell-style="{height:'40px','color':'#333333'}" :row-class-name="tableClassName" highlight-current-row :data="data"  size="mini" :height="height" @row-click="rowClick" style="width:100%;min-height:300px;"  border >
       <el-table-column
           type="selection"
           width="55"  fixed>
       </el-table-column>
-      <el-table-column v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.table,layout,index)" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
+      <el-table-column v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
         <template slot-scope="scope">
           <div class="table-panel" style="color: #333333">
             <!-- 自定义表格显示内容 -->

+ 2 - 2
src/template/addTool/table.vue

@@ -1,11 +1,11 @@
 <template>
   <div>
-    <el-table ref="table" @selection-change="selectionChange" :header-cell-style="{height:'40px','color':'#333333'}" :row-class-name="tableClassName" highlight-current-row :data="data"  size="mini" :height="height" @row-click="rowClick" style="width:100%;min-height:300px;"  border >
+    <el-table ref="table" :fit="tool.calculatedColumnWidth($refs.table,layout)" @selection-change="selectionChange" :header-cell-style="{height:'40px','color':'#333333'}" :row-class-name="tableClassName" highlight-current-row :data="data"  size="mini" :height="height" @row-click="rowClick" style="width:100%;min-height:300px;"  border >
       <el-table-column
           type="selection"
           width="55"  fixed>
       </el-table-column>
-      <el-table-column v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.table,layout,index)" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
+      <el-table-column v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
         <template slot-scope="scope">
           <div class="table-panel" style="color: #333333">
             <!-- 自定义表格显示内容 -->

+ 2 - 2
src/template/popoverTable/table.vue

@@ -2,13 +2,13 @@
   <div>
     <el-input v-if="isInput !== false" style="width:200px;" :placeholder="$t('搜索')" :suffix-icon="param.content.where.condition?param.content.where.condition.length > 0?'':'':'el-icon-search'" v-model="param.content.where.condition" @keyup.native.enter="listData(param.content.pageNumber = 1)" @clear="listData(param.content.pageNumber = 1)" size="small" class="input-with-select inline-16 layout_search__panel" clearable>
     </el-input>
-    <el-table ref="table" :row-class-name="tableClassName" highlight-current-row :data="list"  size="mini" :height="height ? height : list.length <= 5?'280px':'calc(100vh - 268px)'"  @row-click="rowClick" style="width:100%;margin-top: 10px" :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}"
+    <el-table ref="table" :fit="tool.calculatedColumnWidth($refs.table,layout)" :row-class-name="tableClassName" highlight-current-row :data="list"  size="mini" :height="height ? height : list.length <= 5?'280px':'calc(100vh - 268px)'"  @row-click="rowClick" style="width:100%;margin-top: 10px" :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}"
               :cell-style="{height:'40px',color:'#666666',fontWeight:'400'}" border @selection-change="selectionChange">
       <el-table-column
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column  ref="table" show-overflow-tooltip v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.table,layout,index)" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?redirect ? redirect : 'right' :false : false">
+      <el-table-column  ref="table" show-overflow-tooltip v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?redirect ? redirect : 'right' :false : false">
         <template v-slot:header="{ column,$index }" v-if="customHeader">
           <slot name="header" :data="column"></slot>
         </template>

+ 2 - 2
src/template/prediction/table.vue

@@ -1,11 +1,11 @@
 <template>
   <div>
-    <el-table ref="table" @selection-change="selectionChange" :header-cell-style="{height:'40px','color':'#333333'}" :row-class-name="tableClassName" highlight-current-row :data="data"  size="mini" :height="height" @row-click="rowClick" style="width:100%;min-height:300px;"  border >
+    <el-table ref="table" :fit="tool.calculatedColumnWidth($refs.table,layout)" @selection-change="selectionChange" :header-cell-style="{height:'40px','color':'#333333'}" :row-class-name="tableClassName" highlight-current-row :data="data"  size="mini" :height="height" @row-click="rowClick" style="width:100%;min-height:300px;"  border >
       <el-table-column
           type="selection"
           width="55"  fixed>
       </el-table-column>
-      <el-table-column v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.table,layout,index)" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
+      <el-table-column v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
         <template slot-scope="scope">
           <div class="table-panel" style="color: #333333">
             <!-- 自定义表格显示内容 -->

+ 2 - 2
src/template/tableMainLayout/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="bs-table" :style="{height:height?height:'calc(100vh - 330px)'}">
-    <el-table border stripe ref="tables" :row-class-name="tableClassName" :header-cell-style="{background:'#fafafafa',height:'40px','color':'#000000'}" highlight-current-row :data="data" size="mini" @row-click="rowClick" height="100%" style="width:100%;" @selection-change="handleSelectionChange" >
+    <el-table border stripe ref="tables" :fit="tool.calculatedColumnWidth($refs.tables,layout)" :row-class-name="tableClassName" :header-cell-style="{background:'#fafafafa',height:'40px','color':'#000000'}" highlight-current-row :data="data" size="mini" @row-click="rowClick" height="100%" style="width:100%;" @selection-change="handleSelectionChange" >
       <!-- <div slot="empty">
         <el-empty :image="require('../../../assets/empty.svg')" :image-size="250">
         </el-empty>
@@ -12,7 +12,7 @@
           align="center"
           @handleSelectionChange="handleSelectionChange">
       </el-table-column>
-      <el-table-column show-overflow-tooltip v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.tables,layout,index)" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?redirect ? redirect : 'right' :false : false">
+      <el-table-column show-overflow-tooltip v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?redirect ? redirect : 'right' :false : false">
         <template slot-scope="scope">
 
           <slot v-if="col.columnname !== 'operation'" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

+ 2 - 2
src/template/tableTemplate/index.vue

@@ -4,13 +4,13 @@
     <slot name="add"></slot>
     <el-input v-if="isInput !== false" style="width:200px;" :placeholder="$t('搜索')" :suffix-icon="param.content.where.condition?param.content.where.condition.length > 0?'':'':'el-icon-search'" v-model="param.content.where.condition" @keyup.native.enter="listData(param.content.pageNumber = 1)" @clear="listData(param.content.pageNumber = 1)" size="small" class="input-with-select inline-16 layout_search__panel" clearable>
     </el-input>
-    <el-table ref="table" :row-class-name="tableClassName" highlight-current-row :data="list"  size="mini" :height="height ? height : list.length <= 5?'280px':'calc(100vh - 268px)'"  @row-click="rowClick" style="width:100%;margin-top: 10px" :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}"
+    <el-table ref="table" :fit="tool.calculatedColumnWidth($refs.table,layout)" :row-class-name="tableClassName" highlight-current-row :data="list"  size="mini" :height="height ? height : list.length <= 5?'280px':'calc(100vh - 268px)'"  @row-click="rowClick" style="width:100%;margin-top: 10px" :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}"
               :cell-style="{height:'40px',color:'#666666',fontWeight:'400'}" border @selection-change="selectionChange">
       <el-table-column
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column  ref="table" show-overflow-tooltip v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.table,layout,index)" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?redirect ? redirect : 'right' :false : false">
+      <el-table-column  ref="table" show-overflow-tooltip v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?redirect ? redirect : 'right' :false : false">
         <template v-slot:header="{ column,$index }" v-if="customHeader">
           <slot name="header" :data="column"></slot>
         </template>

+ 2 - 2
src/template/tableTemplate/index1.vue

@@ -4,13 +4,13 @@
     <slot name="add"></slot>
     <el-input  style="width:200px;" :placeholder="$t('搜索')" :suffix-icon="param.content.where.condition?param.content.where.condition.length > 0?'':'':'el-icon-search'" v-model="param.content.where.condition" @keyup.native.enter="listData(param.content.pageNumber = 1)" @clear="listData(param.content.pageNumber = 1)" size="small" class="input-with-select inline-16 layout_search__panel" clearable>
     </el-input>
-    <el-table ref="table" :row-class-name="tableClassName" highlight-current-row :data="list"  size="mini" :height="height ? height : list.length <= 5?'280px':'calc(100vh - 268px)'"  @row-click="rowClick" style="width:100%;margin-top: 10px" :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}"
+    <el-table ref="table" :fit="tool.calculatedColumnWidth($refs.table,layout)" :row-class-name="tableClassName" highlight-current-row :data="list"  size="mini" :height="height ? height : list.length <= 5?'280px':'calc(100vh - 268px)'"  @row-click="rowClick" style="width:100%;margin-top: 10px" :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}"
               :cell-style="{height:'40px',color:'#666666',fontWeight:'400'}" border @selection-change="selectionChange">
       <el-table-column
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column  ref="table" show-overflow-tooltip v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="tool.calcTableColWidth($refs.table,layout,index)" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?redirect ? redirect : 'right' :false : false">
+      <el-table-column  ref="table" show-overflow-tooltip v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :min-width="col.width || 150" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?redirect ? redirect : 'right' :false : false">
         <template v-slot:header="{ column,$index }" v-if="customHeader">
           <slot name="header" :data="column"></slot>
         </template>

+ 20 - 36
src/utils/tool.js

@@ -2,7 +2,9 @@ import { Message } from 'element-ui';
 import store from "../store/index";
 import router from '@/router';
 import api from '@/api/api';
-let timer = null
+import { set } from 'nprogress';
+let timer = null,
+  _uids = [];
 export default {
   // 获取应用权限
   checkAuth (appname,auth) {
@@ -226,42 +228,24 @@ export default {
     
     return result
   },
-  //计算表格列宽度
- async calcTableColWidth (vm,layout,index) {
-    if (!vm) return
+  calculatedColumnWidth(dom, layout) {
+    if (!dom || _uids.includes(dom._uid)) return;
+    _uids.push(dom._uid)
     let lang = localStorage.getItem('lang') || 'ZH';
-    if (lang != 'ZH') {
-        const res = await new Promise((resolve, reject) => {
-          setTimeout(() => {
-            let widths = [],
-              el = vm.$el,
-              width = 0;
-            const ths = el.querySelector('.el-table__header-wrapper').querySelectorAll('table thead tr:first-child th .cell') // 获取头部列元素
-            // 定义变量 存储每列的宽度数据
-            // 获取标题中的单元格宽度
-            ths.forEach((item, i) => {
-              widths[i] = item.offsetWidth
-            })
-            if (timer) clearTimeout(timer)
-            timer = setTimeout(() => {
-              vm.doLayout()
-            }, 1000)
-            let isCheckbox = ths[0].querySelector('.el-checkbox__inner') ? 1 : 0
-            if (typeof layout == 'number') {
-              width = widths[index + isCheckbox] > layout ? widths[index + isCheckbox] : layout
-            } else {
-              width = widths[index + isCheckbox] > layout[index].width ? widths[index + isCheckbox] : layout[index].width
-            }
-            resolve(Number(width - 0 + 20))
-          });
+    if (lang!='ZH') setTimeout(() => {     
+      try {
+        const ths = dom.$el.querySelector('.el-table__header-wrapper').querySelectorAll('table thead tr:first-child th'),
+          nodes = [];
+        for (var key of ths.keys()) {
+            const node = ths[key].querySelector('.cell')
+            if (node && layout.some(v => v.title == node.innerText)) nodes.push(node);
+          } 
+        layout.forEach((v,i) => {
+          v.width = v.width > nodes[i].offsetWidth ? v.width : nodes[i].offsetWidth
         })
-         return Number(res)
-    } else {
-      if (typeof layout == 'number') {
-        return layout === 0 ? 150 : layout
-      } else {
-        return layout[index].width === 0 ? 150 : layout[index].width
-      }
-    }
+        _uids = _uids.filter(v => v != _uids)
+      } catch (error) {}
+    });
+    return true
   },
 }

+ 2 - 2
src/views/salesData/components/table.vue

@@ -1,14 +1,14 @@
 <template>
   <div>
     <!-- :header-cell-style="{background:'#EEEEEE',color:'#333'}" -->
-    <el-table :loading="loading" ref="table" :row-class-name="tableClassName" highlight-current-row :data="data"  size="mini"  :height="height"  @row-click="rowClick"
+    <el-table :loading="loading" ref="table" :fit="tool.calculatedColumnWidth($refs.table,layout)" :row-class-name="tableClassName" highlight-current-row :data="data"  size="mini"  :height="height"  @row-click="rowClick"
               style="width:100%;" :header-cell-style="{height:'40px',color:'#606266',fontWeight:'400',fontSize:'14px'}"
               :cell-style="{height:'40px',color:'#666666',fontWeight:'400'}" border @selection-change="selectionChange" >
       <el-table-column
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="$t(col.title)" :min-width="tool.calcTableColWidth($refs.table,layout,index)" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
+      <el-table-column v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :label="$t(col.title)" :min-width="col.width || 150" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
         <template slot-scope="scope">
           <div class="table-panel">
             <!-- 自定义表格显示内容 -->