eoss-mobiles 0.4.0 → 0.4.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/CHANGELOG.md +95 -0
- package/lib/button-group.js +2 -2
- package/lib/button.js +2 -2
- package/lib/calendar.js +2 -2
- package/lib/cell.js +2 -2
- package/lib/checkbox.js +2 -2
- package/lib/circle.js +2 -2
- package/lib/count-down.js +2 -2
- package/lib/empty.js +2 -2
- package/lib/eoss-mobile.common.js +542 -93
- package/lib/field.js +2 -2
- package/lib/flow-btn.js +2 -2
- package/lib/flow.js +8 -8
- package/lib/form.js +593 -144
- package/lib/grid-item.js +2 -2
- package/lib/grid.js +2 -2
- package/lib/index.js +1 -1
- package/lib/list.js +2 -2
- package/lib/loading.js +85 -85
- package/lib/nav-bar.js +2 -2
- package/lib/picker.js +12 -11
- package/lib/popover.js +2 -2
- package/lib/radio.js +8 -7
- package/lib/search.js +2 -2
- package/lib/selector.js +28 -28
- package/lib/switch.js +2 -2
- package/lib/tab.js +2 -2
- package/lib/table-column.js +3 -2
- package/lib/tabs.js +2 -2
- package/lib/tag.js +2 -2
- package/lib/theme-chalk/fonts/iconfont.scss +98 -98
- package/lib/theme-chalk/fonts/iconfont1.scss +90 -90
- package/lib/theme-chalk/form.css +1 -1
- package/lib/theme-chalk/index.css +1 -1
- package/lib/uploader.js +3 -2
- package/package.json +1 -1
- package/packages/action-sheet/index.js +5 -5
- package/packages/action-sheet/src/main.vue +32 -32
- package/packages/button/index.js +5 -5
- package/packages/button/src/main.vue +15 -15
- package/packages/button-group/index.js +5 -5
- package/packages/button-group/src/main.vue +80 -80
- package/packages/calendar/index.js +5 -5
- package/packages/calendar/src/main.vue +34 -34
- package/packages/cascader/index.js +5 -5
- package/packages/cascader/src/main.vue +39 -39
- package/packages/cell/index.js +5 -5
- package/packages/cell/src/main.vue +77 -77
- package/packages/checkbox/index.js +5 -5
- package/packages/checkbox/src/main.vue +232 -232
- package/packages/circle/index.js +5 -5
- package/packages/circle/src/main.vue +27 -27
- package/packages/count-down/index.js +5 -5
- package/packages/count-down/src/main.vue +27 -27
- package/packages/date/index.js +5 -5
- package/packages/date/src/date-time.vue +290 -290
- package/packages/date/src/main.vue +401 -401
- package/packages/empty/index.js +5 -5
- package/packages/empty/src/main.vue +16 -16
- package/packages/esign/index.js +5 -5
- package/packages/esign/src/main.vue +144 -144
- package/packages/field/index.js +5 -5
- package/packages/flow/index.js +5 -5
- package/packages/flow/src/components/Circulate.vue +595 -595
- package/packages/flow/src/components/Handle.vue +2404 -2404
- package/packages/flow/src/components/Message.vue +208 -208
- package/packages/flow/src/components/ProcessSettings.vue +342 -342
- package/packages/flow/src/components/TaskRead.vue +1 -1
- package/packages/flow/src/components/supervise.vue +139 -139
- package/packages/flow/src/flowMix.js +288 -288
- package/packages/flow/src/main.vue +116 -116
- package/packages/flow-btn/index.js +5 -5
- package/packages/flow-btn/src/main.vue +494 -494
- package/packages/flow-list/index.js +5 -5
- package/packages/flow-list/src/main.vue +248 -248
- package/packages/form/index.js +5 -5
- package/packages/form/src/CustomCard.vue +201 -0
- package/packages/form/src/main.vue +32 -19
- package/packages/grid/index.js +5 -5
- package/packages/grid/src/main.vue +486 -486
- package/packages/grid-item/index.js +5 -5
- package/packages/grid-item/src/main.vue +16 -16
- package/packages/image/index.js +5 -5
- package/packages/image/src/main.vue +12 -12
- package/packages/image-preview/index.js +5 -5
- package/packages/list/index.js +5 -5
- package/packages/list/src/main.vue +32 -32
- package/packages/loading/index.js +5 -5
- package/packages/loading/src/main.vue +19 -19
- package/packages/nav-bar/index.js +5 -5
- package/packages/nav-bar/src/main.vue +24 -24
- package/packages/notice-bar/index.js +5 -5
- package/packages/notice-bar/src/main.vue +15 -15
- package/packages/pagination/index.js +5 -5
- package/packages/pagination/src/main.vue +73 -73
- package/packages/picker/index.js +5 -5
- package/packages/picker/src/main.vue +604 -604
- package/packages/popover/index.js +5 -5
- package/packages/popover/src/main.vue +32 -32
- package/packages/popup/index.js +5 -5
- package/packages/popup/src/main.vue +27 -27
- package/packages/pull-refresh/index.js +5 -5
- package/packages/pull-refresh/src/main.vue +31 -31
- package/packages/radio/index.js +5 -5
- package/packages/radio/src/main.vue +179 -179
- package/packages/rate/index.js +5 -5
- package/packages/rate/src/main.vue +26 -26
- package/packages/retrial-auth/index.js +5 -5
- package/packages/retrial-auth/src/main.vue +257 -257
- package/packages/search/index.js +5 -5
- package/packages/search/src/main.vue +39 -39
- package/packages/selector/index.js +5 -5
- package/packages/selector/src/main.vue +186 -186
- package/packages/selector/src/selector-tree.vue +1117 -1117
- package/packages/selector/src/tree.vue +405 -405
- package/packages/skeleton/index.js +5 -5
- package/packages/skeleton/src/main.vue +17 -17
- package/packages/stepper/index.js +5 -5
- package/packages/stepper/src/main.vue +25 -25
- package/packages/swipe/index.js +5 -5
- package/packages/swipe/src/main.vue +42 -42
- package/packages/switch/index.js +5 -5
- package/packages/switch/src/main.vue +38 -38
- package/packages/tab/index.js +5 -5
- package/packages/tab/src/main.vue +16 -16
- package/packages/table/index.js +5 -5
- package/packages/table/src/main.vue +1006 -1006
- package/packages/table-column/index.js +5 -5
- package/packages/table-column/src/main.vue +931 -931
- package/packages/table-column/src/mixins/table.js +12 -12
- package/packages/tabs/index.js +5 -5
- package/packages/tabs/src/main.vue +34 -34
- package/packages/tag/index.js +5 -5
- package/packages/tag/src/main.vue +16 -16
- package/packages/theme-chalk/lib/action-sheet.css +0 -0
- package/packages/theme-chalk/lib/base.css +1 -0
- package/packages/theme-chalk/lib/button-group.css +1 -0
- package/packages/theme-chalk/lib/button.css +1 -0
- package/packages/theme-chalk/lib/calendar.css +1 -0
- package/packages/theme-chalk/lib/cascader.css +1 -0
- package/packages/theme-chalk/lib/cell.css +1 -0
- package/packages/theme-chalk/lib/checkbox.css +1 -0
- package/packages/theme-chalk/lib/circle.css +1 -0
- package/packages/theme-chalk/lib/count-down.css +0 -0
- package/packages/theme-chalk/lib/date.css +0 -0
- package/packages/theme-chalk/lib/empty.css +0 -0
- package/packages/theme-chalk/lib/esign.css +1 -0
- package/packages/theme-chalk/lib/field.css +1 -0
- package/packages/theme-chalk/lib/flow-btn.css +1 -0
- package/packages/theme-chalk/lib/flow-list-task-read.css +1 -0
- package/packages/theme-chalk/lib/flow-list.css +1 -0
- package/packages/theme-chalk/lib/flow.css +1 -0
- package/packages/theme-chalk/lib/fonts/iconfont.scss +98 -0
- package/packages/theme-chalk/lib/fonts/iconfont.ttf +0 -0
- package/packages/theme-chalk/lib/fonts/iconfont.woff +0 -0
- package/packages/theme-chalk/lib/fonts/iconfont1.scss +90 -0
- package/packages/theme-chalk/lib/form.css +1 -0
- package/packages/theme-chalk/lib/grid-item.css +1 -0
- package/packages/theme-chalk/lib/grid.css +1 -0
- package/packages/theme-chalk/lib/icon.css +1 -0
- package/packages/theme-chalk/lib/image-preview.css +0 -0
- package/packages/theme-chalk/lib/image.css +0 -0
- package/packages/theme-chalk/lib/index.css +1 -0
- package/packages/theme-chalk/lib/list.css +0 -0
- package/packages/theme-chalk/lib/loading.css +0 -0
- package/packages/theme-chalk/lib/nav-bar.css +0 -0
- package/packages/theme-chalk/lib/navbar.css +1 -0
- package/packages/theme-chalk/lib/notice-bar.css +0 -0
- package/packages/theme-chalk/lib/pagination.css +1 -0
- package/packages/theme-chalk/lib/picker.css +1 -0
- package/packages/theme-chalk/lib/popover.css +0 -0
- package/packages/theme-chalk/lib/popup.css +0 -0
- package/packages/theme-chalk/lib/pull-refresh.css +0 -0
- package/packages/theme-chalk/lib/radio.css +1 -0
- package/packages/theme-chalk/lib/rate.css +0 -0
- package/packages/theme-chalk/lib/retrial-auth.css +1 -0
- package/packages/theme-chalk/lib/search.css +0 -0
- package/packages/theme-chalk/lib/selector.css +1 -0
- package/packages/theme-chalk/lib/skeleton.css +0 -0
- package/packages/theme-chalk/lib/stepper.css +1 -0
- package/packages/theme-chalk/lib/swipe.css +0 -0
- package/packages/theme-chalk/lib/switch.css +1 -0
- package/packages/theme-chalk/lib/tab.css +0 -0
- package/packages/theme-chalk/lib/table-column.css +0 -0
- package/packages/theme-chalk/lib/table.css +1 -0
- package/packages/theme-chalk/lib/tabs.css +1 -0
- package/packages/theme-chalk/lib/tag.css +1 -0
- package/packages/theme-chalk/lib/theme.css +0 -0
- package/packages/theme-chalk/lib/tree.css +1 -0
- package/packages/theme-chalk/lib/uploader.css +0 -0
- package/packages/theme-chalk/src/base.scss +195 -195
- package/packages/theme-chalk/src/button-group.scss +25 -25
- package/packages/theme-chalk/src/button.scss +2 -2
- package/packages/theme-chalk/src/calendar.scss +11 -11
- package/packages/theme-chalk/src/cascader.scss +11 -11
- package/packages/theme-chalk/src/cell.scss +14 -14
- package/packages/theme-chalk/src/checkbox.scss +9 -9
- package/packages/theme-chalk/src/circle.scss +6 -6
- package/packages/theme-chalk/src/common/var.scss +1525 -1525
- package/packages/theme-chalk/src/esign.scss +51 -51
- package/packages/theme-chalk/src/field.scss +98 -98
- package/packages/theme-chalk/src/flow-btn.scss +99 -99
- package/packages/theme-chalk/src/flow-list.scss +122 -122
- package/packages/theme-chalk/src/fonts/iconfont.scss +98 -98
- package/packages/theme-chalk/src/fonts/iconfont1.scss +90 -90
- package/packages/theme-chalk/src/form.scss +107 -33
- package/packages/theme-chalk/src/grid-item.scss +16 -16
- package/packages/theme-chalk/src/grid.scss +46 -46
- package/packages/theme-chalk/src/icon.scss +1661 -1661
- package/packages/theme-chalk/src/mixins/color.scss +117 -117
- package/packages/theme-chalk/src/navbar.scss +5 -5
- package/packages/theme-chalk/src/pagination.scss +12 -12
- package/packages/theme-chalk/src/picker.scss +31 -31
- package/packages/theme-chalk/src/radio.scss +6 -6
- package/packages/theme-chalk/src/retrial-auth.scss +28 -28
- package/packages/theme-chalk/src/selector.scss +247 -247
- package/packages/theme-chalk/src/stepper.scss +9 -9
- package/packages/theme-chalk/src/switch.scss +5 -5
- package/packages/theme-chalk/src/table.scss +86 -86
- package/packages/theme-chalk/src/tabs.scss +31 -31
- package/packages/theme-chalk/src/tag.scss +12 -12
- package/packages/theme-chalk/src/theme.scss +1 -1
- package/packages/theme-chalk/src/tree.scss +127 -127
- package/packages/uploader/index.js +5 -5
- package/src/config/api.js +190 -190
- package/src/index.js +1 -1
- package/src/utils/axios.js +217 -217
- package/src/utils/date-util.js +312 -312
- package/src/utils/http.js +106 -106
- package/src/utils/rules.js +18 -18
- package/src/utils/store.js +21 -21
- package/packages/theme-chalk/gulpfile.js +0 -25
|
@@ -1,604 +1,604 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="em-picker">
|
|
3
|
-
<em-input
|
|
4
|
-
v-if="!isCheck"
|
|
5
|
-
readonly
|
|
6
|
-
clickable
|
|
7
|
-
v-bind="$attrs"
|
|
8
|
-
:label="label"
|
|
9
|
-
:value="pickerValue"
|
|
10
|
-
:required="required"
|
|
11
|
-
:label-width="labelWidth"
|
|
12
|
-
:hideLabel="hideLabel"
|
|
13
|
-
:placeholder="
|
|
14
|
-
pickerValue
|
|
15
|
-
? pickerValue
|
|
16
|
-
: (disabled || readonly) && placeholder == undefined
|
|
17
|
-
? '暂无数据'
|
|
18
|
-
: placeholder != undefined
|
|
19
|
-
? placeholder
|
|
20
|
-
: `请选择${label}`
|
|
21
|
-
"
|
|
22
|
-
@click="handlePicker"
|
|
23
|
-
:disabled="disabled || readonly"
|
|
24
|
-
:right-icon="disabled || readonly ? '' : 'arrow'"
|
|
25
|
-
>
|
|
26
|
-
<template v-for="(index, name) in $slots" :slot="name">
|
|
27
|
-
<slot :name="name" /> </template
|
|
28
|
-
></em-input>
|
|
29
|
-
<em-input
|
|
30
|
-
v-else
|
|
31
|
-
readonly
|
|
32
|
-
clickable
|
|
33
|
-
v-bind="$attrs"
|
|
34
|
-
:label="label"
|
|
35
|
-
:required="required"
|
|
36
|
-
:disabled="disabled || readonly"
|
|
37
|
-
:label-width="labelWidth"
|
|
38
|
-
:hideLabel="hideLabel"
|
|
39
|
-
@click="handlePicker"
|
|
40
|
-
:right-icon="disabled || readonly ? '' : 'arrow'"
|
|
41
|
-
>
|
|
42
|
-
<template slot="input">
|
|
43
|
-
<div style="width: 100%">
|
|
44
|
-
<slot name="textTop"></slot>
|
|
45
|
-
<div v-if="pickerValue.length > 0">
|
|
46
|
-
<em-tag
|
|
47
|
-
v-for="(r, i) in pickerValue"
|
|
48
|
-
:closeable="!disabled && !readonly"
|
|
49
|
-
type="primary"
|
|
50
|
-
:key="i"
|
|
51
|
-
@click.stop="handleClick(r)"
|
|
52
|
-
@close="deleteList(i, r)"
|
|
53
|
-
>{{ r[labelKey] || r.name }}</em-tag
|
|
54
|
-
>
|
|
55
|
-
</div>
|
|
56
|
-
<div v-else style="color: #c8c9cc">
|
|
57
|
-
{{
|
|
58
|
-
(disabled || readonly) && placeholder == undefined
|
|
59
|
-
? ' 暂无数据'
|
|
60
|
-
: placeholder == undefined
|
|
61
|
-
? '请选择' + label
|
|
62
|
-
: placeholder
|
|
63
|
-
}}
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
</template>
|
|
67
|
-
</em-input>
|
|
68
|
-
<van-popup v-model="showPicker" @close="onConfirm" round position="bottom">
|
|
69
|
-
<van-picker
|
|
70
|
-
v-if="!isCheck"
|
|
71
|
-
show-toolbar
|
|
72
|
-
:loading="newLoading"
|
|
73
|
-
:columns="newColumns"
|
|
74
|
-
v-bind="$attrs"
|
|
75
|
-
v-on="$listeners"
|
|
76
|
-
:valueKey="labelKey"
|
|
77
|
-
:defaultIndex="newDefaultIndex"
|
|
78
|
-
@cancel="showPicker = false"
|
|
79
|
-
@confirm="onConfirm($event, true)"
|
|
80
|
-
>
|
|
81
|
-
<template slot="columns-top" v-if="isSearch">
|
|
82
|
-
<!-- @search="handleSearch" -->
|
|
83
|
-
<em-search
|
|
84
|
-
v-model="keyWord"
|
|
85
|
-
@input="handleSearch"
|
|
86
|
-
placeholder="请输入搜索关键词"
|
|
87
|
-
/>
|
|
88
|
-
</template>
|
|
89
|
-
<template v-for="(index, name) in $slots" :slot="name">
|
|
90
|
-
<slot :name="name" />
|
|
91
|
-
</template>
|
|
92
|
-
</van-picker>
|
|
93
|
-
<van-picker
|
|
94
|
-
v-else
|
|
95
|
-
show-toolbar
|
|
96
|
-
class="check-picker"
|
|
97
|
-
:loading="newLoading"
|
|
98
|
-
:columns="newColumns"
|
|
99
|
-
v-bind="$attrs"
|
|
100
|
-
v-on="$listeners"
|
|
101
|
-
:valueKey="labelKey"
|
|
102
|
-
:defaultIndex="newDefaultIndex"
|
|
103
|
-
@cancel="onConfirm"
|
|
104
|
-
@confirm="onConfirm($event, true)"
|
|
105
|
-
>
|
|
106
|
-
<!-- @search="handleSearch" -->
|
|
107
|
-
<template slot="columns-top" v-if="isSearch">
|
|
108
|
-
<em-search
|
|
109
|
-
v-model="keyWord"
|
|
110
|
-
@input="handleSearch"
|
|
111
|
-
placeholder="请输入搜索关键词"
|
|
112
|
-
/>
|
|
113
|
-
</template>
|
|
114
|
-
<template slot="columns-bottom">
|
|
115
|
-
<div class="em-picker__columns">
|
|
116
|
-
<em-list
|
|
117
|
-
v-model="listLoading"
|
|
118
|
-
:finished="listFinished"
|
|
119
|
-
:finished-text="sysAppCode || url ? '没有更多了' : ''"
|
|
120
|
-
@load="onLoad"
|
|
121
|
-
:offset="50"
|
|
122
|
-
>
|
|
123
|
-
<van-checkbox-group v-model="checkList">
|
|
124
|
-
<em-cell
|
|
125
|
-
v-for="(item, index) in newColumns"
|
|
126
|
-
clickable
|
|
127
|
-
:key="item[valueKey]"
|
|
128
|
-
:isGroup="false"
|
|
129
|
-
:title="item[labelKey]"
|
|
130
|
-
@click="toggle(index)"
|
|
131
|
-
>
|
|
132
|
-
<template #right-icon>
|
|
133
|
-
<van-checkbox :name="item[valueKey]" ref="checkboxes" />
|
|
134
|
-
</template>
|
|
135
|
-
</em-cell>
|
|
136
|
-
</van-checkbox-group>
|
|
137
|
-
</em-list>
|
|
138
|
-
</div>
|
|
139
|
-
</template>
|
|
140
|
-
</van-picker>
|
|
141
|
-
</van-popup>
|
|
142
|
-
</div>
|
|
143
|
-
</template>
|
|
144
|
-
|
|
145
|
-
<script>
|
|
146
|
-
import { findSysCode } from '../../../src/config/api';
|
|
147
|
-
import request from '../../../src/utils/http.js';
|
|
148
|
-
export default {
|
|
149
|
-
name: 'EmPicker',
|
|
150
|
-
inheritAttrs: false,
|
|
151
|
-
data() {
|
|
152
|
-
return {
|
|
153
|
-
showPicker: false,
|
|
154
|
-
newLoading: false,
|
|
155
|
-
keyWord: '',
|
|
156
|
-
newLabelKey: '',
|
|
157
|
-
newValueKey: '',
|
|
158
|
-
listLoading: false,
|
|
159
|
-
listFinished: false,
|
|
160
|
-
newColumns: [],
|
|
161
|
-
checkList: [],
|
|
162
|
-
timer:null,
|
|
163
|
-
newDefaultIndex: 0,
|
|
164
|
-
pageIndex: 1,
|
|
165
|
-
total: -1
|
|
166
|
-
};
|
|
167
|
-
},
|
|
168
|
-
props: {
|
|
169
|
-
// 绑定值
|
|
170
|
-
value: {
|
|
171
|
-
type: [String, Array, Object],
|
|
172
|
-
default: ''
|
|
173
|
-
},
|
|
174
|
-
isSearch: {
|
|
175
|
-
type: Boolean,
|
|
176
|
-
default: false
|
|
177
|
-
},
|
|
178
|
-
hideLabel: {
|
|
179
|
-
type: Boolean,
|
|
180
|
-
default: false
|
|
181
|
-
},
|
|
182
|
-
isCheck: {
|
|
183
|
-
type: Boolean,
|
|
184
|
-
default: false
|
|
185
|
-
},
|
|
186
|
-
required: {
|
|
187
|
-
type: Boolean,
|
|
188
|
-
default: false
|
|
189
|
-
},
|
|
190
|
-
disabled: {
|
|
191
|
-
type: Boolean,
|
|
192
|
-
default: false
|
|
193
|
-
},
|
|
194
|
-
readonly: {
|
|
195
|
-
type: Boolean,
|
|
196
|
-
default: false
|
|
197
|
-
},
|
|
198
|
-
linkTag: {
|
|
199
|
-
type: Boolean,
|
|
200
|
-
default: false
|
|
201
|
-
},
|
|
202
|
-
// 展示标题
|
|
203
|
-
label: {
|
|
204
|
-
type: String,
|
|
205
|
-
default: '
|
|
206
|
-
},
|
|
207
|
-
// 输入框占位提示文字
|
|
208
|
-
placeholder: {
|
|
209
|
-
type: String,
|
|
210
|
-
default: undefined
|
|
211
|
-
},
|
|
212
|
-
// 多级选择展示拼接字符
|
|
213
|
-
joinStr: {
|
|
214
|
-
type: String,
|
|
215
|
-
default: '/'
|
|
216
|
-
},
|
|
217
|
-
beforResponse: {
|
|
218
|
-
type: [Function, String],
|
|
219
|
-
default: ''
|
|
220
|
-
},
|
|
221
|
-
valueKey: {
|
|
222
|
-
type: String,
|
|
223
|
-
default: 'value'
|
|
224
|
-
},
|
|
225
|
-
searchKey: {
|
|
226
|
-
type: String,
|
|
227
|
-
default: 'keyWord'
|
|
228
|
-
},
|
|
229
|
-
labelKey: {
|
|
230
|
-
type: String,
|
|
231
|
-
default: 'name'
|
|
232
|
-
},
|
|
233
|
-
objectType: {
|
|
234
|
-
type: Boolean,
|
|
235
|
-
default: true
|
|
236
|
-
},
|
|
237
|
-
sysAppCode: {
|
|
238
|
-
type: String,
|
|
239
|
-
default: ''
|
|
240
|
-
},
|
|
241
|
-
resultsName: {
|
|
242
|
-
type: String,
|
|
243
|
-
default: ''
|
|
244
|
-
},
|
|
245
|
-
method: {
|
|
246
|
-
type: String,
|
|
247
|
-
default: 'get'
|
|
248
|
-
},
|
|
249
|
-
url: {
|
|
250
|
-
type: String
|
|
251
|
-
},
|
|
252
|
-
param: {
|
|
253
|
-
type: Object,
|
|
254
|
-
default: () => {}
|
|
255
|
-
},
|
|
256
|
-
columns: {
|
|
257
|
-
type: Array,
|
|
258
|
-
default: () => []
|
|
259
|
-
},
|
|
260
|
-
loading: {
|
|
261
|
-
type: Boolean,
|
|
262
|
-
default: false
|
|
263
|
-
},
|
|
264
|
-
defaultIndex: {
|
|
265
|
-
type: [Number, String]
|
|
266
|
-
},
|
|
267
|
-
labelWidth: {
|
|
268
|
-
type: [Number, String],
|
|
269
|
-
default: '4em'
|
|
270
|
-
},
|
|
271
|
-
isTable: {
|
|
272
|
-
type: Boolean,
|
|
273
|
-
default: false
|
|
274
|
-
},
|
|
275
|
-
baseUrl: String
|
|
276
|
-
},
|
|
277
|
-
computed: {
|
|
278
|
-
pickerValue: {
|
|
279
|
-
get() {
|
|
280
|
-
return this.getValue();
|
|
281
|
-
},
|
|
282
|
-
set(val) {
|
|
283
|
-
if (!this.objectType && val.length === undefined) {
|
|
284
|
-
this.$emit(
|
|
285
|
-
'input',
|
|
286
|
-
val[this.sysAppCode ? 'cciValue' : this.valueKey]
|
|
287
|
-
);
|
|
288
|
-
} else if (!this.objectType && val.length != undefined) {
|
|
289
|
-
val.map((x) => {
|
|
290
|
-
if (typeof x === 'object') {
|
|
291
|
-
x = x[this.sysAppCode ? 'cciValue' : this.valueKey];
|
|
292
|
-
}
|
|
293
|
-
});
|
|
294
|
-
this.$emit('input', val);
|
|
295
|
-
} else {
|
|
296
|
-
this.$emit('input', val);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
},
|
|
301
|
-
watch: {
|
|
302
|
-
events: {
|
|
303
|
-
type: Object,
|
|
304
|
-
default: () => {}
|
|
305
|
-
},
|
|
306
|
-
labelKey: {
|
|
307
|
-
handler(val) {
|
|
308
|
-
this.newLabelKey = val;
|
|
309
|
-
},
|
|
310
|
-
deep: true,
|
|
311
|
-
immediate: true
|
|
312
|
-
},
|
|
313
|
-
valueKey: {
|
|
314
|
-
handler(val) {
|
|
315
|
-
this.newValueKey = val;
|
|
316
|
-
},
|
|
317
|
-
deep: true,
|
|
318
|
-
immediate: true
|
|
319
|
-
},
|
|
320
|
-
columns: {
|
|
321
|
-
handler(val) {
|
|
322
|
-
if (this.sysAppCode) return;
|
|
323
|
-
this.newColumns = val;
|
|
324
|
-
},
|
|
325
|
-
deep: true,
|
|
326
|
-
immediate: true
|
|
327
|
-
},
|
|
328
|
-
defaultIndex: {
|
|
329
|
-
handler(val) {
|
|
330
|
-
this.newDefaultIndex = val;
|
|
331
|
-
},
|
|
332
|
-
deep: true,
|
|
333
|
-
immediate: true
|
|
334
|
-
},
|
|
335
|
-
loading: {
|
|
336
|
-
handler(val) {
|
|
337
|
-
this.newLoading = val;
|
|
338
|
-
},
|
|
339
|
-
deep: true,
|
|
340
|
-
immediate: true
|
|
341
|
-
}
|
|
342
|
-
},
|
|
343
|
-
mounted() {
|
|
344
|
-
if (
|
|
345
|
-
(this.sysAppCode || this.url) &&
|
|
346
|
-
this.newColumns.length == 0 &&
|
|
347
|
-
!this.isCheck
|
|
348
|
-
) {
|
|
349
|
-
this.getSysCode();
|
|
350
|
-
}
|
|
351
|
-
if (this.defaultIndex != undefined) {
|
|
352
|
-
let data = this.columns[this.defaultIndex];
|
|
353
|
-
if (typeof data === 'string' && data) {
|
|
354
|
-
this.pickerValue = data;
|
|
355
|
-
} else if (typeof data === 'object') {
|
|
356
|
-
this.pickerValue = data[this.newValueKey];
|
|
357
|
-
}
|
|
358
|
-
} else if (this.isCheck) {
|
|
359
|
-
let data = this.value;
|
|
360
|
-
data.map((item) => {
|
|
361
|
-
this.checkList.push(item[this.valueKey] || item.value || item);
|
|
362
|
-
});
|
|
363
|
-
}
|
|
364
|
-
},
|
|
365
|
-
methods: {
|
|
366
|
-
handleSearch() {
|
|
367
|
-
|
|
368
|
-
if (this.timer != null) {
|
|
369
|
-
clearTimeout(this.timer);
|
|
370
|
-
}
|
|
371
|
-
this.timer = setTimeout( () => {
|
|
372
|
-
|
|
373
|
-
this.$emit('search', this.keyWord);
|
|
374
|
-
|
|
375
|
-
if (this.columns.length > 0) {
|
|
376
|
-
this.newColumns = this.columns.filter(
|
|
377
|
-
(x) => x[this.labelKey].indexOf(this.keyWord) != -1
|
|
378
|
-
);
|
|
379
|
-
if (!this.keyWord) {
|
|
380
|
-
this.newColumns = this.columns;
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
if ((this.columns && this.columns.length == 0) || !this.columns)
|
|
385
|
-
this.getSysCode();
|
|
386
|
-
}, 700);
|
|
387
|
-
},
|
|
388
|
-
handleClick(val) {
|
|
389
|
-
if (this.linkTag) {
|
|
390
|
-
this.$emit('tagClick', val);
|
|
391
|
-
} else {
|
|
392
|
-
if (this.disabled || this.readonly) return;
|
|
393
|
-
this.showPicker = true;
|
|
394
|
-
}
|
|
395
|
-
},
|
|
396
|
-
onLoad() {
|
|
397
|
-
if (
|
|
398
|
-
(this.sysAppCode || this.url) &&
|
|
399
|
-
this.newColumns.length != this.total &&
|
|
400
|
-
this.isCheck
|
|
401
|
-
) {
|
|
402
|
-
this.getSysCode();
|
|
403
|
-
} else {
|
|
404
|
-
this.listFinished = true;
|
|
405
|
-
}
|
|
406
|
-
},
|
|
407
|
-
/**
|
|
408
|
-
* deleteList
|
|
409
|
-
* @desc:删除选中的数据
|
|
410
|
-
* @date 2023年4月20日
|
|
411
|
-
* @author liufan
|
|
412
|
-
* @param {String} val 当前数据的下标
|
|
413
|
-
*/
|
|
414
|
-
deleteList(val, res) {
|
|
415
|
-
if (this.disabled || this.readonly) return;
|
|
416
|
-
this.pickerValue.splice(val, 1);
|
|
417
|
-
this.checkList = this.checkList.filter((x) => x != res.value);
|
|
418
|
-
this.$emit('input', this.pickerValue);
|
|
419
|
-
|
|
420
|
-
this.$emit('tagDelete', this.pickerValue);
|
|
421
|
-
},
|
|
422
|
-
toggle(index) {
|
|
423
|
-
this.$refs.checkboxes[index].toggle();
|
|
424
|
-
},
|
|
425
|
-
onConfirm(value, isConfirm) {
|
|
426
|
-
if (isConfirm) {
|
|
427
|
-
if (this.isCheck) {
|
|
428
|
-
let data = [];
|
|
429
|
-
this.newColumns.filter((x) => {
|
|
430
|
-
this.checkList.find((y) => {
|
|
431
|
-
if (x.value === y) {
|
|
432
|
-
data.push(x);
|
|
433
|
-
}
|
|
434
|
-
});
|
|
435
|
-
});
|
|
436
|
-
this.pickerValue = data;
|
|
437
|
-
} else {
|
|
438
|
-
this.pickerValue = value;
|
|
439
|
-
}
|
|
440
|
-
} else {
|
|
441
|
-
if (this.isCheck) {
|
|
442
|
-
this.checkList = [];
|
|
443
|
-
this.pickerValue.map((x) => {
|
|
444
|
-
this.checkList.push(x.value);
|
|
445
|
-
});
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
this.showPicker = false;
|
|
450
|
-
},
|
|
451
|
-
getValue() {
|
|
452
|
-
let value = '';
|
|
453
|
-
if (this.isCheck) {
|
|
454
|
-
let val = [];
|
|
455
|
-
if (this.newColumns && this.newColumns.length > 0) {
|
|
456
|
-
this.newColumns.filter((x) => {
|
|
457
|
-
this.value.find((y) => {
|
|
458
|
-
if (x[this.valueKey] == y || x[this.valueKey] == y.value) {
|
|
459
|
-
val.push(x);
|
|
460
|
-
}
|
|
461
|
-
});
|
|
462
|
-
});
|
|
463
|
-
} else {
|
|
464
|
-
val = this.value;
|
|
465
|
-
}
|
|
466
|
-
value = val;
|
|
467
|
-
} else {
|
|
468
|
-
if (Array.isArray(this.value) || this.value instanceof Object) {
|
|
469
|
-
if (!Array.isArray(this.value)) {
|
|
470
|
-
value = this.value[this.labelKey] || this.value[this.newValueKey];
|
|
471
|
-
let index = 0;
|
|
472
|
-
value && (value = value.replace(/<[^>]+>/g, ''));
|
|
473
|
-
this.newColumns.map((x, i) => {
|
|
474
|
-
if (typeof x === 'string' && value.indexOf(x) != -1) {
|
|
475
|
-
index = i;
|
|
476
|
-
} else if (
|
|
477
|
-
x[this.newValueKey] == value ||
|
|
478
|
-
x[this.newValueKey].indexOf(value) != -1
|
|
479
|
-
) {
|
|
480
|
-
index = i;
|
|
481
|
-
}
|
|
482
|
-
});
|
|
483
|
-
this.newDefaultIndex = index;
|
|
484
|
-
} else {
|
|
485
|
-
let list = [];
|
|
486
|
-
this.value.map((item) => {
|
|
487
|
-
if (item[this.labelKey] || item[this.newValueKey]) {
|
|
488
|
-
list.push(item[this.labelKey] || item[this.newValueKey]);
|
|
489
|
-
} else if (typeof item === 'string') {
|
|
490
|
-
list.push(item);
|
|
491
|
-
}
|
|
492
|
-
});
|
|
493
|
-
value = list.join(this.joinStr);
|
|
494
|
-
let index = 0;
|
|
495
|
-
this.newColumns.map((x, i) => {
|
|
496
|
-
if (typeof x === 'string' && value.indexOf(x) != -1) {
|
|
497
|
-
index = i;
|
|
498
|
-
} else if (x[this.newValueKey] === value) {
|
|
499
|
-
index = i;
|
|
500
|
-
}
|
|
501
|
-
});
|
|
502
|
-
this.newDefaultIndex = index;
|
|
503
|
-
}
|
|
504
|
-
} else {
|
|
505
|
-
let index = 0;
|
|
506
|
-
value = this.value;
|
|
507
|
-
this.newColumns.map((x, i) => {
|
|
508
|
-
if (typeof x === 'string' && value.indexOf(x) != -1) {
|
|
509
|
-
index = i;
|
|
510
|
-
value = x;
|
|
511
|
-
} else if (x[this.newValueKey] === value) {
|
|
512
|
-
index = i;
|
|
513
|
-
value = x[this.labelKey] || x[this.newValueKey];
|
|
514
|
-
}
|
|
515
|
-
});
|
|
516
|
-
this.newDefaultIndex = index;
|
|
517
|
-
}
|
|
518
|
-
value && (value = value.replace(/<[^>]+>/g, ''));
|
|
519
|
-
}
|
|
520
|
-
return value;
|
|
521
|
-
},
|
|
522
|
-
getSysCode() {
|
|
523
|
-
let { url, method, sysAppCode, param, keyWord } = this;
|
|
524
|
-
let params = {
|
|
525
|
-
url: this.baseUrl
|
|
526
|
-
? this.baseUrl + (url || findSysCode)
|
|
527
|
-
: url || findSysCode,
|
|
528
|
-
type: method,
|
|
529
|
-
params: {
|
|
530
|
-
ccCode: sysAppCode,
|
|
531
|
-
pageIndex: this.pageIndex,
|
|
532
|
-
...param
|
|
533
|
-
}
|
|
534
|
-
};
|
|
535
|
-
if (this.isSearch) {
|
|
536
|
-
params.params[this.searchKey] = keyWord;
|
|
537
|
-
}
|
|
538
|
-
this.newLoading = true;
|
|
539
|
-
request(params)
|
|
540
|
-
.then((res) => {
|
|
541
|
-
const { status, data, message, rCode, results } = res;
|
|
542
|
-
this.listLoading = false;
|
|
543
|
-
if (status == 'success' || rCode === 0 || status === true) {
|
|
544
|
-
let info = this.resultsName
|
|
545
|
-
? data
|
|
546
|
-
? data[this.resultsName]
|
|
547
|
-
: results[this.resultsName]
|
|
548
|
-
: data
|
|
549
|
-
? data
|
|
550
|
-
: results;
|
|
551
|
-
info.map((x) => {
|
|
552
|
-
if (this.isCheck) {
|
|
553
|
-
x.name =
|
|
554
|
-
x[sysAppCode ? 'shortName' : this.labelKey] &&
|
|
555
|
-
x[sysAppCode ? 'shortName' : this.labelKey].replace(
|
|
556
|
-
/<[^>]+>/g,
|
|
557
|
-
''
|
|
558
|
-
);
|
|
559
|
-
} else {
|
|
560
|
-
x.name = x[sysAppCode ? 'shortName' : this.labelKey];
|
|
561
|
-
}
|
|
562
|
-
x.value = x[sysAppCode ? 'cciValue' : this.valueKey];
|
|
563
|
-
});
|
|
564
|
-
if (data && data.totalCount) {
|
|
565
|
-
this.total = data.totalCount;
|
|
566
|
-
if (data.totalCount === this.newColumns.length) {
|
|
567
|
-
this.listFinished = true;
|
|
568
|
-
} else {
|
|
569
|
-
if (this.newColumns.length != 0) {
|
|
570
|
-
this.newColumns.push.apply(this.newColumns, info);
|
|
571
|
-
} else {
|
|
572
|
-
this.newColumns = info;
|
|
573
|
-
}
|
|
574
|
-
this.pageIndex = res.data.nextPageNo;
|
|
575
|
-
}
|
|
576
|
-
} else {
|
|
577
|
-
this.listFinished = true;
|
|
578
|
-
this.newColumns = info;
|
|
579
|
-
}
|
|
580
|
-
if (this.beforResponse) {
|
|
581
|
-
this.newColumns = this.beforResponse(this.newColumns);
|
|
582
|
-
this.getValue();
|
|
583
|
-
} else {
|
|
584
|
-
this.getValue();
|
|
585
|
-
}
|
|
586
|
-
} else {
|
|
587
|
-
this.$toast(message);
|
|
588
|
-
}
|
|
589
|
-
this.newLoading = false;
|
|
590
|
-
})
|
|
591
|
-
.catch((err) => {
|
|
592
|
-
this.$toast(err.message);
|
|
593
|
-
});
|
|
594
|
-
},
|
|
595
|
-
handlePicker() {
|
|
596
|
-
if (this.disabled || this.readonly) return;
|
|
597
|
-
this.showPicker = true;
|
|
598
|
-
this.$emit('showPicker');
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
};
|
|
602
|
-
</script>
|
|
603
|
-
|
|
604
|
-
<style></style>
|
|
1
|
+
<template>
|
|
2
|
+
<div class="em-picker">
|
|
3
|
+
<em-input
|
|
4
|
+
v-if="!isCheck"
|
|
5
|
+
readonly
|
|
6
|
+
clickable
|
|
7
|
+
v-bind="$attrs"
|
|
8
|
+
:label="label"
|
|
9
|
+
:value="pickerValue"
|
|
10
|
+
:required="required"
|
|
11
|
+
:label-width="labelWidth"
|
|
12
|
+
:hideLabel="hideLabel"
|
|
13
|
+
:placeholder="
|
|
14
|
+
pickerValue
|
|
15
|
+
? pickerValue
|
|
16
|
+
: (disabled || readonly) && placeholder == undefined
|
|
17
|
+
? '暂无数据'
|
|
18
|
+
: placeholder != undefined
|
|
19
|
+
? placeholder
|
|
20
|
+
: `请选择${label}`
|
|
21
|
+
"
|
|
22
|
+
@click="handlePicker"
|
|
23
|
+
:disabled="disabled || readonly"
|
|
24
|
+
:right-icon="disabled || readonly ? '' : 'arrow'"
|
|
25
|
+
>
|
|
26
|
+
<template v-for="(index, name) in $slots" :slot="name">
|
|
27
|
+
<slot :name="name" /> </template
|
|
28
|
+
></em-input>
|
|
29
|
+
<em-input
|
|
30
|
+
v-else
|
|
31
|
+
readonly
|
|
32
|
+
clickable
|
|
33
|
+
v-bind="$attrs"
|
|
34
|
+
:label="label"
|
|
35
|
+
:required="required"
|
|
36
|
+
:disabled="disabled || readonly"
|
|
37
|
+
:label-width="labelWidth"
|
|
38
|
+
:hideLabel="hideLabel"
|
|
39
|
+
@click="handlePicker"
|
|
40
|
+
:right-icon="disabled || readonly ? '' : 'arrow'"
|
|
41
|
+
>
|
|
42
|
+
<template slot="input">
|
|
43
|
+
<div style="width: 100%">
|
|
44
|
+
<slot name="textTop"></slot>
|
|
45
|
+
<div v-if="pickerValue.length > 0">
|
|
46
|
+
<em-tag
|
|
47
|
+
v-for="(r, i) in pickerValue"
|
|
48
|
+
:closeable="!disabled && !readonly"
|
|
49
|
+
type="primary"
|
|
50
|
+
:key="i"
|
|
51
|
+
@click.stop="handleClick(r)"
|
|
52
|
+
@close="deleteList(i, r)"
|
|
53
|
+
>{{ r[labelKey] || r.name }}</em-tag
|
|
54
|
+
>
|
|
55
|
+
</div>
|
|
56
|
+
<div v-else style="color: #c8c9cc">
|
|
57
|
+
{{
|
|
58
|
+
(disabled || readonly) && placeholder == undefined
|
|
59
|
+
? ' 暂无数据'
|
|
60
|
+
: placeholder == undefined
|
|
61
|
+
? '请选择' + label
|
|
62
|
+
: placeholder
|
|
63
|
+
}}
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</template>
|
|
67
|
+
</em-input>
|
|
68
|
+
<van-popup v-model="showPicker" @close="onConfirm" round position="bottom">
|
|
69
|
+
<van-picker
|
|
70
|
+
v-if="!isCheck"
|
|
71
|
+
show-toolbar
|
|
72
|
+
:loading="newLoading"
|
|
73
|
+
:columns="newColumns"
|
|
74
|
+
v-bind="$attrs"
|
|
75
|
+
v-on="$listeners"
|
|
76
|
+
:valueKey="labelKey"
|
|
77
|
+
:defaultIndex="newDefaultIndex"
|
|
78
|
+
@cancel="showPicker = false"
|
|
79
|
+
@confirm="onConfirm($event, true)"
|
|
80
|
+
>
|
|
81
|
+
<template slot="columns-top" v-if="isSearch">
|
|
82
|
+
<!-- @search="handleSearch" -->
|
|
83
|
+
<em-search
|
|
84
|
+
v-model="keyWord"
|
|
85
|
+
@input="handleSearch"
|
|
86
|
+
placeholder="请输入搜索关键词"
|
|
87
|
+
/>
|
|
88
|
+
</template>
|
|
89
|
+
<template v-for="(index, name) in $slots" :slot="name">
|
|
90
|
+
<slot :name="name" />
|
|
91
|
+
</template>
|
|
92
|
+
</van-picker>
|
|
93
|
+
<van-picker
|
|
94
|
+
v-else
|
|
95
|
+
show-toolbar
|
|
96
|
+
class="check-picker"
|
|
97
|
+
:loading="newLoading"
|
|
98
|
+
:columns="newColumns"
|
|
99
|
+
v-bind="$attrs"
|
|
100
|
+
v-on="$listeners"
|
|
101
|
+
:valueKey="labelKey"
|
|
102
|
+
:defaultIndex="newDefaultIndex"
|
|
103
|
+
@cancel="onConfirm"
|
|
104
|
+
@confirm="onConfirm($event, true)"
|
|
105
|
+
>
|
|
106
|
+
<!-- @search="handleSearch" -->
|
|
107
|
+
<template slot="columns-top" v-if="isSearch">
|
|
108
|
+
<em-search
|
|
109
|
+
v-model="keyWord"
|
|
110
|
+
@input="handleSearch"
|
|
111
|
+
placeholder="请输入搜索关键词"
|
|
112
|
+
/>
|
|
113
|
+
</template>
|
|
114
|
+
<template slot="columns-bottom">
|
|
115
|
+
<div class="em-picker__columns">
|
|
116
|
+
<em-list
|
|
117
|
+
v-model="listLoading"
|
|
118
|
+
:finished="listFinished"
|
|
119
|
+
:finished-text="sysAppCode || url ? '没有更多了' : ''"
|
|
120
|
+
@load="onLoad"
|
|
121
|
+
:offset="50"
|
|
122
|
+
>
|
|
123
|
+
<van-checkbox-group v-model="checkList">
|
|
124
|
+
<em-cell
|
|
125
|
+
v-for="(item, index) in newColumns"
|
|
126
|
+
clickable
|
|
127
|
+
:key="item[valueKey]"
|
|
128
|
+
:isGroup="false"
|
|
129
|
+
:title="item[labelKey]"
|
|
130
|
+
@click="toggle(index)"
|
|
131
|
+
>
|
|
132
|
+
<template #right-icon>
|
|
133
|
+
<van-checkbox :name="item[valueKey]" ref="checkboxes" />
|
|
134
|
+
</template>
|
|
135
|
+
</em-cell>
|
|
136
|
+
</van-checkbox-group>
|
|
137
|
+
</em-list>
|
|
138
|
+
</div>
|
|
139
|
+
</template>
|
|
140
|
+
</van-picker>
|
|
141
|
+
</van-popup>
|
|
142
|
+
</div>
|
|
143
|
+
</template>
|
|
144
|
+
|
|
145
|
+
<script>
|
|
146
|
+
import { findSysCode } from '../../../src/config/api';
|
|
147
|
+
import request from '../../../src/utils/http.js';
|
|
148
|
+
export default {
|
|
149
|
+
name: 'EmPicker',
|
|
150
|
+
inheritAttrs: false,
|
|
151
|
+
data() {
|
|
152
|
+
return {
|
|
153
|
+
showPicker: false,
|
|
154
|
+
newLoading: false,
|
|
155
|
+
keyWord: '',
|
|
156
|
+
newLabelKey: '',
|
|
157
|
+
newValueKey: '',
|
|
158
|
+
listLoading: false,
|
|
159
|
+
listFinished: false,
|
|
160
|
+
newColumns: [],
|
|
161
|
+
checkList: [],
|
|
162
|
+
timer:null,
|
|
163
|
+
newDefaultIndex: 0,
|
|
164
|
+
pageIndex: 1,
|
|
165
|
+
total: -1
|
|
166
|
+
};
|
|
167
|
+
},
|
|
168
|
+
props: {
|
|
169
|
+
// 绑定值
|
|
170
|
+
value: {
|
|
171
|
+
type: [String, Array, Object],
|
|
172
|
+
default: ''
|
|
173
|
+
},
|
|
174
|
+
isSearch: {
|
|
175
|
+
type: Boolean,
|
|
176
|
+
default: false
|
|
177
|
+
},
|
|
178
|
+
hideLabel: {
|
|
179
|
+
type: Boolean,
|
|
180
|
+
default: false
|
|
181
|
+
},
|
|
182
|
+
isCheck: {
|
|
183
|
+
type: Boolean,
|
|
184
|
+
default: false
|
|
185
|
+
},
|
|
186
|
+
required: {
|
|
187
|
+
type: Boolean,
|
|
188
|
+
default: false
|
|
189
|
+
},
|
|
190
|
+
disabled: {
|
|
191
|
+
type: Boolean,
|
|
192
|
+
default: false
|
|
193
|
+
},
|
|
194
|
+
readonly: {
|
|
195
|
+
type: Boolean,
|
|
196
|
+
default: false
|
|
197
|
+
},
|
|
198
|
+
linkTag: {
|
|
199
|
+
type: Boolean,
|
|
200
|
+
default: false
|
|
201
|
+
},
|
|
202
|
+
// 展示标题
|
|
203
|
+
label: {
|
|
204
|
+
type: String,
|
|
205
|
+
default: ''
|
|
206
|
+
},
|
|
207
|
+
// 输入框占位提示文字
|
|
208
|
+
placeholder: {
|
|
209
|
+
type: String,
|
|
210
|
+
default: undefined
|
|
211
|
+
},
|
|
212
|
+
// 多级选择展示拼接字符
|
|
213
|
+
joinStr: {
|
|
214
|
+
type: String,
|
|
215
|
+
default: '/'
|
|
216
|
+
},
|
|
217
|
+
beforResponse: {
|
|
218
|
+
type: [Function, String],
|
|
219
|
+
default: ''
|
|
220
|
+
},
|
|
221
|
+
valueKey: {
|
|
222
|
+
type: String,
|
|
223
|
+
default: 'value'
|
|
224
|
+
},
|
|
225
|
+
searchKey: {
|
|
226
|
+
type: String,
|
|
227
|
+
default: 'keyWord'
|
|
228
|
+
},
|
|
229
|
+
labelKey: {
|
|
230
|
+
type: String,
|
|
231
|
+
default: 'name'
|
|
232
|
+
},
|
|
233
|
+
objectType: {
|
|
234
|
+
type: Boolean,
|
|
235
|
+
default: true
|
|
236
|
+
},
|
|
237
|
+
sysAppCode: {
|
|
238
|
+
type: String,
|
|
239
|
+
default: ''
|
|
240
|
+
},
|
|
241
|
+
resultsName: {
|
|
242
|
+
type: String,
|
|
243
|
+
default: ''
|
|
244
|
+
},
|
|
245
|
+
method: {
|
|
246
|
+
type: String,
|
|
247
|
+
default: 'get'
|
|
248
|
+
},
|
|
249
|
+
url: {
|
|
250
|
+
type: String
|
|
251
|
+
},
|
|
252
|
+
param: {
|
|
253
|
+
type: Object,
|
|
254
|
+
default: () => {}
|
|
255
|
+
},
|
|
256
|
+
columns: {
|
|
257
|
+
type: Array,
|
|
258
|
+
default: () => []
|
|
259
|
+
},
|
|
260
|
+
loading: {
|
|
261
|
+
type: Boolean,
|
|
262
|
+
default: false
|
|
263
|
+
},
|
|
264
|
+
defaultIndex: {
|
|
265
|
+
type: [Number, String]
|
|
266
|
+
},
|
|
267
|
+
labelWidth: {
|
|
268
|
+
type: [Number, String],
|
|
269
|
+
default: '4em'
|
|
270
|
+
},
|
|
271
|
+
isTable: {
|
|
272
|
+
type: Boolean,
|
|
273
|
+
default: false
|
|
274
|
+
},
|
|
275
|
+
baseUrl: String
|
|
276
|
+
},
|
|
277
|
+
computed: {
|
|
278
|
+
pickerValue: {
|
|
279
|
+
get() {
|
|
280
|
+
return this.getValue();
|
|
281
|
+
},
|
|
282
|
+
set(val) {
|
|
283
|
+
if (!this.objectType && val.length === undefined) {
|
|
284
|
+
this.$emit(
|
|
285
|
+
'input',
|
|
286
|
+
val[this.sysAppCode ? 'cciValue' : this.valueKey]
|
|
287
|
+
);
|
|
288
|
+
} else if (!this.objectType && val.length != undefined) {
|
|
289
|
+
val.map((x) => {
|
|
290
|
+
if (typeof x === 'object') {
|
|
291
|
+
x = x[this.sysAppCode ? 'cciValue' : this.valueKey];
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
this.$emit('input', val);
|
|
295
|
+
} else {
|
|
296
|
+
this.$emit('input', val);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
watch: {
|
|
302
|
+
events: {
|
|
303
|
+
type: Object,
|
|
304
|
+
default: () => {}
|
|
305
|
+
},
|
|
306
|
+
labelKey: {
|
|
307
|
+
handler(val) {
|
|
308
|
+
this.newLabelKey = val;
|
|
309
|
+
},
|
|
310
|
+
deep: true,
|
|
311
|
+
immediate: true
|
|
312
|
+
},
|
|
313
|
+
valueKey: {
|
|
314
|
+
handler(val) {
|
|
315
|
+
this.newValueKey = val;
|
|
316
|
+
},
|
|
317
|
+
deep: true,
|
|
318
|
+
immediate: true
|
|
319
|
+
},
|
|
320
|
+
columns: {
|
|
321
|
+
handler(val) {
|
|
322
|
+
if (this.sysAppCode) return;
|
|
323
|
+
this.newColumns = val;
|
|
324
|
+
},
|
|
325
|
+
deep: true,
|
|
326
|
+
immediate: true
|
|
327
|
+
},
|
|
328
|
+
defaultIndex: {
|
|
329
|
+
handler(val) {
|
|
330
|
+
this.newDefaultIndex = val;
|
|
331
|
+
},
|
|
332
|
+
deep: true,
|
|
333
|
+
immediate: true
|
|
334
|
+
},
|
|
335
|
+
loading: {
|
|
336
|
+
handler(val) {
|
|
337
|
+
this.newLoading = val;
|
|
338
|
+
},
|
|
339
|
+
deep: true,
|
|
340
|
+
immediate: true
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
mounted() {
|
|
344
|
+
if (
|
|
345
|
+
(this.sysAppCode || this.url) &&
|
|
346
|
+
this.newColumns.length == 0 &&
|
|
347
|
+
!this.isCheck
|
|
348
|
+
) {
|
|
349
|
+
this.getSysCode();
|
|
350
|
+
}
|
|
351
|
+
if (this.defaultIndex != undefined) {
|
|
352
|
+
let data = this.columns[this.defaultIndex];
|
|
353
|
+
if (typeof data === 'string' && data) {
|
|
354
|
+
this.pickerValue = data;
|
|
355
|
+
} else if (typeof data === 'object') {
|
|
356
|
+
this.pickerValue = data[this.newValueKey];
|
|
357
|
+
}
|
|
358
|
+
} else if (this.isCheck) {
|
|
359
|
+
let data = this.value;
|
|
360
|
+
data.map((item) => {
|
|
361
|
+
this.checkList.push(item[this.valueKey] || item.value || item);
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
},
|
|
365
|
+
methods: {
|
|
366
|
+
handleSearch() {
|
|
367
|
+
|
|
368
|
+
if (this.timer != null) {
|
|
369
|
+
clearTimeout(this.timer);
|
|
370
|
+
}
|
|
371
|
+
this.timer = setTimeout( () => {
|
|
372
|
+
|
|
373
|
+
this.$emit('search', this.keyWord);
|
|
374
|
+
|
|
375
|
+
if (this.columns.length > 0) {
|
|
376
|
+
this.newColumns = this.columns.filter(
|
|
377
|
+
(x) => x[this.labelKey].indexOf(this.keyWord) != -1
|
|
378
|
+
);
|
|
379
|
+
if (!this.keyWord) {
|
|
380
|
+
this.newColumns = this.columns;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
if ((this.columns && this.columns.length == 0) || !this.columns)
|
|
385
|
+
this.getSysCode();
|
|
386
|
+
}, 700);
|
|
387
|
+
},
|
|
388
|
+
handleClick(val) {
|
|
389
|
+
if (this.linkTag) {
|
|
390
|
+
this.$emit('tagClick', val);
|
|
391
|
+
} else {
|
|
392
|
+
if (this.disabled || this.readonly) return;
|
|
393
|
+
this.showPicker = true;
|
|
394
|
+
}
|
|
395
|
+
},
|
|
396
|
+
onLoad() {
|
|
397
|
+
if (
|
|
398
|
+
(this.sysAppCode || this.url) &&
|
|
399
|
+
this.newColumns.length != this.total &&
|
|
400
|
+
this.isCheck
|
|
401
|
+
) {
|
|
402
|
+
this.getSysCode();
|
|
403
|
+
} else {
|
|
404
|
+
this.listFinished = true;
|
|
405
|
+
}
|
|
406
|
+
},
|
|
407
|
+
/**
|
|
408
|
+
* deleteList
|
|
409
|
+
* @desc:删除选中的数据
|
|
410
|
+
* @date 2023年4月20日
|
|
411
|
+
* @author liufan
|
|
412
|
+
* @param {String} val 当前数据的下标
|
|
413
|
+
*/
|
|
414
|
+
deleteList(val, res) {
|
|
415
|
+
if (this.disabled || this.readonly) return;
|
|
416
|
+
this.pickerValue.splice(val, 1);
|
|
417
|
+
this.checkList = this.checkList.filter((x) => x != res.value);
|
|
418
|
+
this.$emit('input', this.pickerValue);
|
|
419
|
+
|
|
420
|
+
this.$emit('tagDelete', this.pickerValue);
|
|
421
|
+
},
|
|
422
|
+
toggle(index) {
|
|
423
|
+
this.$refs.checkboxes[index].toggle();
|
|
424
|
+
},
|
|
425
|
+
onConfirm(value, isConfirm) {
|
|
426
|
+
if (isConfirm) {
|
|
427
|
+
if (this.isCheck) {
|
|
428
|
+
let data = [];
|
|
429
|
+
this.newColumns.filter((x) => {
|
|
430
|
+
this.checkList.find((y) => {
|
|
431
|
+
if (x.value === y) {
|
|
432
|
+
data.push(x);
|
|
433
|
+
}
|
|
434
|
+
});
|
|
435
|
+
});
|
|
436
|
+
this.pickerValue = data;
|
|
437
|
+
} else {
|
|
438
|
+
this.pickerValue = value;
|
|
439
|
+
}
|
|
440
|
+
} else {
|
|
441
|
+
if (this.isCheck) {
|
|
442
|
+
this.checkList = [];
|
|
443
|
+
this.pickerValue.map((x) => {
|
|
444
|
+
this.checkList.push(x.value);
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
this.showPicker = false;
|
|
450
|
+
},
|
|
451
|
+
getValue() {
|
|
452
|
+
let value = '';
|
|
453
|
+
if (this.isCheck) {
|
|
454
|
+
let val = [];
|
|
455
|
+
if (this.newColumns && this.newColumns.length > 0) {
|
|
456
|
+
this.newColumns.filter((x) => {
|
|
457
|
+
this.value.find((y) => {
|
|
458
|
+
if (x[this.valueKey] == y || x[this.valueKey] == y.value) {
|
|
459
|
+
val.push(x);
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
});
|
|
463
|
+
} else {
|
|
464
|
+
val = this.value;
|
|
465
|
+
}
|
|
466
|
+
value = val;
|
|
467
|
+
} else {
|
|
468
|
+
if (Array.isArray(this.value) || this.value instanceof Object) {
|
|
469
|
+
if (!Array.isArray(this.value)) {
|
|
470
|
+
value = this.value[this.labelKey] || this.value[this.newValueKey];
|
|
471
|
+
let index = 0;
|
|
472
|
+
value && (value = value.replace(/<[^>]+>/g, ''));
|
|
473
|
+
this.newColumns.map((x, i) => {
|
|
474
|
+
if (typeof x === 'string' && value.indexOf(x) != -1) {
|
|
475
|
+
index = i;
|
|
476
|
+
} else if (
|
|
477
|
+
x[this.newValueKey] == value ||
|
|
478
|
+
x[this.newValueKey].indexOf(value) != -1
|
|
479
|
+
) {
|
|
480
|
+
index = i;
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
this.newDefaultIndex = index;
|
|
484
|
+
} else {
|
|
485
|
+
let list = [];
|
|
486
|
+
this.value.map((item) => {
|
|
487
|
+
if (item[this.labelKey] || item[this.newValueKey]) {
|
|
488
|
+
list.push(item[this.labelKey] || item[this.newValueKey]);
|
|
489
|
+
} else if (typeof item === 'string') {
|
|
490
|
+
list.push(item);
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
value = list.join(this.joinStr);
|
|
494
|
+
let index = 0;
|
|
495
|
+
this.newColumns.map((x, i) => {
|
|
496
|
+
if (typeof x === 'string' && value.indexOf(x) != -1) {
|
|
497
|
+
index = i;
|
|
498
|
+
} else if (x[this.newValueKey] === value) {
|
|
499
|
+
index = i;
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
this.newDefaultIndex = index;
|
|
503
|
+
}
|
|
504
|
+
} else {
|
|
505
|
+
let index = 0;
|
|
506
|
+
value = this.value;
|
|
507
|
+
this.newColumns.map((x, i) => {
|
|
508
|
+
if (typeof x === 'string' && value.indexOf(x) != -1) {
|
|
509
|
+
index = i;
|
|
510
|
+
value = x;
|
|
511
|
+
} else if (x[this.newValueKey] === value) {
|
|
512
|
+
index = i;
|
|
513
|
+
value = x[this.labelKey] || x[this.newValueKey];
|
|
514
|
+
}
|
|
515
|
+
});
|
|
516
|
+
this.newDefaultIndex = index;
|
|
517
|
+
}
|
|
518
|
+
value && (value = value.replace(/<[^>]+>/g, ''));
|
|
519
|
+
}
|
|
520
|
+
return value;
|
|
521
|
+
},
|
|
522
|
+
getSysCode() {
|
|
523
|
+
let { url, method, sysAppCode, param, keyWord } = this;
|
|
524
|
+
let params = {
|
|
525
|
+
url: this.baseUrl
|
|
526
|
+
? this.baseUrl + (url || findSysCode)
|
|
527
|
+
: url || findSysCode,
|
|
528
|
+
type: method,
|
|
529
|
+
params: {
|
|
530
|
+
ccCode: sysAppCode,
|
|
531
|
+
pageIndex: this.pageIndex,
|
|
532
|
+
...param
|
|
533
|
+
}
|
|
534
|
+
};
|
|
535
|
+
if (this.isSearch) {
|
|
536
|
+
params.params[this.searchKey] = keyWord;
|
|
537
|
+
}
|
|
538
|
+
this.newLoading = true;
|
|
539
|
+
request(params)
|
|
540
|
+
.then((res) => {
|
|
541
|
+
const { status, data, message, rCode, results } = res;
|
|
542
|
+
this.listLoading = false;
|
|
543
|
+
if (status == 'success' || rCode === 0 || status === true) {
|
|
544
|
+
let info = this.resultsName
|
|
545
|
+
? data
|
|
546
|
+
? data[this.resultsName]
|
|
547
|
+
: results[this.resultsName]
|
|
548
|
+
: data
|
|
549
|
+
? data
|
|
550
|
+
: results;
|
|
551
|
+
info.map((x) => {
|
|
552
|
+
if (this.isCheck) {
|
|
553
|
+
x.name =
|
|
554
|
+
x[sysAppCode ? 'shortName' : this.labelKey] &&
|
|
555
|
+
x[sysAppCode ? 'shortName' : this.labelKey].replace(
|
|
556
|
+
/<[^>]+>/g,
|
|
557
|
+
''
|
|
558
|
+
);
|
|
559
|
+
} else {
|
|
560
|
+
x.name = x[sysAppCode ? 'shortName' : this.labelKey];
|
|
561
|
+
}
|
|
562
|
+
x.value = x[sysAppCode ? 'cciValue' : this.valueKey];
|
|
563
|
+
});
|
|
564
|
+
if (data && data.totalCount) {
|
|
565
|
+
this.total = data.totalCount;
|
|
566
|
+
if (data.totalCount === this.newColumns.length) {
|
|
567
|
+
this.listFinished = true;
|
|
568
|
+
} else {
|
|
569
|
+
if (this.newColumns.length != 0) {
|
|
570
|
+
this.newColumns.push.apply(this.newColumns, info);
|
|
571
|
+
} else {
|
|
572
|
+
this.newColumns = info;
|
|
573
|
+
}
|
|
574
|
+
this.pageIndex = res.data.nextPageNo;
|
|
575
|
+
}
|
|
576
|
+
} else {
|
|
577
|
+
this.listFinished = true;
|
|
578
|
+
this.newColumns = info;
|
|
579
|
+
}
|
|
580
|
+
if (this.beforResponse) {
|
|
581
|
+
this.newColumns = this.beforResponse(this.newColumns);
|
|
582
|
+
this.getValue();
|
|
583
|
+
} else {
|
|
584
|
+
this.getValue();
|
|
585
|
+
}
|
|
586
|
+
} else {
|
|
587
|
+
this.$toast(message);
|
|
588
|
+
}
|
|
589
|
+
this.newLoading = false;
|
|
590
|
+
})
|
|
591
|
+
.catch((err) => {
|
|
592
|
+
this.$toast(err.message);
|
|
593
|
+
});
|
|
594
|
+
},
|
|
595
|
+
handlePicker() {
|
|
596
|
+
if (this.disabled || this.readonly) return;
|
|
597
|
+
this.showPicker = true;
|
|
598
|
+
this.$emit('showPicker');
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
};
|
|
602
|
+
</script>
|
|
603
|
+
|
|
604
|
+
<style></style>
|