Merge branch 'dev-v2' into pr@dev-v2@feat_traffic
This commit is contained in:
commit
91f1b862ff
@ -16,6 +16,7 @@ export interface EnumValue {
|
||||
displayId?: string
|
||||
sortId?: string
|
||||
sort?: string
|
||||
resultMode?: number
|
||||
searchText: string
|
||||
filter?: Array<{}>
|
||||
}
|
||||
|
||||
@ -423,7 +423,17 @@ const queryData = () => {
|
||||
requiredName = next.name
|
||||
}
|
||||
|
||||
if (
|
||||
if (next.displayType === '8') {
|
||||
const { conditionValueF, conditionValueS, conditionType } = next
|
||||
if (conditionType === 0) {
|
||||
requiredName = conditionValueF === '' ? next.name : ''
|
||||
} else {
|
||||
requiredName = [conditionValueF || '', conditionValueS || ''].filter(ele => ele !== '')
|
||||
.length
|
||||
? next.name
|
||||
: ''
|
||||
}
|
||||
} else if (
|
||||
(Array.isArray(next.selectValue) && !next.selectValue.length) ||
|
||||
(next.selectValue !== 0 && !next.selectValue)
|
||||
) {
|
||||
|
||||
@ -922,6 +922,7 @@ const parameterCompletion = () => {
|
||||
conditionValueF: '',
|
||||
conditionValueOperatorS: 'like',
|
||||
conditionValueS: '',
|
||||
resultMode: 0,
|
||||
defaultConditionValueOperatorF: 'eq',
|
||||
defaultConditionValueF: '',
|
||||
defaultConditionValueOperatorS: 'like',
|
||||
@ -1850,6 +1851,13 @@ defineExpose({
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="label">选项值数量</div>
|
||||
<div class="value">
|
||||
<el-radio-group v-model="curComponent.resultMode">
|
||||
<el-radio :label="0">默认</el-radio>
|
||||
<el-radio :label="1">全部</el-radio>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list-item top-item" v-if="curComponent.displayType === '8'">
|
||||
<div class="label">条件类型</div>
|
||||
|
||||
@ -25,6 +25,7 @@ interface SelectConfig {
|
||||
displayType: string
|
||||
showEmpty: boolean
|
||||
id: string
|
||||
resultMode: number
|
||||
displayId: string
|
||||
sort: string
|
||||
sortId: string
|
||||
@ -50,6 +51,7 @@ const props = defineProps({
|
||||
default: () => {
|
||||
return {
|
||||
selectValue: '',
|
||||
resultMode: 0,
|
||||
defaultValue: '',
|
||||
displayType: '',
|
||||
defaultValueCheck: false,
|
||||
@ -219,7 +221,10 @@ const displayTypeChange = () => {
|
||||
|
||||
const handleFieldIdDefaultChange = (val: string[]) => {
|
||||
loading.value = true
|
||||
getEnumValue(val)
|
||||
getEnumValue({
|
||||
fieldIds: val,
|
||||
resultMode: config.value.resultMode || 0
|
||||
})
|
||||
.then(res => {
|
||||
options.value = (res || [])
|
||||
.filter(ele => ele !== null)
|
||||
@ -501,6 +506,7 @@ const setOptions = (num: number) => {
|
||||
displayId: displayId || field.id,
|
||||
sort,
|
||||
sortId,
|
||||
resultMode: config.value.resultMode || 0,
|
||||
searchText: searchText.value,
|
||||
filter: getCascadeFieldId()
|
||||
})
|
||||
|
||||
@ -16,6 +16,7 @@ interface SelectConfig {
|
||||
selectValue: any
|
||||
defaultMapValue: any
|
||||
defaultValue: any
|
||||
resultMode: number
|
||||
checkedFieldsMap: object
|
||||
displayType: string
|
||||
id: string
|
||||
@ -39,6 +40,7 @@ const props = defineProps({
|
||||
selectValue: '',
|
||||
defaultValue: '',
|
||||
displayType: '',
|
||||
resultMode: 0,
|
||||
defaultValueCheck: false,
|
||||
multiple: false,
|
||||
checkedFieldsMap: {},
|
||||
@ -176,7 +178,10 @@ const loading = ref(false)
|
||||
|
||||
const getTreeOption = debounce(() => {
|
||||
loading.value = true
|
||||
getFieldTree(props.config.treeFieldList.map(ele => ele.id))
|
||||
getFieldTree({
|
||||
fieldIds: props.config.treeFieldList.map(ele => ele.id),
|
||||
resultMode: config.value.resultMode || 0
|
||||
})
|
||||
.then(res => {
|
||||
treeOptionList.value = dfs(res)
|
||||
})
|
||||
|
||||
@ -135,6 +135,25 @@ const getDatasourceTypes = () => {
|
||||
})
|
||||
}
|
||||
getDatasourceTypes()
|
||||
const loadDsPlugin = data => {
|
||||
data.forEach(item => {
|
||||
const { name, category, type, icon, extraParams, staticMap } = item
|
||||
const node = {
|
||||
name,
|
||||
category,
|
||||
type,
|
||||
icon,
|
||||
extraParams,
|
||||
isPlugin: true,
|
||||
staticMap
|
||||
}
|
||||
|
||||
const index = typeList.findIndex(ele => ele === node.catalog)
|
||||
if (index !== -1) {
|
||||
databaseList[index].push(node)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const getLatestUseTypes = () => {
|
||||
latestUse({}).then(res => {
|
||||
@ -726,6 +745,10 @@ defineExpose({
|
||||
@finish="complete"
|
||||
ref="creatDsFolder"
|
||||
></creat-ds-group>
|
||||
<XpackComponent
|
||||
jsname="L2NvbXBvbmVudC9wbHVnaW5zLWhhbmRsZXIvRHNDYXRlZ29yeUhhbmRsZXI="
|
||||
@load-ds-plugin="loadDsPlugin"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<style lang="less">
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package io.dataease.api.xpack.component;
|
||||
|
||||
import io.dataease.api.xpack.component.vo.XpackMenuVO;
|
||||
import io.dataease.extensions.datasource.vo.XpackPluginsDatasourceVO;
|
||||
import io.dataease.extensions.view.vo.XpackPluginsViewVO;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
@ -21,6 +22,9 @@ public interface XpackComponentApi {
|
||||
@GetMapping("/viewPlugins")
|
||||
List<XpackPluginsViewVO> viewPlugins();
|
||||
|
||||
@GetMapping("/dsPlugins")
|
||||
List<XpackPluginsDatasourceVO> dsPlugins();
|
||||
|
||||
@GetMapping("/pluginStaticInfo/{moduleName}")
|
||||
void pluginStaticInfo(@PathVariable("moduleName") String moduleName);
|
||||
}
|
||||
|
||||
@ -1,11 +1,19 @@
|
||||
package io.dataease.extensions.datasource.factory;
|
||||
|
||||
import io.dataease.exception.DEException;
|
||||
import io.dataease.extensions.datasource.plugin.DataEaseDatasourcePlugin;
|
||||
import io.dataease.extensions.datasource.provider.Provider;
|
||||
import io.dataease.extensions.datasource.utils.SpringContextUtil;
|
||||
import io.dataease.extensions.datasource.vo.DatasourceConfiguration;
|
||||
import io.dataease.extensions.datasource.vo.XpackPluginsDatasourceVO;
|
||||
import io.dataease.license.utils.LicenseUtil;
|
||||
import io.dataease.license.utils.LogUtil;
|
||||
import io.dataease.plugins.factory.DataEasePluginFactory;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* @Author Junjun
|
||||
@ -17,11 +25,38 @@ public class ProviderFactory {
|
||||
if (list.contains(type)) {
|
||||
return SpringContextUtil.getApplicationContext().getBean("calciteProvider", Provider.class);
|
||||
}
|
||||
return SpringContextUtil.getApplicationContext().getBean(type + "DsProvider", Provider.class);
|
||||
return getInstance(type);
|
||||
}
|
||||
|
||||
public static Provider getDefaultProvider() {
|
||||
return SpringContextUtil.getApplicationContext().getBean("calciteProvider", Provider.class);
|
||||
}
|
||||
|
||||
|
||||
private static final Map<String, DataEaseDatasourcePlugin> templateMap = new ConcurrentHashMap<>();
|
||||
|
||||
public static Provider getInstance(String type) {
|
||||
if (!LicenseUtil.licenseValid()) DEException.throwException("插件功能只对企业版本可用!");
|
||||
String key = type;
|
||||
return templateMap.get(key);
|
||||
}
|
||||
|
||||
public static void loadPlugin(String type, DataEaseDatasourcePlugin plugin) {
|
||||
if (!LicenseUtil.licenseValid()) DEException.throwException("插件功能只对企业版本可用!");
|
||||
String key = type;
|
||||
if (templateMap.containsKey(key)) return;
|
||||
templateMap.put(key, plugin);
|
||||
try {
|
||||
String moduleName = plugin.getPluginInfo().getModuleName();
|
||||
DataEasePluginFactory.loadTemplate(moduleName, plugin);
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e.getMessage(), new Throwable(e));
|
||||
DEException.throwException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static List<XpackPluginsDatasourceVO> getDsConfigList() {
|
||||
if (!LicenseUtil.licenseValid()) DEException.throwException("插件功能只对企业版本可用!");
|
||||
return templateMap.values().stream().map(DataEaseDatasourcePlugin::getConfig).toList();
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
package io.dataease.extensions.datasource.plugin;
|
||||
|
||||
import io.dataease.exception.DEException;
|
||||
import io.dataease.extensions.datasource.factory.ProviderFactory;
|
||||
import io.dataease.extensions.datasource.provider.Provider;
|
||||
import io.dataease.extensions.datasource.vo.XpackPluginsDatasourceVO;
|
||||
import io.dataease.license.utils.JsonUtil;
|
||||
import io.dataease.plugins.template.DataEasePlugin;
|
||||
import io.dataease.plugins.vo.DataEasePluginVO;
|
||||
|
||||
/**
|
||||
* @Author Junjun
|
||||
*/
|
||||
public abstract class DataEaseDatasourcePlugin extends Provider implements DataEasePlugin {
|
||||
@Override
|
||||
public void loadPlugin() {
|
||||
XpackPluginsDatasourceVO datasourceConfig = getConfig();
|
||||
ProviderFactory.loadPlugin(datasourceConfig.getType(), this);
|
||||
}
|
||||
|
||||
public XpackPluginsDatasourceVO getConfig() {
|
||||
DataEasePluginVO pluginInfo = null;
|
||||
try {
|
||||
pluginInfo = getPluginInfo();
|
||||
} catch (Exception e) {
|
||||
DEException.throwException(e);
|
||||
}
|
||||
String config = pluginInfo.getConfig();
|
||||
XpackPluginsDatasourceVO vo = JsonUtil.parseObject(config, XpackPluginsDatasourceVO.class);
|
||||
vo.setIcon(pluginInfo.getIcon());
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package io.dataease.extensions.datasource.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class XpackPluginsDatasourceVO implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String icon;
|
||||
|
||||
private String category;
|
||||
|
||||
private String type;
|
||||
|
||||
private String extraParams;
|
||||
|
||||
private Map<String, String> staticMap;
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user