@idooel/components 0.0.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/dist/@idooel/components.umd.js +1813 -0
- package/package.json +41 -0
- package/packages/button/index.js +5 -0
- package/packages/button/src/index.vue +25 -0
- package/packages/composite-components/button-group/index.js +5 -0
- package/packages/composite-components/button-group/src/index.vue +47 -0
- package/packages/composite-components/search-area/index.js +5 -0
- package/packages/composite-components/search-area/src/index.vue +129 -0
- package/packages/composite-components/search-area/src/label.vue +36 -0
- package/packages/date/index.js +5 -0
- package/packages/date/src/index.vue +40 -0
- package/packages/index.js +50 -0
- package/packages/input/index.js +5 -0
- package/packages/input/src/index.vue +24 -0
- package/packages/select/index.js +5 -0
- package/packages/select/src/index.vue +35 -0
- package/packages/table/index.js +5 -0
- package/packages/table/src/action.vue +45 -0
- package/packages/table/src/index.vue +89 -0
- package/packages/tpl/index.js +5 -0
- package/packages/tpl/src/index.vue +39 -0
- package/packages/tree/index.js +5 -0
- package/packages/tree/src/TreeNode.vue +30 -0
- package/packages/tree/src/index.vue +97 -0
- package/packages/tree-table-model/README.md +0 -0
- package/packages/tree-table-model/index.js +5 -0
- package/packages/tree-table-model/src/index.vue +290 -0
- package/scripts/rollup.config.js +42 -0
- package/scripts/rollup.umd.config.js +15 -0
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@idooel/components",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"private": false,
|
|
6
|
+
"main": "dist/@idooel/components.umd.js",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=14"
|
|
9
|
+
},
|
|
10
|
+
"author": "Ruster <protagonisths@gmail.com> (https://github.com/Protagonistss)",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "rollup --config scripts/rollup.umd.config.js"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [],
|
|
15
|
+
"license": "ISC",
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"ant-design-vue": "1.7.8",
|
|
18
|
+
"moment": "^2.30.1",
|
|
19
|
+
"@idooel/shared": "workspace:^0.0.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@babel/core": "7.17.9",
|
|
23
|
+
"@idooel/shared": "workspace:^0.0.0",
|
|
24
|
+
"@rollup/plugin-node-resolve": "13.2.0",
|
|
25
|
+
"@rollup/plugin-strip": "2.1.0",
|
|
26
|
+
"@vue/compiler-sfc": "3.2.33",
|
|
27
|
+
"babel-plugin-component": "1.1.1",
|
|
28
|
+
"babel-plugin-external-helpers": "6.22.0",
|
|
29
|
+
"postcss": "8.4.12",
|
|
30
|
+
"postcss-import": "14.1.0",
|
|
31
|
+
"rollup": "2.70.1",
|
|
32
|
+
"rollup-plugin-babel": "4.4.0",
|
|
33
|
+
"rollup-plugin-postcss": "4.0.2",
|
|
34
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
35
|
+
"rollup-plugin-vue": "5.1.9",
|
|
36
|
+
"vue-template-compiler": "2.7.16"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"uuid": "^9.0.1"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<a-button :type="type" :icon="icon" @click="handleClick">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</a-button>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script>
|
|
8
|
+
export default {
|
|
9
|
+
name: 'ele-button',
|
|
10
|
+
props: {
|
|
11
|
+
type: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: 'default'
|
|
14
|
+
},
|
|
15
|
+
icon: {
|
|
16
|
+
type: String
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
methods: {
|
|
20
|
+
handleClick () {
|
|
21
|
+
this.$emit('click')
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
</script>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="button-group__wrapper">
|
|
3
|
+
<ele-button
|
|
4
|
+
v-for="(item, idx) in dataSource"
|
|
5
|
+
:type="item.type"
|
|
6
|
+
:icon="item.icon"
|
|
7
|
+
@click="handleClick(item)"
|
|
8
|
+
:key="idx">
|
|
9
|
+
{{ item.label }}
|
|
10
|
+
</ele-button>
|
|
11
|
+
</div>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
import EleButton from '../../../button/src/index.vue'
|
|
16
|
+
export default {
|
|
17
|
+
name: 'ele-button-group',
|
|
18
|
+
components: {
|
|
19
|
+
EleButton
|
|
20
|
+
},
|
|
21
|
+
props: {
|
|
22
|
+
dataSource: {
|
|
23
|
+
type: Array,
|
|
24
|
+
default: () => []
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
methods: {
|
|
28
|
+
handleClick (props) {
|
|
29
|
+
this.$emit('click', props)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<style lang="scss" scoped>
|
|
36
|
+
.button-group__wrapper {
|
|
37
|
+
display: flex;
|
|
38
|
+
padding-left: 16px;
|
|
39
|
+
padding-right: 16px;
|
|
40
|
+
.ant-btn {
|
|
41
|
+
margin-left: 8px;
|
|
42
|
+
&:first-child {
|
|
43
|
+
margin-left: 0;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
</style>
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="search-area__wrapper">
|
|
3
|
+
<a-row :gutter="gutter">
|
|
4
|
+
<a-col :span="item.span || span" v-for="(item, idx) in innerDataSource" :key="idx">
|
|
5
|
+
<div v-if="item.type == '_action'" class="search-area__item search-area--action">
|
|
6
|
+
<ele-button icon="search" type="primary" @click="handleClickSearch">查询</ele-button>
|
|
7
|
+
<ele-button style="margin-left:8px;" icon="reload" @click="handleClickReset">重置</ele-button>
|
|
8
|
+
</div>
|
|
9
|
+
<div v-else class="search-area__item">
|
|
10
|
+
<template v-if="item.type == 'Input'">
|
|
11
|
+
<Label :label="item.label"></Label>
|
|
12
|
+
<ele-input v-model="item._value"></ele-input>
|
|
13
|
+
</template>
|
|
14
|
+
<template v-else-if="item.type == 'Select'">
|
|
15
|
+
<Label :label="item.label"></Label>
|
|
16
|
+
<ele-select v-model="item._value" :data-source="item.optionList"></ele-select>
|
|
17
|
+
</template>
|
|
18
|
+
<template v-else-if="item.type == 'DatePicker'">
|
|
19
|
+
<Label :label="item.label"></Label>
|
|
20
|
+
<ele-date v-model="item._value" :format="item.format"></ele-date>
|
|
21
|
+
</template>
|
|
22
|
+
</div>
|
|
23
|
+
</a-col>
|
|
24
|
+
</a-row>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script>
|
|
29
|
+
import EleInput from '../../../input/src/index.vue'
|
|
30
|
+
import EleSelect from '../../../select/src/index.vue'
|
|
31
|
+
import ELeButton from '../../../button/src/index.vue'
|
|
32
|
+
import EleDate from '../../../date/src/index.vue'
|
|
33
|
+
import Label from './label.vue'
|
|
34
|
+
import moment from 'moment'
|
|
35
|
+
export default {
|
|
36
|
+
name: 'ele-search-area',
|
|
37
|
+
components: {
|
|
38
|
+
EleInput,
|
|
39
|
+
EleSelect,
|
|
40
|
+
ELeButton,
|
|
41
|
+
Label,
|
|
42
|
+
EleDate
|
|
43
|
+
},
|
|
44
|
+
props: {
|
|
45
|
+
gutter: {
|
|
46
|
+
type: [Number, Array, Object],
|
|
47
|
+
default: () => ([
|
|
48
|
+
16, 8
|
|
49
|
+
])
|
|
50
|
+
},
|
|
51
|
+
span: {
|
|
52
|
+
type: Number,
|
|
53
|
+
default: 8
|
|
54
|
+
},
|
|
55
|
+
dataSource: {
|
|
56
|
+
type: Array,
|
|
57
|
+
required: true
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
computed: {
|
|
61
|
+
actionColOffset () {
|
|
62
|
+
return ((24 / this.span) - 1) * this.span
|
|
63
|
+
},
|
|
64
|
+
innerDataSource () {
|
|
65
|
+
return [...this.dataSource, { type: '_action' }]
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
methods: {
|
|
69
|
+
handleClickSearch () {
|
|
70
|
+
const querys = this.extractValues()
|
|
71
|
+
this.$emit('search', querys)
|
|
72
|
+
},
|
|
73
|
+
extractValues () {
|
|
74
|
+
let ret = {}
|
|
75
|
+
this.innerDataSource.filter(item => item.type !== '_action').forEach(item => {
|
|
76
|
+
switch (item.type) {
|
|
77
|
+
case 'DatePicker':
|
|
78
|
+
ret[item.name] = moment(item._value).isValid() ? moment(item._value).format(item.format) : null
|
|
79
|
+
break
|
|
80
|
+
default:
|
|
81
|
+
ret[item.name] = item._value
|
|
82
|
+
break
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
return ret
|
|
86
|
+
},
|
|
87
|
+
handleClickReset () {
|
|
88
|
+
this.innerDataSource.filter(item => item.type !== '_action').forEach(item => {
|
|
89
|
+
switch (item.type) {
|
|
90
|
+
case 'Select':
|
|
91
|
+
this.$set(item, '_value', null)
|
|
92
|
+
break
|
|
93
|
+
case 'DatePicker':
|
|
94
|
+
this.$set(item, '_value', null)
|
|
95
|
+
break
|
|
96
|
+
default:
|
|
97
|
+
this.$set(item, '_value', null)
|
|
98
|
+
break
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
//TODO defaultValue
|
|
102
|
+
const querys = this.extractValues()
|
|
103
|
+
this.$emit('search', querys)
|
|
104
|
+
},
|
|
105
|
+
onChangeSelect (value, props) {
|
|
106
|
+
this.$set(props, '_value', value)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
</script>
|
|
111
|
+
|
|
112
|
+
<style lang="scss" scoped>
|
|
113
|
+
.search-area__wrapper {
|
|
114
|
+
padding-top: 16px;
|
|
115
|
+
padding-left: 16px;
|
|
116
|
+
padding-right: 16px;
|
|
117
|
+
::v-deep .ant-col {
|
|
118
|
+
&:last-child {
|
|
119
|
+
float: right;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
.search-area__item {
|
|
123
|
+
height: 32px;
|
|
124
|
+
display: flex;
|
|
125
|
+
flex-direction: row;
|
|
126
|
+
align-items: center;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
</style>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="g-search__label">
|
|
3
|
+
<span class="label__title">{{ label }}</span>
|
|
4
|
+
<span class="label__suffix">:</span>
|
|
5
|
+
</div>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script>
|
|
9
|
+
export default {
|
|
10
|
+
props: {
|
|
11
|
+
label: {
|
|
12
|
+
type: String
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<style lang="scss" scoped>
|
|
19
|
+
.g-search__label {
|
|
20
|
+
/* width: 69px; */
|
|
21
|
+
flex-basis: 69px;
|
|
22
|
+
height: 32px;
|
|
23
|
+
display: flex;
|
|
24
|
+
flex-direction: row;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: space-between;
|
|
27
|
+
.label__title, .label__suffix {
|
|
28
|
+
font-size: 14px;
|
|
29
|
+
color: rgba(0, 0, 0, 0.88);
|
|
30
|
+
white-space: nowrap;
|
|
31
|
+
}
|
|
32
|
+
.label__suffix {
|
|
33
|
+
margin-left: 4px;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
</style>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<a-date-picker
|
|
3
|
+
style="width: 100%;"
|
|
4
|
+
mode="year"
|
|
5
|
+
:open="open"
|
|
6
|
+
:value="value"
|
|
7
|
+
@focus="onFocus"
|
|
8
|
+
@panelChange="onPanelChange"
|
|
9
|
+
:format="format">
|
|
10
|
+
</a-date-picker>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
export default {
|
|
15
|
+
name: 'ele-date',
|
|
16
|
+
props: {
|
|
17
|
+
value: {
|
|
18
|
+
type: Object
|
|
19
|
+
},
|
|
20
|
+
format: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: 'YYYY/MM/DD'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
data () {
|
|
26
|
+
return {
|
|
27
|
+
open: false
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
methods: {
|
|
31
|
+
onFocus () {
|
|
32
|
+
this.open = true
|
|
33
|
+
},
|
|
34
|
+
onPanelChange (value, mode) {
|
|
35
|
+
this.$emit('input', value)
|
|
36
|
+
this.open = false
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
</script>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import EleButton from './button/index.js'
|
|
2
|
+
import EleDate from './date/index.js'
|
|
3
|
+
import EleInput from './input/index.js'
|
|
4
|
+
import EleSelect from './select/index.js'
|
|
5
|
+
import EleTable from './table/index.js'
|
|
6
|
+
import EleTree from './tree/index.js'
|
|
7
|
+
import EleTpl from './tpl/index.js'
|
|
8
|
+
|
|
9
|
+
import EleButtonGroup from './composite-components/button-group/index.js'
|
|
10
|
+
import EleSearchArea from './composite-components/search-area/index.js'
|
|
11
|
+
|
|
12
|
+
import EleTreeTableModel from './tree-table-model/index.js'
|
|
13
|
+
|
|
14
|
+
const compositeComponents = [
|
|
15
|
+
EleButtonGroup,
|
|
16
|
+
EleSearchArea
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
const models = [
|
|
20
|
+
EleTreeTableModel
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
const components = [
|
|
24
|
+
EleButton,
|
|
25
|
+
EleDate,
|
|
26
|
+
EleInput,
|
|
27
|
+
EleSelect,
|
|
28
|
+
EleTable,
|
|
29
|
+
EleTree,
|
|
30
|
+
EleTpl,
|
|
31
|
+
...compositeComponents,
|
|
32
|
+
...models
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
const install = (Vue) => {
|
|
36
|
+
if (install.installed) return
|
|
37
|
+
install.installed = true
|
|
38
|
+
components.forEach(component => {
|
|
39
|
+
Vue.component(component.name, component)
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
export default install
|
|
43
|
+
export {
|
|
44
|
+
EleButton,
|
|
45
|
+
EleDate,
|
|
46
|
+
EleInput,
|
|
47
|
+
EleSelect,
|
|
48
|
+
EleTable,
|
|
49
|
+
EleTree
|
|
50
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<a-input :value="value" @change="onChange"></a-input>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
export default {
|
|
7
|
+
name: 'ele-input',
|
|
8
|
+
props: {
|
|
9
|
+
value: {
|
|
10
|
+
type: String
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
methods: {
|
|
14
|
+
onChange (e) {
|
|
15
|
+
this.$emit('change', e.target.value)
|
|
16
|
+
this.$emit('input', e.target.value)
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<style scoped>
|
|
23
|
+
|
|
24
|
+
</style>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<a-select :value="value" style="width: 100%" @change="onChange">
|
|
3
|
+
<a-select-option v-for="item in dataSource" :key="item.value" :value="item.value">
|
|
4
|
+
{{ item.label }}
|
|
5
|
+
</a-select-option>
|
|
6
|
+
</a-select>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script>
|
|
10
|
+
export default {
|
|
11
|
+
name: 'ele-select',
|
|
12
|
+
props: {
|
|
13
|
+
value: {
|
|
14
|
+
type: [String, Array, Number]
|
|
15
|
+
},
|
|
16
|
+
defaultValue: {
|
|
17
|
+
type: [String, Array, Number]
|
|
18
|
+
},
|
|
19
|
+
dataSource: {
|
|
20
|
+
type: Array,
|
|
21
|
+
default: () => []
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
methods: {
|
|
25
|
+
onChange (value) {
|
|
26
|
+
this.$emit('change', value)
|
|
27
|
+
this.$emit('input', value)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<style lang="scss" scoped>
|
|
34
|
+
|
|
35
|
+
</style>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="g-table__action">
|
|
3
|
+
<div class="table-action__item" v-for="(item, idx) in dataSource" :key="idx">
|
|
4
|
+
<template v-if="item.type == 'text'">
|
|
5
|
+
<span @click="handleClickText(item)">{{ item.label }}</span>
|
|
6
|
+
</template>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
export default {
|
|
13
|
+
props: {
|
|
14
|
+
record: {
|
|
15
|
+
type: Object
|
|
16
|
+
},
|
|
17
|
+
dataSource: {
|
|
18
|
+
type: Array,
|
|
19
|
+
default: () => []
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
methods: {
|
|
23
|
+
handleClickText (props) {
|
|
24
|
+
const { eventName, key } = props
|
|
25
|
+
this.$emit(eventName, { key, record: this.record })
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<style lang="scss" scoped>
|
|
32
|
+
.g-table__action {
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: row;
|
|
35
|
+
.table-action__item {
|
|
36
|
+
font-size: 14px;
|
|
37
|
+
color: #409EFF;
|
|
38
|
+
margin-left: 16px;
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
&:first-child {
|
|
41
|
+
margin-left: 0;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
</style>
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="g-table__wrapper">
|
|
3
|
+
<a-table
|
|
4
|
+
:pagination="false"
|
|
5
|
+
:loading="loading"
|
|
6
|
+
:columns="columns"
|
|
7
|
+
:row-class-name="setRowClassName"
|
|
8
|
+
:data-source="dataSource"
|
|
9
|
+
:scroll="{ x: 1500, y: 500 }">
|
|
10
|
+
<template slot="action" slot-scope="record">
|
|
11
|
+
<Actions v-on="$listeners" :data-source="actions" :record="record"></Actions>
|
|
12
|
+
</template>
|
|
13
|
+
</a-table>
|
|
14
|
+
<div class="g-table__pagination">
|
|
15
|
+
<a-pagination
|
|
16
|
+
:show-total="total => `共 ${total} 条数据`"
|
|
17
|
+
show-size-changer
|
|
18
|
+
show-quick-jumper
|
|
19
|
+
:pageSize="pageSize"
|
|
20
|
+
:pageSizeOptions="pageSizeOptions"
|
|
21
|
+
@change="onChangePagination"
|
|
22
|
+
:total="total">
|
|
23
|
+
</a-pagination>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script>
|
|
29
|
+
import Actions from './action.vue'
|
|
30
|
+
export default {
|
|
31
|
+
name: 'ele-table',
|
|
32
|
+
components: {
|
|
33
|
+
Actions
|
|
34
|
+
},
|
|
35
|
+
props: {
|
|
36
|
+
actions: {
|
|
37
|
+
type: Array,
|
|
38
|
+
default: () => []
|
|
39
|
+
},
|
|
40
|
+
total: {
|
|
41
|
+
type: Number,
|
|
42
|
+
default: 0
|
|
43
|
+
},
|
|
44
|
+
loading: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: false
|
|
47
|
+
},
|
|
48
|
+
columns: {
|
|
49
|
+
type: Array,
|
|
50
|
+
default: () => []
|
|
51
|
+
},
|
|
52
|
+
dataSource: {
|
|
53
|
+
type: Array,
|
|
54
|
+
default: () => []
|
|
55
|
+
},
|
|
56
|
+
pageSize: {
|
|
57
|
+
type: Number,
|
|
58
|
+
default: 10
|
|
59
|
+
},
|
|
60
|
+
pageSizeOptions: {
|
|
61
|
+
type: Array,
|
|
62
|
+
default: () => ['10', '20', '30', '40']
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
methods: {
|
|
66
|
+
setRowClassName (record, idx) {
|
|
67
|
+
return idx % 2 === 0 ? 'g-table__row--even' : 'g-table__row--odd'
|
|
68
|
+
},
|
|
69
|
+
onChangePagination (page, pagrSize) {
|
|
70
|
+
this.$emit('change-page', page, pagrSize)
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
</script>
|
|
75
|
+
|
|
76
|
+
<style lang="scss" scoped>
|
|
77
|
+
.g-table__wrapper {
|
|
78
|
+
padding: 16px;
|
|
79
|
+
padding-top: unset;
|
|
80
|
+
.g-table__row--even {}
|
|
81
|
+
.g-table__row--odd {}
|
|
82
|
+
.g-table__pagination {
|
|
83
|
+
margin-top: 8px;
|
|
84
|
+
display: flex;
|
|
85
|
+
flex-direction: row;
|
|
86
|
+
justify-content: end;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
</style>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
v-if="modelName"
|
|
4
|
+
:is="modelName"
|
|
5
|
+
:ref="genModelRef"
|
|
6
|
+
v-bind="$attrs"
|
|
7
|
+
v-on="$listeners">
|
|
8
|
+
<template v-for="(idx, name) in $scopedSlots" v-slot:[name]="data">
|
|
9
|
+
<slot :name="name" v-bind="data"></slot>
|
|
10
|
+
</template>
|
|
11
|
+
</component>
|
|
12
|
+
<div v-else>未正确配置模版</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script>
|
|
16
|
+
import EleTreeTableModel from '../../tree-table-model/src/index.vue'
|
|
17
|
+
import { v4 as uuidv4 } from 'uuid'
|
|
18
|
+
export default {
|
|
19
|
+
name: 'ele-tpl',
|
|
20
|
+
props: {
|
|
21
|
+
modelName: {
|
|
22
|
+
type: String
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
components: {
|
|
26
|
+
[EleTreeTableModel.name]: EleTreeTableModel
|
|
27
|
+
},
|
|
28
|
+
computed: {
|
|
29
|
+
genModelRef () {
|
|
30
|
+
return uuidv4()
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
methods: {
|
|
34
|
+
getModel () {
|
|
35
|
+
return this.$refs[this.genModelRef]
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
</script>
|