Forráskód Böngészése

宽度自适应完成1

codeMan 1 éve
szülő
commit
c3586b1b09
44 módosított fájl, 78 hozzáadás és 119 törlés
  1. 1 1
      src/HDrpManagement/ProductMag/modules/productGroup.vue
  2. 1 1
      src/HDrpManagement/competitor/detail/modules/competeProjects/components/table.vue
  3. 1 1
      src/HDrpManagement/contractManage/components/productClassList/table.vue
  4. 2 2
      src/HDrpManagement/orderManage/details/tabs/table.vue
  5. 1 1
      src/HDrpManagement/payvoucher/components/table.vue
  6. 1 1
      src/HDrpManagement/productMoneyOdd/components/table.vue
  7. 1 1
      src/HDrpManagement/projectChange/modules/modules/andEnterprise/components/table.vue
  8. 1 1
      src/HDrpManagement/projectData/components/table.vue
  9. 1 1
      src/HManagement/roleManage/modules/table.vue
  10. 1 1
      src/SDrpManagement/QuotedPrice/detail/components/table.vue
  11. 1 0
      src/SDrpManagement/QuotedPrice/index.vue
  12. 1 1
      src/SManagement/project_target/modules/components/projectAdd/table.vue
  13. 1 1
      src/SManagement/sales_forecast/components/mergeTable.vue
  14. 1 1
      src/components/dynamic-newTable/index.vue
  15. 1 1
      src/components/dynamic-newTable/index1.vue
  16. 1 1
      src/components/dynamic-table-merge/index.vue
  17. 1 1
      src/components/dynamic-table/index.vue
  18. 1 1
      src/components/dynamic-table/index1.vue
  19. 1 1
      src/components/dynamic-table/index2.vue
  20. 1 1
      src/components/dynamic-table/index3.vue
  21. 1 1
      src/components/normal-basic-layout-new/modules/table.vue
  22. 1 1
      src/components/normal-basic-layout-new/modules/tableBook.vue
  23. 3 18
      src/components/normal-basic-layout/modules/table.vue
  24. 1 1
      src/components/selectTable/index.vue
  25. 1 1
      src/components/table/index.vue
  26. 1 1
      src/components/table/index2.vue
  27. 1 1
      src/components/table/index3.vue
  28. 1 1
      src/components/table/index5.vue
  29. 1 1
      src/components/table/index6.vue
  30. 1 1
      src/components/table/index7.vue
  31. 1 1
      src/components/table/index8.vue
  32. 1 1
      src/components/table/index9.vue
  33. 4 1
      src/style/style.css
  34. 1 1
      src/template/addProduct/table.vue
  35. 1 1
      src/template/addProductContract/table.vue
  36. 1 1
      src/template/addTool/table.vue
  37. 1 1
      src/template/popoverTable/table.vue
  38. 1 1
      src/template/prediction/table.vue
  39. 1 1
      src/template/tableMainLayout/index.vue
  40. 1 1
      src/template/tableTemplate/index.vue
  41. 1 1
      src/template/tableTemplate/index1.vue
  42. 1 59
      src/utils/directive.js
  43. 29 1
      src/utils/tool.js
  44. 1 1
      src/views/salesData/components/table.vue

+ 1 - 1
src/HDrpManagement/ProductMag/modules/productGroup.vue

@@ -25,7 +25,7 @@
         </el-table-column>
         <el-table-column
             :label="$t('操作')"
-            width="100px">
+            width="150">
           <template slot-scope="scope">
             <el-button type="text" size="mini" class="inline-16" @click="goDetail(scope.row)">{{$t('详 情')}}</el-button>
             <el-popconfirm :confirm-button-text="$t('确定')" :cancel-button-text="$t('取消')"

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

@@ -13,7 +13,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 in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="col.width">
+      <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.table,layout,index)">
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->
           <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

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

@@ -7,7 +7,7 @@
         align="center"
         fixed>
       </el-table-column>
-      <el-table-column :show-overflow-tooltip="col.title == '来源' || col.title == '地址' || col.title == '备注'" v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="col.width" :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="tool.calcTableColWidth($refs.table,layout,index)" :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

