在xls表格里面在顶部展示模糊查询这个字段的名称?

在这里模糊查询了某个字段,在xls表格里面 在顶部展示这个字段的名称还要对应模糊查询的数据
最终的效果:
1669347524350_7D28D594-EF95-495c-85E1-48FED55310C1.png

代码如下:

formatJson(filterVal, jsonData) {
  jsonData.map((v) => filterVal.map((j) => v[j]));
  return jsonData.map((v) => filterVal.map((j) => v[j]));
},
async handleexportData() {
  const tHeader = [
    "序号",
    "门店名称",
    "省",
    "市",
    "区",
    "详细地址",
    "商家姓名",
    "业务员",
    "门店粉丝数量",
    "补货单总数(已完成)",
  ];
  const filterVal = [
    "id",
    "title",
    "provinceName",
    "cityName",
    "areaName",
    "address",
    "ownerName",
    "sellerName",
    "shopFansTotal",
    "shopPurchaseTotal",
  ];
  const params = {
    current: this.page.current,
    size: this.page.size,
    likeTitle: this.page.likeTitle,
    likeOwnerName: this.page.likeOwnerName,
    likeSellerRealName: this.page.likeSellerRealName,
    province: this.page.province,
    city: this.page.city,
    area: this.page.area,
    beginDay: this.page.beginDay,
    endDay: this.page.endDay,
    export: true,
  };
  const data = await getDataEateryPage(params);
  if (data.data.records) {
    const arrData = this.formatJson(filterVal, data.data.records);
    export_json_to_excel(
      tHeader,
      arrData,
      " 餐饮业务数据",
      "序号",
      "门店名称",
      "省",
      "市",
      "区",
      "详细地址",
      "商家姓名",
      "业务员",
      "门店粉丝数量",
      "补货单总数(已完成)"
    );
    this.getDataEateryPagedatas();
  }
},

不懂怎么弄,有大佬知道的吗

阅读 990
1 个回答

使用filter对现有数据进行过滤 注:页面展示临时list 不改变现有的list

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题