@ecan-bi/tools 1.0.35 → 1.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/indicator.ts +25 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecan-bi/tools",
3
- "version": "1.0.35",
3
+ "version": "1.0.36",
4
4
  "description": "General tools",
5
5
  "main": "lib/index.es.js",
6
6
  "module": "lib/index.es.js",
package/src/indicator.ts CHANGED
@@ -283,6 +283,7 @@ const handleSqlConditions = (graphicConfig: { [key:string]: any }) => {
283
283
  leftAxisList = [],
284
284
  rightAxisList = [],
285
285
  queryColumnList = [],
286
+ indexLibColumns = [],
286
287
  indicators = []
287
288
  } = graphicConfig
288
289
  handleControlList(controlList)
@@ -294,6 +295,7 @@ const handleSqlConditions = (graphicConfig: { [key:string]: any }) => {
294
295
  ...leftAxisList,
295
296
  ...rightAxisList,
296
297
  ...queryColumnList,
298
+ ...indexLibColumns,
297
299
  ...indicators
298
300
  ]
299
301
  const conditionList: any = []
@@ -716,6 +718,7 @@ export const formatIndicatorParams = (props: any, otherParams: any = {}) => {
716
718
  leftAxisList = [],
717
719
  rightAxisList = [],
718
720
  queryColumnList = [],
721
+ indexLibColumns = [],
719
722
  indicators = [],
720
723
  controlList = [],
721
724
  formFields = {},
@@ -944,6 +947,22 @@ export const formatIndicatorParams = (props: any, otherParams: any = {}) => {
944
947
  queryColumns.push(itemObj)
945
948
  })
946
949
 
950
+ const libColumns = []
951
+ if (['ecanTable'].includes(type) && graphicConfig.isIndexSet) {
952
+ // 表格组件并且开启了指标集
953
+ indexLibColumns.forEach((column: any) => {
954
+ const objItem: any = {
955
+ label: column.label,
956
+ calcType: column.calcType,
957
+ show: column.show
958
+ }
959
+ if (column.formula) {
960
+ objItem.formula = column.formula
961
+ }
962
+ libColumns.push(objItem)
963
+ })
964
+ }
965
+
947
966
  // 行表头
948
967
  let rowHeaders: any = []
949
968
  let resultRowHeaderList: any = []
@@ -1118,7 +1137,7 @@ export const formatIndicatorParams = (props: any, otherParams: any = {}) => {
1118
1137
  } else {
1119
1138
  chartType = 'grouptable'
1120
1139
  }
1121
- } else if (layer === '1' && queryColumns.length === 0) {
1140
+ } else if (layer === '1' && !queryColumns.length && !libColumns.length) {
1122
1141
  return
1123
1142
  // queryColumns 图表配置为空返回
1124
1143
  } else if (layer === '2' && indicatorList.length === 0) {
@@ -1171,7 +1190,7 @@ export const formatIndicatorParams = (props: any, otherParams: any = {}) => {
1171
1190
  ...someParams
1172
1191
  }
1173
1192
  } else {
1174
- let classParams = {}
1193
+ let classParams: any = {}
1175
1194
  if (lowerCaseIncludes(type, ['scatter', 'valueline'])) {
1176
1195
  // 散点图多个维度
1177
1196
  classParams = {
@@ -1182,6 +1201,10 @@ export const formatIndicatorParams = (props: any, otherParams: any = {}) => {
1182
1201
  classification
1183
1202
  }
1184
1203
  }
1204
+ if (libColumns?.length) {
1205
+ classParams.indexLibColumns = libColumns
1206
+ classParams.isIndexSet = true
1207
+ }
1185
1208
  resultParams = {
1186
1209
  url: '/diagram',
1187
1210
  source,