@@ -8,10 +8,10 @@
           width="35" fixed v-if="checkbox">
       </el-table-column>
       <el-table-column 
-        v-for="col in layout" :key="col.tablecolid" 
+        v-for="(col,index) in layout" :key="col.tablecolid" 
         :prop="col.columnname" 
         :label="col.title" 
-        :width="width && col.width === 0 ? 150 : col.width" 
+        :min-width="tool.calcTableColWidth($refs.table,layout,index)"
         :fixed="fixedCalc(col.columnname)"
       >
         <template :slot="headerOptions ? headerOptions.includes(col.columnname) ? 'header' : '' : ''" slot-scope="scope">

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

@@ -13,7 +13,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 in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="col.width">
+      <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.table,layout,index)">
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->
           <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

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

@@ -7,7 +7,7 @@
         align="center"
         fixed>
       </el-table-column>
-      <el-table-column :show-overflow-tooltip="col.title == '来源' || col.title == '地址' || col.title == '备注'" v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="col.width" :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="tool.calcTableColWidth($refs.table,layout,index)" :fixed="col.columnname === fixedName?'right':false">
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->
           <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

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

@@ -13,7 +13,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 in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="col.width">
+      <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.table,layout,index)">
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->
           <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

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

@@ -7,7 +7,7 @@
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="width && col.width === 0 ? 150 : col.width" :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="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">
           <slot name="header" :data="column"></slot>
         </template>

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

@@ -7,7 +7,7 @@
         align="center"
         fixed>
       </el-table-column>
-      <el-table-column :show-overflow-tooltip="col.title == '来源' || col.title == '地址' || col.title == '备注'" v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="col.width" :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="tool.calcTableColWidth($refs.table,layout,index)" :fixed="col.columnname === fixedName?'right':false">
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->
           <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

+ 1 - 1
src/SDrpManagement/QuotedPrice/detail/components/table.vue

@@ -13,7 +13,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 in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="col.width">
+      <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.table,layout,index)">
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->
           <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

+ 1 - 0
src/SDrpManagement/QuotedPrice/index.vue

@@ -1,6 +1,7 @@
 <template>
   <div>
     <basicLayout
+      customClassName="quotedPriceList"
       ref="quotedPriceList"
       formPath="QuotedPrice"
       tableName="quotedPriceTable"

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

@@ -13,7 +13,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 in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="col.width">
+      <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.table,layout,index)">
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->
           <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

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

@@ -1,7 +1,7 @@
 <template>
   <div>
     <el-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 in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="col.width">
+      <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)">
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->
           <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

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

@@ -7,7 +7,7 @@
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column show-overflow-tooltip v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="width ? col.width : 150" :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="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">
           <slot name="header" :data="column"></slot>
         </template>

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

@@ -7,7 +7,7 @@
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column show-overflow-tooltip v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="width ? col.width : 150" :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="tool.calcTableColWidth($refs.table,layout,index)" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?redirect ? redirect : '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>

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

@@ -7,7 +7,7 @@
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="width && col.width === 0 ? 150 : col.width" :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="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">
           <slot name="header" :data="column"></slot>
         </template>

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

@@ -7,7 +7,7 @@
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="width && col.width === 0 ? 150 : col.width" :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="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">
           <slot name="header" :data="column"></slot>
         </template>

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

@@ -7,7 +7,7 @@
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="width && col.width === 0 ? 150 : col.width" :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="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">
           <slot name="header" :data="column"></slot>
         </template>

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

@@ -7,7 +7,7 @@
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="width?col.width:'150px'" :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="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">
           <slot name="header" :data="column"></slot>
         </template>

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

@@ -7,7 +7,7 @@
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="width?col.width:'150px'" :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="tool.calcTableColWidth($refs.table,layout,index)" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?redirect ? redirect : '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>

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

@@ -11,7 +11,7 @@
         align="center"
         @handleSelectionChange="handleSelectionChange">
       </el-table-column>
