vue2-client 1.2.54 → 1.2.55-test

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.
@@ -1,348 +1,346 @@
1
- <template>
2
- <!-- 综合筛选 -->
3
- <x-form-col
4
- v-if="attr.type === 'select' && attr.model === 'rowIdValue'"
5
- :xl="xl"
6
- :xxl="xxl">
7
- <a-form-model-item
8
- :ref="attr.model"
9
- :label="attr.name"
10
- :prop="attr.model">
11
- <a-input v-model="form[attr.model]" :disabled="disabled">
12
- <a-select
13
- slot="addonBefore"
14
- :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
15
- v-model="form['rowIdName']"
16
- style="width: 100px">
17
- <a-select-option
18
- v-for="(item,index) in attr.keys"
19
- :key="index"
20
- :value="Object.keys(item)[0]">{{ item[Object.keys(item)[0]] }}
21
- </a-select-option>
22
- </a-select>
23
- </a-input>
24
- </a-form-model-item>
25
- </x-form-col>
26
- <!-- 输入框 -->
27
- <x-form-col
28
- v-else-if="attr.type === 'input'"
29
- :xl="xl"
30
- :xxl="xxl">
31
- <a-form-model-item
32
- :ref="attr.model"
33
- :label="attr.name"
34
- :prop="attr.model">
35
- <a-input v-model="form[attr.model]" :disabled="disabled" :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')"/>
36
- </a-form-model-item>
37
- </x-form-col>
38
- <!-- 下拉框 -->
39
- <x-form-col
40
- v-else-if="attr.type === 'select'"
41
- :xl="xl"
42
- :xxl="xxl">
43
- <a-form-model-item
44
- :ref="attr.model"
45
- :label="attr.name"
46
- :prop="attr.model">
47
- <a-select
48
- :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
49
- v-if="!attr.lazyLoad || attr.lazyLoad === 'false'"
50
- v-model="form[attr.model]"
51
- :disabled="disabled"
52
- :filter-option="filterOption"
53
- :placeholder="attr.placeholder ? attr.placeholder : '请选择'"
54
- show-search
55
- >
56
- <a-select-option
57
- v-if="mode === '查询'"
58
- key="999999"
59
- value="全部">全部
60
- </a-select-option>
61
- <template v-if="attr.keys">
62
- <a-select-option
63
- v-for="(item,index) in attr.keys"
64
- :key="index"
65
- :value="Object.keys(item)[0]">
66
- {{ item[Object.keys(item)[0]] }}
67
- </a-select-option>
68
- </template>
69
- <template v-else>
70
- <template v-if="attr.keyName.indexOf('logic@') !== -1">
71
- <a-select-option
72
- v-for="(item,index) in option"
73
- :key="index"
74
- :value="Object.keys(item)[0]">{{ item[Object.keys(item)[0]] }}
75
- </a-select-option>
76
- </template>
77
- <template v-else>
78
- <a-select-option
79
- v-for="item in $appdata.getDictionaryList(attr.keyName)"
80
- :key="item.value"
81
- :value="item.value">
82
- <!-- 徽标(badge) -->
83
- <x-badge :badge-key="attr.keyName" :replaceText="item.text" :value="item.value"/>
84
- </a-select-option>
85
- </template>
86
- </template>
87
- </a-select>
88
- <a-select
89
- v-else
90
- v-model="form[attr.model]"
91
- :disabled="disabled"
92
- :filter-option="filterOption"
93
- :placeholder="attr.placeholder ? attr.placeholder : '搜索' + attr.name"
94
- :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
95
- show-search
96
- @search="fetchFunction"
97
- >
98
- <a-spin v-if="searching" slot="notFoundContent" size="small" />
99
- <a-select-option
100
- v-if="mode === '查询'"
101
- key="999999"
102
- value="全部">全部
103
- </a-select-option>
104
- <a-select-option
105
- v-for="(item,index) in option"
106
- :key="index"
107
- :value="Object.keys(item)[0]">{{ item[Object.keys(item)[0]] }}
108
- </a-select-option>
109
- </a-select>
110
- </a-form-model-item>
111
- </x-form-col>
112
- <!-- 级联下拉框 -->
113
- <x-form-col
114
- :xl="xl"
115
- :xxl="xxl"
116
- v-else-if="attr.type === 'selects'">
117
- <a-form-model-item
118
- :ref="attr.model"
119
- :label="attr.name"
120
- :prop="attr.model">
121
- <a-select
122
- v-if="!attr.lazyLoad || attr.lazyLoad === 'false'"
123
- v-model="form[attr.model]"
124
- :disabled="disabled || !selectsArray[attr.group] || !selectsArray[attr.group][attr.groupIndex] || (selectsArray[attr.group][attr.groupIndex] && selectsArray[attr.group][attr.groupIndex].length === 0)"
125
- @change="selectsItemCheck(attr.group, attr.groupIndex, form[attr.model])"
126
- show-search
127
- :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
128
- :placeholder="attr.placeholder ? attr.placeholder : '请选择'"
129
- >
130
- <template v-for="optionItem in selectsArray[attr.group][attr.groupIndex]" v-if="selectsArray[attr.group].length > 0 || selectsArray[attr.group][attr.groupIndex]">
131
- <a-select-option :key="optionItem.label" :value="optionItem.value">
132
- {{ optionItem.label }}
133
- </a-select-option>
134
- </template>
135
- </a-select>
136
- </a-form-model-item>
137
- </x-form-col>
138
- <!-- TODO 多选框 -->
139
- <!-- TODO 单选框 -->
140
- <!-- 日期范围选择器 -->
141
- <x-form-col
142
- v-else-if="attr.type === 'rangePicker'"
143
- :xl="xl"
144
- :xxl="xxl">
145
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
146
- <a-range-picker v-model="form[attr.model]" :disabled="disabled" :show-time="true" valueFormat="YYYY-MM-DD HH:mm:ss"/>
147
- </a-form-model-item>
148
- </x-form-col>
149
- <!-- 月份选择器 -->
150
- <x-form-col
151
- v-else-if="attr.type === 'monthPicker'"
152
- :xl="xl"
153
- :xxl="xxl">
154
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
155
- <a-month-picker v-model="form[attr.model]" :disabled="disabled" :show-time="true" valueFormat="YYYY-MM"/>
156
- </a-form-model-item>
157
- </x-form-col>
158
- <!-- 日期选择器 -->
159
- <x-form-col
160
- v-else-if="attr.type === 'datePicker'"
161
- :xl="xl"
162
- :xxl="xxl">
163
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
164
- <a-date-picker v-model="form[attr.model]" :disabled="disabled" :show-time="true" valueFormat="YYYY-MM-DD"/>
165
- </a-form-model-item>
166
- </x-form-col>
167
- <!-- 级联选择器 -->
168
- <x-form-col
169
- v-else-if="attr.type === 'cascader'"
170
- :xl="xl"
171
- :xxl="xxl">
172
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
173
- <template v-if="attr.keys">
174
- <a-dcascader :disabled="disabled" :option="attr.keys" :value="form[attr.model]"/>
175
- </template>
176
- <template v-else>
177
- <a-dcascader :disabled="disabled" :option="option" :value="form[attr.model]"/>
178
- </template>
179
- </a-form-model-item>
180
- </x-form-col>
181
- <!-- 文本域 -->
182
- <x-form-col
183
- v-else-if="attr.type === 'textarea'"
184
- :lg="24"
185
- :md="24"
186
- :sm="24"
187
- :xl="24"
188
- :xs="24"
189
- :xxl="24">
190
- <a-form-model-item
191
- :ref="attr.model"
192
- :label="attr.name"
193
- :prop="attr.model">
194
- <a-textarea v-model="form[attr.model]" :disabled="disabled" :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')" :rows="4"/>
195
- </a-form-model-item>
196
- </x-form-col>
197
- <!-- TODO 文件上传 -->
198
- <x-form-col
199
- v-else-if="attr.type === 'file' || attr.type === 'image'"
200
- :lg="24"
201
- :md="24"
202
- :sm="24"
203
- :xl="24"
204
- :xs="24"
205
- :xxl="24">
206
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
207
- <upload :model="attr" @setFiles="setFiles"></upload>
208
- </a-form-model-item>
209
- </x-form-col>
210
- <!-- TODO 地点搜索框 -->
211
- <x-form-col
212
- v-else-if="attr.type === 'addressSearch'"
213
- :xl="xl"
214
- :xxl="xxl">
215
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
216
- <address-search-combobox
217
- v-model="searchResult"
218
- searchResultType="Object"
219
- @onSelect="form=Object.assign(form,JSON.parse(searchResult))"
220
- :resultKeys="{ address: attr.model, coords: `${attr.model}_coords` }"
221
- ></address-search-combobox>
222
- </a-form-model-item>
223
- </x-form-col>
224
- <!-- TODO 省市区选择框 -->
225
- <x-form-col
226
- v-else-if="attr.type === 'citySelect'"
227
- :xl="xl"
228
- :xxl="xxl">
229
- <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
230
- <citySelect v-model="form[attr.model]" ></citySelect>
231
- </a-form-model-item>
232
- </x-form-col>
233
- </template>
234
- <script>
235
-
236
- import { post } from '@vue2-client/services/api'
237
- import { debounce } from 'ant-design-vue/lib/vc-table/src/utils'
238
- import AddressSearchCombobox from '@/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox'
239
-
240
- export default {
241
- name: 'XFormItem',
242
- components: { AddressSearchCombobox },
243
- data () {
244
- // 检索去抖
245
- this.fetchFunction = debounce(this.fetchFunction, 800)
246
- return {
247
- option: [],
248
- // 最后检索版本
249
- lastFetchId: 0,
250
- // 检索中
251
- searching: false,
252
- searchResult: ''
253
- }
254
- },
255
- props: {
256
- attr: {
257
- type: Object,
258
- default: () => {
259
- return {}
260
- }
261
- },
262
- form: {
263
- type: Object,
264
- required: true
265
- },
266
- disabled: {
267
- type: Boolean,
268
- default: () => {
269
- return false
270
- }
271
- },
272
- mode: {
273
- type: String,
274
- default: () => {
275
- return '查询'
276
- }
277
- },
278
- xl: {
279
- type: Number,
280
- default: undefined
281
- },
282
- xxl: {
283
- type: Number,
284
- default: undefined
285
- },
286
- selectsArray: {
287
- type: Object,
288
- default: () => {
289
- return {}
290
- }
291
- }
292
- },
293
- created () {
294
- if (this.attr.keyName && this.attr.keyName.indexOf('logic@') !== -1) {
295
- this.getData({}, res => {
296
- this.option = res
297
- })
298
- }
299
- },
300
- methods: {
301
- // 向父组件获取级联框的数据
302
- selectsItemCheck (groupName, index, value) {
303
- this.$emit('selectsItemCheck', val => { this.selectsArray = val }, groupName, index, value)
304
- },
305
- // 文件框时设置上传组件的值
306
- setFiles (fileIds) {
307
- this.form[this.attr.model] = fileIds
308
- },
309
- // 懒加载检索方法
310
- fetchFunction (value) {
311
- this.lastFetchId += 1
312
- const fetchId = this.lastFetchId
313
- this.option = []
314
- this.searching = true
315
- this.getData({
316
- word: value
317
- }, res => {
318
- if (fetchId !== this.lastFetchId) {
319
- return
320
- }
321
- this.option = res
322
- this.searching = false
323
- })
324
- },
325
- // 获取数据
326
- getData (value, callback) {
327
- if (value !== '') {
328
- const logicName = this.attr.keyName
329
- const logic = logicName.substring(6)
330
- post('/webmeterapi/' + logic, value).then(res => {
331
- callback(res)
332
- })
333
- }
334
- },
335
- filterOption (input, option) {
336
- if (option.componentOptions.children[0].text) {
337
- return (
338
- option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
339
- )
340
- } else {
341
- return (
342
- option.componentOptions.children[0].child.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
343
- )
344
- }
345
- }
346
- }
347
- }
348
- </script>
1
+ <template>
2
+ <!-- 综合筛选 -->
3
+ <x-form-col
4
+ v-if="attr.type === 'select' && attr.model === 'rowIdValue'"
5
+ :xl="xl"
6
+ :xxl="xxl">
7
+ <a-form-model-item
8
+ :ref="attr.model"
9
+ :label="attr.name"
10
+ :prop="attr.model">
11
+ <a-input v-model="form[attr.model]" :disabled="disabled">
12
+ <a-select
13
+ slot="addonBefore"
14
+ :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
15
+ v-model="form['rowIdName']"
16
+ style="width: 100px">
17
+ <a-select-option
18
+ v-for="(item,index) in attr.keys"
19
+ :key="index"
20
+ :value="Object.keys(item)[0]">{{ item[Object.keys(item)[0]] }}
21
+ </a-select-option>
22
+ </a-select>
23
+ </a-input>
24
+ </a-form-model-item>
25
+ </x-form-col>
26
+ <!-- 输入框 -->
27
+ <x-form-col
28
+ v-else-if="attr.type === 'input'"
29
+ :xl="xl"
30
+ :xxl="xxl">
31
+ <a-form-model-item
32
+ :ref="attr.model"
33
+ :label="attr.name"
34
+ :prop="attr.model">
35
+ <a-input v-model="form[attr.model]" :disabled="disabled" :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')"/>
36
+ </a-form-model-item>
37
+ </x-form-col>
38
+ <!-- 下拉框 -->
39
+ <x-form-col
40
+ v-else-if="attr.type === 'select'"
41
+ :xl="xl"
42
+ :xxl="xxl">
43
+ <a-form-model-item
44
+ :ref="attr.model"
45
+ :label="attr.name"
46
+ :prop="attr.model">
47
+ <a-select
48
+ :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
49
+ v-if="!attr.lazyLoad || attr.lazyLoad === 'false'"
50
+ v-model="form[attr.model]"
51
+ :disabled="disabled"
52
+ :filter-option="filterOption"
53
+ :placeholder="attr.placeholder ? attr.placeholder : '请选择'"
54
+ show-search
55
+ >
56
+ <a-select-option
57
+ v-if="mode === '查询'"
58
+ key="999999"
59
+ value="全部">全部
60
+ </a-select-option>
61
+ <template v-if="attr.keys">
62
+ <a-select-option
63
+ v-for="(item,index) in attr.keys"
64
+ :key="index"
65
+ :value="Object.keys(item)[0]">
66
+ {{ item[Object.keys(item)[0]] }}
67
+ </a-select-option>
68
+ </template>
69
+ <template v-else>
70
+ <template v-if="attr.keyName.indexOf('logic@') !== -1">
71
+ <a-select-option
72
+ v-for="(item,index) in option"
73
+ :key="index"
74
+ :value="Object.keys(item)[0]">{{ item[Object.keys(item)[0]] }}
75
+ </a-select-option>
76
+ </template>
77
+ <template v-else>
78
+ <a-select-option
79
+ v-for="item in $appdata.getDictionaryList(attr.keyName)"
80
+ :key="item.value"
81
+ :value="item.value">
82
+ <!-- 徽标(badge) -->
83
+ <x-badge :badge-key="attr.keyName" :replaceText="item.text" :value="item.value"/>
84
+ </a-select-option>
85
+ </template>
86
+ </template>
87
+ </a-select>
88
+ <a-select
89
+ v-else
90
+ v-model="form[attr.model]"
91
+ :disabled="disabled"
92
+ :filter-option="filterOption"
93
+ :placeholder="attr.placeholder ? attr.placeholder : '搜索' + attr.name"
94
+ :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
95
+ show-search
96
+ @search="fetchFunction"
97
+ >
98
+ <a-spin v-if="searching" slot="notFoundContent" size="small" />
99
+ <a-select-option
100
+ v-if="mode === '查询'"
101
+ key="999999"
102
+ value="全部">全部
103
+ </a-select-option>
104
+ <a-select-option
105
+ v-for="(item,index) in option"
106
+ :key="index"
107
+ :value="Object.keys(item)[0]">{{ item[Object.keys(item)[0]] }}
108
+ </a-select-option>
109
+ </a-select>
110
+ </a-form-model-item>
111
+ </x-form-col>
112
+ <!-- 级联下拉框 -->
113
+ <x-form-col
114
+ :xl="xl"
115
+ :xxl="xxl"
116
+ v-else-if="attr.type === 'selects'">
117
+ <a-form-model-item
118
+ :ref="attr.model"
119
+ :label="attr.name"
120
+ :prop="attr.model">
121
+ <a-select
122
+ v-if="!attr.lazyLoad || attr.lazyLoad === 'false'"
123
+ v-model="form[attr.model]"
124
+ :disabled="disabled || !selectsArray[attr.group] || !selectsArray[attr.group][attr.groupIndex] || (selectsArray[attr.group][attr.groupIndex] && selectsArray[attr.group][attr.groupIndex].length === 0)"
125
+ @change="selectsItemCheck(attr.group, attr.groupIndex, form[attr.model])"
126
+ show-search
127
+ :getPopupContainer=" triggerNode => { return triggerNode.parentNode } "
128
+ :placeholder="attr.placeholder ? attr.placeholder : '请选择'"
129
+ >
130
+ <template v-for="optionItem in selectsArray[attr.group][attr.groupIndex]" v-if="selectsArray[attr.group].length > 0 || selectsArray[attr.group][attr.groupIndex]">
131
+ <a-select-option :key="optionItem.label" :value="optionItem.value">
132
+ {{ optionItem.label }}
133
+ </a-select-option>
134
+ </template>
135
+ </a-select>
136
+ </a-form-model-item>
137
+ </x-form-col>
138
+ <!-- TODO 多选框 -->
139
+ <!-- TODO 单选框 -->
140
+ <!-- 日期范围选择器 -->
141
+ <x-form-col
142
+ v-else-if="attr.type === 'rangePicker'"
143
+ :xl="xl"
144
+ :xxl="xxl">
145
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
146
+ <a-range-picker v-model="form[attr.model]" :disabled="disabled" :show-time="true" valueFormat="YYYY-MM-DD HH:mm:ss"/>
147
+ </a-form-model-item>
148
+ </x-form-col>
149
+ <!-- 月份选择器 -->
150
+ <x-form-col
151
+ v-else-if="attr.type === 'monthPicker'"
152
+ :xl="xl"
153
+ :xxl="xxl">
154
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
155
+ <a-month-picker v-model="form[attr.model]" :disabled="disabled" :show-time="true" valueFormat="YYYY-MM"/>
156
+ </a-form-model-item>
157
+ </x-form-col>
158
+ <!-- 日期选择器 -->
159
+ <x-form-col
160
+ v-else-if="attr.type === 'datePicker'"
161
+ :xl="xl"
162
+ :xxl="xxl">
163
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
164
+ <a-date-picker v-model="form[attr.model]" :disabled="disabled" :show-time="true" valueFormat="YYYY-MM-DD"/>
165
+ </a-form-model-item>
166
+ </x-form-col>
167
+ <!-- 级联选择器 -->
168
+ <x-form-col
169
+ v-else-if="attr.type === 'cascader'"
170
+ :xl="xl"
171
+ :xxl="xxl">
172
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
173
+ <template v-if="attr.keys">
174
+ <a-dcascader :disabled="disabled" :option="attr.keys" :value="form[attr.model]"/>
175
+ </template>
176
+ <template v-else>
177
+ <a-dcascader :disabled="disabled" :option="option" :value="form[attr.model]"/>
178
+ </template>
179
+ </a-form-model-item>
180
+ </x-form-col>
181
+ <!-- 文本域 -->
182
+ <x-form-col
183
+ v-else-if="attr.type === 'textarea'"
184
+ :lg="24"
185
+ :md="24"
186
+ :sm="24"
187
+ :xl="24"
188
+ :xs="24"
189
+ :xxl="24">
190
+ <a-form-model-item
191
+ :ref="attr.model"
192
+ :label="attr.name"
193
+ :prop="attr.model">
194
+ <a-textarea v-model="form[attr.model]" :disabled="disabled" :placeholder="attr.placeholder ? attr.placeholder : '请输入'+attr.name.replace(/\s*/g, '')" :rows="4"/>
195
+ </a-form-model-item>
196
+ </x-form-col>
197
+ <!-- TODO 文件上传 -->
198
+ <x-form-col
199
+ v-else-if="attr.type === 'file' || attr.type === 'image'"
200
+ :lg="24"
201
+ :md="24"
202
+ :sm="24"
203
+ :xl="24"
204
+ :xs="24"
205
+ :xxl="24">
206
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
207
+ <upload :model="attr" @setFiles="setFiles"></upload>
208
+ </a-form-model-item>
209
+ </x-form-col>
210
+ <!-- TODO 地点搜索框 -->
211
+ <x-form-col
212
+ v-else-if="attr.type === 'addressSearch'"
213
+ :xl="xl"
214
+ :xxl="xxl">
215
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
216
+ <address-search-combobox
217
+ v-model="searchResult"
218
+ searchResultType="Object"
219
+ @onSelect="form=Object.assign(form,JSON.parse(searchResult))"
220
+ :resultKeys="{ address: attr.model, coords: `${attr.model}_coords` }"
221
+ ></address-search-combobox>
222
+ </a-form-model-item>
223
+ </x-form-col>
224
+ <!-- TODO 省市区选择框 -->
225
+ <x-form-col
226
+ v-else-if="attr.type === 'citySelect'"
227
+ :xl="xl"
228
+ :xxl="xxl">
229
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
230
+ <citySelect v-model="form[attr.model]" ></citySelect>
231
+ </a-form-model-item>
232
+ </x-form-col>
233
+ </template>
234
+ <script>
235
+
236
+ import { post } from '@vue2-client/services/api'
237
+ import { debounce } from 'ant-design-vue/lib/vc-table/src/utils'
238
+
239
+ export default {
240
+ name: 'XFormItem',
241
+ data () {
242
+ // 检索去抖
243
+ this.fetchFunction = debounce(this.fetchFunction, 800)
244
+ return {
245
+ option: [],
246
+ // 最后检索版本
247
+ lastFetchId: 0,
248
+ // 检索中
249
+ searching: false,
250
+ searchResult: ''
251
+ }
252
+ },
253
+ props: {
254
+ attr: {
255
+ type: Object,
256
+ default: () => {
257
+ return {}
258
+ }
259
+ },
260
+ form: {
261
+ type: Object,
262
+ required: true
263
+ },
264
+ disabled: {
265
+ type: Boolean,
266
+ default: () => {
267
+ return false
268
+ }
269
+ },
270
+ mode: {
271
+ type: String,
272
+ default: () => {
273
+ return '查询'
274
+ }
275
+ },
276
+ xl: {
277
+ type: Number,
278
+ default: undefined
279
+ },
280
+ xxl: {
281
+ type: Number,
282
+ default: undefined
283
+ },
284
+ selectsArray: {
285
+ type: Object,
286
+ default: () => {
287
+ return {}
288
+ }
289
+ }
290
+ },
291
+ created () {
292
+ if (this.attr.keyName && this.attr.keyName.indexOf('logic@') !== -1) {
293
+ this.getData({}, res => {
294
+ this.option = res
295
+ })
296
+ }
297
+ },
298
+ methods: {
299
+ // 向父组件获取级联框的数据
300
+ selectsItemCheck (groupName, index, value) {
301
+ this.$emit('selectsItemCheck', val => { this.selectsArray = val }, groupName, index, value)
302
+ },
303
+ // 文件框时设置上传组件的值
304
+ setFiles (fileIds) {
305
+ this.form[this.attr.model] = fileIds
306
+ },
307
+ // 懒加载检索方法
308
+ fetchFunction (value) {
309
+ this.lastFetchId += 1
310
+ const fetchId = this.lastFetchId
311
+ this.option = []
312
+ this.searching = true
313
+ this.getData({
314
+ word: value
315
+ }, res => {
316
+ if (fetchId !== this.lastFetchId) {
317
+ return
318
+ }
319
+ this.option = res
320
+ this.searching = false
321
+ })
322
+ },
323
+ // 获取数据
324
+ getData (value, callback) {
325
+ if (value !== '') {
326
+ const logicName = this.attr.keyName
327
+ const logic = logicName.substring(6)
328
+ post('/webmeterapi/' + logic, value).then(res => {
329
+ callback(res)
330
+ })
331
+ }
332
+ },
333
+ filterOption (input, option) {
334
+ if (option.componentOptions.children[0].text) {
335
+ return (
336
+ option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
337
+ )
338
+ } else {
339
+ return (
340
+ option.componentOptions.children[0].child.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
341
+ )
342
+ }
343
+ }
344
+ }
345
+ }
346
+ </script>