lambo-design-bi 0.0.131 → 0.0.133

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.
@@ -5,7 +5,7 @@
5
5
  {{ widget.options.title }}
6
6
  </template>
7
7
  <template v-for="(item, index) in widget.widgets">
8
- <component :is="getWidgetName(item)" :widget="item" :key="index">
8
+ <component :is="getWidgetName(item)" :widget="item" :key="index" :params="params">
9
9
  <template v-for="slot in Object.keys($scopedSlots)" v-slot:[slot]="scope">
10
10
  <slot :name="slot" v-bind="scope" />
11
11
  </template>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <el-col :span="(widget.options && widget.options.span) ? parseInt(widget.options.span) : 24">
3
3
  <template v-for="(item, index) in widget.widgets">
4
- <component :is="getWidgetName(item)" :widget="item" :key="index">
4
+ <component :is="getWidgetName(item)" :widget="item" :key="index" :params="params">
5
5
  <template v-for="slot in Object.keys($scopedSlots)" v-slot:[slot]="scope">
6
6
  <slot :name="slot" v-bind="scope" />
7
7
  </template>
@@ -19,6 +19,10 @@ export default {
19
19
  widget: {
20
20
  type: Object,
21
21
  default: () => ({})
22
+ },
23
+ params: {
24
+ type: Object,
25
+ default: () => ({})
22
26
  }
23
27
  },
24
28
  data() {
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <el-row class="custom-row" :gutter="(widget.options && widget.options.gutter) ? parseInt(widget.options.gutter) : 0">
3
3
  <template v-for="(item, index) in widget.widgets">
4
- <component :is="getWidgetName(item)" :widget="item" :key="index">
4
+ <component :is="getWidgetName(item)" :widget="item" :key="index" :params="params">
5
5
  <template v-for="slot in Object.keys($scopedSlots)" v-slot:[slot]="scope">
6
6
  <slot :name="slot" v-bind="scope" />
7
7
  </template>
@@ -19,6 +19,10 @@ export default {
19
19
  widget: {
20
20
  type: Object,
21
21
  default: () => ({})
22
+ },
23
+ params: {
24
+ type: Object,
25
+ default: () => ({})
22
26
  }
23
27
  },
24
28
  data() {
@@ -75,7 +75,7 @@ export default {
75
75
  // this.$router.push({ name: 'xxx' })
76
76
  },
77
77
  doSearch(params) {
78
- console.log("child-page-tm doSearch params:", params)
78
+ console.log("child-page-tm doSearch 1 params:", params)
79
79
  console.log("child-page-tm doSearch this.childPageWidget:", this.childPageWidget)
80
80
  let emptySearchArr = []
81
81
  // 增加前端校验是否必传
@@ -104,6 +104,7 @@ export default {
104
104
  return
105
105
  }
106
106
  this.params = deepCopy(params)
107
+ console.log("child-page-tm doSearch 2 this.params:", this.params)
107
108
  },
108
109
  setRouteConfig2Search(widgetData) {
109
110
  let routeConfig = this.$route.query || {}
@@ -115,7 +116,7 @@ export default {
115
116
  let searchType = item.options['searchType']
116
117
  let qKey = item.options['qKey']
117
118
  if (searchType === SEARCH_DICT.INPUT.id) {
118
- item['val'] = routeConfig[qKey]
119
+ item.options['val'] = routeConfig[qKey]
119
120
  } else if (searchType === SEARCH_DICT.SINGLE_SELECT.id) {
120
121
  let val = routeConfig[qKey]
121
122
  let valName = ''
@@ -131,8 +132,8 @@ export default {
131
132
  }
132
133
  }
133
134
  if (valName) {
134
- item['val'] = val
135
- item['valName'] = valName
135
+ item.options['val'] = val
136
+ item.options['valName'] = valName
136
137
  }
137
138
  }
138
139
  } else if (searchType === SEARCH_DICT.MUlTI_SELECT.id) {
@@ -150,8 +151,8 @@ export default {
150
151
  }
151
152
  }
152
153
  if (valNameArr && valNameArr.length > 0) {
153
- item['val'] = val
154
- item['valName'] = valNameArr.join()
154
+ item.options['val'] = valArr
155
+ item.options['valName'] = valNameArr.join()
155
156
  }
156
157
  }
157
158
  } else if (searchType === SEARCH_DICT.SINGLE_DATE.id) {
@@ -159,7 +160,7 @@ export default {
159
160
  if (val && val.indexOf('-') > 0) {
160
161
  val = moment(val).format("YYYYMMDD")
161
162
  }
162
- item['val'] = val
163
+ item.options['val'] = val
163
164
  } else if (searchType === SEARCH_DICT.MUlTI_DATE.id) {
164
165
  console.log("detail -- getPageConfig -- routeConfig:", routeConfig)
165
166
  let startDate = routeConfig[qKey + '_start']
@@ -61,7 +61,7 @@ export default {
61
61
  })
62
62
  },