-      <el-table-column show-overflow-tooltip v-for="(col) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="col.width ? col.width : 0" :min-width="col.width === 0 ? 150 : col.width" :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="tool.calcTableColWidth($refs.table,layout,index)" :fixed="checkFixed(col.columnname)">
         <template slot-scope="scope">
 
           <slot v-if="col.columnname !== 'operation'" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

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

@@ -11,7 +11,7 @@
         align="center"
         @handleSelectionChange="handleSelectionChange">
       </el-table-column>
-      <el-table-column show-overflow-tooltip v-for="(col) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title"  :min-width="col.width === 0 ? 150 : col.width" :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="tool.calcTableColWidth($refs.table,layout,index)" :fixed="checkFixed(col.columnname)">
         <template slot-scope="scope">
 
           <slot v-if="col.columnname !== 'operation'" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

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

@@ -11,13 +11,13 @@
         align="center"
         @handleSelectionChange="handleSelectionChange">
       </el-table-column>
-      <el-table-column v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :width="calcWidth($refs.tables,index)" :label="col.title" :fixed="checkFixed(col.columnname)">
+      <el-table-column v-for="(col,index) in layout" :key="col.tablecolid" :prop="col.columnname" :min-width="tool.calcTableColWidth($refs.tables,layout,index)" :label="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>
 
           <slot v-if="col.columnname === 'operation'" name="opreation" :data="scope.row"></slot>
-        </template>
+        </template> 
       </el-table-column>
       <!-- <el-table-column  v-for="(col) in layout" :key="col.tablecolid">
         <template #header>
@@ -56,7 +56,7 @@ export default {
       list:[],
       act_column:'',
       value:'',
-      show:false
+      show:false,
     }
   },
   computed:{
@@ -77,21 +77,6 @@ export default {
     }
   },
   methods:{
-    calcWidth (vm,index) {
-      if (sessionStorage.getItem('lang') == 'EN') {
-        if (!vm) return
-        let el = vm.$el
-        const ths = el.querySelector('.el-table__header-wrapper').querySelectorAll('table thead th .cell')       // 获取头部列元素
-        // 定义变量 存储每列的宽度数据
-        const widths = [];           
-        // 获取标题中的单元格宽度
-        ths.forEach((item, i) => widths[i] = [item.offsetWidth+20])
-        return this.layout[index].width === 0 ? widths[index+1] < 150 ? 150 : widths[index+1] : this.layout[index].width
-      } else {
-
-      }
-      
-    },
     rowClick (row) {
       this.$emit('rowClick',row)
     },

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

@@ -7,7 +7,7 @@
         align="center"
         fixed>
       </el-table-column>
-      <el-table-column v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="col.width" :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="tool.calcTableColWidth($refs.table,layout,index)" :fixed="col.columnname === fixedName?'right':false">
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->
           <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

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

@@ -5,7 +5,7 @@
         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 in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="col.width">
+      <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.table,layout,index)">
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->
           <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

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

@@ -5,7 +5,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 in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="col.width">
+      <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.table,layout,index)">
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->
           <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

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

@@ -5,7 +5,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 in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="col.width">
+      <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.table,layout,index)">
         <template slot-scope="scope">
           <!-- 自定义表格显示内容 -->
           <slot v-if="custom" name="customcol" :column="{data:scope.row,columnname:col.columnname}"></slot>

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

@@ -8,7 +8,7 @@
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title"  :width="col.width" :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="tool.calcTableColWidth($refs.table,layout,index)" :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>

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

@@ -8,7 +8,7 @@
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column  v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title"  :width="col.width" :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="tool.calcTableColWidth($refs.table,layout,index)" :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>

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

@@ -8,7 +8,7 @@
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title"  :width="col.width" :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="tool.calcTableColWidth($refs.table,layout,index)" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
         <template slot-scope="scope">
           <div class="table-panel">
             <!-- 自定义表格显示内容 -->

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

@@ -8,7 +8,7 @@
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title"  :width="col.width" :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="tool.calcTableColWidth($refs.table,layout,index)":fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
         <template slot-scope="scope">
           <div class="table-panel">
             <!-- 自定义表格显示内容 -->

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

@@ -8,7 +8,7 @@
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column  v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title"  :width="col.width" :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="tool.calcTableColWidth($refs.table,layout,index)" :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>

