From 3be575c98e450136f3b01f5d9caffbcaf393cb07 Mon Sep 17 00:00:00 2001 From: turc Date: Wed, 5 Jan 2022 13:36:15 +0800 Subject: [PATCH 01/16] =?UTF-8?q?fix:=20=E6=95=B0=E6=8D=AE=E6=BA=90?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E4=B8=BAoracle=E6=97=B6=E5=80=99=E4=B8=8D?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=AD=97=E6=AE=B5=E6=B3=A8=E9=87=8A=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/dataease/provider/datasource/JdbcProvider.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/src/main/java/io/dataease/provider/datasource/JdbcProvider.java b/backend/src/main/java/io/dataease/provider/datasource/JdbcProvider.java index df88db99c1..48a2af205f 100644 --- a/backend/src/main/java/io/dataease/provider/datasource/JdbcProvider.java +++ b/backend/src/main/java/io/dataease/provider/datasource/JdbcProvider.java @@ -2,6 +2,7 @@ package io.dataease.provider.datasource; import com.alibaba.druid.filter.Filter; import com.alibaba.druid.pool.DruidDataSource; +import com.alibaba.druid.pool.DruidPooledConnection; import com.alibaba.druid.wall.WallFilter; import com.google.gson.Gson; import io.dataease.commons.constants.DatasourceTypes; @@ -18,6 +19,7 @@ import javax.annotation.PostConstruct; import java.beans.PropertyVetoException; import java.io.File; import java.io.IOException; +import java.lang.reflect.Method; import java.net.URL; import java.sql.*; import java.util.*; @@ -143,6 +145,10 @@ public class JdbcProvider extends DatasourceProvider { } List list = new LinkedList<>(); try (Connection connection = getConnectionFromPool(datasourceRequest)) { + if (datasourceRequest.getDatasource().getType().equalsIgnoreCase("oracle")) { + Method setRemarksReporting = extendedJdbcClassLoader.loadClass("oracle.jdbc.driver.OracleConnection").getMethod("setRemarksReporting",boolean.class); + setRemarksReporting.invoke(((DruidPooledConnection) connection).getConnection(), true); + } DatabaseMetaData databaseMetaData = connection.getMetaData(); ResultSet resultSet = databaseMetaData.getColumns(null, "%", datasourceRequest.getTable(), "%"); while (resultSet.next()) { From dc4c9ca3ac6aef05fef47106907ab15bdafa681b Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Fri, 7 Jan 2022 14:14:22 +0800 Subject: [PATCH 02/16] =?UTF-8?q?fix:=20=E5=8A=A8=E6=80=81=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/widget/serviceImpl/TimeDateServiceImpl.js | 6 ++---- .../views/panel/filter/defaultValue/DeDateDefault.vue | 9 +++++++-- .../src/views/panel/filter/filterMain/FilterFoot.vue | 2 ++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/widget/serviceImpl/TimeDateServiceImpl.js b/frontend/src/components/widget/serviceImpl/TimeDateServiceImpl.js index 98bfcc7af6..1a9e0c6deb 100644 --- a/frontend/src/components/widget/serviceImpl/TimeDateServiceImpl.js +++ b/frontend/src/components/widget/serviceImpl/TimeDateServiceImpl.js @@ -114,10 +114,8 @@ class TimeDateServiceImpl extends WidgetService { const tarYear = nowYear if (dynamicSuffix === 'before') { const deffMonth = nowMonth - dynamicPrefix - let diffYear = deffMonth / 12 - if (deffMonth < 0) { - diffYear -= 1 - } + const diffYear = Math.floor(deffMonth / 12) + return new Date(tarYear + diffYear, nowMonth - dynamicPrefix % 12, nowDate).getTime() } else { const deffMonth = nowMonth + dynamicPrefix diff --git a/frontend/src/views/panel/filter/defaultValue/DeDateDefault.vue b/frontend/src/views/panel/filter/defaultValue/DeDateDefault.vue index f6ce1acaa3..06ea0b0cd0 100644 --- a/frontend/src/views/panel/filter/defaultValue/DeDateDefault.vue +++ b/frontend/src/views/panel/filter/defaultValue/DeDateDefault.vue @@ -1,5 +1,5 @@ diff --git a/frontend/src/views/panel/filter/defaultValue/DeDateRangeDefault.vue b/frontend/src/views/panel/filter/defaultValue/DeDateRangeDefault.vue index f0b707259b..9241ed82c2 100644 --- a/frontend/src/views/panel/filter/defaultValue/DeDateRangeDefault.vue +++ b/frontend/src/views/panel/filter/defaultValue/DeDateRangeDefault.vue @@ -223,21 +223,20 @@ export default { .inline-first, .inline { display: flex; - - >>>.el-input--mini { - min-width: 70px; - } - } .inline-first { .el-form-item { margin-bottom: 5px !important; + + .el-form-item__content>.el-input--mini { + min-width: 70px; + } } } .relative-time { - width: 100%; + width: 100% !important; } From d424e1540075f5271f5297cc1908c1a416bb49be Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Mon, 10 Jan 2022 15:28:33 +0800 Subject: [PATCH 06/16] =?UTF-8?q?fix:=20=E5=A4=9A=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=9E=9A=E4=B8=BENPE=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataset/DataSetTableFieldController.java | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/backend/src/main/java/io/dataease/controller/dataset/DataSetTableFieldController.java b/backend/src/main/java/io/dataease/controller/dataset/DataSetTableFieldController.java index 3b72309c60..7d66eac976 100644 --- a/backend/src/main/java/io/dataease/controller/dataset/DataSetTableFieldController.java +++ b/backend/src/main/java/io/dataease/controller/dataset/DataSetTableFieldController.java @@ -23,6 +23,8 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; +import cn.hutool.core.collection.CollectionUtil; + import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.util.*; @@ -100,8 +102,10 @@ public class DataSetTableFieldController { @ApiOperation("多字段值枚举") @PostMapping("linkMultFieldValues") - public List linkMultFieldValues(@RequestBody MultFieldValuesRequest multFieldValuesRequest) throws Exception { - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + public List linkMultFieldValues(@RequestBody MultFieldValuesRequest multFieldValuesRequest) + throws Exception { + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()) + .getRequest(); String linkToken = request.getHeader(F2CLinkFilter.LINK_TOKEN_KEY); DecodedJWT jwt = JWT.decode(linkToken); Long userId = jwt.getClaim("userId").asLong(); @@ -114,18 +118,21 @@ public class DataSetTableFieldController { public List multFieldValues(@RequestBody MultFieldValuesRequest multFieldValuesRequest) throws Exception { List results = new ArrayList<>(); for (String fieldId : multFieldValuesRequest.getFieldIds()) { - results.addAll(dataSetFieldService.fieldValues(fieldId, multFieldValuesRequest.getUserId())); + List fieldValues = dataSetFieldService.fieldValues(fieldId, multFieldValuesRequest.getUserId()); + if (CollectionUtil.isNotEmpty(fieldValues)) { + results.addAll(fieldValues); + } + } ArrayList list = results.stream().collect( Collectors.collectingAndThen( Collectors.toCollection( () -> new TreeSet<>(Comparator.comparing(t -> { - if (ObjectUtils.isEmpty(t)) return ""; + if (ObjectUtils.isEmpty(t)) + return ""; return t.toString(); - })) - ), ArrayList::new - ) - ); + }))), + ArrayList::new)); return list; } } From eaed04f4410ed9e38991a8504dd2cd96c37bcaef Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Mon, 10 Jan 2022 15:34:59 +0800 Subject: [PATCH 07/16] =?UTF-8?q?fix:=20=E9=82=AE=E4=BB=B6=E9=A2=84?= =?UTF-8?q?=E8=A7=88=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/dataease/plugins/server/XEmailTaskServer.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/main/java/io/dataease/plugins/server/XEmailTaskServer.java b/backend/src/main/java/io/dataease/plugins/server/XEmailTaskServer.java index 78dfecc793..9ecd645704 100644 --- a/backend/src/main/java/io/dataease/plugins/server/XEmailTaskServer.java +++ b/backend/src/main/java/io/dataease/plugins/server/XEmailTaskServer.java @@ -34,7 +34,7 @@ public class XEmailTaskServer { @PostMapping("/queryTasks/{goPage}/{pageSize}") public Pager> queryTask(@PathVariable int goPage, @PathVariable int pageSize, - @RequestBody XpackGridRequest request) { + @RequestBody XpackGridRequest request) { EmailXpackService emailXpackService = SpringContextUtil.getBean(EmailXpackService.class); Page page = PageHelper.startPage(goPage, pageSize, true); List tasks = emailXpackService.taskGrid(request); @@ -87,7 +87,7 @@ public class XEmailTaskServer { try { fileId = emailXpackService.print(url, token, buildPixel(request.getPixel())); } catch (Exception e) { - LogUtil.error(e); + LogUtil.error(e.getMessage(), e); DEException.throwException("预览失败,请联系管理员"); } String imageUrl = "/system/ui/image/" + fileId; @@ -116,7 +116,7 @@ public class XEmailTaskServer { @PostMapping("/queryInstancies/{goPage}/{pageSize}") public Pager> instancesGrid(@PathVariable int goPage, @PathVariable int pageSize, - @RequestBody XpackGridRequest request) { + @RequestBody XpackGridRequest request) { EmailXpackService emailXpackService = SpringContextUtil.getBean(EmailXpackService.class); Page page = PageHelper.startPage(goPage, pageSize, true); List instances = emailXpackService.taskInstanceGrid(request); From a90c128cadad8527f2fa027433021a06292e2bd5 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Tue, 11 Jan 2022 12:48:14 +0800 Subject: [PATCH 08/16] =?UTF-8?q?fix:=20=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E8=AF=AD=E8=A8=80=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mobile/src/pages/tabBar/me/language.vue | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/mobile/src/pages/tabBar/me/language.vue b/mobile/src/pages/tabBar/me/language.vue index be3d97773b..86b6ed79ca 100644 --- a/mobile/src/pages/tabBar/me/language.vue +++ b/mobile/src/pages/tabBar/me/language.vue @@ -39,14 +39,20 @@ export default { }, onLoad(e) { this.language = getLanguage() + }, methods: { radioChange(node) { this.language = node.detail.value if(node.detail.value === 'sys') { - var local = uni.getLocale() - uni.setLocale(local) - this.$i18n.locale = local + uni.getSystemInfo({ + success: res => { + var local = res.language === 'zh-CN' ? 'zh-Hans' : res.language === 'zh-TW' ? 'zh-Hant' : 'en' + uni.setLocale(local) + this.$i18n.locale = local + } + }) + }else { uni.setLocale(node.detail.value) From 36bf4206a9e0b0082628b6c5939a12eaeecc5b98 Mon Sep 17 00:00:00 2001 From: junjie Date: Tue, 11 Jan 2022 15:29:28 +0800 Subject: [PATCH 09/16] =?UTF-8?q?refactor:=20=E8=A7=86=E5=9B=BE=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E9=85=8D=E7=BD=AE=E9=A1=B9=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/chart/components/normal/LabelNormal.vue | 2 +- .../src/views/chart/components/shape-attr/SizeSelector.vue | 3 --- .../src/views/chart/components/shape-attr/SizeSelectorAntV.vue | 3 --- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/frontend/src/views/chart/components/normal/LabelNormal.vue b/frontend/src/views/chart/components/normal/LabelNormal.vue index 27f728943c..616692f810 100644 --- a/frontend/src/views/chart/components/normal/LabelNormal.vue +++ b/frontend/src/views/chart/components/normal/LabelNormal.vue @@ -6,7 +6,7 @@ id="label-content" :style="content_class" > - +

{{ item.data[0] }}

diff --git a/frontend/src/views/chart/components/shape-attr/SizeSelector.vue b/frontend/src/views/chart/components/shape-attr/SizeSelector.vue index 362b8d15ab..892ea3bd90 100644 --- a/frontend/src/views/chart/components/shape-attr/SizeSelector.vue +++ b/frontend/src/views/chart/components/shape-attr/SizeSelector.vue @@ -128,9 +128,6 @@ - - {{ $t('chart.show') }} - diff --git a/frontend/src/views/chart/components/shape-attr/SizeSelectorAntV.vue b/frontend/src/views/chart/components/shape-attr/SizeSelectorAntV.vue index bedb4a527d..d7995ec282 100644 --- a/frontend/src/views/chart/components/shape-attr/SizeSelectorAntV.vue +++ b/frontend/src/views/chart/components/shape-attr/SizeSelectorAntV.vue @@ -125,9 +125,6 @@ - - {{ $t('chart.show') }} - From 792ad211c744444e2a1d8d889a346d0deabeb816 Mon Sep 17 00:00:00 2001 From: junjie Date: Tue, 11 Jan 2022 15:34:13 +0800 Subject: [PATCH 10/16] =?UTF-8?q?refactor:=20=E8=A7=86=E5=9B=BE=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E9=85=8D=E7=BD=AE=E9=A1=B9=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/chart/chart/liquid/liquid.js | 14 +------------- .../components/shape-attr/SizeSelectorAntV.vue | 12 ------------ 2 files changed, 1 insertion(+), 25 deletions(-) diff --git a/frontend/src/views/chart/chart/liquid/liquid.js b/frontend/src/views/chart/chart/liquid/liquid.js index d317e06232..2d61bc2066 100644 --- a/frontend/src/views/chart/chart/liquid/liquid.js +++ b/frontend/src/views/chart/chart/liquid/liquid.js @@ -5,7 +5,7 @@ import { DEFAULT_SIZE } from '@/views/chart/chart/chart' export function baseLiquid(plot, container, chart) { let value = 0 const colors = [] - let max, radius, outlineBorder, outlineDistance, waveLength, waveCount, bgColor, shape, labelContent, title + let max, radius, bgColor, shape, labelContent, title if (chart.data) { if (chart.data.series.length > 0) { value = chart.data.series[0].data[0] @@ -26,10 +26,6 @@ export function baseLiquid(plot, container, chart) { const size = JSON.parse(JSON.stringify(customAttr.size)) max = size.liquidMax ? size.liquidMax : DEFAULT_SIZE.liquidMax radius = parseFloat((size.liquidSize ? size.liquidSize : DEFAULT_SIZE.liquidSize) / 100) - outlineBorder = parseInt(size.liquidOutlineBorder ? size.liquidOutlineBorder : DEFAULT_SIZE.liquidOutlineBorder) - outlineDistance = parseInt((size.liquidOutlineDistance || size.liquidOutlineDistance === 0) ? size.liquidOutlineDistance : DEFAULT_SIZE.liquidOutlineDistance) - waveLength = parseInt(size.liquidWaveLength ? size.liquidWaveLength : DEFAULT_SIZE.liquidWaveLength) - waveCount = parseInt(size.liquidWaveCount ? size.liquidWaveCount : DEFAULT_SIZE.liquidWaveCount) shape = size.liquidShape ? size.liquidShape : DEFAULT_SIZE.liquidShape } // label @@ -86,14 +82,6 @@ export function baseLiquid(plot, container, chart) { percent: (parseFloat(value) / parseFloat(max)), radius: radius, shape: shape, - outline: { - border: outlineBorder, - distance: outlineDistance - }, - wave: { - length: waveLength, - count: waveCount - }, statistic: { // title: title, content: labelContent diff --git a/frontend/src/views/chart/components/shape-attr/SizeSelectorAntV.vue b/frontend/src/views/chart/components/shape-attr/SizeSelectorAntV.vue index d7995ec282..ad36ad6972 100644 --- a/frontend/src/views/chart/components/shape-attr/SizeSelectorAntV.vue +++ b/frontend/src/views/chart/components/shape-attr/SizeSelectorAntV.vue @@ -241,18 +241,6 @@ - - - - - - - - - - - - From b59c33ddd6e9ebd636674a8eceddfb84c712ae41 Mon Sep 17 00:00:00 2001 From: junjie Date: Tue, 11 Jan 2022 15:57:29 +0800 Subject: [PATCH 11/16] =?UTF-8?q?refactor:=20=E8=A7=86=E5=9B=BE=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E9=85=8D=E7=BD=AE=E9=A1=B9=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/chart/chart/chart.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/chart/chart/chart.js b/frontend/src/views/chart/chart/chart.js index 2db3f6c550..e0f36d1f81 100644 --- a/frontend/src/views/chart/chart/chart.js +++ b/frontend/src/views/chart/chart/chart.js @@ -13,11 +13,11 @@ export const DEFAULT_SIZE = { barDefault: true, barWidth: 40, barGap: 0.4, - lineWidth: 1, + lineWidth: 2, lineType: 'solid', lineSymbol: 'circle', lineSymbolSize: 4, - lineSmooth: false, + lineSmooth: true, lineArea: false, pieInnerRadius: 0, pieOuterRadius: 80, From 7d9214c2039ee48f9982623ded3e4a1c82dac99a Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Tue, 11 Jan 2022 16:30:47 +0800 Subject: [PATCH 12/16] =?UTF-8?q?feat:=20=E5=B9=B4=E4=BB=BD=E3=80=81?= =?UTF-8?q?=E5=B9=B4=E6=9C=88=E7=BB=84=E4=BB=B6=E5=A2=9E=E5=8A=A0=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/canvas/utils/utils.js | 27 +++------ .../src/components/widget/DeWidget/DeDate.vue | 19 ++----- .../serviceImpl/TimeDateRangeServiceImpl.js | 3 + .../widget/serviceImpl/TimeDateServiceImpl.js | 21 ++++++- .../serviceImpl/TimeMonthServiceImpl.js | 55 ++++++++++++++++++- .../widget/serviceImpl/TimeYearServiceImpl.js | 51 ++++++++++++++++- frontend/src/lang/en.js | 13 +++++ frontend/src/lang/tw.js | 13 +++++ frontend/src/lang/zh.js | 14 +++++ .../filter/defaultValue/DeDateDefault.vue | 54 +++++++++++++----- .../panel/filter/filterMain/FilterFoot.vue | 12 ++-- 11 files changed, 227 insertions(+), 55 deletions(-) diff --git a/frontend/src/components/canvas/utils/utils.js b/frontend/src/components/canvas/utils/utils.js index d5d4fa84fa..dbc4161bd4 100644 --- a/frontend/src/components/canvas/utils/utils.js +++ b/frontend/src/components/canvas/utils/utils.js @@ -3,6 +3,10 @@ import { HYPERLINKS } from '@/components/canvas/custom-component/component-list' +import { + ApplicationContext +} from '@/utils/ApplicationContext' + export function deepCopy(target) { if (typeof target === 'object') { const result = Array.isArray(target) ? [] : {} @@ -62,25 +66,10 @@ export function mobile2MainCanvas(mainSource, mobileSource) { export function panelInit(componentDatas) { componentDatas.forEach(item => { if (item.component && item.component === 'de-date') { - if (item.serviceName === 'timeDateWidget' && item.options.attrs && !item.options.attrs.default) { - item.options.attrs.default = { - isDynamic: false, - dkey: 0, - dynamicPrefix: 1, - dynamicInfill: 'day', - dynamicSuffix: 'before' - } - } - if (item.serviceName === 'timeDateRangeWidget' && item.options.attrs && !item.options.attrs.default) { - item.options.attrs.default = { - isDynamic: false, - dkey: 0, - sDynamicPrefix: 1, - sDynamicInfill: 'day', - sDynamicSuffix: 'before', - eDynamicPrefix: 1, - eDynamicInfill: 'day', - eDynamicSuffix: 'after' + if (item.options.attrs && !item.options.attrs.default) { + const widget = ApplicationContext.getService(item.serviceName) + if (widget && widget.defaultSetting) { + item.options.attrs.default = widget.defaultSetting() } } } diff --git a/frontend/src/components/widget/DeWidget/DeDate.vue b/frontend/src/components/widget/DeWidget/DeDate.vue index 39176372d6..403accd14e 100644 --- a/frontend/src/components/widget/DeWidget/DeDate.vue +++ b/frontend/src/components/widget/DeWidget/DeDate.vue @@ -72,9 +72,7 @@ export default { this.setCondition() }, 'defaultValueStr': function(value, old) { - if ((this.element.serviceName === 'timeDateWidget' || this.element.serviceName === 'timeDateRangeWidget') && - this.element.options.attrs.default.isDynamic) { - // 如果设置了动态时间 不做任何操作 + if (this.element.options.attrs.default.isDynamic) { return } if (value === old) return @@ -82,13 +80,10 @@ export default { this.dateChange(value) }, 'defaultoptions': function(val, old) { - // console.log('default chaneg') - if (this.element.serviceName !== 'timeDateWidget' || this.element.serviceName === 'timeDateRangeWidget') { - if (!this.element.options.attrs.default.isDynamic) { - this.values = this.fillValueDerfault() - this.dateChange(this.values) - return - } + if (!this.element.options.attrs.default.isDynamic) { + this.values = this.fillValueDerfault() + this.dateChange(this.values) + return } if (val === old) return const widget = ApplicationContext.getService(this.element.serviceName) @@ -97,9 +92,7 @@ export default { } }, created() { - if ((this.element.serviceName === 'timeDateWidget' || this.element.serviceName === 'timeDateRangeWidget') && this - .element.options.attrs.default && this.element.options - .attrs.default.isDynamic) { + if (this.element.options.attrs.default && this.element.options.attrs.default.isDynamic) { if (this.element.options.attrs.default) { const widget = ApplicationContext.getService(this.element.serviceName) this.values = widget.dynamicDateFormNow(this.element) diff --git a/frontend/src/components/widget/serviceImpl/TimeDateRangeServiceImpl.js b/frontend/src/components/widget/serviceImpl/TimeDateRangeServiceImpl.js index 33ef0d0e05..5e3083c3ee 100644 --- a/frontend/src/components/widget/serviceImpl/TimeDateRangeServiceImpl.js +++ b/frontend/src/components/widget/serviceImpl/TimeDateRangeServiceImpl.js @@ -80,6 +80,9 @@ class TimeDateRangeServiceImpl extends WidgetService { return field['deType'] === 1 }) } + defaultSetting() { + return dialogPanel.options.attrs.default + } getStartDayOfWeek() { var now = new Date() // 当前日期 var nowDayOfWeek = now.getDay() diff --git a/frontend/src/components/widget/serviceImpl/TimeDateServiceImpl.js b/frontend/src/components/widget/serviceImpl/TimeDateServiceImpl.js index 90c85c6a1b..d7f6725af9 100644 --- a/frontend/src/components/widget/serviceImpl/TimeDateServiceImpl.js +++ b/frontend/src/components/widget/serviceImpl/TimeDateServiceImpl.js @@ -21,7 +21,23 @@ const dialogPanel = { dkey: 0, dynamicPrefix: 1, dynamicInfill: 'day', - dynamicSuffix: 'before' + dynamicSuffix: 'before', + radioOptions: [{ value: false, text: 'dynamic_time.fix' }, { value: true, text: 'dynamic_time.dynamic' }], + relativeOptions: [ + { value: 0, text: 'dynamic_time.today' }, + { value: 1, text: 'dynamic_time.yesterday' }, + { value: 2, text: 'dynamic_time.firstOfMonth' }, + { value: 3, text: 'dynamic_time.custom' } + ], + custom: { + unitsOptions: [ + { value: 'day', text: 'dynamic_time.date' }, + { value: 'week', text: 'dynamic_time.week' }, + { value: 'month', text: 'dynamic_time.month' }, + { value: 'year', text: 'dynamic_time.year' } + ], + limits: [1, 12] + } } }, value: '' @@ -75,6 +91,9 @@ class TimeDateServiceImpl extends WidgetService { return field['deType'] === 1 }) } + defaultSetting() { + return dialogPanel.options.attrs.default + } dynamicDateFormNow(element) { if (element.options.attrs.default === null || typeof element.options.attrs.default === 'undefined' || !element.options.attrs.default.isDynamic) return null diff --git a/frontend/src/components/widget/serviceImpl/TimeMonthServiceImpl.js b/frontend/src/components/widget/serviceImpl/TimeMonthServiceImpl.js index 45f77dd99d..8a09aafc4f 100644 --- a/frontend/src/components/widget/serviceImpl/TimeMonthServiceImpl.js +++ b/frontend/src/components/widget/serviceImpl/TimeMonthServiceImpl.js @@ -13,7 +13,27 @@ const dialogPanel = { placeholder: 'deyearmonth.placeholder', viewIds: [], fieldId: '', - dragItems: [] + dragItems: [], + default: { + isDynamic: false, + dkey: 0, + dynamicPrefix: 1, + dynamicInfill: 'month', + dynamicSuffix: 'before', + radioOptions: [{ value: false, text: 'dynamic_month.fix' }, { value: true, text: 'dynamic_month.dynamic' }], + relativeOptions: [ + { value: 0, text: 'dynamic_month.current' }, + { value: 1, text: 'dynamic_month.last' }, + { value: 2, text: 'dynamic_month.firstOfYear' }, + { value: 3, text: 'dynamic_time.custom' } + ], + custom: { + unitsOptions: [ + { value: 'month', text: 'dynamic_time.month' } + ], + limits: [0, 10] + } + } }, value: '' }, @@ -64,6 +84,39 @@ class TimeMonthServiceImpl extends WidgetService { return field['deType'] === 1 }) } + defaultSetting() { + return dialogPanel.options.attrs.default + } + dynamicDateFormNow(element) { + const now = new Date() + const nowMonth = now.getMonth() + const nowYear = now.getFullYear() + const nowDate = now.getDate() + if (element.options.attrs.default === null || typeof element.options.attrs.default === 'undefined' || !element.options.attrs.default.isDynamic) return null + + if (element.options.attrs.default.dkey === 0) { + return Date.now() + } + + if (element.options.attrs.default.dkey === 1) { + return new Date(nowYear, nowMonth - 1, nowDate).getTime() + } + + if (element.options.attrs.default.dkey === 2) { + return new Date(nowYear, 0, 1).getTime() + } + + if (element.options.attrs.default.dkey === 3) { + const dynamicPrefix = parseInt(element.options.attrs.default.dynamicPrefix) + const dynamicSuffix = element.options.attrs.default.dynamicSuffix + + if (dynamicSuffix === 'before') { + return new Date(nowYear, nowMonth - dynamicPrefix, nowDate).getTime() + } else { + return new Date(nowYear, nowMonth + dynamicPrefix, nowDate).getTime() + } + } + } } const timeMonthServiceImpl = new TimeMonthServiceImpl() export default timeMonthServiceImpl diff --git a/frontend/src/components/widget/serviceImpl/TimeYearServiceImpl.js b/frontend/src/components/widget/serviceImpl/TimeYearServiceImpl.js index 2beb3d6935..900b681bcb 100644 --- a/frontend/src/components/widget/serviceImpl/TimeYearServiceImpl.js +++ b/frontend/src/components/widget/serviceImpl/TimeYearServiceImpl.js @@ -13,7 +13,26 @@ const dialogPanel = { placeholder: 'deyear.placeholder', viewIds: [], fieldId: '', - dragItems: [] + dragItems: [], + default: { + isDynamic: false, + dkey: 0, + dynamicPrefix: 1, + dynamicInfill: 'year', + dynamicSuffix: 'before', + radioOptions: [{ value: false, text: 'dynamic_year.fix' }, { value: true, text: 'dynamic_year.dynamic' }], + relativeOptions: [ + { value: 0, text: 'dynamic_year.current' }, + { value: 1, text: 'dynamic_year.last' }, + { value: 2, text: 'dynamic_time.custom' } + ], + custom: { + unitsOptions: [ + { value: 'year', text: 'dynamic_time.year' } + ], + limits: [0, 10] + } + } }, value: '' }, @@ -65,6 +84,36 @@ class TimeYearServiceImpl extends WidgetService { return field['deType'] === 1 }) } + defaultSetting() { + return dialogPanel.options.attrs.default + } + dynamicDateFormNow(element) { + if (element.options.attrs.default === null || typeof element.options.attrs.default === 'undefined' || !element.options.attrs.default.isDynamic) return null + + if (element.options.attrs.default.dkey === 0) { + return Date.now() + } + + if (element.options.attrs.default.dkey === 1) { + const now = new Date() + const nowYear = now.getFullYear() + const nowMonth = now.getMonth() + const nowDate = now.getDate() + return new Date(nowYear - 1, nowMonth, nowDate).getTime() + } + + if (element.options.attrs.default.dkey === 2) { + const dynamicPrefix = parseInt(element.options.attrs.default.dynamicPrefix) + const dynamicSuffix = element.options.attrs.default.dynamicSuffix + + const now = new Date() + const nowMonth = now.getMonth() + const nowYear = now.getFullYear() + const nowDate = now.getDate() + + return new Date(dynamicSuffix === 'before' ? (nowYear - dynamicPrefix) : (nowYear + dynamicPrefix), nowMonth, nowDate).getTime() + } + } } const timeYearServiceImpl = new TimeYearServiceImpl() export default timeYearServiceImpl diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index 94e34aed89..d0c8e5d03a 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -1758,5 +1758,18 @@ export default { cmonth: 'This Month', cquarter: 'This Quarter', cyear: 'This Year' + }, + dynamic_year: { + fix: 'Fixed Year', + dynamic: 'Dynamic Year', + current: 'This Year', + last: 'Last Year' + }, + dynamic_month: { + fix: 'Fixed Month', + dynamic: 'Dynamic Month', + current: 'This Month', + last: 'Last Month', + firstOfYear: 'First month of this year' } } diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index f1f65bab69..e7780a44cd 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -1770,5 +1770,18 @@ export default { cmonth: '本月', cquarter: '本季', cyear: '本年' + }, + dynamic_year: { + fix: '固定年份', + dynamic: '動態年份', + current: '當年', + last: '去年' + }, + dynamic_month: { + fix: '固定年月', + dynamic: '動態年月', + current: '本月', + last: '上月', + firstOfYear: '當年首月' } } diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index a9d299de18..0a5a33a417 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -1780,5 +1780,19 @@ export default { cmonth: '本月', cquarter: '本季', cyear: '本年' + }, + dynamic_year: { + fix: '固定年份', + dynamic: '动态年份', + current: '当年', + last: '去年' + }, + dynamic_month: { + fix: '固定年月', + dynamic: '动态年月', + current: '当月', + last: '上月', + firstOfYear: '当年首月' } + } diff --git a/frontend/src/views/panel/filter/defaultValue/DeDateDefault.vue b/frontend/src/views/panel/filter/defaultValue/DeDateDefault.vue index 02d0e820af..c83e0ff172 100644 --- a/frontend/src/views/panel/filter/defaultValue/DeDateDefault.vue +++ b/frontend/src/views/panel/filter/defaultValue/DeDateDefault.vue @@ -4,8 +4,14 @@ - {{ $t('dynamic_time.fix') }} - {{ $t('dynamic_time.dynamic') }} + + + {{ $t(item.text) }} + @@ -17,10 +23,13 @@ class="relative-time" @change="dkeyChange" > - - - - + + @@ -28,7 +37,7 @@
@@ -50,17 +59,21 @@ v-model="element.options.attrs.default.dynamicInfill" size="mini" placeholder="" + :disabled="defaultSetting.custom && defaultSetting.custom.unitsOptions && defaultSetting.custom.unitsOptions.length === 1" @change="dynamicInfillChange" > - - - - + + @@ -79,7 +92,13 @@
- + @@ -115,6 +134,13 @@ export default { dval: null } }, + computed: { + defaultSetting() { + const widget = ApplicationContext.getService(this.element.serviceName) + const setting = widget.defaultSetting() + return setting + } + }, created() { this.setDval() }, diff --git a/frontend/src/views/panel/filter/filterMain/FilterFoot.vue b/frontend/src/views/panel/filter/filterMain/FilterFoot.vue index 19a04ccfc0..e95451761c 100644 --- a/frontend/src/views/panel/filter/filterMain/FilterFoot.vue +++ b/frontend/src/views/panel/filter/filterMain/FilterFoot.vue @@ -3,11 +3,11 @@
- 默认值设置 + {{ $t('dynamic_time.set_default') }}
- - + + - + From 5cff660ceacaa6c0c5308617232597aac63843c7 Mon Sep 17 00:00:00 2001 From: junjie Date: Tue, 11 Jan 2022 17:16:22 +0800 Subject: [PATCH 13/16] =?UTF-8?q?refactor:=20=E8=A7=86=E5=9B=BE=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E9=85=8D=E7=BD=AE=E9=A1=B9=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/shape-attr/LabelSelector.vue | 32 +++++++++--- .../shape-attr/LabelSelectorAntV.vue | 50 +++++++++---------- frontend/src/views/chart/view/ChartEdit.vue | 34 ++++++++++++- 3 files changed, 83 insertions(+), 33 deletions(-) diff --git a/frontend/src/views/chart/components/shape-attr/LabelSelector.vue b/frontend/src/views/chart/components/shape-attr/LabelSelector.vue index e94542193d..c5059bc83e 100644 --- a/frontend/src/views/chart/components/shape-attr/LabelSelector.vue +++ b/frontend/src/views/chart/components/shape-attr/LabelSelector.vue @@ -17,7 +17,7 @@ - + @@ -84,27 +84,35 @@ export default { labelForm: JSON.parse(JSON.stringify(DEFAULT_LABEL)), fontSize: [], isSetting: false, - labelPosition: [ + labelPosition: [], + labelPositionPie: [ { name: this.$t('chart.inside'), value: 'inside' }, - { name: this.$t('chart.outside'), value: 'outside' }, - { name: this.$t('chart.center'), value: 'center' }, - { name: this.$t('chart.text_pos_top'), value: 'top' }, - { name: this.$t('chart.text_pos_bottom'), value: 'bottom' }, + { name: this.$t('chart.outside'), value: 'outside' } + ], + labelPositionH: [ { name: this.$t('chart.text_pos_left'), value: 'left' }, + { name: this.$t('chart.center'), value: 'inside' }, { name: this.$t('chart.text_pos_right'), value: 'right' } ], + labelPositionV: [ + { name: this.$t('chart.text_pos_top'), value: 'top' }, + { name: this.$t('chart.center'), value: 'inside' }, + { name: this.$t('chart.text_pos_bottom'), value: 'bottom' } + ], predefineColors: COLOR_PANEL } }, watch: { 'chart': { handler: function() { + this.initOptions() this.initData() } } }, mounted() { this.init() + this.initOptions() this.initData() }, methods: { @@ -140,6 +148,18 @@ export default { this.isSetting = false } this.$emit('onLabelChange', this.labelForm) + }, + initOptions() { + const type = this.chart.type + if (type) { + if (type.includes('horizontal')) { + this.labelPosition = this.labelPositionH + } else if (type.includes('pie')) { + this.labelPosition = this.labelPositionPie + } else { + this.labelPosition = this.labelPositionV + } + } } } } diff --git a/frontend/src/views/chart/components/shape-attr/LabelSelectorAntV.vue b/frontend/src/views/chart/components/shape-attr/LabelSelectorAntV.vue index 52c90ecdf3..50d23e7abc 100644 --- a/frontend/src/views/chart/components/shape-attr/LabelSelectorAntV.vue +++ b/frontend/src/views/chart/components/shape-attr/LabelSelectorAntV.vue @@ -17,7 +17,7 @@ - + @@ -62,29 +62,35 @@ export default { labelForm: JSON.parse(JSON.stringify(DEFAULT_LABEL)), fontSize: [], isSetting: false, - labelPosition: [ - { name: this.$t('chart.inside'), value: 'middle' }, - { name: this.$t('chart.outside'), value: 'outside' }, - { name: this.$t('chart.center'), value: 'center' }, - { name: this.$t('chart.text_pos_top'), value: 'top' }, - { name: this.$t('chart.text_pos_bottom'), value: 'bottom' }, + labelPosition: [], + labelPositionPie: [ + { name: this.$t('chart.inside'), value: 'inner' }, + { name: this.$t('chart.outside'), value: 'outer' } + ], + labelPositionH: [ { name: this.$t('chart.text_pos_left'), value: 'left' }, + { name: this.$t('chart.center'), value: 'middle' }, { name: this.$t('chart.text_pos_right'), value: 'right' } ], + labelPositionV: [ + { name: this.$t('chart.text_pos_top'), value: 'top' }, + { name: this.$t('chart.center'), value: 'middle' }, + { name: this.$t('chart.text_pos_bottom'), value: 'bottom' } + ], predefineColors: COLOR_PANEL } }, watch: { 'chart': { handler: function() { - this.initLabelPosition() + this.initOptions() this.initData() } } }, mounted() { this.init() - this.initLabelPosition() + this.initOptions() this.initData() }, methods: { @@ -121,22 +127,16 @@ export default { } this.$emit('onLabelChange', this.labelForm) }, - initLabelPosition() { - if (this.chart && this.chart.type && this.chart.type.includes('pie')) { - this.labelPosition = [ - { name: this.$t('chart.inside'), value: 'inner' }, - { name: this.$t('chart.outside'), value: 'outer' } - ] - } else { - this.labelPosition = [ - { name: this.$t('chart.inside'), value: 'middle' }, - { name: this.$t('chart.outside'), value: 'outside' }, - { name: this.$t('chart.center'), value: 'center' }, - { name: this.$t('chart.text_pos_top'), value: 'top' }, - { name: this.$t('chart.text_pos_bottom'), value: 'bottom' }, - { name: this.$t('chart.text_pos_left'), value: 'left' }, - { name: this.$t('chart.text_pos_right'), value: 'right' } - ] + initOptions() { + const type = this.chart.type + if (type) { + if (type.includes('horizontal')) { + this.labelPosition = this.labelPositionH + } else if (type.includes('pie')) { + this.labelPosition = this.labelPositionPie + } else { + this.labelPosition = this.labelPositionV + } } } } diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index e1e89fb7a5..e76b1c5fd5 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -141,7 +141,7 @@ class="render-select" style="width: 100px" size="mini" - @change="calcData(true,'chart',true,true)" + @change="changeChartType()" > @@ -2066,6 +2066,36 @@ export default { reset() { this.getData(this.param.id) + }, + + changeChartType() { + this.setChartDefaultOptions() + this.calcData(true, 'chart', true, true) + }, + + setChartDefaultOptions() { + const type = this.view.type + if (type.includes('pie')) { + if (this.view.render === 'echarts') { + this.view.customAttr.label.position = 'inside' + } else { + this.view.customAttr.label.position = 'inner' + } + } else if (type.includes('line')) { + this.view.customAttr.label.position = 'top' + } else if (type.includes('treemap')) { + if (this.view.render === 'echarts') { + this.view.customAttr.label.position = 'inside' + } else { + this.view.customAttr.label.position = 'middle' + } + } else { + if (this.view.render === 'echarts') { + this.view.customAttr.label.position = 'inside' + } else { + this.view.customAttr.label.position = 'middle' + } + } } } } From 3f028ce0b0af259aea34862dd2af18751615eb92 Mon Sep 17 00:00:00 2001 From: junjie Date: Tue, 11 Jan 2022 17:26:07 +0800 Subject: [PATCH 14/16] =?UTF-8?q?refactor:=20=E8=A7=86=E5=9B=BE=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E9=85=8D=E7=BD=AE=E9=A1=B9=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/chart/components/shape-attr/LabelSelector.vue | 2 +- .../src/views/chart/components/shape-attr/LabelSelectorAntV.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/chart/components/shape-attr/LabelSelector.vue b/frontend/src/views/chart/components/shape-attr/LabelSelector.vue index c5059bc83e..3a5acfe09f 100644 --- a/frontend/src/views/chart/components/shape-attr/LabelSelector.vue +++ b/frontend/src/views/chart/components/shape-attr/LabelSelector.vue @@ -152,7 +152,7 @@ export default { initOptions() { const type = this.chart.type if (type) { - if (type.includes('horizontal')) { + if (type.includes('horizontal') || type === 'funnel') { this.labelPosition = this.labelPositionH } else if (type.includes('pie')) { this.labelPosition = this.labelPositionPie diff --git a/frontend/src/views/chart/components/shape-attr/LabelSelectorAntV.vue b/frontend/src/views/chart/components/shape-attr/LabelSelectorAntV.vue index 50d23e7abc..50142634b7 100644 --- a/frontend/src/views/chart/components/shape-attr/LabelSelectorAntV.vue +++ b/frontend/src/views/chart/components/shape-attr/LabelSelectorAntV.vue @@ -130,7 +130,7 @@ export default { initOptions() { const type = this.chart.type if (type) { - if (type.includes('horizontal')) { + if (type.includes('horizontal') || type === 'funnel') { this.labelPosition = this.labelPositionH } else if (type.includes('pie')) { this.labelPosition = this.labelPositionPie From 76523b5787d64c589f00aa1aa3df797086b829ea Mon Sep 17 00:00:00 2001 From: junjie Date: Wed, 12 Jan 2022 11:01:14 +0800 Subject: [PATCH 15/16] =?UTF-8?q?refactor:=20=E8=A7=86=E5=9B=BE=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E9=85=8D=E7=BD=AE=E9=A1=B9=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/chart/group/Group.vue | 34 +++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/frontend/src/views/chart/group/Group.vue b/frontend/src/views/chart/group/Group.vue index e7df267002..f9cb7d2c9b 100644 --- a/frontend/src/views/chart/group/Group.vue +++ b/frontend/src/views/chart/group/Group.vue @@ -196,9 +196,9 @@ :options="chartGroupTreeAvailable" :normalizer="normalizer" :placeholder="$t('chart.select_group')" - :noChildrenText="$t('commons.treeselect.no_children_text')" - :noOptionsText="$t('commons.treeselect.no_options_text')" - :noResultsText="$t('commons.treeselect.no_results_text')" + :no-children-text="$t('commons.treeselect.no_children_text')" + :no-options-text="$t('commons.treeselect.no_options_text')" + :no-results-text="$t('commons.treeselect.no_results_text')" /> @@ -773,6 +773,7 @@ export default { view.customFilter = JSON.stringify([]) view.drillFields = JSON.stringify([]) view.extBubble = JSON.stringify([]) + this.setChartDefaultOptions(view) const _this = this post('/chart/view/save', view).then(response => { this.closeCreateChart() @@ -788,6 +789,33 @@ export default { }) }, + setChartDefaultOptions(view) { + const type = view.type + const attr = JSON.parse(view.customAttr) + if (type.includes('pie')) { + if (view.render === 'echarts') { + attr.label.position = 'inside' + } else { + attr.label.position = 'inner' + } + } else if (type.includes('line')) { + attr.label.position = 'top' + } else if (type.includes('treemap')) { + if (view.render === 'echarts') { + attr.label.position = 'inside' + } else { + attr.label.position = 'middle' + } + } else { + if (view.render === 'echarts') { + attr.label.position = 'inside' + } else { + attr.label.position = 'middle' + } + } + view.customAttr = JSON.stringify(attr) + }, + getTable(table) { this.table = JSON.parse(JSON.stringify(table)) }, From 0a3580ddaeba4cb484949134161979aecbeb51e4 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Wed, 12 Jan 2022 11:07:03 +0800 Subject: [PATCH 16/16] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E4=B8=BB?= =?UTF-8?q?=E9=A2=98=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataease/plugins/server/ThemeServer.java | 22 ++++++++++++------- frontend/src/lang/en.js | 6 ++++- frontend/src/lang/tw.js | 6 ++++- frontend/src/lang/zh.js | 6 ++++- 4 files changed, 29 insertions(+), 11 deletions(-) diff --git a/backend/src/main/java/io/dataease/plugins/server/ThemeServer.java b/backend/src/main/java/io/dataease/plugins/server/ThemeServer.java index 08e2d10374..99dc4c5fec 100644 --- a/backend/src/main/java/io/dataease/plugins/server/ThemeServer.java +++ b/backend/src/main/java/io/dataease/plugins/server/ThemeServer.java @@ -4,12 +4,13 @@ import java.util.List; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; +import io.dataease.commons.exception.DEException; +import io.dataease.commons.utils.LogUtil; import io.dataease.plugins.config.SpringContextUtil; import io.dataease.plugins.xpack.theme.dto.ThemeDto; import io.dataease.plugins.xpack.theme.dto.ThemeItem; @@ -20,10 +21,8 @@ import io.dataease.plugins.xpack.theme.service.ThemeXpackService; @RestController public class ThemeServer { - - @PostMapping("/themes") - public List themes(){ + public List themes() { ThemeXpackService themeXpackService = SpringContextUtil.getBean(ThemeXpackService.class); return themeXpackService.themes(); @@ -36,15 +35,22 @@ public class ThemeServer { } @PostMapping("/save") - public void save(@RequestPart("request") ThemeRequest request, @RequestPart(value = "file", required = false) MultipartFile bodyFile) { + public void save(@RequestPart("request") ThemeRequest request, + @RequestPart(value = "file", required = false) MultipartFile bodyFile) { ThemeXpackService themeXpackService = SpringContextUtil.getBean(ThemeXpackService.class); - themeXpackService.save(request, bodyFile); + try { + themeXpackService.save(request, bodyFile); + } catch (Exception e) { + LogUtil.error(e.getMessage(), e); + DEException.throwException(e); + } + } @PostMapping("/delete/{themeId}") - public void save(@PathVariable("themeId") int themeId) { + public void delete(@PathVariable("themeId") int themeId) { ThemeXpackService themeXpackService = SpringContextUtil.getBean(ThemeXpackService.class); themeXpackService.deleteTheme(themeId); } - + } diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index d0c8e5d03a..497a9f9ec0 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -131,6 +131,7 @@ export default { default_login: 'Normal' }, commons: { + apply: 'Apply', search: 'Search', folder: 'Folder', no_target_permission: 'No permission', @@ -437,7 +438,10 @@ export default { background: 'Background color', custom: 'Custom color', otherSave: 'Theme Save as', - info: 'Theme info' + info: 'Theme info', + add: 'Add Theme', + please_input_name: 'Please enter a name', + name_repeat: 'Name already exists' }, tagsView: { refresh: 'Refresh', diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index e7780a44cd..d819bad6a1 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -131,6 +131,7 @@ export default { default_login: '普通登錄' }, commons: { + apply: '應用', search: '搜索', folder: '目錄', no_target_permission: '沒有權限', @@ -437,7 +438,10 @@ export default { background: '背景顏色', custom: '自定義顏色', otherSave: '主題另存為', - info: '主題信息' + info: '主題信息', + add: '新增主題', + please_input_name: '請輸入名稱', + name_repeat: '名稱已存在' }, tagsView: { refresh: '刷新', diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 0a5a33a417..5fb9fcfdcf 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -131,6 +131,7 @@ export default { default_login: '普通登录' }, commons: { + apply: '应用', search: '搜索', folder: '目录', no_target_permission: '没有权限', @@ -438,7 +439,10 @@ export default { background: '背景颜色', custom: '自定义颜色', otherSave: '主题另存为', - info: '主题信息' + info: '主题信息', + add: '新增主题', + please_input_name: '请输入名称', + name_repeat: '名称已存在' }, tagsView: { refresh: '刷新',