完善导入模块
This commit is contained in:
@@ -3,7 +3,9 @@
|
||||
<el-header>
|
||||
<div class="left-panel">
|
||||
<el-button type="primary" :size="size" icon="el-icon-plus" @click="add">新增公司</el-button>
|
||||
<el-button type="primary" :size="size" plain @click="importFile">批量导入</el-button>
|
||||
<scImport :size="size" title="批量导入公司组织" text="公司表单" @parentParams="importUpload" @importSuccess="importSuccess">
|
||||
<div @click="importTemplate">下载导入模版</div>
|
||||
</scImport>
|
||||
</div>
|
||||
<div class="right-panel">
|
||||
<scExport :size="size" @exportData="exportData" @updateShow="exportChangeShow" :show="exportShow" type="6"></scExport>
|
||||
@@ -51,9 +53,6 @@
|
||||
|
||||
<save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSaveSuccess" @closed="dialog.save=false"></save-dialog>
|
||||
<see-dialog v-if="dialog.show" ref="showDialog" @closed="dialog.show=false"></see-dialog>
|
||||
<scImport v-if="dialog.import" ref="importDialog" @closed="dialog.import=false">
|
||||
<div @click="importTemplate">下载导入模版</div>
|
||||
</scImport>
|
||||
|
||||
</template>
|
||||
|
||||
@@ -72,7 +71,6 @@ export default {
|
||||
dialog: {
|
||||
save: false,
|
||||
show: false,
|
||||
import:false
|
||||
},
|
||||
list: {
|
||||
apiObj: this.$API.system.company.list,
|
||||
@@ -146,25 +144,30 @@ export default {
|
||||
this.$refs.saveDialog.open()
|
||||
})
|
||||
},
|
||||
// 导入文件
|
||||
importFile(){
|
||||
this.dialog.import = true;
|
||||
this.$nextTick(() => {
|
||||
this.$refs.importDialog.open()
|
||||
})
|
||||
},
|
||||
|
||||
// 批量导入
|
||||
async importTemplate() {
|
||||
const res = await this.$API.system.company.template.post();
|
||||
const blob = new Blob([res.data]);
|
||||
const blob = new Blob([res]);
|
||||
const text = new Date().getTime();
|
||||
const eLink = document.createElement('a');
|
||||
eLink.download = "company_import_template_20240716093538_6695ce6a3ca1f.xlsx";
|
||||
eLink.download = "公司导入模版_"+text+'.xlsx';
|
||||
eLink.style.display = 'none';
|
||||
eLink.href = URL.createObjectURL(blob);
|
||||
document.body.appendChild(eLink);
|
||||
eLink.click();
|
||||
URL.revokeObjectURL(eLink.href); // 释放URL 对象
|
||||
URL.revokeObjectURL(eLink.href);
|
||||
document.body.removeChild(eLink);
|
||||
},
|
||||
async importUpload(params) {
|
||||
const res = await this.$API.system.company.import.post(params);
|
||||
if(res.code == 200){
|
||||
this.$message.success('上传成功,开始导入数据');
|
||||
}
|
||||
},
|
||||
importSuccess(){
|
||||
this.$refs.table.refresh()
|
||||
},
|
||||
|
||||
//编辑
|
||||
table_edit(row){
|
||||
|
||||
@@ -241,7 +241,15 @@ export default {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 20px;
|
||||
width: 90px;
|
||||
width: 120px;
|
||||
.name{
|
||||
width: 100px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
display: block;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user