lambo-design-bi 0.0.150 → 0.0.151
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.
- package/bi/widget/container/card/card-widget.vue +1 -1
- package/bi/widget/container/card/comps/indicator-card/src/styles/css/card.less +1 -7
- package/bi/widget/page/child-page-tm.vue +23 -104
- package/bi/widget/page/index-page-tm.vue +32 -31
- package/bi/widget/page/util/common.js +157 -0
- package/bi/widget/search/search-form.vue +5 -3
- package/bi/widget/search/search-item.vue +12 -10
- package/bi/widget/table/detail-table.vue +4 -3
- package/package.json +1 -1
- package/util/constants.js +8 -0
|
@@ -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);
|
|
@@ -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.
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
let
|
|
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(
|
|
114
|
-
console.log("child-page-tm
|
|
96
|
+
this.params = deepCopy(initParams)
|
|
97
|
+
console.log("child-page-tm initSearch this.params:", this.params)
|
|
115
98
|
},
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
console.log("child-page-tm
|
|
119
|
-
|
|
120
|
-
if (
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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
|
-
|
|
59
|
-
|
|
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.
|
|
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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
let
|
|
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(
|
|
102
|
-
console.log("index-page-tm
|
|
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 ===
|
|
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 ===
|
|
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 ===
|
|
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 ===
|
|
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 ===
|
|
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 ===
|
|
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 ===
|
|
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 ===
|
|
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 ===
|
|
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 ===
|
|
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: {
|
|
@@ -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
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({
|