+ 4 - 1
src/style/style.css

@@ -307,4 +307,7 @@ ul{
 .div-line-right{
   margin-right: 10px;
 }
-
+.el-table__header-wrapper table thead .cell {
+  white-space: nowrap !important;
+  width: auto !important;
+}

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

@@ -5,7 +5,7 @@
           type="selection"
           width="55"  fixed>
       </el-table-column>
-      <el-table-column v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="width && col.width === 0 ? 150 : col.width" :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="tool.calcTableColWidth($refs.table,layout,index)" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
         <template slot-scope="scope">
           <div class="table-panel" style="color: #333333">
             <!-- 自定义表格显示内容 -->

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

@@ -5,7 +5,7 @@
           type="selection"
           width="55"  fixed>
       </el-table-column>
-      <el-table-column v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="width && col.width === 0 ? 150 : col.width" :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="tool.calcTableColWidth($refs.table,layout,index)" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
         <template slot-scope="scope">
           <div class="table-panel" style="color: #333333">
             <!-- 自定义表格显示内容 -->

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

@@ -5,7 +5,7 @@
           type="selection"
           width="55"  fixed>
       </el-table-column>
-      <el-table-column v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="width && col.width === 0 ? 150 : col.width" :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="tool.calcTableColWidth($refs.table,layout,index)" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
         <template slot-scope="scope">
           <div class="table-panel" style="color: #333333">
             <!-- 自定义表格显示内容 -->

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

@@ -8,7 +8,7 @@
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column  ref="table" show-overflow-tooltip v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="width ? col.width : 150" :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="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">
           <slot name="header" :data="column"></slot>
         </template>

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

@@ -5,7 +5,7 @@
           type="selection"
           width="55"  fixed>
       </el-table-column>
-      <el-table-column v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="width && col.width === 0 ? 150 : col.width" :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="tool.calcTableColWidth($refs.table,layout,index)" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
         <template slot-scope="scope">
           <div class="table-panel" style="color: #333333">
             <!-- 自定义表格显示内容 -->

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

@@ -12,7 +12,7 @@
           align="center"
           @handleSelectionChange="handleSelectionChange">
       </el-table-column>
-      <el-table-column show-overflow-tooltip v-for="(col) in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="col.width ? col.width : 0" :min-width="col.width === 0 ? 150 : col.width" :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="tool.calcTableColWidth($refs.table,layout,index)" :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>

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

@@ -10,7 +10,7 @@
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column  ref="table" show-overflow-tooltip v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="width ? col.width : 150" :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="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">
           <slot name="header" :data="column"></slot>
         </template>

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

@@ -10,7 +10,7 @@
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column  ref="table" show-overflow-tooltip v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="col.title" :width="width ? col.width : 150" :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="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">
           <slot name="header" :data="column"></slot>
         </template>

+ 1 - 59
src/utils/directive.js

@@ -1,59 +1,3 @@
- 
-class AutoTable{
-    constructor(){
-        this.timerHandle = null;        //计时器手柄
-    }
-    // 开始重新计算表格宽度
-  start(el, binding){
-    // 如果值为false, 则不进行计算处理
-    if(!binding.value.table) return;
-    const headerDOM = el.querySelector('.el-table__header-wrapper'),      // 头部DOM
-          bodyDOM = el.querySelector('.el-table__body-wrapper');          // 内容DOM
-    // 先清除旧计时器
-    // 开始计时
-    this.timerHandle = setInterval(() => {
-      const tds = bodyDOM.querySelectorAll('table tbody tr'),             // 获取内容行数
-            ths = headerDOM.querySelectorAll('table thead th .cell'),       // 获取头部列元素
-            emptyDOM = el.querySelector('.el-table__empty-text');         // 获取空DOM节点
-      // 如果满足条件,结束计时器
-      if(null != emptyDOM || ths.length>0) {
-        clearInterval(this.timerHandle);
-      }
-      if(tds.length == 0 && ths.length == 0)  return;
- 
-      // 定义变量 存储每列的宽度数据
-      const widths = [];           
-      // 获取标题中的单元格宽度
-      ths.forEach((item, i) => widths[i] = [item.offsetWidth+20]);
-
-    //   const realWidth = widths.reduce((total, value) => total + value, 0) + (widths.length * 10);
-      // 修改表格宽度
-    //   if(realWidth>0) el.style.width = realWidth + 'px';
-      // 获取colgroup
-      const headerColGroup = headerDOM.querySelectorAll('colgroup col'),
-            bodyColGroup = bodyDOM.querySelectorAll('colgroup col');
-      // 修改每列宽度
-      widths.forEach((val, i) => {
-        //排除序号列
-        if (i == 0) {
-            headerColGroup[i].style.width = val + 'px';
-            bodyColGroup[i].style.width = val + 'px';
-        } else {
-            headerColGroup[i].style.width = (binding.value.layout[i-1].width === 0 ? val < 150 ? 150 : val : binding.value.layout[i-1].width) + 'px';
-            bodyColGroup[i].style.width = (binding.value.layout[i-1].width === 0 ? val < 150 ? 150 : val : binding.value.layout[i-1].width) + 'px';
-
-            headerColGroup[i].setAttribute('width',binding.value.layout[i-1].width === 0 ? val < 150 ? 150 : val : binding.value.layout[i-1].width)
-            bodyColGroup[i].setAttribute('width',binding.value.layout[i-1].width === 0 ? val < 150 ? 150 : val : binding.value.layout[i-1].width)
-
-        }
-        
-      });
-      binding.value.table.doLayout()
-      clearInterval(this.timerHandle);
-    });
-  }
-}
-// binding.value.layout[i-1].width === 0 ? val < 150 ? 150 : val : binding.value.layout[i-1].width
  export default {
     install (Vue)  {
         /* table懒加载 */
@@ -73,9 +17,7 @@ class AutoTable{
             /* 解绑 */
             el.tableWarp.removeEventListener('scroll',el.handleFun)
             }
-        }),
-        Vue.directive('autoColWidth',{
-	        componentUpdated: (el, binding) =>  new AutoTable().start(el, binding)
         })
+
     }
  }

