lambo-design-bi 0.0.151 → 0.0.153

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>
@@ -2,28 +2,28 @@
2
2
  <template>
3
3
  <div>
4
4
  <div v-if="widget.options.searchType === searchDict.INPUT.id"> <!-- 输入框 -->
5
- <Input v-model="widget.options.val" class="query" placeholder="请输入" :clearable="true" />
5
+ <Input v-model="widget.options.val" class="lambo-query-class" placeholder="请输入" :clearable="true" />
6
6
  </div>
7
7
  <div v-else-if="widget.options.searchType === searchDict.FUZZY_INPUT.id"> <!-- 模糊输入框 -->
8
- <Input v-model="widget.options.val" class="query" placeholder="请输入" :clearable="true" />
8
+ <Input v-model="widget.options.val" class="lambo-query-class" placeholder="请输入" :clearable="true" />
9
9
  </div>
10
- <div v-else-if="widget.options.searchType === searchDict.NOT_SHOW_INPUT.id" class="not-show"> <!-- 隐形查询条件 -->
11
- <Input v-model="widget.options.val" class="query" />
10
+ <div v-else-if="widget.options.searchType === searchDict.NOT_SHOW_INPUT.id" class="lambo-display-none "> <!-- 隐形查询条件 -->
11
+ <Input v-model="widget.options.val" class="lambo-query-class" />
12
12
  </div>
13
13
  <div v-else-if="widget.options.searchType === searchDict.SINGLE_SELECT.id"> <!-- 单选下拉框 -->
14
- <Select v-model="widget.options.val" class="query" filterable :clearable="true" placeholder="请选择">
14
+ <Select v-model="widget.options.val" class="lambo-query-class" 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
18
  <div v-else-if="widget.options.searchType === searchDict.MUlTI_SELECT.id"> <!-- 多选下拉框 -->
19
- <Select v-model="widget.options.val" class="query" filterable :clearable="true" placeholder="请选择" multiple
19
+ <Select v-model="widget.options.val" class="lambo-query-class" 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
24
  <div v-else-if="widget.options.searchType === searchDict.SINGLE_HELP.id"> <!-- 单选帮助框 -->
25
- <Input class="display-none" v-model="helpVal" />
26
- <Input class="query" v-model="helpValName" icon="ios-list-box-outline" readonly @on-click="showHelpBox"
25
+ <Input class="lambo-display-none" v-model="helpVal" />
26
+ <Input class="lambo-query-class" v-model="helpValName" icon="ios-list-box-outline" readonly @on-click="showHelpBox"
27
27
  placeholder="请选择" />
28
28
 
29
29
  <HelpBox v-model="helpBoxShow" :title="widget.name" :columns="helpColumns" :url="helpBoxUrl"
@@ -31,8 +31,8 @@
31
31
  :help-box-search-params="helpSearchParams" @on-ok="onHelpOk" @onClear="onHelpClear"></HelpBox>
32
32
  </div>
33
33
  <div v-else-if="widget.options.searchType === searchDict.MUlTI_HELP.id"> <!-- 多选帮助框 -->
34
- <Input class="display-none" v-model="helpVal" />
35
- <Input class="query" v-model="helpValName" icon="ios-list-box-outline" readonly @on-click="showHelpBox"
34
+ <Input class="lambo-display-none" v-model="helpVal" />
35
+ <Input class="lambo-query-class" v-model="helpValName" icon="ios-list-box-outline" readonly @on-click="showHelpBox"
36
36
  placeholder="请选择" />
37
37
 
38
38
  <HelpBox v-model="helpBoxShow" :title="widget.name" :columns="helpColumns" :url="helpBoxUrl"
@@ -41,11 +41,11 @@
41
41
  </div>
42
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
- class="query"></DatePicker>
44
+ class="lambo-query-class"></DatePicker>
45
45
  </div>
46
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
- class="query" type="daterange"></DatePicker>
48
+ class="lambo-lambo-query-class-class" type="daterange"></DatePicker>
49
49
  </div>
50
50
  </div>
51
51
  </template>
@@ -208,7 +208,10 @@ export default {
208
208
  }
209
209
  </script>
210
210
  <style scoped>
211
- .not-show {
212
- display: none;
211
+ .lambo-display-none {
212
+ display: none
213
+ }
214
+ .lambo-query-class {
215
+ width: 200px;
213
216
  }
214
217
  </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.153",
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>