@yxhl/specter-pui-vtk 1.0.74 → 1.0.76

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,182 +1,231 @@
1
- <template>
2
- <div class="search">
3
- <VMenu
4
- v-model="menu"
5
- @update:model-value="obtain"
6
- location="bottom end"
7
- origin="top end"
8
- offset="12"
9
- :close-on-content-click="false"
10
- >
11
- <template v-slot:activator="{ props }">
12
- <VTextField
13
- v-model="queryParam.condition"
14
- :placeholder="$attrs.placeholder || '请输入查询内容'"
15
- :style="$attrs.styles"
16
- class="box"
17
- density="compact"
18
- variant="outlined"
19
- hide-details
20
- @click:append="search"
21
- @keyup.enter="search"
22
- @click:clear="(queryParam.condition = ''), search()"
23
- clearable
24
- >
25
- <template v-slot:append-inner>
26
- <VBadge
27
- dot
28
- :content="initialIndex"
29
- :model-value="initialIndex > 0"
30
- color="error"
31
- class="advanced-badge"
32
- >
33
- <span
34
- v-bind="props"
35
- class="text-blue vtk-cursor-pointer d-inline-flex align-center text-body-2"
36
- >
37
- 高级
38
- </span>
39
- </VBadge>
40
- </template>
41
- </VTextField>
42
- </template>
43
-
44
- <VCard style="width: 380px; margin-right: -16px; overflow: visible;">
45
- <VCardTitle class="pr-3 d-flex justify-space-between align-center pb-5">
46
- <span>高级搜索</span>
47
- <VBtn class="mx-0" variant="text" icon @click="close" size="small">
48
- <VIcon>mdi-close</VIcon>
49
- </VBtn>
50
- </VCardTitle>
51
-
52
- <VCardText style="overflow: visible;">
53
- <slot :query-param="queryParam"></slot>
54
- </VCardText>
55
-
56
- <VCardActions class="pt-0 px-4 pb-3">
57
- <slot name="actions"></slot>
58
- <VSpacer />
59
- <VBtn @click="search" variant="flat" color="primary">
60
- <VIcon class="mr-1">mdi-magnify</VIcon>搜索
61
- </VBtn>
62
- <VBtn @click="handleResetClick" variant="flat" color="error">
63
- <VIcon class="mr-1">mdi-sync</VIcon>重置
64
- </VBtn>
65
- </VCardActions>
66
- </VCard>
67
- </VMenu>
68
- </div>
69
- </template>
70
-
71
- <script setup>
72
- import { computed, getCurrentInstance, onMounted, ref, watch } from 'vue';
73
-
74
- defineOptions({
75
- name: "VtkSearch"
76
- });
77
-
78
- const props = defineProps({
79
- value: {
80
- type: Object,
81
- default: () => ({})
82
- }
83
- });
84
-
85
- const emit = defineEmits(['update:value', 'search', 'reset']);
86
- const instance = getCurrentInstance();
87
-
88
- const user = ref({});
89
- const menu = ref(false);
90
- const queryParam = ref({ ...props.value });
91
- const initialQueryParam = ref({ ...props.value });
92
-
93
- const initialIndex = computed(() => {
94
- return Object.entries(queryParam.value).filter(([key, val]) => {
95
- if (key === 'condition') return false;
96
- const initVal = initialQueryParam.value[key];
97
- if (Array.isArray(val) && Array.isArray(initVal)) {
98
- return JSON.stringify(val) !== JSON.stringify(initVal);
99
- }
100
- return val !== initVal;
101
- }).length;
102
- });
103
-
104
- watch(
105
- () => props.value,
106
- (newVal) => {
107
- queryParam.value = { ...newVal };
108
- }
109
- );
110
-
111
- onMounted(() => {
112
- user.value = JSON.parse(localStorage.getItem("_mis_acis_users") || "{}");
113
- });
114
-
115
- const obtain = () => {};
116
-
117
- const close = () => {
118
- menu.value = false;
119
- obtain();
120
- };
121
-
122
- const filterNull = (obj) => {
123
- return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== null && v !== undefined));
124
- };
125
-
126
- const search = () => {
127
- close();
128
- emit('update:value', filterNull(queryParam.value));
129
- emit("search");
130
- };
131
-
132
- const reset = () => {
133
- queryParam.value = {
134
- ...initialQueryParam.value,
135
- condition: ''
136
- };
137
- emit('update:value', filterNull(queryParam.value));
138
- emit("search");
139
- menu.value = false;
140
- };
141
-
142
- const handleResetClick = () => {
143
- const hasParentResetHandler = Boolean(instance?.vnode.props?.onReset);
144
-
145
- if (hasParentResetHandler) {
146
- emit('reset', { ...queryParam.value });
147
- return;
148
- }
149
-
150
- reset();
151
- };
152
-
153
- defineExpose({ search, reset });
154
-
155
- </script>
156
-
157
- <style lang="scss" scoped>
158
- .search {
159
- position: relative;
160
- min-width: 380px;
161
- min-height: 40px;
162
- }
163
-
164
- .box {
165
- min-width: 380px;
166
- min-height: 40px;
167
- }
168
-
169
- :deep(.box .v-field__append-inner) {
170
- cursor: pointer;
171
- padding-left: 16px !important;
172
- padding-right: 4px !important;
173
- border-left: 1px #cccccc88 solid;
174
- min-width: 50px;
175
- display: flex;
176
- align-items: center;
177
- }
178
-
179
- :deep(.advanced-badge .v-badge__badge) {
180
- transform: translate(10px, -2px);
181
- }
182
- </style>
1
+ <template>
2
+ <div class="search">
3
+ <VMenu
4
+ v-model="menu"
5
+ @update:model-value="obtain"
6
+ location="bottom end"
7
+ origin="top end"
8
+ offset="12"
9
+ :close-on-content-click="false"
10
+ >
11
+ <template v-slot:activator="{ props }">
12
+ <VTextField
13
+ v-model="queryParam.condition"
14
+ :placeholder="$attrs.placeholder || '请输入查询内容'"
15
+ :style="$attrs.styles"
16
+ class="box"
17
+ density="compact"
18
+ variant="outlined"
19
+ hide-details
20
+ @click:append="search"
21
+ @keyup.enter="search"
22
+ @click:clear="(queryParam.condition = ''), search()"
23
+ clearable
24
+ >
25
+ <template v-slot:append-inner>
26
+ <VBadge
27
+ dot
28
+ :content="initialIndex"
29
+ :model-value="initialIndex > 0"
30
+ color="error"
31
+ class="advanced-badge"
32
+ >
33
+ <span
34
+ v-bind="props"
35
+ class="text-blue vtk-cursor-pointer d-inline-flex align-center text-body-2"
36
+ >
37
+ 高级
38
+ </span>
39
+ </VBadge>
40
+ </template>
41
+ </VTextField>
42
+ </template>
43
+
44
+ <VCard class="search-panel">
45
+ <VCardTitle class="pr-3 d-flex justify-space-between align-center pb-5">
46
+ <span>高级搜索</span>
47
+ <VBtn class="mx-0" variant="text" icon @click="close" size="small">
48
+ <VIcon>mdi-close</VIcon>
49
+ </VBtn>
50
+ </VCardTitle>
51
+
52
+ <VCardText class="search-panel__body">
53
+ <div class="search-panel__content" :style="contentStyle">
54
+ <slot :query-param="queryParam"></slot>
55
+ </div>
56
+ </VCardText>
57
+
58
+ <VCardActions class="pt-0 px-4 pb-3">
59
+ <slot name="actions"></slot>
60
+ <VSpacer />
61
+ <VBtn @click="search" variant="flat" color="primary">
62
+ <VIcon class="mr-1">mdi-magnify</VIcon>搜索
63
+ </VBtn>
64
+ <VBtn @click="handleResetClick" variant="flat" color="error">
65
+ <VIcon class="mr-1">mdi-sync</VIcon>重置
66
+ </VBtn>
67
+ </VCardActions>
68
+ </VCard>
69
+ </VMenu>
70
+ </div>
71
+ </template>
72
+
73
+ <script setup>
74
+ import { computed, getCurrentInstance, onMounted, ref, watch } from 'vue';
75
+
76
+ defineOptions({
77
+ name: "VtkSearch"
78
+ });
79
+
80
+ const props = defineProps({
81
+ value: {
82
+ type: Object,
83
+ default: () => ({})
84
+ },
85
+ contentMinHeight: {
86
+ type: [Number, String],
87
+ default: 0
88
+ },
89
+ contentMaxHeight: {
90
+ type: [Number, String],
91
+ default: 360
92
+ }
93
+ });
94
+
95
+ const emit = defineEmits(['update:value', 'search', 'reset']);
96
+ const instance = getCurrentInstance();
97
+
98
+ const user = ref({});
99
+ const menu = ref(false);
100
+ const queryParam = ref({ ...props.value });
101
+ const initialQueryParam = ref({ ...props.value });
102
+
103
+ const initialIndex = computed(() => {
104
+ return Object.entries(queryParam.value).filter(([key, val]) => {
105
+ if (key === 'condition') return false;
106
+ const initVal = initialQueryParam.value[key];
107
+ if (Array.isArray(val) && Array.isArray(initVal)) {
108
+ return JSON.stringify(val) !== JSON.stringify(initVal);
109
+ }
110
+ return val !== initVal;
111
+ }).length;
112
+ });
113
+
114
+ const contentStyle = computed(() => {
115
+ const minValue = props.contentMinHeight;
116
+ const maxValue = props.contentMaxHeight;
117
+ const minHeight = typeof minValue === 'number' ? `${minValue}px` : minValue;
118
+ const maxHeight = typeof maxValue === 'number' ? `${maxValue}px` : maxValue;
119
+
120
+ return {
121
+ ...(minValue ? { minHeight } : {}),
122
+ maxHeight,
123
+ };
124
+ });
125
+
126
+ watch(
127
+ () => props.value,
128
+ (newVal) => {
129
+ queryParam.value = { ...newVal };
130
+ }
131
+ );
132
+
133
+ onMounted(() => {
134
+ user.value = JSON.parse(localStorage.getItem("_mis_acis_users") || "{}");
135
+ });
136
+
137
+ const obtain = () => {};
138
+
139
+ const close = () => {
140
+ menu.value = false;
141
+ obtain();
142
+ };
143
+
144
+ const filterNull = (obj) => {
145
+ return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== null && v !== undefined));
146
+ };
147
+
148
+ const search = () => {
149
+ close();
150
+ emit('update:value', filterNull(queryParam.value));
151
+ emit("search");
152
+ };
153
+
154
+ const reset = () => {
155
+ queryParam.value = {
156
+ ...initialQueryParam.value,
157
+ condition: ''
158
+ };
159
+ emit('update:value', filterNull(queryParam.value));
160
+ emit("search");
161
+ menu.value = false;
162
+ };
163
+
164
+ const handleResetClick = () => {
165
+ const hasParentResetHandler = Boolean(instance?.vnode.props?.onReset);
166
+
167
+ if (hasParentResetHandler) {
168
+ emit('reset', { ...queryParam.value });
169
+ return;
170
+ }
171
+
172
+ reset();
173
+ };
174
+
175
+ defineExpose({ search, reset });
176
+
177
+ </script>
178
+
179
+ <style lang="scss" scoped>
180
+ .search {
181
+ position: relative;
182
+ min-width: 380px;
183
+ min-height: 40px;
184
+ }
185
+
186
+ .box {
187
+ min-width: 380px;
188
+ min-height: 40px;
189
+ }
190
+
191
+ .search-panel {
192
+ width: 380px;
193
+ margin-right: -16px;
194
+ overflow: visible;
195
+ }
196
+
197
+ .search-panel__body {
198
+ overflow: visible;
199
+ }
200
+
201
+ .search-panel__content {
202
+ overflow-x: hidden;
203
+ overflow-y: auto;
204
+ scrollbar-gutter: stable;
205
+ scrollbar-color: rgb(var(--v-theme-primary)) transparent;
206
+ scrollbar-width: thin;
207
+ }
208
+
209
+
210
+ .search-panel__content::-webkit-scrollbar-track {
211
+ background: transparent;
212
+ }
213
+
214
+ .search-panel__content::-webkit-scrollbar-thumb {
215
+ background: rgb(var(--v-theme-primary));
216
+ }
217
+
218
+ :deep(.box .v-field__append-inner) {
219
+ cursor: pointer;
220
+ padding-left: 16px !important;
221
+ padding-right: 4px !important;
222
+ border-left: 1px #cccccc88 solid;
223
+ min-width: 50px;
224
+ display: flex;
225
+ align-items: center;
226
+ }
227
+
228
+ :deep(.advanced-badge .v-badge__badge) {
229
+ transform: translate(10px, -2px);
230
+ }
231
+ </style>
@@ -141,7 +141,7 @@ $color-dark-bg: #1e1e1e;
141
141
 
142
142
  .last-box::after {
143
143
  position: absolute;
144
- right: -70px;
144
+ right: -69px;
145
145
  content: "";
146
146
  z-index: 1;
147
147
  width: 0;
@@ -39,7 +39,7 @@ const onModelUpdate = (value) => {
39
39
  };
40
40
  </script>
41
41
  <style lang="scss" scoped>
42
- ::v-deep .v-snackbar__wrapper {
43
- top: 24px;
44
- }
42
+ :deep(.v-snackbar__wrapper) {
43
+ top: 24px;
44
+ }
45
45
  </style>