tenghui-ui 2.3.2 → 2.3.3
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/dist/style.css +1 -1
- package/dist/tenghui-ui.es.js +1985 -74
- package/dist/tenghui-ui.es.js.map +1 -1
- package/dist/tenghui-ui.umd.js +45 -41
- package/dist/tenghui-ui.umd.js.map +1 -1
- package/package.json +2 -1
- package/packages/search/src/Record.vue +23 -16
- package/packages/search/src/index.vue +68 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tenghui-ui",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.3",
|
|
4
4
|
"description": "vue 2x, tenghui-ui",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"vue-tsc": "^0.29.8"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
+
"axios": "^1.6.2",
|
|
40
41
|
"draggabilly": "^3.0.0",
|
|
41
42
|
"element-ui": "^2.15.8",
|
|
42
43
|
"qs": "^6.11.0",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
</el-popover>
|
|
30
30
|
</div>
|
|
31
31
|
<div>
|
|
32
|
-
<div v-if="item.title">
|
|
32
|
+
<div v-if="item.title" class="ui-desc__title">
|
|
33
33
|
<span>{{ item.title }}</span>
|
|
34
34
|
</div>
|
|
35
|
-
<div v-else>
|
|
35
|
+
<div v-else class="ui-desc__title">
|
|
36
36
|
<span v-for="(v, index) in item.labels" :key="index">{{v.prependLabel || v.label}}:{{v.valueLabel || v.value}}</span>
|
|
37
37
|
</div>
|
|
38
38
|
</div>
|
|
@@ -50,7 +50,9 @@
|
|
|
50
50
|
:key="index"
|
|
51
51
|
:title="item.map(v => `${v.prependLabel || v.label}:${v.valueLabel || v.value}`).join(';')"
|
|
52
52
|
@click="handleShortcut(item, index)">
|
|
53
|
-
<
|
|
53
|
+
<div class="ui-desc__title">
|
|
54
|
+
<span v-for="(v, i) in item" :key="i">{{v.prependLabel || v.label}}:{{v.valueLabel || v.value}}</span>
|
|
55
|
+
</div>
|
|
54
56
|
<el-tooltip class="item" effect="dark" content="添加到常用筛选" placement="top-start">
|
|
55
57
|
<i class="el-icon-circle-plus ui-flag--icon" @click.stop="handleOperation(index, 'temps')"></i>
|
|
56
58
|
</el-tooltip>
|
|
@@ -89,9 +91,10 @@ export default {
|
|
|
89
91
|
changeLabelTitleItem: {}
|
|
90
92
|
}
|
|
91
93
|
},
|
|
92
|
-
created() {
|
|
93
|
-
let locData = localStorage.getItem(`SaveRecord_${this.configKey}`);
|
|
94
|
-
|
|
94
|
+
async created() {
|
|
95
|
+
// let locData = localStorage.getItem(`SaveRecord_${this.configKey}`);
|
|
96
|
+
let locData = await this.$parent.getConfigCache(`SaveRecord_${this.configKey}`);
|
|
97
|
+
const recordData = !!Object.entries(locData).length ? locData : {
|
|
95
98
|
saves: [],
|
|
96
99
|
temps: []
|
|
97
100
|
}
|
|
@@ -173,7 +176,8 @@ export default {
|
|
|
173
176
|
if (this.recordData.temps.length > 10) {
|
|
174
177
|
this.recordData.temps.splice(10);
|
|
175
178
|
}
|
|
176
|
-
|
|
179
|
+
|
|
180
|
+
this.$parent.setConfigCache(`SaveRecord_${this.configKey}`, this.recordData);
|
|
177
181
|
},
|
|
178
182
|
|
|
179
183
|
// 修改标签名称
|
|
@@ -185,7 +189,7 @@ export default {
|
|
|
185
189
|
this.changeLabelTitleItem.title = this.changeLabelTitleVal;
|
|
186
190
|
this.changeLabelTitleVal = '';
|
|
187
191
|
this.$refs[`EditLabelTitlePopover_${index}`][0].doClose();
|
|
188
|
-
|
|
192
|
+
this.$parent.setConfigCache(`SaveRecord_${this.configKey}`, this.recordData);
|
|
189
193
|
}
|
|
190
194
|
},
|
|
191
195
|
watch: {
|
|
@@ -251,9 +255,6 @@ export default {
|
|
|
251
255
|
font-size: 12px;
|
|
252
256
|
margin-right: 8px;
|
|
253
257
|
margin-bottom: 8px;
|
|
254
|
-
text-overflow: ellipsis;
|
|
255
|
-
white-space: nowrap;
|
|
256
|
-
overflow: hidden;
|
|
257
258
|
border: 1px solid #f1f1f1;
|
|
258
259
|
padding: 5px;
|
|
259
260
|
background: #fefefe;
|
|
@@ -262,6 +263,13 @@ export default {
|
|
|
262
263
|
align-self: flex-end;
|
|
263
264
|
cursor: pointer;
|
|
264
265
|
position: relative;
|
|
266
|
+
max-width: 99%;
|
|
267
|
+
|
|
268
|
+
.ui-desc__title {
|
|
269
|
+
text-overflow: ellipsis;
|
|
270
|
+
white-space: nowrap;
|
|
271
|
+
overflow: hidden;
|
|
272
|
+
}
|
|
265
273
|
|
|
266
274
|
span {
|
|
267
275
|
background-color: #f1f1f1;
|
|
@@ -276,7 +284,7 @@ export default {
|
|
|
276
284
|
|
|
277
285
|
&:hover {
|
|
278
286
|
border-color: #b2d8ff;
|
|
279
|
-
min-width: 100px;
|
|
287
|
+
// min-width: 100px;
|
|
280
288
|
|
|
281
289
|
span {
|
|
282
290
|
background-color: #b2d8ff;
|
|
@@ -290,9 +298,8 @@ export default {
|
|
|
290
298
|
|
|
291
299
|
.ui-flag--icon {
|
|
292
300
|
position: absolute;
|
|
293
|
-
|
|
294
|
-
top:
|
|
295
|
-
margin-top: -8px;
|
|
301
|
+
left: 2px;
|
|
302
|
+
top: -8px;
|
|
296
303
|
font-size: 16px;
|
|
297
304
|
color: #409EFF;
|
|
298
305
|
display: none;
|
|
@@ -306,7 +313,7 @@ export default {
|
|
|
306
313
|
}
|
|
307
314
|
|
|
308
315
|
.el-icon-edit {
|
|
309
|
-
|
|
316
|
+
left: 26px;
|
|
310
317
|
font-size: 12px;
|
|
311
318
|
}
|
|
312
319
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="ui-search" ref="Search" v-loading="loadSearch">
|
|
3
|
+
<div class="ui-search--mask"
|
|
4
|
+
v-loading="true"
|
|
5
|
+
element-loading-text="加载配置中"
|
|
6
|
+
element-loading-background="rgba(255, 255, 255, 1)"
|
|
7
|
+
v-if="loadingConfig"></div>
|
|
3
8
|
<div class="ui-search__main" v-show="collspase">
|
|
4
9
|
<slot v-if="!useConfig"></slot>
|
|
5
10
|
<div v-else v-show="false"><slot></slot></div>
|
|
@@ -146,7 +151,10 @@ export default {
|
|
|
146
151
|
searchHeight: '',
|
|
147
152
|
listenerSearchTimes: '',
|
|
148
153
|
collspase: true,
|
|
149
|
-
showTip: false
|
|
154
|
+
showTip: false,
|
|
155
|
+
|
|
156
|
+
localConfig: null,
|
|
157
|
+
loadingConfig: true
|
|
150
158
|
}
|
|
151
159
|
},
|
|
152
160
|
computed: {
|
|
@@ -329,7 +337,8 @@ export default {
|
|
|
329
337
|
checkItems: this.checkItems,
|
|
330
338
|
sortItems: this.sortItems
|
|
331
339
|
}
|
|
332
|
-
|
|
340
|
+
|
|
341
|
+
this.setConfigCache(`SearchCfg__${this.configKey}`, saveConfig);
|
|
333
342
|
|
|
334
343
|
const sortItems = this.sortItems.map(item => {
|
|
335
344
|
const findItem = this.childItems.find(v => v.$options.propsData.label == item);
|
|
@@ -354,6 +363,41 @@ export default {
|
|
|
354
363
|
findTableRes && findTableRes.handleRefreshHeight();
|
|
355
364
|
}
|
|
356
365
|
}, 200);
|
|
366
|
+
},
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
async setConfigCache(key, value) {
|
|
370
|
+
|
|
371
|
+
if (!this.$UICONFIG.setCacheApi) {
|
|
372
|
+
|
|
373
|
+
localStorage.setItem(key, JSON.stringify(value));
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
this.localConfig[key] = JSON.stringify(value);
|
|
378
|
+
const { data:res } = await this.$http.post(this.$UICONFIG.setCacheApi, {
|
|
379
|
+
code: this.configKey,
|
|
380
|
+
datas: this.localConfig
|
|
381
|
+
});
|
|
382
|
+
},
|
|
383
|
+
|
|
384
|
+
async getConfigCache(key) {
|
|
385
|
+
|
|
386
|
+
if (!this.$UICONFIG.getCacheApi) {
|
|
387
|
+
this.loadingConfig = false;
|
|
388
|
+
return JSON.parse(localStorage.getItem(key) || "{}");
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
this.loadingConfig = true;
|
|
392
|
+
const { data:res } = await this.$http.post(this.$UICONFIG.getCacheApi, {
|
|
393
|
+
code: this.configKey
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
setTimeout(() => {
|
|
397
|
+
this.loadingConfig = false;
|
|
398
|
+
}, 500)
|
|
399
|
+
this.localConfig = !Object.entries(res.data).length ? {} : res.data;
|
|
400
|
+
return JSON.parse(res.data[key] || "{}");
|
|
357
401
|
}
|
|
358
402
|
},
|
|
359
403
|
async mounted() {
|
|
@@ -382,11 +426,20 @@ export default {
|
|
|
382
426
|
|
|
383
427
|
|
|
384
428
|
// 读取缓存配置
|
|
385
|
-
const locConfig =
|
|
429
|
+
const locConfig = await this.getConfigCache(`SearchCfg__${this.configKey}`);
|
|
386
430
|
if (locConfig.checkItems) {
|
|
387
431
|
await this.$nextTick();
|
|
388
|
-
|
|
389
|
-
|
|
432
|
+
|
|
433
|
+
// 处理搜索条件发生变更
|
|
434
|
+
const newItemInx = this.sortItems.findIndex(v => !locConfig.sortItems.includes(v));
|
|
435
|
+
if (newItemInx > -1) {
|
|
436
|
+
const newItem = this.sortItems[newItemInx];
|
|
437
|
+
locConfig.checkItems.push(newItem);
|
|
438
|
+
locConfig.sortItems.splice(newItemInx, 0, newItem);
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
this.checkItems = locConfig.checkItems.filter(v => this.sortItems.includes(v));
|
|
442
|
+
this.sortItems = locConfig.sortItems.filter(v => this.sortItems.includes(v));
|
|
390
443
|
this.handleRenderConfig();
|
|
391
444
|
}
|
|
392
445
|
} else {
|
|
@@ -436,6 +489,7 @@ export default {
|
|
|
436
489
|
</script>
|
|
437
490
|
<style lang="less" scoped>
|
|
438
491
|
.ui-search {
|
|
492
|
+
overflow: hidden;
|
|
439
493
|
// height: 138px;
|
|
440
494
|
box-sizing: border-box;
|
|
441
495
|
margin: 10px 10px 0 10px;
|
|
@@ -612,4 +666,13 @@ export default {
|
|
|
612
666
|
width: 100%;
|
|
613
667
|
}
|
|
614
668
|
}
|
|
669
|
+
|
|
670
|
+
.ui-search--mask {
|
|
671
|
+
position: absolute;
|
|
672
|
+
top: 0;
|
|
673
|
+
left: 0;
|
|
674
|
+
width: 100%;
|
|
675
|
+
height: 100%;
|
|
676
|
+
z-index: 99999;
|
|
677
|
+
}
|
|
615
678
|
</style>
|