+ 29 - 1
src/utils/tool.js

@@ -1,6 +1,7 @@
 import { Message } from 'element-ui';
 import router from '@/router';
 import api from '@/api/api';
+let timer = null
 export default {
   // 获取应用权限
   checkAuth (appname,auth) {
@@ -195,5 +196,32 @@ export default {
     })
     
     return result
-  }
+  },
+  //计算表格列宽度
+  calcTableColWidth (vm,layout,index) {
+    if (!vm) return
+    if (sessionStorage.getItem('lang') == 'EN') {
+      let el = vm.$el
+      const ths = el.querySelector('.el-table__header-wrapper').querySelectorAll('table thead th .cell')       // 获取头部列元素
+      // 定义变量 存储每列的宽度数据
+      let widths = [];           
+      // 获取标题中的单元格宽度
+      ths.forEach((item, i) => {
+        widths[i] = item.offsetWidth
+      })
+      if (timer) clearTimeout(timer)
+      timer = setTimeout(() => {
+        vm.doLayout()
+      },50)
+      let isCheckbox = ths[0].querySelector('.el-checkbox__inner') ? 1 : 0
+
+      if (typeof layout == 'number') {
+        return widths[index+isCheckbox] > layout ? widths[index+isCheckbox]:layout
+      } else {
+        return  widths[index+isCheckbox] > layout[index].width ? widths[index+isCheckbox]:layout[index].width
+      }
+    } else {
+      return layout[index].width === 0 ? 150 : layout[index].width
+    }
+  },
 }

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

@@ -8,7 +8,7 @@
           type="selection"
           width="35" fixed v-if="checkbox">
       </el-table-column>
-      <el-table-column v-for="col in layout" :key="col.tablecolid" :prop="col.columnname" :label="$t(col.title)"  :width="col.width" :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="tool.calcTableColWidth($refs.table,layout,index)" :fixed="fixedName ? fixedName.indexOf(col.columnname)!= -1?'right':false : false">
         <template slot-scope="scope">
           <div class="table-panel">
             <!-- 自定义表格显示内容 -->