forked from github/dataease
Merge branch 'dev-v2' into pr@dev-v2_dzz
This commit is contained in:
commit
4cb022654e
@ -0,0 +1,10 @@
|
|||||||
|
package io.dataease.system.dao.ext.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import io.dataease.system.dao.auto.entity.CoreSysSetting;
|
||||||
|
import io.dataease.system.dao.auto.mapper.CoreSysSettingMapper;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component("extCoreSysSettingMapper")
|
||||||
|
public class ExtCoreSysSettingMapper extends ServiceImpl<CoreSysSettingMapper, CoreSysSetting> {
|
||||||
|
}
|
@ -1,15 +1,17 @@
|
|||||||
package io.dataease.system.manage;
|
package io.dataease.system.manage;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import io.dataease.api.system.vo.SettingItemVO;
|
||||||
import io.dataease.system.dao.auto.entity.CoreSysSetting;
|
import io.dataease.system.dao.auto.entity.CoreSysSetting;
|
||||||
import io.dataease.system.dao.auto.mapper.CoreSysSettingMapper;
|
import io.dataease.system.dao.auto.mapper.CoreSysSettingMapper;
|
||||||
|
import io.dataease.system.dao.ext.mapper.ExtCoreSysSettingMapper;
|
||||||
|
import io.dataease.utils.BeanUtils;
|
||||||
import io.dataease.utils.IDUtils;
|
import io.dataease.utils.IDUtils;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -22,6 +24,9 @@ public class SysParameterManage {
|
|||||||
@Resource
|
@Resource
|
||||||
private CoreSysSettingMapper coreSysSettingMapper;
|
private CoreSysSettingMapper coreSysSettingMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ExtCoreSysSettingMapper extCoreSysSettingMapper;
|
||||||
|
|
||||||
public String singleVal(String key) {
|
public String singleVal(String key) {
|
||||||
QueryWrapper<CoreSysSetting> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<CoreSysSetting> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("pkey", key);
|
queryWrapper.eq("pkey", key);
|
||||||
@ -53,22 +58,39 @@ public class SysParameterManage {
|
|||||||
sysSetting.setPval(val);
|
sysSetting.setPval(val);
|
||||||
coreSysSettingMapper.updateById(sysSetting);
|
coreSysSettingMapper.updateById(sysSetting);
|
||||||
}
|
}
|
||||||
void save(List<CoreSysSetting> boList) {
|
|
||||||
List<CoreSysSetting> all = all();
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<CoreSysSetting> all() {
|
|
||||||
QueryWrapper<CoreSysSetting> queryWrapper = new QueryWrapper<>();
|
|
||||||
return coreSysSettingMapper.selectList(queryWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String,String> groupVal(String groupKey) {
|
public Map<String, String> groupVal(String groupKey) {
|
||||||
QueryWrapper<CoreSysSetting> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<CoreSysSetting> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.like("pkey", groupKey);
|
queryWrapper.likeRight("pkey", groupKey);
|
||||||
|
queryWrapper.orderByAsc("sort");
|
||||||
List<CoreSysSetting> sysSettings = coreSysSettingMapper.selectList(queryWrapper);
|
List<CoreSysSetting> sysSettings = coreSysSettingMapper.selectList(queryWrapper);
|
||||||
if (!CollectionUtils.isEmpty(sysSettings)) {
|
if (!CollectionUtils.isEmpty(sysSettings)) {
|
||||||
return sysSettings.stream().collect(Collectors.toMap(CoreSysSetting::getPkey, CoreSysSetting::getPval));
|
return sysSettings.stream().collect(Collectors.toMap(CoreSysSetting::getPkey, CoreSysSetting::getPval));
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<SettingItemVO> groupList(String groupKey) {
|
||||||
|
QueryWrapper<CoreSysSetting> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.likeRight("pkey", groupKey);
|
||||||
|
queryWrapper.orderByAsc("sort");
|
||||||
|
List<CoreSysSetting> sysSettings = coreSysSettingMapper.selectList(queryWrapper);
|
||||||
|
if (!CollectionUtils.isEmpty(sysSettings)) {
|
||||||
|
return sysSettings.stream().map(item -> BeanUtils.copyBean(new SettingItemVO(), item)).toList();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void saveGroup(List<SettingItemVO> vos, String groupKey) {
|
||||||
|
QueryWrapper<CoreSysSetting> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.likeRight("pkey", groupKey);
|
||||||
|
coreSysSettingMapper.delete(queryWrapper);
|
||||||
|
List<CoreSysSetting> sysSettings = vos.stream().map(item -> {
|
||||||
|
CoreSysSetting sysSetting = BeanUtils.copyBean(new CoreSysSetting(), item);
|
||||||
|
sysSetting.setId(IDUtils.snowID());
|
||||||
|
return sysSetting;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
extCoreSysSettingMapper.saveBatch(sysSettings);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,15 @@ package io.dataease.system.server;
|
|||||||
|
|
||||||
import io.dataease.api.system.SysParameterApi;
|
import io.dataease.api.system.SysParameterApi;
|
||||||
import io.dataease.api.system.request.OnlineMapEditor;
|
import io.dataease.api.system.request.OnlineMapEditor;
|
||||||
|
import io.dataease.api.system.vo.SettingItemVO;
|
||||||
import io.dataease.system.manage.SysParameterManage;
|
import io.dataease.system.manage.SysParameterManage;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/sysParameter")
|
@RequestMapping("/sysParameter")
|
||||||
public class SysParameterServer implements SysParameterApi {
|
public class SysParameterServer implements SysParameterApi {
|
||||||
@ -29,4 +32,15 @@ public class SysParameterServer implements SysParameterApi {
|
|||||||
String key = sysParameterManage.queryOnlineMap();
|
String key = sysParameterManage.queryOnlineMap();
|
||||||
return StringUtils.isNotBlank(key) ? key : "";
|
return StringUtils.isNotBlank(key) ? key : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SettingItemVO> queryBasicSetting() {
|
||||||
|
String key = "basic.";
|
||||||
|
return sysParameterManage.groupList(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveBasicSetting(List<SettingItemVO> settingItemVOS) {
|
||||||
|
sysParameterManage.saveGroup(settingItemVOS, "basic.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
1
core/core-frontend/src/assets/svg/de-json.svg
Normal file
1
core/core-frontend/src/assets/svg/de-json.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 5.1 KiB |
@ -33,6 +33,9 @@
|
|||||||
</el-icon>
|
</el-icon>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
<span v-else-if="item.pkey === '数据源检测时间间隔'">
|
||||||
|
<span>{{ item.pval + ' ' + executeTime + '执行一次' }}</span>
|
||||||
|
</span>
|
||||||
<span v-else>{{ item.pval }}</span>
|
<span v-else>{{ item.pval }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -62,22 +65,35 @@ const props = defineProps({
|
|||||||
default: '基础设置'
|
default: '基础设置'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
const executeTime = ref('0分0秒')
|
||||||
const curTitle = computed(() => {
|
const curTitle = computed(() => {
|
||||||
return props.settingTitle
|
return props.settingTitle
|
||||||
})
|
})
|
||||||
|
|
||||||
const loadList = () => {
|
const loadList = () => {
|
||||||
|
settingList.value = []
|
||||||
if (props.settingData?.length) {
|
if (props.settingData?.length) {
|
||||||
props.settingData.forEach(item => {
|
props.settingData.forEach(item => {
|
||||||
settingList.value.push(item)
|
if (item.pkey === '数据源检测频率') {
|
||||||
|
executeTime.value = getExecuteTime(item.pval)
|
||||||
|
} else {
|
||||||
|
settingList.value.push(item)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getExecuteTime = val => {
|
||||||
|
const options = [
|
||||||
|
{ value: 'minute', label: '分钟(执行时间:0秒)' },
|
||||||
|
{ value: 'hour', label: '小时(执行时间:0分0秒)' }
|
||||||
|
]
|
||||||
|
return options.filter(item => item.value === val)[0].label
|
||||||
|
}
|
||||||
|
|
||||||
const settingList = ref([] as SettingRecord[])
|
const settingList = ref([] as SettingRecord[])
|
||||||
|
|
||||||
const loadBasic = () => {
|
/* const loadBasic = () => {
|
||||||
settingList.value.push({
|
settingList.value.push({
|
||||||
pkey: '请求超时时间',
|
pkey: '请求超时时间',
|
||||||
pval: '100',
|
pval: '100',
|
||||||
@ -147,15 +163,9 @@ const loadEmail = () => {
|
|||||||
type: 'text',
|
type: 'text',
|
||||||
sort: 7
|
sort: 7
|
||||||
})
|
})
|
||||||
}
|
} */
|
||||||
|
|
||||||
const init = () => {
|
const init = () => {
|
||||||
if (props.settingKey === 'basic') {
|
|
||||||
loadBasic()
|
|
||||||
}
|
|
||||||
if (props.settingKey === 'email') {
|
|
||||||
loadEmail()
|
|
||||||
}
|
|
||||||
if (props.settingData?.length) {
|
if (props.settingData?.length) {
|
||||||
loadList()
|
loadList()
|
||||||
}
|
}
|
||||||
@ -186,6 +196,9 @@ const emits = defineEmits(['edit'])
|
|||||||
const edit = () => {
|
const edit = () => {
|
||||||
emits('edit')
|
emits('edit')
|
||||||
}
|
}
|
||||||
|
defineExpose({
|
||||||
|
init
|
||||||
|
})
|
||||||
init()
|
init()
|
||||||
formatPwd()
|
formatPwd()
|
||||||
formatLabel()
|
formatLabel()
|
||||||
|
@ -3,51 +3,82 @@ import { ref, reactive } from 'vue'
|
|||||||
import { ElMessage, ElLoading } from 'element-plus-secondary'
|
import { ElMessage, ElLoading } from 'element-plus-secondary'
|
||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import type { FormInstance, FormRules } from 'element-plus-secondary'
|
import type { FormInstance, FormRules } from 'element-plus-secondary'
|
||||||
|
import request from '@/config/axios'
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const loadingInstance = ref(null)
|
const loadingInstance = ref(null)
|
||||||
const createUserForm = ref<FormInstance>()
|
const basicForm = ref<FormInstance>()
|
||||||
|
const options = [
|
||||||
|
{ value: 'minute', label: '分钟(执行时间:0秒)' },
|
||||||
|
{ value: 'hour', label: '小时(执行时间:0分0秒)' }
|
||||||
|
]
|
||||||
|
interface BasicFrom {
|
||||||
|
autoCreateUser?: boolean
|
||||||
|
dsIntervalTime?: string
|
||||||
|
dsExecuteTime?: string
|
||||||
|
}
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
roleList: [],
|
form: reactive<BasicFrom>({
|
||||||
form: reactive<UserForm>({
|
autoCreateUser: false,
|
||||||
id: null,
|
dsIntervalTime: '30',
|
||||||
account: null,
|
dsExecuteTime: 'minute'
|
||||||
name: null,
|
|
||||||
email: null,
|
|
||||||
enable: true,
|
|
||||||
phone: null,
|
|
||||||
phonePrefix: '+86',
|
|
||||||
roleIds: []
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
const rule = reactive<FormRules>({})
|
const rule = reactive<FormRules>({
|
||||||
|
dsIntervalTime: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: t('common.require'),
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
const edit = () => {
|
const edit = row => {
|
||||||
|
state.form = {
|
||||||
|
autoCreateUser: row.autoCreateUser === 'true',
|
||||||
|
dsIntervalTime: row.dsIntervalTime,
|
||||||
|
dsExecuteTime: row.dsExecuteTime
|
||||||
|
}
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
// queryForm()
|
|
||||||
}
|
}
|
||||||
/* const queryForm = () => {
|
|
||||||
showLoading()
|
|
||||||
personInfoApi().then(res => {
|
|
||||||
state.form = reactive<UserForm>(res.data)
|
|
||||||
closeLoading()
|
|
||||||
})
|
|
||||||
} */
|
|
||||||
const emits = defineEmits(['saved'])
|
const emits = defineEmits(['saved'])
|
||||||
|
|
||||||
|
const buildSettingList = () => {
|
||||||
|
const param = { ...state.form }
|
||||||
|
const item0 = {
|
||||||
|
pkey: 'basic.autoCreateUser',
|
||||||
|
pval: param.autoCreateUser.toString(),
|
||||||
|
type: 'text',
|
||||||
|
sort: 1
|
||||||
|
}
|
||||||
|
const item1 = {
|
||||||
|
pkey: 'basic.dsIntervalTime',
|
||||||
|
pval: param.dsIntervalTime,
|
||||||
|
type: 'text',
|
||||||
|
sort: 2
|
||||||
|
}
|
||||||
|
const item2 = {
|
||||||
|
pkey: 'basic.dsExecuteTime',
|
||||||
|
pval: param.dsExecuteTime,
|
||||||
|
type: 'text',
|
||||||
|
sort: 3
|
||||||
|
}
|
||||||
|
return [item0, item1, item2]
|
||||||
|
}
|
||||||
const submitForm = async (formEl: FormInstance | undefined) => {
|
const submitForm = async (formEl: FormInstance | undefined) => {
|
||||||
if (!formEl) return
|
if (!formEl) return
|
||||||
await formEl.validate((valid, fields) => {
|
await formEl.validate((valid, fields) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
const param = { ...state.form }
|
const param = buildSettingList()
|
||||||
const method = null
|
|
||||||
showLoading()
|
showLoading()
|
||||||
method(param)
|
request
|
||||||
|
.post({ url: '/sysParameter/basic/save', data: param })
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (!res.msg) {
|
if (!res.msg) {
|
||||||
ElMessage.success(t('common.save_success'))
|
ElMessage.success(t('common.save_success'))
|
||||||
|
|
||||||
emits('saved')
|
emits('saved')
|
||||||
reset()
|
reset()
|
||||||
}
|
}
|
||||||
@ -69,7 +100,7 @@ const resetForm = (formEl: FormInstance | undefined) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const reset = () => {
|
const reset = () => {
|
||||||
resetForm(createUserForm.value)
|
resetForm(basicForm.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
const showLoading = () => {
|
const showLoading = () => {
|
||||||
@ -92,32 +123,46 @@ defineExpose({
|
|||||||
direction="rtl"
|
direction="rtl"
|
||||||
>
|
>
|
||||||
<el-form
|
<el-form
|
||||||
ref="createUserForm"
|
ref="basicForm"
|
||||||
require-asterisk-position="right"
|
require-asterisk-position="right"
|
||||||
:model="state.form"
|
:model="state.form"
|
||||||
:rules="rule"
|
:rules="rule"
|
||||||
label-width="80px"
|
label-width="80px"
|
||||||
label-position="top"
|
label-position="top"
|
||||||
>
|
>
|
||||||
<el-form-item label="请求超时时间" prop="name">
|
<el-form-item label="禁止扫码创建用户" prop="autoCreateUser">
|
||||||
<el-input
|
<el-switch v-model="state.form.autoCreateUser" />
|
||||||
v-model="state.form.name"
|
|
||||||
:placeholder="t('common.please_input') + t('user.name')"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="数据源检测时间间隔" prop="account">
|
<el-form-item label="数据源检测时间间隔" prop="dsIntervalTime">
|
||||||
<el-input
|
<div class="ds-task-form-inline">
|
||||||
v-model="state.form.account"
|
<span>每</span>
|
||||||
:placeholder="t('common.please_input') + t('common.account')"
|
<el-input-number
|
||||||
disabled
|
v-model="state.form.dsIntervalTime"
|
||||||
/>
|
autocomplete="off"
|
||||||
|
step-strictly
|
||||||
|
class="text-left"
|
||||||
|
:min="1"
|
||||||
|
:placeholder="t('common.inputText')"
|
||||||
|
controls-position="right"
|
||||||
|
type="number"
|
||||||
|
/>
|
||||||
|
<el-select v-model="state.form.dsExecuteTime">
|
||||||
|
<el-option
|
||||||
|
v-for="item in options"
|
||||||
|
:key="item.value"
|
||||||
|
:label="item.label"
|
||||||
|
:value="item.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
<span class="ds-span">执行一次</span>
|
||||||
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
<el-button @click="resetForm(createUserForm)">{{ t('common.cancel') }}</el-button>
|
<el-button @click="resetForm(basicForm)">{{ t('common.cancel') }}</el-button>
|
||||||
<el-button type="primary" @click="submitForm(createUserForm)">
|
<el-button type="primary" @click="submitForm(basicForm)">
|
||||||
{{ t('commons.save') }}
|
{{ t('commons.save') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</span>
|
</span>
|
||||||
@ -125,47 +170,22 @@ defineExpose({
|
|||||||
</el-drawer>
|
</el-drawer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="less">
|
<style scoped lang="less">
|
||||||
.basic-info-drawer {
|
.ds-task-form-inline {
|
||||||
.editer-form-title {
|
width: 100%;
|
||||||
width: 100%;
|
display: flex;
|
||||||
border-radius: 4px;
|
.ed-input-number {
|
||||||
background: #e1eaff;
|
width: 140px;
|
||||||
margin: -8px 0 16px 0;
|
margin: 0 6px;
|
||||||
height: 40px;
|
}
|
||||||
padding-left: 16px;
|
.ed-select {
|
||||||
|
width: 240px;
|
||||||
i {
|
:deep(.ed-input) {
|
||||||
color: #3370ff;
|
width: 100% !important;
|
||||||
font-size: 14.666666030883789px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pwd {
|
|
||||||
font-family: PingFang SC;
|
|
||||||
font-size: 14px;
|
|
||||||
font-weight: 400;
|
|
||||||
line-height: 22px;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pwd {
|
|
||||||
margin: 0 8px;
|
|
||||||
color: #1f2329;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.input-with-select {
|
span.ds-span {
|
||||||
.ed-input-group__prepend {
|
margin-left: 6px;
|
||||||
width: 72px;
|
|
||||||
background-color: #fff;
|
|
||||||
padding: 0 20px;
|
|
||||||
color: #1f2329;
|
|
||||||
text-align: center;
|
|
||||||
font-family: PingFang SC;
|
|
||||||
font-size: 14px;
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 400;
|
|
||||||
line-height: 22px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -1,27 +1,81 @@
|
|||||||
<template>
|
<template>
|
||||||
<InfoTemplate
|
<InfoTemplate
|
||||||
|
ref="infoTemplate"
|
||||||
:label-tooltips="tooltips"
|
:label-tooltips="tooltips"
|
||||||
setting-key="basic"
|
setting-key="basic"
|
||||||
setting-title="基础设置"
|
setting-title="基础设置"
|
||||||
|
:setting-data="state.templateList"
|
||||||
@edit="edit"
|
@edit="edit"
|
||||||
/>
|
/>
|
||||||
<basic-edit ref="editor" />
|
<basic-edit ref="editor" @saved="refresh" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import InfoTemplate from '../../common/InfoTemplate.vue'
|
import InfoTemplate from '../../common/InfoTemplate.vue'
|
||||||
import BasicEdit from './BasicEdit.vue'
|
import BasicEdit from './BasicEdit.vue'
|
||||||
|
import request from '@/config/axios'
|
||||||
|
import { SettingRecord } from '@/views/system/common/SettingTemplate'
|
||||||
|
import { reactive } from 'vue'
|
||||||
const editor = ref()
|
const editor = ref()
|
||||||
|
const infoTemplate = ref()
|
||||||
const tooltips = [
|
const tooltips = [
|
||||||
{
|
{
|
||||||
key: '请求超时时间',
|
key: '请求超时时间',
|
||||||
val: '请求超时时间(单位:秒,注意:保存后刷新浏览器生效)'
|
val: '请求超时时间(单位:秒,注意:保存后刷新浏览器生效)'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
const state = reactive({
|
||||||
|
templateList: [
|
||||||
|
{
|
||||||
|
pkey: '禁止扫码创建用户',
|
||||||
|
pval: '未开启',
|
||||||
|
type: 'text',
|
||||||
|
sort: 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pkey: '数据源检测时间间隔',
|
||||||
|
pval: '100',
|
||||||
|
type: 'text',
|
||||||
|
sort: 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
pkey: '数据源检测频率',
|
||||||
|
pval: 'minute',
|
||||||
|
type: 'text',
|
||||||
|
sort: 3
|
||||||
|
}
|
||||||
|
] as SettingRecord[]
|
||||||
|
})
|
||||||
|
|
||||||
|
const search = cb => {
|
||||||
|
const url = '/sysParameter/basic/query'
|
||||||
|
request.get({ url }).then(res => {
|
||||||
|
const data = res.data
|
||||||
|
for (let index = 0; index < data.length; index++) {
|
||||||
|
const item = data[index]
|
||||||
|
if (index === 0) {
|
||||||
|
state.templateList[index].pval = item.pval === 'true' ? '开启' : '未开启'
|
||||||
|
} else {
|
||||||
|
state.templateList[index].pval = item.pval
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cb && cb()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const refresh = () => {
|
||||||
|
search(() => {
|
||||||
|
infoTemplate?.value.init()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
search(null)
|
||||||
|
|
||||||
const edit = () => {
|
const edit = () => {
|
||||||
editor?.value.edit()
|
const param = {
|
||||||
|
autoCreateUser: state.templateList[0].pval === '开启' ? 'true' : 'false',
|
||||||
|
dsIntervalTime: state.templateList[1].pval,
|
||||||
|
dsExecuteTime: state.templateList[2].pval
|
||||||
|
}
|
||||||
|
editor?.value.edit(param)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<div class="container-sys-param">
|
<div class="container-sys-param">
|
||||||
<map-setting v-if="activeName === 'map'" />
|
<map-setting v-if="activeName === 'map'" />
|
||||||
<basic-info v-if="activeName === 'basic'" />
|
<basic-info v-if="activeName === 'basic'" />
|
||||||
<email-info v-if="activeName === 'email'" />
|
<!-- <email-info v-if="activeName === 'email'" /> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -17,12 +17,12 @@ import { ref } from 'vue'
|
|||||||
import { useI18n } from '@/hooks/web/useI18n'
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
import MapSetting from './map/MapSetting.vue'
|
import MapSetting from './map/MapSetting.vue'
|
||||||
import BasicInfo from './basic/BasicInfo.vue'
|
import BasicInfo from './basic/BasicInfo.vue'
|
||||||
import EmailInfo from './email/EmailInfo.vue'
|
/* import EmailInfo from './email/EmailInfo.vue' */
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|
||||||
const tabArray = [
|
const tabArray = [
|
||||||
{ label: '基础设置', name: 'basic' },
|
{ label: '基础设置', name: 'basic' },
|
||||||
{ label: '邮件设置', name: 'email' },
|
/* { label: '邮件设置', name: 'email' }, */
|
||||||
{ label: '地图设置', name: 'map' }
|
{ label: '地图设置', name: 'map' }
|
||||||
/* {label: '引擎设置', name: 'engine'}, */
|
/* {label: '引擎设置', name: 'engine'}, */
|
||||||
]
|
]
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<el-aside class="geonetry-aside">
|
<el-aside class="geonetry-aside">
|
||||||
<div class="geo-title">
|
<div class="geo-title">
|
||||||
<span>{{ t('online_map.geometry') }}</span>
|
<span>{{ t('online_map.geometry') }}</span>
|
||||||
<span class="add-icon-span">
|
<span class="add-icon-span" @click="add()">
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<Icon name="icon_add_outlined"></Icon>
|
<Icon name="icon_add_outlined"></Icon>
|
||||||
</el-icon>
|
</el-icon>
|
||||||
@ -83,6 +83,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container>
|
</el-container>
|
||||||
|
<geometry-edit ref="editor" :tree-data="treeData" @saved="loadTreeData" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
@ -93,9 +94,11 @@ import EmptyBackground from '@/components/empty-background/src/EmptyBackground.v
|
|||||||
import { getGeoJsonFile } from '@/views/chart/components/js/util'
|
import { getGeoJsonFile } from '@/views/chart/components/js/util'
|
||||||
import { cloneDeep } from 'lodash-es'
|
import { cloneDeep } from 'lodash-es'
|
||||||
import { setColorName } from '@/utils/utils'
|
import { setColorName } from '@/utils/utils'
|
||||||
|
import GeometryEdit from './GeometryEdit.vue'
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const keyword = ref('')
|
const keyword = ref('')
|
||||||
const treeData = ref([])
|
const treeData = ref([])
|
||||||
|
const editor = ref()
|
||||||
interface Tree {
|
interface Tree {
|
||||||
label: string
|
label: string
|
||||||
children?: Tree[]
|
children?: Tree[]
|
||||||
@ -136,6 +139,10 @@ const loadTreeData = () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const add = (pid?: string) => {
|
||||||
|
editor?.value.edit(pid)
|
||||||
|
}
|
||||||
|
|
||||||
loadTreeData()
|
loadTreeData()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -158,7 +165,7 @@ loadTreeData()
|
|||||||
line-height: 24px;
|
line-height: 24px;
|
||||||
}
|
}
|
||||||
.add-icon-span {
|
.add-icon-span {
|
||||||
display: none;
|
// display: none;
|
||||||
color: #3370ff;
|
color: #3370ff;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
width: 20px;
|
width: 20px;
|
||||||
|
@ -0,0 +1,240 @@
|
|||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, PropType } from 'vue'
|
||||||
|
import { ElMessage, ElLoading } from 'element-plus-secondary'
|
||||||
|
import { useI18n } from '@/hooks/web/useI18n'
|
||||||
|
import type {
|
||||||
|
FormInstance,
|
||||||
|
FormRules,
|
||||||
|
UploadRequestOptions,
|
||||||
|
UploadProps
|
||||||
|
} from 'element-plus-secondary'
|
||||||
|
import request from '@/config/axios'
|
||||||
|
import { GeometryFrom } from './interface'
|
||||||
|
const { t } = useI18n()
|
||||||
|
const dialogVisible = ref(false)
|
||||||
|
const loadingInstance = ref(null)
|
||||||
|
const geoForm = ref<FormInstance>()
|
||||||
|
const props = defineProps({
|
||||||
|
treeData: {
|
||||||
|
type: Array as PropType<unknown[]>,
|
||||||
|
default: () => []
|
||||||
|
}
|
||||||
|
})
|
||||||
|
const geoFile = ref()
|
||||||
|
const fileName = ref()
|
||||||
|
const state = reactive({
|
||||||
|
form: reactive<GeometryFrom>({
|
||||||
|
pid: null,
|
||||||
|
code: null,
|
||||||
|
name: null
|
||||||
|
})
|
||||||
|
})
|
||||||
|
const treeProps = {
|
||||||
|
value: 'id',
|
||||||
|
label: 'name',
|
||||||
|
disabled: 'readOnly'
|
||||||
|
}
|
||||||
|
|
||||||
|
const rule = reactive<FormRules>({
|
||||||
|
pid: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: t('common.require'),
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
code: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: t('common.require'),
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
name: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: t('common.require'),
|
||||||
|
trigger: 'blur'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
const edit = (pid?: string) => {
|
||||||
|
state.form.pid = pid
|
||||||
|
state.form.code = null
|
||||||
|
state.form.name = null
|
||||||
|
geoFile.value = null
|
||||||
|
fileName.value = null
|
||||||
|
dialogVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
const emits = defineEmits(['saved'])
|
||||||
|
|
||||||
|
const submitForm = async (formEl: FormInstance | undefined) => {
|
||||||
|
if (!formEl) return
|
||||||
|
await formEl.validate((valid, fields) => {
|
||||||
|
if (valid) {
|
||||||
|
const param = { ...state.form }
|
||||||
|
showLoading()
|
||||||
|
request
|
||||||
|
.post({ url: '/sysParameter/map/save', data: param })
|
||||||
|
.then(res => {
|
||||||
|
if (!res.msg) {
|
||||||
|
ElMessage.success(t('common.save_success'))
|
||||||
|
emits('saved')
|
||||||
|
reset()
|
||||||
|
}
|
||||||
|
closeLoading()
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
closeLoading()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
console.log('error submit!', fields)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const resetForm = (formEl: FormInstance | undefined) => {
|
||||||
|
if (!formEl) return
|
||||||
|
geoFile.value = null
|
||||||
|
fileName.value = null
|
||||||
|
formEl.resetFields()
|
||||||
|
dialogVisible.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
const reset = () => {
|
||||||
|
resetForm(geoForm.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
const showLoading = () => {
|
||||||
|
loadingInstance.value = ElLoading.service({ target: '.basic-info-drawer' })
|
||||||
|
}
|
||||||
|
const closeLoading = () => {
|
||||||
|
loadingInstance.value?.close()
|
||||||
|
}
|
||||||
|
const handleExceed: UploadProps['onExceed'] = () => {
|
||||||
|
ElMessage.warning(t('userimport.exceedMsg'))
|
||||||
|
}
|
||||||
|
const handleError = () => {
|
||||||
|
ElMessage.warning('执行失败请联系管理员')
|
||||||
|
}
|
||||||
|
const setFile = (options: UploadRequestOptions) => {
|
||||||
|
geoFile.value = options.file
|
||||||
|
fileName.value = options.file.name
|
||||||
|
}
|
||||||
|
const uploadValidate = file => {
|
||||||
|
const suffix = file.name.substring(file.name.lastIndexOf('.') + 1)
|
||||||
|
if (suffix !== 'json') {
|
||||||
|
ElMessage.warning('只能上传json文件')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file.size / 1024 / 1024 > 200) {
|
||||||
|
ElMessage.warning('最大上传200M')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
defineExpose({
|
||||||
|
edit
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<el-drawer
|
||||||
|
title="地理信息"
|
||||||
|
v-model="dialogVisible"
|
||||||
|
custom-class="basic-info-drawer"
|
||||||
|
size="600px"
|
||||||
|
direction="rtl"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="geoForm"
|
||||||
|
require-asterisk-position="right"
|
||||||
|
:model="state.form"
|
||||||
|
:rules="rule"
|
||||||
|
label-width="80px"
|
||||||
|
label-position="top"
|
||||||
|
>
|
||||||
|
<el-form-item label="上级区域" prop="pid">
|
||||||
|
<el-tree-select
|
||||||
|
class="map-tree-selector"
|
||||||
|
node-key="id"
|
||||||
|
v-model="state.form.pid"
|
||||||
|
:props="treeProps"
|
||||||
|
:data="props.treeData"
|
||||||
|
check-strictly
|
||||||
|
:render-after-expand="false"
|
||||||
|
:placeholder="t('common.please_select')"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="区域代码" prop="code">
|
||||||
|
<el-input v-model="state.form.code" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="区域名称" prop="name">
|
||||||
|
<el-input v-model="state.form.name" />
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<div class="geo-label-mask" />
|
||||||
|
<el-form-item label="坐标文件">
|
||||||
|
<el-upload
|
||||||
|
class="upload-geo"
|
||||||
|
action=""
|
||||||
|
accept=".json"
|
||||||
|
:on-exceed="handleExceed"
|
||||||
|
:before-upload="uploadValidate"
|
||||||
|
:on-error="handleError"
|
||||||
|
:show-file-list="false"
|
||||||
|
:http-request="setFile"
|
||||||
|
>
|
||||||
|
<el-input :placeholder="t('userimport.placeholder')" readonly v-model="fileName">
|
||||||
|
<template #suffix>
|
||||||
|
<el-icon>
|
||||||
|
<Icon name="icon_upload_outlined" />
|
||||||
|
</el-icon>
|
||||||
|
</template>
|
||||||
|
<template #prefix>
|
||||||
|
<el-icon v-if="!!fileName">
|
||||||
|
<Icon name="de-json" />
|
||||||
|
</el-icon>
|
||||||
|
</template>
|
||||||
|
</el-input>
|
||||||
|
</el-upload>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<span class="dialog-footer">
|
||||||
|
<el-button @click="resetForm(geoForm)">{{ t('common.cancel') }}</el-button>
|
||||||
|
<el-button type="primary" @click="submitForm(geoForm)">
|
||||||
|
{{ t('commons.save') }}
|
||||||
|
</el-button>
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-drawer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="less">
|
||||||
|
.map-tree-selector {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.geo-btn-container {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 33px;
|
||||||
|
right: 0px;
|
||||||
|
}
|
||||||
|
.upload-geo {
|
||||||
|
width: 100%;
|
||||||
|
height: 32px;
|
||||||
|
:deep(.ed-upload) {
|
||||||
|
width: 100% !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.geo-label-mask {
|
||||||
|
position: absolute;
|
||||||
|
width: calc(100% - 48px);
|
||||||
|
height: 30px;
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,5 @@
|
|||||||
|
export interface GeometryFrom {
|
||||||
|
pid?: string
|
||||||
|
code?: string
|
||||||
|
name?: string
|
||||||
|
}
|
@ -15,5 +15,5 @@ public class LarkInfoVO implements Serializable {
|
|||||||
|
|
||||||
private String callBack;
|
private String callBack;
|
||||||
|
|
||||||
private Boolean enable;
|
private Boolean enable = false;
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
package io.dataease.api.system;
|
package io.dataease.api.system;
|
||||||
|
|
||||||
import io.dataease.api.system.request.OnlineMapEditor;
|
import io.dataease.api.system.request.OnlineMapEditor;
|
||||||
|
import io.dataease.api.system.vo.SettingItemVO;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface SysParameterApi {
|
public interface SysParameterApi {
|
||||||
|
|
||||||
@GetMapping("/singleVal/{key}")
|
@GetMapping("/singleVal/{key}")
|
||||||
@ -17,4 +20,10 @@ public interface SysParameterApi {
|
|||||||
@GetMapping("/queryOnlineMap")
|
@GetMapping("/queryOnlineMap")
|
||||||
String queryOnlineMap();
|
String queryOnlineMap();
|
||||||
|
|
||||||
|
@GetMapping("basic/query")
|
||||||
|
List<SettingItemVO> queryBasicSetting();
|
||||||
|
|
||||||
|
@PostMapping("/basic/save")
|
||||||
|
void saveBasicSetting(@RequestBody List<SettingItemVO> settingItemVOS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
package io.dataease.api.system.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class SettingItemVO implements Serializable {
|
||||||
|
|
||||||
|
private String pkey;
|
||||||
|
|
||||||
|
private String pval;
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
private Integer sort;
|
||||||
|
}
|
@ -17,7 +17,7 @@ public class CorsConfig implements WebMvcConfigurer {
|
|||||||
@Resource(name = "deCorsInterceptor")
|
@Resource(name = "deCorsInterceptor")
|
||||||
private CorsInterceptor corsInterceptor;
|
private CorsInterceptor corsInterceptor;
|
||||||
|
|
||||||
@Value("#{'${dataease.origin-list}'.split(',')}")
|
@Value("#{'${dataease.origin-list:http://127.0.0.1:8100}'.split(',')}")
|
||||||
private List<String> originList;
|
private List<String> originList;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user