@idooel/components 0.0.1 → 0.0.2-beta.10
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 +13639 -1388
- package/dist/@idooel/components.umd.js +13682 -1397
- package/jsconfig.json +8 -0
- package/package.json +58 -44
- 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/src/index.vue +43 -2
- package/packages/checkbox/index.js +5 -0
- package/packages/checkbox/src/index.vue +53 -0
- package/packages/composite-components/button-group/src/index.vue +119 -14
- 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 +132 -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/src/index.vue +145 -36
- 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/src/index.vue +87 -14
- 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 +320 -0
- package/packages/icon/index.js +5 -0
- package/packages/icon/src/index.vue +32 -0
- package/packages/index.js +109 -6
- package/packages/input/src/index.vue +13 -1
- 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 +237 -0
- package/packages/models/step-model/index.js +5 -0
- package/packages/models/step-model/src/index.vue +224 -0
- 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/src/index.vue +73 -2
- package/packages/select-entity/index.js +5 -0
- package/packages/select-entity/src/index.vue +120 -0
- package/packages/table/src/action.vue +81 -12
- package/packages/table/src/index.vue +244 -13
- 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 +44 -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/src/index.vue +12 -3
- package/packages/tree/src/index.vue +32 -27
- 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 +997 -0
- package/packages/utils/index.js +63 -0
- package/scripts/rollup.config.js +18 -11
- package/scripts/rollup.umd.config.js +3 -1
- package/vitest.config.js +17 -0
- 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
- /package/packages/{tree-table-model → models/tree-table-model}/index.js +0 -0
|
@@ -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,45 +1,52 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="search-area__wrapper">
|
|
3
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
|
-
|
|
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" :init="item.init" :mode="item.mode" :code="item.code" :params="item.params" :url="item.url" :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>
|
|
24
37
|
</a-row>
|
|
25
38
|
</div>
|
|
26
39
|
</template>
|
|
27
40
|
|
|
28
41
|
<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
42
|
import Label from './label.vue'
|
|
34
43
|
import moment from 'moment'
|
|
44
|
+
import { parse } from '@idooel/expression'
|
|
45
|
+
import { type } from '@idooel/shared'
|
|
35
46
|
export default {
|
|
36
47
|
name: 'ele-search-area',
|
|
37
48
|
components: {
|
|
38
|
-
|
|
39
|
-
EleSelect,
|
|
40
|
-
ELeButton,
|
|
41
|
-
Label,
|
|
42
|
-
EleDate
|
|
49
|
+
Label
|
|
43
50
|
},
|
|
44
51
|
props: {
|
|
45
52
|
gutter: {
|
|
@@ -57,19 +64,79 @@ export default {
|
|
|
57
64
|
required: true
|
|
58
65
|
}
|
|
59
66
|
},
|
|
67
|
+
data() {
|
|
68
|
+
return {
|
|
69
|
+
isExpand: false
|
|
70
|
+
}
|
|
71
|
+
},
|
|
60
72
|
computed: {
|
|
61
|
-
|
|
62
|
-
return (
|
|
73
|
+
cuttingFormula () {
|
|
74
|
+
return (24 / this.span - 1)
|
|
75
|
+
},
|
|
76
|
+
buildDataSource () {
|
|
77
|
+
return this.controlDisplayByFormula(this.mapDefaultValueToValue())
|
|
63
78
|
},
|
|
64
79
|
innerDataSource () {
|
|
65
|
-
return [...this.
|
|
80
|
+
return [ ...this.buildDataSource, { type: '_action', _show: true }]
|
|
66
81
|
}
|
|
67
82
|
},
|
|
83
|
+
created() {
|
|
84
|
+
const querys = this.extractValues()
|
|
85
|
+
this.$emit('search', querys)
|
|
86
|
+
},
|
|
68
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
|
+
},
|
|
69
128
|
handleClickSearch () {
|
|
70
129
|
const querys = this.extractValues()
|
|
71
130
|
this.$emit('search', querys)
|
|
72
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
|
+
},
|
|
73
140
|
extractValues () {
|
|
74
141
|
let ret = {}
|
|
75
142
|
this.innerDataSource.filter(item => item.type !== '_action').forEach(item => {
|
|
@@ -77,6 +144,13 @@ export default {
|
|
|
77
144
|
case 'DatePicker':
|
|
78
145
|
ret[item.name] = typeof item._value == 'undefined' ? undefined : moment(item._value).format(item.format)
|
|
79
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
|
|
80
154
|
default:
|
|
81
155
|
ret[item.name] = item._value
|
|
82
156
|
break
|
|
@@ -84,20 +158,31 @@ export default {
|
|
|
84
158
|
})
|
|
85
159
|
return ret
|
|
86
160
|
},
|
|
87
|
-
|
|
161
|
+
cleanValues () {
|
|
88
162
|
this.innerDataSource.filter(item => item.type !== '_action').forEach(item => {
|
|
163
|
+
const { defaultValue } = item
|
|
89
164
|
switch (item.type) {
|
|
90
165
|
case 'Select':
|
|
91
|
-
this.$set(item, '_value',
|
|
166
|
+
defaultValue && this.$set(item, '_value', this.buildDefaultValue(defaultValue))
|
|
167
|
+
!defaultValue && this.$set(item, '_value', null)
|
|
92
168
|
break
|
|
93
169
|
case 'DatePicker':
|
|
94
|
-
this.$set(item, '_value',
|
|
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', [])
|
|
95
176
|
break
|
|
96
177
|
default:
|
|
97
|
-
this.$set(item, '_value',
|
|
178
|
+
defaultValue && this.$set(item, '_value', this.buildDefaultValue(defaultValue))
|
|
179
|
+
!defaultValue && this.$set(item, '_value', null)
|
|
98
180
|
break
|
|
99
181
|
}
|
|
100
182
|
})
|
|
183
|
+
},
|
|
184
|
+
handleClickReset () {
|
|
185
|
+
this.cleanValues()
|
|
101
186
|
//TODO defaultValue
|
|
102
187
|
const querys = this.extractValues()
|
|
103
188
|
this.$emit('search', querys)
|
|
@@ -105,6 +190,9 @@ export default {
|
|
|
105
190
|
onChangeSelect (value, props) {
|
|
106
191
|
this.$set(props, '_value', value)
|
|
107
192
|
}
|
|
193
|
+
},
|
|
194
|
+
destroyed () {
|
|
195
|
+
this.cleanValues()
|
|
108
196
|
}
|
|
109
197
|
}
|
|
110
198
|
</script>
|
|
@@ -124,6 +212,27 @@ export default {
|
|
|
124
212
|
display: flex;
|
|
125
213
|
flex-direction: row;
|
|
126
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
|
+
}
|
|
127
236
|
}
|
|
128
237
|
}
|
|
129
238
|
</style>
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<section class="select__entity--modal-table">
|
|
3
|
+
<ele-select-entity :multiple="multiple" :maxCount="maxCount" :value="entityValue" @close="onClosSelectEntity" @evoke="evokeSelectEntity"></ele-select-entity>
|
|
4
|
+
<ele-modal-table
|
|
5
|
+
@handleEntitySave="handleEntitySave"
|
|
6
|
+
@handleEntityCancel="handleEntityCancel"
|
|
7
|
+
:meta="buildMeta"
|
|
8
|
+
v-model="showModalTableValue">
|
|
9
|
+
</ele-modal-table>
|
|
10
|
+
</section>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
import { type } from '@idooel/shared'
|
|
15
|
+
export default {
|
|
16
|
+
name: 'ele-select-entity-modal-table',
|
|
17
|
+
model: {
|
|
18
|
+
prop: 'value',
|
|
19
|
+
event: 'change'
|
|
20
|
+
},
|
|
21
|
+
props: {
|
|
22
|
+
value: {
|
|
23
|
+
type: [Array, Object],
|
|
24
|
+
default: () => []
|
|
25
|
+
},
|
|
26
|
+
title: {
|
|
27
|
+
type: String
|
|
28
|
+
},
|
|
29
|
+
maxCount: {
|
|
30
|
+
type: Number
|
|
31
|
+
},
|
|
32
|
+
tableMeta: {
|
|
33
|
+
type: Object,
|
|
34
|
+
default: () => ({})
|
|
35
|
+
},
|
|
36
|
+
returnValues: {
|
|
37
|
+
type: [String, Object],
|
|
38
|
+
default: () => ({})
|
|
39
|
+
},
|
|
40
|
+
replaceFields: {
|
|
41
|
+
type: Object
|
|
42
|
+
},
|
|
43
|
+
multiple: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: true
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
data() {
|
|
49
|
+
return {
|
|
50
|
+
showModalTableValue: false,
|
|
51
|
+
entityValue: [],
|
|
52
|
+
emitValue: void 0
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
watch: {
|
|
56
|
+
value: {
|
|
57
|
+
handler(innerValue) {
|
|
58
|
+
const _innerValue = type.isArray(innerValue) ? innerValue : [innerValue]
|
|
59
|
+
const { label, value } = this.replaceFields
|
|
60
|
+
this.entityValue = _innerValue.map(item => {
|
|
61
|
+
return {
|
|
62
|
+
label: item[label],
|
|
63
|
+
value: item[value]
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
},
|
|
67
|
+
immediate: true
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
computed: {
|
|
71
|
+
buildMeta () {
|
|
72
|
+
const { tableMeta } = this.tableMeta
|
|
73
|
+
Object.assign(tableMeta, { multiple: this.multiple })
|
|
74
|
+
return {
|
|
75
|
+
...this.tableMeta,
|
|
76
|
+
footerMeta: {
|
|
77
|
+
elements: (ctx) => [
|
|
78
|
+
{
|
|
79
|
+
label: '确定',
|
|
80
|
+
type: 'primary',
|
|
81
|
+
key: 'save',
|
|
82
|
+
eventName: 'handleEntitySave'
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
label: '返回',
|
|
86
|
+
key: 'cancel',
|
|
87
|
+
eventName: 'handleEntityCancel'
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
created () {
|
|
95
|
+
this.emitValue = this.multiple ? [] : void 0
|
|
96
|
+
},
|
|
97
|
+
methods: {
|
|
98
|
+
handleEntityCancel () {
|
|
99
|
+
this.showModalTableValue = false
|
|
100
|
+
},
|
|
101
|
+
buildEntityValueForEmitObjectReturnValues (dataSource = []) {
|
|
102
|
+
const keys = Object.keys(this.returnValues)
|
|
103
|
+
const ret = dataSource.map(props => {
|
|
104
|
+
const ret = {}
|
|
105
|
+
keys.forEach(key => {
|
|
106
|
+
ret[key] = props[this.returnValues[key]]
|
|
107
|
+
})
|
|
108
|
+
return ret
|
|
109
|
+
})
|
|
110
|
+
return this.multiple ? ret : ret[0]
|
|
111
|
+
},
|
|
112
|
+
emitEntityValue (dataSource = []) {
|
|
113
|
+
this.emitValue = this.value
|
|
114
|
+
if (this.multiple) {
|
|
115
|
+
if (type.isStr(this.returnValues)) {
|
|
116
|
+
const ret = dataSource.map(props => {
|
|
117
|
+
return props[this.returnValues]
|
|
118
|
+
})
|
|
119
|
+
this.emitValue.push(...ret)
|
|
120
|
+
} else if (type.isObject(this.returnValues)) {
|
|
121
|
+
this.emitValue.push(...this.buildEntityValueForEmitObjectReturnValues(dataSource))
|
|
122
|
+
}
|
|
123
|
+
} else {
|
|
124
|
+
if (type.isStr(this.returnValues)) {
|
|
125
|
+
this.emitValue = dataSource ? dataSource[this.returnValues] : ''
|
|
126
|
+
} else if (type.isObject(this.returnValues)) {
|
|
127
|
+
this.emitValue = dataSource ? this.buildEntityValueForEmitObjectReturnValues([dataSource]) : ''
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
this.$emit('change', this.emitValue)
|
|
131
|
+
},
|
|
132
|
+
onClosSelectEntity (props) {
|
|
133
|
+
this.entityValue = this.entityValue.filter(item => item.value !== props.value)
|
|
134
|
+
if (this.multiple) {
|
|
135
|
+
if (type.isStr(this.returnValues)) {
|
|
136
|
+
this.emitValue = this.emitValue.filter(item => item !== props.value)
|
|
137
|
+
} else if (type.isObject(this.returnValues)) {
|
|
138
|
+
const reverseReturnValues = Object.fromEntries(Object.entries(this.returnValues).map(([key, value]) => [value, key]))
|
|
139
|
+
const primaryKey = reverseReturnValues[this.replaceFields.value]
|
|
140
|
+
this.emitValue = this.emitValue.filter(item => item[primaryKey] !== props.value)
|
|
141
|
+
}
|
|
142
|
+
} else {
|
|
143
|
+
if (type.isStr(this.returnValues)) {
|
|
144
|
+
this.emitValue = ''
|
|
145
|
+
} else if (type.isObject(this.returnValues)) {
|
|
146
|
+
this.emitValue = {}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
this.$emit('change', this.emitValue)
|
|
150
|
+
},
|
|
151
|
+
handleEntitySave (props) {
|
|
152
|
+
const { exposed = {} } = props
|
|
153
|
+
const { currentTableSelection } = exposed
|
|
154
|
+
const currentTableSelectionRet = type.isArray(currentTableSelection) ? currentTableSelection : [currentTableSelection]
|
|
155
|
+
this.entityValue = currentTableSelectionRet.map(item => {
|
|
156
|
+
return {
|
|
157
|
+
label: item[this.replaceFields.label],
|
|
158
|
+
value: item[this.replaceFields.value]
|
|
159
|
+
}
|
|
160
|
+
})
|
|
161
|
+
this.emitEntityValue(currentTableSelection)
|
|
162
|
+
this.showModalTableValue = false
|
|
163
|
+
},
|
|
164
|
+
showModalTable () {
|
|
165
|
+
this.showModalTableValue = true
|
|
166
|
+
},
|
|
167
|
+
evokeSelectEntity () {
|
|
168
|
+
this.showModalTable()
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
</script>
|
|
File without changes
|
|
@@ -1,25 +1,76 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
<div class="ele-date__wrapper">
|
|
3
|
+
<a-date-picker
|
|
4
|
+
style="width: 100%;"
|
|
5
|
+
:mode="modeValue"
|
|
6
|
+
v-if="modeValue == 'year'"
|
|
7
|
+
:open="open"
|
|
8
|
+
:disabled="disabled"
|
|
9
|
+
:value="value"
|
|
10
|
+
:placeholder="placeholder"
|
|
11
|
+
:show-time="showTime"
|
|
12
|
+
:show-today="showToday"
|
|
13
|
+
:valueFormat="innerValueFormat"
|
|
14
|
+
@panelChange="onPanelChange"
|
|
15
|
+
@openChange="openChange"
|
|
16
|
+
@change="onChange"
|
|
17
|
+
:format="format">
|
|
18
|
+
</a-date-picker>
|
|
19
|
+
<a-date-picker
|
|
20
|
+
v-else
|
|
21
|
+
style="width: 100%;"
|
|
22
|
+
:placeholder="placeholder"
|
|
23
|
+
:open="open"
|
|
24
|
+
:disabled="disabled"
|
|
25
|
+
:value="value"
|
|
26
|
+
:show-time="showTime"
|
|
27
|
+
:show-today="showToday"
|
|
28
|
+
:valueFormat="innerValueFormat"
|
|
29
|
+
@panelChange="onPanelChange"
|
|
30
|
+
@openChange="openChange"
|
|
31
|
+
@change="onChange"
|
|
32
|
+
:format="format">
|
|
33
|
+
</a-date-picker>
|
|
34
|
+
</div>
|
|
11
35
|
</template>
|
|
12
36
|
|
|
13
37
|
<script>
|
|
38
|
+
import moment from 'moment'
|
|
14
39
|
export default {
|
|
15
40
|
name: 'ele-date',
|
|
41
|
+
model: {
|
|
42
|
+
prop: 'value',
|
|
43
|
+
event: 'change'
|
|
44
|
+
},
|
|
16
45
|
props: {
|
|
17
46
|
value: {
|
|
18
|
-
type: Object
|
|
47
|
+
type: [String, Object]
|
|
48
|
+
},
|
|
49
|
+
disabled: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: false
|
|
19
52
|
},
|
|
20
53
|
format: {
|
|
21
54
|
type: String,
|
|
22
55
|
default: 'YYYY/MM/DD'
|
|
56
|
+
},
|
|
57
|
+
mode: {
|
|
58
|
+
type: String
|
|
59
|
+
},
|
|
60
|
+
valueFormat: {
|
|
61
|
+
type: String
|
|
62
|
+
},
|
|
63
|
+
showTime: {
|
|
64
|
+
type: [Boolean, Object],
|
|
65
|
+
default: true
|
|
66
|
+
},
|
|
67
|
+
showToday: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: true
|
|
70
|
+
},
|
|
71
|
+
placeholder: {
|
|
72
|
+
type: String,
|
|
73
|
+
default: '请选择日期'
|
|
23
74
|
}
|
|
24
75
|
},
|
|
25
76
|
data () {
|
|
@@ -27,14 +78,36 @@ export default {
|
|
|
27
78
|
open: false
|
|
28
79
|
}
|
|
29
80
|
},
|
|
81
|
+
computed: {
|
|
82
|
+
innerValueFormat () {
|
|
83
|
+
if (this.valueFormat) return this.valueFormat
|
|
84
|
+
return this.format
|
|
85
|
+
},
|
|
86
|
+
modeValue () {
|
|
87
|
+
if (this.mode) return this.mode
|
|
88
|
+
if (this.format === 'YYYY') return 'year'
|
|
89
|
+
return 'date'
|
|
90
|
+
}
|
|
91
|
+
},
|
|
30
92
|
methods: {
|
|
31
|
-
|
|
32
|
-
this
|
|
93
|
+
onChange (_, dataString) {
|
|
94
|
+
this.$emit('input', dataString)
|
|
95
|
+
this.$emit('change', dataString)
|
|
33
96
|
},
|
|
34
97
|
onPanelChange (value, mode) {
|
|
35
|
-
this
|
|
98
|
+
if (this.modeValue !== 'year') return
|
|
99
|
+
this.$emit('input', moment(value).format(this.format))
|
|
100
|
+
this.$emit('change', moment(value).format(this.format))
|
|
36
101
|
this.open = false
|
|
102
|
+
},
|
|
103
|
+
openChange (open) {
|
|
104
|
+
this.open = open
|
|
37
105
|
}
|
|
38
106
|
}
|
|
39
107
|
}
|
|
40
|
-
</script>
|
|
108
|
+
</script>
|
|
109
|
+
<style lang="scss" scoped>
|
|
110
|
+
.ele-date__wrapper {
|
|
111
|
+
width: 100%;
|
|
112
|
+
}
|
|
113
|
+
</style>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<a-range-picker
|
|
3
|
+
style="width: 100%;"
|
|
4
|
+
:disabled="disabled"
|
|
5
|
+
:show-time="showTime"
|
|
6
|
+
:value="value"
|
|
7
|
+
:format="format"
|
|
8
|
+
@change="onChange">
|
|
9
|
+
</a-range-picker>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
export default {
|
|
14
|
+
name: 'ele-date-range',
|
|
15
|
+
model: {
|
|
16
|
+
prop: 'value',
|
|
17
|
+
event: 'change'
|
|
18
|
+
},
|
|
19
|
+
props: {
|
|
20
|
+
disabled: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: false
|
|
23
|
+
},
|
|
24
|
+
showTime: {
|
|
25
|
+
type: Object
|
|
26
|
+
},
|
|
27
|
+
format: {
|
|
28
|
+
type: Array,
|
|
29
|
+
default: () => ['YYYY-MM-DD', 'YYYY-MM-DD']
|
|
30
|
+
},
|
|
31
|
+
value: {
|
|
32
|
+
type: Array,
|
|
33
|
+
default: () => []
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
methods: {
|
|
37
|
+
onChange (date, dateString) {
|
|
38
|
+
this.$emit('change', dateString)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<style lang="scss" scoped>
|
|
45
|
+
|
|
46
|
+
</style>
|
|
47
|
+
import { models } from '../..';
|