本地导入

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="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> <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"> <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"> <input ref="files" type="file" class="file_box" accept=".json, application/json" @change="button.handler">
{{ $t('map.importMap') }} {{ $t('map.importMap') }}
</el-button> </el-button>
@ -522,14 +522,33 @@ export default {
margin-right:10px; margin-right:10px;
margin-left: 0; margin-left: 0;
margin-bottom: 10px; 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 { .file_box {
width: 50px; width: 100%;
height: 30px; height: 100%;
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
opacity: 0; opacity: 0;
cursor: pointer; cursor: pointer;
z-index: 100;
} }
</style> </style>

View File

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

View File

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