@aochuang/common 1.0.0 → 1.0.1
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/common/loading/index.js +7 -0
- package/common/loading/loading.vue +71 -0
- package/common/tips/index.js +7 -0
- package/common/tips/tips.vue +82 -0
- package/common/tooltip/index.js +7 -0
- package/common/tooltip/popper.js +18 -0
- package/common/tooltip/tooltip.vue +55 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-boolean.vue +33 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-date-range.vue +30 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-date.vue +41 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-datetime-range.vue +34 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-datetime.vue +41 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-number-range.vue +67 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-number.vue +35 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-string.vue +41 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item-value.vue +73 -0
- package/components/advanced-filter/advanced-filter-condition-item/advanced-filter-condition-item.vue +226 -0
- package/components/advanced-filter/advanced-filter-condition-toggle.vue +112 -0
- package/components/advanced-filter/advanced-filter-condition.vue +352 -0
- package/components/advanced-filter/advanced-filter-permanent-item.vue +10 -0
- package/components/advanced-filter/advanced-filter-permanent.vue +10 -0
- package/components/advanced-filter/advanced-filter-scene-form.vue +95 -0
- package/components/advanced-filter/advanced-filter-scene-item.vue +64 -0
- package/components/advanced-filter/advanced-filter-scene-manage.vue +264 -0
- package/components/advanced-filter/advanced-filter-scene-transfer.vue +283 -0
- package/components/advanced-filter/advanced-filter-scene.vue +199 -0
- package/components/advanced-filter/advanced-filter.vue +114 -0
- package/components/advanced-filter/index.js +36 -0
- package/components/advanced-filter/utils.js +132 -0
- package/components/autocomplete/autocomplete.vue +121 -0
- package/components/autocomplete/index.js +7 -0
- package/components/avatar/avatar.png +0 -0
- package/components/avatar/avatar.vue +212 -0
- package/components/avatar/index.js +7 -0
- package/components/brick-wall/brick-wall-skeleton.vue +125 -0
- package/components/brick-wall/brick-wall.vue +293 -0
- package/components/brick-wall/index.js +7 -0
- package/components/button/button.vue +537 -0
- package/components/button/index.js +7 -0
- package/components/button/utils.js +20 -0
- package/components/cascader/cascader.vue +184 -0
- package/components/cascader/index.js +7 -0
- package/components/cascader/util.js +50 -0
- package/components/checkbox/checkbox.vue +114 -0
- package/components/checkbox/index.js +7 -0
- package/components/checkbox-button/index.js +8 -0
- package/components/checkbox-group/checkbox-group.vue +11 -0
- package/components/checkbox-group/index.js +7 -0
- package/components/date-picker/date-picker.vue +300 -0
- package/components/date-picker/index.js +7 -0
- package/components/dialog/dialog.vue +182 -0
- package/components/dialog/index.js +14 -0
- package/components/dialog/utils.js +20 -0
- package/components/drawer/drawer.vue +186 -0
- package/components/drawer/index.js +14 -0
- package/components/drawer/utils.js +36 -0
- package/components/dropdown/dropdown-item.vue +63 -0
- package/components/dropdown/dropdown.vue +286 -0
- package/components/dropdown/index.js +16 -0
- package/components/empty/empty.vue +62 -0
- package/components/empty/index.js +7 -0
- package/components/filter/filter-group.vue +44 -0
- package/components/filter/filter-item.vue +122 -0
- package/components/filter/filter-more.vue +114 -0
- package/components/filter/filter.vue +407 -0
- package/components/filter/index.js +20 -0
- package/components/filter/refresh-line.svg +1 -0
- package/components/filter/util.js +5 -0
- package/components/form/form-cell.vue +231 -0
- package/components/form/form-group.vue +147 -0
- package/components/form/form-row.vue +51 -0
- package/components/form/form.vue +256 -0
- package/components/form/index.js +13 -0
- package/components/grid/grid-card-view/grid-card-view.vue +157 -0
- package/components/grid/grid-column.vue +136 -0
- package/components/grid/grid-filter/grid-filter-group.vue +41 -0
- package/components/grid/grid-filter/grid-filter-item.vue +68 -0
- package/components/grid/grid-filter/grid-filter.vue +115 -0
- package/components/grid/grid-filter/util.js +7 -0
- package/components/grid/grid-filter-operate/grid-filter-operate-item.vue +55 -0
- package/components/grid/grid-filter-operate/grid-filter-operate.vue +46 -0
- package/components/grid/grid-sort/grid-sort-proxy.js +27 -0
- package/components/grid/grid-sort/grid-sort.vue +205 -0
- package/components/grid/grid-sort/icons/asc.png +0 -0
- package/components/grid/grid-sort/icons/desc.png +0 -0
- package/components/grid/grid-sort/index.js +7 -0
- package/components/grid/grid-table-view/grid-table-view.vue +178 -0
- package/components/grid/grid-table.vue +547 -0
- package/components/grid/grid-toolbar/grid-batch-toolbar-proxy.js +21 -0
- package/components/grid/grid-toolbar/grid-batch-toolbar.vue +129 -0
- package/components/grid/grid-toolbar/grid-global-toolbar-proxy.js +21 -0
- package/components/grid/grid-toolbar/grid-global-toolbar.vue +37 -0
- package/components/grid/grid-toolbar/grid-more-toolbar-proxy.js +21 -0
- package/components/grid/grid-toolbar/grid-more-toolbar.vue +138 -0
- package/components/grid/grid-toolbar/grid-row-toolbar.vue +279 -0
- package/components/grid/grid-view-select.vue +78 -0
- package/components/grid/grid.vue +1102 -0
- package/components/grid/icons/more-line.svg +1 -0
- package/components/grid/icons/refresh.svg +14 -0
- package/components/grid/index.js +61 -0
- package/components/grid/util.js +31 -0
- package/components/icon/demo.css +539 -0
- package/components/icon/demo_index.html +7433 -0
- package/components/icon/icon.vue +96 -0
- package/components/icon/iconfont.css +1275 -0
- package/components/icon/iconfont.eot +0 -0
- package/components/icon/iconfont.js +1 -0
- package/components/icon/iconfont.json +2214 -0
- package/components/icon/iconfont.svg +455 -0
- package/components/icon/iconfont.ttf +0 -0
- package/components/icon/iconfont.woff +0 -0
- package/components/icon/iconfont.woff2 +0 -0
- package/components/icon/index.js +7 -0
- package/components/image/image.vue +299 -0
- package/components/image/index.js +12 -0
- package/components/image/util.js +26 -0
- package/components/index.js +153 -0
- package/components/loading/index.js +7 -0
- package/components/loading/loading.vue +130 -0
- package/components/menu/index.js +14 -0
- package/components/menu/menu-group.vue +240 -0
- package/components/menu/menu-item.vue +215 -0
- package/components/menu/menu.vue +64 -0
- package/components/message/index.js +19 -0
- package/components/message/message.js +28 -0
- package/components/message/message.less +6 -0
- package/components/message-box/index.js +10 -0
- package/components/message-box/message-box.js +140 -0
- package/components/message-box/message-box.less +5 -0
- package/components/pagination/index.js +7 -0
- package/components/pagination/pagination.vue +193 -0
- package/components/panel/index.js +7 -0
- package/components/panel/panel.vue +44 -0
- package/components/popover/index.js +7 -0
- package/components/popover/popover.vue +140 -0
- package/components/popup-select/index.js +7 -0
- package/components/popup-select/popup-select.vue +114 -0
- package/components/radio/index.js +7 -0
- package/components/radio/radio.vue +92 -0
- package/components/radio-button/index.js +7 -0
- package/components/radio-button/radio-button.vue +20 -0
- package/components/radio-group/index.js +7 -0
- package/components/radio-group/radio-group.vue +22 -0
- package/components/searchbox/index.js +7 -0
- package/components/searchbox/searchbox.vue +260 -0
- package/components/select/index.js +9 -0
- package/components/select/select-load-more.vue +53 -0
- package/components/select/select.vue +572 -0
- package/components/skeleton/index.js +14 -0
- package/components/skeleton/skeleton-rows.vue +52 -0
- package/components/skeleton/skeleton.vue +72 -0
- package/components/sortable/index.js +9 -0
- package/components/sortable/sortable-item.vue +77 -0
- package/components/sortable/sortable.vue +62 -0
- package/components/spinner/index.js +7 -0
- package/components/spinner/spinner.vue +121 -0
- package/components/spinner-range/index.js +7 -0
- package/components/spinner-range/spinner-range.vue +97 -0
- package/components/spinner-textarea/index.js +7 -0
- package/components/spinner-textarea/spinner-textarea.vue +65 -0
- package/components/switch/index.js +7 -0
- package/components/switch/switch.vue +105 -0
- package/components/tabs/index.js +10 -0
- package/components/tabs/tabs.vue +115 -0
- package/components/tag/index.js +9 -0
- package/components/tag/tag.less +30 -0
- package/components/text/index.js +7 -0
- package/components/text/text.vue +69 -0
- package/components/textarea/index.js +7 -0
- package/components/textarea/textarea.vue +229 -0
- package/components/textbox/index.js +7 -0
- package/components/textbox/textbox.vue +275 -0
- package/components/time-picker/index.js +7 -0
- package/components/time-picker/time-picker.vue +77 -0
- package/components/toolbar/index.js +14 -0
- package/components/toolbar/toolbar-item.vue +43 -0
- package/components/toolbar/toolbar.vue +81 -0
- package/components/tooltip/index.js +9 -0
- package/components/tooltip/tooltip.vue +86 -0
- package/components/transfer/index.js +7 -0
- package/components/transfer/transfer-load-more.vue +53 -0
- package/components/transfer/transfer.vue +245 -0
- package/components/tree/index.js +7 -0
- package/components/tree/tree.vue +326 -0
- package/components/tree/utils.js +122 -0
- package/components/video/index.js +7 -0
- package/components/video/video.vue +53 -0
- package/package.json +4 -1
- package/utils/date.js +55 -0
- package/utils/emitter.js +3 -0
- package/utils/json.js +19 -0
- package/utils/resize-event.js +35 -0
- package/utils/util.js +12 -0
- package/utils/utils.js +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Toolbar from './toolbar.vue'
|
|
2
|
+
import ToolbarItem from './toolbar-item.vue'
|
|
3
|
+
|
|
4
|
+
Toolbar.install = (Vue) => {
|
|
5
|
+
Vue.component(Toolbar.name, Toolbar)
|
|
6
|
+
Vue.component(ToolbarItem.name, ToolbarItem)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
Toolbar,
|
|
11
|
+
ToolbarItem
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default Toolbar
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ui-toolbar-item" :class="{'is-divided': divided}" @click="handleClick">
|
|
3
|
+
<slot v-if="!divided"></slot>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
<script>
|
|
7
|
+
export default {
|
|
8
|
+
name: 'UiToolbarItem',
|
|
9
|
+
props: {
|
|
10
|
+
divided: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: false
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
provide () {
|
|
16
|
+
return {
|
|
17
|
+
UiToolbarItem: this
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
methods: {
|
|
21
|
+
handleClick (evt) {
|
|
22
|
+
evt.stopPropagation()
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
</script>
|
|
27
|
+
<style lang="less">
|
|
28
|
+
.ui-toolbar-item{
|
|
29
|
+
vertical-align: top;
|
|
30
|
+
display: inline-block;
|
|
31
|
+
&.is-divided{
|
|
32
|
+
height: 20px;
|
|
33
|
+
width: 1px;
|
|
34
|
+
background-color: rgba(0,0,0,.06);
|
|
35
|
+
}
|
|
36
|
+
&:first-child{
|
|
37
|
+
margin-left: 0;
|
|
38
|
+
}
|
|
39
|
+
&:last-child{
|
|
40
|
+
margin-right: 0;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
</style>
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ui-toolbar" :class="['ui-toolbar--' + type]" :style="style">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
<script>
|
|
7
|
+
export default {
|
|
8
|
+
name: 'UiToolbar',
|
|
9
|
+
inject: {
|
|
10
|
+
UiDialog: {
|
|
11
|
+
default: null
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
provide () {
|
|
15
|
+
return {
|
|
16
|
+
UiToolbar: this
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
props: {
|
|
20
|
+
position: {
|
|
21
|
+
type: String
|
|
22
|
+
},
|
|
23
|
+
type: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: 'default',
|
|
26
|
+
validator (value) {
|
|
27
|
+
return ['default', 'tight'].includes(value)
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
closeDialog: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: true
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
computed: {
|
|
36
|
+
innerPosition () {
|
|
37
|
+
if (this.position) {
|
|
38
|
+
return this.position
|
|
39
|
+
}
|
|
40
|
+
if (this.UiDialog) {
|
|
41
|
+
return 'right'
|
|
42
|
+
}
|
|
43
|
+
return 'left'
|
|
44
|
+
},
|
|
45
|
+
style () {
|
|
46
|
+
const style = {}
|
|
47
|
+
const map = {
|
|
48
|
+
left: 'flex-start',
|
|
49
|
+
center: 'center',
|
|
50
|
+
right: 'flex-end',
|
|
51
|
+
between: 'space-between',
|
|
52
|
+
around: 'space-around'
|
|
53
|
+
}
|
|
54
|
+
style['justify-content'] = map[this.innerPosition]
|
|
55
|
+
return style
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
methods: {
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
</script>
|
|
63
|
+
<style lang="less">
|
|
64
|
+
.ui-toolbar{
|
|
65
|
+
display: flex;
|
|
66
|
+
flex-direction: row;
|
|
67
|
+
align-items: center;
|
|
68
|
+
}
|
|
69
|
+
.ui-toolbar--default {
|
|
70
|
+
.ui-toolbar-item {
|
|
71
|
+
margin-left: 6px;
|
|
72
|
+
margin-right: 6px;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
.ui-toolbar--tight {
|
|
76
|
+
.ui-toolbar-item {
|
|
77
|
+
margin-left: 2px;
|
|
78
|
+
margin-right: 2px;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
</style>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-tooltip ref="tooltip" :popper-class="popperClass" :content="content" :manual="manual" v-model="innerVisible" :placement="placement" :disabled="disabled" :open-delay="openDelay" :visible-arrow="true">
|
|
3
|
+
<slot slot="content" name="content">
|
|
4
|
+
<div v-if="html" class="ui-tooltip__html" v-html="html"></div>
|
|
5
|
+
</slot>
|
|
6
|
+
<slot></slot>
|
|
7
|
+
</el-tooltip>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
import ElTooltip from 'element-ui/lib/tooltip'
|
|
12
|
+
import 'element-ui/lib/theme-chalk/tooltip.css'
|
|
13
|
+
export default {
|
|
14
|
+
name: 'UiTooltip',
|
|
15
|
+
components: {
|
|
16
|
+
ElTooltip
|
|
17
|
+
},
|
|
18
|
+
model: {
|
|
19
|
+
prop: 'visible',
|
|
20
|
+
event: 'input'
|
|
21
|
+
},
|
|
22
|
+
props: {
|
|
23
|
+
content: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: ''
|
|
26
|
+
},
|
|
27
|
+
html: {
|
|
28
|
+
type: String
|
|
29
|
+
},
|
|
30
|
+
visible: {
|
|
31
|
+
type: Boolean
|
|
32
|
+
},
|
|
33
|
+
manual: {
|
|
34
|
+
type: Boolean
|
|
35
|
+
},
|
|
36
|
+
openDelay: {
|
|
37
|
+
type: Number
|
|
38
|
+
},
|
|
39
|
+
placement: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: 'top'
|
|
42
|
+
},
|
|
43
|
+
disabled: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: false
|
|
46
|
+
},
|
|
47
|
+
popperClass: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: ''
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
computed: {
|
|
53
|
+
innerVisible: {
|
|
54
|
+
get () {
|
|
55
|
+
return this.visible
|
|
56
|
+
},
|
|
57
|
+
set (val) {
|
|
58
|
+
this.$emit('input', val)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
methods: {
|
|
63
|
+
setReferenceElm ($el) {
|
|
64
|
+
this.$refs.tooltip.referenceElm = $el
|
|
65
|
+
clearTimeout(this._timer)
|
|
66
|
+
this._timer = setTimeout(() => {
|
|
67
|
+
this.$refs.tooltip.popperJS._reference = $el
|
|
68
|
+
this.$refs.tooltip.updatePopper()
|
|
69
|
+
}, 30)
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
beforeDestroy () {
|
|
73
|
+
clearTimeout(this._timer)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
</script>
|
|
77
|
+
<style lang="less">
|
|
78
|
+
body {
|
|
79
|
+
.el-tooltip__popper{
|
|
80
|
+
max-width: 800px;
|
|
81
|
+
line-height: 1.7em;
|
|
82
|
+
padding: 8px 12px;
|
|
83
|
+
pointer-events: none;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
</style>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ui-transfer-load-more">
|
|
3
|
+
<div class="ui-transfer-load-more__loading" v-if="status === 'loading'">
|
|
4
|
+
<ui-icon name="loading"></ui-icon> 正在加载
|
|
5
|
+
</div>
|
|
6
|
+
<div class="ui-transfer-load-more__loadmore" v-if="status === 'loadmore'" @click="handleLoadMoreClick">点击加载更多</div>
|
|
7
|
+
<div class="ui-transfer-load-more__nomore" v-if="status === 'nomore'">没有更多了</div>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
export default {
|
|
13
|
+
name: 'UiTransferLoadMore',
|
|
14
|
+
props: {
|
|
15
|
+
status: {
|
|
16
|
+
type: String,
|
|
17
|
+
value: 'loadmore',
|
|
18
|
+
validator (value) {
|
|
19
|
+
return ['loadmore', 'loading', 'nomore']
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
methods: {
|
|
24
|
+
handleLoadMoreClick () {
|
|
25
|
+
this.$emit('loadmore')
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<style lang="less">
|
|
32
|
+
.ui-transfer-load-more{
|
|
33
|
+
height: 24px;
|
|
34
|
+
line-height: 24px;
|
|
35
|
+
padding: 4px 12px;
|
|
36
|
+
text-align: center;
|
|
37
|
+
color: #999;
|
|
38
|
+
font-size: 12px;
|
|
39
|
+
box-sizing: content-box!important;
|
|
40
|
+
}
|
|
41
|
+
.ui-transfer-load-more__loading,
|
|
42
|
+
.ui-transfer-load-more__loadmore,
|
|
43
|
+
.ui-transfer-load-more__nomore{
|
|
44
|
+
display: inline-block;
|
|
45
|
+
position: relative;
|
|
46
|
+
}
|
|
47
|
+
.ui-transfer-load-more__loadmore{
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
&:hover {
|
|
50
|
+
color: #4389fa;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
</style>
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-transfer
|
|
3
|
+
class="ui-transfer"
|
|
4
|
+
:data="innerData"
|
|
5
|
+
:props="props"
|
|
6
|
+
:titles="titles"
|
|
7
|
+
:filter-placeholder="filterPlaceholer"
|
|
8
|
+
:filterable="filterable"
|
|
9
|
+
:filter-method="filterMethod"
|
|
10
|
+
v-loadmore="lazy ? handleLoadMore : null"
|
|
11
|
+
v-model="innerValue"
|
|
12
|
+
>
|
|
13
|
+
<template slot="left-footer">
|
|
14
|
+
<transfer-load-more
|
|
15
|
+
style="margin-top: 4px;"
|
|
16
|
+
v-if="lazy"
|
|
17
|
+
:status="loadMoreStatus"
|
|
18
|
+
@loadmore="handleLoadMoreClick"
|
|
19
|
+
></transfer-load-more>
|
|
20
|
+
</template>
|
|
21
|
+
<template slot="right-footer">
|
|
22
|
+
<div
|
|
23
|
+
v-if="lazy"
|
|
24
|
+
>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
</el-transfer>
|
|
28
|
+
</template>
|
|
29
|
+
<script>
|
|
30
|
+
import ElTransfer from 'element-ui/lib/transfer'
|
|
31
|
+
import 'element-ui/lib/theme-chalk/transfer.css'
|
|
32
|
+
import TransferLoadMore from './transfer-load-more'
|
|
33
|
+
|
|
34
|
+
export default {
|
|
35
|
+
name: 'UiTransfer',
|
|
36
|
+
components: {
|
|
37
|
+
ElTransfer,
|
|
38
|
+
TransferLoadMore
|
|
39
|
+
},
|
|
40
|
+
props: {
|
|
41
|
+
value: {
|
|
42
|
+
type: Array
|
|
43
|
+
},
|
|
44
|
+
titles: {
|
|
45
|
+
type: Array
|
|
46
|
+
},
|
|
47
|
+
filterable: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: false
|
|
50
|
+
},
|
|
51
|
+
filterMethod: {
|
|
52
|
+
type: Function
|
|
53
|
+
},
|
|
54
|
+
textField: {
|
|
55
|
+
type: String,
|
|
56
|
+
default: 'text'
|
|
57
|
+
},
|
|
58
|
+
valueField: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: 'value'
|
|
61
|
+
},
|
|
62
|
+
lazy: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: false
|
|
65
|
+
},
|
|
66
|
+
filterPlaceholer: {
|
|
67
|
+
type: String
|
|
68
|
+
},
|
|
69
|
+
data: {
|
|
70
|
+
type: Array
|
|
71
|
+
},
|
|
72
|
+
queryMethod: {
|
|
73
|
+
type: Function
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
data () {
|
|
77
|
+
return {
|
|
78
|
+
pageIndex: 1,
|
|
79
|
+
pageSize: 20,
|
|
80
|
+
reloading: false,
|
|
81
|
+
moring: false,
|
|
82
|
+
innerData: [],
|
|
83
|
+
innerLoading: false,
|
|
84
|
+
notMore: false
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
computed: {
|
|
88
|
+
innerValue: {
|
|
89
|
+
get () {
|
|
90
|
+
return this.value
|
|
91
|
+
},
|
|
92
|
+
set (val) {
|
|
93
|
+
this.$emit('input', val)
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
props () {
|
|
97
|
+
return {
|
|
98
|
+
key: this.valueField,
|
|
99
|
+
label: this.textField
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
loadMoreStatus () {
|
|
103
|
+
let status = 'loadmore'
|
|
104
|
+
if (this.notMore) {
|
|
105
|
+
status = 'nomore'
|
|
106
|
+
} else if (this.moring || this.innerLoading) {
|
|
107
|
+
status = 'loading'
|
|
108
|
+
}
|
|
109
|
+
return status
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
watch: {
|
|
113
|
+
data () {
|
|
114
|
+
this.innerData = this.data || []
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
directives: {
|
|
118
|
+
loadmore: {
|
|
119
|
+
bind(el, binding) {
|
|
120
|
+
// 获取element-ui定义好的scroll盒子
|
|
121
|
+
const $scroll = el.querySelector('.el-transfer-panel__list')
|
|
122
|
+
const scrollTop = $scroll.scrollTop
|
|
123
|
+
$scroll.addEventListener('scroll', function(e) {
|
|
124
|
+
const CONDITION = this.scrollHeight - this.scrollTop - 5 <= this.clientHeight
|
|
125
|
+
if (CONDITION && this.scrollTop > scrollTop) {
|
|
126
|
+
binding.value && binding.value()
|
|
127
|
+
}
|
|
128
|
+
})
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
created () {
|
|
133
|
+
if (this.queryMethod) {
|
|
134
|
+
this.reload()
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
methods: {
|
|
138
|
+
loadMoreOptions () {
|
|
139
|
+
if (this.innerLoading || this.notMore) {
|
|
140
|
+
return
|
|
141
|
+
}
|
|
142
|
+
const nextPageIndex = this.pageIndex + 1
|
|
143
|
+
const rs = this.loadOptions(true, nextPageIndex)
|
|
144
|
+
if (rs && rs.then) {
|
|
145
|
+
this.moring = true
|
|
146
|
+
rs.then((rs) => {
|
|
147
|
+
this.pageIndex = nextPageIndex
|
|
148
|
+
this.innerData = [].concat(this.innerData, rs || [])
|
|
149
|
+
this.$emit('load', {
|
|
150
|
+
data: this.innerData
|
|
151
|
+
})
|
|
152
|
+
}).finally(() => {
|
|
153
|
+
this.moring = false
|
|
154
|
+
})
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
/**
|
|
158
|
+
* 加载远程备选项
|
|
159
|
+
*/
|
|
160
|
+
loadOptions (isLoading, pageIndex) {
|
|
161
|
+
if (!this.queryMethod) {
|
|
162
|
+
return
|
|
163
|
+
}
|
|
164
|
+
const params = {}
|
|
165
|
+
if (this.lazy) {
|
|
166
|
+
params.pageIndex = (pageIndex || this.pageIndex) - 1
|
|
167
|
+
params.pageSize = this.pageSize
|
|
168
|
+
}
|
|
169
|
+
if (this.innerData && this.innerData.length) {
|
|
170
|
+
params.lastItem = this.innerData[this.innerData.length - 1]
|
|
171
|
+
}
|
|
172
|
+
params.keyword = this.keyword
|
|
173
|
+
const rs = this.queryMethod(params)
|
|
174
|
+
if (rs && rs.then) {
|
|
175
|
+
if (isLoading !== false) {
|
|
176
|
+
this.innerLoading = true
|
|
177
|
+
}
|
|
178
|
+
return rs.then((rs) => {
|
|
179
|
+
this.notMore = rs.length < this.pageSize
|
|
180
|
+
return rs
|
|
181
|
+
}).finally(() => {
|
|
182
|
+
this.innerLoading = false
|
|
183
|
+
})
|
|
184
|
+
} else {
|
|
185
|
+
return Promise.resolve(rs || [])
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
reload (isLoading = true) {
|
|
189
|
+
this.innerData = []
|
|
190
|
+
const rs = this.loadOptions(true, 1)
|
|
191
|
+
if (rs && rs.then) {
|
|
192
|
+
if (isLoading) {
|
|
193
|
+
this.reloading = true
|
|
194
|
+
}
|
|
195
|
+
rs.then((rs) => {
|
|
196
|
+
this.innerData = rs || []
|
|
197
|
+
this.$emit('load', {
|
|
198
|
+
data: this.innerData
|
|
199
|
+
})
|
|
200
|
+
}).finally(() => {
|
|
201
|
+
if (isLoading) {
|
|
202
|
+
this.reloading = false
|
|
203
|
+
}
|
|
204
|
+
})
|
|
205
|
+
}
|
|
206
|
+
return rs
|
|
207
|
+
},
|
|
208
|
+
handleLoadMore () {
|
|
209
|
+
this.loadMoreOptions()
|
|
210
|
+
},
|
|
211
|
+
handleLoadMoreClick () {
|
|
212
|
+
this.loadMoreOptions()
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
</script>
|
|
217
|
+
<style lang="less">
|
|
218
|
+
.ui-transfer {
|
|
219
|
+
&.el-transfer{
|
|
220
|
+
display: flex;
|
|
221
|
+
flex-direction: row;
|
|
222
|
+
align-items: center;
|
|
223
|
+
}
|
|
224
|
+
.el-transfer-panel .el-transfer-panel__header .el-checkbox .el-checkbox__label{
|
|
225
|
+
font-size: 14px;
|
|
226
|
+
}
|
|
227
|
+
.el-transfer-panel .el-checkbox__inner {
|
|
228
|
+
width: 12px;
|
|
229
|
+
height: 12px;
|
|
230
|
+
}
|
|
231
|
+
.el-transfer-panel{
|
|
232
|
+
flex: 1;
|
|
233
|
+
min-width: 0;
|
|
234
|
+
}
|
|
235
|
+
.el-transfer-panel__body{
|
|
236
|
+
height: 316px;
|
|
237
|
+
}
|
|
238
|
+
.el-transfer-panel__list.is-filterable{
|
|
239
|
+
height: 262px;
|
|
240
|
+
}
|
|
241
|
+
.el-transfer-panel__footer{
|
|
242
|
+
border-top: 0;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
</style>
|