vue2-client 1.2.55-test1 → 1.2.55-test2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.2.55-test1",
3
+ "version": "1.2.55-test2",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -50,11 +50,26 @@ export default {
50
50
  default: () => {
51
51
  return {}
52
52
  }
53
+ },
54
+ files: {
55
+ type: Array,
56
+ default: () => {
57
+ return []
58
+ }
59
+ },
60
+ images: {
61
+ type: Array,
62
+ default: () => {
63
+ return []
64
+ }
53
65
  }
54
66
  },
55
67
  computed: {
56
68
  ...mapState('account', { currUser: 'user' })
57
69
  },
70
+ created () {
71
+ this.uploadedFileList = this.mode.type === 'file' ? [...this.files] : [...this.images]
72
+ },
58
73
  methods: {
59
74
  uploadFiles (info) {
60
75
  // 初始化文件信息
@@ -20,6 +20,8 @@
20
20
  v-for="(item, index) in realJsonData"
21
21
  mode="新增/修改"
22
22
  :attr="item"
23
+ :files="files"
24
+ :images="images"
23
25
  :form="form"
24
26
  :key="index"
25
27
  :disabled="itemDisabled(item)"
@@ -54,6 +56,9 @@ export default {
54
56
  SelectsArray: { },
55
57
  // 多层下拉框组 各组数量
56
58
  SelectsNumber: {},
59
+ // 修改有文件得表单是使用
60
+ files: [],
61
+ images: [],
57
62
  // 校验
58
63
  rules: {},
59
64
  // 图标样式
@@ -252,6 +257,9 @@ export default {
252
257
  }
253
258
  }
254
259
  this.form = formData
260
+ this.files = this.modifyModelData.files
261
+ this.images = this.modifyModelData.images
262
+ this.modifyModelData = this.modifyModelData.data
255
263
  if (Object.keys(this.modifyModelData).length > 0) {
256
264
  this.getModifyModelData()
257
265
  }
@@ -1,346 +1,358 @@
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>
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" :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}_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
+ 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>
@@ -335,7 +335,7 @@ export default {
335
335
  }
336
336
  this.editDataLoading = true
337
337
  queryWithResource(requestParameters).then(res => {
338
- this.modifyModelData = res.data[0]
338
+ this.modifyModelData = { data: res.data[0], images: res.images, files: res.files }
339
339
  this.modelVisible = true
340
340
  this.editDataLoading = false
341
341
  console.warn(this.modifyModelData)