@yxhl/specter-pui-vtk 1.0.75 → 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,226 +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 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__content" :style="contentStyle">
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
- contentMaxHeight: {
84
- type: [Number, String],
85
- default: 360
86
- }
87
- });
88
-
89
- const emit = defineEmits(['update:value', 'search', 'reset']);
90
- const instance = getCurrentInstance();
91
-
92
- const user = ref({});
93
- const menu = ref(false);
94
- const queryParam = ref({ ...props.value });
95
- const initialQueryParam = ref({ ...props.value });
96
-
97
- const initialIndex = computed(() => {
98
- return Object.entries(queryParam.value).filter(([key, val]) => {
99
- if (key === 'condition') return false;
100
- const initVal = initialQueryParam.value[key];
101
- if (Array.isArray(val) && Array.isArray(initVal)) {
102
- return JSON.stringify(val) !== JSON.stringify(initVal);
103
- }
104
- return val !== initVal;
105
- }).length;
106
- });
107
-
108
- const contentStyle = computed(() => {
109
- const value = props.contentMaxHeight;
110
- const maxHeight = typeof value === 'number' ? `${value}px` : value;
111
-
112
- return {
113
- maxHeight,
114
- };
115
- });
116
-
117
- watch(
118
- () => props.value,
119
- (newVal) => {
120
- queryParam.value = { ...newVal };
121
- }
122
- );
123
-
124
- onMounted(() => {
125
- user.value = JSON.parse(localStorage.getItem("_mis_acis_users") || "{}");
126
- });
127
-
128
- const obtain = () => {};
129
-
130
- const close = () => {
131
- menu.value = false;
132
- obtain();
133
- };
134
-
135
- const filterNull = (obj) => {
136
- return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== null && v !== undefined));
137
- };
138
-
139
- const search = () => {
140
- close();
141
- emit('update:value', filterNull(queryParam.value));
142
- emit("search");
143
- };
144
-
145
- const reset = () => {
146
- queryParam.value = {
147
- ...initialQueryParam.value,
148
- condition: ''
149
- };
150
- emit('update:value', filterNull(queryParam.value));
151
- emit("search");
152
- menu.value = false;
153
- };
154
-
155
- const handleResetClick = () => {
156
- const hasParentResetHandler = Boolean(instance?.vnode.props?.onReset);
157
-
158
- if (hasParentResetHandler) {
159
- emit('reset', { ...queryParam.value });
160
- return;
161
- }
162
-
163
- reset();
164
- };
165
-
166
- defineExpose({ search, reset });
167
-
168
- </script>
169
-
170
- <style lang="scss" scoped>
171
- .search {
172
- position: relative;
173
- min-width: 380px;
174
- min-height: 40px;
175
- }
176
-
177
- .box {
178
- min-width: 380px;
179
- min-height: 40px;
180
- }
181
-
182
- .search-panel {
183
- width: 380px;
184
- margin-right: -16px;
185
- display: flex;
186
- flex-direction: column;
187
- }
188
-
189
- .search-panel__content {
190
- overflow-y: auto;
191
- overflow-x: hidden;
192
- scrollbar-width: thin;
193
- scrollbar-color: rgb(var(--v-theme-primary)) transparent;
194
- }
195
-
196
- .search-panel__content::-webkit-scrollbar {
197
- width: 8px;
198
- }
199
-
200
- .search-panel__content::-webkit-scrollbar-track {
201
- background: transparent;
202
- }
203
-
204
- .search-panel__content::-webkit-scrollbar-thumb {
205
- background: rgba(var(--v-theme-primary), 0.8);
206
- border-radius: 999px;
207
- }
208
-
209
- .search-panel__content::-webkit-scrollbar-thumb:hover {
210
- background: rgb(var(--v-theme-primary));
211
- }
212
-
213
- :deep(.box .v-field__append-inner) {
214
- cursor: pointer;
215
- padding-left: 16px !important;
216
- padding-right: 4px !important;
217
- border-left: 1px #cccccc88 solid;
218
- min-width: 50px;
219
- display: flex;
220
- align-items: center;
221
- }
222
-
223
- :deep(.advanced-badge .v-badge__badge) {
224
- transform: translate(10px, -2px);
225
- }
226
- </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>