diff --git a/core/backend/src/main/java/io/dataease/auth/server/AuthServer.java b/core/backend/src/main/java/io/dataease/auth/server/AuthServer.java index 9f1b2b082a..3684ff8869 100644 --- a/core/backend/src/main/java/io/dataease/auth/server/AuthServer.java +++ b/core/backend/src/main/java/io/dataease/auth/server/AuthServer.java @@ -196,6 +196,11 @@ public class AuthServer implements AuthApi { } if (user.getIsAdmin() && user.getPassword().equals("40b8893ea9ebc2d631c4bb42bb1e8996")) { result.put("passwordModified", false); + result.put("defaultPwd", "dataease"); + } + if (!user.getIsAdmin() && user.getPassword().equals("83d923c9f1d8fcaa46cae0ed2aaa81b5")) { + result.put("passwordModified", false); + result.put("defaultPwd", DEFAULT_PWD); } } diff --git a/core/backend/src/main/java/io/dataease/controller/request/datasource/ApiDefinition.java b/core/backend/src/main/java/io/dataease/controller/request/datasource/ApiDefinition.java index 540081cefa..f786e37618 100644 --- a/core/backend/src/main/java/io/dataease/controller/request/datasource/ApiDefinition.java +++ b/core/backend/src/main/java/io/dataease/controller/request/datasource/ApiDefinition.java @@ -17,6 +17,7 @@ public class ApiDefinition { private List fields; private ApiDefinitionRequest request; private String dataPath; + private Integer queryTimeout; private String status; private List> data = new ArrayList<>(); private List jsonFields = new ArrayList<>(); diff --git a/core/backend/src/main/java/io/dataease/controller/sys/SysPluginController.java b/core/backend/src/main/java/io/dataease/controller/sys/SysPluginController.java index 782953a328..a3f81c0aeb 100644 --- a/core/backend/src/main/java/io/dataease/controller/sys/SysPluginController.java +++ b/core/backend/src/main/java/io/dataease/controller/sys/SysPluginController.java @@ -58,7 +58,7 @@ public class SysPluginController { @RequiresPermissions("plugin:upload") public Map update(@PathVariable("pluginId") Long pluginId, @RequestParam("file") MultipartFile file) throws Exception { DeFileUtils.validateFile(file); - if (pluginService.uninstall(pluginId)) { + if (pluginService.uninstallForUpdate(pluginId, true)) { return pluginService.localInstall(file); } return null; diff --git a/core/backend/src/main/java/io/dataease/provider/datasource/ApiProvider.java b/core/backend/src/main/java/io/dataease/provider/datasource/ApiProvider.java index b9478cb16e..31d26fce1c 100644 --- a/core/backend/src/main/java/io/dataease/provider/datasource/ApiProvider.java +++ b/core/backend/src/main/java/io/dataease/provider/datasource/ApiProvider.java @@ -37,14 +37,10 @@ public class ApiProvider extends Provider { private static String path = "['%s']"; - @Resource - private SystemParameterService systemParameterService; - @Override public List getData(DatasourceRequest datasourceRequest) throws Exception { - BasicInfo basicInfo = systemParameterService.basicInfo(); ApiDefinition apiDefinition = checkApiDefinition(datasourceRequest); - String response = execHttpRequest(apiDefinition, StringUtils.isNotBlank(basicInfo.getFrontTimeOut()) ? Integer.parseInt(basicInfo.getFrontTimeOut()) : 10); + String response = execHttpRequest(apiDefinition, apiDefinition.getQueryTimeout() == null || apiDefinition.getQueryTimeout()<=0 ? 30 : apiDefinition.getQueryTimeout()); return fetchResult(response, apiDefinition); } @@ -68,12 +64,11 @@ public class ApiProvider extends Provider { } public Map fetchResultAndField(DatasourceRequest datasourceRequest) throws Exception { - BasicInfo basicInfo = systemParameterService.basicInfo(); Map result = new HashMap<>(); List dataList = new ArrayList<>(); List fieldList = new ArrayList<>(); ApiDefinition apiDefinition = checkApiDefinition(datasourceRequest); - String response = execHttpRequest(apiDefinition, StringUtils.isNotBlank(basicInfo.getFrontTimeOut()) ? Integer.parseInt(basicInfo.getFrontTimeOut()) : 10); + String response = execHttpRequest(apiDefinition, apiDefinition.getQueryTimeout() == null || apiDefinition.getQueryTimeout()<=0 ? 30 : apiDefinition.getQueryTimeout()); fieldList = getTableFields(apiDefinition); result.put("fieldList", fieldList); diff --git a/core/backend/src/main/java/io/dataease/provider/engine/doris/DorisDDLProvider.java b/core/backend/src/main/java/io/dataease/provider/engine/doris/DorisDDLProvider.java index 374fa8460f..011eb80edc 100644 --- a/core/backend/src/main/java/io/dataease/provider/engine/doris/DorisDDLProvider.java +++ b/core/backend/src/main/java/io/dataease/provider/engine/doris/DorisDDLProvider.java @@ -73,7 +73,7 @@ public class DorisDDLProvider extends DDLProviderImpl { break; case 3: if(datasetTableField.getType().equalsIgnoreCase("DECIMAL") && datasetTableField.getAccuracy() != 0){ - Column_Fields.append("DECIMAL(" + datasetTableField.getSize() + "," + datasetTableField.getAccuracy() + ")").append(",`"); + Column_Fields.append("DecimalV3(" + datasetTableField.getSize() + "," + datasetTableField.getAccuracy() + ")").append(",`"); }else { Column_Fields.append("DOUBLE").append(",`"); } diff --git a/core/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java b/core/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java index 83e209f781..19586b83dc 100644 --- a/core/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java +++ b/core/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java @@ -218,9 +218,7 @@ public class DataSetTableService { excelSheetDataList.forEach(excelSheetData -> { String[] fieldArray = excelSheetData.getFields().stream().map(TableField::getFieldName) .toArray(String[]::new); - if (checkIsRepeat(fieldArray)) { - DataEaseException.throwException(Translator.get("i18n_excel_field_repeat")); - } + checkIsRepeat(fieldArray); excelSheetData.setData(null); excelSheetData.setJsonArray(null); }); @@ -254,9 +252,7 @@ public class DataSetTableService { for (ExcelSheetData sheet : datasetTable.getSheets()) { String[] fieldArray = sheet.getFields().stream().map(TableField::getFieldName) .toArray(String[]::new); - if (checkIsRepeat(fieldArray)) { - DataEaseException.throwException(Translator.get("i18n_excel_field_repeat")); - } + checkIsRepeat(fieldArray); } for (ExcelSheetData sheet : datasetTable.getSheets()) { @@ -304,9 +300,7 @@ public class DataSetTableService { } String[] fieldArray = sheet.getFields().stream().map(TableField::getFieldName).toArray(String[]::new); - if (checkIsRepeat(fieldArray)) { - DataEaseException.throwException(Translator.get("i18n_excel_field_repeat")); - } + checkIsRepeat(fieldArray); sheet.setData(null); sheet.setJsonArray(null); excelSheetDataList.add(sheet); @@ -1221,9 +1215,7 @@ public class DataSetTableService { List data = result.get("dataList"); List fields = result.get("fieldList"); String[] fieldArray = fields.stream().map(TableField::getFieldName).toArray(String[]::new); - if (checkIsRepeat(fieldArray)) { - DataEaseException.throwException(Translator.get("i18n_excel_field_repeat")); - } + checkIsRepeat(fieldArray); List> jsonArray = new ArrayList<>(); if (CollectionUtils.isNotEmpty(data)) { jsonArray = data.stream().map(ele -> { @@ -1305,9 +1297,7 @@ public class DataSetTableService { List data = result.get("dataList"); List fields = result.get("fieldList"); String[] fieldArray = fields.stream().map(TableField::getFieldName).toArray(String[]::new); - if (checkIsRepeat(fieldArray)) { - DataEaseException.throwException(Translator.get("i18n_excel_field_repeat")); - } + checkIsRepeat(fieldArray); List> jsonArray = new ArrayList<>(); if (CollectionUtils.isNotEmpty(data)) { jsonArray = data.stream().map(ele -> { @@ -2755,15 +2745,22 @@ public class DataSetTableService { /* * 判断数组中是否有重复的值 */ - public static boolean checkIsRepeat(String[] array) { + public static void checkIsRepeat(String[] array) { HashSet hashSet = new HashSet<>(); + HashSet repeat = new HashSet<>(); for (String s : array) { if (StringUtils.isEmpty(s)) { throw new RuntimeException(Translator.get("i18n_excel_empty_column")); } - hashSet.add(s); + if(hashSet.contains(s)){ + repeat.add(s); + }else { + hashSet.add(s); + } + } + if(CollectionUtils.isNotEmpty(repeat)){ + DataEaseException.throwException(Translator.get("i18n_excel_field_repeat") + ": " + String.valueOf(repeat)); } - return hashSet.size() != array.length; } public DatasetTable syncDatasetTableField(String id) throws Exception { diff --git a/core/backend/src/main/java/io/dataease/service/sys/PluginService.java b/core/backend/src/main/java/io/dataease/service/sys/PluginService.java index 9df89c03dc..f3589418d9 100644 --- a/core/backend/src/main/java/io/dataease/service/sys/PluginService.java +++ b/core/backend/src/main/java/io/dataease/service/sys/PluginService.java @@ -221,6 +221,10 @@ public class PluginService { * @return */ public Boolean uninstall(Long pluginId) { + return uninstallForUpdate(pluginId, false); + } + + public Boolean uninstallForUpdate(Long pluginId, boolean forUpdate) { MyPlugin myPlugin = myPluginMapper.selectByPrimaryKey(pluginId); if (ObjectUtils.isEmpty(myPlugin)) { String msg = "当前插件不存在"; @@ -232,7 +236,7 @@ public class PluginService { CacheUtils.removeAll(AuthConstants.USER_ROLE_CACHE_NAME); CacheUtils.removeAll(AuthConstants.USER_PERMISSION_CACHE_NAME); - if (myPlugin.getCategory().equalsIgnoreCase("datasource")) { + if (myPlugin.getCategory().equalsIgnoreCase("datasource") && !forUpdate) { if (CollectionUtils.isNotEmpty(datasourceService.selectByType(myPlugin.getDsType()))) { DEException.throwException(Translator.get("i18n_plugin_not_allow_delete")); } diff --git a/core/backend/src/main/resources/i18n/messages_en_US.properties b/core/backend/src/main/resources/i18n/messages_en_US.properties index 2aaf7f0b7e..0d5b36e213 100644 --- a/core/backend/src/main/resources/i18n/messages_en_US.properties +++ b/core/backend/src/main/resources/i18n/messages_en_US.properties @@ -92,7 +92,7 @@ i18n_sql_add_not_matching=The data column of incremental SQL does not match the i18n_sql_delete_not_matching=The data column of incremental delete SQL does not match the dataset, i18n_cst_ds_tb_or_field_deleted=Custom dataset union data is deleted or field changed,can not display i18n_no_all_delete_privilege_folder=This folder have sources which have no manage or view privilege,Can Not Be Deleted. -i18n_excel_field_repeat=Duplicate fields exist, please modify and try again. +i18n_excel_field_repeat=Duplicate fields exist: i18n_schema_is_empty=Database schema is empty \u7AD9\u5185\u6D88\u606F=Messages Center \u6240\u6709\u6D88\u606F=All Messages diff --git a/core/backend/src/main/resources/i18n/messages_zh_CN.properties b/core/backend/src/main/resources/i18n/messages_zh_CN.properties index b27d1036df..a31e8745dc 100644 --- a/core/backend/src/main/resources/i18n/messages_zh_CN.properties +++ b/core/backend/src/main/resources/i18n/messages_zh_CN.properties @@ -92,7 +92,7 @@ i18n_sql_add_not_matching=\u589E\u91CF\u6DFB\u52A0 SQL \u7684\u6570\u636E\u5217\ i18n_sql_delete_not_matching=\u589E\u91CF\u5220\u9664 SQL \u7684\u6570\u636E\u5217\u4E0E\u6570\u636E\u96C6\u4E0D\u5339\u914D, i18n_cst_ds_tb_or_field_deleted=\u81EA\u5B9A\u4E49\u6570\u636E\u96C6\u6240\u5173\u8054\u6570\u636E\u88AB\u5220\u9664\u6216\u5B57\u6BB5\u53D1\u751F\u53D8\u5316\uFF0C\u65E0\u6CD5\u6B63\u5E38\u663E\u793A i18n_no_all_delete_privilege_folder=\u8BE5\u76EE\u5F55\u4E0B\u5B58\u5728\u6CA1\u6709\u7BA1\u7406\u6743\u9650\u6216\u67E5\u770B\u6743\u9650\u7684\u8D44\u6E90\uFF0C\u65E0\u6CD5\u5220\u9664 -i18n_excel_field_repeat=\u5B58\u5728\u91CD\u590D\u5B57\u6BB5\uFF0C\u8BF7\u4FEE\u6539\u540E\u91CD\u8BD5 +i18n_excel_field_repeat=\u5b58\u5728\u91cd\u590d\u5b57\u6bb5\uff1a i18n_schema_is_empty=\u6570\u636E\u5E93 Schema \u4E3A\u7A7A \u7AD9\u5185\u6D88\u606F=\u6D88\u606F\u4E2D\u5FC3 \u6240\u6709\u6D88\u606F=\u6240\u6709\u6D88\u606F diff --git a/core/backend/src/main/resources/i18n/messages_zh_TW.properties b/core/backend/src/main/resources/i18n/messages_zh_TW.properties index 969fd1440a..e5b121220c 100644 --- a/core/backend/src/main/resources/i18n/messages_zh_TW.properties +++ b/core/backend/src/main/resources/i18n/messages_zh_TW.properties @@ -92,7 +92,7 @@ i18n_sql_add_not_matching=\u589E\u91CF\u6DFB\u52A0 sql \u7684\u6578\u64DA\u5217\ i18n_sql_delete_not_matching=\u589E\u91CF\u522A\u9664 sql \u7684\u6578\u64DA\u5217\u8207\u6578\u64DA\u96C6\u4E0D\u5339\u914D, i18n_cst_ds_tb_or_field_deleted=\u81EA\u5B9A\u7FA9\u6578\u64DA\u96C6\u6240\u95DC\u806F\u6578\u64DA\u88AB\u522A\u9664\u6216\u5B57\u6BB5\u767C\u751F\u8B8A\u5316\uFF0C\u7121\u6CD5\u6B63\u5E38\u986F\u793A i18n_no_all_delete_privilege_folder=\u8A72\u76EE\u9304\u4E0B\u5B58\u5728\u6C92\u6709\u7BA1\u7406\u6B0A\u9650\u6216\u67E5\u770B\u6B0A\u9650\u7684\u8CC7\u6E90\uFF0C\u7121\u6CD5\u522A\u9664 -i18n_excel_field_repeat=\u5B58\u5728\u91CD\u5FA9\u5B57\u6BB5\uFF0C\u8ACB\u4FEE\u6539\u5F8C\u91CD\u8BD5 +i18n_excel_field_repeat=\u5b58\u5728\u91cd\u5fa9\u5b57\u6bb5\uff1a i18n_schema_is_empty=\u6578\u64DA\u5EAB Schema \u70BA\u7A7A \u7AD9\u5185\u6D88\u606F=\u6D88\u606F\u4E2D\u5FC3 \u6240\u6709\u6D88\u606F=\u6240\u6709\u6D88\u606F diff --git a/core/frontend/src/App.vue b/core/frontend/src/App.vue index 380888af6b..40f3077521 100644 --- a/core/frontend/src/App.vue +++ b/core/frontend/src/App.vue @@ -13,7 +13,7 @@ :title="$t('user.change_password')" :show-close="false" > - + @@ -28,7 +28,8 @@ export default { components: { PluginCom, PasswordUpdateForm }, data() { return { - showPasswordModifiedDialog: false + showPasswordModifiedDialog: false, + defaultPwd: 'dataease' } }, computed: { @@ -46,6 +47,7 @@ export default { }, mounted() { const passwordModified = JSON.parse(localStorage.getItem('passwordModified')) + this.defaultPwd = localStorage.getItem('defaultPwd') if (typeof passwordModified === 'boolean') { this.$store.commit('user/SET_PASSWORD_MODIFIED', passwordModified) } diff --git a/core/frontend/src/components/canvas/components/editor/ComponentWrapper.vue b/core/frontend/src/components/canvas/components/editor/ComponentWrapper.vue index 828ee49abe..dd39680fed 100644 --- a/core/frontend/src/components/canvas/components/editor/ComponentWrapper.vue +++ b/core/frontend/src/components/canvas/components/editor/ComponentWrapper.vue @@ -48,6 +48,7 @@ :h="config.style.height" :search-count="searchCount" :canvas-id="canvasId" + @filter-loaded="filterLoaded" /> { diff --git a/core/frontend/src/components/canvas/components/editor/Preview.vue b/core/frontend/src/components/canvas/components/editor/Preview.vue index aa4edd1aa2..357c632813 100644 --- a/core/frontend/src/components/canvas/components/editor/Preview.vue +++ b/core/frontend/src/components/canvas/components/editor/Preview.vue @@ -59,6 +59,7 @@ :screen-shot="screenShot" :canvas-style-data="canvasStyleData" :show-position="showPosition" + @filter-loaded="filterLoaded" /> @@ -155,7 +156,7 @@ import eventBus from '@/components/canvas/utils/eventBus' import elementResizeDetectorMaker from 'element-resize-detector' import CanvasOptBar from '@/components/canvas/components/editor/CanvasOptBar' import bus from '@/utils/bus' -import { buildFilterMap, buildViewKeyMap, formatCondition, valueValid, viewIdMatch } from '@/utils/conditionUtil' +import { buildFilterMap, buildViewKeyMap, formatCondition, valueValid, viewIdMatch, buildAfterFilterLoaded } from '@/utils/conditionUtil' import { hasDataPermission } from '@/utils/permission' import { activeWatermark } from '@/components/canvas/tools/watermark' import { proxyUserLoginInfo, userLoginInfo } from '@/api/systemInfo/userLogin' @@ -461,6 +462,9 @@ export default { bus.$off('trigger-reset-button', this.triggerResetButton) }, methods: { + filterLoaded(p) { + buildAfterFilterLoaded(this.filterMap, p) + }, getWrapperChildRefs() { return this.$refs['viewWrapperChild'] }, @@ -589,7 +593,10 @@ export default { } param = wrapperChild.getCondition && wrapperChild.getCondition() const condition = formatCondition(param) - const vValid = valueValid(condition) + let vValid = valueValid(condition) + const required = element.options.attrs.required + condition.requiredInvalid = required && !vValid + vValid = vValid || required const filterComponentId = condition.componentId const conditionCanvasId = wrapperChild.getCanvasId && wrapperChild.getCanvasId() Object.keys(result).forEach(viewId => { diff --git a/core/frontend/src/components/canvas/components/editor/SettingMenu.vue b/core/frontend/src/components/canvas/components/editor/SettingMenu.vue index 7b06044173..2b7a96923f 100644 --- a/core/frontend/src/components/canvas/components/editor/SettingMenu.vue +++ b/core/frontend/src/components/canvas/components/editor/SettingMenu.vue @@ -220,13 +220,11 @@ export default { }, linkJumpSetShow() { return this.curComponent.type === 'view' && - !this.jumpExcludeViewType.includes(this.curComponent.propValue.innerType) && - !(this.curComponent.propValue.innerType?.includes('table') && this.curComponent.propValue.render === 'echarts') + !this.jumpExcludeViewType.includes(this.curComponent.propValue.innerType) }, linkageSettingShow() { return this.curComponent.type === 'view' && - !this.linkageExcludeViewType.includes(this.curComponent.propValue.innerType) && - !(this.curComponent.propValue.innerType?.includes('table') && this.curComponent.propValue.render === 'echarts') + !this.linkageExcludeViewType.includes(this.curComponent.propValue.innerType) }, panelInfo() { return this.$store.state.panel.panelInfo diff --git a/core/frontend/src/components/canvas/customComponent/UserView.vue b/core/frontend/src/components/canvas/customComponent/UserView.vue index 28b88e8b10..2b07d4daba 100644 --- a/core/frontend/src/components/canvas/customComponent/UserView.vue +++ b/core/frontend/src/components/canvas/customComponent/UserView.vue @@ -28,8 +28,18 @@ {{ $t('chart.chart_error_tips') }} +
+
+ {{ view.unReadyMsg }},{{ $t('chart.chart_show_error') }} +
+ {{ $t('chart.chart_error_tips') }} +
+
f instanceof Promise)).then(fList => { + this.filter.filter = readyList.concat(fList) + this.getData(this.element.propValue.viewId, false) + }) + return + } this.getData(this.element.propValue.viewId, false) } }, methods: { + groupFilter(filters) { + const result = { + ready: [], + unReady: [] + } + filters.forEach(f => { + if (f instanceof Promise) { + result.unReady.push(f) + } else { + result.ready.push(f) + } + }) + return result + }, + groupRequiredInvalid(filters) { + const result = { + ready: [], + unReady: [] + } + filters.forEach(f => { + if (f.requiredInvalid) { + result.unReady.push(f) + } else { + result.ready.push(f) + } + }) + return result + }, equalsAny, tabSwitch(tabCanvasId) { if (this.charViewS2ShowFlag && tabCanvasId === this.canvasId && this.$refs[this.element.propValue.id]) { @@ -734,7 +783,7 @@ export default { clearPanelLinkage(param) { if (param.viewId === 'all' || param.viewId === this.element.propValue.viewId) { try { - this.$refs[this.element.propValue.id]?.reDrawView() + this.$refs[this.element.propValue.id]?.reDrawView?.() } catch (e) { console.error('reDrawView-error:', this.element.propValue.id) } @@ -773,6 +822,15 @@ export default { }, getData(id, cache = true, dataBroadcast = false) { if (id) { + const filters = this.filter.filter + const group = this.groupRequiredInvalid(filters) + if (group.unReady?.length) { + this.view.unReadyMsg = '请先完成必填项过滤器!' + this.getDataLoading = false + return + } else { + this.view.unReadyMsg = '' + } if (this.getDataLoading || Vue.prototype.$currentHttpRequestList.get(`/chart/view/getData/${id}/${this.panelInfo.id}`)) { const url = `/chart/view/getData/${id}/${this.panelInfo.id}` Vue.prototype.$cancelRequest(url) @@ -794,6 +852,7 @@ export default { if (!token && linkToken) { method = viewInfo } + const requestInfo = { ...this.filter, cache: cache, diff --git a/core/frontend/src/components/dataease/DeOutWidget.vue b/core/frontend/src/components/dataease/DeOutWidget.vue index 6daf889bd6..d68712a26c 100644 --- a/core/frontend/src/components/dataease/DeOutWidget.vue +++ b/core/frontend/src/components/dataease/DeOutWidget.vue @@ -26,9 +26,12 @@
-
+
+
+ * +
@@ -180,6 +190,9 @@ export default { this.$set(this.element.style, 'innerBgColor', innerBgColor || '') }, methods: { + filterLoaded(p) { + this.$emit('filter-loaded', p) + }, getComponentId() { return this.element.id }, @@ -266,6 +279,16 @@ export default { overflow: auto hidden; letter-spacing: 0px !important; width: 100%; + .widget-required { + width: calc(100% - 10px) !important; + float: left !important; + } + .widget-required-symbol { + color: #f54a45; + height: 40px; + line-height: 40px; + float: right; + } } .condition-content-container { diff --git a/core/frontend/src/components/dataeaseTabs/index.vue b/core/frontend/src/components/dataeaseTabs/index.vue index 3fd408fb59..fa732ec6bf 100644 --- a/core/frontend/src/components/dataeaseTabs/index.vue +++ b/core/frontend/src/components/dataeaseTabs/index.vue @@ -14,7 +14,7 @@ export default { name: 'DataeaseTabs', props: { - + hideTitle: Boolean, fontColor: String, activeColor: String, borderColor: String, @@ -43,7 +43,8 @@ export default { this.fontColor && 'fontColor', this.activeColor && 'activeColor', this.noBorder ? 'noBorder' : this.borderColor && 'borderColor', - this.borderActiveColor && 'borderActiveColor' + this.borderActiveColor && 'borderActiveColor', + this.hideTitle && 'no-header' ] return classes }, diff --git a/core/frontend/src/components/elVisualSelect/index.vue b/core/frontend/src/components/elVisualSelect/index.vue index d30a355ab0..9778792549 100644 --- a/core/frontend/src/components/elVisualSelect/index.vue +++ b/core/frontend/src/components/elVisualSelect/index.vue @@ -7,14 +7,14 @@ popper-class="VisualSelects coustom-de-select" no-match-text=" " reserve-keyword - clearable + :clearable="clearable" v-bind="$attrs" v-on="$listeners" @change="visualChange" @visible-change="popChange" >

{{ item.text }} @@ -76,6 +77,14 @@ export default { keyWord: { type: String, default: '' + }, + itemDisabled: { + type: Boolean, + default: false + }, + clearable: { + type: Boolean, + default: true } }, data() { diff --git a/core/frontend/src/components/widget/bean/Condition.js b/core/frontend/src/components/widget/bean/Condition.js index bf5ca5f799..5b73e602f0 100644 --- a/core/frontend/src/components/widget/bean/Condition.js +++ b/core/frontend/src/components/widget/bean/Condition.js @@ -13,5 +13,6 @@ export class Condition { this.viewIds = viewIds this.parameters = parameters this.isTree = isTree || false + this.requiredInvalid = false } } diff --git a/core/frontend/src/components/widget/deWidget/DeDate.vue b/core/frontend/src/components/widget/deWidget/DeDate.vue index 86082f1363..ff355563cc 100644 --- a/core/frontend/src/components/widget/deWidget/DeDate.vue +++ b/core/frontend/src/components/widget/deWidget/DeDate.vue @@ -226,7 +226,11 @@ export default { }, watch: { - + 'values': function(val, old) { + if (!this.inDraw) { + this.$emit('widget-value-changed', val) + } + }, 'viewIds': function(value, old) { if (typeof value === 'undefined' || value === old) return this.setCondition() diff --git a/core/frontend/src/components/widget/deWidget/DeInputSearch.vue b/core/frontend/src/components/widget/deWidget/DeInputSearch.vue index e54b9e554e..f2becf0ad6 100644 --- a/core/frontend/src/components/widget/deWidget/DeInputSearch.vue +++ b/core/frontend/src/components/widget/deWidget/DeInputSearch.vue @@ -66,6 +66,11 @@ export default { } }, watch: { + 'value': function(val, old) { + if (!this.inDraw) { + this.$emit('widget-value-changed', val) + } + }, 'viewIds': function(value, old) { if (typeof value === 'undefined' || value === old) return this.setCondition() diff --git a/core/frontend/src/components/widget/deWidget/DeNumberRange.vue b/core/frontend/src/components/widget/deWidget/DeNumberRange.vue index c4ef17d931..beb9410fdf 100644 --- a/core/frontend/src/components/widget/deWidget/DeNumberRange.vue +++ b/core/frontend/src/components/widget/deWidget/DeNumberRange.vue @@ -105,6 +105,16 @@ export default { } }, watch: { + 'form.min': function(val, old) { + if (!this.inDraw) { + this.$emit('widget-value-changed', val) + } + }, + 'form.max': function(val, old) { + if (!this.inDraw) { + this.$emit('widget-value-changed', val) + } + }, 'viewIds': function(value, old) { if (typeof value === 'undefined' || value === old) return this.setCondition() diff --git a/core/frontend/src/components/widget/deWidget/DeSelect.vue b/core/frontend/src/components/widget/deWidget/DeSelect.vue index 848aa4b2d3..2d5020a517 100644 --- a/core/frontend/src/components/widget/deWidget/DeSelect.vue +++ b/core/frontend/src/components/widget/deWidget/DeSelect.vue @@ -6,15 +6,17 @@ v-model="value" :class-id="'visual-' + element.id + '-' + inDraw + '-' + inScreen" :collapse-tags="showNumber" - :clearable="!element.options.attrs.multiple" + :clearable="!element.options.attrs.multiple && (inDraw || !selectFirst)" :multiple="element.options.attrs.multiple" :placeholder="$t(element.options.attrs.placeholder) + placeholderSuffix" :popper-append-to-body="inScreen" :size="size" - :filterable="true" + :filterable="inDraw || !selectFirst" :filter-method="filterMethod" + :item-disabled="!inDraw && selectFirst" :key-word="keyWord" popper-class="coustom-de-select" + :class="{'disabled-close': !inDraw && selectFirst && element.options.attrs.multiple}" :list="data" :is-config="isConfig" :custom-style="customStyle" @@ -31,6 +33,7 @@ :style="{width:selectOptionWidth}" :label="item[element.options.attrs.label]" :value="item[element.options.attrs.value]" + :disabled="!inDraw && selectFirst" > 0 && method(param).then(res => { this.data = this.optionData(res.data) + this.clearDefault(this.data) + this.fillFirstValue() bus.$emit('valid-values-change', true) }).catch(e => { bus.$emit('valid-values-change', false) }) || (this.element.options.value = '') }, + 'selectFirst': function(value, old) { + if (value === old) return + if (value) { + this.fillFirstValue() + } else { + this.value = '' + this.firstChange(this.value) + } + }, 'element.options.attrs.multiple': function(value, old) { if (typeof old === 'undefined' || value === old) return if (!this.inDraw) { @@ -179,6 +202,7 @@ export default { this.show = false this.$nextTick(() => { + this.fillFirstValue() this.show = true this.handleCoustomStyle() }) @@ -195,6 +219,9 @@ export default { if (!token && linkToken) { method = linkMultFieldValues } + if (!this.element.options.attrs.fieldId) { + return + } const param = { fieldIds: this.element.options.attrs.fieldId.split(this.separator), sort: this.element.options.attrs.sort } if (this.panelInfo.proxy) { param.userId = this.panelInfo.proxy @@ -204,6 +231,7 @@ export default { method(param).then(res => { this.data = this.optionData(res.data) this.$nextTick(() => { + this.fillFirstValue() this.show = true this.handleCoustomStyle() }) @@ -271,6 +299,11 @@ export default { }, resetDefaultValue(id) { if (this.inDraw && this.manualModify && this.element.id === id) { + if (this.selectFirst) { + this.fillFirstValue() + this.firstChange(this.value) + return + } this.value = this.fillValueDerfault() this.changeValue(this.value) } @@ -285,17 +318,26 @@ export default { }, 500) }, initLoad() { - this.value = this.fillValueDerfault() - this.initOptions() - if (this.element.options.value) { + // this.value = this.fillValueDerfault() + this.initOptions(this.fillFirstSelected) + if (this.element.options.value && !this.selectFirst) { this.value = this.fillValueDerfault() this.changeValue(this.value) } }, + fillFirstSelected() { + if (this.selectFirst && this.data?.length) { + this.fillFirstValue() + this.$emit('filter-loaded', { + componentId: this.element.id, + val: (this.value && Array.isArray(this.value)) ? this.value.join(',') : this.value + }) + } + }, refreshLoad() { this.initOptions() }, - initOptions() { + initOptions(cb) { this.data = [] if (this.element.options.attrs.fieldId) { let method = multFieldValues @@ -310,6 +352,7 @@ export default { }).then(res => { this.data = this.optionData(res.data) bus.$emit('valid-values-change', true) + cb && cb() }).catch(e => { bus.$emit('valid-values-change', false) }) @@ -338,6 +381,10 @@ export default { this.setCondition() this.handleShowNumber() }, + firstChange(value) { + this.setCondition() + this.handleShowNumber() + }, handleShowNumber() { this.showNumber = false @@ -377,6 +424,20 @@ export default { } return this.value.split(',') }, + fillFirstValue() { + if (!this.selectFirst) { + return + } + const defaultV = this.data[0].id + if (this.element.options.attrs.multiple) { + if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV === '[object Object]') return [] + this.value = defaultV.split(this.separator) + } else { + if (defaultV === null || typeof defaultV === 'undefined' || defaultV === '' || defaultV === '[object Object]') return null + this.value = defaultV.split(this.separator)[0] + } + this.firstChange(this.value) + }, fillValueDerfault() { const defaultV = this.element.options.value === null ? '' : this.element.options.value.toString() if (this.element.options.attrs.multiple) { @@ -415,13 +476,15 @@ export default { } + diff --git a/core/frontend/src/views/panel/filter/filterMain/FilterHead.vue b/core/frontend/src/views/panel/filter/filterMain/FilterHead.vue index 38181d2511..925c67809b 100644 --- a/core/frontend/src/views/panel/filter/filterMain/FilterHead.vue +++ b/core/frontend/src/views/panel/filter/filterMain/FilterHead.vue @@ -1,6 +1,6 @@ @@ -71,10 +79,12 @@ export default { }, methods: { + requiredChange(val) { + this.$emit('required-change', val) + }, getTableName(tableId) { let tableName = null this.$emit('dataset-name', tableId, t => { tableName = t }) - console.log(tableName) return tableName }, onMove(e, originalEvent) { @@ -95,6 +105,11 @@ export default {