vue2-client 1.2.90 → 1.2.93-test1

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,358 +1,367 @@
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=" attr.groupIndex>1 && (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" :files="files" :images="images"></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}_lng_lat` }"
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
- files: {
291
- type: Array,
292
- default: () => {
293
- return []
294
- }
295
- },
296
- images: {
297
- type: Array,
298
- default: () => {
299
- return []
300
- }
301
- },
302
- },
303
- created () {
304
- if (this.attr.keyName && this.attr.keyName.indexOf('logic@') !== -1) {
305
- this.getData({}, res => {
306
- this.option = res
307
- })
308
- }
309
- },
310
- methods: {
311
- // 向父组件获取级联框的数据
312
- selectsItemCheck (groupName, index, value) {
313
- this.$emit('selectsItemCheck', val => { this.selectsArray = val }, groupName, index, value)
314
- },
315
- // 文件框时设置上传组件的值
316
- setFiles (fileIds) {
317
- this.form[this.attr.model] = fileIds
318
- },
319
- // 懒加载检索方法
320
- fetchFunction (value) {
321
- this.lastFetchId += 1
322
- const fetchId = this.lastFetchId
323
- this.option = []
324
- this.searching = true
325
- this.getData({
326
- word: value
327
- }, res => {
328
- if (fetchId !== this.lastFetchId) {
329
- return
330
- }
331
- this.option = res
332
- this.searching = false
333
- })
334
- },
335
- // 获取数据
336
- getData (value, callback) {
337
- if (value !== '') {
338
- const logicName = this.attr.keyName
339
- const logic = logicName.substring(6)
340
- post('/webmeterapi/' + logic, value).then(res => {
341
- callback(res)
342
- })
343
- }
344
- },
345
- filterOption (input, option) {
346
- if (option.componentOptions.children[0].text) {
347
- return (
348
- option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
349
- )
350
- } else {
351
- return (
352
- option.componentOptions.children[0].child.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
353
- )
354
- }
355
- }
356
- }
357
- }
358
- </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="item.value">{{ item.label }}
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="item.value">
66
+ {{ item.label }}
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="item.value">{{ item.label }}
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="item.value">{{ item.label }}
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=" attr.groupIndex>1 && (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" :files="files" :images="images"></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}_lng_lat` }"
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
+ <!-- TODO 省市区选择框 -->
234
+ <x-form-col
235
+ v-else-if="attr.type === 'personSetting'"
236
+ :xl="xl"
237
+ :xxl="xxl">
238
+ <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.model">
239
+ <PersonSetting v-model="form[attr.model]" ></PersonSetting>
240
+ </a-form-model-item>
241
+ </x-form-col>
242
+ </template>
243
+ <script>
244
+
245
+ import { post } from '@vue2-client/services/api'
246
+ import { debounce } from 'ant-design-vue/lib/vc-table/src/utils'
247
+
248
+ export default {
249
+ name: 'XFormItem',
250
+ data () {
251
+ // 检索去抖
252
+ this.fetchFunction = debounce(this.fetchFunction, 800)
253
+ return {
254
+ option: [],
255
+ // 最后检索版本
256
+ lastFetchId: 0,
257
+ // 检索中
258
+ searching: false,
259
+ searchResult: ''
260
+ }
261
+ },
262
+ props: {
263
+ attr: {
264
+ type: Object,
265
+ default: () => {
266
+ return {}
267
+ }
268
+ },
269
+ form: {
270
+ type: Object,
271
+ required: true
272
+ },
273
+ disabled: {
274
+ type: Boolean,
275
+ default: () => {
276
+ return false
277
+ }
278
+ },
279
+ mode: {
280
+ type: String,
281
+ default: () => {
282
+ return '查询'
283
+ }
284
+ },
285
+ xl: {
286
+ type: Number,
287
+ default: undefined
288
+ },
289
+ xxl: {
290
+ type: Number,
291
+ default: undefined
292
+ },
293
+ selectsArray: {
294
+ type: Object,
295
+ default: () => {
296
+ return {}
297
+ }
298
+ },
299
+ files: {
300
+ type: Array,
301
+ default: () => {
302
+ return []
303
+ }
304
+ },
305
+ images: {
306
+ type: Array,
307
+ default: () => {
308
+ return []
309
+ }
310
+ },
311
+ },
312
+ created () {
313
+ if (this.attr.keyName && this.attr.keyName.indexOf('logic@') !== -1) {
314
+ this.getData({}, res => {
315
+ this.option = res
316
+ })
317
+ }
318
+ },
319
+ methods: {
320
+ // 向父组件获取级联框的数据
321
+ selectsItemCheck (groupName, index, value) {
322
+ this.$emit('selectsItemCheck', val => { this.selectsArray = val }, groupName, index, value)
323
+ },
324
+ // 文件框时设置上传组件的值
325
+ setFiles (fileIds) {
326
+ this.form[this.attr.model] = fileIds
327
+ },
328
+ // 懒加载检索方法
329
+ fetchFunction (value) {
330
+ this.lastFetchId += 1
331
+ const fetchId = this.lastFetchId
332
+ this.option = []
333
+ this.searching = true
334
+ this.getData({
335
+ word: value
336
+ }, res => {
337
+ if (fetchId !== this.lastFetchId) {
338
+ return
339
+ }
340
+ this.option = res
341
+ this.searching = false
342
+ })
343
+ },
344
+ // 获取数据
345
+ getData (value, callback) {
346
+ if (value !== '') {
347
+ const logicName = this.attr.keyName
348
+ const logic = logicName.substring(6)
349
+ post('/webmeterapi/' + logic, value).then(res => {
350
+ callback(res)
351
+ })
352
+ }
353
+ },
354
+ filterOption (input, option) {
355
+ if (option.componentOptions.children[0].text) {
356
+ return (
357
+ option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
358
+ )
359
+ } else {
360
+ return (
361
+ option.componentOptions.children[0].child.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
362
+ )
363
+ }
364
+ }
365
+ }
366
+ }
367
+ </script>