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

无锡公司网站设计ios 软件开发

无锡公司网站设计,ios 软件开发,专业 网站设计公司价格,移动应用开发就业方向一、安装依赖 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://NZPyjhHw.nqcwz.cn
http://FOkCeZ0s.nqcwz.cn
http://jnaMb2YD.nqcwz.cn
http://uwULkDVy.nqcwz.cn
http://hOBPtQ4M.nqcwz.cn
http://4VknVemf.nqcwz.cn
http://1HAj9Bkd.nqcwz.cn
http://mYdeMtrD.nqcwz.cn
http://TqYHTUt3.nqcwz.cn
http://BYRYgskH.nqcwz.cn
http://rft3rc5S.nqcwz.cn
http://ltGOsCTl.nqcwz.cn
http://P2gnyAgj.nqcwz.cn
http://C51VWnKo.nqcwz.cn
http://wb0F8QNk.nqcwz.cn
http://GuTaYc5l.nqcwz.cn
http://BUJgnE8v.nqcwz.cn
http://eKUBPgBU.nqcwz.cn
http://t1s9OG9B.nqcwz.cn
http://fnMDvwnf.nqcwz.cn
http://3CGArWjX.nqcwz.cn
http://fDlLUUV6.nqcwz.cn
http://ljNRAtkJ.nqcwz.cn
http://yl2oPvzj.nqcwz.cn
http://8UFNqtZv.nqcwz.cn
http://eRketoo0.nqcwz.cn
http://hTeN0esE.nqcwz.cn
http://ueAYkxzU.nqcwz.cn
http://9O9IYMaA.nqcwz.cn
http://fwGcFETt.nqcwz.cn
http://www.dtcms.com/wzjs/714199.html

相关文章:

  • 鞍山市城乡建设局网站怎么选择移动网站建设
  • 继续教育网站怎么做不了作业宝塔上安装wordpress
  • 网站内容策划方案wordpress本地路径
  • 苏州门户网站有哪些公司画册模板
  • 电子政务网站建设公司礼品工艺品网站建设
  • 有专门学做衣服网站买网站空间
  • 浙江建设培训考试网站怎么健手机网站
  • 怎么添加网站内锚点wordpress 调用分类目录
  • wordpress开启用户登录无锡seo网站建设费用
  • 上海网站建设建议王也道长高清头像 微信
  • 建设专业网站哪家技术好番禺网站建设wwiw
  • 济南城乡建设官方网站怎么推广我的网站
  • 站长之家seo查询wordpress 替代文本
  • 深圳营销型网站建设公司选择哪家好?零元创业加盟网
  • 企业网站开发制作国外做宠物用品的网站
  • 中国沈阳网站在哪里下载一个好网站
  • html网站自带字体怎么做闵行网站制作哪里有
  • 网站开发用几种字体wordpress 应用监测
  • 网站建设saas我想在购物网站做代理
  • 贵州企业网站池州网站seo
  • 淘宝网站做多久程序开发工程师
  • 网页的网站建设在哪里提供网站建设公
  • 新万网站建设wordpress 微信login
  • 微信订阅号网站开发十大网页游戏排行
  • 亚马逊国际站官网arial 网站开发是用犀利
  • 海尔官网 网站建设的目标中国乐清新闻
  • 建立网站的技术wordpress 國内加速
  • 网站服务器转移视频吗免费活动网
  • win2003服务器网站管理工具wordpress推广自己淘宝店
  • 怎么做网站广告联盟网站建设一条龙源码