vue2-client 1.15.13 → 1.15.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/jest.config.js +22 -22
- 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/XForm/demo.vue +105 -105
- package/src/base-client/components/common/XFormTable/demo.vue +0 -1
- package/src/base-client/components/common/XPrint/PrintBill.vue +3 -1
- package/src/base-client/components/common/XRate/demo.vue +102 -102
- 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/WorkFlowDemo2.vue +2 -1
- package/src/pages/WorkflowDetail/WorkflowDetail.vue +20 -4
- package/src/pages/WorkflowDetail/WorkflowPageDetail/LeaveMessage.vue +388 -388
- package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowHandle.vue +475 -148
- package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkFlowTimeline.vue +677 -188
- package/src/pages/WorkflowDetail/WorkflowPageDetail/WorkflowLog.vue +1 -1
- package/src/pages/WorkflowDetail/WorkflowPageDetail/components/WorkflowPersonSelector.vue +25 -23
- package/src/pages/XPageViewExample/index.vue +149 -149
- package/src/router/async/router.map.js +3 -5
- package/src/router/index.js +27 -27
- package/src/router.js +0 -2
- package/src/services/api/workFlow.js +0 -4
- package/test/request.test.js +17 -17
- package/vue.config.js +2 -5
- 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
|
@@ -1,105 +1,105 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="demo-container">
|
|
3
|
-
<h2>XFormItem Demo</h2>
|
|
4
|
-
|
|
5
|
-
<!-- 查询模式演示 -->
|
|
6
|
-
<div class="demo-section">
|
|
7
|
-
<h3>查询模式</h3>
|
|
8
|
-
<x-form-item
|
|
9
|
-
:attr="queryAttr"
|
|
10
|
-
:form="queryForm"
|
|
11
|
-
mode="查询"
|
|
12
|
-
:showLabel="true"
|
|
13
|
-
/>
|
|
14
|
-
<div class="value-display">
|
|
15
|
-
当前值: {{ queryForm.rate || '未选择' }}
|
|
16
|
-
</div>
|
|
17
|
-
</div>
|
|
18
|
-
|
|
19
|
-
<!-- 新增模式演示 -->
|
|
20
|
-
<div class="demo-section">
|
|
21
|
-
<h3>新增模式</h3>
|
|
22
|
-
<x-form-item
|
|
23
|
-
:attr="addAttr"
|
|
24
|
-
:form="addForm"
|
|
25
|
-
mode="新增/修改"
|
|
26
|
-
:showLabel="true"
|
|
27
|
-
/>
|
|
28
|
-
<div class="value-display">
|
|
29
|
-
当前值: {{ addForm.rate || '未评分' }}
|
|
30
|
-
</div>
|
|
31
|
-
</div>
|
|
32
|
-
</div>
|
|
33
|
-
</template>
|
|
34
|
-
|
|
35
|
-
<script>
|
|
36
|
-
import XFormItem from './XFormItem.vue'
|
|
37
|
-
|
|
38
|
-
export default {
|
|
39
|
-
name: 'XFormItemDemo',
|
|
40
|
-
components: {
|
|
41
|
-
XFormItem
|
|
42
|
-
},
|
|
43
|
-
data () {
|
|
44
|
-
return {
|
|
45
|
-
// 查询表单配置
|
|
46
|
-
queryAttr: {
|
|
47
|
-
type: 'rate',
|
|
48
|
-
name: '评分查询',
|
|
49
|
-
queryType: 'IN',
|
|
50
|
-
model: 'rate',
|
|
51
|
-
placeholder: '请选择评分',
|
|
52
|
-
allowHalf: true,
|
|
53
|
-
maxCount: 5
|
|
54
|
-
},
|
|
55
|
-
queryForm: {
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
// 新增表单配置
|
|
59
|
-
addAttr: {
|
|
60
|
-
type: 'rate',
|
|
61
|
-
name: '评分',
|
|
62
|
-
model: 'rate',
|
|
63
|
-
allowHalf: true,
|
|
64
|
-
maxCount: 10
|
|
65
|
-
},
|
|
66
|
-
addForm: {
|
|
67
|
-
rate: 3
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
</script>
|
|
73
|
-
|
|
74
|
-
<style lang="less" scoped>
|
|
75
|
-
.demo-container {
|
|
76
|
-
padding: 20px;
|
|
77
|
-
max-width: 800px;
|
|
78
|
-
margin: 0 auto;
|
|
79
|
-
background-color: #f5f5f5;
|
|
80
|
-
|
|
81
|
-
h2 {
|
|
82
|
-
margin-bottom: 20px;
|
|
83
|
-
color: #1890ff;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.demo-section {
|
|
87
|
-
margin-bottom: 30px;
|
|
88
|
-
padding: 20px;
|
|
89
|
-
border: 1px solid #e8e8e8;
|
|
90
|
-
border-radius: 4px;
|
|
91
|
-
|
|
92
|
-
h3 {
|
|
93
|
-
margin-bottom: 16px;
|
|
94
|
-
color: #333;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.value-display {
|
|
98
|
-
margin-top: 16px;
|
|
99
|
-
padding: 8px;
|
|
100
|
-
background-color: #f5f5f5;
|
|
101
|
-
border-radius: 4px;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="demo-container">
|
|
3
|
+
<h2>XFormItem Demo</h2>
|
|
4
|
+
|
|
5
|
+
<!-- 查询模式演示 -->
|
|
6
|
+
<div class="demo-section">
|
|
7
|
+
<h3>查询模式</h3>
|
|
8
|
+
<x-form-item
|
|
9
|
+
:attr="queryAttr"
|
|
10
|
+
:form="queryForm"
|
|
11
|
+
mode="查询"
|
|
12
|
+
:showLabel="true"
|
|
13
|
+
/>
|
|
14
|
+
<div class="value-display">
|
|
15
|
+
当前值: {{ queryForm.rate || '未选择' }}
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<!-- 新增模式演示 -->
|
|
20
|
+
<div class="demo-section">
|
|
21
|
+
<h3>新增模式</h3>
|
|
22
|
+
<x-form-item
|
|
23
|
+
:attr="addAttr"
|
|
24
|
+
:form="addForm"
|
|
25
|
+
mode="新增/修改"
|
|
26
|
+
:showLabel="true"
|
|
27
|
+
/>
|
|
28
|
+
<div class="value-display">
|
|
29
|
+
当前值: {{ addForm.rate || '未评分' }}
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<script>
|
|
36
|
+
import XFormItem from './XFormItem.vue'
|
|
37
|
+
|
|
38
|
+
export default {
|
|
39
|
+
name: 'XFormItemDemo',
|
|
40
|
+
components: {
|
|
41
|
+
XFormItem
|
|
42
|
+
},
|
|
43
|
+
data () {
|
|
44
|
+
return {
|
|
45
|
+
// 查询表单配置
|
|
46
|
+
queryAttr: {
|
|
47
|
+
type: 'rate',
|
|
48
|
+
name: '评分查询',
|
|
49
|
+
queryType: 'IN',
|
|
50
|
+
model: 'rate',
|
|
51
|
+
placeholder: '请选择评分',
|
|
52
|
+
allowHalf: true,
|
|
53
|
+
maxCount: 5
|
|
54
|
+
},
|
|
55
|
+
queryForm: {
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
// 新增表单配置
|
|
59
|
+
addAttr: {
|
|
60
|
+
type: 'rate',
|
|
61
|
+
name: '评分',
|
|
62
|
+
model: 'rate',
|
|
63
|
+
allowHalf: true,
|
|
64
|
+
maxCount: 10
|
|
65
|
+
},
|
|
66
|
+
addForm: {
|
|
67
|
+
rate: 3
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<style lang="less" scoped>
|
|
75
|
+
.demo-container {
|
|
76
|
+
padding: 20px;
|
|
77
|
+
max-width: 800px;
|
|
78
|
+
margin: 0 auto;
|
|
79
|
+
background-color: #f5f5f5;
|
|
80
|
+
|
|
81
|
+
h2 {
|
|
82
|
+
margin-bottom: 20px;
|
|
83
|
+
color: #1890ff;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.demo-section {
|
|
87
|
+
margin-bottom: 30px;
|
|
88
|
+
padding: 20px;
|
|
89
|
+
border: 1px solid #e8e8e8;
|
|
90
|
+
border-radius: 4px;
|
|
91
|
+
|
|
92
|
+
h3 {
|
|
93
|
+
margin-bottom: 16px;
|
|
94
|
+
color: #333;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.value-display {
|
|
98
|
+
margin-top: 16px;
|
|
99
|
+
padding: 8px;
|
|
100
|
+
background-color: #f5f5f5;
|
|
101
|
+
border-radius: 4px;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
</style>
|
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="demo-container">
|
|
3
|
-
<h2>XRate 评分组件示例</h2>
|
|
4
|
-
|
|
5
|
-
<div class="demo-section">
|
|
6
|
-
<h3>基础用法</h3>
|
|
7
|
-
<x-rate v-model="basicRate" />
|
|
8
|
-
<div>当前值: {{ basicRate }}</div>
|
|
9
|
-
<a-button @click="resetBasicRate">重置</a-button>
|
|
10
|
-
</div>
|
|
11
|
-
|
|
12
|
-
<div class="demo-section">
|
|
13
|
-
<h3>允许半星</h3>
|
|
14
|
-
<x-rate v-model="halfRate" :allow-half="true" />
|
|
15
|
-
<div>当前值: {{ halfRate }}</div>
|
|
16
|
-
</div>
|
|
17
|
-
|
|
18
|
-
<div class="demo-section">
|
|
19
|
-
<h3>自定义最大分值</h3>
|
|
20
|
-
<x-rate v-model="customRate" :max-count="10" />
|
|
21
|
-
<div>当前值: {{ customRate }}</div>
|
|
22
|
-
</div>
|
|
23
|
-
|
|
24
|
-
<div class="demo-section">
|
|
25
|
-
<h3>查询模式</h3>
|
|
26
|
-
<x-rate v-model="queryRate" mode="查询" />
|
|
27
|
-
<div>当前值: {{ queryRate }}</div>
|
|
28
|
-
</div>
|
|
29
|
-
|
|
30
|
-
<div class="demo-section">
|
|
31
|
-
<h3>查询模式(多选)</h3>
|
|
32
|
-
<x-rate v-model="queryMultiRate" mode="查询" query-type="IN" />
|
|
33
|
-
<div>当前值: {{ queryMultiRate }}</div>
|
|
34
|
-
</div>
|
|
35
|
-
|
|
36
|
-
<div class="demo-section">
|
|
37
|
-
<h3>禁用状态</h3>
|
|
38
|
-
<x-rate v-model="disabledRate" :disabled="true" />
|
|
39
|
-
<div>当前值: {{ disabledRate }}</div>
|
|
40
|
-
</div>
|
|
41
|
-
|
|
42
|
-
<div class="demo-section">
|
|
43
|
-
<h3>空值处理</h3>
|
|
44
|
-
<x-rate v-model="emptyRate" />
|
|
45
|
-
<div>当前值: {{ emptyRate }}</div>
|
|
46
|
-
<a-button @click="clearRate">清除</a-button>
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
</template>
|
|
50
|
-
|
|
51
|
-
<script>
|
|
52
|
-
import XRate from './index.vue'
|
|
53
|
-
|
|
54
|
-
export default {
|
|
55
|
-
name: 'XRateDemo',
|
|
56
|
-
components: {
|
|
57
|
-
XRate
|
|
58
|
-
},
|
|
59
|
-
data () {
|
|
60
|
-
return {
|
|
61
|
-
basicRate: 3,
|
|
62
|
-
halfRate: 3.5,
|
|
63
|
-
customRate: 7,
|
|
64
|
-
queryRate: 4,
|
|
65
|
-
queryMultiRate: [3, 4],
|
|
66
|
-
disabledRate: 2,
|
|
67
|
-
emptyRate: undefined
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
methods: {
|
|
71
|
-
resetBasicRate () {
|
|
72
|
-
this.basicRate = 3
|
|
73
|
-
},
|
|
74
|
-
clearRate () {
|
|
75
|
-
this.emptyRate = undefined
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
</script>
|
|
80
|
-
|
|
81
|
-
<style lang="less" scoped>
|
|
82
|
-
.demo-container {
|
|
83
|
-
padding: 20px;
|
|
84
|
-
|
|
85
|
-
.demo-section {
|
|
86
|
-
margin-bottom: 30px;
|
|
87
|
-
padding: 20px;
|
|
88
|
-
border: 1px solid #eee;
|
|
89
|
-
border-radius: 4px;
|
|
90
|
-
|
|
91
|
-
h3 {
|
|
92
|
-
margin-top: 0;
|
|
93
|
-
margin-bottom: 16px;
|
|
94
|
-
color: #333;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.ant-btn {
|
|
98
|
-
margin-top: 8px;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="demo-container">
|
|
3
|
+
<h2>XRate 评分组件示例</h2>
|
|
4
|
+
|
|
5
|
+
<div class="demo-section">
|
|
6
|
+
<h3>基础用法</h3>
|
|
7
|
+
<x-rate v-model="basicRate" />
|
|
8
|
+
<div>当前值: {{ basicRate }}</div>
|
|
9
|
+
<a-button @click="resetBasicRate">重置</a-button>
|
|
10
|
+
</div>
|
|
11
|
+
|
|
12
|
+
<div class="demo-section">
|
|
13
|
+
<h3>允许半星</h3>
|
|
14
|
+
<x-rate v-model="halfRate" :allow-half="true" />
|
|
15
|
+
<div>当前值: {{ halfRate }}</div>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div class="demo-section">
|
|
19
|
+
<h3>自定义最大分值</h3>
|
|
20
|
+
<x-rate v-model="customRate" :max-count="10" />
|
|
21
|
+
<div>当前值: {{ customRate }}</div>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<div class="demo-section">
|
|
25
|
+
<h3>查询模式</h3>
|
|
26
|
+
<x-rate v-model="queryRate" mode="查询" />
|
|
27
|
+
<div>当前值: {{ queryRate }}</div>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<div class="demo-section">
|
|
31
|
+
<h3>查询模式(多选)</h3>
|
|
32
|
+
<x-rate v-model="queryMultiRate" mode="查询" query-type="IN" />
|
|
33
|
+
<div>当前值: {{ queryMultiRate }}</div>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<div class="demo-section">
|
|
37
|
+
<h3>禁用状态</h3>
|
|
38
|
+
<x-rate v-model="disabledRate" :disabled="true" />
|
|
39
|
+
<div>当前值: {{ disabledRate }}</div>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<div class="demo-section">
|
|
43
|
+
<h3>空值处理</h3>
|
|
44
|
+
<x-rate v-model="emptyRate" />
|
|
45
|
+
<div>当前值: {{ emptyRate }}</div>
|
|
46
|
+
<a-button @click="clearRate">清除</a-button>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</template>
|
|
50
|
+
|
|
51
|
+
<script>
|
|
52
|
+
import XRate from './index.vue'
|
|
53
|
+
|
|
54
|
+
export default {
|
|
55
|
+
name: 'XRateDemo',
|
|
56
|
+
components: {
|
|
57
|
+
XRate
|
|
58
|
+
},
|
|
59
|
+
data () {
|
|
60
|
+
return {
|
|
61
|
+
basicRate: 3,
|
|
62
|
+
halfRate: 3.5,
|
|
63
|
+
customRate: 7,
|
|
64
|
+
queryRate: 4,
|
|
65
|
+
queryMultiRate: [3, 4],
|
|
66
|
+
disabledRate: 2,
|
|
67
|
+
emptyRate: undefined
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
methods: {
|
|
71
|
+
resetBasicRate () {
|
|
72
|
+
this.basicRate = 3
|
|
73
|
+
},
|
|
74
|
+
clearRate () {
|
|
75
|
+
this.emptyRate = undefined
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
</script>
|
|
80
|
+
|
|
81
|
+
<style lang="less" scoped>
|
|
82
|
+
.demo-container {
|
|
83
|
+
padding: 20px;
|
|
84
|
+
|
|
85
|
+
.demo-section {
|
|
86
|
+
margin-bottom: 30px;
|
|
87
|
+
padding: 20px;
|
|
88
|
+
border: 1px solid #eee;
|
|
89
|
+
border-radius: 4px;
|
|
90
|
+
|
|
91
|
+
h3 {
|
|
92
|
+
margin-top: 0;
|
|
93
|
+
margin-bottom: 16px;
|
|
94
|
+
color: #333;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.ant-btn {
|
|
98
|
+
margin-top: 8px;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
</style>
|
|
@@ -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>
|