lw-cdp-ui 1.3.13 → 1.3.15
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/components/lwFormMini/ViewItem.vue +3 -3
- package/dist/components/lwFormMini/index.vue +45 -25
- package/dist/components/lwSearch/date/date.vue +13 -15
- package/dist/components/lwSearch/dateRange/dateRange.vue +12 -14
- package/dist/components/lwSearch/index.vue +28 -18
- package/dist/lw-cdp-ui.esm.js +2575 -2562
- package/dist/lw-cdp-ui.umd.js +4 -4
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
<!-- 间隔标题 -->
|
|
3
3
|
<div v-if="item.component == 'divider'"
|
|
4
4
|
class="title-name title-name-divider"
|
|
5
|
-
:id="'divider-' +
|
|
6
|
-
:data-index="
|
|
5
|
+
:id="'divider-' + item.label"
|
|
6
|
+
:data-index="item.label">
|
|
7
7
|
<span>
|
|
8
8
|
{{ item.label }}
|
|
9
9
|
<el-tooltip v-if="item.tips">
|
|
@@ -289,7 +289,7 @@ export default {
|
|
|
289
289
|
if (!options?.multiple) {
|
|
290
290
|
val = [val]
|
|
291
291
|
}
|
|
292
|
-
let items = options.items.filter(item => { return val.includes(item.value)
|
|
292
|
+
let items = options.items.filter(item => { return val.includes(item.value) })
|
|
293
293
|
return items?.map(item => item.label).join('、') || val || '--'
|
|
294
294
|
},
|
|
295
295
|
dayjs: dayjs
|
|
@@ -313,13 +313,23 @@ export default {
|
|
|
313
313
|
this.$emit("submit", this.form)
|
|
314
314
|
},
|
|
315
315
|
clickAffix(index) {
|
|
316
|
-
this.affixIndex = index
|
|
317
|
-
const targetElement = document.getElementById('divider-' + index)
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
316
|
+
this.affixIndex = index;
|
|
317
|
+
const targetElement = document.getElementById('divider-' + index);
|
|
318
|
+
const scrollContainer = document.querySelector('.el-container > .el-main');
|
|
319
|
+
|
|
320
|
+
if (targetElement && scrollContainer) {
|
|
321
|
+
const offset = 85; // 目标元素与顶部的偏移量
|
|
322
|
+
const targetRect = targetElement.getBoundingClientRect();
|
|
323
|
+
const containerRect = scrollContainer.getBoundingClientRect();
|
|
324
|
+
|
|
325
|
+
// 计算目标元素相对于滚动容器内部的真实偏移量
|
|
326
|
+
const elementPosition = targetRect.top - containerRect.top + scrollContainer.scrollTop;
|
|
327
|
+
|
|
328
|
+
// 让 el-main 滚动到目标元素,保证它距离顶部 30px
|
|
329
|
+
scrollContainer.scrollTo({
|
|
330
|
+
top: elementPosition - offset,
|
|
331
|
+
behavior: 'smooth'
|
|
332
|
+
});
|
|
323
333
|
}
|
|
324
334
|
|
|
325
335
|
this.scrollObserverEnabled = false;
|
|
@@ -329,28 +339,38 @@ export default {
|
|
|
329
339
|
},
|
|
330
340
|
// 监听滚动
|
|
331
341
|
handleScroll() {
|
|
332
|
-
// 获取所有 title-name-divider 元素
|
|
333
342
|
const titleNameDividers = document.querySelectorAll('.title-name-divider');
|
|
334
343
|
const elMain = document.querySelector('.el-main');
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
+
|
|
345
|
+
if (!elMain || titleNameDividers.length === 0) return;
|
|
346
|
+
|
|
347
|
+
let _this = this;
|
|
348
|
+
|
|
349
|
+
// 创建 IntersectionObserver 观察滚动元素
|
|
350
|
+
const observer = new IntersectionObserver(
|
|
351
|
+
(entries) => {
|
|
352
|
+
entries.forEach((entry) => {
|
|
353
|
+
if (entry.isIntersecting && _this.scrollObserverEnabled) {
|
|
354
|
+
const dataIndex = entry.target.getAttribute('data-index');
|
|
355
|
+
_this.affixIndex = dataIndex; // 更新 affixIndex
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
root: elMain, // 设置 el-main 为滚动容器
|
|
361
|
+
rootMargin: '30px 0px -70% 0px', // 确保元素在滚动到 30px 位置时触发
|
|
362
|
+
threshold: 0.1 // 交叉比例,确保元素部分可见时触发
|
|
344
363
|
}
|
|
345
|
-
|
|
346
|
-
root: elMain, // 设置根元素为 el-main
|
|
347
|
-
rootMargin: '0px 0px 70% 0px' // 可根据需要调整
|
|
348
|
-
});
|
|
364
|
+
);
|
|
349
365
|
|
|
350
|
-
//
|
|
351
|
-
titleNameDividers.forEach(divider =>
|
|
352
|
-
|
|
353
|
-
|
|
366
|
+
// 观察每个 title-name-divider 元素
|
|
367
|
+
titleNameDividers.forEach((divider) => observer.observe(divider));
|
|
368
|
+
|
|
369
|
+
// 解绑旧的观察者(防止重复监听)
|
|
370
|
+
if (this.scrollObserver) {
|
|
371
|
+
this.scrollObserver.disconnect();
|
|
372
|
+
}
|
|
373
|
+
this.scrollObserver = observer;
|
|
354
374
|
}
|
|
355
375
|
}
|
|
356
376
|
}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
</el-date-picker>
|
|
16
|
-
</div>
|
|
2
|
+
<el-date-picker :type="item.type || 'date'"
|
|
3
|
+
:disabled="item.disabled"
|
|
4
|
+
:format="item.format || 'YYYY-MM-DD'"
|
|
5
|
+
:value-format="item.valueFormat"
|
|
6
|
+
:placeholder="item.placeholder || $t('lwSearch.please_select')"
|
|
7
|
+
:range-separator="item.rangeSeparator || $t('lwSearch.monthRange.rangeSeparator')"
|
|
8
|
+
:start-placeholder="item.startPlaceholder || $t('lwSearch.monthRange.startPlaceholder')"
|
|
9
|
+
:end-placeholder="item.endPlaceholder || $t('lwSearch.monthRange.endPlaceholder')"
|
|
10
|
+
clearable
|
|
11
|
+
v-model="value"
|
|
12
|
+
:disabled-date="disabledDate"
|
|
13
|
+
style="width: 100%">
|
|
14
|
+
</el-date-picker>
|
|
17
15
|
</template>
|
|
18
16
|
|
|
19
17
|
<script>
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
</el-date-picker>
|
|
15
|
-
</div>
|
|
2
|
+
<el-date-picker :showTime="item.showTime"
|
|
3
|
+
:format="item.format || 'YYYY-MM-DD HH:mm:ss'"
|
|
4
|
+
:value-format="item.valueFormat || 'YYYY-MM-DD HH:mm:ss'"
|
|
5
|
+
clearable
|
|
6
|
+
v-model="value"
|
|
7
|
+
style="width: 100%"
|
|
8
|
+
type="datetimerange"
|
|
9
|
+
:start-placeholder="item.startPlaceholder || $t('lwSearch.dateRange.startPlaceholder')"
|
|
10
|
+
:end-placeholder="item.endPlaceholder || $t('lwSearch.dateRange.endPlaceholder')"
|
|
11
|
+
:default-time="item.defaultTime || defaultTime(0)"
|
|
12
|
+
size="">
|
|
13
|
+
</el-date-picker>
|
|
16
14
|
</template>
|
|
17
15
|
|
|
18
16
|
<script>
|
|
@@ -6,14 +6,12 @@
|
|
|
6
6
|
@submit.prevent
|
|
7
7
|
:label-align="labelAlign"
|
|
8
8
|
style="width: 100%">
|
|
9
|
-
<el-row :class="
|
|
10
|
-
type="flex"
|
|
11
|
-
justify="start"
|
|
9
|
+
<el-row :class="[isExpandRow ? 'expand-row' : '']"
|
|
12
10
|
:gutter="10">
|
|
13
11
|
<template v-for="(item, index) in options"
|
|
14
12
|
:key="item.prop">
|
|
15
|
-
<el-col :class="(
|
|
16
|
-
:span="
|
|
13
|
+
<el-col :class="[isDefaultShow(index) ? '' : isExpandStatus ? '' : 'hide']"
|
|
14
|
+
:span="item?.span ? item.span : 6">
|
|
17
15
|
<el-form-item :label-width="hideLabel ? 0 : labelWidth"
|
|
18
16
|
:required="item.required"
|
|
19
17
|
:label="hideLabel ? '' : $t(item.label)">
|
|
@@ -65,7 +63,7 @@
|
|
|
65
63
|
{{$t('btn.query')}}
|
|
66
64
|
</el-button>
|
|
67
65
|
|
|
68
|
-
<div :class="
|
|
66
|
+
<div :class="isExpandNumber ? 'expand-button' : 'hidden'"
|
|
69
67
|
@click="handleExpandStatus()">
|
|
70
68
|
<span>{{ isExpandStatus ? "收起" : "展开" }}</span>
|
|
71
69
|
</div>
|
|
@@ -113,11 +111,6 @@ export default {
|
|
|
113
111
|
type: String,
|
|
114
112
|
default: "left",
|
|
115
113
|
},
|
|
116
|
-
columnNumber: {
|
|
117
|
-
// 每行列数量
|
|
118
|
-
type: Number,
|
|
119
|
-
default: 4,
|
|
120
|
-
},
|
|
121
114
|
isSave: {
|
|
122
115
|
// 是否保存功能
|
|
123
116
|
type: Boolean,
|
|
@@ -138,11 +131,6 @@ export default {
|
|
|
138
131
|
type: Boolean,
|
|
139
132
|
default: false,
|
|
140
133
|
},
|
|
141
|
-
expandNumber: {
|
|
142
|
-
// 默认收起展示数量
|
|
143
|
-
type: Number,
|
|
144
|
-
default: 4,
|
|
145
|
-
},
|
|
146
134
|
hasExpandAll: {
|
|
147
135
|
// 默认收起展示数量
|
|
148
136
|
type: Boolean,
|
|
@@ -170,8 +158,8 @@ export default {
|
|
|
170
158
|
isSaveShow: false, // 是否展示保存操作
|
|
171
159
|
isSelectShow: false, // 是否展示选择操作
|
|
172
160
|
selectForm: "", // 当前选中数据
|
|
173
|
-
currentExpandNumber: 4, // 当前收起展示数量
|
|
174
161
|
isExpandAll: true,
|
|
162
|
+
span: 6,
|
|
175
163
|
currentTemplate: {},
|
|
176
164
|
variantList: [],
|
|
177
165
|
varianId: [],
|
|
@@ -203,9 +191,26 @@ export default {
|
|
|
203
191
|
deep: true,
|
|
204
192
|
},
|
|
205
193
|
},
|
|
194
|
+
computed: {
|
|
195
|
+
// 是否显示展开关闭按钮
|
|
196
|
+
isExpandNumber() {
|
|
197
|
+
let spans = this.options.reduce((sum, item) => sum + (item.span || this.span), 0)
|
|
198
|
+
return (spans - 24) > 0;
|
|
199
|
+
},
|
|
200
|
+
// 是否行内显示按钮
|
|
201
|
+
isExpandRow() {
|
|
202
|
+
const spans = this.options.reduce((sum, item) => sum + (item.span || this.span), 0);
|
|
203
|
+
const remainder = spans % 24;
|
|
204
|
+
|
|
205
|
+
if (spans > 18) {
|
|
206
|
+
return !this.isExpandStatus || remainder === 0 || (remainder > 15 && remainder < 24);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return false
|
|
210
|
+
},
|
|
211
|
+
},
|
|
206
212
|
mounted() {
|
|
207
213
|
this.isExpandStatus = this.isExpand;
|
|
208
|
-
this.currentExpandNumber = this.expandNumber || this.columnNumber;
|
|
209
214
|
this.form = JSON.parse(JSON.stringify(this.modelValue));
|
|
210
215
|
this.defaultForm =
|
|
211
216
|
JSON.stringify(this.defaultForm) === "{}"
|
|
@@ -213,6 +218,11 @@ export default {
|
|
|
213
218
|
: this.defaultForm;
|
|
214
219
|
},
|
|
215
220
|
methods: {
|
|
221
|
+
// 是否默认展示
|
|
222
|
+
isDefaultShow(index) {
|
|
223
|
+
let span = this.options.slice(0, index + 1).reduce((sum, item) => sum + (item.span || this.span), 0)
|
|
224
|
+
return span <= 24;
|
|
225
|
+
},
|
|
216
226
|
// 切换展开状态
|
|
217
227
|
handleExpandStatus() {
|
|
218
228
|
this.isExpandStatus = !this.isExpandStatus;
|