lambo-design-bi 0.0.173 → 0.0.175

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.
@@ -1,11 +1,12 @@
1
1
  <template>
2
2
  <LamboNumberInfoBi :title="title" :sub-title="subTitle" :num="num" :sub-num1="subNum1" :trend1="trend1"
3
- :sub-num2="subNum2" :trend2="trend2" :polar1="polar1" :polar2="polar2">
3
+ :is-drill="isDrill" @on-drill="onDrill" :sub-num2="subNum2" :trend2="trend2" :polar1="polar1" :polar2="polar2">
4
4
  </LamboNumberInfoBi>
5
5
  </template>
6
6
  <script>
7
7
  import { getListMapData } from "../api/data"
8
8
  import LamboNumberInfoBi from "../../../pub/number-info/index"
9
+ import { pageDrill } from '../util/router-util';
9
10
 
10
11
  export default {
11
12
  name: "BiNumIndex",
@@ -31,13 +32,27 @@ export default {
31
32
  polar1: null,
32
33
  subNum2: null,
33
34
  trend2: null,
34
- polar2: null
35
+ polar2: null,
36
+ isDrill: false,
37
+ toPageId: null,
38
+ toRouteName: null,
39
+ drillK1: null,
40
+ drillV1: null,
41
+ drillK2: null,
42
+ drillV2: null,
43
+ drillK3: null,
44
+ dirllV3: null
35
45
  }
36
46
  },
37
47
  methods: {
38
48
  initConfig() {
39
49
  this.title = this.widget.options.title || this.widget.name || ''
40
50
  this.apiId = this.widget.options.apiId
51
+ this.toPageId = this.widget.options.toPageId
52
+ this.toRouteName = this.widget.options.toRouteName
53
+ if (this.toPageId && this.toRouteName) {
54
+ this.isDrill = true
55
+ }
41
56
  },
42
57
  doSearch() {
43
58
  if (!this.apiId) {
@@ -61,7 +76,19 @@ export default {
61
76
  this.polar1 = row['polar1']
62
77
  }
63
78
  if (Object.prototype.hasOwnProperty.call(row, 'polar2')) {
64
- this.polar2 = row['polar2']
79
+ this.polar2 = row['polar2']
80
+ }
81
+ if (Object.prototype.hasOwnProperty.call(row, 'drill_k1') && Object.prototype.hasOwnProperty.call(row, 'drill_v1')) {
82
+ this.drillK1 = row['drill_k1'] || ''
83
+ this.drillV1 = row['drill_v1'] || ''
84
+ }
85
+ if (Object.prototype.hasOwnProperty.call(row, 'drill_k2') && Object.prototype.hasOwnProperty.call(row, 'drill_v2')) {
86
+ this.drillK2 = row['drill_k2'] || ''
87
+ this.drillV2 = row['drill_v2'] || ''
88
+ }
89
+ if (Object.prototype.hasOwnProperty.call(row, 'drill_k3') && Object.prototype.hasOwnProperty.call(row, 'drill_v3')) {
90
+ this.drillK3 = row['drill_k3'] || ''
91
+ this.drillV3 = row['drill_v3'] || ''
65
92
  }
66
93
  }
67
94
  }
@@ -69,6 +96,32 @@ export default {
69
96
  }).catch(err => {
70
97
  console.error("数据卡片的调用服务[" + this.widget.options.apiId + "]异常:", err)
71
98
  })
99
+ },
100
+ async onDrill(obj) {
101
+ let drillKV = {}
102
+ if (this.drillK1 && this.drillV1) {
103
+ drillKV[this.drillK1] = this.drillV1
104
+ }
105
+ if (this.drillK2 && this.drillV2) {
106
+ drillKV[this.drillK2] = this.drillV2
107
+ }
108
+ if (this.drillK3 && this.drillV3) {
109
+ drillKV[this.drillK3] = this.drillV3
110
+ }
111
+ let drillParams = Object.assign({}, this.params, obj, drillKV)
112
+ try {
113
+ await pageDrill(
114
+ this.$router,
115
+ this.widget.rootId,
116
+ this.toPageId,
117
+ this.toRouteName,
118
+ drillParams
119
+ )
120
+ console.log('number 跳转成功')
121
+ } catch (error) {
122
+ console.error('num 跳转失败:', error.msg)
123
+ this.$message.error(error.msg)
124
+ }
72
125
  }
73
126
  },
74
127
  created() {
@@ -153,5 +153,4 @@ export function getSearchFormRes(formParams, pageWidget) {
153
153
  }
154
154
  }
155
155
  return emptySearchArr
156
-
157
156
  }
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div style="width: 100%">
3
3
  <LamboPagingTableBi ref="table" :auto-search="false" :columns="columns" :dataUrl="widget.options.url"
