vue2-client 1.3.24 → 1.4.0
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/CHANGELOG.md +12 -1
- package/package.json +78 -76
- package/src/base-client/components/common/CreateQuery/CreateQuery.vue +543 -551
- package/src/base-client/components/common/Upload/Upload.vue +168 -167
- package/src/base-client/components/common/XFormTable/XFormTable.vue +113 -76
- package/src/base-client/components/common/XImportExcel/XImportExcel.vue +131 -0
- package/src/base-client/components/common/XImportExcel/index.js +3 -0
- package/src/base-client/components/common/XImportExcel/index.md +38 -0
- package/src/base-client/components/common/XTable/XTable.vue +259 -278
- package/src/components/TableSetting/TableSetting.vue +143 -0
- package/src/components/TableSetting/index.js +3 -0
- package/src/pages/login/Login.vue +360 -361
- package/src/pages/system/ticket/index.vue +1 -1
- package/src/services/api/common.js +123 -58
- package/src/utils/common.js +10 -0
- package/src/utils/errorCode.js +6 -0
- package/src/base-client/components/common/CustomColumnsDrawer/CustomColumnsDrawer.vue +0 -109
- package/src/base-client/components/common/CustomColumnsDrawer/index.js +0 -3
- package/src/base-client/components/common/CustomColumnsDrawer/index.md +0 -46
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<a-popover placement="bottomRight" trigger="click">
|
|
3
|
+
<template slot="content">
|
|
4
|
+
<a-tree
|
|
5
|
+
class="draggable-tree"
|
|
6
|
+
:show-icon="true"
|
|
7
|
+
v-model="checkedKeys"
|
|
8
|
+
checkable
|
|
9
|
+
:replaceFields="replaceFields"
|
|
10
|
+
draggable
|
|
11
|
+
:tree-data="currentValue"
|
|
12
|
+
@drop="onDrop"
|
|
13
|
+
/>
|
|
14
|
+
</template>
|
|
15
|
+
<template slot="title">
|
|
16
|
+
<a-checkbox :indeterminate="indeterminate" :checked="checkAll" @change="onCheckAllChange">
|
|
17
|
+
列展示/排序
|
|
18
|
+
<a-tooltip>
|
|
19
|
+
<template slot="title">
|
|
20
|
+
列排序需拖动名称
|
|
21
|
+
</template>
|
|
22
|
+
<a-icon type="question-circle" />
|
|
23
|
+
</a-tooltip>
|
|
24
|
+
</a-checkbox>
|
|
25
|
+
</template>
|
|
26
|
+
<a-button>
|
|
27
|
+
<a-icon :style="iconStyle" type="setting" />
|
|
28
|
+
</a-button>
|
|
29
|
+
</a-popover>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script>
|
|
33
|
+
import Ellipsis from '@/components/Ellipsis'
|
|
34
|
+
|
|
35
|
+
export default {
|
|
36
|
+
name: 'TableSetting',
|
|
37
|
+
props: {
|
|
38
|
+
value: {
|
|
39
|
+
type: Array,
|
|
40
|
+
required: true
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
components: {
|
|
44
|
+
Ellipsis
|
|
45
|
+
},
|
|
46
|
+
data () {
|
|
47
|
+
return {
|
|
48
|
+
// 图标样式
|
|
49
|
+
iconStyle: {
|
|
50
|
+
position: 'relative',
|
|
51
|
+
top: '1px'
|
|
52
|
+
},
|
|
53
|
+
allKey: [],
|
|
54
|
+
indeterminate: true,
|
|
55
|
+
checkAll: false,
|
|
56
|
+
currentValue: [],
|
|
57
|
+
checkedKeys: [],
|
|
58
|
+
replaceFields: { children: 'children', title: 'currentTitle', key: 'dataIndex', slot: 'tsSlots' }
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
mounted () {
|
|
62
|
+
this.currentValue = this.value
|
|
63
|
+
this.currentValue.forEach(column => {
|
|
64
|
+
this.allKey.push(column.dataIndex)
|
|
65
|
+
column.currentTitle = <ellipsis length={16} tooltip>{column.title}</ellipsis>
|
|
66
|
+
column.width2 = column.width
|
|
67
|
+
column.ellipsis2 = column.ellipsis
|
|
68
|
+
if (column.width !== 0 || !column.ellipsis) {
|
|
69
|
+
this.checkedKeys.push(column.dataIndex)
|
|
70
|
+
}
|
|
71
|
+
column.switcherIcon = <a-icon type="pic-left" />
|
|
72
|
+
})
|
|
73
|
+
},
|
|
74
|
+
watch: {
|
|
75
|
+
checkedKeys (cur, last) {
|
|
76
|
+
const checked = cur.filter(function (v) { return last.indexOf(v) === -1 })
|
|
77
|
+
const canceled = last.filter(function (v) { return cur.indexOf(v) === -1 })
|
|
78
|
+
this.currentValue.forEach(column => {
|
|
79
|
+
if (checked.length > 0) {
|
|
80
|
+
if (checked.indexOf(column.dataIndex) > -1) {
|
|
81
|
+
this.$set(column, 'width', column.width2)
|
|
82
|
+
this.$set(column, 'ellipsis', column.ellipsis2)
|
|
83
|
+
}
|
|
84
|
+
} else if (canceled.length > 0) {
|
|
85
|
+
if (canceled.indexOf(column.dataIndex) > -1) {
|
|
86
|
+
this.$set(column, 'width', 0)
|
|
87
|
+
this.$set(column, 'ellipsis', true)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
this.indeterminate = !!cur.length && cur.length < this.allKey.length
|
|
92
|
+
this.checkAll = cur.length === this.allKey.length
|
|
93
|
+
this.$emit('input', this.currentValue)
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
methods: {
|
|
97
|
+
onCheckAllChange (e) {
|
|
98
|
+
Object.assign(this, {
|
|
99
|
+
checkedKeys: e.target.checked ? this.allKey : [],
|
|
100
|
+
indeterminate: false,
|
|
101
|
+
checkAll: e.target.checked
|
|
102
|
+
})
|
|
103
|
+
},
|
|
104
|
+
onDrop (info) {
|
|
105
|
+
const dropKey = info.node.eventKey
|
|
106
|
+
const dragKey = info.dragNode.eventKey
|
|
107
|
+
const dropPos = info.node.pos.split('-')
|
|
108
|
+
const dropPosition = info.dropPosition - Number(dropPos[dropPos.length - 1])
|
|
109
|
+
const loop = (data, key, callback) => {
|
|
110
|
+
data.forEach((item, index, arr) => {
|
|
111
|
+
if (item.dataIndex === key) {
|
|
112
|
+
return callback(item, index, arr)
|
|
113
|
+
}
|
|
114
|
+
if (item.children) {
|
|
115
|
+
return loop(item.children, key, callback)
|
|
116
|
+
}
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
const data = [...this.value]
|
|
120
|
+
|
|
121
|
+
// Find dragObject
|
|
122
|
+
let dragObj
|
|
123
|
+
loop(data, dragKey, (item, index, arr) => {
|
|
124
|
+
arr.splice(index, 1)
|
|
125
|
+
dragObj = item
|
|
126
|
+
})
|
|
127
|
+
let ar
|
|
128
|
+
let i
|
|
129
|
+
loop(data, dropKey, (item, index, arr) => {
|
|
130
|
+
ar = arr
|
|
131
|
+
i = index
|
|
132
|
+
})
|
|
133
|
+
if (dropPosition === -1) {
|
|
134
|
+
ar.splice(i, 0, dragObj)
|
|
135
|
+
} else {
|
|
136
|
+
ar.splice(i + 1, 0, dragObj)
|
|
137
|
+
}
|
|
138
|
+
this.$emit('input', data)
|
|
139
|
+
this.currentValue = data
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
</script>
|