lambo-design-bi 0.0.150 → 0.0.152

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.
@@ -39,7 +39,7 @@ export default {
39
39
  getWidgetName
40
40
  },
41
41
  created() {
42
-
42
+ console.log("ContainerCard params:", this.params)
43
43
  },
44
44
  mounted() {
45
45
 
@@ -85,13 +85,7 @@
85
85
  background: var(--component-background, @_component-background);
86
86
  border-radius: 0 0 var(--border-radius-base, @_border-radius-base) var(--border-radius-base, @_border-radius-base);
87
87
  padding: 8px 8px;
88
-
89
- display: flex; // 启用flex布局
90
- flex-wrap: wrap; // 允许换行
91
- justify-content: flex-start; // 元素间距均匀分布
92
- align-items: flex-start; // 顶部对齐
93
- gap: 8px;
94
-
88
+
95
89
  &.no-border-top {
96
90
  border-top: 0;
97
91
  border-radius: var(--border-radius-base, @_border-radius-base);
@@ -1,14 +1,15 @@
1
1
  <template>
2
- <num-index :title="widget.name" :val="numVal" :unit="unit" :items="items" :note="widget.options.note"></num-index>
2
+ <LamboNumberInfoBi :title="title" :sub-title="subTitle" :num="num" :sub-num1="subNum1" :trend1="trend1"
3
+ :sub-num2="subNum2" :trend2="trend2">
4
+ </LamboNumberInfoBi>
3
5
  </template>
4
6
  <script>
5
- import NumIndex from "../../../pub/num-index/num-index.vue"
6
7
  import { getListMapData } from "../api/data"
7
- import { formatNumLocale } from "../../../util/num-util"
8
+ import LamboNumberInfoBi from "../../../pub/number-info/index"
8
9
 
9
10
  export default {
10
11
  name: "BiNumIndex",
11
- components: { NumIndex },
12
+ components: { LamboNumberInfoBi },
12
13
  props: {
13
14
  widget: {
14
15
  type: Object,
@@ -21,25 +22,20 @@ export default {
21
22
  },
22
23
  data() {
23
24
  return {
24
- numVal: '',
25
- unit: '',
26
- /**
27
- * [
28
- * {"k_name": "同比", "val": "+12%"},
29
- * {"k_name": "环比", "val": "-12%"},
30
- * ]
31
- */
32
- kName1: '',
33
- kName2: '',
34
- items: [],
35
- apiId: '',
25
+ title: '',
26
+ apiId: null,
27
+ subTitle: null,
28
+ num: null,
29
+ subNum1: null,
30
+ trend1: null,
31
+ subNum2: null,
32
+ trend2: null
36
33
  }
37
34
  },
38
35
  methods: {
39
36
  initConfig() {
37
+ this.title = this.widget.options.title || this.widget.name || ''
40
38
  this.apiId = this.widget.options.apiId
41
- this.kName1 = this.widget.options.kName1 || ''
42
- this.kName2 = this.widget.options.kName2 || ''
43
39
  },
44
40
  doSearch() {
45
41
  if (!this.apiId) {
@@ -52,26 +48,13 @@ export default {
52
48
  } else {
53
49
  if (res.data.data.rows.length > 0) {
54
50
  let row = res.data.data.rows[0]
55
- /**
56
- * [
57
- * {"val": "457182134", "unit": "条", "extend_val1": "+12%", "extend_val2": "-12%", }
58
- * ]
59
- */
60
51
  if (row) {
61
- if (Object.prototype.hasOwnProperty.call(row, "val") && row['val']) {
62
- this.numVal = formatNumLocale(row.val)
63
- }
64
- if (Object.prototype.hasOwnProperty.call(row, "unit") && row['unit']) {
65
- this.unit = row['unit']
66
- }
67
- let itemArr = []
68
- if (Object.prototype.hasOwnProperty.call(row, "extend_val1") && row['extend_val1']) {
69
- itemArr.push({ "k_name": this.kName1, "val": row['extend_val1'] })
70
- }
71
- if (Object.prototype.hasOwnProperty.call(row, "extend_val2") && row['extend_val2']) {
72
- itemArr.push({ "k_name": this.kName2, "val": row['extend_val2'] })
73
- }
74
- this.items = itemArr
52
+ this.subTitle = row['sub_title']
53
+ this.num = row['num']
54
+ this.subNum1 = row['sub_num1']
55
+ this.trend1 = row['trend1']
56
+ this.subNum2 = row['sub_num2']
57
+ this.trend2 = row['trend2']
75
58
  }
76
59
  }
77
60
  }
@@ -81,6 +64,7 @@ export default {
81
64
  }
82
65
  },
83
66
  created() {
67
+ console.log("num-idx widget:", this.widget)
84
68
  this.initConfig()
85
69
  this.doSearch()
86
70
  },
@@ -98,4 +82,3 @@ export default {
98
82
  }
99
83
  }
100
84
  </script>
101
- <style scoped></style>
@@ -27,9 +27,8 @@ import BiSearchForm from '../search/search-form.vue'
27
27
  import LamboIndicatorCardBiSearch from '../container/card/comps/indicator-card/src/indicator-card-bi-search.vue'
28
28
  import { getPageConfig } from '../api/config'
29
29
  import { deepCopy } from "@lambo-design/shared/utils/assist"
30
- import { SEARCH_DICT, DATE_RANGE_PFIX } from '../../../util/constants'
31
- import moment from "moment/moment"
32
30
  import { getWidgetName } from '../util/widget-map'
31
+ import { setRouteCfg2Search, getInitSearchRes, getSearchFormRes } from './util/common'
33
32
 
34
33
  export default {
35
34
  name: 'BiChildPageTm',
@@ -62,10 +61,14 @@ export default {
62
61
  if (res.data.data) {
63
62
  let pageWidgetTree = deepCopy(res.data.data)
64
63
  this.pageTitle = pageWidgetTree.options.title || ''
64
+
65
65
  console.log("获取页面配置 1:", pageWidgetTree)
66
- this.setRouteConfig2Search(pageWidgetTree)
66
+ let routeConfig = this.$route.query || {}
67
+ setRouteCfg2Search(routeConfig, pageWidgetTree)
67
68
  console.log("获取页面配置 2:", pageWidgetTree)
69
+
68
70
  this.childPageWidget = deepCopy(pageWidgetTree)
71
+ this.initSearch()
69
72
  } else {
70
73
  console.error("获取页面配置[" + this.pageId + "]失败:配置数据为空")
71
74
  return
@@ -81,113 +84,29 @@ export default {
81
84
  // name从路由里面取
82
85
  // this.$router.push({ name: 'xxx' })
83
86
  },
84
- doSearch(params) {
85
- console.log("child-page-tm doSearch 1 params:", params)
86
- console.log("child-page-tm doSearch this.childPageWidget:", this.childPageWidget)
87
- let emptySearchArr = []
88
- // 增加前端校验是否必传
89
- let searchConfig = this.childPageWidget.search
90
- if (searchConfig && Object.prototype.hasOwnProperty.call(searchConfig, "widgets") && searchConfig.widgets) {
91
- for (let i = 0; i < searchConfig.widgets.length; i++) {
92
- let oneSearch = searchConfig.widgets[i]
93
- console.log("child-page-tm doSearch oneSearch:", oneSearch)
94
- if (oneSearch && oneSearch.options.isRequired === '1' && oneSearch.options.qKey) {
95
- // 时间范围选择框
96
- if (oneSearch.options.searchType && oneSearch.options.searchType === SEARCH_DICT.MUlTI_DATE.id) {
97
- if (!params[oneSearch.options.qKey + DATE_RANGE_PFIX.START] || !params[oneSearch.options.qKey + DATE_RANGE_PFIX.END]) {
98
- emptySearchArr.push(oneSearch.name)
99
- }
100
- } else {
101
- if (!params[oneSearch.options.qKey]) {
102
- emptySearchArr.push(oneSearch.name)
103
- }
104
- }
105
- }
106
- }
107
- }
87
+ initSearch() {
88
+ let resObj = getInitSearchRes(this.childPageWidget)
89
+ let emptySearchArr = resObj['emptySearchArr']
90
+ let initParams = resObj['initParams']
108
91
  if (emptySearchArr.length > 0) {
109
92
  console.log("必选查询条件为空:", emptySearchArr)
110
93
  this.$Message.warning({ content: "必选查询条件" + emptySearchArr.join() + "为空,请选择", duration: 1.8 })
111
94
  return
112
95
  }
113
- this.params = deepCopy(params)
114
- console.log("child-page-tm doSearch 2 this.params:", this.params)
96
+ this.params = deepCopy(initParams)
97
+ console.log("child-page-tm initSearch this.params:", this.params)
115
98
  },
116
- setRouteConfig2Search(widgetData) {
117
- let routeConfig = this.$route.query || {}
118
- console.log("child-page-tm setRouteConfig2Search -- routeConfig:", routeConfig)
119
- console.log("child-page-tm setRouteConfig2Search -- widgetData:", widgetData)
120
- if (routeConfig && widgetData && widgetData.search && widgetData.search.widgets) {
121
- widgetData.search.widgets.map(item => {
122
- if (item.options && Object.prototype.hasOwnProperty.call(item.options, "qKey") && item.options['qKey']) {
123
- let searchType = item.options['searchType']
124
- let qKey = item.options['qKey']
125
- if (searchType === SEARCH_DICT.INPUT.id) {
126
- item.options['val'] = routeConfig[qKey]
127
- } else if (searchType === SEARCH_DICT.SINGLE_SELECT.id) {
128
- let val = routeConfig[qKey]
129
- let valName = ''
130
- let selDataList = item.options['dataList']
131
- if (val && selDataList) {
132
- for (let i = 0; i < selDataList.length; i++) {
133
- let selDataItem = selDataList[i]
134
- if (selDataItem && Object.prototype.hasOwnProperty.call(selDataItem, "K") && Object.prototype.hasOwnProperty.call(selDataItem, "V")) {
135
- if (selDataItem['K'] && selDataItem['K'] === val) {
136
- valName = selDataItem['V']
137
- break;
138
- }
139
- }
140
- }
141
- if (valName) {
142
- item.options['val'] = val
143
- item.options['valName'] = valName
144
- }
145
- }
146
- } else if (searchType === SEARCH_DICT.MUlTI_SELECT.id) {
147
- let val = routeConfig[qKey]
148
- let valNameArr = []
149
- let selDataList = item.options['dataList']
150
- if (val && selDataList) {
151
- let valArr = val.split(',')
152
- for (let i = 0; i < selDataList.length; i++) {
153
- let selDataItem = selDataList[i]
154
- if (selDataItem && Object.prototype.hasOwnProperty.call(selDataItem, "K") && Object.prototype.hasOwnProperty.call(selDataItem, "V")) {
155
- if (selDataItem['K'] && valArr.includes(selDataItem['K'])) {
156
- valNameArr.push(selDataItem['V'])
157
- }
158
- }
159
- }
160
- if (valNameArr && valNameArr.length > 0) {
161
- item.options['val'] = valArr
162
- item.options['valName'] = valNameArr.join()
163
- }
164
- }
165
- } else if (searchType === SEARCH_DICT.SINGLE_DATE.id) {
166
- let val = routeConfig[qKey]
167
- if (val && val.indexOf('-') > 0) {
168
- val = moment(val).format("YYYYMMDD")
169
- }
170
- item.options['val'] = val
171
- } else if (searchType === SEARCH_DICT.MUlTI_DATE.id) {
172
- console.log("detail -- getPageConfig -- routeConfig:", routeConfig)
173
- let startDate = routeConfig[qKey + '_start']
174
- console.log("detail -- getPageConfig -- startDate:", startDate)
175
- if (startDate.indexOf('-') > 0) {
176
- startDate = moment(startDate).format("YYYYMMDD") || ''
177
- }
178
-
179
- let endDate = routeConfig[qKey + '_end']
180
- console.log("detail -- getPageConfig -- endDate:", endDate)
181
- if (endDate.indexOf('-')) {
182
- endDate = moment(endDate).format("YYYYMMDD") || ''
183
- }
184
- if (startDate && endDate) {
185
- item.options['val'] = [startDate, endDate]
186
- }
187
- }
188
- }
189
- })
99
+ doSearch(formParams) {
100
+ console.log("child-page-tm doSearch 1 formParams:", formParams)
101
+ console.log("child-page-tm doSearch this.childPageWidget:", this.childPageWidget)
102
+ let emptySearchArr = getSearchFormRes(formParams, this.childPageWidget)
103
+ if (emptySearchArr && emptySearchArr.length > 0) {
104
+ console.log("必选查询条件为空:", emptySearchArr)
105
+ this.$Message.warning({ content: "必选查询条件" + emptySearchArr.join() + "为空,请选择", duration: 1.8 })
106
+ return
190
107
  }
108
+ this.params = deepCopy(formParams)
109
+ console.log("child-page-tm doSearch 2 this.params:", this.params)
191
110
  }
192
111
  },
193
112
  created() {
@@ -201,7 +120,7 @@ export default {
201
120
  '$route'(to, from) {
202
121
  // 只有 query 或 params 变化时执行逻辑(避免 path 相同但参数变化时无响应)
203
122
  if (to.path === from.path && (to.query !== from.query || to.params !== from.params)) {
204
- console.log("------------'$route'(to, from)---------------------------")
123
+ console.log("------------'$route'(to, from)------------")
205
124
  this.getConfig()
206
125
  }
207
126
  }
@@ -24,8 +24,8 @@ import BiSearchForm from '../search/search-form.vue'
24
24
  import LamboIndicatorCardBiSearch from '../container/card/comps/indicator-card/src/indicator-card-bi-search.vue'
25
25
  import { getPageConfig } from '../api/config'
26
26
  import { deepCopy } from "@lambo-design/shared/utils/assist"
27
- import { SEARCH_DICT, DATE_RANGE_PFIX } from '../../../util/constants'
28
27
  import { getWidgetName } from '../util/widget-map'
28
+ import { setRouteCfg2Search, getInitSearchRes, getSearchFormRes } from './util/common'
29
29
 
30
30
  export default {
31
31
  name: 'BiIndexPageTm',
@@ -55,11 +55,20 @@ export default {
55
55
  if (res.data.code !== 1) {
56
56
  console.error("获取页面配置[" + this.pageId + "]失败:" + res.data.message)
57
57
  } else {
58
- let pageWidgetTree = res.data.data
59
- if (pageWidgetTree) {
58
+ if (res.data.data) {
59
+ let pageWidgetTree = deepCopy(res.data.data)
60
+ this.pageTitle = pageWidgetTree.options.title || ''
61
+
62
+ let routeConfig = this.$route.query || {}
63
+ // 首页一般路由都会有参数,但是大多数情况不需要配置输入参数
64
+ if (Object.prototype.hasOwnProperty.call(routeConfig, "paramsPass") && routeConfig['paramsPass']) {
65
+ console.log("获取页面配置 1:", pageWidgetTree)
66
+ setRouteCfg2Search(routeConfig, pageWidgetTree)
67
+ console.log("获取页面配置 2:", pageWidgetTree)
68
+ }
69
+
60
70
  this.pageWidget = deepCopy(pageWidgetTree)
61
- this.pageTitle = this.pageWidget.options.title || ''
62
- console.log("获取页面配置成功:", this.pageWidget)
71
+ this.initSearch()
63
72
  } else {
64
73
  console.error("获取页面配置[" + this.pageId + "]失败:配置数据为空")
65
74
  return
@@ -69,38 +78,30 @@ export default {
69
78
  console.error("获取页面配置[" + this.pageId + "]异常:", err)
70
79
  })
71
80
  },
72
- doSearch(params) {
73
- console.log("index-page-tm doSearch 1 params:", params)
74
- console.log("index-page-tm doSearch this.pageWidget:", this.pageWidget)
75
- let emptySearchArr = []
76
- // 增加前端校验是否必传
77
- let searchConfig = this.pageWidget.search
78
- if (searchConfig && Object.prototype.hasOwnProperty.call(searchConfig, "widgets") && searchConfig.widgets) {
79
- for (let i = 0; i < searchConfig.widgets.length; i++) {
80
- let oneSearch = searchConfig.widgets[i]
81
- console.log("index-page-tm doSearch oneSearch:", oneSearch)
82
- if (oneSearch && oneSearch.options.isRequired === '1' && oneSearch.options.qKey) {
83
- // 时间范围选择框
84
- if (oneSearch.options.searchType && oneSearch.options.searchType === SEARCH_DICT.MUlTI_DATE.id) {
85
- if (!params[oneSearch.options.qKey + DATE_RANGE_PFIX.START] || !params[oneSearch.options.qKey + DATE_RANGE_PFIX.END]) {
86
- emptySearchArr.push(oneSearch.name)
87
- }
88
- } else {
89
- if (!params[oneSearch.options.qKey]) {
90
- emptySearchArr.push(oneSearch.name)
91
- }
92
- }
93
- }
94
- }
95
- }
81
+ initSearch() {
82
+ let resObj = getInitSearchRes(this.childPageWidget)
83
+ let emptySearchArr = resObj['emptySearchArr']
84
+ let initParams = resObj['initParams']
96
85
  if (emptySearchArr.length > 0) {
97
86
  console.log("必选查询条件为空:", emptySearchArr)
98
87
  this.$Message.warning({ content: "必选查询条件" + emptySearchArr.join() + "为空,请选择", duration: 1.8 })
99
88
  return
100
89
  }
101
- this.params = deepCopy(params)
102
- console.log("index-page-tm doSearch 2 this.params:", this.params)
90
+ this.params = deepCopy(initParams)
91
+ console.log("index-page-tm initSearch this.params:", this.params)
103
92
  },
93
+ doSearch(formParams) {
94
+ console.log("index-page-tm doSearch 1 formParams:", formParams)
95
+ console.log("index-page-tm doSearch this.pageWidget:", this.pageWidget)
96
+ let emptySearchArr = getSearchFormRes(formParams, this.pageWidget)
97
+ if (emptySearchArr && emptySearchArr.length > 0) {
98
+ console.log("必选查询条件为空:", emptySearchArr)
99
+ this.$Message.warning({ content: "必选查询条件" + emptySearchArr.join() + "为空,请选择", duration: 1.8 })
100
+ return
101
+ }
102
+ this.params = deepCopy(formParams)
103
+ console.log("index-page-tm doSearch 2 this.params:", this.params)
104
+ }
104
105
  },
105
106
  created() {
106
107
  this.getConfig()
@@ -0,0 +1,157 @@
1
+ import { SEARCH_DICT, DATE_RANGE_PFIX, DEFAULT_DATE_FORMAT } from '../../../../util/constants'
2
+ import moment from "moment/moment"
3
+
4
+ /**
5
+ * 将路由携带的参数,赋值给查询条件列表
6
+ *
7
+ * @param {*} widgetData
8
+ */
9
+ export function setRouteCfg2Search(routeConfig, widgetData) {
10
+ console.log("setRouteConfig2Search -- routeConfig:", routeConfig)
11
+ console.log("setRouteConfig2Search -- widgetData:", widgetData)
12
+ if (routeConfig && widgetData && widgetData.search && widgetData.search.widgets) {
13
+ widgetData.search.widgets.map(item => {
14
+ if (item.options && item.options['qKey'] && Object.prototype.hasOwnProperty.call(routeConfig, item.options['qKey'])) {
15
+ let qKey = item.options['qKey']
16
+ let searchType = item.options['searchType']
17
+ if (searchType === SEARCH_DICT.INPUT.id || searchType === SEARCH_DICT.NOT_SHOW_INPUT.id) {
18
+ item.options['val'] = routeConfig[qKey]
19
+ } else if (searchType === SEARCH_DICT.SINGLE_SELECT.id) {
20
+ let val = routeConfig[qKey]
21
+ let valName = ''
22
+ let selDataList = item.options['dataList']
23
+ if (val && selDataList) {
24
+ for (let i = 0; i < selDataList.length; i++) {
25
+ let selDataItem = selDataList[i]
26
+ if (selDataItem && Object.prototype.hasOwnProperty.call(selDataItem, "K") && Object.prototype.hasOwnProperty.call(selDataItem, "V")) {
27
+ if (selDataItem['K'] && selDataItem['K'] === val) {
28
+ valName = selDataItem['V']
29
+ break;
30
+ }
31
+ }
32
+ }
33
+ if (valName) {
34
+ item.options['val'] = val
35
+ item.options['valName'] = valName
36
+ }
37
+ }
38
+ } else if (searchType === SEARCH_DICT.MUlTI_SELECT.id) {
39
+ let val = routeConfig[qKey]
40
+ let valNameArr = []
41
+ let selDataList = item.options['dataList']
42
+ if (val && selDataList) {
43
+ let valArr = val.split(',')
44
+ for (let i = 0; i < selDataList.length; i++) {
45
+ let selDataItem = selDataList[i]
46
+ if (selDataItem && Object.prototype.hasOwnProperty.call(selDataItem, "K") && Object.prototype.hasOwnProperty.call(selDataItem, "V")) {
47
+ if (selDataItem['K'] && valArr.includes(selDataItem['K'])) {
48
+ valNameArr.push(selDataItem['V'])
49
+ }
50
+ }
51
+ }
52
+ if (valNameArr && valNameArr.length > 0) {
53
+ item.options['val'] = valArr
54
+ item.options['valName'] = valNameArr.join()
55
+ }
56
+ }
57
+ } else if (searchType === SEARCH_DICT.SINGLE_DATE.id) {
58
+ let val = routeConfig[qKey]
59
+ if (val && val.indexOf('-') > 0) {
60
+ val = moment(val).format("YYYYMMDD")
61
+ }
62
+ item.options['val'] = val
63
+ } else if (searchType === SEARCH_DICT.MUlTI_DATE.id) {
64
+ let startDate = routeConfig[qKey + '_start']
65
+ if (startDate.indexOf('-') > 0) {
66
+ startDate = moment(startDate).format("YYYYMMDD") || ''
67
+ }
68
+ let endDate = routeConfig[qKey + '_end']
69
+ if (endDate.indexOf('-')) {
70
+ endDate = moment(endDate).format("YYYYMMDD") || ''
71
+ }
72
+ if (startDate && endDate) {
73
+ item.options['val'] = [startDate, endDate]
74
+ }
75
+ }
76
+ }
77
+ })
78
+ }
79
+ }
80
+
81
+ /**
82
+ * 初始化的查询条件,提取后端查询参数值合集、校验必传参数
83
+ *
84
+ * @param {*} pageWidget
85
+ * @returns
86
+ */
87
+ export function getInitSearchRes(pageWidget) {
88
+ let emptySearchArr = []
89
+ let initParams = {}
90
+ // 页面没设置查询条件的先不管
91
+ if (pageWidget && pageWidget.search) {
92
+ let searchList = pageWidget.search.widgets
93
+ searchList.map(item => {
94
+ if (item.options && Object.prototype.hasOwnProperty.call(item.options, "qKey")) {
95
+ let qKey = item.options.qKey
96
+ if (Object.prototype.hasOwnProperty.call(item.options, "val") && item.options.val) {
97
+ let val = item.options.val
98
+ if (Array.isArray(val)) {
99
+ if (item.options.searchType === SEARCH_DICT.MUlTI_DATE.id) {
100
+ if (val && Array.isArray(val) && val.length === 2 && val[0] && val[1]) {
101
+ initParams[qKey + DATE_RANGE_PFIX.START] = moment(val[0]).format(DEFAULT_DATE_FORMAT)
102
+ initParams[qKey + DATE_RANGE_PFIX.END] = moment(val[1]).format(DEFAULT_DATE_FORMAT)
103
+ }
104
+ } else {
105
+ initParams[qKey] = val.join()
106
+ }
107
+ } else {
108
+ if (item.options.searchType === SEARCH_DICT.SINGLE_DATE.id) {
109
+ initParams[qKey] = moment(val).format(DEFAULT_DATE_FORMAT)
110
+ } else {
111
+ initParams[qKey] = val
112
+ }
113
+ }
114
+ } else {
115
+ // 必填查询条件
116
+ if (item.options.isRequired === '1') {
117
+ emptySearchArr.push(item.name)
118
+ }
119
+ }
120
+ }
121
+ })
122
+ }
123
+ return { emptySearchArr: emptySearchArr, initParams: initParams }
124
+ }
125
+
126
+ /**
127
+ * 校验SearchForm中获取查询条件的值合集,是否必传但为空值的
128
+ *
129
+ * @param {*} formParams
130
+ * @param {*} pageWidget
131
+ * @returns
132
+ */
133
+ export function getSearchFormRes(formParams, pageWidget) {
134
+ let emptySearchArr = []
135
+ // 增加前端校验是否必传
136
+ let searchConfig = pageWidget.search
137
+ if (searchConfig && Object.prototype.hasOwnProperty.call(searchConfig, "widgets") && searchConfig.widgets) {
138
+ for (let i = 0; i < searchConfig.widgets.length; i++) {
139
+ let oneSearch = searchConfig.widgets[i]
140
+ console.log("child-page-tm doSearch oneSearch:", oneSearch)
141
+ if (oneSearch && oneSearch.options.isRequired === '1' && oneSearch.options.qKey) {
142
+ // 时间范围选择框
143
+ if (oneSearch.options.searchType && oneSearch.options.searchType === SEARCH_DICT.MUlTI_DATE.id) {
144
+ if (!formParams[oneSearch.options.qKey + DATE_RANGE_PFIX.START] || !formParams[oneSearch.options.qKey + DATE_RANGE_PFIX.END]) {
145
+ emptySearchArr.push(oneSearch.name)
146
+ }
147
+ } else {
148
+ if (!formParams[oneSearch.options.qKey]) {
149
+ emptySearchArr.push(oneSearch.name)
150
+ }
151
+ }
152
+ }
153
+ }
154
+ }
155
+ return emptySearchArr
156
+
157
+ }
@@ -51,15 +51,17 @@ export default {
51
51
  params[qKey] = val.join()
52
52
  }
53
53
  } else {
54
- if (item.options.searchType === '50') {
54
+ if (item.options.searchType === SEARCH_DICT.SINGLE_DATE.id) {
55
55
  params[qKey] = moment(val).format(DEFAULT_DATE_FORMAT)
56
56
  } else {
57
57
  params[qKey] = val
58
58
  }
59
59
  }
60
- } else {
61
- params[qKey] = null
62
60
  }
61
+ // TODO:这里传null还是不传后面看下
62
+ // else {
63
+ // params[qKey] = null
64
+ // }
63
65
  }
64
66
  })
65
67
  }
@@ -1,27 +1,27 @@
1
1
  <!-- eslint-disable -->
2
2
  <template>
3
3
  <div>
4
- <div v-if="widget.options.searchType === '00'"> <!-- 输入框 -->
4
+ <div v-if="widget.options.searchType === searchDict.INPUT.id"> <!-- 输入框 -->
5
5
  <Input v-model="widget.options.val" class="query" placeholder="请输入" :clearable="true" />
6
6
  </div>
7
- <div v-else-if="widget.options.searchType === '01'"> <!-- 模糊输入框 -->
7
+ <div v-else-if="widget.options.searchType === searchDict.FUZZY_INPUT.id"> <!-- 模糊输入框 -->
8
8
  <Input v-model="widget.options.val" class="query" placeholder="请输入" :clearable="true" />
9
9
  </div>
10
- <div v-else-if="widget.options.searchType === 'A0'" class="not-show"> <!-- 隐形查询条件 -->
10
+ <div v-else-if="widget.options.searchType === searchDict.NOT_SHOW_INPUT.id" class="not-show"> <!-- 隐形查询条件 -->
11
11
  <Input v-model="widget.options.val" class="query" />
12
12
  </div>
13
- <div v-else-if="widget.options.searchType === '10'"> <!-- 单选下拉框 -->
13
+ <div v-else-if="widget.options.searchType === searchDict.SINGLE_SELECT.id"> <!-- 单选下拉框 -->
14
14
  <Select v-model="widget.options.val" class="query" filterable :clearable="true" placeholder="请选择">
15
15
  <Option v-for="(item, index) in widget.options.dataList" :key="index" :value="item.K"> {{ item.V }}</Option>
16
16
  </Select>
17
17
  </div>
18
- <div v-else-if="widget.options.searchType === '20'"> <!-- 多选下拉框 -->
18
+ <div v-else-if="widget.options.searchType === searchDict.MUlTI_SELECT.id"> <!-- 多选下拉框 -->
19
19
  <Select v-model="widget.options.val" class="query" filterable :clearable="true" placeholder="请选择" multiple
20
20
  :max-tag-count="1">
21
21
  <Option v-for="(item, index) in widget.options.dataList" :key="index" :value="item.K"> {{ item.V }}</Option>
22
22
  </Select>
23
23
  </div>
24
- <div v-else-if="widget.options.searchType === '30'"> <!-- 单选帮助框 -->
24
+ <div v-else-if="widget.options.searchType === searchDict.SINGLE_HELP.id"> <!-- 单选帮助框 -->
25
25
  <Input class="display-none" v-model="helpVal" />
26
26
  <Input class="query" v-model="helpValName" icon="ios-list-box-outline" readonly @on-click="showHelpBox"
27
27
  placeholder="请选择" />
@@ -30,7 +30,7 @@
30
30
  :row-key="helpRowIdKey" :row-name="helpRowNameKey" :selected-key="helpSelectKey" :multi-select="false"
31
31
  :help-box-search-params="helpSearchParams" @on-ok="onHelpOk" @onClear="onHelpClear"></HelpBox>
32
32
  </div>
33
- <div v-else-if="widget.options.searchType === '40'"> <!-- 多选帮助框 -->
33
+ <div v-else-if="widget.options.searchType === searchDict.MUlTI_HELP.id"> <!-- 多选帮助框 -->
34
34
  <Input class="display-none" v-model="helpVal" />
35
35
  <Input class="query" v-model="helpValName" icon="ios-list-box-outline" readonly @on-click="showHelpBox"
36
36
  placeholder="请选择" />
@@ -39,11 +39,11 @@
39
39
  :row-key="helpRowIdKey" :row-name="helpRowNameKey" :selected-key="helpSelectKey" :multi-select="true"
40
40
  :help-box-search-params="helpSearchParams" @on-ok="onHelpOk" @onClear="onHelpClear"></HelpBox>
41
41
  </div>
42
- <div v-else-if="widget.options.searchType === '50'"> <!-- 单日期选择框 -->
42
+ <div v-else-if="widget.options.searchType === searchDict.SINGLE_DATE.id"> <!-- 单日期选择框 -->
43
43
  <DatePicker v-model="widget.options.val" format="yyyy-MM-dd" placeholder="请选择" placement="bottom-end"
44
44
  class="query"></DatePicker>
45
45
  </div>
46
- <div v-else-if="widget.options.searchType === '51'"> <!-- 日期范围选择框 -->
46
+ <div v-else-if="widget.options.searchType === searchDict.MUlTI_DATE.id"> <!-- 日期范围选择框 -->
47
47
  <DatePicker v-model="widget.options.val" format="yyyy-MM-dd" placeholder="请选择" placement="bottom-end"
48
48
  class="query" type="daterange"></DatePicker>
49
49
  </div>
@@ -53,6 +53,7 @@
53
53
  /* eslint-disable */
54
54
  import HelpBox from "../../../pub/helpbox/index.vue"
55
55
  import biConfig from "../config/config"
56
+ import { SEARCH_DICT } from '../../../util/constants'
56
57
 
57
58
  export default {
58
59
  name: 'BiSearchItem',
@@ -99,7 +100,8 @@ export default {
99
100
  helpApiId: '',
100
101
  helpVal: null,
101
102
  helpValName: null,
102
- helpSearchParams: null
103
+ helpSearchParams: null,
104
+ searchDict: SEARCH_DICT
103
105
  }
104
106
  },
105
107
  methods: {
@@ -1,13 +1,13 @@
1
1
  <template>
2
- <DetailTableBi :data="data"></DetailTableBi>
2
+ <LamboDetailTableBi :data="data"></LamboDetailTableBi>
3
3
  </template>
4
4
  <script>
5
- import DetailTableBi from "../../../pub/table/detail-table/index.vue"
5
+ import LamboDetailTableBi from "../../../pub/table/detail-table/index.vue"
6
6
  import { getListMapData } from "../api/data"
7
7
 
8
8
  export default {
9
9
  name: "BiDetailTable",
10
- components: { DetailTableBi },
10
+ components: { LamboDetailTableBi },
11
11
  props: {
12
12
  widget: {
13
13
  type: Object,
@@ -45,11 +45,12 @@ export default {
45
45
  }
46
46
  },
47
47
  created() {
48
+ console.log("detail-table created params:", this.params)
48
49
  this.initConfig()
49
- this.doSearch()
50
50
  },
51
51
  mounted() {
52
-
52
+ // 组件渲染之前已经拿到该拿到的数据了
53
+ this.doSearch()
53
54
  },
54
55
  watch: {
55
56
  params: {
@@ -58,7 +59,7 @@ export default {
58
59
  this.doSearch()
59
60
  },
60
61
  deep: true
61
- },
62
+ }
62
63
  }
63
64
  }
64
65
  </script>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lambo-design-bi",
3
- "version": "0.0.150",
4
- "description": "",
3
+ "version": "0.0.152",
4
+ "description": "Vue2 BI 数据可视化组件库",
5
5
  "main": "index.js",
6
6
  "author": "finch",
7
7
  "license": "ISC",
@@ -16,20 +16,21 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "@lambo-design/core": "^4.7.1-beta.162",
19
+ "@lambo-design/detail-table": "^1.0.0-beta.23",
19
20
  "@lambo-design/file-list": "^1.0.0-beta.9",
21
+ "@lambo-design/page-container": "^1.0.0-beta.35",
20
22
  "@lambo-design/percent-progress": "^1.0.0-beta.9",
21
- "@lambo-design/shared": "^1.0.0-beta.283",
22
23
  "@lambo-design/query-filter": "^1.0.0-beta.38",
23
- "@lambo-design/detail-table": "^1.0.0-beta.23",
24
- "@lambo-design/page-container": "^1.0.0-beta.35",
24
+ "@lambo-design/shared": "^1.0.0-beta.283",
25
25
  "axios": "1.6.7",
26
26
  "core-js": "^3.8.3",
27
27
  "echarts": "^4.8.0",
28
28
  "element-ui": "^2.15.14",
29
+ "jszip": "^3.5.0",
29
30
  "moment": "^2.30.1",
31
+ "view-ui-plus": "^1.3.21",
30
32
  "xlsx": "^0.13.3",
31
- "xlsx-style": "^0.8.13",
32
- "jszip": "^3.5.0"
33
+ "xlsx-style": "^0.8.13"
33
34
  },
34
35
  "devDependencies": {
35
36
  "less": "^4.4.0",
@@ -0,0 +1,2 @@
1
+ import LamboNumberInfoBi from './number-info.vue'
2
+ export default LamboNumberInfoBi
@@ -0,0 +1,102 @@
1
+ <template>
2
+ <div class="ivu-number-info">
3
+ <div class="ivu-number-info-title-lambo" v-if="title || $slots.title">
4
+ <slot name="title">{{ title }}</slot>
5
+ </div>
6
+ <div class="ivu-number-info-subTitle" v-if="subTitle || $slots.subTitle">
7
+ <slot name="subTitle">{{ subTitle }}</slot>
8
+ </div>
9
+ <div class="ivu-number-info-value-lambo" :style="valueStyle">
10
+ <span class="ivu-number-info-total">
11
+ <slot name="num">{{ num }}</slot>
12
+ </span>
13
+ <span class="ivu-number-info-subTotal" v-if="subNum1 || subNum2">
14
+ <slot name="subNum">
15
+ <template v-if="subNum1">
16
+ <template v-if="trend1">
17
+ <Trend :flag="trend1" text-color>{{ subNum1 }}</Trend>
18
+ </template>
19
+ <template v-else>
20
+ {{ subNum1 }}
21
+ </template>
22
+ </template>
23
+ <template v-if="subNum2">
24
+ <template v-if="trend1">
25
+ <Trend :flag="trend2" text-color>{{ subNum2 }}</Trend>
26
+ </template>
27
+ <template v-else>
28
+ {{ subNum2 }}
29
+ </template>
30
+ </template>
31
+ </slot>
32
+ </span>
33
+ </div>
34
+ </div>
35
+ </template>
36
+ <script>
37
+ import { oneOf } from 'view-ui-plus/src/utils/assist'
38
+ import Trend from 'view-ui-plus/src/components/trend'
39
+ import 'view-ui-plus/dist/styles/viewuiplus.css'
40
+
41
+ export default {
42
+ name: 'LamboNumberInfoBi',
43
+ components: { Trend },
44
+ props: {
45
+ title: {
46
+ type: String
47
+ },
48
+ subTitle: {
49
+ type: String
50
+ },
51
+ num: {
52
+ type: [String, Number]
53
+ },
54
+ subNum1: {
55
+ type: [String, Number]
56
+ },
57
+ trend1: {
58
+ validator(value) {
59
+ return oneOf(value, ['up', 'down']);
60
+ }
61
+ },
62
+ subNum2: {
63
+ type: [String, Number]
64
+ },
65
+ trend2: {
66
+ validator(value) {
67
+ return oneOf(value, ['up', 'down']);
68
+ }
69
+ },
70
+ gap: {
71
+ type: [String, Number],
72
+ default: 6
73
+ }
74
+ },
75
+ computed: {
76
+ valueStyle() {
77
+ return {
78
+ 'margin-top': this.gap + 'px'
79
+ };
80
+ }
81
+ }
82
+ };
83
+ </script>
84
+ <style scoped lang="less">
85
+ .ivu-number-info-value-lambo {
86
+ margin-top: 4px;
87
+ overflow: hidden;
88
+ font-size: 0;
89
+ white-space: nowrap;
90
+ text-overflow: ellipsis;
91
+ word-break: break-all;
92
+ display: flex;
93
+ flex-direction: column;
94
+ }
95
+ .ivu-number-info-title-lambo {
96
+ margin-bottom: 9px;
97
+ color: #17233d;
98
+ font-size: 16px;
99
+ -webkit-transition: all .2s;
100
+ transition: all .2s
101
+ }
102
+ </style>
@@ -9,7 +9,7 @@
9
9
  import { LamboDetailTable, LamboDetailTableItem } from "@lambo-design/detail-table"
10
10
 
11
11
  export default {
12
- name: "DetailTableBi",
12
+ name: "LamboDetailTableBi",
13
13
  components: { LamboDetailTable, LamboDetailTableItem },
14
14
  props: {
15
15
  data: {
package/util/constants.js CHANGED
@@ -3,6 +3,10 @@ export const SEARCH_DICT = Object.freeze({
3
3
  id: "00",
4
4
  name: "输入框"
5
5
  },
6
+ FUZZY_INPUT: {
7
+ id: "01",
8
+ name: "模糊输入框"
9
+ },
6
10
  SINGLE_SELECT: {
7
11
  id: "10",
8
12
  name: "单选下拉框"
@@ -27,6 +31,10 @@ export const SEARCH_DICT = Object.freeze({
27
31
  id: "51",
28
32
  name: "日期范围帮助框"
29
33
  },
34
+ NOT_SHOW_INPUT: {
35
+ id: "A0",
36
+ name: "隐形输入框"
37
+ },
30
38
  })
31
39
 
32
40
  export const DATE_RANGE_PFIX = Object.freeze({
@@ -1,120 +0,0 @@
1
- <template>
2
- <div class="num-index">
3
- <div class="title">
4
- <span class="title-text">{{ title }}</span>
5
- <Poptip v-if="note" trigger="hover" placement="right-end" transfer word-wrap width="250" :content="note"
6
- class="title-icon">
7
- <Icon type="ios-information-circle-outline" />
8
- </Poptip>
9
- </div>
10
- <div class="content">
11
- <span class="value">{{ val }}</span>
12
- <span v-if="unit" class="unit">{{ unit }}</span>
13
- </div>
14
- <div class="extends">
15
- <div v-for="(item, index) in items" :key="index" class="extends-item">
16
- <p><span>{{ item.k_name }}&nbsp;</span><span>{{ item.val }}</span></p>
17
- </div>
18
- </div>
19
- </div>
20
- </template>
21
- <script>
22
-
23
- export default {
24
- name: "NumIndex",
25
- components: {},
26
- props: {
27
- title: {
28
- type: String,
29
- default: ''
30
- },
31
- val: {
32
- type: [String, Number],
33
- default: ''
34
- },
35
- unit: {
36
- type: String,
37
- default: ''
38
- },
39
- items: {
40
- type: Array,
41
- default: () => []
42
- },
43
- note: {
44
- type: String,
45
- default: ''
46
- }
47
- },
48
- data() {
49
- return {
50
-
51
- }
52
- },
53
- methods: {
54
-
55
- },
56
- created() {
57
-
58
- },
59
- mounted() {
60
-
61
- }
62
- }
63
- </script>
64
- <style scoped lang="less">
65
- .num-index {
66
- width: 257px;
67
-
68
- .title {
69
- font-size: 16px;
70
- position: relative;
71
- text-align: center;
72
-
73
- .title-text {
74
- display: inline-block;
75
- position: relative;
76
- z-index: 1
77
- }
78
-
79
- .title-icon {
80
- position: absolute;
81
- right: 0;
82
- width: 16px;
83
- height: 16px;
84
- line-height: 24px;
85
- }
86
- }
87
-
88
- .content {
89
- display: flex;
90
- flex-direction: row;
91
- justify-content: center;
92
- line-height: 50px;
93
- position: relative;
94
-
95
- .value {
96
- font-size: 35px;
97
- }
98
-
99
- .unit {
100
- font-size: 12px;
101
- position: absolute;
102
- right: 0;
103
- }
104
- }
105
-
106
- .extends {
107
- margin-left: 10px;
108
- display: flex;
109
- justify-content: center;
110
- flex-direction: row;
111
- flex-wrap: wrap;
112
- gap: 0 10px;
113
-
114
- .extends-item {
115
- font-size: 14px;
116
- color: #888;
117
- }
118
- }
119
- }
120
- </style>