Commit 3fb95eeb authored by renjintao's avatar renjintao

detailExcel

parent 26184dad
This diff is collapsed.
...@@ -25,11 +25,8 @@ ...@@ -25,11 +25,8 @@
"gantt-elastic": "^1.0.11", "gantt-elastic": "^1.0.11",
"gantt-elastic-header": "^0.1.11", "gantt-elastic-header": "^0.1.11",
"gojs": "^2.1.19", "gojs": "^2.1.19",
"iview-loader": "^1.3.0",
"iview-pro": "file:./iview-pro", "iview-pro": "file:./iview-pro",
"js-cookie": "^2.2.1", "js-cookie": "^2.2.1",
"less": "^3.10.3",
"less-loader": "^5.0.0",
"lodash": "^4.17.15", "lodash": "^4.17.15",
"lodash.chunk": "^4.2.0", "lodash.chunk": "^4.2.0",
"lowdb": "^1.0.0", "lowdb": "^1.0.0",
...@@ -72,8 +69,8 @@ ...@@ -72,8 +69,8 @@
"eslint": "^7.7.0", "eslint": "^7.7.0",
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",
"iview-loader": "^1.3.0", "iview-loader": "^1.3.0",
"less": "^2.7.3", "less": "^3.12.2",
"less-loader": "^4.1.0", "less-loader": "^5.0.0",
"lint-staged": "^7.2.0", "lint-staged": "^7.2.0",
"script-loader": "^0.7.2", "script-loader": "^0.7.2",
"svg-sprite-loader": "^3.8.0", "svg-sprite-loader": "^3.8.0",
......
...@@ -91,7 +91,14 @@ export default { ...@@ -91,7 +91,14 @@ export default {
tabColum.forEach(el => { tabColum.forEach(el => {
el.key = el.title el.key = el.title
}) })
this.columnsImport = tabColum; this.columnsImport = tabColum;
this.columnsImport.unshift({
type: 'index',
width: 80,
align: 'right',
title: '序号'
})
this.excelData = arrData; this.excelData = arrData;
this.$emit("on-datalength", this.excelData.length) this.$emit("on-datalength", this.excelData.length)
}, },
......
...@@ -29,30 +29,38 @@ ...@@ -29,30 +29,38 @@
<div class="btns"> <div class="btns">
<Form inline> <Form inline>
<FormItem> <FormItem>
<a @click="downFile"> <Tooltip content="下载文件">
<a @click="downFile" tooltip="1111">
<Icon type="md-download" />{{entity.file}} <Icon type="md-download" />{{entity.file}}
</a> </a>
</Tooltip>
</FormItem> </FormItem>
<FormItem> <FormItem>
<Tooltip content="预览文件">
<a class="ml10 mr10" @click="resetTable"> <a class="ml10 mr10" @click="resetTable">
<Icon type="md-eye" />预览 <Icon type="md-eye" />预览
</a> </a>
</Tooltip>
</FormItem> </FormItem>
<FormItem> <FormItem>
<RadioGroup v-model="excelType" type="button" @on-change="changeExcel" size="small"> <RadioGroup v-model="excelType" type="button" @on-change="changeExcel" size="small">
<Tooltip content="文件数据">
<Radio label="0"> <Radio label="0">
<Icon type="ios-list-box-outline" /> <Icon type="ios-list-box-outline" />
</Radio> </Radio>
</Tooltip>
<Tooltip content="粘贴Excel数据">
<Radio label="1"> <Radio label="1">
<Icon type="ios-copy" /> <Icon type="ios-copy" />
</Radio> </Radio>
</Tooltip>
</RadioGroup> </RadioGroup>
</FormItem> </FormItem>
</Form> </Form>
</div> </div>
</div> </div>
<div class="table-main" ref="main"> <div class="table-main" ref="main">
<Table :border="true" :columns="columnsImport" :data="excelData" :height="tdHeightExcel" ref="table" class="tableCommon" v-if="tableImport"></Table> <Table :border="true" :columns="columnsImport" :data="excelData" :height="tdHeightExcel" :no-data-text="noDataText" ref="table" class="tableCommon" v-if="tableImport"></Table>
<component :is="detailExcel" ref="comExcel" @on-datalength="datalength" /> <component :is="detailExcel" ref="comExcel" @on-datalength="datalength" />
</div> </div>
<FooterToolbar v-if="sheetNames.length>1&&tableImport"> <FooterToolbar v-if="sheetNames.length>1&&tableImport">
...@@ -341,6 +349,7 @@ export default { ...@@ -341,6 +349,7 @@ export default {
btnIm: true, btnIm: true,
listLength: 0, listLength: 0,
titleInfo: '', titleInfo: '',
noDataText: '暂无数据',
}; };
}, },
props: { props: {
...@@ -379,6 +388,7 @@ export default { ...@@ -379,6 +388,7 @@ export default {
this.sheetNames = []; this.sheetNames = [];
this.excelData = []; this.excelData = [];
this.excelDataBack = []; this.excelDataBack = [];
Api.openExcel({ Api.openExcel({
id: v, id: v,
}).then((res) => { }).then((res) => {
...@@ -392,7 +402,11 @@ export default { ...@@ -392,7 +402,11 @@ export default {
}); });
} }
} }
}); }).catch(e => {
//this.$Message.error("数据解析失败,请下载原文件后转为Excel重新进行上传!")
this.noDataText = "文件无法解析,建议下载原文件后转换为Excel文件格式重新上传!"
})
}, },
//加载原文件列表 //加载原文件列表
dealOpenTable(val) { dealOpenTable(val) {
...@@ -404,8 +418,9 @@ export default { ...@@ -404,8 +418,9 @@ export default {
var headersNow = []; var headersNow = [];
headersNow.push({ headersNow.push({
type: 'index', type: 'index',
width: 60, width: 80,
align: 'center' align: 'right',
title: '序号'
}) })
tempCos.forEach((el) => { tempCos.forEach((el) => {
let headObj = {}; let headObj = {};
...@@ -418,12 +433,19 @@ export default { ...@@ -418,12 +433,19 @@ export default {
//重新处理colum //重新处理colum
loadColum(columns) { loadColum(columns) {
let tempCol = this.$u.clone(columns); let tempCol = this.$u.clone(columns);
tempCol.unshift({
type: 'index',
width: 80,
align: 'right',
title: '序号'
})
tempCol.forEach((ele, index) => { tempCol.forEach((ele, index) => {
if (ele.key == "action") { if (ele.key == "action") {
ele.hide = true; ele.hide = true;
} }
}); });
this.colsIm = tempCol; this.colsIm = tempCol;
//处理原始数据和表头进行对应 //处理原始数据和表头进行对应
let temCol = this.$u.clone(this.colsIm); //原始数据表头 let temCol = this.$u.clone(this.colsIm); //原始数据表头
let temColPage = this.$u.clone(columns); //需要显示的页面的表头 let temColPage = this.$u.clone(columns); //需要显示的页面的表头
...@@ -541,8 +563,9 @@ export default { ...@@ -541,8 +563,9 @@ export default {
var headersNow = []; var headersNow = [];
headersNow.push({ headersNow.push({
type: 'index', type: 'index',
width: 60, width: 80,
align: 'center' align: 'right',
title: '序号'
}) })
headers.forEach((elHead) => { headers.forEach((elHead) => {
let headObj = {}; let headObj = {};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment