lambo-design-bi 0.0.1
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.
- package/bi/widget/README.md +18 -0
- package/bi/widget/api/data.js +48 -0
- package/bi/widget/atom/index.vue +36 -0
- package/bi/widget/atom/test.vue +36 -0
- package/bi/widget/config/config.js +7 -0
- package/bi/widget/container/card/card-widget.vue +46 -0
- package/bi/widget/container/card/comps/indicator-card/index.js +7 -0
- package/bi/widget/container/card/comps/indicator-card/src/indicator-card-bi-search.vue +132 -0
- package/bi/widget/container/card/comps/indicator-card/src/indicator-card-bi.vue +129 -0
- package/bi/widget/container/card/comps/indicator-card/src/indicator-card-item-bi.vue +97 -0
- package/bi/widget/container/card/comps/indicator-card/src/styles/css/card-search.less +108 -0
- package/bi/widget/container/card/comps/indicator-card/src/styles/css/card.less +114 -0
- package/bi/widget/layout/col.vue +35 -0
- package/bi/widget/layout/row.vue +40 -0
- package/bi/widget/num/index.vue +101 -0
- package/bi/widget/page/index.vue +38 -0
- package/bi/widget/search/search-form.vue +85 -0
- package/bi/widget/search/search-item.vue +205 -0
- package/bi/widget/table/detail-table.vue +65 -0
- package/bi/widget/table/paging-table.vue +188 -0
- package/bi/widget/util/widget-map.js +41 -0
- package/package.json +39 -0
- package/pub/charts/echarts.vue +57 -0
- package/pub/charts/factory/charts-factory.vue +58 -0
- package/pub/charts/factory/options.js +2351 -0
- package/pub/empty/index.vue +33 -0
- package/pub/helpbox/README.md +6 -0
- package/pub/helpbox/index.vue +363 -0
- package/pub/num-index/num-index.vue +120 -0
- package/pub/table/detail-table/index.vue +41 -0
- package/pub/table/paging-table/README.md +4 -0
- package/pub/table/paging-table/comps/export-data.vue +390 -0
- package/pub/table/paging-table/comps/export-drawer.vue +429 -0
- package/pub/table/paging-table/index.js +3 -0
- package/pub/table/paging-table/index.vue +1577 -0
- package/pub/table/paging-table/styles/css/index.less +190 -0
- package/pub/theme/color.js +3 -0
- package/util/math-util.js +71 -0
- package/util/num-util.js +16 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
@import "@lambo-design/core/src/styles/default.less";
|
|
2
|
+
|
|
3
|
+
.c-info {
|
|
4
|
+
background: var(--component-background, @_component-background);
|
|
5
|
+
border-radius: var(--border-radius-base, @_border-radius-base);
|
|
6
|
+
padding: 0;
|
|
7
|
+
margin-bottom: 8px;
|
|
8
|
+
|
|
9
|
+
&-bordered {
|
|
10
|
+
border: 1px solid var(--border-color-base, @_border-color-base);
|
|
11
|
+
border-color: var(--border-color-split, @_border-color-split);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&-shadow {
|
|
15
|
+
box-shadow: var(--shadow-base, @_shadow-base);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&:hover {
|
|
19
|
+
box-shadow: var(--shadow-base, @_shadow-base);
|
|
20
|
+
border-color: var(--border-color-split, @_border-color-split);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&&-dis-hover:hover {
|
|
24
|
+
box-shadow: none;
|
|
25
|
+
border-color: transparent;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&&-dis-hover&-bordered:hover {
|
|
29
|
+
border-color: var(--border-color-split, @_border-color-split);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&&-shadow:hover {
|
|
33
|
+
box-shadow: var(--shadow-base, @_shadow-base);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&:last-child {
|
|
37
|
+
margin-bottom: 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.ct-header {
|
|
41
|
+
background: var(--component-background, @_component-background);
|
|
42
|
+
overflow: hidden;
|
|
43
|
+
padding: 0px 8px;
|
|
44
|
+
border-radius: var(--border-radius-base, @_border-radius-base) var(--border-radius-base, @_border-radius-base) 0 0;
|
|
45
|
+
display: flex;
|
|
46
|
+
|
|
47
|
+
.ct-title {
|
|
48
|
+
color: var(--heading-color, @_heading-color);
|
|
49
|
+
font-weight: bold;
|
|
50
|
+
font-size: 15px;
|
|
51
|
+
line-height: 30px;
|
|
52
|
+
flex: 0 0 auto;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.center-title {
|
|
56
|
+
position: relative;
|
|
57
|
+
left: 50%;
|
|
58
|
+
transform: translateX(-50%);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.hd-extend {
|
|
62
|
+
font-size: 13px;
|
|
63
|
+
line-height: 30px;
|
|
64
|
+
flex: 1 1 auto;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.ct-extend {
|
|
68
|
+
font-size: 13px;
|
|
69
|
+
line-height: 30px;
|
|
70
|
+
flex: 0 0 auto;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.ct-toggle {
|
|
74
|
+
font-size: 13px;
|
|
75
|
+
line-height: 30px;
|
|
76
|
+
flex: 0 0 auto;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&.collapse {
|
|
80
|
+
border-radius: var(--border-radius-base, @_border-radius-base);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.ct-body {
|
|
85
|
+
background: var(--component-background, @_component-background);
|
|
86
|
+
border-radius: 0 0 var(--border-radius-base, @_border-radius-base) var(--border-radius-base, @_border-radius-base);
|
|
87
|
+
padding: 8px 8px;
|
|
88
|
+
|
|
89
|
+
display: flex; // 启用flex布局
|
|
90
|
+
flex-wrap: wrap; // 允许换行
|
|
91
|
+
justify-content: flex-start; // 元素间距均匀分布
|
|
92
|
+
align-items: flex-start; // 顶部对齐
|
|
93
|
+
gap: 8px;
|
|
94
|
+
|
|
95
|
+
&.no-border-top {
|
|
96
|
+
border-top: 0;
|
|
97
|
+
border-radius: var(--border-radius-base, @_border-radius-base);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.ivu-form-label-right {
|
|
101
|
+
.ivu-form-item {
|
|
102
|
+
.ivu-form-item-content {
|
|
103
|
+
button {
|
|
104
|
+
width: 88px;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.offset-padding {
|
|
112
|
+
padding: 0px 8px 8px 8px;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-col :span="(widget.options && widget.options.span) ? parseInt(widget.options.span) : 24">
|
|
3
|
+
<template v-for="(item, index) in widget.widgets">
|
|
4
|
+
<atom-widget :widget="item" :key="index"></atom-widget>
|
|
5
|
+
</template>
|
|
6
|
+
</el-col>
|
|
7
|
+
</template>
|
|
8
|
+
<script>
|
|
9
|
+
import AtomWidget from '../atom/index.vue'
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
name: "BiCol",
|
|
13
|
+
components: { AtomWidget },
|
|
14
|
+
props: {
|
|
15
|
+
widget: {
|
|
16
|
+
type: Object,
|
|
17
|
+
default: () => ({})
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
data() {
|
|
21
|
+
return {
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
methods: {
|
|
26
|
+
|
|
27
|
+
},
|
|
28
|
+
created() {
|
|
29
|
+
|
|
30
|
+
},
|
|
31
|
+
mounted() {
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
</script>
|
|
35
|
+
<style scoped></style>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-row class="custom-row" :gutter="(widget.options && widget.options.gutter) ? parseInt(widget.options.gutter) : 0">
|
|
3
|
+
<template v-for="(item, index) in widget.widgets">
|
|
4
|
+
<atom-widget :widget="item" :key="index"></atom-widget>
|
|
5
|
+
</template>
|
|
6
|
+
</el-row>
|
|
7
|
+
</template>
|
|
8
|
+
<script>
|
|
9
|
+
import AtomWidget from '../atom/index.vue'
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
name: "BiRow",
|
|
13
|
+
components: { AtomWidget },
|
|
14
|
+
props: {
|
|
15
|
+
widget: {
|
|
16
|
+
type: Object,
|
|
17
|
+
default: () => ({})
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
data() {
|
|
21
|
+
return {
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
methods: {
|
|
26
|
+
|
|
27
|
+
},
|
|
28
|
+
created() {
|
|
29
|
+
|
|
30
|
+
},
|
|
31
|
+
mounted() {
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
<style scoped>
|
|
37
|
+
.custom-row {
|
|
38
|
+
margin-bottom: 5px;
|
|
39
|
+
}
|
|
40
|
+
</style>
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<num-index :title="widget.name" :val="numVal" :unit="unit" :items="items" :note="widget.options.note"></num-index>
|
|
3
|
+
</template>
|
|
4
|
+
<script>
|
|
5
|
+
import NumIndex from "../../../pub/num-index/num-index.vue"
|
|
6
|
+
import { getListMapData } from "../api/data"
|
|
7
|
+
import { formatNumLocale } from "../../../util/num-util"
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
name: "BiNumIndex",
|
|
11
|
+
components: { NumIndex },
|
|
12
|
+
props: {
|
|
13
|
+
widget: {
|
|
14
|
+
type: Object,
|
|
15
|
+
default: () => ({})
|
|
16
|
+
},
|
|
17
|
+
params: {
|
|
18
|
+
type: Object,
|
|
19
|
+
default: () => ({})
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
data() {
|
|
23
|
+
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: '',
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
methods: {
|
|
39
|
+
initConfig() {
|
|
40
|
+
this.apiId = this.widget.options.apiId
|
|
41
|
+
this.kName1 = this.widget.options.kName1 || ''
|
|
42
|
+
this.kName2 = this.widget.options.kName2 || ''
|
|
43
|
+
},
|
|
44
|
+
doSearch() {
|
|
45
|
+
if (!this.apiId) {
|
|
46
|
+
this.$Message.warning("组件[" + this.widget.name + "]未配置数据接口")
|
|
47
|
+
return
|
|
48
|
+
}
|
|
49
|
+
getListMapData(this.apiId, this.params).then(res => {
|
|
50
|
+
if (res.data.code === 0) {
|
|
51
|
+
console.error("数据卡片的调用服务[" + this.widget.options.apiId + "]失败:" + res.data.message)
|
|
52
|
+
} else {
|
|
53
|
+
if (res.data.data.rows.length > 0) {
|
|
54
|
+
let row = res.data.data.rows[0]
|
|
55
|
+
/**
|
|
56
|
+
* [
|
|
57
|
+
* {"val": "457182134", "unit": "条", "extend_val1": "+12%", "extend_val2": "-12%", }
|
|
58
|
+
* ]
|
|
59
|
+
*/
|
|
60
|
+
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
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}).catch(err => {
|
|
79
|
+
console.error("数据卡片的调用服务[" + this.widget.options.apiId + "]异常:", err)
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
created() {
|
|
84
|
+
this.initConfig()
|
|
85
|
+
this.doSearch()
|
|
86
|
+
},
|
|
87
|
+
mounted() {
|
|
88
|
+
|
|
89
|
+
},
|
|
90
|
+
watch: {
|
|
91
|
+
params: {
|
|
92
|
+
handler: function (val, oldVal) {
|
|
93
|
+
console.log('BiNumIndex watch val,oldVal', val, oldVal)
|
|
94
|
+
this.doSearch()
|
|
95
|
+
},
|
|
96
|
+
deep: true
|
|
97
|
+
},
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
</script>
|
|
101
|
+
<style scoped></style>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<template v-for="(item, index) in widget.widgets">
|
|
4
|
+
<atom-widget :widget="item" :key="index" :params="params"></atom-widget>
|
|
5
|
+
</template>
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
<script>
|
|
9
|
+
import AtomWidget from '../atom/index.vue'
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
name: "BiPage",
|
|
13
|
+
components: { AtomWidget },
|
|
14
|
+
props: {
|
|
15
|
+
widget: {
|
|
16
|
+
type: Object,
|
|
17
|
+
default: () => ({})
|
|
18
|
+
},
|
|
19
|
+
params: {
|
|
20
|
+
type: Object,
|
|
21
|
+
default: () => ({})
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
data() {
|
|
25
|
+
return {}
|
|
26
|
+
},
|
|
27
|
+
methods: {
|
|
28
|
+
|
|
29
|
+
},
|
|
30
|
+
created() {
|
|
31
|
+
|
|
32
|
+
},
|
|
33
|
+
mounted() {
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
38
|
+
<style scoped></style>
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="widget">
|
|
3
|
+
<LamboQueryFilter :default-rows="3" :label-width="145" :span="8" :hideResetButton="true" @do-search="doSearch"
|
|
4
|
+
@on-reset="onReset">
|
|
5
|
+
<template v-if="widget.widgets">
|
|
6
|
+
<FormItem v-for="(item, index) in widget.widgets" :key="index" :label="item.name">
|
|
7
|
+
<BiSearchItem :widget="item"></BiSearchItem>
|
|
8
|
+
</FormItem>
|
|
9
|
+
</template>
|
|
10
|
+
</LamboQueryFilter>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
<script>
|
|
14
|
+
import LamboQueryFilter from "@lambo-design/query-filter"
|
|
15
|
+
import { deepCopy } from "@lambo-design/shared/utils/assist"
|
|
16
|
+
import moment from 'moment'
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
name: 'BiSearchForm',
|
|
20
|
+
components: { LamboQueryFilter },
|
|
21
|
+
props: {
|
|
22
|
+
widget: {
|
|
23
|
+
type: Object,
|
|
24
|
+
default: () => ({})
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
data() {
|
|
28
|
+
return {
|
|
29
|
+
cacheWidget: {}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
methods: {
|
|
33
|
+
doSearch() {
|
|
34
|
+
let params = {}
|
|
35
|
+
let searchList = this.widget.widgets
|
|
36
|
+
console.log("doSearch -- this.widget.widgets:", searchList)
|
|
37
|
+
if (searchList) {
|
|
38
|
+
searchList.map(item => {
|
|
39
|
+
if (item.options && Object.prototype.hasOwnProperty.call(item, "val") && Object.prototype.hasOwnProperty.call(item, "qKey")) {
|
|
40
|
+
let val = item.options.val
|
|
41
|
+
let qKey = item.options.qKey
|
|
42
|
+
if (val) {
|
|
43
|
+
if (Array.isArray(val)) {
|
|
44
|
+
if (item.options.searchType === '51') {
|
|
45
|
+
if (val && Array.isArray(val) && val.length === 2 && val[0] && val[1]) {
|
|
46
|
+
params[qKey + '_start'] = moment(val[0]).format("YYYYMMDD")
|
|
47
|
+
params[qKey + '_end'] = moment(val[1]).format("YYYYMMDD")
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
params[qKey] = val.join()
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
if (item.options.searchType === '50') {
|
|
54
|
+
params[qKey] = moment(val).format("YYYYMMDD")
|
|
55
|
+
} else {
|
|
56
|
+
params[qKey] = val
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
this.$emit("on-search", params)
|
|
64
|
+
},
|
|
65
|
+
onReset() {
|
|
66
|
+
if (this.cacheWidget && Object.prototype.hasOwnProperty.call(this.cacheWidget, "widgets")) {
|
|
67
|
+
let cacheSearchList = this.cacheWidget.widgets
|
|
68
|
+
console.log("onReset -- cacheSearchList:", cacheSearchList)
|
|
69
|
+
if (this.widget.widgets) {
|
|
70
|
+
this.$set(this.widget, 'widgets', cacheSearchList)
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
this.doSearch()
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
created() {
|
|
77
|
+
console.log("search-form created -- widget:", this.widget)
|
|
78
|
+
},
|
|
79
|
+
mounted() {
|
|
80
|
+
this.cacheWidget = deepCopy(this.widget)
|
|
81
|
+
this.doSearch();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
</script>
|
|
85
|
+
<style scoped></style>
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
<!-- eslint-disable -->
|
|
2
|
+
<template>
|
|
3
|
+
<div>
|
|
4
|
+
<div v-if="widget.options.searchType === '00'"> <!-- 输入框 -->
|
|
5
|
+
<Input v-model="widget.options.val" class="query" placeholder="请输入" :clearable="true" />
|
|
6
|
+
</div>
|
|
7
|
+
<div v-if="widget.options.searchType === '01'"> <!-- 输入框 -->
|
|
8
|
+
<Input v-model="widget.options.val" class="query" placeholder="请输入" :clearable="true" />
|
|
9
|
+
</div>
|
|
10
|
+
<div v-else-if="widget.options.searchType === '10'"> <!-- 单选下拉框 -->
|
|
11
|
+
<Select v-model="widget.options.val" class="query" filterable :clearable="true" placeholder="请选择">
|
|
12
|
+
<Option v-for="(item, index) in widget.options.dataList" :key="index" :value="item.K"> {{ item.V }}</Option>
|
|
13
|
+
</Select>
|
|
14
|
+
</div>
|
|
15
|
+
<div v-else-if="widget.options.searchType === '20'"> <!-- 多选下拉框 -->
|
|
16
|
+
<Select v-model="widget.options.val" class="query" filterable :clearable="true" placeholder="请选择" multiple
|
|
17
|
+
:max-tag-count="1">
|
|
18
|
+
<Option v-for="(item, index) in widget.options.dataList" :key="index" :value="item.K"> {{ item.V }}</Option>
|
|
19
|
+
</Select>
|
|
20
|
+
</div>
|
|
21
|
+
<div v-else-if="widget.options.searchType === '30'"> <!-- 单选帮助框 -->
|
|
22
|
+
<Input class="display-none" v-model="helpVal" />
|
|
23
|
+
<Input class="query" v-model="helpValName" icon="ios-list-box-outline" readonly @on-click="showHelpBox"
|
|
24
|
+
placeholder="请选择" />
|
|
25
|
+
|
|
26
|
+
<HelpBox v-model="helpBoxShow" :title="widget.name" :columns="helpColumns" :url="helpBoxUrl"
|
|
27
|
+
:row-key="helpRowIdKey" :row-name="helpRowNameKey" :selected-key="helpSelectKey" :multi-select="false"
|
|
28
|
+
:help-box-search-params="helpSearchParams" @on-ok="onHelpOk" @onClear="onHelpClear"></HelpBox>
|
|
29
|
+
</div>
|
|
30
|
+
<div v-else-if="widget.options.searchType === '40'"> <!-- 多选帮助框 -->
|
|
31
|
+
<Input class="display-none" v-model="helpVal" />
|
|
32
|
+
<Input class="query" v-model="helpValName" icon="ios-list-box-outline" readonly @on-click="showHelpBox"
|
|
33
|
+
placeholder="请选择" />
|
|
34
|
+
|
|
35
|
+
<HelpBox v-model="helpBoxShow" :title="widget.name" :columns="helpColumns" :url="helpBoxUrl"
|
|
36
|
+
:row-key="helpRowIdKey" :row-name="helpRowNameKey" :selected-key="helpSelectKey" :multi-select="true"
|
|
37
|
+
:help-box-search-params="helpSearchParams" @on-ok="onHelpOk" @onClear="onHelpClear"></HelpBox>
|
|
38
|
+
</div>
|
|
39
|
+
<div v-else-if="widget.options.searchType === '50'"> <!-- 单日期选择框 -->
|
|
40
|
+
<DatePicker v-model="widget.options.val" format="yyyy-MM-dd" placeholder="请选择" placement="bottom-end"
|
|
41
|
+
class="query"></DatePicker>
|
|
42
|
+
</div>
|
|
43
|
+
<div v-else-if="widget.options.searchType === '51'"> <!-- 日期范围选择框 -->
|
|
44
|
+
<DatePicker v-model="widget.options.val" format="yyyy-MM-dd" placeholder="请选择" placement="bottom-end"
|
|
45
|
+
class="query" type="daterange"></DatePicker>
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</template>
|
|
49
|
+
<script>
|
|
50
|
+
/* eslint-disable */
|
|
51
|
+
import HelpBox from "../../../pub/helpbox/index.vue"
|
|
52
|
+
import biConfig from "../config/config"
|
|
53
|
+
|
|
54
|
+
export default {
|
|
55
|
+
name: 'BiSearchItem',
|
|
56
|
+
components: { HelpBox },
|
|
57
|
+
props: {
|
|
58
|
+
/**
|
|
59
|
+
* {
|
|
60
|
+
* "id": "",
|
|
61
|
+
* "name": "单据状态",
|
|
62
|
+
* "type": "",
|
|
63
|
+
* "datas": [],
|
|
64
|
+
* "options": {
|
|
65
|
+
* "seq": 1,
|
|
66
|
+
* "type": "",
|
|
67
|
+
* "key": "",
|
|
68
|
+
* "columns": [],
|
|
69
|
+
* "url": "",
|
|
70
|
+
* "rowIdKey": "",
|
|
71
|
+
* "rowNameKey": "",
|
|
72
|
+
* "show": true,
|
|
73
|
+
* "selectKey": [],
|
|
74
|
+
* "helpSearch": {},
|
|
75
|
+
* val: '',
|
|
76
|
+
* valName: '',
|
|
77
|
+
* },
|
|
78
|
+
* pId: "",
|
|
79
|
+
* pType: "",
|
|
80
|
+
* isLeaf: "1"
|
|
81
|
+
* }
|
|
82
|
+
*/
|
|
83
|
+
widget: {
|
|
84
|
+
type: Object,
|
|
85
|
+
default: () => ({})
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
data() {
|
|
89
|
+
return {
|
|
90
|
+
helpBoxShow: false,
|
|
91
|
+
helpBoxUrl: '',
|
|
92
|
+
helpRowIdKey: '',
|
|
93
|
+
helpRowNameKey: '',
|
|
94
|
+
helpSelectKey: [],
|
|
95
|
+
helpColumns: [],
|
|
96
|
+
helpApiId: '',
|
|
97
|
+
helpVal: null,
|
|
98
|
+
helpValName: null,
|
|
99
|
+
helpSearchParams: null
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
methods: {
|
|
103
|
+
onHelpOk(res) {
|
|
104
|
+
console.log("onMultiHelpOk res:", res, this.widget)
|
|
105
|
+
let rowIdKey = this.helpRowIdKey
|
|
106
|
+
let rowNameKey = this.helpRowNameKey
|
|
107
|
+
if (this.widget.options.searchType === '40') {
|
|
108
|
+
let idNameObj = this.getValArrObj(rowIdKey, rowNameKey, res)
|
|
109
|
+
console.log("onMultiHelpOk onOk idNameObj:", idNameObj)
|
|
110
|
+
if (idNameObj) {
|
|
111
|
+
let idArr = idNameObj[rowIdKey]
|
|
112
|
+
let nameArr = idNameObj[rowNameKey]
|
|
113
|
+
if (idArr && nameArr) {
|
|
114
|
+
this.helpVal = idArr.join()
|
|
115
|
+
this.helpValName = nameArr.join()
|
|
116
|
+
|
|
117
|
+
this.widget.options.val = this.helpVal
|
|
118
|
+
this.widget.options.valName = this.helpValName
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
} else {
|
|
122
|
+
this.helpVal = res[rowIdKey]
|
|
123
|
+
this.helpValName = res[rowNameKey]
|
|
124
|
+
this.widget.options.val = this.helpVal
|
|
125
|
+
this.widget.options.valName = this.helpValName
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
onHelpClear() {
|
|
129
|
+
this.helpVal = ''
|
|
130
|
+
this.helpValName = ''
|
|
131
|
+
this.widget.options.val = ''
|
|
132
|
+
this.widget.options.valName = ''
|
|
133
|
+
},
|
|
134
|
+
showHelpBox() {
|
|
135
|
+
if (!this.helpApiId) {
|
|
136
|
+
this.helpApiId = this.widget.options.apiId
|
|
137
|
+
}
|
|
138
|
+
if (!this.helpRowIdKey || !this.helpRowNameKey) {
|
|
139
|
+
this.helpRowIdKey = this.widget.options.rowIdKey
|
|
140
|
+
this.helpRowNameKey = this.widget.options.rowNameKey
|
|
141
|
+
}
|
|
142
|
+
if (!this.helpColumns) {
|
|
143
|
+
this.helpColumns = this.widget.options.columns
|
|
144
|
+
}
|
|
145
|
+
if (!this.helpApiId) {
|
|
146
|
+
console.error("showHelpBox helpApiId为空:", this.helpApiId)
|
|
147
|
+
this.$Message.warning("查询条件的帮助框[" + this.widget.id + "-" + this.widget.name + "]未配置相关服务")
|
|
148
|
+
}
|
|
149
|
+
if (!this.helpRowIdKey || !this.helpRowNameKey) {
|
|
150
|
+
console.error("showHelpBox helpRowIdKey或者helpRowNameKey为空:", this.helpRowIdKey + this.helpRowNameKey)
|
|
151
|
+
this.$Message.warning("查询条件的帮助框[" + this.widget.id + "-" + this.widget.name + "]未配置列标识")
|
|
152
|
+
}
|
|
153
|
+
console.log("showHelpBox helpColumns:", this.helpColumns)
|
|
154
|
+
if (!this.helpColumns) {
|
|
155
|
+
console.error("showHelpBox helpColumns为空:", this.helpColumns)
|
|
156
|
+
this.$Message.warning("查询条件的帮助框[" + this.widget.id + "-" + this.widget.name + "]未配置列头")
|
|
157
|
+
}
|
|
158
|
+
this.widget.options.url = biConfig.dataServerContext + biConfig.dataServiceUri + this.helpApiId
|
|
159
|
+
this.helpBoxUrl = this.widget.options.url
|
|
160
|
+
console.log("showHelpBox url:", this.widget.options.url)
|
|
161
|
+
|
|
162
|
+
this.widget.options.show = true
|
|
163
|
+
this.helpBoxShow = true
|
|
164
|
+
},
|
|
165
|
+
getValArrObj(key1, key2, objArrData) {
|
|
166
|
+
console.log("key1, key2, objArrData:", key1, key2, objArrData)
|
|
167
|
+
let obj = {}
|
|
168
|
+
let outputObj = {}
|
|
169
|
+
if (key1) {
|
|
170
|
+
outputObj[key1] = []
|
|
171
|
+
}
|
|
172
|
+
if (key2) {
|
|
173
|
+
outputObj[key2] = []
|
|
174
|
+
}
|
|
175
|
+
if (objArrData && Array.isArray(objArrData) && objArrData.length > 0) {
|
|
176
|
+
|
|
177
|
+
obj = objArrData.reduce((acc, m) => {
|
|
178
|
+
if (m) {
|
|
179
|
+
if (key1) {
|
|
180
|
+
acc[key1].push(m[key1]);
|
|
181
|
+
}
|
|
182
|
+
if (key2) {
|
|
183
|
+
acc[key2].push(m[key2]);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
return acc
|
|
187
|
+
}, outputObj)
|
|
188
|
+
}
|
|
189
|
+
return obj
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
},
|
|
193
|
+
created() {
|
|
194
|
+
this.helpApiId = this.widget.options.apiId
|
|
195
|
+
this.helpColumns = this.widget.options.columns
|
|
196
|
+
this.helpRowIdKey = this.widget.options.rowIdKey
|
|
197
|
+
this.helpRowNameKey = this.widget.options.rowNameKey
|
|
198
|
+
this.helpSearchParams = this.widget.options.helpSearch
|
|
199
|
+
},
|
|
200
|
+
mounted() {
|
|
201
|
+
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
</script>
|
|
205
|
+
<style scoped></style>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<DetailTableBi :data="data"></DetailTableBi>
|
|
3
|
+
</template>
|
|
4
|
+
<script>
|
|
5
|
+
import DetailTableBi from "../../../pub/table/detail-table/index.vue"
|
|
6
|
+
import { getListMapData } from "../api/data"
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
name: "BiDetailTable",
|
|
10
|
+
components: { DetailTableBi },
|
|
11
|
+
props: {
|
|
12
|
+
widget: {
|
|
13
|
+
type: Object,
|
|
14
|
+
default: () => ({})
|
|
15
|
+
},
|
|
16
|
+
params: {
|
|
17
|
+
type: Object,
|
|
18
|
+
default: () => ({})
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
data() {
|
|
22
|
+
return {
|
|
23
|
+
apiId: '',
|
|
24
|
+
data: []
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
methods: {
|
|
28
|
+
initConfig() {
|
|
29
|
+
this.apiId = this.widget.options.apiId
|
|
30
|
+
},
|
|
31
|
+
doSearch() {
|
|
32
|
+
if (!this.apiId) {
|
|
33
|
+
this.$Message.warning("组件[" + this.widget.name + "]未配置数据接口")
|
|
34
|
+
return
|
|
35
|
+
}
|
|
36
|
+
getListMapData(this.apiId, this.params).then(res => {
|
|
37
|
+
if (res.data.code !== 1) {
|
|
38
|
+
console.error("明细表格的调用服务[" + this.widget.options.apiId + "]失败:", res)
|
|
39
|
+
} else {
|
|
40
|
+
this.data = res.data.data.rows || []
|
|
41
|
+
}
|
|
42
|
+
}).catch(err => {
|
|
43
|
+
console.error("明细表格的调用服务[" + this.widget.options.apiId + "]异常:", err)
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
created() {
|
|
48
|
+
this.initConfig()
|
|
49
|
+
this.doSearch()
|
|
50
|
+
},
|
|
51
|
+
mounted() {
|
|
52
|
+
|
|
53
|
+
},
|
|
54
|
+
watch: {
|
|
55
|
+
params: {
|
|
56
|
+
handler: function (val, oldVal) {
|
|
57
|
+
console.log('BiDetailTable watch val,oldVal=', val, oldVal)
|
|
58
|
+
this.doSearch()
|
|
59
|
+
},
|
|
60
|
+
deep: true
|
|
61
|
+
},
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
</script>
|
|
65
|
+
<style scoped></style>
|