lambo-design-bi 0.0.164 → 0.0.166

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,8 @@ export default {
39
39
  pageTitle: '',
40
40
  childPageWidget: {},
41
41
  params: {},
42
- pageId: ''
42
+ pageId: '',
43
+ parentPageId: ''
43
44
  }
44
45
  },
45
46
  methods: {
@@ -48,9 +49,10 @@ export default {
48
49
  // 从路由参数中获取pageId
49
50
  console.log("child-page-tm getConfig this.$route:", this.$route)
50
51
  this.pageId = this.$route.query.pageId || ''
51
- if (!this.pageId) {
52
- console.error("pageId为空,请检查菜单配置:", this.pageId)
53
- this.$Message.error('pageId为空,请检查菜单配置')
52
+ this.parentPageId = this.$route.query.parentPageId || ''
53
+ if (!this.pageId || !this.parentPageId) {
54
+ console.error("pageId或者parentPageId为空,请检查菜单配置:", this.pageId)
55
+ this.$Message.error('pageId或者parentPageId为空,请检查菜单配置')
54
56
  return false
55
57
  }
56
58
  // 获取页面配置
@@ -79,10 +81,28 @@ export default {
79
81
  })
80
82
  },
81
83
  goBack() {
82
- this.$router.go(-1)
83
- // TODO: 或者跳转到指定路由
84
- // name从路由里面取
85
- // this.$router.push({ name: 'xxx' })
84
+ let routeConfig = this.$route || {}
85
+ console.log("child-page-tm goBack routeConfig:", routeConfig)
86
+ let parentRouteName = null
87
+ if (routeConfig && routeConfig.meta && routeConfig.meta.crumbs) {
88
+ let crumbs = routeConfig.meta.crumbs
89
+ if (crumbs && crumbs.length > 1) {
90
+ let parentRoute = crumbs[crumbs.length - 2]
91
+ if (parentRoute) {
92
+ parentRouteName = parentRoute.name || null
93
+ }
94
+ }
95
+ }
96
+ if (parentRouteName) {
97
+ console.log("child-page-tm goBack parentRouteName:", parentRouteName)
98
+ this.$router.push({
99
+ name: parentRouteName,
100
+ query: { pageId: this.parentPageId }
101
+ })
102
+ } else {
103
+ console.log("child-page-tm goBack history.back()")
104
+ this.$router.go(-1)
105
+ }
86
106
  },
87
107
  initSearch() {
88
108
  let resObj = getInitSearchRes(this.childPageWidget)
@@ -140,5 +160,6 @@ export default {
140
160
  }
141
161
  }
142
162
  }
163
+
143
164
  </script>
144
165
  <style scoped></style>
@@ -40,8 +40,10 @@ export default {
40
40
  this.$set(this.tableSearchParams, 'inJson', this.params)
41
41
  },
42
42
  goDetail(routerName, pageId, row) {
43
+ let parentPageId = this.widget.options.rootId || ''
43
44
  let newQuery = Object.assign({}, this.params, row);
44
45
  newQuery['pageId'] = pageId
46
+ newQuery['parentPageId'] = parentPageId
45
47
  console.log("goDetail newQuery:", newQuery)
46
48
  console.log("goDetail routerName:", routerName)
47
49
  this.$router.push({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lambo-design-bi",
3
- "version": "0.0.164",
3
+ "version": "0.0.166",
4
4
  "description": "Vue2 BI 数据可视化组件库",
5
5
  "main": "index.js",
6
6
  "author": "finch",