@ctzy-web-client/plugin-component-vue 1.0.37 → 1.0.38
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/index.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 +131 -77
- package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.vue_vue_type_style_index_0_scoped_0a08184f_lang.mjs +13 -0
- package/lib/advance-select/advance-option.js +2 -2
- package/lib/index.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 +130 -76
- package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.vue_vue_type_style_index_0_scoped_0a08184f_lang.js +17 -0
- 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 +148 -96
- package/style/index.css +1 -1
- package/style/src/var.scss +2 -0
- package/style/var.css +1 -1
- package/es/plugins.css +0 -1
- package/lib/plugins.css +0 -1
- /package/es/advance-select/{advance-option.vue_vue_type_style_index_0_scoped_1e505c71_lang.mjs → advance-option.vue_vue_type_style_index_0_scoped_9ba46efc_lang.mjs} +0 -0
- /package/lib/advance-select/{advance-option.vue_vue_type_style_index_0_scoped_1e505c71_lang.js → advance-option.vue_vue_type_style_index_0_scoped_9ba46efc_lang.js} +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
// Inject __name helper
|
|
6
|
+
if (typeof __name === 'undefined') {
|
|
7
|
+
function __name(obj, name) {
|
|
8
|
+
Object.defineProperty(obj, "name", {
|
|
9
|
+
value: name,
|
|
10
|
+
configurable: true
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
var undefined$1 = undefined;
|
|
16
|
+
|
|
17
|
+
exports["default"] = undefined$1;
|
package/package.json
CHANGED
|
@@ -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-condition2.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,5 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
2
|
+
<div :class="ns.e('conditbox')">
|
|
3
|
+
<span v-if="showTitle" :class="ns.e('title')">{{ column.title }}</span>
|
|
4
|
+
|
|
3
5
|
<ElSelect
|
|
4
6
|
v-model="modelValue"
|
|
5
7
|
clearable
|
|
@@ -9,135 +11,185 @@
|
|
|
9
11
|
:loading="loading"
|
|
10
12
|
@visible-change="visibleChange"
|
|
11
13
|
:remote="remote"
|
|
12
|
-
:remote-method="
|
|
14
|
+
:remote-method="handleFieldSearch"
|
|
13
15
|
:size="size"
|
|
14
16
|
:class="ns.e('multiple')"
|
|
15
17
|
collapse-tags
|
|
16
18
|
collapse-tags-tooltip
|
|
17
19
|
no-data-text="暂无数据"
|
|
18
20
|
>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
<ElOption
|
|
22
|
+
v-for="item in data"
|
|
23
|
+
:key="item[valuePropStr]"
|
|
24
|
+
:value="item[valuePropStr]"
|
|
25
|
+
:label="item[labelPropStr]"
|
|
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>
|
|
25
39
|
</ElSelect>
|
|
40
|
+
</div>
|
|
26
41
|
</template>
|
|
27
42
|
|
|
28
43
|
<script setup>
|
|
29
|
-
import {ElOption, ElSelect} from 'element-plus';
|
|
44
|
+
import { ElOption, ElSelect } from 'element-plus';
|
|
30
45
|
import { useNamespace } from '@ctzy-web-client/web-base-client-vue';
|
|
31
|
-
import {computed, unref, defineEmits, inject, ref, useAttrs} from 'vue';
|
|
32
|
-
import {dataProps} from
|
|
46
|
+
import { computed, unref, defineEmits, inject, ref, useAttrs } from 'vue';
|
|
47
|
+
import { dataProps } from '../../hooks/use-data';
|
|
33
48
|
import {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
49
|
+
useService,
|
|
50
|
+
HttpRequest,
|
|
51
|
+
filterPanelItemKey,
|
|
37
52
|
} from '@ctzy-web-client/web-base-client-vue';
|
|
53
|
+
import { pinyin } from 'pinyin-pro';
|
|
38
54
|
|
|
39
55
|
const httpRequest = useService(HttpRequest);
|
|
56
|
+
|
|
40
57
|
defineOptions({
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
58
|
+
name: 'BwaPctMultipleMenuCondition',
|
|
59
|
+
__conditionTitle__: '多选菜单',
|
|
60
|
+
__conditionDefault__: () => [],
|
|
44
61
|
});
|
|
45
62
|
|
|
46
|
-
|
|
47
63
|
const props = defineProps({
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
}
|
|
64
|
+
...dataProps,
|
|
65
|
+
modelValue: { type: null },
|
|
66
|
+
options: { type: Array, default: () => [] },
|
|
67
|
+
labelProp: { type: String, default: 'label' },
|
|
68
|
+
valueProp: { type: String, default: 'value' },
|
|
69
|
+
multiple: { type: Boolean, default: true },
|
|
70
|
+
showSearch: { type: Boolean, default: true },
|
|
71
|
+
filterable: { type: Boolean, default: true },
|
|
72
|
+
placeholder: { type: String, default: '请选择' },
|
|
73
|
+
remote: { type: Boolean, default: true },
|
|
74
|
+
showLetterAvatar: { type: Boolean, default: false },
|
|
75
|
+
size: { type: String, default: '' },
|
|
76
|
+
searchPlaceholder: { type: String, default: '' },
|
|
77
|
+
labelAttr: { type: String, default: '' },
|
|
78
|
+
valueAttr: { type: String, default: '' },
|
|
79
|
+
searchAttr: { type: String, default: '' },
|
|
80
|
+
itfInfo: { type: Object, default: null },
|
|
81
|
+
isRequiredByVisibleChange: { type: Boolean, default: false },
|
|
84
82
|
});
|
|
85
|
-
const ns = useNamespace('pctfilterpanel-item');
|
|
86
83
|
|
|
84
|
+
const ns = useNamespace('pctfilterpanel-item');
|
|
87
85
|
const attrs = useAttrs();
|
|
88
|
-
const showTitle = computed(() => attrs.showTitle)
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
const loading = ref(false)
|
|
86
|
+
const showTitle = computed(() => attrs.showTitle);
|
|
87
|
+
const data = ref([]);
|
|
88
|
+
const loading = ref(false);
|
|
92
89
|
const emit = defineEmits(['update:modelValue', 'search', 'visible-change']);
|
|
93
|
-
|
|
94
90
|
const filterPanelItem = inject(filterPanelItemKey, null);
|
|
95
91
|
const column = computed(() => filterPanelItem?.column ?? null);
|
|
96
92
|
|
|
97
|
-
|
|
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
|
+
}
|
|
98
103
|
|
|
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
|
+
);
|
|
99
116
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
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 };
|
|
111
134
|
}
|
|
112
|
-
if (column.value?.componentProps) {
|
|
113
135
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
136
|
+
// ====================== 数据请求 ======================
|
|
137
|
+
const getData = async (query) => {
|
|
138
|
+
if (!column.value?.componentProps) {
|
|
139
|
+
data.value = props.options ?? [];
|
|
140
|
+
loading.value = false;
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
loading.value = true;
|
|
145
|
+
try {
|
|
146
|
+
const { itfInfo, searchAttr } = column.value.componentProps;
|
|
147
|
+
const { url, method, options, params } = {
|
|
148
|
+
url: unref(itfInfo).url,
|
|
149
|
+
method: unref(itfInfo).method || 'POST',
|
|
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 ?? [];
|
|
163
|
+
|
|
117
164
|
const visibleChange = (val) => {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
165
|
+
emit('visible-change', val);
|
|
166
|
+
if (val && props.isRequiredByVisibleChange) emit('search', '');
|
|
167
|
+
if (val && column.value?.componentProps) getData();
|
|
168
|
+
};
|
|
121
169
|
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
} else {
|
|
126
|
-
emit('search', query)
|
|
127
|
-
}
|
|
128
|
-
}
|
|
170
|
+
const handleFieldSearch = (query) => {
|
|
171
|
+
column.value?.componentProps ? getData(query) : emit('search', query);
|
|
172
|
+
};
|
|
129
173
|
|
|
174
|
+
// ====================== 双向绑定 ======================
|
|
130
175
|
const modelValue = computed({
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
: [];
|
|
136
|
-
} else {
|
|
137
|
-
return props.modelValue == null ? '' : props.modelValue + '';
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
set: (v) => emit('update:modelValue', v),
|
|
176
|
+
get: () => props.multiple
|
|
177
|
+
? (Array.isArray(props.modelValue) ? props.modelValue : [])
|
|
178
|
+
: (props.modelValue ?? ''),
|
|
179
|
+
set: (v) => emit('update:modelValue', v),
|
|
141
180
|
});
|
|
142
181
|
</script>
|
|
143
182
|
|
|
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>
|