项目使用的是vue+elementui,但因为项目中elementui的版本太低(只1.几的版本,2.0以上的版本才支持合并表格的功能),贸然升级的话怕有很多其它问题出现,项目也急着上线,所以只能手动嵌套实现,如下:
    image.png

    1. <table cellspacing="0" border="1" class="evaluation" id="ChaKanGrid">
    2. <thead>
    3. <tr>
    4. <th class="w40">序号</th>
    5. <th class="w100">分组名</th>
    6. <th class="w150">名称</th>
    7. <th class="w100">编号</th>
    8. <th class="w100">客户名称</th>
    9. <th class="w100">最终客户名称</th>
    10. <th class="w150">预计合同金额(万元)</th>
    11. <th class="w100">专业</th>
    12. <th class="w100">业务地区</th>
    13. <th class="w100">合作方名</th>
    14. </tr>
    15. </thead>
    16. <tbody>
    17. <tr v-if="loadingDatas"> <!-- 暂无数据时显示 -->
    18. <td :colspan="10">数据加载中...</td>
    19. </tr>
    20. <tr v-if="noDatas">
    21. <td :colspan="10">暂无数据</td>
    22. </tr>
    23. <!-- template不会被渲染 -->
    24. <template v-for="(item,index) in autoData">
    25. <!-- 左侧跨行区域 -->
    26. <tr :for="item.groupName">
    27. <td class="w40">{{index +1}}</td>
    28. <td class="w100" @click="handleViewrow(item.groupName,item.id,item.flowStatus)">
    29. <el-tooltip placement='top'>
    30. <div slot="content">{{item.groupName}}</div>
    31. <span type="text" style="cursor:pointer">{{item.groupName}}</span>
    32. </el-tooltip>
    33. </td>
    34. <td colspan="8" style="padding: 0;" >
    35. <table style="margin: 0;padding: 0;" class="smallTable">
    36. <tr v-for="(citem,index) in item.oppoList" :for="citem.name" class="custom-control">
    37. <td class="w150" >
    38. <el-tooltip placement='top'>
    39. <div slot="content">{{citem.name}}</div>
    40. <span type="text" style="cursor:pointer">{{citem.name}}</span>
    41. </el-tooltip>
    42. </td>
    43. <td class="w100">
    44. <el-tooltip placement='top'>
    45. <div slot="content">{{citem.oppoNo}}</div>
    46. <span type="text" style="cursor:pointer">{{citem.oppoNo}}</span>
    47. </el-tooltip>
    48. </td>
    49. <td class="w100">
    50. <el-tooltip placement='top'>
    51. <div slot="content">{{citem.customerName}}</div>
    52. <span type="text" style="cursor:pointer">{{citem.customerName}}</span>
    53. </el-tooltip>
    54. </td>
    55. <td class="w100">
    56. <el-tooltip placement='top'>
    57. <div slot="content">{{citem.finalCustomerName}}</div>
    58. <span type="text" style="cursor:pointer">{{citem.finalCustomerName}}</span>
    59. </el-tooltip>
    60. </td>
    61. <td class="w150">
    62. <el-tooltip placement='top'>
    63. <div slot="content">{{citem.exceptContractAmount/10000}}</div>
    64. <span type="text" style="cursor:pointer">{{citem.exceptContractAmount/10000}}</span>
    65. </el-tooltip>
    66. </td>
    67. <td class="w100">
    68. <el-tooltip placement='top'>
    69. <div slot="content">{{citem.speciality}}</div>
    70. <span type="text" style="cursor:pointer">{{citem.speciality}}</span>
    71. </el-tooltip>
    72. </td>
    73. <td class="w100">
    74. <el-tooltip placement='top'>
    75. <div slot="content">{{citem.businessArea}}</div>
    76. <span type="text" style="cursor:pointer">{{citem.businessArea}}</span>
    77. </el-tooltip>
    78. </td>
    79. <td class="w100">
    80. <el-tooltip placement='top'>
    81. <div slot="content">{{citem.partnerName}}</div>
    82. <span type="text" style="cursor:pointer">{{citem.partnerName}}</span>
    83. </el-tooltip>
    84. </td>
    85. </tr>
    86. </table>
    87. </td>
    88. </tr>
    89. </template>
    90. </tbody>
    91. </table>