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

做平台的网站有哪些内容一键做单页网站

做平台的网站有哪些内容,一键做单页网站,广州最新新闻头条,网站技术建设维护技术论文引入插件 import * as XLSX from xlsx/xlsx.mjs; import { read, utils } from xlsx/xlsx.mjs; 上传文件方法 // 上传文件状态改变时的钩子#xff0c;添加文件、上传成功和上传失败时都会被调用async handle(ev) {//改变表格key值this.$refs.cpkTable.loading…引入插件  import * as XLSX from xlsx/xlsx.mjs; import { read, utils } from xlsx/xlsx.mjs; 上传文件方法 // 上传文件状态改变时的钩子添加文件、上传成功和上传失败时都会被调用async handle(ev) {//改变表格key值this.$refs.cpkTable.loading true;this.$refs.cpkLine.myChart.showLoading({text: 加载中...,color: #1890ff,textColor: #1890ff,showSpinner: false,maskColor: rgba(255, 255, 255, 0.7),});this.tableKey true;this.file ev.raw;this.excelName this.file.name;//截取表格文件名this.excelName this.excelName.substring(0,this.excelName.lastIndexOf(.));console.log(上传的未解析源文件, this.file);if (!this.file) {console.log(文件打开失败);return;} else {//!-- 用来解析表头的代码--// let data await this.readFile(file);// let workbook XLSX.read(data, { type: binary }); //解析二进制格式数据// console.log(二进制数据的解析:, workbook);// let worksheet workbook.Sheets[workbook.SheetNames[0]]; //获取第一个Sheet// // 调用解析表头方法// this.getHeader(worksheet);// let result XLSX.utils.sheet_to_json(worksheet); //转换为json数据格式// console.log(最终解析的 json 格式数据:, result);// this.tableData result;// // 调用处理表头函数// this.setTable();//!-- 用来解析表头的代码--// 读取 Excel 文件//!-- 不需要解析表头的代码--const file this.file;const reader new FileReader();const that thisreader.onload function(e) {const data new Uint8Array(e.target.result);const workbook read(data, { type: array });const sheetName workbook.SheetNames[0];const worksheet workbook.Sheets[sheetName];const jsonData utils.sheet_to_json(worksheet, { header: 1, raw: false, defval: });// const worksheet workbook.Sheets[workbook.SheetNames[0]];// const jsonData XLSX.utils.sheet_to_json(worksheet, { header: 1 });that.tableData jsonDatathat.lineData jsonData// 在这里处理读取到的数据};reader.readAsArrayBuffer(file);that.fileOpen falsethat.$refs.cpkLine.lineData this.tableData;that.LSL this.form.lslthat.MBZ this.form.targetValuethat.USL this.form.uslsetTimeout((){that.$message.success(this.excelName导入成功)that.$refs.upload.clearFiles();that.$refs.cpkTable.loading false;that.$refs.cpkLine.myChart.hideLoading();},800)// that.tableLength that.tableData.length// this.setTable()//!-- 不需要解析表头的代码--}}, 解析获取到表头的数据 getHeader(sheet) {// const XLSX XLSX;const headers [];const range XLSX.utils.decode_range(sheet[!ref]); // worksheet[!ref] 是工作表的有效范围let C;/* 获取单元格值 start in the first row */const R range.s.r; // 行 // C 列let i 0;for (C range.s.c; C range.e.c; C) {var cell sheet[XLSX.utils.encode_cell({ c: C, r: R })]; /* 根据地址得到单元格的值find the cell in the first row */var hdr UNKNOWN C; // 如果有空表头会替换为您想要的默认值replace with your desired default// XLSX.utils.format_cell 生成单元格文本值if (cell cell.t) hdr XLSX.utils.format_cell(cell);if (hdr.indexOf(UNKNOWN) -1) {if (!i) {hdr __EMPTY;} else {hdr __EMPTY_ i;}i;}headers.push(hdr);}// 保存至data中this.excelHeader headers;return headers;}, 设置中英文映射 就是字段对应 // 设置表格中英文映射setTable() {const headers this.excelHeader;const excellist this.tableData;const tableTitleData []; // 存储表格表头数据const tableMapTitle {}; // 设置表格内容中英文对照用headers.forEach((_, i) {tableMapTitle[_] cord i;tableTitleData.push({prop: cord i,label: _,width: 100,});});console.log(表格头标题, tableTitleData);// 映射表格内容属性名为英文const newTableData [];excellist.forEach((_) {const newObj {};Object.keys(_).forEach((key) {newObj[tableMapTitle[key]] _[key];});newTableData.push(newObj);});this.tableColumn tableTitleData;this.tableData newTableData;},
http://www.dnsts.com.cn/news/56652.html

相关文章:

  • 网站开发最适合的浏览器网页设计创建站点教程
  • 襄阳做网站价格凡科是大厂吗
  • 山西做网站多少钱建设企业网站价格
  • 昌平网站建设哪家强wordpress按装教程
  • 网站怎做百度代码统计网站发布的方法有几种
  • 如何建立本站站点网站建设网站网页模板
  • ps软件推荐常州市网站优化
  • 淄博企业网站建设哪家专业国外包装设计网站
  • 网站空间年费WordPress模板资源下载站
  • react网站开发实战制作网页的工具主要有哪些
  • 常德规划建设局网站苏州姑苏区专业做网站
  • 网站建设技术方面的论文手绘风网站
  • 什么网站做全景效果图好企业建设网
  • 技术支持 骏域网站建设专家佛山做家政的在哪些网站推广
  • 效果好的手机网站建设深圳做义工的网站
  • 厂字型布局网站网站未备案会怎么样
  • 网站管理平台有哪些跨境电商网站模板
  • 电子商务网站建设与管理课后习题网络营销的特点主要有
  • 建一个o2o网站织梦的手机端网站
  • 南京比较有名的广告公司seo计费系统源码
  • 寿宁县建设局网站免费wordpress网站
  • 网站开发原型 图中国制造网
  • 福建省住房和建设厅网站玩具外贸好做吗
  • 协和医院网站建设目标网站策划主要做什么工作
  • vs2010网站开发网站浮动条
  • 政务中心建设网站wordpress文章上传视频
  • 优酷土豆网站建设网站建设行吗
  • 嘉兴高端网站定制wordpress图片浏览器
  • 门户网站介绍哈尔滨房产信息网官网
  • 南阳在线网站制作制作网页的详细步骤