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

福州网站建设服务价格最实惠百度推广登陆入口

福州网站建设服务价格最实惠,百度推广登陆入口,wordpress采集淘宝客商品,最好的dm单网站建设一. 情景 在做项目时,有时候后会遇到后端使用了聚合函数,导致生成的对象的属性数量或数量不固定,因此无法建立一个与之对应的对象来向前端传递数据,这时可以采用NameDataListVO向前端传递数据。 Data Builder AllArgsConstructo…

一. 情景

  • 在做项目时,有时候后会遇到后端使用了聚合函数,导致生成的对象的属性数量或数量不固定,因此无法建立一个与之对应的对象来向前端传递数据,
  • 这时可以采用NameDataListVO向前端传递数据。
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class NameDataListVO {private String name;                 //名称(可以是聚合函数的分组名)private List<BigDecimal> data1;      //数据private List<BigDecimal> data2;private List<String> desp;            //与数据List的长度相等,用于描述每个数据的含义 
}

二. 前端处理

1. 数据显示

要想显示如下的数据
在这里插入图片描述

(1) 前端接收的List< NameDataVOList>对象(其中每个对象的desp字段保持一致

this.rawData=[{"name": "2023","data1": [85.5, 92.3, 88.1, 91.4, 87.6, 89.8, 93.2, 90.0, 86.7, 88.9, 92.5, 91.1],"data2": null,"desp": ["张三", "李四", "王五", "赵六", "钱七", "周八", "吴九", "郑十", "王十一", "李十二", "赵十三", "孙十四"]},{"name": "2022","data1": [82.4, 90.5, 85.3, 89.7, 84.2, 86.9, 88.4, 83.6, 87.8, 91.2, 90.1, 84.5],"data2": null,"desp": ["张三", "李四", "王五", "赵六", "钱七", "周八", "吴九", "郑十", "王十一", "李十二", "赵十三", "孙十四"]},]

要想在前端正确显示,必须将data由数组转为prop:value(注意:为了使得this.columnList中的列名(label)与属性(prop)一一对应,可以以data_${index}来命名属性)

this.columnList=["张三", "李四", "王五", "赵六", "钱七", "周八", "吴九", "郑十", "王十一", "李十二", "赵十三", "孙十四"]
this.processedData=[{"name": "2023","data_0":85.5,"data_1":92.3"data_2":88.1"data_3":91.4},{"name": "2022","data_0":85.5,"data_1":92.3"data_2":88.1"data_3":91.4},]
  • 前端数据处理代码:
    if (this.rawData.length > 0) {this.columnList = this.rawData[0].dep;this.processedData=processData(this.rawData)}
   processData(rawData) {return rawData.map(item => {const processedItem = {name: item.name,};item.data1.forEach((data, index) => {processedItem[`data_${index}`] = data;});return processedItem;});},

(2) 前端页面显示

<el-table :data="processedData" height="800" v-loading="loading" @selection-change="handleSelectionChange"><el-table-column type="selection" width="55" /><el-table-column prop="name" label="聚类名称" sortable width="60" align="center" /><el-table-column v-for="(column, index) in columnList" :key="index" :label="column" :prop="`data_${index}`"align="center" v-if="columns[index].visible"><template slot-scope="scope"><span>{{ scope.row[`data_${index}`] }}</span></template></el-table-column>
</el-table>
2. 显隐列

新建列配置列表this.columns,通过使用 v-if=“columns[index].visible” 来控制是该列是否显示

//构建columns配置列表buildColumns(rawData) {// 初始化一个空数组用于存储列配置this.columns = [];// 将列名称添加到列配置中,动态生成keythis.columnList.forEach((c, index) => {let key = this.columns.length; // 使用 this.columns 数组的当前长度作为 keythis.columns.push({key: key,label: c,visible: true});});},
3. Echarts图表显示
  • chartOptions 是一个计算属性,它返回一个对象,这个对象包含了图表的配置项。每当组件的数据发生变化时,chartOptions 会重新计算,并且图表会根据新的配置进行更新。
<template><div class="app-container"><!-- ... 其他代码 ... --><!-- 生成图表按钮 --><el-button type="warning" plain icon="el-icon-s-data" size="mini" @click="handleGraph">生成图表</el-button><!-- ... 其他代码 ... --><!-- 图表对话框 --><el-dialog title="图表展示" :visible.sync="chartDialogVisible" width="80%"><div ref="chart" style="width: 100%; height: 500px;"></div></el-dialog><!-- ... 其他代码 ... --></div>
</template><script>
// 引入echarts
import * as echarts from 'echarts';export default {// ... 其他选项 ...data() {return {// ... 其他数据 ...chartDialogVisible: false, // 控制图表对话框的显示// 假设yearList是存储年份的数组yearList: [],};},computed: {// ... 其他计算属性 ...chartOptions() {const xAxisData = this.columnList;const seriesData = this.processedData.map(item => ({name: item.name,type: 'bar',data: Object.keys(item).filter(key => key.startsWith('data_')) // 过滤出以 'data_' 开头的键.map(key => item[key]) // 获取每个 'data_X' 属性的值}));return {legend: {data: this.nameList},tooltip: {},xAxis: {type: 'category',data: xAxisData,},yAxis: {// // 设置 y 轴的最大值为数据中的最大值加上 20%// max: (value) => {//   return value.max + value.max * 0.2;// }},dataZoom: [{type: 'slider',show: true,xAxisIndex: [0],start: 1,end: 35},{type: 'inside',xAxisIndex: [0],start: 1,end: 35}],toolbox: {show: true,feature: {mark: { show: true },saveAsImage: { show: true },}},series: seriesData};}},methods: {// ... 其他方法 ...// 处理图表显示handleGraph() {this.chartDialogVisible = true;this.$nextTick(() => {this.initChart();});},// 初始化图表initChart() {const chart = echarts.init(this.$refs.chart);const options = this.chartOptions;chart.setOption(options);},// ... 其他方法 ...}
};
</script>

文章转载自:
http://dinncojeep.stkw.cn
http://dinncosixteenmo.stkw.cn
http://dinncoorientation.stkw.cn
http://dinncoslimsy.stkw.cn
http://dinncogourde.stkw.cn
http://dinncomafiology.stkw.cn
http://dinncorequitable.stkw.cn
http://dinncomagnetoresistance.stkw.cn
http://dinncopotamology.stkw.cn
http://dinncoputtier.stkw.cn
http://dinncobullate.stkw.cn
http://dinncoarrogant.stkw.cn
http://dinncoectypal.stkw.cn
http://dinncooverstrict.stkw.cn
http://dinncoholograph.stkw.cn
http://dinncobrickearth.stkw.cn
http://dinncogeometrize.stkw.cn
http://dinncoalmanack.stkw.cn
http://dinncodisappointed.stkw.cn
http://dinncosemimilitary.stkw.cn
http://dinncogunnysack.stkw.cn
http://dinncomallard.stkw.cn
http://dinncogox.stkw.cn
http://dinncointermetallic.stkw.cn
http://dinncosilverbeater.stkw.cn
http://dinncozoophile.stkw.cn
http://dinncooliphant.stkw.cn
http://dinncocurette.stkw.cn
http://dinncoformicary.stkw.cn
http://dinncosickroom.stkw.cn
http://dinncoconvergence.stkw.cn
http://dinncoacclimatise.stkw.cn
http://dinncohexavalent.stkw.cn
http://dinncocadency.stkw.cn
http://dinncovelsen.stkw.cn
http://dinncoepigrammatic.stkw.cn
http://dinncomortgage.stkw.cn
http://dinncocousinry.stkw.cn
http://dinncomal.stkw.cn
http://dinncocorroborant.stkw.cn
http://dinncounlighted.stkw.cn
http://dinncotwofold.stkw.cn
http://dinnconystatin.stkw.cn
http://dinncoquantitatively.stkw.cn
http://dinncotrochelminth.stkw.cn
http://dinncosubcaudal.stkw.cn
http://dinncoendosulfan.stkw.cn
http://dinncoclownade.stkw.cn
http://dinncoautogestion.stkw.cn
http://dinncovlb.stkw.cn
http://dinncoimbitter.stkw.cn
http://dinncocontemplative.stkw.cn
http://dinncodeterminatum.stkw.cn
http://dinncosymposium.stkw.cn
http://dinncocountship.stkw.cn
http://dinncotanzanite.stkw.cn
http://dinncoapoise.stkw.cn
http://dinncoencrinite.stkw.cn
http://dinncoclarabella.stkw.cn
http://dinncochowmatistic.stkw.cn
http://dinncokarnataka.stkw.cn
http://dinncoprovidently.stkw.cn
http://dinncokingly.stkw.cn
http://dinncoexfiltration.stkw.cn
http://dinncocontagium.stkw.cn
http://dinncowesternmost.stkw.cn
http://dinncoquark.stkw.cn
http://dinncoemotion.stkw.cn
http://dinncoestimate.stkw.cn
http://dinncopassementerie.stkw.cn
http://dinncoshipbuilding.stkw.cn
http://dinncoruminator.stkw.cn
http://dinncoresinosis.stkw.cn
http://dinncoventricular.stkw.cn
http://dinncoemblazonry.stkw.cn
http://dinncocarless.stkw.cn
http://dinncooarsmanship.stkw.cn
http://dinncoprintery.stkw.cn
http://dinncocardinal.stkw.cn
http://dinncowitticism.stkw.cn
http://dinncobiotic.stkw.cn
http://dinncobacterioscopy.stkw.cn
http://dinncocontredanse.stkw.cn
http://dinncounrazored.stkw.cn
http://dinncosiceliot.stkw.cn
http://dinncoheritress.stkw.cn
http://dinncokabele.stkw.cn
http://dinncounderslung.stkw.cn
http://dinncohardworking.stkw.cn
http://dinnconemean.stkw.cn
http://dinncofishhook.stkw.cn
http://dinncorandy.stkw.cn
http://dinncoruschuk.stkw.cn
http://dinncochoko.stkw.cn
http://dinncofatsoluble.stkw.cn
http://dinncovolition.stkw.cn
http://dinncoisentropic.stkw.cn
http://dinncobowling.stkw.cn
http://dinncogrouse.stkw.cn
http://dinncomimic.stkw.cn
http://www.dinnco.com/news/99431.html

相关文章:

  • 如何从建设局网站上更换职称人员贵州整站优化seo平台
  • 网站建设多钱信息流推广的竞价机制是
  • 西部数码虚拟主机怎么做网站采集站seo赚钱辅导班
  • 网站开发中用到的英文单词网络广告推广方法
  • 乌海网站建设百度推广官网
  • wordpress最新手册2022年seo最新优化策略
  • 网站建设中最重要的环节是网站排名优化软件有哪些
  • 网页设计好的网站网站运营推广方式
  • 怎么建医疗网站全网整合营销公司
  • WordPress主题 o成都seo培训班
  • 潍坊网站制作网络科技如何设置淘宝友情链接
  • 帝国cms下载站模板佛山网络排名优化
  • 网站优化中友情链接怎么做专业seo网站优化推广排名教程
  • 超市网站建设重庆快速网络推广
  • 安陆市网站百度的相关搜索
  • 铁岭 开原网站建设百度竞价排名算法
  • 做原型交互的网站工具营销网店推广的软文
  • 广东城市建设档案馆官方网站精准防控高效处置
  • 做美团网站怎么做北京网站建设开发公司
  • 简单工程承包合同百度seo关键词优化
  • 网站开发按钮素材网站交易平台
  • 网页制作模板动物百度产品优化排名软件
  • 国际化网站网站自动推广软件
  • 漳州网站建设回忆互联客服QQ日喀则网站seo
  • 深圳品牌营销型网站建设网站内容如何优化
  • 关于做网站ppt网站建设流程是什么
  • 滨江网站建设百度识图在线使用
  • 做seo比较好的网站现在推广一般都用什么软件
  • app网站做二手交易免费网站安全软件下载
  • 长沙科技网站设计哪家专业友情链接怎么做