@ctzy-web-client/plugin-component-vue 1.0.38 → 1.0.39
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/es/advance-select/advance-option.mjs +2 -2
- package/es/make-installer.css +1 -0
- package/es/pct-filter-panel/pct-compents/index.mjs +1 -1
- package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition.mjs +2 -2
- package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.mjs +77 -131
- package/lib/advance-select/advance-option.js +2 -2
- package/lib/make-installer.css +1 -0
- package/lib/pct-filter-panel/pct-compents/index.js +2 -2
- package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition.js +2 -2
- package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.js +76 -130
- package/package.json +1 -1
- package/src/advance-select/advance-option.vue +4 -4
- package/src/pct-filter-panel/pct-compents/index.js +1 -1
- package/src/pct-filter-panel/pct-compents/pct-multiple-menu-condition.vue +4 -4
- package/src/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.vue +96 -148
- package/style/index.css +1 -1
- package/style/src/var.scss +0 -2
- package/style/var.css +1 -1
- package/es/index.css +0 -1
- package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.vue_vue_type_style_index_0_scoped_0a08184f_lang.mjs +0 -13
- package/lib/index.css +0 -1
- package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.vue_vue_type_style_index_0_scoped_0a08184f_lang.js +0 -17
- /package/es/advance-select/{advance-option.vue_vue_type_style_index_0_scoped_9ba46efc_lang.mjs → advance-option.vue_vue_type_style_index_0_scoped_1e505c71_lang.mjs} +0 -0
- /package/lib/advance-select/{advance-option.vue_vue_type_style_index_0_scoped_9ba46efc_lang.js → advance-option.vue_vue_type_style_index_0_scoped_1e505c71_lang.js} +0 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<slot>
|
|
6
6
|
<ElTooltip placement="top" append-to=".bwa-application" :disabled="currentLabel.length < 16">
|
|
7
7
|
<div :class="ns.be('option', 'content-label')" ref="contentText">
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
<div v-if="!showLetterAvatarStatus" :class="ns.be('option', 'content-label')" style="width: 100%;min-width: 178px;">{{ currentLabel }}</div>
|
|
10
10
|
<div v-if="showLetterAvatarStatus" :class="ns.be('option', 'content-label')" style="width: 100%;min-width: 178px;display: flex;align-items: center;" >
|
|
11
11
|
<div class="letter-circle" :style="{ backgroundColor: (processLabel(currentLabel).color) }">
|
|
@@ -64,7 +64,7 @@ export default {
|
|
|
64
64
|
const show = ref(true)
|
|
65
65
|
const clickFlag = ref(true)
|
|
66
66
|
const showLetterAvatarStatus = computed(() => props.showLetterAvatar);
|
|
67
|
-
|
|
67
|
+
|
|
68
68
|
// console.log(showLetterAvatarStatus.value,'下一级')
|
|
69
69
|
const contentText = ref()
|
|
70
70
|
|
|
@@ -119,7 +119,7 @@ function processLabel(label) {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
return {
|
|
122
|
-
|
|
122
|
+
|
|
123
123
|
firstLetter: firstLetter, // 确保是大写
|
|
124
124
|
color: color
|
|
125
125
|
};
|
|
@@ -144,7 +144,7 @@ function processLabel(label) {
|
|
|
144
144
|
show,
|
|
145
145
|
ns,
|
|
146
146
|
currentLabel,
|
|
147
|
-
|
|
147
|
+
|
|
148
148
|
itemSelected,
|
|
149
149
|
showSelectIcon,
|
|
150
150
|
filterOptionClick,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import {withInstall} from "element-plus/es/utils/vue/install";
|
|
3
|
-
import PctMultipleMenuCondition from './pct-multiple-menu-
|
|
3
|
+
import PctMultipleMenuCondition from './pct-multiple-menu-condition.vue'
|
|
4
4
|
import PctInputCondition from './pct-Input-condition.vue'
|
|
5
5
|
import PctDateRangeCondition from './pct-date-range-condition.vue'
|
|
6
6
|
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
@mouseleave="isHoverIcon = false"
|
|
51
51
|
@click.stop="handleIconClick"
|
|
52
52
|
:class="ns.be('option', 'selected')"
|
|
53
|
-
>
|
|
53
|
+
>
|
|
54
54
|
<CircleClose
|
|
55
55
|
v-if="isHoverIcon && selected.length > 0"
|
|
56
56
|
class="delete-icon"
|
|
@@ -229,10 +229,10 @@ const handleClose = (val)=>{
|
|
|
229
229
|
// 1. 空值兜底:避免 modelValue.value 为 null/undefined 时报错
|
|
230
230
|
const currentModelValue = Array.isArray(modelValue.value) ? modelValue.value : [];
|
|
231
231
|
// 2. 严格相等 + 类型统一:解决 1 vs "1" 不匹配,同时避免隐式类型转换
|
|
232
|
-
modelValue.value = currentModelValue.filter(item =>
|
|
232
|
+
modelValue.value = currentModelValue.filter(item =>
|
|
233
233
|
String(item) !== String(val.value)
|
|
234
234
|
);
|
|
235
|
-
|
|
235
|
+
|
|
236
236
|
}
|
|
237
237
|
const handleIconClick = () => {
|
|
238
238
|
if (isHoverIcon.value) {
|
|
@@ -308,4 +308,4 @@ const handleClearClick = () => {
|
|
|
308
308
|
defineExpose({
|
|
309
309
|
data
|
|
310
310
|
})
|
|
311
|
-
</script>
|
|
311
|
+
</script>
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
<span v-if="showTitle" :class="ns.e('title')">{{ column.title }}</span>
|
|
4
|
-
|
|
2
|
+
<span v-if="showTitle" :class="ns.e('title')">{{column.title}}</span>
|
|
5
3
|
<ElSelect
|
|
6
4
|
v-model="modelValue"
|
|
7
5
|
clearable
|
|
@@ -11,185 +9,135 @@
|
|
|
11
9
|
:loading="loading"
|
|
12
10
|
@visible-change="visibleChange"
|
|
13
11
|
:remote="remote"
|
|
14
|
-
:remote-method="
|
|
12
|
+
:remote-method="remoteMethod"
|
|
15
13
|
:size="size"
|
|
16
14
|
:class="ns.e('multiple')"
|
|
17
15
|
collapse-tags
|
|
18
16
|
collapse-tags-tooltip
|
|
19
17
|
no-data-text="暂无数据"
|
|
20
18
|
>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<!-- 文字头像 -->
|
|
28
|
-
<div style="display: flex; align-items: center">
|
|
29
|
-
<div
|
|
30
|
-
v-if="showLetterAvatarStatus"
|
|
31
|
-
class="letter-circle"
|
|
32
|
-
:style="{ backgroundColor: processLabel(item[labelPropStr]).color }"
|
|
33
|
-
>
|
|
34
|
-
{{ processLabel(item[labelPropStr]).firstLetter }}
|
|
35
|
-
</div>
|
|
36
|
-
<span style="margin-left: 8px">{{ item[labelPropStr] }}</span>
|
|
37
|
-
</div>
|
|
38
|
-
</ElOption>
|
|
19
|
+
<ElOption
|
|
20
|
+
v-for="(item, index) in data"
|
|
21
|
+
:key="item[valueProp] + index"
|
|
22
|
+
:value="item[valueProp] + ''"
|
|
23
|
+
:label="item[labelProp]"
|
|
24
|
+
/>
|
|
39
25
|
</ElSelect>
|
|
40
|
-
</div>
|
|
41
26
|
</template>
|
|
42
27
|
|
|
43
28
|
<script setup>
|
|
44
|
-
import {
|
|
29
|
+
import {ElOption, ElSelect} from 'element-plus';
|
|
45
30
|
import { useNamespace } from '@ctzy-web-client/web-base-client-vue';
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
31
|
+
import {computed, unref, defineEmits, inject, ref, useAttrs} from 'vue';
|
|
32
|
+
import {dataProps} from "../../hooks/use-data";
|
|
48
33
|
import {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
34
|
+
useService,
|
|
35
|
+
HttpRequest,
|
|
36
|
+
filterPanelItemKey,
|
|
52
37
|
} from '@ctzy-web-client/web-base-client-vue';
|
|
53
|
-
import { pinyin } from 'pinyin-pro';
|
|
54
38
|
|
|
55
39
|
const httpRequest = useService(HttpRequest);
|
|
56
|
-
|
|
57
40
|
defineOptions({
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
41
|
+
name: 'BwaPctMultipleMenuCondition',
|
|
42
|
+
__conditionTitle__: '多选菜单-PZ',
|
|
43
|
+
__conditionDefault__: () => [],
|
|
61
44
|
});
|
|
62
45
|
|
|
46
|
+
|
|
63
47
|
const props = defineProps({
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
48
|
+
...dataProps,
|
|
49
|
+
modelValue: {
|
|
50
|
+
type: null,
|
|
51
|
+
},
|
|
52
|
+
options: {
|
|
53
|
+
type: Array,
|
|
54
|
+
default: () => [],
|
|
55
|
+
},
|
|
56
|
+
labelProp: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: 'label',
|
|
59
|
+
},
|
|
60
|
+
valueProp: {
|
|
61
|
+
type: String,
|
|
62
|
+
default: 'value',
|
|
63
|
+
},
|
|
64
|
+
multiple: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
default: false,
|
|
67
|
+
},
|
|
68
|
+
filterable: {
|
|
69
|
+
type: Boolean,
|
|
70
|
+
default: true,
|
|
71
|
+
},
|
|
72
|
+
placeholder: {
|
|
73
|
+
type: String,
|
|
74
|
+
default: '请选择',
|
|
75
|
+
},
|
|
76
|
+
remote: {
|
|
77
|
+
type: Boolean,
|
|
78
|
+
default: true,
|
|
79
|
+
},
|
|
80
|
+
size: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: 'small',
|
|
83
|
+
}
|
|
82
84
|
});
|
|
83
|
-
|
|
84
85
|
const ns = useNamespace('pctfilterpanel-item');
|
|
86
|
+
|
|
85
87
|
const attrs = useAttrs();
|
|
86
|
-
const showTitle = computed(() => attrs.showTitle)
|
|
87
|
-
|
|
88
|
-
const
|
|
88
|
+
const showTitle = computed(() => attrs.showTitle)
|
|
89
|
+
|
|
90
|
+
const data = ref([])
|
|
91
|
+
const loading = ref(false)
|
|
89
92
|
const emit = defineEmits(['update:modelValue', 'search', 'visible-change']);
|
|
93
|
+
|
|
90
94
|
const filterPanelItem = inject(filterPanelItemKey, null);
|
|
91
95
|
const column = computed(() => filterPanelItem?.column ?? null);
|
|
92
96
|
|
|
93
|
-
|
|
94
|
-
if (props.itfInfo && column.value) {
|
|
95
|
-
column.value.componentProps = {
|
|
96
|
-
itfInfo: props.itfInfo,
|
|
97
|
-
labelAttr: props.labelAttr,
|
|
98
|
-
valueAttr: props.valueAttr,
|
|
99
|
-
searchAttr: props.searchAttr,
|
|
100
|
-
showLetterAvatar: props.showLetterAvatar,
|
|
101
|
-
};
|
|
102
|
-
}
|
|
97
|
+
const placeholderStr = computed(() => showTitle.value ? props.placeholder : column.value.title)
|
|
103
98
|
|
|
104
|
-
const placeholderStr = computed(() =>
|
|
105
|
-
showTitle.value ? props.placeholder : column.value?.title
|
|
106
|
-
);
|
|
107
|
-
const labelPropStr = computed(
|
|
108
|
-
() => column.value?.componentProps?.labelAttr || props.labelProp
|
|
109
|
-
);
|
|
110
|
-
const valuePropStr = computed(
|
|
111
|
-
() => column.value?.componentProps?.valueAttr || props.valueProp
|
|
112
|
-
);
|
|
113
|
-
const showLetterAvatarStatus = computed(
|
|
114
|
-
() => column.value?.componentProps?.showLetterAvatar || props.showLetterAvatar
|
|
115
|
-
);
|
|
116
99
|
|
|
117
|
-
// ====================== 文字头像 ======================
|
|
118
|
-
const COLOR_POOL = ['#2DC86D', '#19BBFF', '#FFA901'];
|
|
119
|
-
function processLabel(label = '') {
|
|
120
|
-
const match = (label + '').match(/^(.*)\(/);
|
|
121
|
-
const txt = match ? match[1] : label;
|
|
122
|
-
const first = txt.charAt(0);
|
|
123
|
-
let letter = '#';
|
|
124
|
-
if (/[\u4e00-\u9fa5]/.test(first)) {
|
|
125
|
-
letter = pinyin(first, { pattern: 'first' }).toUpperCase();
|
|
126
|
-
} else if (/[a-zA-Z]/.test(first)) {
|
|
127
|
-
letter = first.toUpperCase();
|
|
128
|
-
}
|
|
129
|
-
let color = COLOR_POOL[0];
|
|
130
|
-
if (/[A-Z]/.test(letter)) {
|
|
131
|
-
color = COLOR_POOL[(letter.charCodeAt(0) - 65) % 3];
|
|
132
|
-
}
|
|
133
|
-
return { firstLetter: letter, color };
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// ====================== 数据请求 ======================
|
|
137
100
|
const getData = async (query) => {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
options: unref(itfInfo).options || {},
|
|
151
|
-
params: { ...unref(itfInfo).params, [searchAttr]: query || '' } || {},
|
|
152
|
-
};
|
|
153
|
-
data.value = (await unref(httpRequest)[method.toLowerCase()](url, params, options))?.data || [];
|
|
154
|
-
} catch (err) {
|
|
155
|
-
data.value = [];
|
|
156
|
-
} finally {
|
|
157
|
-
loading.value = false;
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
// 初始化
|
|
162
|
-
data.value = props.options ?? [];
|
|
101
|
+
loading.value = true
|
|
102
|
+
const { itfInfo, searchAttr } = column.value.componentProps
|
|
103
|
+
const {url, method, options, params } = {
|
|
104
|
+
url: unref(itfInfo).url,
|
|
105
|
+
method: unref(itfInfo).method || 'POST',
|
|
106
|
+
options: unref(itfInfo).options || {},
|
|
107
|
+
params: { ...unref(itfInfo).params, [searchAttr]: query || ''} || {},
|
|
108
|
+
}
|
|
109
|
+
data.value = (await unref(httpRequest)[method.toLowerCase()](url, params, options))?.data
|
|
110
|
+
loading.value = false
|
|
111
|
+
}
|
|
112
|
+
if (column.value?.componentProps) {
|
|
163
113
|
|
|
114
|
+
} else {
|
|
115
|
+
data.value = props.options ?? []
|
|
116
|
+
}
|
|
164
117
|
const visibleChange = (val) => {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
};
|
|
118
|
+
if (!val || !column.value.componentProps) return
|
|
119
|
+
getData()
|
|
120
|
+
}
|
|
169
121
|
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
122
|
+
const remoteMethod = (query) => {
|
|
123
|
+
if (column.value.componentProps) {
|
|
124
|
+
getData(query)
|
|
125
|
+
} else {
|
|
126
|
+
emit('search', query)
|
|
127
|
+
}
|
|
128
|
+
}
|
|
173
129
|
|
|
174
|
-
// ====================== 双向绑定 ======================
|
|
175
130
|
const modelValue = computed({
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
131
|
+
get: () => {
|
|
132
|
+
if (props.multiple) {
|
|
133
|
+
return Array.isArray(props.modelValue)
|
|
134
|
+
? props.modelValue.map((item) => item + '')
|
|
135
|
+
: [];
|
|
136
|
+
} else {
|
|
137
|
+
return props.modelValue == null ? '' : props.modelValue + '';
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
set: (v) => emit('update:modelValue', v),
|
|
180
141
|
});
|
|
181
142
|
</script>
|
|
182
143
|
|
|
183
|
-
<style scoped>
|
|
184
|
-
.letter-circle {
|
|
185
|
-
width: 22px;
|
|
186
|
-
height: 22px;
|
|
187
|
-
border-radius: 50%;
|
|
188
|
-
color: #fff;
|
|
189
|
-
display: flex;
|
|
190
|
-
align-items: center;
|
|
191
|
-
justify-content: center;
|
|
192
|
-
font-size: 12px;
|
|
193
|
-
flex-shrink: 0;
|
|
194
|
-
}
|
|
195
|
-
</style>
|