当前位置: 首页 > news >正文

网站主题设计特色网络营销方案

网站主题设计特色,网络营销方案,龙岩有什么兼职可以做,海外购物网站建设一、业务需求: 一个展示列表,表格中有一部分列是根据后端接口动态展示,对于不同类型的数据展示效果不一样。如果接口返回数据是’类型1‘的,则正常展示,如果是’类型2‘的数据,则合并当前数据的动态表格。…

一、业务需求:

一个展示列表,表格中有一部分列是根据后端接口动态展示,对于不同类型的数据展示效果不一样。如果接口返回数据是’类型1‘的,则正常展示,如果是’类型2‘的数据,则合并当前数据的动态表格。

二、实现思路:

1、先将普通表格实现,不考虑合并效果;

2、在表格上对要合并的单元格类型进行区分;

3、 在表格上使用:span-method="arraySpanMethod"方法触发表格;

4、在arraySpanMethod方法内接收数据处理合并,确定从哪一列开始合并到哪一列合并结束;

三、代码展示:

<el-tableref="table"size="mini"height="100%":data="tableData":span-method="arraySpanMethod":header-cell-style="{background: '#f5f7fa',fontWeight: 'bold',color: '#303133'}"border><el-table-columntype="index"header-align="center"align="center"label="序号"width="50"></el-table-column><el-table-columnwidth="120"prop="indexShowName"label="名称"show-overflow-tooltip></el-table-column><el-table-columnwidth="80"prop="type"label="类型种类"show-overflow-tooltip><template slot-scope="scope">{{ scope.row.type === '1' ? '类型1' : '类型2' }}</template></el-table-column><el-table-columnv-for="(item, index) in tableColumns":key="index"width="80":label="item.year"show-overflow-tooltip><template slot-scope="scope"><!-- 类型1展示name --><divv-if="scope.row.type === '1'"style="text-align: center">{{scope.row.uploadValueList[index]?.uploadValueName}}</div><!-- 类型2展示value --><div v-else>{{ scope.row.uploadValueList[index].uploadValue }}</div></template></el-table-column><el-table-columnwidth="160"prop="reportDate"label="上报时间"show-overflow-tooltip></el-table-column><el-table-columnwidth="195"label="操作"header-align="center"align="center"fixed="right"><template slot-scope="scope"><el-buttonsize="small"style="color: #409eff; padding: 0"type="text"@click="detailClick(scope.row)">数据明细</el-button></template></el-table-column></el-table>// --------------methods方法--------------------// 右侧表格initTable() {const params = {pageNum: this.pages.pageIndex,pageSize: this.pages.pageSize,}this.tableLoading = true//api接口调用xxxxxx(params).then((res) => {if (res.code === 200) {const { total } = res.result// const { records, total } = res.result//后端接口数据返回形式如下:const records = [{indexShowName: '测试001',type: '1',reportDate: '2023-12-01 15:53:46',uploadValueList: [{id: '1',year: '2021年',uploadValue: '0',uploadValueName: '完全符合'},{id: '2',year: '2022年',uploadValue: '0',uploadValueName: '完全符合'},{id: '3',year: '2023年',uploadValue: '0',uploadValueName: '完全符合'},{id: '4',year: '2024年',uploadValue: '0',uploadValueName: '完全符合'}]},{indexShowName: '测试002',type: '2',reportDate: '2023-12-01 13:45:53',uploadValueList: [{id: '5',year: '2021年',uploadValue: '99.00'},{id: '6',year: '2022年',uploadValue: '98.00'},{id: '7',year: '2023年',uploadValue: '77.00'},{id: '8',year: '2024年',uploadValue: '34.00'}]}]if (records && records.length > 0) {// 使用第一个元素的 uploadValueList 来创建列this.tableColumns = records[0].uploadValueList.map((item) => ({year: item.year, // 使用 year 作为列的标签id: item.id // 用于做key}))}this.tableData = recordsthis.pages.total = total} else {this.$message.error(res.message)}}).finally(() => {this.tableLoading = false})},// 单元格合并 {当前行row、当前列column、当前行号rowIndex、当前列号columnIndex}arraySpanMethod({ row, column, rowIndex, columnIndex }) {// 类型1,且动态数据长度>1if (row.type === '1' && row?.uploadValueList?.length > 1) {const len = row?.uploadValueList?.length// 合并从下标为0开始的【下标为3的第四列,动态数据长度】if ( columnIndex > 2 && columnIndex <= 2 + Number(len) ) {return {rowspan: 1,colspan: columnIndex === 3 ? len : 0}}}},

http://www.15wanjia.com/news/2715.html

相关文章:

  • 网站建设 图片压缩广告海外推广
  • 计算机网站设计湖南seo优化报价
  • bi网站开发当下最流行的营销方式
  • 国内做涂装生产线网站保定seo博客
  • 网站如何做一张轮播图西安seo王尘宇
  • 网站可以用什么做域名查询备案
  • 手机网站引导页js插件长沙网站制作公司哪家好
  • 建设专题网站房地产新闻最新消息
  • 网站关键词西安seo关键词排名优化
  • 手机怎么同步连接wordpress天津seo推广服务
  • 五百亿网站建设最近有哪些新闻
  • 什么是网站根目录百度一级代理商
  • wordpress 数据库类型南昌网站优化公司
  • 邢台做网站优化悟空建站seo服务
  • 广州专业做网站公司外贸快车
  • 建设门户网站所需故事性营销软文
  • 网文网站微信小程序开发教程
  • 信息服务类网站建设方案百度员工收入工资表
  • 网页设计与制作教程清华大学出版社seo查询友情链接
  • 厦门做网站seo的seo综合查询什么意思
  • 专门做招商的网站是什么四川百度推广排名查询
  • seo外包方法优化网络的软件
  • 成都网站建设与推广sem托管公司
  • 什么公司网站建设做的好爱站网 关键词挖掘
  • 潍坊百度网站建设在线代理浏览网站
  • 太原阳性确诊西安网站seo技术厂家
  • 诸城市做网站网站建设公司哪家好?该如何选择
  • 外贸网站外链平台广州四楚seo顾问
  • 网站开发后台做些什么aso优化渠道
  • 装修设计图包括哪些图纸百度seo怎么关闭