本地导入

This commit is contained in:
fan 2020-04-09 18:54:22 +08:00
parent 991fa86ede
commit 1e4b7bbfd9
3 changed files with 28 additions and 8 deletions

View File

@ -148,7 +148,7 @@
<el-button v-if="queryForm.reset" type="primary" size="small" :disabled="!canQuery" @click="doClean">{{ $t('global.reset') }}</el-button>
<el-button v-if="exportFlag" type="primary" size="small" :disabled="!canQuery" @click="doExport">{{ $t('global.export') }}</el-button>
<template v-for="(button, index) in queryList.actions">
<el-button v-if="button.fileType==='file'" :key="index" :type="button.type ? button.type: 'primary'" size="small" class="button_style" :disabled="button.disabled" :loading="button.disabled">
<el-button v-if="button.fileType==='file' && (button.hasOwnProperty('show') ? button.show: true)" :key="index" :type="button.type ? button.type: 'primary'" size="small" class="button_style uploadDemo" :disabled="button.disabled" :loading="button.disabled">
<input ref="files" type="file" class="file_box" accept=".json, application/json" @change="button.handler">
{{ $t('map.importMap') }}
</el-button>
@ -523,13 +523,32 @@ export default {
margin-left: 0;
margin-bottom: 10px;
}
.uploadDemo {
position: relative;
overflow: hidden;
margin-right: 3px;
cursor: pointer;
/*width: 60px;*/
padding: 0 15px;
height: 32px;
/*input {*/
/*width: 100%;*/
/*height: 100%;*/
/*position: relative;*/
/*left: 0;*/
/*top: 0;*/
/*opacity: 0;*/
/*cursor: pointer;*/
/*}*/
}
.file_box {
width: 50px;
height: 30px;
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
opacity: 0;
cursor: pointer;
z-index: 100;
}
</style>

View File

@ -18,6 +18,7 @@ import UpdateOperate from './draft.vue';
import SetProject from './project';
import CopyMap from './copy';
import LocalMap from './localMap';
import { superAdmin } from '@/router/index_APP_TARGET';
export default {
name: 'PublishMap',
@ -139,8 +140,8 @@ export default {
],
actions: [
{ text: '地图排序', handler: this.mapSort },
{ text: '导出', handler: this.localExport},
{ text: '导入', handler: this.localImport, fileType: 'file'}
{ text: '导出', handler: this.localExport, show: () => { return this.$store.state.user.roles.indexOf(superAdmin) > 0; }},
{ text: '导入', handler: this.localImport, fileType: 'file', show: () => { return this.$store.state.user.roles.indexOf(superAdmin) > 0; }}
]
},
@ -363,7 +364,7 @@ export default {
this.$router.push({ path: `/publish/mapSort`});
},
localExport() {
this.$refs['localMap'].doShow();
this.$refs['localMap'].doShow();
},
localImport() {
const loading = this.$loading({

View File

@ -1,6 +1,6 @@
<template>
<el-dialog v-dialogDrag title="导出地图" :visible.sync="dialogVisible" width="30%" center>
<el-select v-model="selectMapList" multiple placeholder="请选择" style="text-align: center">
<el-dialog v-dialogDrag title="导出地图" :visible.sync="dialogVisible" width="20%" center>
<el-select v-model="selectMapList" multiple placeholder="请选择地图" style="width: 60%; position: relative; left: 20%;">
<el-option
v-for="item in publishMapList"
:key="item.id"