vue2-client 1.15.12 → 1.15.14
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 +2 -2
- package/src/ReportView.js +0 -6
- package/src/base-client/components/common/XForm/XForm.vue +419 -419
- package/src/base-client/components/common/XFormTable/demo.vue +1 -1
- package/src/base-client/components/common/XPrint/PrintBill.vue +3 -1
- package/src/base-client/components/common/XTable/XTableWrapper.vue +166 -1
- package/src/base-client/components/common/XUploadFilesView/index.vue +485 -485
- package/src/base-client/components/layout/XPageView/RenderRow.vue +88 -88
- package/src/base-client/components/layout/XPageView/XPageView.vue +223 -223
- package/src/base-client/components/layout/XPageView/XTab/XTab.vue +96 -96
- package/src/base-client/components/layout/XPageView/componentTypes.js +22 -22
- package/src/main.js +3 -4
- package/src/pages/WorkflowDetail/WorkFlowDemo.vue +1 -1
- package/src/pages/WorkflowDetail/WorkFlowDemo2.vue +310 -14
- package/src/pages/WorkflowDetail/WorkflowPageDetail/LeaveMessage.vue +388 -388
- package/src/pages/XPageViewExample/index.vue +149 -149
- package/src/pages/addressSelect/addressDemo.vue +24 -24
- package/src/router/async/router.map.js +2 -4
- package/src/router.js +0 -2
- package/src/utils/indexedDB.js +13 -2
- package/vue.config.js +0 -3
- package/src/base-client/components/common/AMisRender/index.js +0 -3
- package/src/base-client/components/common/AMisRender/index.vue +0 -263
- package/src/pages/AMisDemo/AMisDemo.vue +0 -325
- package/src/pages/AMisDemo/AMisDemo2.vue +0 -74
- package/test/Amis.spec.js +0 -164
@@ -19,6 +19,7 @@
|
|
19
19
|
:setScrollYHeight="tableContext.setScrollYHeight"
|
20
20
|
:selectRowMode="tableContext.selectRowMode"
|
21
21
|
:size="tableContext.tableSize"
|
22
|
+
:components="components"
|
22
23
|
@beforeDataChange="beforeDataChange"
|
23
24
|
@expand="onExpand"
|
24
25
|
@rowClick="handleRowClick"
|
@@ -154,6 +155,7 @@
|
|
154
155
|
:setScrollYHeight="tableContext.setScrollYHeight"
|
155
156
|
:selectRowMode="tableContext.selectRowMode"
|
156
157
|
:size="tableContext.tableSize"
|
158
|
+
:components="components"
|
157
159
|
@rowClick="handleRowClick"
|
158
160
|
@beforeDataChange="beforeDataChange"
|
159
161
|
>
|
@@ -269,6 +271,7 @@ import XFormItem from '@vue2-client/base-client/components/common/XForm/XFormIte
|
|
269
271
|
import CustomFuncCel from '@vue2-client/base-client/components/common/XTable/CustomFuncCel.vue'
|
270
272
|
import { executeStrFunctionByContext } from '@vue2-client/utils/runEvalFunction'
|
271
273
|
import XRate from '@vue2-client/base-client/components/common/XRate/index.vue'
|
274
|
+
import VueDraggableResizable from 'vue-draggable-resizable'
|
272
275
|
|
273
276
|
export default {
|
274
277
|
name: 'XTableWrapper',
|
@@ -278,7 +281,15 @@ export default {
|
|
278
281
|
XBadge,
|
279
282
|
XFormItem,
|
280
283
|
XRate,
|
281
|
-
CustomFuncCel
|
284
|
+
CustomFuncCel,
|
285
|
+
VueDraggableResizable
|
286
|
+
},
|
287
|
+
data () {
|
288
|
+
return {
|
289
|
+
isDragging: false, // 添加拖拽状态标记
|
290
|
+
// eslint-disable-next-line vue/no-reserved-keys
|
291
|
+
_rafId: null // 添加requestAnimationFrame ID标记
|
292
|
+
}
|
282
293
|
},
|
283
294
|
computed: {
|
284
295
|
localDataSource () {
|
@@ -290,6 +301,114 @@ export default {
|
|
290
301
|
},
|
291
302
|
realTableColumns () {
|
292
303
|
return this.tableContext.tableColumns.filter(item => item.slotType !== 'action' || !this.disableAction)
|
304
|
+
},
|
305
|
+
components () {
|
306
|
+
return {
|
307
|
+
header: {
|
308
|
+
cell: (h, props, children) => {
|
309
|
+
const { key, ...restProps } = props
|
310
|
+
// 此处的this.realTableColumns 是定义的table的表头属性变量
|
311
|
+
const col = this.realTableColumns.find((col) => {
|
312
|
+
const k = col.dataIndex || col.key
|
313
|
+
return k === key
|
314
|
+
})
|
315
|
+
if (!col || !col.width) {
|
316
|
+
return h('th', { ...restProps }, [...children])
|
317
|
+
}
|
318
|
+
|
319
|
+
// 创建一个防止点击排序的容器
|
320
|
+
const preventSortProps = {
|
321
|
+
style: {
|
322
|
+
position: 'absolute',
|
323
|
+
right: 0,
|
324
|
+
top: 0,
|
325
|
+
width: '20px',
|
326
|
+
height: '100%',
|
327
|
+
zIndex: 10
|
328
|
+
},
|
329
|
+
on: {
|
330
|
+
mousedown: (e) => {
|
331
|
+
e.stopPropagation()
|
332
|
+
e.preventDefault()
|
333
|
+
this.isDragging = true
|
334
|
+
}
|
335
|
+
}
|
336
|
+
}
|
337
|
+
|
338
|
+
const dragProps = {
|
339
|
+
key: col.dataIndex || col.key,
|
340
|
+
class: 'table-draggable-handle',
|
341
|
+
attrs: {
|
342
|
+
w: 10,
|
343
|
+
x: col.width,
|
344
|
+
z: 1,
|
345
|
+
axis: 'x',
|
346
|
+
draggable: true,
|
347
|
+
resizable: false,
|
348
|
+
},
|
349
|
+
on: {
|
350
|
+
dragging: (x, y) => {
|
351
|
+
// 使用requestAnimationFrame优化性能,减少卡顿
|
352
|
+
if (!this._rafId) {
|
353
|
+
this._rafId = requestAnimationFrame(() => {
|
354
|
+
col.width = Math.max(x, 50) // 设置最小列宽为50px
|
355
|
+
this.isDragging = true // 设置拖拽状态
|
356
|
+
this._rafId = null
|
357
|
+
})
|
358
|
+
}
|
359
|
+
},
|
360
|
+
mousedown: (e) => {
|
361
|
+
// 阻止事件冒泡,防止触发排序
|
362
|
+
e.stopPropagation()
|
363
|
+
e.preventDefault()
|
364
|
+
this.isDragging = true // 设置拖拽状态
|
365
|
+
},
|
366
|
+
dragstop: () => {
|
367
|
+
// 清除可能存在的动画帧请求
|
368
|
+
if (this._rafId) {
|
369
|
+
cancelAnimationFrame(this._rafId)
|
370
|
+
this._rafId = null
|
371
|
+
}
|
372
|
+
|
373
|
+
// 拖拽结束时,延迟重置拖拽状态,以防止排序被触发
|
374
|
+
setTimeout(() => {
|
375
|
+
this.isDragging = false
|
376
|
+
}, 100)
|
377
|
+
}
|
378
|
+
},
|
379
|
+
nativeOn: {
|
380
|
+
mousedown: (e) => {
|
381
|
+
e.stopPropagation()
|
382
|
+
e.preventDefault()
|
383
|
+
this.isDragging = true // 设置拖拽状态
|
384
|
+
}
|
385
|
+
}
|
386
|
+
}
|
387
|
+
|
388
|
+
const preventSort = h('div', preventSortProps)
|
389
|
+
const drag = h('vue-draggable-resizable', { ...dragProps })
|
390
|
+
|
391
|
+
// 修改th的点击事件,在拖拽状态下阻止排序
|
392
|
+
const newRestProps = { ...restProps }
|
393
|
+
const originalClick = newRestProps.on && newRestProps.on.click
|
394
|
+
if (originalClick) {
|
395
|
+
newRestProps.on = {
|
396
|
+
...newRestProps.on,
|
397
|
+
click: (e) => {
|
398
|
+
if (this.isDragging) {
|
399
|
+
e.stopPropagation()
|
400
|
+
e.preventDefault()
|
401
|
+
return
|
402
|
+
}
|
403
|
+
originalClick(e)
|
404
|
+
}
|
405
|
+
}
|
406
|
+
}
|
407
|
+
|
408
|
+
return h('th', { ...newRestProps, class: 'resize-table-th' }, [...children, preventSort, drag])
|
409
|
+
},
|
410
|
+
}
|
411
|
+
}
|
293
412
|
}
|
294
413
|
},
|
295
414
|
props: {
|
@@ -412,6 +531,52 @@ export default {
|
|
412
531
|
}
|
413
532
|
return false
|
414
533
|
},
|
534
|
+
handleResizeColumn (w, col) {
|
535
|
+
col.width = w
|
536
|
+
}
|
415
537
|
}
|
416
538
|
}
|
417
539
|
</script>
|
540
|
+
|
541
|
+
<style>
|
542
|
+
.table-draggable-handle {
|
543
|
+
height: 100% !important;
|
544
|
+
left: auto !important;
|
545
|
+
right: -10px;
|
546
|
+
cursor: col-resize;
|
547
|
+
touch-action: none;
|
548
|
+
border: none;
|
549
|
+
position: absolute;
|
550
|
+
transform: none !important;
|
551
|
+
bottom: 0;
|
552
|
+
width: 20px !important;
|
553
|
+
}
|
554
|
+
|
555
|
+
.table-draggable-handle::after {
|
556
|
+
content: "";
|
557
|
+
position: absolute;
|
558
|
+
top: 50%;
|
559
|
+
height: 20px;
|
560
|
+
width: 1px;
|
561
|
+
background-color: #d9d9d9;
|
562
|
+
transition: background-color 0.2s;
|
563
|
+
transform: translateY(-50%);
|
564
|
+
right: 9px;
|
565
|
+
}
|
566
|
+
|
567
|
+
.table-draggable-handle:hover::after {
|
568
|
+
background-color: #1890ff;
|
569
|
+
}
|
570
|
+
|
571
|
+
.table-draggable-handle:active::after {
|
572
|
+
background-color: #096dd9;
|
573
|
+
}
|
574
|
+
|
575
|
+
.resize-table-th {
|
576
|
+
position: relative;
|
577
|
+
}
|
578
|
+
|
579
|
+
.resize-table-th:hover .table-draggable-handle::after {
|
580
|
+
background-color: rgba(24, 144, 255, 0.5);
|
581
|
+
}
|
582
|
+
</style>
|