lambo-design-bi 0.0.199 → 0.0.200

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.
@@ -7,7 +7,8 @@
7
7
  <div v-else-if="widget.options.searchType === searchDict.FUZZY_INPUT.id"> <!-- 模糊输入框 -->
8
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="lambo-display-none "> <!-- 隐形查询条件 -->
10
+ <div v-else-if="widget.options.searchType === searchDict.NOT_SHOW_INPUT.id" class="lambo-display-none ">
11
+ <!-- 隐形查询条件 -->
11
12
  <Input v-model="widget.options.val" class="lambo-query-class" />
12
13
  </div>
13
14
  <div v-else-if="widget.options.searchType === searchDict.SINGLE_SELECT.id"> <!-- 单选下拉框 -->
@@ -16,15 +17,16 @@
16
17
  </Select>
17
18
  </div>
18
19
  <div v-else-if="widget.options.searchType === searchDict.MUlTI_SELECT.id"> <!-- 多选下拉框 -->
19
- <Select v-model="widget.options.val" class="lambo-query-class" filterable :clearable="true" placeholder="请选择" multiple
20
+ <!-- <Select v-model="widget.options.val" class="lambo-query-class" filterable :clearable="true" placeholder="请选择" multiple
20
21
  :max-tag-count="1">
21
22
  <Option v-for="(item, index) in widget.options.dataList" :key="index" :value="item.K"> {{ item.V }}</Option>
22
- </Select>
23
+ </Select> -->
24
+ <LamboElMultiSelect v-model="widget.options.val" :data="widget.options.dataList"></LamboElMultiSelect>
23
25
  </div>
24
26
  <div v-else-if="widget.options.searchType === searchDict.SINGLE_HELP.id"> <!-- 单选帮助框 -->
25
27
  <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
- placeholder="请选择" />
28
+ <Input class="lambo-query-class" v-model="helpValName" icon="ios-list-box-outline" readonly
29
+ @on-click="showHelpBox" placeholder="请选择" />
28
30
 
29
31
  <HelpBox v-model="helpBoxShow" :title="widget.name" :columns="helpColumns" :url="helpBoxUrl"
30
32
  :row-key="helpRowIdKey" :row-name="helpRowNameKey" :selected-key="helpSelectKey" :multi-select="false"
@@ -32,8 +34,8 @@
32
34
  </div>
33
35
  <div v-else-if="widget.options.searchType === searchDict.MUlTI_HELP.id"> <!-- 多选帮助框 -->
34
36
  <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
- placeholder="请选择" />
37
+ <Input class="lambo-query-class" v-model="helpValName" icon="ios-list-box-outline" readonly
38
+ @on-click="showHelpBox" placeholder="请选择" />
37
39
 
38
40
  <HelpBox v-model="helpBoxShow" :title="widget.name" :columns="helpColumns" :url="helpBoxUrl"
39
41
  :row-key="helpRowIdKey" :row-name="helpRowNameKey" :selected-key="helpSelectKey" :multi-select="true"
@@ -49,7 +51,7 @@
49
51
  </div>
50
52
  <div v-else-if="widget.options.searchType === searchDict.SINGLE_YEAR.id"> <!-- 年选择框 -->
51
53
  <DatePicker v-model="widget.options.val" format="yyyy" placeholder="请选择" placement="bottom-end"
52
- class="lambo-query-class" type="year"></DatePicker>
54
+ class="lambo-query-class" type="year"></DatePicker>
53
55
  </div>
54
56
  <div v-else-if="widget.options.searchType === searchDict.SINGLE_MONTH.id"> <!-- 月选择框 -->
55
57
  <DatePicker v-model="widget.options.val" format="yyyy-MM" placeholder="请选择" placement="bottom-end"
@@ -62,10 +64,11 @@
62
64
  import HelpBox from "../../../pub/helpbox/index.vue"
63
65
  import biConfig from "../config/config"
64
66
  import { SEARCH_DICT } from '../../../util/constants'
67
+ import LamboElMultiSelect from '@/components/lambo/pub/search/multi-select'
65
68
 
