n20-common-lib 3.0.96 → 3.0.98
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/package.json +1 -1
- package/src/assets/css/rootvar.scss +74 -0
- package/src/components/AdvancedFilter/index.vue +1 -1
- package/src/components/ProFilterView/index.vue +127 -88
- package/src/components/TableOperate/index.vue +1 -1
- package/src/components/v3/TablePro/index.vue +3 -1
- package/style/index.css +1 -1
- package/theme/blue.css +1 -1
- package/theme/cctcRed.css +1 -1
- package/theme/green.css +1 -1
- package/theme/lightBlue.css +1 -1
- package/theme/orange.css +1 -1
- package/theme/purple.css +1 -1
- package/theme/red.css +1 -1
- package/theme/yellow.css +1 -1
package/package.json
CHANGED
|
@@ -148,4 +148,78 @@ $--color-FFBF00: #ffbf00;
|
|
|
148
148
|
--color-AE89E0: #ae89e0;
|
|
149
149
|
--color-5F5CD2: #5f5cd2;
|
|
150
150
|
--color-7585A2: #7585a2;
|
|
151
|
+
|
|
152
|
+
// ==================== 其他系统色 ====================
|
|
153
|
+
|
|
154
|
+
// 碧涛青 Cyan (Success 系)
|
|
155
|
+
--color-success-6: #0fc6c2;
|
|
156
|
+
--color-success-5: #33d1c9;
|
|
157
|
+
--color-success-7: #0aa5a8;
|
|
158
|
+
--color-success-3: #86e8dd;
|
|
159
|
+
--color-success-2: #b5f4ea;
|
|
160
|
+
--color-success-1: #e8fffb;
|
|
161
|
+
|
|
162
|
+
// 晚秋橙红 Orange Red
|
|
163
|
+
--color-orange-red-6: #f77234;
|
|
164
|
+
--color-orange-red-5: #f99057;
|
|
165
|
+
--color-orange-red-7: #cc5120;
|
|
166
|
+
--color-orange-red-3: #fcc59f;
|
|
167
|
+
--color-orange-red-2: #fddcc3;
|
|
168
|
+
--color-orange-red-1: #fff3eb;
|
|
169
|
+
|
|
170
|
+
// 黄油 Gold
|
|
171
|
+
--color-gold-6: #f7ba1e;
|
|
172
|
+
--color-gold-5: #f9cc45;
|
|
173
|
+
--color-gold-7: #cc9213;
|
|
174
|
+
--color-gold-3: #fce996;
|
|
175
|
+
--color-gold-2: #fdf4bf;
|
|
176
|
+
--color-gold-1: #fffcf8;
|
|
177
|
+
|
|
178
|
+
// 海蔚蓝 Blue
|
|
179
|
+
--color-blue-6: #3491fa;
|
|
180
|
+
--color-blue-5: #57a9fb;
|
|
181
|
+
--color-blue-7: #206ccf;
|
|
182
|
+
--color-blue-3: #9fd4fd;
|
|
183
|
+
--color-blue-2: #c3e7fe;
|
|
184
|
+
--color-blue-1: #e8f7ff;
|
|
185
|
+
|
|
186
|
+
// 暗夜紫 Purple
|
|
187
|
+
--color-purple-6: #722ed1;
|
|
188
|
+
--color-purple-5: #8d4eda;
|
|
189
|
+
--color-purple-7: #551db0;
|
|
190
|
+
--color-purple-3: #c396ed;
|
|
191
|
+
--color-purple-2: #ddbef6;
|
|
192
|
+
--color-purple-1: #f5ebff;
|
|
193
|
+
|
|
194
|
+
// 柠檬黄 Yellow
|
|
195
|
+
--color-yellow-6: #fadc19;
|
|
196
|
+
--color-yellow-5: #fbe842;
|
|
197
|
+
--color-yellow-7: #cfaf0f;
|
|
198
|
+
--color-yellow-3: #fdfa94;
|
|
199
|
+
--color-yellow-2: #fefebe;
|
|
200
|
+
--color-yellow-1: #feffe8;
|
|
201
|
+
|
|
202
|
+
// 新生绿 Lime
|
|
203
|
+
--color-lime-6: #9fdb1d;
|
|
204
|
+
--color-lime-5: #b5e241;
|
|
205
|
+
--color-lime-7: #7eb712;
|
|
206
|
+
--color-lime-3: #dcf190;
|
|
207
|
+
--color-lime-2: #edf8bb;
|
|
208
|
+
--color-lime-1: #fcffeb;
|
|
209
|
+
|
|
210
|
+
// 青春紫 Pink Purple
|
|
211
|
+
--color-pink-purple-6: #d91ad9;
|
|
212
|
+
--color-pink-purple-5: #e13edb;
|
|
213
|
+
--color-pink-purple-7: #b01db6;
|
|
214
|
+
--color-pink-purple-3: #f08ee6;
|
|
215
|
+
--color-pink-purple-2: #f7baef;
|
|
216
|
+
--color-pink-purple-1: #ffebfb;
|
|
217
|
+
|
|
218
|
+
// 品红 Magenta
|
|
219
|
+
--color-magenta-6: #f5319d;
|
|
220
|
+
--color-magenta-5: #f754a8;
|
|
221
|
+
--color-magenta-7: #cb1eb3;
|
|
222
|
+
--color-magenta-3: #f89dc7;
|
|
223
|
+
--color-magenta-2: #fdc2db;
|
|
224
|
+
--color-magenta-1: #ffe8f1;
|
|
151
225
|
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
:key="getOnlyKey(item)"
|
|
8
8
|
:class="[prefixCls + '-item', activeClass(item)]"
|
|
9
9
|
:label="item.label"
|
|
10
|
-
:required="item.required
|
|
10
|
+
:required="!!item.required"
|
|
11
11
|
:disabled="item.props && item.props.disabled"
|
|
12
12
|
>
|
|
13
13
|
<div :class="prefixCls + '-content'">
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<div class="flex-box flex-v">
|
|
6
6
|
<el-popover
|
|
7
7
|
v-if="bussId"
|
|
8
|
-
v-model="
|
|
8
|
+
v-model="viewPopoverVisible"
|
|
9
9
|
popper-class="pro-filter-view-popover"
|
|
10
10
|
placement="bottom-start"
|
|
11
11
|
trigger="click"
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
</div>
|
|
20
20
|
</el-button>
|
|
21
21
|
<div class="p-s">
|
|
22
|
-
<cl-input-search v-model="
|
|
22
|
+
<cl-input-search v-model="searchKeyword" class="w-100p" placeholder="请输入关键字" />
|
|
23
23
|
<div style="color: var(--color-text-secondary); margin: 12px 0 8px 0">{{ $lc('自定义视图') }}</div>
|
|
24
24
|
<div class="filter-view-wrapper">
|
|
25
|
-
<cl-drag-list class="flex-item" :list="filteredList" :hide-delete="true" @change="
|
|
25
|
+
<cl-drag-list class="flex-item" :list="filteredList" :hide-delete="true" @change="handleDragSort">
|
|
26
26
|
<template v-slot="{ item }">
|
|
27
27
|
<div class="proFilterView-list-item" :class="{ 'is-selected': selectedItem === item.viewName }">
|
|
28
28
|
<span class="proFilterView-list-item__name" :title="item.viewName" @click="handleSelect(item)">{{
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
</div>
|
|
68
68
|
</el-button>
|
|
69
69
|
<div class="flex-box flex-v">
|
|
70
|
-
<el-button icon="v3-icon-filter" class="m-r-s botton" @click="
|
|
70
|
+
<el-button icon="v3-icon-filter" class="m-r-s botton" @click="filterExpanded = !filterExpanded">{{
|
|
71
71
|
'筛选' | $lc
|
|
72
72
|
}}</el-button>
|
|
73
73
|
<slot name="rightContent"></slot>
|
|
@@ -77,8 +77,8 @@
|
|
|
77
77
|
<cl-advanced-filter
|
|
78
78
|
ref="filter"
|
|
79
79
|
class="filter"
|
|
80
|
-
:class="{ 'is-hidden': !
|
|
81
|
-
:visible.sync="
|
|
80
|
+
:class="{ 'is-hidden': !filterExpanded }"
|
|
81
|
+
:visible.sync="filterExpanded"
|
|
82
82
|
:filter-id="filterId"
|
|
83
83
|
:buss-id="bussId"
|
|
84
84
|
:model="searchValue"
|
|
@@ -95,9 +95,8 @@
|
|
|
95
95
|
<div slot="prefix">
|
|
96
96
|
<slot name="prefix"></slot>
|
|
97
97
|
</div>
|
|
98
|
-
<!-- 使用作用域插槽传递 searchValue -->
|
|
99
98
|
<template
|
|
100
|
-
v-for="filter in
|
|
99
|
+
v-for="filter in slotFilters"
|
|
101
100
|
#[filter.slotName]="{ model }"
|
|
102
101
|
>
|
|
103
102
|
<slot
|
|
@@ -131,25 +130,24 @@
|
|
|
131
130
|
<div>{{ $lc('数据范围') }}</div>
|
|
132
131
|
<div style="color: var(--color-primary); cursor: pointer" @click="typeChange">
|
|
133
132
|
<i class="v3-icon-switch"></i>
|
|
134
|
-
<span v-if="form.viewType ===
|
|
133
|
+
<span v-if="form.viewType === VIEW_TYPE.ADVANCED"> {{ $lc('高级查询') }}</span>
|
|
135
134
|
<span v-else> {{ $lc('基础查询') }}</span>
|
|
136
135
|
</div>
|
|
137
136
|
</div>
|
|
138
137
|
<cl-advanced-filter
|
|
139
|
-
v-if="form.viewType ===
|
|
138
|
+
v-if="form.viewType === VIEW_TYPE.ADVANCED"
|
|
140
139
|
ref="filter"
|
|
141
|
-
:key="
|
|
140
|
+
:key="dialogFilterKey"
|
|
142
141
|
class="filter"
|
|
143
|
-
:visible
|
|
142
|
+
:visible="visible"
|
|
144
143
|
:model="searchForm"
|
|
145
144
|
only-key="id"
|
|
146
145
|
:filter-list="filterList"
|
|
147
146
|
:check-ids="form.keyIds"
|
|
148
147
|
@saveCheckData="saveCheckData"
|
|
149
148
|
>
|
|
150
|
-
<!-- 使用作用域插槽传递 searchValue -->
|
|
151
149
|
<template
|
|
152
|
-
v-for="filter in
|
|
150
|
+
v-for="filter in slotFilters"
|
|
153
151
|
#[filter.slotName]="{ model }"
|
|
154
152
|
>
|
|
155
153
|
<slot
|
|
@@ -168,9 +166,8 @@
|
|
|
168
166
|
:filter-id="filterId"
|
|
169
167
|
:buss-id="bussId"
|
|
170
168
|
>
|
|
171
|
-
<!-- 使用作用域插槽传递 slot 类型的过滤器 -->
|
|
172
169
|
<template
|
|
173
|
-
v-for="filter in
|
|
170
|
+
v-for="filter in slotFilters"
|
|
174
171
|
#[filter.slotName]="{ model, value, input, disabled }"
|
|
175
172
|
>
|
|
176
173
|
<slot
|
|
@@ -199,6 +196,8 @@ import ClDragList from '../DragList/index.vue'
|
|
|
199
196
|
import ClDialog from '../Dialog/index.vue'
|
|
200
197
|
import axios from '../../utils/axios.js'
|
|
201
198
|
|
|
199
|
+
const VIEW_TYPE = { ADVANCED: '0', BASIC: '1' }
|
|
200
|
+
|
|
202
201
|
export default {
|
|
203
202
|
name: 'ProFilterView',
|
|
204
203
|
components: {
|
|
@@ -234,19 +233,17 @@ export default {
|
|
|
234
233
|
},
|
|
235
234
|
data() {
|
|
236
235
|
return {
|
|
237
|
-
|
|
236
|
+
VIEW_TYPE,
|
|
237
|
+
searchKeyword: '',
|
|
238
238
|
list: ['无视图'],
|
|
239
239
|
selectedItem: '无视图', // 默认选中第一项
|
|
240
|
-
|
|
240
|
+
viewPopoverVisible: false,
|
|
241
241
|
visible: false,
|
|
242
242
|
isAdd: false,
|
|
243
243
|
form: { userNo: sessionStorage.getItem('userNo'), pageNo: this.filterId },
|
|
244
244
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
checkData: [],
|
|
248
|
-
key: 0,
|
|
249
|
-
keyIds: [],
|
|
245
|
+
filterExpanded: this.defaultExpanded,
|
|
246
|
+
dialogFilterKey: 0,
|
|
250
247
|
selectItem: '',
|
|
251
248
|
// 高级视图筛选
|
|
252
249
|
conditionGroups: [],
|
|
@@ -255,21 +252,29 @@ export default {
|
|
|
255
252
|
// 普通筛选值
|
|
256
253
|
searchValue: {},
|
|
257
254
|
viewId: undefined,
|
|
258
|
-
isRefresh: false
|
|
255
|
+
isRefresh: false,
|
|
256
|
+
// 视图类型切换时缓存对方数据
|
|
257
|
+
savedViewConfigs: {}
|
|
259
258
|
}
|
|
260
259
|
},
|
|
261
260
|
computed: {
|
|
262
261
|
/**
|
|
263
262
|
* 本地搜索过滤视图列表
|
|
264
|
-
* @returns {Array} 根据
|
|
263
|
+
* @returns {Array} 根据 searchKeyword 过滤后的视图列表;searchKeyword 为空时返回完整列表
|
|
265
264
|
*/
|
|
266
265
|
filteredList() {
|
|
267
|
-
if (!this.
|
|
266
|
+
if (!this.searchKeyword) {
|
|
268
267
|
return this.list
|
|
269
268
|
}
|
|
270
|
-
const keyword = this.
|
|
269
|
+
const keyword = this.searchKeyword.toLowerCase()
|
|
271
270
|
return this.list.filter((item) => item.viewName && item.viewName.toLowerCase().includes(keyword))
|
|
272
271
|
},
|
|
272
|
+
// 筛选出类型为 slot 且在父组件提供了对应作用域插槽的筛选项
|
|
273
|
+
slotFilters() {
|
|
274
|
+
return this.filterList.filter(
|
|
275
|
+
(item) => item.type === 'slot' && this.$scopedSlots[item.slotName]
|
|
276
|
+
)
|
|
277
|
+
},
|
|
273
278
|
getInitialSearchValue() {
|
|
274
279
|
const obj = {}
|
|
275
280
|
// 遍历 filterList,为每个 type 为 slot 的项初始化值
|
|
@@ -381,8 +386,36 @@ export default {
|
|
|
381
386
|
this.$emit('filter', this.filterObj, 'clean')
|
|
382
387
|
},
|
|
383
388
|
handleClear() {
|
|
384
|
-
|
|
385
|
-
|
|
389
|
+
// 收集 required 项的当前值,清空时保留
|
|
390
|
+
const preserved = {}
|
|
391
|
+
this.filterList.forEach((item) => {
|
|
392
|
+
if (!item.required) return
|
|
393
|
+
if (item.type === 'daterange' || item.type === 'datetimerange' || item.type === 'monthrange') {
|
|
394
|
+
if (item.startDate && this.searchValue[item.startDate] !== undefined) {
|
|
395
|
+
preserved[item.startDate] = this.searchValue[item.startDate]
|
|
396
|
+
}
|
|
397
|
+
if (item.endDate && this.searchValue[item.endDate] !== undefined) {
|
|
398
|
+
preserved[item.endDate] = this.searchValue[item.endDate]
|
|
399
|
+
}
|
|
400
|
+
} else if (item.type === 'numberrange') {
|
|
401
|
+
if (item.startValue && this.searchValue[item.startValue] !== undefined) {
|
|
402
|
+
preserved[item.startValue] = this.searchValue[item.startValue]
|
|
403
|
+
}
|
|
404
|
+
if (item.endValue && this.searchValue[item.endValue] !== undefined) {
|
|
405
|
+
preserved[item.endValue] = this.searchValue[item.endValue]
|
|
406
|
+
}
|
|
407
|
+
} else if (item.value && this.searchValue[item.value] !== undefined) {
|
|
408
|
+
preserved[item.value] = this.searchValue[item.value]
|
|
409
|
+
}
|
|
410
|
+
})
|
|
411
|
+
this.searchValue = { ...this.getInitialSearchValue, ...preserved }
|
|
412
|
+
// 直接构建 payload,绕过 filterObj 避免 initialValue 重新注入
|
|
413
|
+
this.$emit('filter', {
|
|
414
|
+
conditionGroups: this.conditionGroups,
|
|
415
|
+
searchValue: { ...this.searchValue },
|
|
416
|
+
viewId: this.selectItem ? this.selectItem.viewId : null,
|
|
417
|
+
viewType: this.selectItem ? this.selectItem.viewType : null
|
|
418
|
+
}, 'clear')
|
|
386
419
|
},
|
|
387
420
|
isEnter() {
|
|
388
421
|
this.$rulesValidateForm('ruleValidate', (valid) => {
|
|
@@ -406,7 +439,7 @@ export default {
|
|
|
406
439
|
.get(`/bems/query/viewColumn/getViewInfo`, { bussId: this.bussId })
|
|
407
440
|
.then((res) => {
|
|
408
441
|
list = res.data.map((item) => {
|
|
409
|
-
item.keyIds =
|
|
442
|
+
item.keyIds = this.safeParse(item.keyIds, [])
|
|
410
443
|
return item
|
|
411
444
|
})
|
|
412
445
|
this.list = [
|
|
@@ -434,13 +467,13 @@ export default {
|
|
|
434
467
|
// 新增
|
|
435
468
|
add() {
|
|
436
469
|
this.isRefresh = false
|
|
437
|
-
this.
|
|
470
|
+
this.viewPopoverVisible = false
|
|
438
471
|
this.visible = true
|
|
439
472
|
this.isAdd = true
|
|
440
473
|
this.form = {
|
|
441
474
|
userNo: sessionStorage.getItem('userNo'),
|
|
442
475
|
pageNo: this.filterId,
|
|
443
|
-
viewType:
|
|
476
|
+
viewType: VIEW_TYPE.ADVANCED
|
|
444
477
|
}
|
|
445
478
|
this.viewId = undefined
|
|
446
479
|
this.form.keyIds = []
|
|
@@ -449,30 +482,37 @@ export default {
|
|
|
449
482
|
...this.getInitialSearchValue
|
|
450
483
|
}
|
|
451
484
|
// 新建时重置切换缓存
|
|
452
|
-
this.
|
|
485
|
+
this.savedViewConfigs = {}
|
|
453
486
|
},
|
|
454
487
|
// 修改
|
|
455
488
|
edit(item, isRefresh = false) {
|
|
456
489
|
this.isRefresh = isRefresh
|
|
457
490
|
console.log(item)
|
|
458
|
-
this.
|
|
491
|
+
this.viewPopoverVisible = false
|
|
459
492
|
this.visible = true
|
|
460
493
|
this.isAdd = false
|
|
461
|
-
this.
|
|
494
|
+
this.dialogFilterKey++
|
|
462
495
|
// 赋值操作
|
|
463
496
|
this.form = item
|
|
464
497
|
this.viewId = item.viewId
|
|
465
498
|
// 初始化两种类型的已保存数据缓存,供 typeChange 切换时恢复使用
|
|
466
|
-
this.
|
|
467
|
-
if (item.viewType ===
|
|
468
|
-
const parsed =
|
|
499
|
+
this.savedViewConfigs = {}
|
|
500
|
+
if (item.viewType === VIEW_TYPE.ADVANCED) {
|
|
501
|
+
const parsed = this.safeParse(item.viewConfig)
|
|
469
502
|
this.searchForm = { ...this.getInitialSearchValue, ...parsed }
|
|
470
|
-
this.
|
|
503
|
+
this.savedViewConfigs[VIEW_TYPE.ADVANCED] = { ...parsed }
|
|
471
504
|
} else {
|
|
472
|
-
const parsed =
|
|
505
|
+
const parsed = this.safeParse(item.viewConfig)
|
|
473
506
|
this.conditionGroups = parsed.conditionGroups || []
|
|
474
507
|
|
|
475
|
-
this.
|
|
508
|
+
this.savedViewConfigs[VIEW_TYPE.BASIC] = { conditionGroups: this.conditionGroups }
|
|
509
|
+
}
|
|
510
|
+
},
|
|
511
|
+
safeParse(str, fallback = {}) {
|
|
512
|
+
try {
|
|
513
|
+
return JSON.parse(str || '{}')
|
|
514
|
+
} catch {
|
|
515
|
+
return fallback
|
|
476
516
|
}
|
|
477
517
|
},
|
|
478
518
|
// 保存筛选条件
|
|
@@ -481,29 +521,31 @@ export default {
|
|
|
481
521
|
return item.id
|
|
482
522
|
})
|
|
483
523
|
},
|
|
484
|
-
//
|
|
485
|
-
|
|
486
|
-
// 如果没有 bussId,不保存视图
|
|
487
|
-
if (!this.bussId) {
|
|
488
|
-
this.$message.warning('缺少业务ID,无法保存视图')
|
|
489
|
-
return
|
|
490
|
-
}
|
|
491
|
-
|
|
524
|
+
// 构建视图保存请求体
|
|
525
|
+
buildViewPayload() {
|
|
492
526
|
let viewConfig
|
|
493
527
|
let keyIds
|
|
494
|
-
if (this.form.viewType ===
|
|
528
|
+
if (this.form.viewType === VIEW_TYPE.ADVANCED) {
|
|
495
529
|
viewConfig = JSON.stringify(this.searchForm)
|
|
496
530
|
keyIds = this.form.keyIds
|
|
497
531
|
} else {
|
|
498
532
|
viewConfig = JSON.stringify({ conditionGroups: this.conditionGroups })
|
|
499
533
|
keyIds = []
|
|
500
534
|
}
|
|
501
|
-
console.log(this.conditionGroups)
|
|
502
535
|
this.form.viewConfig = viewConfig
|
|
503
|
-
|
|
504
|
-
|
|
536
|
+
return {
|
|
537
|
+
viewName: this.form.viewName,
|
|
538
|
+
viewType: this.form.viewType,
|
|
539
|
+
bussId: this.bussId,
|
|
540
|
+
viewConfig,
|
|
541
|
+
keyIds: JSON.stringify(keyIds),
|
|
542
|
+
viewId: this.viewId
|
|
543
|
+
}
|
|
544
|
+
},
|
|
545
|
+
// 检查基础查询条件是否有空值
|
|
546
|
+
hasEmptyCondition() {
|
|
547
|
+
return this.conditionGroups.some((group) =>
|
|
505
548
|
group.conditions.some((condition) => {
|
|
506
|
-
// operator 5(为空) 和 6(不为空) 不需要填写 value
|
|
507
549
|
if (condition.operator === 5 || condition.operator === 6) {
|
|
508
550
|
return false
|
|
509
551
|
}
|
|
@@ -511,35 +553,34 @@ export default {
|
|
|
511
553
|
return val === null || val === undefined || val === '' || (Array.isArray(val) && val.length === 0)
|
|
512
554
|
})
|
|
513
555
|
)
|
|
556
|
+
},
|
|
557
|
+
// 保存视图
|
|
558
|
+
saveSt() {
|
|
559
|
+
if (!this.bussId) {
|
|
560
|
+
this.$message.warning('缺少业务ID,无法保存视图')
|
|
561
|
+
return
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
const payload = this.buildViewPayload()
|
|
565
|
+
const hasEmptyValue = this.hasEmptyCondition()
|
|
514
566
|
|
|
515
567
|
this.$refs.form.validate(async (valid) => {
|
|
516
568
|
if (!valid) {
|
|
517
569
|
this.$message.error('请输入视图名称')
|
|
518
570
|
return
|
|
519
571
|
}
|
|
520
|
-
|
|
521
|
-
if (this.form.viewType === '0' && !keyIds.length) {
|
|
572
|
+
if (this.form.viewType === VIEW_TYPE.ADVANCED && !this.form.keyIds.length) {
|
|
522
573
|
this.$message.warning('至少添加一个条件')
|
|
523
574
|
return
|
|
524
575
|
}
|
|
525
|
-
if (this.form.viewType ===
|
|
576
|
+
if (this.form.viewType === VIEW_TYPE.BASIC) {
|
|
526
577
|
if (!this.conditionGroups.length || hasEmptyValue) {
|
|
527
578
|
this.$message.warning('至少添加一个条件')
|
|
528
579
|
return
|
|
529
580
|
}
|
|
530
581
|
}
|
|
531
582
|
|
|
532
|
-
|
|
533
|
-
const obj = {
|
|
534
|
-
viewName: this.form.viewName,
|
|
535
|
-
viewType: this.form.viewType,
|
|
536
|
-
bussId: this.bussId,
|
|
537
|
-
viewConfig: this.form.viewConfig,
|
|
538
|
-
keyIds: JSON.stringify(keyIds),
|
|
539
|
-
viewId: this.viewId
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
axios.post('/bems/query/viewColumn/saveOrUpdateViewInfo', obj).then((res) => {
|
|
583
|
+
axios.post('/bems/query/viewColumn/saveOrUpdateViewInfo', payload).then((res) => {
|
|
543
584
|
if (res.code !== 200) {
|
|
544
585
|
return false
|
|
545
586
|
}
|
|
@@ -567,7 +608,7 @@ export default {
|
|
|
567
608
|
// 选中视图
|
|
568
609
|
handleSelect(item) {
|
|
569
610
|
console.log(item)
|
|
570
|
-
this.
|
|
611
|
+
this.viewPopoverVisible = false
|
|
571
612
|
this.selectItem = item
|
|
572
613
|
this.selectedItem = item.viewName
|
|
573
614
|
if (item.viewName === '无视图') {
|
|
@@ -575,17 +616,18 @@ export default {
|
|
|
575
616
|
this.searchValue = {}
|
|
576
617
|
this.conditionGroups = []
|
|
577
618
|
}
|
|
578
|
-
if (item.viewType ===
|
|
579
|
-
|
|
580
|
-
this.
|
|
581
|
-
|
|
582
|
-
|
|
619
|
+
if (item.viewType === VIEW_TYPE.ADVANCED) {
|
|
620
|
+
const config = this.safeParse(item.viewConfig)
|
|
621
|
+
this.searchForm = config
|
|
622
|
+
this.searchValue = config
|
|
623
|
+
} else if (item.viewType === VIEW_TYPE.BASIC) {
|
|
624
|
+
this.conditionGroups = this.safeParse(item.viewConfig).conditionGroups || []
|
|
583
625
|
this.searchValue = { ...this.getInitialSearchValue }
|
|
584
626
|
}
|
|
585
627
|
this.$emit('filter', this.filterObj, 'filter')
|
|
586
628
|
},
|
|
587
629
|
// 拖动保存视图列表
|
|
588
|
-
|
|
630
|
+
handleDragSort(list) {
|
|
589
631
|
console.log('当前list:', list)
|
|
590
632
|
},
|
|
591
633
|
/**
|
|
@@ -594,23 +636,22 @@ export default {
|
|
|
594
636
|
* 若无已保存数据则重置为初始值
|
|
595
637
|
*/
|
|
596
638
|
typeChange() {
|
|
597
|
-
this.form.viewType = this.form.viewType ===
|
|
598
|
-
//
|
|
599
|
-
if (this.form.viewType ===
|
|
639
|
+
this.form.viewType = this.form.viewType === VIEW_TYPE.ADVANCED ? VIEW_TYPE.BASIC : VIEW_TYPE.ADVANCED
|
|
640
|
+
// 切换到高级查询
|
|
641
|
+
if (this.form.viewType === VIEW_TYPE.ADVANCED) {
|
|
600
642
|
this.conditionGroups = []
|
|
601
643
|
// 若已有保存的 viewConfig 且原始类型也是基础查询,则恢复已保存的搜索条件
|
|
602
|
-
const savedConfig = this.
|
|
644
|
+
const savedConfig = this.savedViewConfigs[VIEW_TYPE.ADVANCED]
|
|
603
645
|
if (savedConfig) {
|
|
604
646
|
this.searchForm = { ...this.getInitialSearchValue, ...savedConfig }
|
|
605
647
|
} else {
|
|
606
648
|
this.searchForm = { ...this.getInitialSearchValue }
|
|
607
649
|
}
|
|
608
650
|
} else {
|
|
609
|
-
//
|
|
610
|
-
|
|
611
|
-
this._savedViewConfigs['0'] = { ...this.searchForm }
|
|
651
|
+
// 切换到基础查询,保存当前高级查询数据
|
|
652
|
+
this.savedViewConfigs[VIEW_TYPE.ADVANCED] = { ...this.searchForm }
|
|
612
653
|
// 恢复已保存的高级查询数据,若无则重置
|
|
613
|
-
const savedConfig = this.
|
|
654
|
+
const savedConfig = this.savedViewConfigs[VIEW_TYPE.BASIC]
|
|
614
655
|
if (savedConfig) {
|
|
615
656
|
this.conditionGroups = savedConfig.conditionGroups || []
|
|
616
657
|
} else {
|
|
@@ -624,17 +665,15 @@ export default {
|
|
|
624
665
|
* 供下游调用以恢复组件初始状态
|
|
625
666
|
*/
|
|
626
667
|
resetState() {
|
|
627
|
-
this.
|
|
668
|
+
this.searchKeyword = ''
|
|
628
669
|
this.selectedItem = '无视图'
|
|
629
670
|
this.selectItem = ''
|
|
630
671
|
this.searchValue = { ...this.getInitialSearchValue, ...this.initialValue }
|
|
631
672
|
this.searchForm = { ...this.getInitialSearchValue }
|
|
632
673
|
this.conditionGroups = []
|
|
633
|
-
this.
|
|
634
|
-
this.checkData = []
|
|
635
|
-
this.keyIds = []
|
|
674
|
+
this.filterExpanded = this.defaultExpanded
|
|
636
675
|
this.viewId = undefined
|
|
637
|
-
this.
|
|
676
|
+
this.savedViewConfigs = {}
|
|
638
677
|
}
|
|
639
678
|
}
|
|
640
679
|
}
|
|
@@ -101,7 +101,7 @@ export default {
|
|
|
101
101
|
},
|
|
102
102
|
// 根据可见项数动态计算宽度
|
|
103
103
|
hoverWidth() {
|
|
104
|
-
const widthMap = { 4: '
|
|
104
|
+
const widthMap = { 4: '168px', 3: '128px', 2: '88px', 1: '40px', 0: '0px' }
|
|
105
105
|
return widthMap[this.activeItemCount] || '0px'
|
|
106
106
|
}
|
|
107
107
|
},
|
|
@@ -684,7 +684,9 @@ export default {
|
|
|
684
684
|
},
|
|
685
685
|
resizableChange({ resizeWidth, columnIndex }) {
|
|
686
686
|
this.checkColumns[columnIndex].width = resizeWidth
|
|
687
|
-
this
|
|
687
|
+
if(this.showColumn && this.pageId) {
|
|
688
|
+
this.$refs.showColumn.saveColumns(this.checkColumns)
|
|
689
|
+
}
|
|
688
690
|
},
|
|
689
691
|
setColumns(list) {
|
|
690
692
|
if (this.isExport) {
|