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

自己建网站开网店seo推广教程seo高级教程

自己建网站开网店,seo推广教程seo高级教程,公司网站域名更改怎么做,成都黑帽seo一、安装依赖 npm install xlsx 二、引用依赖 import XLSX from xlsx 三、代码实现 1、注意&#xff1a;函数 analysis 中reader.readAsBinaryString(file)&#xff0c;file的数据格式如图所示 2、示例代码 <!-- 项目使用的前端框架为非流行框架&#xff0c;主要关注…

一、安装依赖

npm install xlsx

二、引用依赖

import XLSX from 'xlsx'

三、代码实现

1、注意:函数 analysis 中reader.readAsBinaryString(file),file的数据格式如图所示

2、示例代码 

<!-- 项目使用的前端框架为非流行框架,主要关注JS实现逻辑即可 -->
<template><div><ta-upload:accept="upload.accept":fileList="upload.fileList":beforeUpload="beforeUpload":remove="uploadRemove"style="margin: 0 8px;"><ta-button>选择附件</ta-button></ta-upload><ta-tablehaveSnsize="small":columns="columns":data-source="dataSource":scroll="{x: 1600, y: 400}"showOverflowTooltip></ta-table></div>
</template>
<script>
import XLSX from 'xlsx'export default {data () {return {columns: [{ title: '医保目录编码', dataIndex: 'hilistCode', width: 300, align: 'center' },{ title: '医保目录名称', dataIndex: 'hilistName', width: 200, align: 'center' },{ title: '参保所属医保区划', dataIndex: 'insuAdmdvs', width: 200, align: 'center' },{ title: '医疗收费项目类别', dataIndex: 'medChrgitmType', width: 200, align: 'center' },{ title: '收费项目等级', dataIndex: 'chrgitmLv', width: 150, align: 'center' },{ title: '目录类别', dataIndex: 'listType', width: 200, align: 'center' },{ title: '限复方使用类型', dataIndex: 'lmtCpndType', width: 200, align: 'center' },{ title: '计价单位', dataIndex: 'prcunt', width: 200, align: 'center' },{ title: '计价说明', dataIndex: 'pricDscr', width: 200, align: 'center' },{ title: '医疗服务项目输出', dataIndex: 'servitemOupt', width: 200, align: 'center' },{ title: '价格构成', dataIndex: 'pricComp', width: 200, align: 'center' },{ title: '费用类型口径', dataIndex: 'feeTypeCali', width: 200, align: 'center' },{ title: '开始时间', dataIndex: 'begndate', width: 200, align: 'center' },{ title: '结束时间', dataIndex: 'enddate', width: 200, align: 'center' }],dataSource: [],upload: {accept: '.xls,.xlsx',fileList: []}}},computed: {uploadTypeErrorMessage () {return `只能上传 ${this.upload.accept.split(',')} 格式的文件`;}},methods: {beforeUpload (file) {if(!['application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'].includes(file.type)) {this.$message.error(this.uploadTypeErrorMessage);return false;}this.upload.fileList.length>0?this.upload.fileList.splice(0, 1, file):this.upload.fileList.push(file);this.analysis(file).then(res => { if (res && res.length > 0){let list = [];res[0].sheet.forEach(d => {let data = {};Object.keys(d).filter(k => k!=='序号').forEach(k => { //过滤掉根本不需要的列,根据自己情况写let column = this.columns.find(li => li.title===k);if(column) {data[column.dataIndex] = d[k];}});if(Object.keys(data).length>0) {list.push(data);}});this.dataSource = list;}});return false;},analysis (file){return new Promise(function (resolve) {const reader = new FileReader()reader.onload = function (e){const json = XLSX.read(e.target.result, {type: 'binary'});resolve(json.SheetNames.map(sheetName => {return {sheetName: sheetName,sheet: XLSX.utils.sheet_to_json(json.Sheets[sheetName])};}));};reader.readAsBinaryString(file);});},uploadRemove (file) {let index = this.upload.fileList.findIndex(li =>li.uid===file.uid);if(index> -1) {this.upload.fileList.splice(index, 1);this.dataSource = [];}}},mounted () {this.dataSource = [];this.upload.fileList = [];}
}
</script>

四、参考文章

前端使用xlsx插件读取excel文件数据 - yingzi__block - 博客园

http://www.dtcms.com/wzjs/42860.html

相关文章:

  • 如何通过网站做调查问卷网游推广员
  • 鲅鱼圈网站开发哪家好哦seo整站排名
  • wordpress内网外网访问不了南京seo顾问
  • 深圳英文网站开发公司长尾关键词挖掘精灵官网
  • 网站备案 假身份证百家号官网
  • wordpress 地图 注记优化关键词规则
  • wordpress js css样式温州seo排名优化
  • 计算机网站建设及管理如何做营销
  • 好网站建设公司业务企业产品推广运营公司
  • wordpress虚拟主机排名网站关键词优化排名外包
  • 网站制作优化济南站长工具关键词挖掘
  • 广东网站建设找哪家企业邮箱登录入口
  • 闲鱼网站如何赚钱海南网站建设
  • 做网站网课企查查在线查询
  • 广东住房和城乡建设委员会网站常用的网络营销工具有哪些
  • 傻瓜式网站界面seo课程培训机构
  • 网站内容页面怎么做外链个人网站设计方案
  • 纹身网站建设苏州seo网站系统
  • 电脑上自己做科目一的网站怎么上百度搜索
  • 做慧聪网站多少钱陕西百度代理公司
  • 唐山网站建设方案策划免费网站在线客服系统源码
  • 滕州网站建安卓优化大师官方版
  • 网站怎么做图片动态seo技术有哪些
  • 制作图片的软件哪个好用旺道seo优化软件
  • 点餐系统微信小程序阜阳seo
  • 福田专业网站建设公司上街网络推广
  • 怎么做才能让网站人气提升seo怎么做优化工作
  • 烟台外贸网站建设中国纪检监察报
  • 商家做网站的优点seo排名诊断
  • css做电商网站首页app推广代理平台