4
- :export-batch-size="20000" :show-table-option="true" :exportName="widget.name"
4
+ :export-batch-size="20000" :show-table-option="false" :exportName="widget.name"
5
5
  :page-disable="widget.options.isPaging === '0'" :page-size="widget.options.pageSize" :export-request-limit="200"
6
6
  :isSingleSelectModel="true" :showSummary="widget.options.isPageSum === '1'" :summary-method="handleSummary"
7
7
  @on-data-load="onDataLoad" :searchParams="tableSearchParams">
@@ -41,7 +41,7 @@ export default {
41
41
  },
42
42
  goDetail(routerName, pageId, row) {
43
43
  let parentPageId = this.widget.rootId || ''
44
- let newQuery = Object.assign({}, this.params, row);
44
+ let newQuery = Object.assign({}, this.params, row)
45
45
  newQuery['pageId'] = pageId
46
46
  newQuery['parentPageId'] = parentPageId
47
47
  console.log("goDetail newQuery:", newQuery)
@@ -0,0 +1,101 @@
1
+ /**
2
+ * 下钻页公共方法 (Promise)
3
+ *
4
+ * @param {*} router Vue Router 实例
5
+ * @param {*} fromPageId 源页面ID
6
+ * @param {*} toPageId 目标页面ID
7
+ * @param {*} toRouteName 目标路由名称
8
+ * @param {*} dataObj 传递的数据对象
9
+ * @returns {Promise} 返回Promise对象
10
+ */
11
+ export function pageDrill(router, fromPageId, toPageId, toRouteName, dataObj = {}) {
12
+ return new Promise((resolve, reject) => {
13
+ // 参数验证
14
+ if (!fromPageId) {
15
+ const error = {
16
+ code: RES_CODE.PARAM_ERROR,
17
+ msg: "页面跳转失败,跳转参数源页面编码为空",
18
+ data: fromPageId
19
+ }
20
+ console.error("drill 参数 fromPageId 无效:", fromPageId)
21
+ reject(error)
22
+ return
23
+ }
24
+ if (!toPageId) {
25
+ const error = {
26
+ code: RES_CODE.PARAM_ERROR,
27
+ msg: "页面跳转失败,跳转参数目标页面编码为空",
28
+ data: toPageId
29
+ }
30
+ console.error("drill 参数 toPageId 无效:", toPageId)
31
+ reject(error)
32
+ return
33
+ }
34
+ if (!toRouteName) {
35
+ const error = {
36
+ code: RES_CODE.PARAM_ERROR,
37
+ msg: "页面跳转失败,跳转参数目标路由名称为空",
38
+ data: toRouteName
39
+ }
40
+ console.error("drill 参数 toRouteName 无效:", toRouteName)
41
+ reject(error)
42
+ return
43
+ }
44
+
45
+ // 构造查询参数
46
+ const drillParams = {
47
+ ...dataObj,
48
+ pageId: toPageId,
49
+ parentPageId: fromPageId,
50
+ toRouteName: toRouteName
51
+ }
52
+ console.log("drill 下钻跳转参数 drillParams:", drillParams)
53
+
54
+ // 执行跳转
55
+ router.push({
56
+ name: toRouteName,
57
+ query: drillParams
58
+ })
59
+ .then(() => {
60
+ resolve({
61
+ code: RES_CODE.SUCCESS,
62
+ msg: "页面跳转成功",
63
+ data: null
64
+ })
65
+ })
66
+ .catch(error => {
67
+ console.error("drill 页面跳转失败:", error)
68
+
69
+ let errorMsg = "页面跳转失败,未知原因跳转失败"
70
+ let errorCode = RES_CODE.PAGE_ERROR
71
+
72
+ if (error.name === 'NavigationDuplicated') {
73
+ errorMsg = "页面跳转失败,跳转同一页面"
74
+ } else if (error.message && error.message.includes('not found')) {
75
+ errorMsg = "页面跳转失败,页面不存在"
76
+ }
77
+
78
+ reject({
79
+ code: errorCode,
80
+ msg: errorMsg,
81
+ data: error
82
+ })
83
+ })
84
+ })
85
+ }
86
+
87
+ /**
88
+ * 返回状态码
89
+ */
90
+ export const RES_CODE = {
91
+ // 成功
92
+ SUCCESS: 1,
93
+ // 未知原因失败
94
+ UNKNOWN_ERROR: 0,
95
+ // 参数异常
96
+ PARAM_ERROR: 1001,
97
+ // 页面异常
98
+ PAGE_ERROR: 3001,
99
+ // 系统异常
100
+ SYSTEM_ERROR: 5001
101
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lambo-design-bi",
3
- "version": "0.0.173",
3
+ "version": "0.0.175",
4
4
  "description": "Vue2 BI 数据可视化组件库",
5
5
  "main": "index.js",
6
6
  "author": "finch",
@@ -1398,11 +1398,14 @@ export function getECharts(type, dataX, dataY, dataDim) {
1398
1398
  })
1399
1399
  sum += dataY[0][i]
1400
1400
  }
