n20-common-lib 3.2.3 → 3.2.5
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/_coreLib.scss +1 -0
- package/src/assets/css/dynamic-field.scss +86 -0
- package/src/components/ApprovalCard/index.vue +6 -1
- package/src/components/AttachmentPass/index.vue +1 -1
- package/src/components/DynamicField/DynamicField.vue +727 -301
- package/src/components/DynamicField/DynamicFieldMixin.js +69 -18
- package/src/components/DynamicField/DynamicFormView.vue +28 -13
- package/src/components/DynamicField/contentPop.vue +0 -5
- package/src/components/DynamicField/tableView.vue +0 -5
- package/src/components/FileUploadTable/index.vue +95 -1
- package/src/components/InfoCard/index.vue +249 -0
- package/src/components/ProFilterView/advancedQuery.vue +4 -30
- package/src/components/ProFilterView/index.vue +29 -22
- package/src/components/ViewToggle/index.vue +74 -6
- package/src/index.js +3 -0
- 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
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<slot name="leftContent"></slot>
|
|
5
5
|
<div class="flex-box flex-v">
|
|
6
6
|
<el-popover
|
|
7
|
-
v-if="bussId"
|
|
7
|
+
v-if="bussId && isFilter"
|
|
8
8
|
v-model="viewPopoverVisible"
|
|
9
9
|
popper-class="pro-filter-view-popover"
|
|
10
10
|
placement="bottom-start"
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
</div>
|
|
53
53
|
</div>
|
|
54
54
|
</el-popover>
|
|
55
|
-
<el-button v-if="bussId && selectItem" class="activiti m-r" @click="edit(selectItem, true)">
|
|
55
|
+
<el-button v-if="bussId && selectItem && isFilter" class="activiti m-r" @click="edit(selectItem, true)">
|
|
56
56
|
<div class="flex-box flex-v">
|
|
57
57
|
<!-- <img src="./find.svg" alt="" /> -->
|
|
58
58
|
<i class="v3-icon-find"></i>
|
|
@@ -67,14 +67,19 @@
|
|
|
67
67
|
</div>
|
|
68
68
|
</el-button>
|
|
69
69
|
<div class="flex-box flex-v">
|
|
70
|
-
<el-button
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
<el-button
|
|
71
|
+
v-if="isFilter"
|
|
72
|
+
icon="v3-icon-filter"
|
|
73
|
+
class="m-r-s botton"
|
|
74
|
+
@click="filterExpanded = !filterExpanded"
|
|
75
|
+
>{{ '筛选' | $lc }}</el-button
|
|
76
|
+
>
|
|
73
77
|
<slot name="rightContent"></slot>
|
|
74
78
|
</div>
|
|
75
79
|
</div>
|
|
76
80
|
</div>
|
|
77
81
|
<cl-advanced-filter
|
|
82
|
+
v-if="isFilter"
|
|
78
83
|
ref="filter"
|
|
79
84
|
class="filter"
|
|
80
85
|
:class="{ 'is-hidden': !filterExpanded }"
|
|
@@ -260,6 +265,11 @@ export default {
|
|
|
260
265
|
autoExpandWithValues: {
|
|
261
266
|
type: Boolean,
|
|
262
267
|
default: false
|
|
268
|
+
},
|
|
269
|
+
// 是否显示筛选按钮及筛选区域,为 false 时不显示筛选按钮、视图相关 UI,且不请求筛选相关接口
|
|
270
|
+
isFilter: {
|
|
271
|
+
type: Boolean,
|
|
272
|
+
default: true
|
|
263
273
|
}
|
|
264
274
|
},
|
|
265
275
|
data() {
|
|
@@ -327,16 +337,11 @@ export default {
|
|
|
327
337
|
filterObj() {
|
|
328
338
|
const filterKeys = new Set()
|
|
329
339
|
this.filterList.forEach((item) => {
|
|
330
|
-
;[
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
item.endValue,
|
|
336
|
-
...(item.slotFields || [])
|
|
337
|
-
].forEach((key) => {
|
|
338
|
-
if (key) filterKeys.add(key)
|
|
339
|
-
})
|
|
340
|
+
;[item.value, item.startDate, item.endDate, item.startValue, item.endValue, ...(item.slotFields || [])].forEach(
|
|
341
|
+
(key) => {
|
|
342
|
+
if (key) filterKeys.add(key)
|
|
343
|
+
}
|
|
344
|
+
)
|
|
340
345
|
})
|
|
341
346
|
|
|
342
347
|
const extraInitialValues = {}
|
|
@@ -383,14 +388,16 @@ export default {
|
|
|
383
388
|
}
|
|
384
389
|
},
|
|
385
390
|
mounted() {
|
|
386
|
-
// 只有在有 bussId 时才获取视图列表
|
|
387
|
-
if (this.bussId) {
|
|
391
|
+
// 只有在有 bussId 且 isFilter 为 true 时才获取视图列表
|
|
392
|
+
if (this.bussId && this.isFilter) {
|
|
388
393
|
this.getFilterList()
|
|
389
394
|
}
|
|
390
395
|
// 合并初始筛选值:slot 字段使用默认值,其他字段使用 initialValue 传入的值
|
|
391
|
-
this.
|
|
392
|
-
|
|
393
|
-
|
|
396
|
+
if (this.isFilter) {
|
|
397
|
+
this.searchValue = { ...this.getInitialSearchValue, ...this.initialValue }
|
|
398
|
+
// 初始挂载后根据筛选值情况决定是否自动展开
|
|
399
|
+
this.checkAndAutoExpand()
|
|
400
|
+
}
|
|
394
401
|
},
|
|
395
402
|
methods: {
|
|
396
403
|
/**
|
|
@@ -537,8 +544,8 @@ export default {
|
|
|
537
544
|
},
|
|
538
545
|
// 通过bussId拿取视图列表
|
|
539
546
|
getFilterList(viewId) {
|
|
540
|
-
// 如果没有 bussId,不获取视图列表
|
|
541
|
-
if (!this.bussId) {
|
|
547
|
+
// 如果没有 bussId 或 isFilter 为 false,不获取视图列表
|
|
548
|
+
if (!this.bussId || !this.isFilter) {
|
|
542
549
|
return
|
|
543
550
|
}
|
|
544
551
|
|
|
@@ -48,7 +48,9 @@ export default {
|
|
|
48
48
|
data() {
|
|
49
49
|
return {
|
|
50
50
|
// 自适应模式下指示器的测量数据
|
|
51
|
-
measuredIndicator: { width: 0, height: 0, translateX: 0 }
|
|
51
|
+
measuredIndicator: { width: 0, height: 0, translateX: 0 },
|
|
52
|
+
indicatorResizeObserver: null,
|
|
53
|
+
indicatorRaf: null
|
|
52
54
|
}
|
|
53
55
|
},
|
|
54
56
|
computed: {
|
|
@@ -85,8 +87,8 @@ export default {
|
|
|
85
87
|
// 自适应模式:基于 DOM 测量定位
|
|
86
88
|
const { width, height, translateX } = this.measuredIndicator
|
|
87
89
|
return {
|
|
88
|
-
width: `${width - 2 * gap}px`,
|
|
89
|
-
height: `${height - 2 * gap}px`,
|
|
90
|
+
width: `${Math.max(width - 2 * gap, 0)}px`,
|
|
91
|
+
height: `${Math.max(height - 2 * gap, 0)}px`,
|
|
90
92
|
top: `${gap}px`,
|
|
91
93
|
left: `${gap}px`,
|
|
92
94
|
transform: `translateX(${translateX}px)`
|
|
@@ -95,17 +97,33 @@ export default {
|
|
|
95
97
|
},
|
|
96
98
|
watch: {
|
|
97
99
|
value() {
|
|
98
|
-
if (!this.isFixedWidth) this.$nextTick(this.
|
|
100
|
+
if (!this.isFixedWidth) this.$nextTick(this.syncIndicatorObserver)
|
|
99
101
|
},
|
|
100
102
|
options: {
|
|
101
103
|
deep: true,
|
|
102
104
|
handler() {
|
|
103
|
-
if (!this.isFixedWidth) this.$nextTick(this.
|
|
105
|
+
if (!this.isFixedWidth) this.$nextTick(this.syncIndicatorObserver)
|
|
104
106
|
}
|
|
107
|
+
},
|
|
108
|
+
itemWidth() {
|
|
109
|
+
this.$nextTick(this.syncIndicatorObserver)
|
|
110
|
+
},
|
|
111
|
+
itemHeight() {
|
|
112
|
+
if (!this.isFixedWidth) this.$nextTick(this.scheduleIndicatorUpdate)
|
|
105
113
|
}
|
|
106
114
|
},
|
|
107
115
|
mounted() {
|
|
108
|
-
|
|
116
|
+
this.syncIndicatorObserver()
|
|
117
|
+
},
|
|
118
|
+
activated() {
|
|
119
|
+
if (!this.isFixedWidth) this.scheduleIndicatorUpdate()
|
|
120
|
+
},
|
|
121
|
+
beforeDestroy() {
|
|
122
|
+
this.destroyIndicatorObserver()
|
|
123
|
+
if (this.indicatorRaf) {
|
|
124
|
+
this.cancelIndicatorFrame(this.indicatorRaf)
|
|
125
|
+
this.indicatorRaf = null
|
|
126
|
+
}
|
|
109
127
|
},
|
|
110
128
|
methods: {
|
|
111
129
|
// 统一尺寸格式化
|
|
@@ -113,6 +131,56 @@ export default {
|
|
|
113
131
|
if (typeof val === 'number') return `${val}px`
|
|
114
132
|
return isNaN(val) ? val : `${val}px`
|
|
115
133
|
},
|
|
134
|
+
syncIndicatorObserver() {
|
|
135
|
+
this.destroyIndicatorObserver()
|
|
136
|
+
if (this.isFixedWidth) return
|
|
137
|
+
this.scheduleIndicatorUpdate()
|
|
138
|
+
|
|
139
|
+
if (typeof window === 'undefined' || typeof window.ResizeObserver === 'undefined') {
|
|
140
|
+
if (typeof window !== 'undefined') {
|
|
141
|
+
window.addEventListener('resize', this.scheduleIndicatorUpdate)
|
|
142
|
+
}
|
|
143
|
+
return
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
this.indicatorResizeObserver = new window.ResizeObserver(() => {
|
|
147
|
+
this.scheduleIndicatorUpdate()
|
|
148
|
+
})
|
|
149
|
+
const container = this.$refs.container
|
|
150
|
+
const items = this.$refs.items || []
|
|
151
|
+
const activeIndex = this.options.findIndex((item) => item.value === this.value)
|
|
152
|
+
if (container) this.indicatorResizeObserver.observe(container)
|
|
153
|
+
if (items[activeIndex]) this.indicatorResizeObserver.observe(items[activeIndex])
|
|
154
|
+
},
|
|
155
|
+
destroyIndicatorObserver() {
|
|
156
|
+
if (this.indicatorResizeObserver) {
|
|
157
|
+
this.indicatorResizeObserver.disconnect()
|
|
158
|
+
this.indicatorResizeObserver = null
|
|
159
|
+
}
|
|
160
|
+
if (typeof window !== 'undefined') {
|
|
161
|
+
window.removeEventListener('resize', this.scheduleIndicatorUpdate)
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
requestIndicatorFrame(callback) {
|
|
165
|
+
if (typeof window !== 'undefined' && typeof window.requestAnimationFrame === 'function') {
|
|
166
|
+
return window.requestAnimationFrame(callback)
|
|
167
|
+
}
|
|
168
|
+
return setTimeout(callback, 16)
|
|
169
|
+
},
|
|
170
|
+
cancelIndicatorFrame(frameId) {
|
|
171
|
+
if (typeof window !== 'undefined' && typeof window.cancelAnimationFrame === 'function') {
|
|
172
|
+
window.cancelAnimationFrame(frameId)
|
|
173
|
+
return
|
|
174
|
+
}
|
|
175
|
+
clearTimeout(frameId)
|
|
176
|
+
},
|
|
177
|
+
scheduleIndicatorUpdate() {
|
|
178
|
+
if (this.indicatorRaf) this.cancelIndicatorFrame(this.indicatorRaf)
|
|
179
|
+
this.indicatorRaf = this.requestIndicatorFrame(() => {
|
|
180
|
+
this.indicatorRaf = null
|
|
181
|
+
this.updateIndicator()
|
|
182
|
+
})
|
|
183
|
+
},
|
|
116
184
|
// 自适应模式下测量激活项的位置
|
|
117
185
|
updateIndicator() {
|
|
118
186
|
const items = this.$refs.items
|
package/src/index.js
CHANGED
|
@@ -137,6 +137,7 @@ import tableProV3 from './components/v3/TablePro/index.vue'
|
|
|
137
137
|
import FileUploadTableV3 from './components/v3/UploadList/index.vue'
|
|
138
138
|
import ViewToggle from './components/ViewToggle/index.vue'
|
|
139
139
|
import WorkCard from './components/WorkCard/index.vue'
|
|
140
|
+
import InfoCard from './components/InfoCard/index.vue'
|
|
140
141
|
import WornPagination from './components/WornPagination/index.vue'
|
|
141
142
|
import VTableLoading from './directives/loading/index.js'
|
|
142
143
|
|
|
@@ -266,6 +267,7 @@ const components = [
|
|
|
266
267
|
BusiDatePicker,
|
|
267
268
|
TableTransfer,
|
|
268
269
|
WorkCard,
|
|
270
|
+
InfoCard,
|
|
269
271
|
UploadMsg,
|
|
270
272
|
Tree,
|
|
271
273
|
DateChoose,
|
|
@@ -436,6 +438,7 @@ export {
|
|
|
436
438
|
Upload,
|
|
437
439
|
UploadMsg,
|
|
438
440
|
WorkCard,
|
|
441
|
+
InfoCard,
|
|
439
442
|
WornPagination,
|
|
440
443
|
/* v3组件*/
|
|
441
444
|
tableProV3,
|