@idooel/components 0.0.1 → 0.0.2
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/README.md +99 -0
- package/dist/@idooel/components.esm.js +13956 -1882
- package/dist/@idooel/components.umd.js +14000 -1891
- package/jsconfig.json +8 -0
- package/package.json +12 -6
- package/packages/alert/index.js +5 -0
- package/packages/alert/src/index.vue +46 -0
- package/packages/batch-export/index.js +5 -0
- package/packages/batch-export/src/index.vue +105 -0
- package/packages/business-components/modal-fsm/index.js +5 -0
- package/packages/business-components/modal-fsm/src/index.vue +164 -0
- package/packages/business-components/modal-import/index.js +5 -0
- package/packages/business-components/modal-import/src/index.vue +140 -0
- package/packages/business-components/modal-timeline/index.js +5 -0
- package/packages/business-components/modal-timeline/src/index.vue +78 -0
- package/packages/business-components/tabs-sub-center/index.js +5 -0
- package/packages/business-components/tabs-sub-center/src/index.vue +117 -0
- package/packages/button/index.js +4 -4
- package/packages/button/src/index.vue +65 -24
- package/packages/checkbox/index.js +5 -0
- package/packages/checkbox/src/index.vue +53 -0
- package/packages/composite-components/button-group/index.js +4 -4
- package/packages/composite-components/button-group/src/index.vue +151 -46
- package/packages/composite-components/form-attachment/src/index.vue +15 -0
- package/packages/composite-components/form-img-crop/index.js +5 -0
- package/packages/composite-components/form-img-crop/src/index.vue +121 -0
- package/packages/composite-components/modal-confirm/index.js +5 -0
- package/packages/composite-components/modal-confirm/src/index.vue +104 -0
- package/packages/composite-components/modal-form/index.js +5 -0
- package/packages/composite-components/modal-form/src/index.vue +231 -0
- package/packages/composite-components/modal-img-crop/index.js +5 -0
- package/packages/composite-components/modal-img-crop/src/index.vue +299 -0
- package/packages/composite-components/modal-table/index.js +5 -0
- package/packages/composite-components/modal-table/src/index.vue +156 -0
- package/packages/composite-components/modal-table-transfer/index.js +0 -0
- package/packages/composite-components/modal-tree/index.js +5 -0
- package/packages/composite-components/modal-tree/src/index.vue +76 -0
- package/packages/composite-components/search-area/index.js +4 -4
- package/packages/composite-components/search-area/src/index.vue +237 -128
- package/packages/composite-components/search-area/src/label.vue +35 -35
- package/packages/composite-components/select-entity-modal-table/index.js +5 -0
- package/packages/composite-components/select-entity-modal-table/src/index.vue +172 -0
- package/packages/composite-components/table-transfer/index.js +0 -0
- package/packages/date/index.js +4 -4
- package/packages/date/src/index.vue +113 -40
- package/packages/date-range/index.js +5 -0
- package/packages/date-range/src/index.vue +47 -0
- package/packages/form/index.js +5 -0
- package/packages/form/src/index.vue +319 -0
- package/packages/icon/index.js +5 -0
- package/packages/icon/src/index.vue +32 -0
- package/packages/index.js +153 -50
- package/packages/input/index.js +4 -4
- package/packages/input/src/index.vue +35 -23
- package/packages/input-number/index.js +5 -0
- package/packages/input-number/src/index.vue +24 -0
- package/packages/loading/index.js +5 -0
- package/packages/loading/src/index.vue +37 -0
- package/packages/modal/index.js +5 -0
- package/packages/modal/src/index.vue +185 -0
- package/packages/models/form-group-model/index.js +5 -0
- package/packages/models/form-group-model/src/index.vue +274 -0
- package/packages/models/form-model/index.js +5 -0
- package/packages/models/form-model/src/index.vue +233 -0
- package/packages/models/step-model/index.js +5 -0
- package/packages/models/step-model/src/index.vue +224 -0
- package/packages/{tree-table-model → models/tree-table-model}/index.js +4 -4
- package/packages/models/tree-table-model/src/index.vue +689 -0
- package/packages/radio/index.js +5 -0
- package/packages/radio/src/index.vue +57 -0
- package/packages/select/index.js +4 -4
- package/packages/select/src/index.vue +105 -34
- package/packages/select-entity/index.js +5 -0
- package/packages/select-entity/src/index.vue +120 -0
- package/packages/table/index.js +4 -4
- package/packages/table/src/action.vue +172 -103
- package/packages/table/src/index.vue +289 -88
- package/packages/tabs/index.js +5 -0
- package/packages/tabs/src/index.vue +56 -0
- package/packages/text/index.js +5 -0
- package/packages/text/src/index.vue +48 -0
- package/packages/text-editor/index.js +5 -0
- package/packages/text-editor/src/index.vue +73 -0
- package/packages/textarea/index.js +5 -0
- package/packages/textarea/src/index.vue +58 -0
- package/packages/theme/form.scss +22 -0
- package/packages/theme/index.scss +43 -0
- package/packages/theme/overrid.scss +8 -0
- package/packages/theme/styleClass.scss +3 -0
- package/packages/theme/variables.scss +56 -0
- package/packages/timeline/index.js +5 -0
- package/packages/timeline/src/index.vue +258 -0
- package/packages/tpl/index.js +4 -4
- package/packages/tpl/src/index.vue +56 -47
- package/packages/tree/index.js +4 -4
- package/packages/tree/src/TreeNode.vue +29 -29
- package/packages/tree/src/index.vue +101 -96
- package/packages/tree-select/index.js +5 -0
- package/packages/tree-select/src/index.vue +143 -0
- package/packages/upload/index.js +5 -0
- package/packages/upload/src/index.vue +445 -0
- package/packages/utils/index.js +63 -0
- package/scripts/rollup.config.js +42 -35
- package/scripts/rollup.esm.config.js +11 -11
- package/scripts/rollup.umd.config.js +14 -14
- package/packages/tree-table-model/src/index.vue +0 -290
- /package/packages/{tree-table-model/README.md → composite-components/form-attachment/index.js} +0 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ele-modal
|
|
3
|
+
:title="buildTitle"
|
|
4
|
+
v-on="assignAttrForEvents"
|
|
5
|
+
:button-group-meta="buildButtonGroupMeta"
|
|
6
|
+
:value="value"
|
|
7
|
+
:size="size">
|
|
8
|
+
<ele-tree-table-model
|
|
9
|
+
:over-height="156"
|
|
10
|
+
v-on="treeTableListeners"
|
|
11
|
+
@on-change-table-selection="onChangeTableSelection"
|
|
12
|
+
@x:refresh-exposed="onAbstractEvent"
|
|
13
|
+
v-bind="buildMeta">
|
|
14
|
+
<template v-if="$slots['sub-center']" #sub-center>
|
|
15
|
+
<slot name="sub-center"></slot>
|
|
16
|
+
</template>
|
|
17
|
+
</ele-tree-table-model>
|
|
18
|
+
</ele-modal>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
import { type } from '@idooel/shared'
|
|
23
|
+
import { CONTEXT } from '../../../utils'
|
|
24
|
+
export default {
|
|
25
|
+
name: 'ele-modal-table',
|
|
26
|
+
model: {
|
|
27
|
+
event: 'change',
|
|
28
|
+
prop: 'value'
|
|
29
|
+
},
|
|
30
|
+
props: {
|
|
31
|
+
value: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: false
|
|
34
|
+
},
|
|
35
|
+
title: {
|
|
36
|
+
type: String
|
|
37
|
+
},
|
|
38
|
+
size: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: 'big'
|
|
41
|
+
},
|
|
42
|
+
meta: {
|
|
43
|
+
type: Object,
|
|
44
|
+
default: () => ({})
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
data() {
|
|
48
|
+
return {
|
|
49
|
+
currentTableSelection: null,
|
|
50
|
+
currentExposed: {}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
inject: {
|
|
54
|
+
[CONTEXT]: {
|
|
55
|
+
default: () => (() => ({}))
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
computed: {
|
|
59
|
+
buildMeta () {
|
|
60
|
+
const { title, ...rest } = this.meta
|
|
61
|
+
return rest
|
|
62
|
+
},
|
|
63
|
+
buildTitle () {
|
|
64
|
+
return this.title || this.meta.title
|
|
65
|
+
},
|
|
66
|
+
callContext () {
|
|
67
|
+
return this[CONTEXT].call(this)
|
|
68
|
+
},
|
|
69
|
+
exposed () {
|
|
70
|
+
const mergeExposed = Object.assign({}, this.callContext.exposed, this.currentExposed)
|
|
71
|
+
return {
|
|
72
|
+
closeModal: this.closeModal,
|
|
73
|
+
currentTableSelection: this.currentTableSelection,
|
|
74
|
+
...this.callContext,
|
|
75
|
+
exposed: {
|
|
76
|
+
...mergeExposed,
|
|
77
|
+
setModalTable: this.setModalTable,
|
|
78
|
+
showModalTable: this.showModalTable,
|
|
79
|
+
closeModalTable: this.closeModalTable
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
assignAttrForEvents () {
|
|
84
|
+
const events = this.footerMetaElements.reduce((ret, ele) => {
|
|
85
|
+
ret[ele.eventName] = (e) => {
|
|
86
|
+
this.$emit(ele.eventName || 'click', { ...e, ...this.exposed })
|
|
87
|
+
}
|
|
88
|
+
return ret
|
|
89
|
+
}, {})
|
|
90
|
+
return {
|
|
91
|
+
...this.$listeners,
|
|
92
|
+
...events
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
treeTableListeners () {
|
|
96
|
+
const events = this.treeTableButtonGroupElements.reduce((ret, ele) => {
|
|
97
|
+
ret[ele.eventName] = (e) => {
|
|
98
|
+
this.$emit(ele.eventName || 'click', { ...e, exposed: this.exposed })
|
|
99
|
+
}
|
|
100
|
+
return ret
|
|
101
|
+
}, {})
|
|
102
|
+
return {
|
|
103
|
+
...this.$listeners,
|
|
104
|
+
...events
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
footerMetaElements () {
|
|
108
|
+
const { elements = [] } = this.buttonGroupMeta
|
|
109
|
+
if (type.isFunction(elements)) {
|
|
110
|
+
return elements.call(this)
|
|
111
|
+
}
|
|
112
|
+
return elements
|
|
113
|
+
},
|
|
114
|
+
treeTableButtonGroupElements () {
|
|
115
|
+
const { buttonGroupMeta = {} } = this.meta
|
|
116
|
+
const { elements = [] } = buttonGroupMeta
|
|
117
|
+
if (type.isFunction(elements)) {
|
|
118
|
+
return elements.call(this)
|
|
119
|
+
}
|
|
120
|
+
return elements
|
|
121
|
+
},
|
|
122
|
+
buildButtonGroupMeta () {
|
|
123
|
+
return { ...this.buttonGroupMeta, elements: this.footerMetaElements }
|
|
124
|
+
},
|
|
125
|
+
buttonGroupMeta () {
|
|
126
|
+
const { footerMeta = {} } = this.meta
|
|
127
|
+
return footerMeta
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
methods: {
|
|
131
|
+
closeModal () {
|
|
132
|
+
this.$emit('change', false)
|
|
133
|
+
},
|
|
134
|
+
setModalTable (arg = false) {
|
|
135
|
+
this.$emit('change', arg)
|
|
136
|
+
},
|
|
137
|
+
showModalTable () {
|
|
138
|
+
this.$emit('change', true)
|
|
139
|
+
},
|
|
140
|
+
closeModalTable () {
|
|
141
|
+
this.$emit('change', false)
|
|
142
|
+
},
|
|
143
|
+
onChangeTableSelection (selection) {
|
|
144
|
+
this.currentTableSelection = selection
|
|
145
|
+
},
|
|
146
|
+
onAbstractEvent (props = {}) {
|
|
147
|
+
const { exposed } = props
|
|
148
|
+
this.currentExposed = Object.assign({}, exposed)
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
</script>
|
|
153
|
+
|
|
154
|
+
<style lang="scss" scoped>
|
|
155
|
+
|
|
156
|
+
</style>
|
|
File without changes
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ele-modal :title="title" :value="value" :size="size" :buttonGroupMeta="buttonGroupMeta">
|
|
3
|
+
<ele-tree
|
|
4
|
+
:checkable="checkable"
|
|
5
|
+
:tree-data="treeData">
|
|
6
|
+
</ele-tree>
|
|
7
|
+
</ele-modal>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script>
|
|
11
|
+
export default {
|
|
12
|
+
name: 'ele-modal-tree',
|
|
13
|
+
model: {
|
|
14
|
+
event: 'input',
|
|
15
|
+
prop: 'value'
|
|
16
|
+
},
|
|
17
|
+
props: {
|
|
18
|
+
title: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: '树形选择'
|
|
21
|
+
},
|
|
22
|
+
size: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: 'small'
|
|
25
|
+
},
|
|
26
|
+
checkable: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: true
|
|
29
|
+
},
|
|
30
|
+
value: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: false
|
|
33
|
+
},
|
|
34
|
+
buttonGroupMeta: {
|
|
35
|
+
type: Object
|
|
36
|
+
},
|
|
37
|
+
contextProp: {
|
|
38
|
+
type: Object,
|
|
39
|
+
default: () => ({})
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
data () {
|
|
43
|
+
return {
|
|
44
|
+
treeData: [
|
|
45
|
+
{
|
|
46
|
+
title: 'parent 1',
|
|
47
|
+
key: 1,
|
|
48
|
+
scopedSlots: {
|
|
49
|
+
icon: 'custom',
|
|
50
|
+
iconName: 'smile-o'
|
|
51
|
+
},
|
|
52
|
+
children: [
|
|
53
|
+
{
|
|
54
|
+
title: '2',
|
|
55
|
+
key: 2,
|
|
56
|
+
scopedSlots: {
|
|
57
|
+
icon: 'custom',
|
|
58
|
+
iconName: 'frown-o'
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
title: '3',
|
|
63
|
+
key: 3,
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
methods: {}
|
|
71
|
+
}
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<style lang="scss" scoped>
|
|
75
|
+
|
|
76
|
+
</style>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import EleSearchArea from './src/index.vue'
|
|
2
|
-
|
|
3
|
-
EleSearchArea.install = Vue => Vue.component(EleSearchArea.name, EleSearchArea)
|
|
4
|
-
|
|
1
|
+
import EleSearchArea from './src/index.vue'
|
|
2
|
+
|
|
3
|
+
EleSearchArea.install = Vue => Vue.component(EleSearchArea.name, EleSearchArea)
|
|
4
|
+
|
|
5
5
|
export default EleSearchArea
|
|
@@ -1,129 +1,238 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="search-area__wrapper">
|
|
3
|
-
<a-row :gutter="gutter">
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<div class="search-area__wrapper">
|
|
3
|
+
<a-row :gutter="gutter">
|
|
4
|
+
<template v-for="(item, idx) in innerDataSource">
|
|
5
|
+
<a-col v-if="item._show" :span="item.span || span" :key="idx">
|
|
6
|
+
<div v-if="item.type == '_action'" class="search-area__item search-area--action">
|
|
7
|
+
<ele-button icon="search" type="primary" @click="handleClickSearch">查询</ele-button>
|
|
8
|
+
<ele-button style="margin-left:8px;" icon="reload" @click="handleClickReset">重置</ele-button>
|
|
9
|
+
<div v-if="innerDataSource.length > cuttingFormula + 1" class="expand-collapse" @click="handleClickExpandCollapse">
|
|
10
|
+
<span class="expand-collapse__text">{{ isExpand ? '收起' : '展开' }}</span>
|
|
11
|
+
<span class="expand-collapse__icon">
|
|
12
|
+
<a-icon v-if="isExpand" type="up" />
|
|
13
|
+
<a-icon v-else type="down" />
|
|
14
|
+
</span>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
<div v-else class="search-area__item">
|
|
18
|
+
<template v-if="(item.type == 'ele-input') || (item.type == 'Input')">
|
|
19
|
+
<Label :label="item.label"></Label>
|
|
20
|
+
<ele-input v-model="item._value"></ele-input>
|
|
21
|
+
</template>
|
|
22
|
+
<template v-else-if="(item.type == 'ele-select') || (item.type == 'Select')">
|
|
23
|
+
<Label :label="item.label"></Label>
|
|
24
|
+
<ele-select v-model="item._value" :multiple="item.multiple" :data-source="item.optionList"></ele-select>
|
|
25
|
+
</template>
|
|
26
|
+
<template v-else-if="(item.type == 'ele-date') || (item.type == 'DatePicker')">
|
|
27
|
+
<Label :label="item.label"></Label>
|
|
28
|
+
<ele-date v-model="item._value" :placeholder="item.placeholder" :format="item.format"></ele-date>
|
|
29
|
+
</template>
|
|
30
|
+
<template v-else-if="item.type == 'ele-date-range'">
|
|
31
|
+
<Label :label="item.label"></Label>
|
|
32
|
+
<ele-date-range v-model="item._value" :format="item.format" :show-time="item.showTime"></ele-date-range>
|
|
33
|
+
</template>
|
|
34
|
+
</div>
|
|
35
|
+
</a-col>
|
|
36
|
+
</template>
|
|
37
|
+
</a-row>
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script>
|
|
42
|
+
import Label from './label.vue'
|
|
43
|
+
import moment from 'moment'
|
|
44
|
+
import { parse } from '@idooel/expression'
|
|
45
|
+
import { type } from '@idooel/shared'
|
|
46
|
+
export default {
|
|
47
|
+
name: 'ele-search-area',
|
|
48
|
+
components: {
|
|
49
|
+
Label
|
|
50
|
+
},
|
|
51
|
+
props: {
|
|
52
|
+
gutter: {
|
|
53
|
+
type: [Number, Array, Object],
|
|
54
|
+
default: () => ([
|
|
55
|
+
16, 8
|
|
56
|
+
])
|
|
57
|
+
},
|
|
58
|
+
span: {
|
|
59
|
+
type: Number,
|
|
60
|
+
default: 8
|
|
61
|
+
},
|
|
62
|
+
dataSource: {
|
|
63
|
+
type: Array,
|
|
64
|
+
required: true
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
data() {
|
|
68
|
+
return {
|
|
69
|
+
isExpand: false
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
computed: {
|
|
73
|
+
cuttingFormula () {
|
|
74
|
+
return (24 / this.span - 1)
|
|
75
|
+
},
|
|
76
|
+
buildDataSource () {
|
|
77
|
+
return this.controlDisplayByFormula(this.mapDefaultValueToValue())
|
|
78
|
+
},
|
|
79
|
+
innerDataSource () {
|
|
80
|
+
return [ ...this.buildDataSource, { type: '_action', _show: true }]
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
created() {
|
|
84
|
+
const querys = this.extractValues()
|
|
85
|
+
this.$emit('search', querys)
|
|
86
|
+
},
|
|
87
|
+
methods: {
|
|
88
|
+
controlDisplayByFormula (dataSource = []) {
|
|
89
|
+
if (this.isExpand) {
|
|
90
|
+
dataSource.forEach(item => {
|
|
91
|
+
this.$set(item, '_show', true)
|
|
92
|
+
})
|
|
93
|
+
} else {
|
|
94
|
+
dataSource.forEach((item, idx) => {
|
|
95
|
+
if (idx < this.cuttingFormula) {
|
|
96
|
+
this.$set(item, '_show', true)
|
|
97
|
+
} else {
|
|
98
|
+
this.$set(item, '_show', false)
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
}
|
|
102
|
+
return dataSource
|
|
103
|
+
},
|
|
104
|
+
buildDefaultValue (arg) {
|
|
105
|
+
if (type.notStr(arg)) return arg
|
|
106
|
+
if (!arg || arg.charAt(0) !== '_') return arg
|
|
107
|
+
return parse(arg, {
|
|
108
|
+
_route: this.$route.query
|
|
109
|
+
})
|
|
110
|
+
},
|
|
111
|
+
mapDefaultValueToValue () {
|
|
112
|
+
this.dataSource.forEach(props => {
|
|
113
|
+
this.$set(props, '_show', this.isExpand)
|
|
114
|
+
if (props.defaultValue) {
|
|
115
|
+
if (type.isFunction(props.defaultValue)) {
|
|
116
|
+
const ret = props.defaultValue.call(this)
|
|
117
|
+
this.$set(props, '_value', this.buildDefaultValue(ret))
|
|
118
|
+
} else {
|
|
119
|
+
this.$set(props, '_value', this.buildDefaultValue(props.defaultValue))
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
return this.dataSource
|
|
124
|
+
},
|
|
125
|
+
handleClickExpandCollapse () {
|
|
126
|
+
this.isExpand = !this.isExpand
|
|
127
|
+
},
|
|
128
|
+
handleClickSearch () {
|
|
129
|
+
const querys = this.extractValues()
|
|
130
|
+
this.$emit('search', querys)
|
|
131
|
+
},
|
|
132
|
+
buildMapto (mapTo = [], dataSource) {
|
|
133
|
+
const [ startField, endField ] = mapTo
|
|
134
|
+
const [ startValue, endValue ] = dataSource || [null, null]
|
|
135
|
+
return {
|
|
136
|
+
[startField]: startValue,
|
|
137
|
+
[endField]: endValue
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
extractValues () {
|
|
141
|
+
let ret = {}
|
|
142
|
+
this.innerDataSource.filter(item => item.type !== '_action').forEach(item => {
|
|
143
|
+
switch (item.type) {
|
|
144
|
+
case 'DatePicker':
|
|
145
|
+
ret[item.name] = typeof item._value == 'undefined' ? undefined : moment(item._value).format(item.format)
|
|
146
|
+
break
|
|
147
|
+
case 'ele-date-range':
|
|
148
|
+
if (item.mapTo) {
|
|
149
|
+
Object.assign(ret, this.buildMapto(item.mapTo, item._value))
|
|
150
|
+
} else {
|
|
151
|
+
ret[item.name] = (item._value || []).join(',')
|
|
152
|
+
}
|
|
153
|
+
break
|
|
154
|
+
default:
|
|
155
|
+
ret[item.name] = item._value
|
|
156
|
+
break
|
|
157
|
+
}
|
|
158
|
+
})
|
|
159
|
+
return ret
|
|
160
|
+
},
|
|
161
|
+
cleanValues () {
|
|
162
|
+
this.innerDataSource.filter(item => item.type !== '_action').forEach(item => {
|
|
163
|
+
const { defaultValue } = item
|
|
164
|
+
switch (item.type) {
|
|
165
|
+
case 'Select':
|
|
166
|
+
defaultValue && this.$set(item, '_value', this.buildDefaultValue(defaultValue))
|
|
167
|
+
!defaultValue && this.$set(item, '_value', null)
|
|
168
|
+
break
|
|
169
|
+
case 'DatePicker':
|
|
170
|
+
defaultValue && this.$set(item, '_value', this.buildDefaultValue(defaultValue))
|
|
171
|
+
!defaultValue && this.$set(item, '_value', undefined)
|
|
172
|
+
break
|
|
173
|
+
case 'ele-date-range':
|
|
174
|
+
defaultValue && this.$set(item, '_value', this.buildDefaultValue(defaultValue))
|
|
175
|
+
!defaultValue && this.$set(item, '_value', [])
|
|
176
|
+
break
|
|
177
|
+
default:
|
|
178
|
+
defaultValue && this.$set(item, '_value', this.buildDefaultValue(defaultValue))
|
|
179
|
+
!defaultValue && this.$set(item, '_value', null)
|
|
180
|
+
break
|
|
181
|
+
}
|
|
182
|
+
})
|
|
183
|
+
},
|
|
184
|
+
handleClickReset () {
|
|
185
|
+
this.cleanValues()
|
|
186
|
+
//TODO defaultValue
|
|
187
|
+
const querys = this.extractValues()
|
|
188
|
+
this.$emit('search', querys)
|
|
189
|
+
},
|
|
190
|
+
onChangeSelect (value, props) {
|
|
191
|
+
this.$set(props, '_value', value)
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
destroyed () {
|
|
195
|
+
this.cleanValues()
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
</script>
|
|
199
|
+
|
|
200
|
+
<style lang="scss" scoped>
|
|
201
|
+
.search-area__wrapper {
|
|
202
|
+
padding-top: 16px;
|
|
203
|
+
padding-left: 16px;
|
|
204
|
+
padding-right: 16px;
|
|
205
|
+
::v-deep .ant-col {
|
|
206
|
+
&:last-child {
|
|
207
|
+
float: right;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
.search-area__item {
|
|
211
|
+
height: 32px;
|
|
212
|
+
display: flex;
|
|
213
|
+
flex-direction: row;
|
|
214
|
+
align-items: center;
|
|
215
|
+
&.search-area--action {
|
|
216
|
+
justify-content: end;
|
|
217
|
+
}
|
|
218
|
+
.expand-collapse {
|
|
219
|
+
margin-left: 8px;
|
|
220
|
+
height: 32px;
|
|
221
|
+
padding: 4px 16px;
|
|
222
|
+
color: var(--idooel-primary-color);
|
|
223
|
+
display: flex;
|
|
224
|
+
flex-direction: row;
|
|
225
|
+
align-items: center;
|
|
226
|
+
justify-content: center;
|
|
227
|
+
cursor: pointer;
|
|
228
|
+
.expand-collapse__text {
|
|
229
|
+
font-size: 14px;
|
|
230
|
+
}
|
|
231
|
+
.expand-collapse__icon {
|
|
232
|
+
font-size: 16px;
|
|
233
|
+
margin-left: 8px;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
129
238
|
</style>
|