1401
-
1401
+ let title33 = ''
1402
+ if(dataDim && dataDim.length > 0){
1403
+ title33 = formatTitle(dataDim[0])
1404
+ }
1402
1405
  opt = {
1403
1406
  backgroundColor: '#fff',
1404
1407
  title: {
1405
- text: formatTitle(dataDim[0]),
1408
+ text: title33,
1406
1409
  textAlign: 'center',
1407
1410
  textStyle: {
1408
1411
  fontSize: '10px',
@@ -1519,10 +1522,14 @@ export function getECharts(type, dataX, dataY, dataDim) {
1519
1522
  'value': dataY[0][i],
1520
1523
  });
1521
1524
  }
1525
+ let title34 = ''
1526
+ if(dataDim && dataDim.length > 0){
1527
+ title34 = formatTitle(dataDim[0])
1528
+ }
1522
1529
  opt = {
1523
1530
  backgroundColor: '#fff',
1524
1531
  title: {
1525
- text: formatTitle(dataDim[0]),
1532
+ text: title34,
1526
1533
  textAlign: 'center',
1527
1534
  textStyle: {
1528
1535
  fontSize: '10px',
@@ -1,9 +1,11 @@
1
1
  <template>
2
2
  <div class="ivu-number-info">
3
- <div class="ivu-number-info-title-lambo" v-if="title || $slots.title">
3
+ <div class="ivu-number-info-title-lambo title-div"
4
+ :class="{ 'isDrill': isDrill }" v-if="title || $slots.title" @click="drill">
4
5
  <slot name="title">{{ title }}</slot>
6
+ <Icon v-if="isDrill" type="ios-redo-outline" />
5
7
  </div>
6
- <div class="ivu-number-info-subTitle" v-if="subTitle || $slots.subTitle">
8
+ <div v-if="subTitle" class="ivu-number-info-subTitle">
7
9
  <slot name="subTitle">{{ subTitle }}</slot>
8
10
  </div>
9
11
  <div class="ivu-number-info-value-lambo" :style="valueStyle">
@@ -56,7 +58,8 @@ export default {
56
58
  type: String
57
59
  },
58
60
  subTitle: {
59
- type: String
61
+ type: String,
62
+ default: ''
60
63
  },
61
64
  num: {
62
65
  type: [String, Number]
@@ -71,7 +74,7 @@ export default {
71
74
  },
72
75
  polar1: {
73
76
  type: String,
74
- required: false,
77
+ required: false,
75
78
  validator(value) {
76
79
  return !value || ['pos', 'neg'].includes(value);
77
80
  }
@@ -86,7 +89,7 @@ export default {
86
89
  },
87
90
  polar2: {
88
91
  type: String,
89
- required: false,
92
+ required: false,
90
93
  validator(value) {
91
94
  return !value || ['pos', 'neg'].includes(value);
92
95
  }
@@ -94,6 +97,10 @@ export default {
94
97
  gap: {
95
98
  type: [String, Number],
96
99
  default: 6
100
+ },
101
+ isDrill: {
102
+ type: Boolean,
103
+ default: false
97
104
  }
98
105
  },
99
106
  computed: {
@@ -102,6 +109,12 @@ export default {
102
109
  'margin-top': this.gap + 'px'
103
110
  };
104
111
  }
112
+ },
113
+ methods: {
114
+ drill() {
115
+ console.log("number-info 点击了下钻按钮")
116
+ this.$emit('on-drill', {})
117
+ }
105
118
  }
106
119
  };
107
120
  </script>
@@ -124,4 +137,20 @@ export default {
124
137
  -webkit-transition: all .2s;
125
138
  transition: all .2s
126
139
  }
140
+
141
+ .title-div {
142
+ display: flex;
143
+ justify-content: space-between;
144
+ align-items: center;
145
+ transition: all 0.2s ease;
146
+ border-radius: 5px;
147
+ }
148
+
149
+ .title-div.isDrill {
150
+ cursor: pointer;
151
+ }
152
+
153
+ .title-div.isDrill:hover {
154
+ transform: scale(1.02);
155
+ }
127
156
  </style>
@@ -218,7 +218,7 @@
218
218
  </div>
219
219
  </Col>
220
220
  </Row>
221
- <Row style="margin-top:10px;">
221
+ <Row>
222
222
  <Col span="24">
223
223
  <Table v-if="hackReset" ref="tableRef" :border="tableBorder" :columns="tableColumns" :data="tableData"
224
224
  :disabledHover="disabledHover" :draggable="draggable" :height="tableHeight" :max-height="tableMaxHeight"