lambo-design-bi 0.0.149 → 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 +39 -107
- package/bi/widget/page/index-page-tm.vue +48 -33
- package/bi/widget/page/util/common.js +157 -0
- package/bi/widget/search/search-form.vue +9 -8
- 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);
|
|
@@ -6,9 +6,8 @@
|
|
|
6
6
|
<Button @click="goBack" type="primary" class="btn-margin" ghost>返回</Button>
|
|
7
7
|
</template>
|
|
8
8
|
|
|
9
|
-
<LamboIndicatorCardBiSearch v-if="
|
|
10
|
-
<BiSearchForm
|
|
11
|
-
@on-search="doSearch">
|
|
9
|
+
<LamboIndicatorCardBiSearch v-if="shouldShowLamboIndicator" :has-extend="false" :has-title="false">
|
|
10
|
+
<BiSearchForm :widget="childPageWidget.search" @on-search="doSearch">
|
|
12
11
|
</BiSearchForm>
|
|
13
12
|
</LamboIndicatorCardBiSearch>
|
|
14
13
|
|
|
@@ -28,9 +27,8 @@ import BiSearchForm from '../search/search-form.vue'
|
|
|
28
27
|
import LamboIndicatorCardBiSearch from '../container/card/comps/indicator-card/src/indicator-card-bi-search.vue'
|
|
29
28
|
import { getPageConfig } from '../api/config'
|
|
30
29
|
import { deepCopy } from "@lambo-design/shared/utils/assist"
|
|
31
|
-
import { SEARCH_DICT, DATE_RANGE_PFIX } from '../../../util/constants'
|
|
32
|
-
import moment from "moment/moment"
|
|
33
30
|
import { getWidgetName } from '../util/widget-map'
|
|
31
|
+
import { setRouteCfg2Search, getInitSearchRes, getSearchFormRes } from './util/common'
|
|
34
32
|
|
|
35
33
|
export default {
|
|
36
34
|
name: 'BiChildPageTm',
|
|
@@ -63,10 +61,14 @@ export default {
|
|
|
63
61
|
if (res.data.data) {
|
|
64
62
|
let pageWidgetTree = deepCopy(res.data.data)
|
|
65
63
|
this.pageTitle = pageWidgetTree.options.title || ''
|
|
64
|
+
|
|
66
65
|
console.log("获取页面配置 1:", pageWidgetTree)
|
|
67
|
-
this.
|
|
66
|
+
let routeConfig = this.$route.query || {}
|
|
67
|
+
setRouteCfg2Search(routeConfig, pageWidgetTree)
|
|
68
68
|
console.log("获取页面配置 2:", pageWidgetTree)
|
|
69
|
+
|
|
69
70
|
this.childPageWidget = deepCopy(pageWidgetTree)
|
|
71
|
+
this.initSearch()
|
|
70
72
|
} else {
|
|
71
73
|
console.error("获取页面配置[" + this.pageId + "]失败:配置数据为空")
|
|
72
74
|
return
|
|
@@ -82,113 +84,29 @@ export default {
|
|
|
82
84
|
// name从路由里面取
|
|
83
85
|
// this.$router.push({ name: 'xxx' })
|
|
84
86
|
},
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
let
|
|
89
|
-
// 增加前端校验是否必传
|
|
90
|
-
let searchConfig = this.childPageWidget.search
|
|
91
|
-
if (searchConfig && Object.prototype.hasOwnProperty.call(searchConfig, "widgets") && searchConfig.widgets) {
|
|
92
|
-
for (let i = 0; i < searchConfig.widgets.length; i++) {
|
|
93
|
-
let oneSearch = searchConfig.widgets[i]
|
|
94
|
-
console.log("child-page-tm doSearch oneSearch:", oneSearch)
|
|
95
|
-
if (oneSearch && oneSearch.options.isRequired === '1' && oneSearch.options.qKey) {
|
|
96
|
-
// 时间范围选择框
|
|
97
|
-
if (oneSearch.options.searchType && oneSearch.options.searchType === SEARCH_DICT.MUlTI_DATE.id) {
|
|
98
|
-
if (!params[oneSearch.options.qKey + DATE_RANGE_PFIX.START] || !params[oneSearch.options.qKey + DATE_RANGE_PFIX.END]) {
|
|
99
|
-
emptySearchArr.push(oneSearch.name)
|
|
100
|
-
}
|
|
101
|
-
} else {
|
|
102
|
-
if (!params[oneSearch.options.qKey]) {
|
|
103
|
-
emptySearchArr.push(oneSearch.name)
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
87
|
+
initSearch() {
|
|
88
|
+
let resObj = getInitSearchRes(this.childPageWidget)
|
|
89
|
+
let emptySearchArr = resObj['emptySearchArr']
|
|
90
|
+
let initParams = resObj['initParams']
|
|
109
91
|
if (emptySearchArr.length > 0) {
|
|
110
92
|
console.log("必选查询条件为空:", emptySearchArr)
|
|
111
93
|
this.$Message.warning({ content: "必选查询条件" + emptySearchArr.join() + "为空,请选择", duration: 1.8 })
|
|
112
94
|
return
|
|
113
95
|
}
|
|
114
|
-
this.params = deepCopy(
|
|
115
|
-
console.log("child-page-tm
|
|
96
|
+
this.params = deepCopy(initParams)
|
|
97
|
+
console.log("child-page-tm initSearch this.params:", this.params)
|
|
116
98
|
},
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
console.log("child-page-tm
|
|
120
|
-
|
|
121
|
-
if (
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
let qKey = item.options['qKey']
|
|
126
|
-
if (searchType === SEARCH_DICT.INPUT.id) {
|
|
127
|
-
item.options['val'] = routeConfig[qKey]
|
|
128
|
-
} else if (searchType === SEARCH_DICT.SINGLE_SELECT.id) {
|
|
129
|
-
let val = routeConfig[qKey]
|
|
130
|
-
let valName = ''
|
|
131
|
-
let selDataList = item.options['dataList']
|
|
132
|
-
if (val && selDataList) {
|
|
133
|
-
for (let i = 0; i < selDataList.length; i++) {
|
|
134
|
-
let selDataItem = selDataList[i]
|
|
135
|
-
if (selDataItem && Object.prototype.hasOwnProperty.call(selDataItem, "K") && Object.prototype.hasOwnProperty.call(selDataItem, "V")) {
|
|
136
|
-
if (selDataItem['K'] && selDataItem['K'] === val) {
|
|
137
|
-
valName = selDataItem['V']
|
|
138
|
-
break;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
if (valName) {
|
|
143
|
-
item.options['val'] = val
|
|
144
|
-
item.options['valName'] = valName
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
} else if (searchType === SEARCH_DICT.MUlTI_SELECT.id) {
|
|
148
|
-
let val = routeConfig[qKey]
|
|
149
|
-
let valNameArr = []
|
|
150
|
-
let selDataList = item.options['dataList']
|
|
151
|
-
if (val && selDataList) {
|
|
152
|
-
let valArr = val.split(',')
|
|
153
|
-
for (let i = 0; i < selDataList.length; i++) {
|
|
154
|
-
let selDataItem = selDataList[i]
|
|
155
|
-
if (selDataItem && Object.prototype.hasOwnProperty.call(selDataItem, "K") && Object.prototype.hasOwnProperty.call(selDataItem, "V")) {
|
|
156
|
-
if (selDataItem['K'] && valArr.includes(selDataItem['K'])) {
|
|
157
|
-
valNameArr.push(selDataItem['V'])
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
if (valNameArr && valNameArr.length > 0) {
|
|
162
|
-
item.options['val'] = valArr
|
|
163
|
-
item.options['valName'] = valNameArr.join()
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
} else if (searchType === SEARCH_DICT.SINGLE_DATE.id) {
|
|
167
|
-
let val = routeConfig[qKey]
|
|
168
|
-
if (val && val.indexOf('-') > 0) {
|
|
169
|
-
val = moment(val).format("YYYYMMDD")
|
|
170
|
-
}
|
|
171
|
-
item.options['val'] = val
|
|
172
|
-
} else if (searchType === SEARCH_DICT.MUlTI_DATE.id) {
|
|
173
|
-
console.log("detail -- getPageConfig -- routeConfig:", routeConfig)
|
|
174
|
-
let startDate = routeConfig[qKey + '_start']
|
|
175
|
-
console.log("detail -- getPageConfig -- startDate:", startDate)
|
|
176
|
-
if (startDate.indexOf('-') > 0) {
|
|
177
|
-
startDate = moment(startDate).format("YYYYMMDD") || ''
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
let endDate = routeConfig[qKey + '_end']
|
|
181
|
-
console.log("detail -- getPageConfig -- endDate:", endDate)
|
|
182
|
-
if (endDate.indexOf('-')) {
|
|
183
|
-
endDate = moment(endDate).format("YYYYMMDD") || ''
|
|
184
|
-
}
|
|
185
|
-
if (startDate && endDate) {
|
|
186
|
-
item.options['val'] = [startDate, endDate]
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
})
|
|
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
|
|
191
107
|
}
|
|
108
|
+
this.params = deepCopy(formParams)
|
|
109
|
+
console.log("child-page-tm doSearch 2 this.params:", this.params)
|
|
192
110
|
}
|
|
193
111
|
},
|
|
194
112
|
created() {
|
|
@@ -202,10 +120,24 @@ export default {
|
|
|
202
120
|
'$route'(to, from) {
|
|
203
121
|
// 只有 query 或 params 变化时执行逻辑(避免 path 相同但参数变化时无响应)
|
|
204
122
|
if (to.path === from.path && (to.query !== from.query || to.params !== from.params)) {
|
|
205
|
-
console.log("------------'$route'(to, from)
|
|
123
|
+
console.log("------------'$route'(to, from)------------")
|
|
206
124
|
this.getConfig()
|
|
207
125
|
}
|
|
208
126
|
}
|
|
127
|
+
},
|
|
128
|
+
computed: {
|
|
129
|
+
shouldShowLamboIndicator() {
|
|
130
|
+
if (!this.childPageWidget ||
|
|
131
|
+
!this.childPageWidget.search ||
|
|
132
|
+
!this.childPageWidget.search.widgets) {
|
|
133
|
+
return false
|
|
134
|
+
}
|
|
135
|
+
// 过滤出searchType不等于'A0'的widgets
|
|
136
|
+
const filteredWidgets = this.childPageWidget.search.widgets.filter(item =>
|
|
137
|
+
item && item.options && item.options.searchType !== 'A0'
|
|
138
|
+
)
|
|
139
|
+
return filteredWidgets.length > 0
|
|
140
|
+
}
|
|
209
141
|
}
|
|
210
142
|
}
|
|
211
143
|
</script>
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
<LamboPageContainer :has-footer="false" :has-header="pageTitle ? true : false">
|
|
4
4
|
<template #page-title>{{ pageTitle }}</template>
|
|
5
5
|
|
|
6
|
-
<LamboIndicatorCardBiSearch v-if="
|
|
7
|
-
<BiSearchForm
|
|
6
|
+
<LamboIndicatorCardBiSearch v-if="shouldShowLamboIndicator" :has-extend="false" :has-title="false">
|
|
7
|
+
<BiSearchForm :widget="pageWidget.search" @on-search="doSearch">
|
|
8
8
|
</BiSearchForm>
|
|
9
9
|
</LamboIndicatorCardBiSearch>
|
|
10
10
|
|
|
@@ -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,44 +78,50 @@ 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()
|
|
107
108
|
},
|
|
108
109
|
mounted() {
|
|
109
110
|
|
|
111
|
+
},
|
|
112
|
+
computed: {
|
|
113
|
+
shouldShowLamboIndicator() {
|
|
114
|
+
if (!this.pageWidget ||
|
|
115
|
+
!this.pageWidget.search ||
|
|
116
|
+
!this.pageWidget.search.widgets) {
|
|
117
|
+
return false
|
|
118
|
+
}
|
|
119
|
+
// 过滤出searchType不等于'A0'的widgets
|
|
120
|
+
const filteredWidgets = this.pageWidget.search.widgets.filter(item =>
|
|
121
|
+
item && item.options && item.options.searchType !== 'A0'
|
|
122
|
+
)
|
|
123
|
+
return filteredWidgets.length > 0
|
|
124
|
+
}
|
|
110
125
|
}
|
|
111
126
|
}
|
|
112
127
|
</script>
|
|
@@ -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
|
+
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div v-if="widget.widgets && widget.widgets.length > 0">
|
|
3
|
-
<LamboQueryFilter :default-rows="3" :label-width="145" :span="8" :hideResetButton="true" @do-search="doSearch"
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
<FormItem v-for="(item, index) in widget.widgets" :key="index" :label="item.name">
|
|
3
|
+
<LamboQueryFilter :default-rows="3" :label-width="145" :span="8" :hideResetButton="true" @do-search="doSearch" @on-reset="onReset">
|
|
4
|
+
<div v-for="(item, index) in widget.widgets" :key="index">
|
|
5
|
+
<FormItem v-if="item.options.searchType !== 'A0'" :label="item.name">
|
|
7
6
|
<BiSearchItem :widget="item"></BiSearchItem>
|
|
8
7
|
</FormItem>
|
|
9
|
-
</
|
|
8
|
+
</div>
|
|
10
9
|
</LamboQueryFilter>
|
|
11
10
|
</div>
|
|
12
11
|
</template>
|
|
@@ -52,15 +51,17 @@ export default {
|
|
|
52
51
|
params[qKey] = val.join()
|
|
53
52
|
}
|
|
54
53
|
} else {
|
|
55
|
-
if (item.options.searchType ===
|
|
54
|
+
if (item.options.searchType === SEARCH_DICT.SINGLE_DATE.id) {
|
|
56
55
|
params[qKey] = moment(val).format(DEFAULT_DATE_FORMAT)
|
|
57
56
|
} else {
|
|
58
57
|
params[qKey] = val
|
|
59
58
|
}
|
|
60
59
|
}
|
|
61
|
-
} else {
|
|
62
|
-
params[qKey] = null
|
|
63
60
|
}
|
|
61
|
+
// TODO:这里传null还是不传后面看下
|
|
62
|
+
// else {
|
|
63
|
+
// params[qKey] = null
|
|
64
|
+
// }
|
|
64
65
|
}
|
|
65
66
|
})
|
|
66
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({
|