66
69
  export default {
67
70
  name: 'BiSearchItem',
68
- components: { HelpBox },
71
+ components: { HelpBox, LamboElMultiSelect },
69
72
  props: {
70
73
  /**
71
74
  * {
@@ -219,6 +222,7 @@ export default {
219
222
  .lambo-display-none {
220
223
  display: none
221
224
  }
225
+
222
226
  .lambo-query-class {
223
227
  width: 250px;
224
228
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lambo-design-bi",
3
- "version": "0.0.199",
3
+ "version": "0.0.200",
4
4
  "description": "Vue2 BI 数据可视化组件库",
5
5
  "main": "index.js",
6
6
  "author": "finch",
@@ -0,0 +1,173 @@
1
+ <!-- 带全选、清空、反选的多选下拉框 -->
2
+ <template>
3
+ <div class="multi-select">
4
+ <el-select v-model="internalValue" :style="style" size="small" multiple collapse-tags @change="handleChange">
5
+ <div class="select-up">
6
+ <el-button type="text" icon="el-icon-finished" @click="selectAll">
7
+ 全选
8
+ </el-button>
9
+ <el-button type="text" icon="el-icon-close" @click="removeTag">
10
+ 清空
11
+ </el-button>
12
+ <el-button type="text" icon="el-icon-crop" @click="selectReverse">
13
+ 反选
14
+ </el-button>
15
+ </div>
16
+ <div class="select-list">
17
+ <el-option v-for="(item, index) in data" :key="index" :label="item.V" :value="item.K" />
18
+ </div>
19
+ </el-select>
20
+ </div>
21
+ </template>
22
+
23
+ <script>
24
+ export default {
25
+ name: "LamboElMultiSelect",
26
+ model: {
27
+ prop: 'value', // 指定v-model绑定的prop名
28
+ event: 'change' // 指定触发v-model更新的事件名
29
+ },
30
+ props: {
31
+ // v-model绑定的值
32
+ value: {
33
+ type: Array,
34
+ default: () => ([])
35
+ },
36
+ data: {
37
+ type: Array,
38
+ default: () => ([])
39
+ },
40
+ width: {
41
+ type: String,
42
+ default: "250px"
43
+ }
44
+ },
45
+ data() {
46
+ return {
47
+ style: {
48
+ width: this.width
49
+ },
50
+ // 内部值,用于双向绑定
51
+ internalValue: []
52
+ }
53
+ },
54
+ watch: {
55
+ // 监听外部传入的value变化
56
+ value: {
57
+ immediate: true,
58
+ handler(newVal) {
59
+ // 确保internalValue与外部value同步
60
+ this.internalValue = Array.isArray(newVal) ? [...newVal] : []
61
+ }
62
+ },
63
+
64
+ // 监听数据源变化,如果外部数据变化,清空选中状态
65
+ data: {
66
+ handler() {
67
+ // 这里可以根据需求决定是否清空选中
68
+ // this.internalValue = []
69
+ }
70
+ }
71
+ },
72
+ methods: {
73
+ // 清空操作
74
+ removeTag() {
75
+ this.internalValue = []
76
+ this.$emit('change', [])
77
+ this.$emit('clear') // 可选:触发清空事件
78
+ },
79
+
80
+ // 全选操作
81
+ selectAll() {
82
+ if (!this.data || this.data.length === 0) {
83
+ return
84
+ }
85
+
86
+ const allValues = this.data.map(item => item.K)
87
+ this.internalValue = [...allValues]
88
+ this.$emit('change', allValues)
89
+ this.$emit('select-all', allValues) // 可选:触发全选事件
90
+ },
91
+
92
+ // 反选操作 - 修复逻辑
93
+ selectReverse() {
94
+ if (!this.data || this.data.length === 0) {
95
+ return
96
+ }
97
+
98
+ const allValues = this.data.map(item => item.K)
99
+ const currentValues = this.internalValue
100
+
101
+ // 找出当前未选中的项目
102
+ const reversedValues = allValues.filter(value => !currentValues.includes(value))
103
+
104
+ this.internalValue = [...reversedValues]
105
+ this.$emit('change', reversedValues)
106
+ this.$emit('reverse-select', reversedValues) // 可选:触发反选事件
107
+ },
108
+
109
+ // select变化时触发
110
+ handleChange(value) {
111
+ this.internalValue = value
112
+ this.$emit('change', value)
113
+ this.$emit('input', value) // 为了兼容.sync修饰符
114
+ }
115
+ }
116
+ }
117
+ </script>
118
+
119
+ <style scoped lang="less">
120
+ .el-select-dropdown__list {
121
+ height: 100%;
122
+ overflow: hidden;
123
+ }
124
+
125
+ .select-up {
126
+ padding: 0 12px;
127
+ font-size: 14px;
128
+ position: absolute;
129
+ z-index: 99999;
130
+ background-color: white;
131
+ top: 0px;
132
+ width: 100%;
133
+ border-radius: 5px 5px 0 0;
134
+
135
+ ::v-deep .el-button {
136
+ color: #bcbcbc;
137
+ font-size: 14px;
138
+
139
+ i {
140
+ font-size: 14px;
141
+ }
142
+ }
143
+
144
+ ::v-deep .el-button:hover {
145
+ color: #409EFF;
146
+ }
147
+
148
+ .el-button+.el-button {
149
+ margin-left: 6px;
150
+ }
151
+ }
152
+
153
+ .select-list {
154
+ margin-top: 27px;
155
+ }
156
+
157
+ .multi-select {
158
+ ::v-deep .el-input__inner {
159
+ font-size: 14px;
160
+ }
161
+
162
+ ::v-deep .el-select__tags-text {
163
+ color: #515a6e;
164
+ }
165
+
166
+ ::v-deep .el-tag--mini {
167
+ height: 22px;
168
+ padding: 0 3px;
169
+ line-height: 22px;
170
+ }
171
+
172
+ }
173
+ </style>