63
63
  doSearch(params) {
64
- console.log("index-page-tm doSearch params:", params)
64
+ console.log("index-page-tm doSearch 1 params:", params)
65
65
  console.log("index-page-tm doSearch this.pageWidget:", this.pageWidget)
66
66
  let emptySearchArr = []
67
67
  // 增加前端校验是否必传
@@ -90,6 +90,7 @@ export default {
90
90
  return
91
91
  }
92
92
  this.params = deepCopy(params)
93
+ console.log("index-page-tm doSearch 2 this.params:", this.params)
93
94
  },
94
95
  },
95
96
  created() {
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div>
3
3
  <template v-for="(item, index) in widget.widgets">
4
- <component :is="getWidgetName(item)" :widget="item" :key="index">
4
+ <component :is="getWidgetName(item)" :widget="item" :key="index" :params="params">
5
5
  <template v-for="slot in Object.keys($scopedSlots)" v-slot:[slot]="scope">
6
6
  <slot :name="slot" v-bind="scope" />
7
7
  </template>
@@ -37,6 +37,15 @@ export default {
37
37
  },
38
38
  mounted() {
39
39
 
40
+ },
41
+ watch: {
42
+ params: {
43
+ handler: function (val, oldVal) {
44
+ console.log('page watch oldVal,val:', oldVal, val)
45
+
46
+ },
47
+ deep: true
48
+ },
40
49
  }
41
50
  }
42
51
  </script>
@@ -15,6 +15,7 @@ import LamboQueryFilter from "@lambo-design/query-filter"
15
15
  import { deepCopy } from "@lambo-design/shared/utils/assist"
16
16
  import moment from 'moment'
17
17
  import BiSearchItem from "./search-item.vue"
18
+ import { SEARCH_DICT, DATE_RANGE_PFIX, DEFAULT_DATE_FORMAT } from '../../../util/constants'
18
19
 
19
20
  export default {
20
21
  name: 'BiSearchForm',
@@ -34,33 +35,36 @@ export default {
34
35
  doSearch() {
35
36
  let params = {}
36
37
  let searchList = this.widget.widgets
37
- console.log("doSearch -- this.widget.widgets:", searchList)
38
+ console.log("search-from doSearch this.widget.widgets:", searchList)
38
39
  if (searchList) {
39
40
  searchList.map(item => {
40
- if (item.options && Object.prototype.hasOwnProperty.call(item, "val") && Object.prototype.hasOwnProperty.call(item, "qKey")) {
41
- let val = item.options.val
41
+ if (item.options && Object.prototype.hasOwnProperty.call(item.options, "qKey")) {
42
42
  let qKey = item.options.qKey
43
- if (val) {
43
+ if (Object.prototype.hasOwnProperty.call(item.options, "val") && item.options.val) {
44
+ let val = item.options.val
44
45
  if (Array.isArray(val)) {
45
- if (item.options.searchType === '51') {
46
+ if (item.options.searchType === SEARCH_DICT.MUlTI_DATE.id) {
46
47
  if (val && Array.isArray(val) && val.length === 2 && val[0] && val[1]) {
47
- params[qKey + '_start'] = moment(val[0]).format("YYYYMMDD")
48
- params[qKey + '_end'] = moment(val[1]).format("YYYYMMDD")
48
+ params[qKey + DATE_RANGE_PFIX.START] = moment(val[0]).format(DEFAULT_DATE_FORMAT)
49
+ params[qKey + DATE_RANGE_PFIX.END] = moment(val[1]).format(DEFAULT_DATE_FORMAT)
49
50
  }
50
51
  } else {
51
52
  params[qKey] = val.join()
52
53
  }
53
54
  } else {
54
55
  if (item.options.searchType === '50') {
55
- params[qKey] = moment(val).format("YYYYMMDD")
56
+ params[qKey] = moment(val).format(DEFAULT_DATE_FORMAT)
56
57
  } else {
57
58
  params[qKey] = val
58
59
  }
59
60
  }
61
+ } else {
62
+ params[qKey] = null
60
63
  }
61
64
  }
62
65
  })
63
66
  }
67
+ console.log("search-from doSearch params:", params)
64
68
  this.$emit("on-search", params)
65
69
  },
66
70
  onReset() {
@@ -177,7 +177,7 @@ export default {
177
177
  watch: {
178
178
  params: {
179
179
  handler: function (val, oldVal) {
180
- console.log('watch val,oldVal', val, oldVal)
180
+ console.log('paging-table watch oldVal,val:', oldVal, val)
181
181
  this.doSearch()
182
182
  },
183
183
  deep: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lambo-design-bi",
3
- "version": "0.0.131",
3
+ "version": "0.0.133",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "finch",