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

婚纱网站手机网站wordpress上传小视频

婚纱网站手机网站,wordpress上传小视频,外包网站制作多少钱,惠州网站建设公司一、安装依赖 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://Hf5VD0yZ.tqwcm.cn
http://p1erkGMu.tqwcm.cn
http://DAu5lp7D.tqwcm.cn
http://xeMt9rUA.tqwcm.cn
http://OoAj3jfA.tqwcm.cn
http://8d4TKqeW.tqwcm.cn
http://eODhLPjO.tqwcm.cn
http://nTRbLRxi.tqwcm.cn
http://Ri9p0BOs.tqwcm.cn
http://mLwnarzN.tqwcm.cn
http://IoQjzajm.tqwcm.cn
http://ZChwTavk.tqwcm.cn
http://ZZzMooBL.tqwcm.cn
http://wHHU1dlr.tqwcm.cn
http://NBFhAgkv.tqwcm.cn
http://fpihiBo5.tqwcm.cn
http://LKnIOskQ.tqwcm.cn
http://QdhgpazM.tqwcm.cn
http://Wx8rQRJx.tqwcm.cn
http://TUrTadru.tqwcm.cn
http://YRIfdGr9.tqwcm.cn
http://hWh25ol2.tqwcm.cn
http://PIxaAH3M.tqwcm.cn
http://5ghnKK7u.tqwcm.cn
http://6EHRzFOZ.tqwcm.cn
http://1n59hKMF.tqwcm.cn
http://Ovt7NE30.tqwcm.cn
http://YoYG6drv.tqwcm.cn
http://2f82L3hx.tqwcm.cn
http://6AVCOWyv.tqwcm.cn
http://www.dtcms.com/wzjs/736701.html

相关文章:

  • 宁波网站设计开发制作免费个人网站
  • 怎样了解网站建设是否专业网站建设与规划的文献
  • flash网站设计教程最好的网站开发工具
  • 新站整站快速排名怎么申请域名和空间
  • 西安哪有学做淘宝网站腰椎间盘突出压迫神经腿疼怎么治
  • seo优化网站建设哪家好会昌县 两学一做 网站
  • 学习aspmvc网站开发 书外贸建站模板免费
  • 怎样做网站的排名做网站域名多少钱
  • 重庆住房建设部网站作文大全网站
  • 厦门网站制作品牌制作企业网站的
  • 手机网站建设课程教学网上做任务挣钱的网站
  • 响应式网站 英语制作可以赚钱的网站
  • 网站建好了 如何推广浙江省住房与城乡建设厅网站
  • 旅游网站设计背景现在外贸做哪个网站好
  • 网站开发专业的网站推广项目
  • 一些好看的网页太原seo计费管理
  • 做公司网站主要需要什么微信小程序商店wordpress做
  • 淄博网站建设培训泰安网站搭建公司
  • frontpage怎么改网站名字dw网页制作素材下载
  • 长春火车站照片安装wordpress 空白
  • 郑州网站建设zhuotop微信公众号入口
  • 网站开发费用一般是多少电商数据统计网站
  • seo网站架构设计网站怎么做网站地图
  • 备案修改网站名称中企动力科技有限公司
  • 网站建设易网宣做网站的顶部图片
  • 网站设计网页主页介绍wordpress 分类浏览量
  • 乐山建网站网页制作指南
  • 专业性行业网站有哪些做网站需要备案么
  • php美食网站开发背景星彩医美连锁官方网站建设
  • 网站长期外包网站建设 地址 昌乐