forked from github/dataease
feat: 系统设置-系统参数
This commit is contained in:
parent
db52fb8f4a
commit
339630cc22
@ -14,18 +14,18 @@ public class MybatisPlusGenerator {
|
|||||||
* 第一 我嫌麻烦
|
* 第一 我嫌麻烦
|
||||||
* 第二 后面配置会放到nacos读起来更麻烦了
|
* 第二 后面配置会放到nacos读起来更麻烦了
|
||||||
*/
|
*/
|
||||||
private static final String url = "jdbc:mysql://39.98.78.97:3306/dataease?autoReconnect=false&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false";
|
private static final String url = "jdbc:mysql://127.0.0.1:3306/de_standalone?autoReconnect=false&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false";
|
||||||
private static final String username = "root";
|
private static final String username = "root";
|
||||||
private static final String password = "Password123@mysql";
|
private static final String password = "Password123@mysql";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 业务模块例如datasource,dataset,panel等
|
* 业务模块例如datasource,dataset,panel等
|
||||||
*/
|
*/
|
||||||
private static final String busi = "operation";
|
private static final String busi = "system";
|
||||||
/**
|
/**
|
||||||
* 这是要生成代码的表名称
|
* 这是要生成代码的表名称
|
||||||
*/
|
*/
|
||||||
private static final String TABLE_NAME = "core_opt_recent";
|
private static final String TABLE_NAME = "core_sys_setting";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下面两个配置基本上不用动
|
* 下面两个配置基本上不用动
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4
core/core-frontend/src/api/setting/sysParameter.ts
Normal file
4
core/core-frontend/src/api/setting/sysParameter.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import request from '@/config/axios'
|
||||||
|
|
||||||
|
export const queryMapKeyApi = () => request.get({ url: '/sysParameter/queryOnlineMap' })
|
||||||
|
export const saveMapKeyApi = data => request.post({ url: '/sysParameter/saveOnlineMap', data })
|
@ -2117,6 +2117,7 @@ export default {
|
|||||||
},
|
},
|
||||||
online_map: {
|
online_map: {
|
||||||
geometry: '地理信息',
|
geometry: '地理信息',
|
||||||
onlinemap: '在线地图'
|
onlinemap: '在线地图',
|
||||||
|
empty_desc: '请在左侧输入信息然后保存'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,21 +19,117 @@
|
|||||||
}}</el-button>
|
}}</el-button>
|
||||||
</el-aside>
|
</el-aside>
|
||||||
<el-main>
|
<el-main>
|
||||||
<div class="de-map-container" :id="domId" />
|
<div v-show="mapLoaded" v-if="!mapReloading" class="de-map-container" :id="domId" />
|
||||||
|
<EmptyBackground
|
||||||
|
v-if="!mapLoaded"
|
||||||
|
img-type="noneWhite"
|
||||||
|
:description="t('online_map.empty_desc')"
|
||||||
|
/>
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container>
|
</el-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from 'vue'
|
import { nextTick, onMounted, ref } from 'vue'
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
|
import { queryMapKeyApi, saveMapKeyApi } from '@/api/setting/sysParameter'
|
||||||
|
import { ElMessage } from 'element-plus-secondary'
|
||||||
|
import EmptyBackground from '@/components/empty-background/src/EmptyBackground.vue'
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const key = ref('')
|
const key = ref('')
|
||||||
|
const mapInstance = ref(null)
|
||||||
|
const mapReloading = ref(false)
|
||||||
const domId = ref('de-map-container')
|
const domId = ref('de-map-container')
|
||||||
const saveHandler = () => {
|
const mapLoaded = ref(false)
|
||||||
console.log(111)
|
|
||||||
|
const loadMap = () => {
|
||||||
|
if (!key.value) {
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
const mykey = key.value
|
||||||
|
const url = `https://webapi.amap.com/maps?v=2.0&key=${mykey}`
|
||||||
|
|
||||||
|
loadScript(url)
|
||||||
|
.then(() => {
|
||||||
|
if (mapInstance.value) {
|
||||||
|
mapInstance.value?.destroy()
|
||||||
|
mapInstance.value = null
|
||||||
|
mapReloading.value = true
|
||||||
|
setTimeout(() => {
|
||||||
|
domId.value = domId.value + '-de-'
|
||||||
|
mapReloading.value = false
|
||||||
|
nextTick(() => {
|
||||||
|
createMapInstance()
|
||||||
|
})
|
||||||
|
}, 1500)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
createMapInstance()
|
||||||
|
})
|
||||||
|
.catch(e => {
|
||||||
|
if (mapInstance.value) {
|
||||||
|
mapInstance.value.destroy()
|
||||||
|
mapInstance.value = null
|
||||||
|
}
|
||||||
|
console.error(e)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const createMapInstance = () => {
|
||||||
|
mapInstance.value = new window.AMap.Map(domId.value, {
|
||||||
|
viewMode: '2D',
|
||||||
|
zoom: 11,
|
||||||
|
center: [116.397428, 39.90923]
|
||||||
|
})
|
||||||
|
mapLoaded.value = true
|
||||||
|
}
|
||||||
|
const saveHandler = () => {
|
||||||
|
saveMapKeyApi({ key: key.value })
|
||||||
|
.then(() => {
|
||||||
|
ElMessage.success(t('commons.save_success'))
|
||||||
|
initLoad()
|
||||||
|
})
|
||||||
|
.catch(e => {
|
||||||
|
console.error(e)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const initLoad = () => {
|
||||||
|
queryMapKeyApi()
|
||||||
|
.then(res => {
|
||||||
|
key.value = res.data
|
||||||
|
loadMap()
|
||||||
|
})
|
||||||
|
.catch(e => {
|
||||||
|
console.error(e)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const loadScript = (url: string) => {
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
const scriptId = 'de-gaode-script-id'
|
||||||
|
let dom = document.getElementById(scriptId)
|
||||||
|
if (dom) {
|
||||||
|
dom.parentElement?.removeChild(dom)
|
||||||
|
dom = null
|
||||||
|
window.AMap = null
|
||||||
|
}
|
||||||
|
var script = document.createElement('script')
|
||||||
|
|
||||||
|
script.id = scriptId
|
||||||
|
script.onload = function () {
|
||||||
|
return resolve(null)
|
||||||
|
}
|
||||||
|
script.onerror = function () {
|
||||||
|
return reject(new Error('Load script from '.concat(url, ' failed')))
|
||||||
|
}
|
||||||
|
script.src = url
|
||||||
|
var head = document.head || document.getElementsByTagName('head')[0]
|
||||||
|
;(document.body || head).appendChild(script)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
initLoad()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
package io.dataease.api.system;
|
||||||
|
|
||||||
|
import io.dataease.api.system.request.OnlineMapEditor;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
|
public interface SysParameterApi {
|
||||||
|
|
||||||
|
@GetMapping("/singleVal/{key}")
|
||||||
|
String singleVal(@PathVariable("key") String key);
|
||||||
|
|
||||||
|
@PostMapping("/saveOnlineMap")
|
||||||
|
void saveOnlineMap(@RequestBody OnlineMapEditor editor);
|
||||||
|
|
||||||
|
@GetMapping("/queryOnlineMap")
|
||||||
|
String queryOnlineMap();
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package io.dataease.api.system.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class OnlineMapEditor implements Serializable {
|
||||||
|
|
||||||
|
private String key;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user