Commit f5568ee9 authored by renjintao's avatar renjintao

import

parent 367ceb3d
...@@ -21,10 +21,7 @@ ...@@ -21,10 +21,7 @@
</div> </div>
<div class="btns"> <div class="btns">
<slot name="buttons"></slot> <slot name="buttons"></slot>
<Button @click="openImportModal"> <Button @click="export2Excel" v-if="exportTitle.length>0">
导入
</Button>
<Button @click="export2Excel">
导出 导出
</Button> </Button>
<Button v-if="set&&type=='table'" @click="config=!config"> <Button v-if="set&&type=='table'" @click="config=!config">
...@@ -70,9 +67,7 @@ ...@@ -70,9 +67,7 @@
</li> </li>
</ul> </ul>
</Drawer> </Drawer>
<Modal v-model="ImportModal" title="导入" fullscreen footer-hide>
<ImportExcel v-if="ImportModal" @on-get-data="getData" :columns="columnsNow" />
</Modal>
<FooterToolbar v-if="batch" v-show="footerToolbar"> <FooterToolbar v-if="batch" v-show="footerToolbar">
<div class="tip">已选{{selectItems.length}}</div> <div class="tip">已选{{selectItems.length}}</div>
<slot name="batch"></slot> <slot name="batch"></slot>
...@@ -105,7 +100,6 @@ export default { ...@@ -105,7 +100,6 @@ export default {
userConfig: null, //用户页面配置信息。, userConfig: null, //用户页面配置信息。,
// userId: 1 // userId: 1
userId: this.$store.state.userInfo.userId, userId: this.$store.state.userInfo.userId,
ImportModal: false,
}; };
}, },
props: { props: {
...@@ -222,9 +216,9 @@ export default { ...@@ -222,9 +216,9 @@ export default {
type: Number, type: Number,
default: 40, default: 40,
}, },
title: { exportTitle: {
type: String, type: String,
default: "导出数据", default: "",
} }
}, },
created() { created() {
...@@ -476,17 +470,7 @@ export default { ...@@ -476,17 +470,7 @@ export default {
this.footerToolbar = false; this.footerToolbar = false;
this.$refs.table.selectAll(false); this.$refs.table.selectAll(false);
}, },
//导入功能
openImportModal() {
this.ImportModal = true
},
getData(val) {
// alert(JSON.stringify(val))
this.$emit("on-import-data", val)
},
closeImport() {
this.ImportModal = false
},
//导出excel //导出excel
export2Excel() { export2Excel() {
//当前显示数据 //当前显示数据
...@@ -531,7 +515,7 @@ export default { ...@@ -531,7 +515,7 @@ export default {
var tempCol = []; var tempCol = [];
var columnsCur = this.$u.clone(this.columnsNow); //导出列标题信息griddata this.$refs.grid.columnsCur var columnsCur = this.$u.clone(this.columnsNow); //导出列标题信息griddata this.$refs.grid.columnsCur
columnsCur.forEach((el) => { columnsCur.forEach((el) => {
if ((el.hide && !el.import) || (!el.hide && el.key != "action" && el.type != "selection")) { if ((el.hide && !el.import) || (!el.hide && el.key != "action" && el.type != "selection" && el.key != "ico")) {
if (el.code) { if (el.code) {
tempCol.push({ tempCol.push({
key: el.key, key: el.key,
...@@ -553,7 +537,7 @@ export default { ...@@ -553,7 +537,7 @@ export default {
}); });
let nowDate = this.$u.getNowTime(); //年月日时分秒yyyyMMddhhmmss let nowDate = this.$u.getNowTime(); //年月日时分秒yyyyMMddhhmmss
//获取导出数据结束 //获取导出数据结束
this.$u.outExcel(this.title + this.$u.outExcel(this.exportTitle +
"(" + nowDate + ")", "(" + nowDate + ")",
tHeader, tHeader,
filterVal, filterVal,
...@@ -561,7 +545,6 @@ export default { ...@@ -561,7 +545,6 @@ export default {
); );
}); });
}, },
//导入excel
}, },
computed: { computed: {
columnsNow() { columnsNow() {
......
<template> <template>
<div class="table-content"> <Modal v-model="ImportModal" title="导入" fullscreen footer-hide @on-cancel="cancelModal">
<div class="table-tools"> <div class="table-content">
<div class="table-search">
<Form inline>
<FormItem>
<div style="height:34px;overflow: hidden;padding:0">
<Upload action :before-upload="beforeUpload" ref="uploadfile" :format="formatList">
<Button icon="ios-cloud-upload-outline">上传文件</Button>
</Upload>
</div>
</FormItem>
<FormItem>
<Button type="primary" @click="openInfoModal" :disabled="btnIm">导入</Button>
</FormItem>
</Form> <div class="table-tools">
<div class="table-search">
<Form inline>
<FormItem>
<div style="height:34px;overflow: hidden;padding:0">
<Upload action :before-upload="beforeUpload" ref="uploadfile" :format="formatList">
<Button icon="ios-cloud-upload-outline">上传文件</Button>
</Upload>
</div>
</FormItem>
<FormItem>
<Button type="primary" @click="openInfoModal" :disabled="btnIm">导入</Button>
</FormItem>
</Form>
</div>
<div class="btns">
<Form inline>
<FormItem>
<RadioGroup v-model="excelType" type="button" @on-change="changeExcel" size="small">
<Tooltip content="文件数据">
<Radio label="0">
<Icon type="ios-list-box-outline" />
</Radio>
</Tooltip>
<Tooltip content="粘贴Excel数据">
<Radio label="1">
<Icon type="ios-copy" />
</Radio>
</Tooltip>
</RadioGroup>
</FormItem>
</Form>
</div>
</div> </div>
<div class="btns"> <div class="table-main" ref="main">
<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" />
</div>
<FooterToolbar v-if="sheetNames.length>1&&tableImport">
<Form inline> <Form inline>
<FormItem> <FormItem>
<RadioGroup v-model="excelType" type="button" @on-change="changeExcel" size="small"> <Tabs :animated="false" :value="0" @on-click="sheetClick">
<Tooltip content="文件数据"> <TabPane :label="item" v-for="(item,index) in sheetNames" :key="index"></TabPane>
<Radio label="0"> </Tabs>
<Icon type="ios-list-box-outline" />
</Radio>
</Tooltip>
<Tooltip content="粘贴Excel数据">
<Radio label="1">
<Icon type="ios-copy" />
</Radio>
</Tooltip>
</RadioGroup>
</FormItem> </FormItem>
</Form> </Form>
</div> </FooterToolbar>
<Modal v-model="infoModal" :title="titleInfo" fullscreen>
<DataGrid :tool="false" :page="false" :columns="colsIm" :data="dataIm" :height="tdHeightExcel+30" ref="dataImport"></DataGrid>
<div slot="footer">
<Button @click="infoModal=false">关闭</Button>
<Button type="primary" @click="importOk" v-show="imBtn">确定导入</Button>
</div>
</Modal>
</div> </div>
<div class="table-main" ref="main"> </Modal>
<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" />
</div>
<FooterToolbar v-if="sheetNames.length>1&&tableImport">
<Form inline>
<FormItem>
<Tabs :animated="false" :value="0" @on-click="sheetClick">
<TabPane :label="item" v-for="(item,index) in sheetNames" :key="index"></TabPane>
</Tabs>
</FormItem>
</Form>
</FooterToolbar>
<Modal v-model="infoModal" :title="titleInfo" fullscreen>
<DataGrid :tool="false" :page="false" :columns="colsIm" :data="dataIm" :height="tdHeightExcel+30" ref="dataImport"></DataGrid>
<div slot="footer">
<Button @click="infoModal=false">关闭</Button>
<Button type="primary" @click="importOk" v-show="imBtn">确定导入</Button>
</div>
</Modal>
</div>
</template> </template>
<script> <script>
...@@ -93,6 +96,8 @@ export default { ...@@ -93,6 +96,8 @@ export default {
titleInfo: '', titleInfo: '',
noDataText: '暂无数据', noDataText: '暂无数据',
imBtn: true, imBtn: true,
columnsIm: this.columns,
ImportModal: this.open
}; };
}, },
props: { props: {
...@@ -109,6 +114,10 @@ export default { ...@@ -109,6 +114,10 @@ export default {
type: Array, type: Array,
default: [], default: [],
}, },
open: {
type: Boolean,
default: false
}
}, },
created() { created() {
this.tdHeightExcel = window.innerHeight - 180; this.tdHeightExcel = window.innerHeight - 180;
...@@ -143,7 +152,7 @@ export default { ...@@ -143,7 +152,7 @@ export default {
title: '序号' title: '序号'
}) })
tempCol.forEach((ele, index) => { tempCol.forEach((ele, index) => {
if (ele.key == "action" || ele.type == "selection") { if (ele.key == "action" || ele.type == "selection" || ele.key == "ico") {
ele.hide = true; ele.hide = true;
} }
}); });
...@@ -298,7 +307,7 @@ export default { ...@@ -298,7 +307,7 @@ export default {
openInfoModal() { openInfoModal() {
if ((this.excelType == '0' && this.excelData.length > 0) || (this.excelType == '1' && this.$refs.comExcel.excelData.length > 0)) { if ((this.excelType == '0' && this.excelData.length > 0) || (this.excelType == '1' && this.$refs.comExcel.excelData.length > 0)) {
this.imBtn = true; this.imBtn = true;
this.loadColum(this.columns); this.loadColum(this.columnsIm);
this.titleInfo = "批量导入"; this.titleInfo = "批量导入";
this.infoModal = true this.infoModal = true
} else { } else {
...@@ -339,6 +348,9 @@ export default { ...@@ -339,6 +348,9 @@ export default {
this.btnIm = false this.btnIm = false
} }
}, },
cancelModal() {
this.$emit('on-cancel')
},
l(key) { l(key) {
key = "user" + "." + key; key = "user" + "." + key;
return this.$t(key); return this.$t(key);
...@@ -352,7 +364,11 @@ export default { ...@@ -352,7 +364,11 @@ export default {
} }
}); });
this.colsIm = this.$u.clone(this.columns); this.colsIm = this.$u.clone(this.columns);
this.columnsIm = this.$u.clone(this.columns)
}, },
open(v) {
this.ImportModal = v
}
}, },
}; };
</script> </script>
......
<template> <template>
<div class="h100"> <div class="h100">
<DataGrid :columns="columns" ref="grid" :action="action" title="导入中心"> <DataGrid :columns="columns" ref="grid" :action="action" exportTitle="导入中心">
<template slot="easySearch"> <template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline> <Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys"> <FormItem prop="keys">
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
</div> </div>
<Content class="content" :class="!showMenu?'con_bord':''"> <Content class="content" :class="!showMenu?'con_bord':''">
<!--:data="dataT"--> <!--:data="dataT"-->
<DataGrid :action="action" :columns="columns" :conditions="easySearch" ref="grid" @on-selection-change="onSelect" :batch="true" :border="false" rowKey="id" title="订单管理" @on-import-data="onImportData"> <DataGrid :action="action" :columns="columns" :conditions="easySearch" ref="grid" @on-selection-change="onSelect" :batch="true" :border="false" rowKey="id" exportTitle="订单管理" @on-import-data="onImportData">
<template slot="easySearch"> <template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline> <Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys"> <FormItem prop="keys">
...@@ -1045,10 +1045,7 @@ export default { ...@@ -1045,10 +1045,7 @@ export default {
this.dataT = this.$u.clone(this.dataT); this.dataT = this.$u.clone(this.dataT);
}, },
//批量导入start //批量导入start
onImportData(val) {
alert(JSON.stringify(val))
this.$refs.grid.closeImport()
},
//批量导入end //批量导入end
} }
}; };
......
...@@ -44,5 +44,9 @@ export default { ...@@ -44,5 +44,9 @@ export default {
getmaterialdefinitionproperty(params){ getmaterialdefinitionproperty(params){
return Api.get(`${material}/custompropertydefinition/getmaterialdefinitionproperty`,params); return Api.get(`${material}/custompropertydefinition/getmaterialdefinitionproperty`,params);
}, },
//批量导入
import(params) {
return Api.post(`${resourceUrl}/resourceimportservice/import`, params);
},
} }
\ No newline at end of file
This diff is collapsed.
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