lambo-design-bi 0.0.151 → 0.0.152

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,14 +1,15 @@
1
1
  <template>
2
- <num-index :title="widget.name" :val="numVal" :unit="unit" :items="items" :note="widget.options.note"></num-index>
2
+ <LamboNumberInfoBi :title="title" :sub-title="subTitle" :num="num" :sub-num1="subNum1" :trend1="trend1"
3
+ :sub-num2="subNum2" :trend2="trend2">
4
+ </LamboNumberInfoBi>
3
5
  </template>
4
6
  <script>
5
- import NumIndex from "../../../pub/num-index/num-index.vue"
6
7
  import { getListMapData } from "../api/data"
7
- import { formatNumLocale } from "../../../util/num-util"
8
+ import LamboNumberInfoBi from "../../../pub/number-info/index"
8
9
 
9
10
  export default {
10
11
  name: "BiNumIndex",
11
- components: { NumIndex },
12
+ components: { LamboNumberInfoBi },
12
13
  props: {
13
14
  widget: {
14
15
  type: Object,
@@ -21,25 +22,20 @@ export default {
21
22
  },
22
23
  data() {
23
24
  return {
24
- numVal: '',
25
- unit: '',
26
- /**
27
- * [
28
- * {"k_name": "同比", "val": "+12%"},
29
- * {"k_name": "环比", "val": "-12%"},
30
- * ]
31
- */
32
- kName1: '',
33
- kName2: '',
34
- items: [],
35
- apiId: '',
25
+ title: '',
26
+ apiId: null,
27
+ subTitle: null,
28
+ num: null,
29
+ subNum1: null,
30
+ trend1: null,
31
+ subNum2: null,
32
+ trend2: null
36
33
  }
37
34
  },
38
35
  methods: {
39
36
  initConfig() {
37
+ this.title = this.widget.options.title || this.widget.name || ''
40
38
  this.apiId = this.widget.options.apiId
41
- this.kName1 = this.widget.options.kName1 || ''
42
- this.kName2 = this.widget.options.kName2 || ''
43
39
  },
44
40
  doSearch() {
45
41
  if (!this.apiId) {
@@ -52,26 +48,13 @@ export default {
52
48
  } else {
53
49
  if (res.data.data.rows.length > 0) {
54
50
  let row = res.data.data.rows[0]
55
- /**
56
- * [
57
- * {"val": "457182134", "unit": "条", "extend_val1": "+12%", "extend_val2": "-12%", }
58
- * ]
59
- */
60
51
  if (row) {
61
- if (Object.prototype.hasOwnProperty.call(row, "val") && row['val']) {
62
- this.numVal = formatNumLocale(row.val)
63
- }
64
- if (Object.prototype.hasOwnProperty.call(row, "unit") && row['unit']) {
65
- this.unit = row['unit']
66
- }
67
- let itemArr = []
68
- if (Object.prototype.hasOwnProperty.call(row, "extend_val1") && row['extend_val1']) {
69
- itemArr.push({ "k_name": this.kName1, "val": row['extend_val1'] })
70
- }
71
- if (Object.prototype.hasOwnProperty.call(row, "extend_val2") && row['extend_val2']) {
72
- itemArr.push({ "k_name": this.kName2, "val": row['extend_val2'] })
73
- }
74
- this.items = itemArr
52
+ this.subTitle = row['sub_title']
53
+ this.num = row['num']
54
+ this.subNum1 = row['sub_num1']
55
+ this.trend1 = row['trend1']
56
+ this.subNum2 = row['sub_num2']
57
+ this.trend2 = row['trend2']
75
58
  }
76
59
  }
77
60
  }
@@ -81,6 +64,7 @@ export default {
81
64
  }
82
65
  },
83
66
  created() {
67
+ console.log("num-idx widget:", this.widget)
84
68
  this.initConfig()
85
69
  this.doSearch()
86
70
  },
@@ -98,4 +82,3 @@ export default {
98
82
  }
99
83
  }
100
84
  </script>
101
- <style scoped></style>
@@ -1,13 +1,13 @@
1
1
  <template>
2
- <DetailTableBi :data="data"></DetailTableBi>
2
+ <LamboDetailTableBi :data="data"></LamboDetailTableBi>
3
3
  </template>
4
4
  <script>
5
- import DetailTableBi from "../../../pub/table/detail-table/index.vue"
5
+ import LamboDetailTableBi from "../../../pub/table/detail-table/index.vue"
6
6
  import { getListMapData } from "../api/data"
7
7
 
8
8
  export default {
9
9
  name: "BiDetailTable",
10
- components: { DetailTableBi },
10
+ components: { LamboDetailTableBi },
11
11
  props: {
12
12
  widget: {
13
13
  type: Object,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lambo-design-bi",
3
- "version": "0.0.151",
4
- "description": "",
3
+ "version": "0.0.152",
4
+ "description": "Vue2 BI 数据可视化组件库",
5
5
  "main": "index.js",
6
6
  "author": "finch",
7
7
  "license": "ISC",
@@ -16,20 +16,21 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "@lambo-design/core": "^4.7.1-beta.162",
19
+ "@lambo-design/detail-table": "^1.0.0-beta.23",
19
20
  "@lambo-design/file-list": "^1.0.0-beta.9",
21
+ "@lambo-design/page-container": "^1.0.0-beta.35",
20
22
  "@lambo-design/percent-progress": "^1.0.0-beta.9",
21
- "@lambo-design/shared": "^1.0.0-beta.283",
22
23
  "@lambo-design/query-filter": "^1.0.0-beta.38",
23
- "@lambo-design/detail-table": "^1.0.0-beta.23",
24
- "@lambo-design/page-container": "^1.0.0-beta.35",
24
+ "@lambo-design/shared": "^1.0.0-beta.283",
25
25
  "axios": "1.6.7",
26
26
  "core-js": "^3.8.3",
27
27
  "echarts": "^4.8.0",
28
28
  "element-ui": "^2.15.14",
29
+ "jszip": "^3.5.0",
29
30
  "moment": "^2.30.1",
31
+ "view-ui-plus": "^1.3.21",
30
32
  "xlsx": "^0.13.3",
31
- "xlsx-style": "^0.8.13",
32
- "jszip": "^3.5.0"
33
+ "xlsx-style": "^0.8.13"
33
34
  },
34
35
  "devDependencies": {
35
36
  "less": "^4.4.0",
@@ -0,0 +1,2 @@
1
+ import LamboNumberInfoBi from './number-info.vue'
2
+ export default LamboNumberInfoBi
@@ -0,0 +1,102 @@
1
+ <template>
2
+ <div class="ivu-number-info">
3
+ <div class="ivu-number-info-title-lambo" v-if="title || $slots.title">
4
+ <slot name="title">{{ title }}</slot>
5
+ </div>
6
+ <div class="ivu-number-info-subTitle" v-if="subTitle || $slots.subTitle">
7
+ <slot name="subTitle">{{ subTitle }}</slot>
8
+ </div>
9
+ <div class="ivu-number-info-value-lambo" :style="valueStyle">
10
+ <span class="ivu-number-info-total">
11
+ <slot name="num">{{ num }}</slot>
12
+ </span>
13
+ <span class="ivu-number-info-subTotal" v-if="subNum1 || subNum2">
14
+ <slot name="subNum">
15
+ <template v-if="subNum1">
16
+ <template v-if="trend1">
17
+ <Trend :flag="trend1" text-color>{{ subNum1 }}</Trend>
18
+ </template>
19
+ <template v-else>
20
+ {{ subNum1 }}
21
+ </template>
22
+ </template>
23
+ <template v-if="subNum2">
24
+ <template v-if="trend1">
25
+ <Trend :flag="trend2" text-color>{{ subNum2 }}</Trend>
26
+ </template>
27
+ <template v-else>
28
+ {{ subNum2 }}
29
+ </template>
30
+ </template>
31
+ </slot>
32
+ </span>
33
+ </div>
34
+ </div>
35
+ </template>
36
+ <script>
37
+ import { oneOf } from 'view-ui-plus/src/utils/assist'
38
+ import Trend from 'view-ui-plus/src/components/trend'
39
+ import 'view-ui-plus/dist/styles/viewuiplus.css'
40
+
41
+ export default {
42
+ name: 'LamboNumberInfoBi',
43
+ components: { Trend },
44
+ props: {
45
+ title: {
46
+ type: String
47
+ },
48
+ subTitle: {
49
+ type: String
50
+ },
51
+ num: {
52
+ type: [String, Number]
53
+ },
54
+ subNum1: {
55
+ type: [String, Number]
56
+ },
57
+ trend1: {
58
+ validator(value) {
59
+ return oneOf(value, ['up', 'down']);
60
+ }
61
+ },
62
+ subNum2: {
63
+ type: [String, Number]
64
+ },
65
+ trend2: {
66
+ validator(value) {
67
+ return oneOf(value, ['up', 'down']);
68
+ }
69
+ },
70
+ gap: {
71
+ type: [String, Number],
72
+ default: 6
73
+ }
74
+ },
75
+ computed: {
76
+ valueStyle() {
77
+ return {
78
+ 'margin-top': this.gap + 'px'
79
+ };
80
+ }
81
+ }
82
+ };
83
+ </script>
84
+ <style scoped lang="less">
85
+ .ivu-number-info-value-lambo {
86
+ margin-top: 4px;
87
+ overflow: hidden;
88
+ font-size: 0;
89
+ white-space: nowrap;
90
+ text-overflow: ellipsis;
91
+ word-break: break-all;
92
+ display: flex;
93
+ flex-direction: column;
94
+ }
95
+ .ivu-number-info-title-lambo {
96
+ margin-bottom: 9px;
97
+ color: #17233d;
98
+ font-size: 16px;
99
+ -webkit-transition: all .2s;
100
+ transition: all .2s
101
+ }
102
+ </style>
@@ -9,7 +9,7 @@
9
9
  import { LamboDetailTable, LamboDetailTableItem } from "@lambo-design/detail-table"
10
10
 
11
11
  export default {
12
- name: "DetailTableBi",
12
+ name: "LamboDetailTableBi",
13
13
  components: { LamboDetailTable, LamboDetailTableItem },
14
14
  props: {
15
15
  data: {
@@ -1,120 +0,0 @@
1
- <template>
2
- <div class="num-index">
3
- <div class="title">
4
- <span class="title-text">{{ title }}</span>
5
- <Poptip v-if="note" trigger="hover" placement="right-end" transfer word-wrap width="250" :content="note"
6
- class="title-icon">
7
- <Icon type="ios-information-circle-outline" />
8
- </Poptip>
9
- </div>
10
- <div class="content">
11
- <span class="value">{{ val }}</span>
12
- <span v-if="unit" class="unit">{{ unit }}</span>
13
- </div>
14
- <div class="extends">
15
- <div v-for="(item, index) in items" :key="index" class="extends-item">
16
- <p><span>{{ item.k_name }}&nbsp;</span><span>{{ item.val }}</span></p>
17
- </div>
18
- </div>
19
- </div>
20
- </template>
21
- <script>
22
-
23
- export default {
24
- name: "NumIndex",
25
- components: {},
26
- props: {
27
- title: {
28
- type: String,
29
- default: ''
30
- },
31
- val: {
32
- type: [String, Number],
33
- default: ''
34
- },
35
- unit: {
36
- type: String,
37
- default: ''
38
- },
39
- items: {
40
- type: Array,
41
- default: () => []
42
- },
43
- note: {
44
- type: String,
45
- default: ''
46
- }
47
- },
48
- data() {
49
- return {
50
-
51
- }
52
- },
53
- methods: {
54
-
55
- },
56
- created() {
57
-
58
- },
59
- mounted() {
60
-
61
- }
62
- }
63
- </script>
64
- <style scoped lang="less">
65
- .num-index {
66
- width: 257px;
67
-
68
- .title {
69
- font-size: 16px;
70
- position: relative;
71
- text-align: center;
72
-
73
- .title-text {
74
- display: inline-block;
75
- position: relative;
76
- z-index: 1
77
- }
78
-
79
- .title-icon {
80
- position: absolute;
81
- right: 0;
82
- width: 16px;
83
- height: 16px;
84
- line-height: 24px;
85
- }
86
- }
87
-
88
- .content {
89
- display: flex;
90
- flex-direction: row;
91
- justify-content: center;
92
- line-height: 50px;
93
- position: relative;
94
-
95
- .value {
96
- font-size: 35px;
97
- }
98
-
99
- .unit {
100
- font-size: 12px;
101
- position: absolute;
102
- right: 0;
103
- }
104
- }
105
-
106
- .extends {
107
- margin-left: 10px;
108
- display: flex;
109
- justify-content: center;
110
- flex-direction: row;
111
- flex-wrap: wrap;
112
- gap: 0 10px;
113
-
114
- .extends-item {
115
- font-size: 14px;
116
- color: #888;
117
- }
118
- }
119
- }
120
- </style>