vue2-client 1.2.8 → 1.2.9

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 CHANGED
@@ -1,6 +1,14 @@
1
1
  # Change Log
2
2
  > 所有关于本项目的变化都在该文档里。
3
3
 
4
+ **##1.2.9 -2022-03-24 @江超**
5
+ - 功能新增:
6
+ - [查询配置生成]:下拉框表单选择业务逻辑作为数据源时,可以选择数据源加载方式
7
+ - [XFormItem]:当数据源加载方式为懒加载搜索时,将渲染一个可以根据关键词实时查询的选择框
8
+ - 问题修复:
9
+ - [查询配置生成]:修复修改已有查询配置时,显示状态不一致的问题
10
+ - [指令详情页]:修复操作记录查询报错的问题
11
+
4
12
  **##1.2.8 -2022-03-24 @江超**
5
13
  - 问题修复:
6
14
  - [登录页面]:修复登录后欢迎提示出现undefined的问题
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.2.8",
3
+ "version": "1.2.9",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -314,7 +314,7 @@
314
314
  <a-popover slot="suffix" title="关于组别内顺序" placement="bottom">
315
315
  <template slot="content">
316
316
  <p>多个下拉框为一组时,按照此顺序判断页面如何展示以及下拉框得父子顺序</p>
317
- <p>只有顺序为1得数据字段才可以选择数据源类型</p>
317
+ <p>只有顺序为1的数据字段才可以选择数据源类型</p>
318
318
  </template>
319
319
  <a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
320
320
  </a-popover>
@@ -397,6 +397,20 @@
397
397
  </a-form-model-item>
398
398
  </a-col>
399
399
  </a-row>
400
+ <a-form-model-item label="数据源加载方式" prop="selectLoadType" v-if="item.formType === 'select' && item.selectType === 'logic'">
401
+ <a-row :guttor="16">
402
+ <a-col :span="8">
403
+ <a-radio-group v-model="item.lazyLoad" default-value="false" button-style="solid">
404
+ <a-radio-button value="true">
405
+ 懒加载搜索
406
+ </a-radio-button>
407
+ <a-radio-button value="false">
408
+ 一次性加载
409
+ </a-radio-button>
410
+ </a-radio-group>
411
+ </a-col>
412
+ </a-row>
413
+ </a-form-model-item>
400
414
  <a-form-model-item label="表单校验类型" prop="rule">
401
415
  <a-row :gutter="16">
402
416
  <a-col :span="8" v-if="item.formType === 'input' || item.formType === 'textarea'">
@@ -420,7 +434,7 @@
420
434
  </a-select>
421
435
  </a-col>
422
436
  <a-col :span="8">
423
- <a-radio-group v-model="item.rule.required" default-value="true" button-style="solid">
437
+ <a-radio-group v-model="item.rule.required" default-value="false" button-style="solid">
424
438
  <a-radio-button value="true">
425
439
  必选项
426
440
  </a-radio-button>
@@ -648,7 +662,9 @@ export default {
648
662
  key: '',
649
663
  title: '',
650
664
  slot: {},
651
- rule: {},
665
+ rule: {
666
+ required: 'false'
667
+ },
652
668
  dataModeArray: []
653
669
  },
654
670
  itemMap: {},
@@ -804,11 +820,16 @@ export default {
804
820
  // 必选项兼容处理
805
821
  if (columnItem.rule && !isNaN(columnItem.rule.required)) {
806
822
  columnItem.rule.required = columnItem.rule.required.toString()
823
+ } else {
824
+ if (!columnItem.rule) {
825
+ columnItem.rule = {}
826
+ }
827
+ columnItem.rule.required = 'false'
807
828
  }
808
829
  // 下拉框数据源兼容处理
809
830
  if ((columnItem.formType === 'select' || columnItem.formType === 'cascader') && columnItem.selectKey) {
810
831
  // 数据源为logic
811
- if (columnItem.selectKey instanceof String && columnItem.selectKey.startsWith('logic@')) {
832
+ if (columnItem.selectKey.toString().startsWith('logic@')) {
812
833
  columnItem.selectType = 'logic'
813
834
  } else if (columnItem.selectKey instanceof Array || this.isJSON(columnItem.selectKey)) {
814
835
  // 数据源为固定json集合
@@ -824,7 +845,9 @@ export default {
824
845
  key: '',
825
846
  title: '',
826
847
  slot: {},
827
- rule: {},
848
+ rule: {
849
+ required: 'false'
850
+ },
828
851
  dataModeArray: []
829
852
  }, columnItem)
830
853
  }
@@ -836,6 +859,8 @@ export default {
836
859
  this.buttonStateData.push(buttonStateKey)
837
860
  }
838
861
  }
862
+ } else {
863
+ this.buttonStateData = ['add', 'edit', 'delete', 'export']
839
864
  }
840
865
  }
841
866
  }
@@ -968,14 +993,10 @@ export default {
968
993
  delete item.formType
969
994
  }
970
995
  // 校验类型
971
- if (!item.rule.type) {
972
- delete item.rule
996
+ if (item.rule.required) {
997
+ item.rule.required = item.rule.required.toString() === 'true'
973
998
  } else {
974
- if (item.rule.required) {
975
- item.rule.required = item.rule.required.toString() === 'true'
976
- } else {
977
- item.rule.required = true
978
- }
999
+ item.rule.required = false
979
1000
  }
980
1001
  // 下拉框
981
1002
  if ((item.formType === 'select' || (item.formType === 'selects' && item.groupIndex == '1') || item.formType === 'cascader') && item.selectKey) {
@@ -1056,7 +1077,9 @@ export default {
1056
1077
  key: '',
1057
1078
  title: '',
1058
1079
  slot: {},
1059
- rule: {},
1080
+ rule: {
1081
+ required: 'false'
1082
+ },
1060
1083
  dataModeArray: []
1061
1084
  }
1062
1085
  this.$message.success('增加成功')
@@ -1130,7 +1153,9 @@ export default {
1130
1153
  key: '',
1131
1154
  title: '',
1132
1155
  slot: {},
1133
- rule: {},
1156
+ rule: {
1157
+ required: 'false'
1158
+ },
1134
1159
  dataModeArray: []
1135
1160
  }
1136
1161
  this.dataModeArrayData = ['queryForm', 'table', 'addOrEditForm', 'sqlQueryItem', 'sqlQueryCondition']
@@ -81,12 +81,17 @@
81
81
  <a-select v-model="item.formType" placeholder="表单类型,可选">
82
82
  <a-select-option key="input">输入框</a-select-option>
83
83
  <a-select-option key="select">选择框</a-select-option>
84
+ <a-select-option key="checkbox">多选框</a-select-option>
85
+ <a-select-option key="radio">单选框</a-select-option>
84
86
  <a-select-option key="rangePicker">日期范围选择框</a-select-option>
85
87
  <a-select-option key="monthPicker">月份选择框</a-select-option>
86
88
  <a-select-option key="datePicker">单日选择框</a-select-option>
87
- <a-select-option key="cascader">级联选择框</a-select-option>
89
+ <a-select-option key="cascader">级联选择框(单个下拉)</a-select-option>
90
+ <a-select-option key="selects">级联选择框(多个下拉)</a-select-option>
88
91
  <a-select-option key="textarea">文本域</a-select-option>
89
- <a-popover slot="suffixIcon" title="关于表单类型" placement="bottom">
92
+ <a-select-option key="file">文件上传</a-select-option>
93
+ <a-select-option key="image">图片上传</a-select-option>
94
+ <a-popover slot="suffixIcon" title="关于表单类型" placement="right">
90
95
  <template slot="content">
91
96
  <p>预览设置的表单类型</p>
92
97
  <a-input-group compact style="width: 400px;">
@@ -99,6 +104,16 @@
99
104
  <a-select style="width: 80%" placeholder="请选择"/>
100
105
  </a-input-group>
101
106
  <br/>
107
+ <a-input-group compact style="width: 400px;">
108
+ <a-input value="多选框" style="width: 20%" readOnly/>
109
+ <a-checkbox-group style="margin-left: 10px;margin-top: 5px; width: 70%" :options="['数据1','数据2']"/>
110
+ </a-input-group>
111
+ <br/>
112
+ <a-input-group compact style="width: 400px;">
113
+ <a-input value="单选框" style="width: 20%" readOnly/>
114
+ <a-radio-group style="margin-left: 10px;margin-top: 5px; width: 70%" :options="[{label: '数据1', value: 'a'},{label: '数据2', value: 'b'}]" name="radioGroup" />
115
+ </a-input-group>
116
+ <br/>
102
117
  <a-input-group compact style="width: 400px;">
103
118
  <a-input value="日期范围选择框" style="width: 20%" readOnly/>
104
119
  <a-range-picker style="width: 80%" :show-time="true" format="YYYY-MM-DD HH:mm:ss" valueFormat="YYYY-MM-DD HH:mm:ss" />
@@ -118,9 +133,39 @@
118
133
  <a-input value="级联选择框" style="width: 20%" readOnly/>
119
134
  <a-cascader style="width: 80%" placeholder="请选择"/>
120
135
  </a-input-group>
136
+ <br/>
121
137
  <a-input-group compact style="width: 400px;">
122
138
  <a-input value="文本域" style="width: 20%" readOnly/>
123
- <a-textarea style="width: 80%" placeholder="请输入" :rows="4"/>
139
+ <a-textarea style="width: 80%" placeholder="请输入" :rows="1"/>
140
+ </a-input-group>
141
+ <br/>
142
+ <a-input-group compact style="width: 400px;">
143
+ <a-input value="文件上传" style="width: 20%" readOnly/>
144
+ <a-upload-dragger
145
+ name="file"
146
+ :multiple="true"
147
+ style="margin-left: 5px; width: 75%"
148
+ action="https://www.mocky.io/v2/5cc8019d300000980a055e76">
149
+ <p class="ant-upload-drag-icon">
150
+ <a-icon type="inbox" />
151
+ </p>
152
+ <p class="ant-upload-text">
153
+ 点击或拖动文件到该区域上传
154
+ </p>
155
+ <p class="ant-upload-hint">
156
+ 支持单个或多个文件
157
+ </p>
158
+ </a-upload-dragger>
159
+ </a-input-group>
160
+ <br/>
161
+ <a-input-group compact style="width: 400px;">
162
+ <a-input value="图片上传" style="width: 20%" readOnly/>
163
+ <a-upload style="margin-left: 5px; width: 75%" list-type="picture-card" :file-list="[]">
164
+ <a-icon type="plus" />
165
+ <div class="ant-upload-text">
166
+ Upload
167
+ </div>
168
+ </a-upload>
124
169
  </a-input-group>
125
170
  </template>
126
171
  <a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
@@ -129,14 +174,112 @@
129
174
  </a-form-model-item>
130
175
  </a-col>
131
176
  <a-col :span="8">
132
- <a-form-model-item label="表单水印" prop="placeholder">
177
+ <a-form-model-item
178
+ label="表单水印"
179
+ prop="placeholder"
180
+ v-if="item.formType !== 'checkbox' && item.formType !== 'radio' && item.formType !== 'file' && item.formType !== 'image'">
133
181
  <a-input v-model="item.placeholder" placeholder="表单水印(placeholder),可选" />
134
182
  </a-form-model-item>
135
183
  </a-col>
136
184
  </a-row>
185
+ <a-row :gutter="16" v-if="item.formType === 'file' || item.formType === 'image'">
186
+ <a-col :span="8">
187
+ <a-form-model-item
188
+ label="允许上传文件数量"
189
+ prop="accept"
190
+ v-if="item.formType === 'file' || item.formType === 'image'">
191
+ <a-slider
192
+ v-model="item.acceptCount"
193
+ :min="1"
194
+ :max="20"
195
+ :marks="{ 1: '1', 3: '3', 5: '5', 10: '10', 15: '15', 20: '20'}"
196
+ :default-value="3"
197
+ />
198
+ </a-form-model-item>
199
+ </a-col>
200
+ <a-col :span="8">
201
+ <a-form-model-item
202
+ label="文件上传模式"
203
+ prop="resUploadMode"
204
+ v-if="item.formType === 'file' || item.formType === 'image'">
205
+ <a-select v-model="item.resUploadMode" placeholder="文件上传模式,默认为服务器" @change="changeFormType(item)">
206
+ <a-select-option key="server">服务器</a-select-option>
207
+ <a-select-option key="oss">腾讯云对象存储</a-select-option>
208
+ <a-select-option key="base64" :disabled="item.formType === 'file'">Base64</a-select-option>
209
+ <a-popover slot="suffixIcon" title="关于资源上传模式" placement="right">
210
+ <template slot="content">
211
+ <p>指定文件上传到服务器,对象存储还是以base64方式存储</p>
212
+ <br/>
213
+ <p><span style="font-weight: bold">服务器:</span>文件上传到服务器,数据库需存储文件于服务器的路径</p>
214
+ <p><span style="font-weight: bold">对象存储:</span>文件上传到云对象存储,数据库需存储文件于对象存储的路径</p>
215
+ <p><span style="font-weight: bold">base64:</span>文件以base64字符串方式存入数据库中(仅图片上传表单支持)</p>
216
+ </template>
217
+ <a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
218
+ </a-popover>
219
+ </a-select>
220
+ </a-form-model-item>
221
+ </a-col>
222
+ <a-col :span="8">
223
+ <a-form-model-item
224
+ label="允许上传文件类型"
225
+ prop="accept"
226
+ v-if="item.formType === 'file'">
227
+ <a-input v-model="item.accept" placeholder="指定文件类型,默认不限制,可选">
228
+ <a-popover slot="suffix" title="关于允许上传文件类型" placement="bottom">
229
+ <template slot="content">
230
+ <p>指定允许上传的文件类型扩展名,如:.doc,.docx等,详情请参考<a target="_blank" @click="visitAcceptFile">允许上传文件类型</a></p>
231
+ </template>
232
+ <a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
233
+ </a-popover>
234
+ </a-input>
235
+ </a-form-model-item>
236
+ </a-col>
237
+ <!-- TODO 配置文件上传表单-所属模块 -->
238
+ <!-- TODO 配置文件上传表单-上传扩展目录Key -->
239
+ </a-row>
240
+ <a-row :gutter="16" v-if="item.formType === 'selects'">
241
+ <a-col :span="8">
242
+ <a-form-model-item label="数据所属组别" prop="group">
243
+ <a-select v-model="item.group" placeholder="请输入数据字段名" ref="group">
244
+ <a-select-option v-for="i in groupArray" :key="i">{{ i }}</a-select-option>
245
+ <a-popover slot="suffixIcon" title="关于所属组别" placement="bottom">
246
+ <template slot="content">
247
+ <p>多个下拉框时按照次组别归为一组</p>
248
+ </template>
249
+ <a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
250
+ </a-popover>
251
+ </a-select>
252
+ </a-form-model-item>
253
+ </a-col>
254
+ <a-col :span="8">
255
+ <a-form-model-item label="组别内顺序" prop="groupIndex">
256
+ <a-select v-model="item.groupIndex" placeholder="表单类型,可选">
257
+ <template v-for="i in 5">
258
+ <a-select-option :key="i">{{ i }}</a-select-option>
259
+ </template>
260
+ <a-popover slot="suffix" title="关于组别内顺序" placement="bottom">
261
+ <template slot="content">
262
+ <p>多个下拉框为一组时,按照此顺序判断页面如何展示以及下拉框得父子顺序</p>
263
+ <p>只有顺序为1的数据字段才可以选择数据源类型</p>
264
+ </template>
265
+ <a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
266
+ </a-popover>
267
+ </a-select>
268
+ </a-form-model-item>
269
+ </a-col>
270
+ <a-col :span="8">
271
+ <a-form-model-item label="增加组" prop="groupName">
272
+ <a-input-search v-model="item.groupName" @search="addGroupName" placeholder="请输入数据字段名" ref="key">
273
+ <a-button slot="enterButton">
274
+ 新增
275
+ </a-button>
276
+ </a-input-search>
277
+ </a-form-model-item>
278
+ </a-col>
279
+ </a-row>
137
280
  <a-row :gutter="16">
138
281
  <a-col :span="8">
139
- <a-form-model-item label="数据源类型" prop="selectType" v-if="item.formType === 'select' || item.formType === 'cascader'">
282
+ <a-form-model-item label="数据源类型" prop="selectType" v-if="item.formType === 'select' || (item.formType === 'selects' && item.groupIndex == 1) || item.formType === 'cascader'">
140
283
  <a-select v-model="item.selectType" placeholder="请选择数据源类型" @change="changeSelectKey(item)">
141
284
  <a-select-option key="key">字典键</a-select-option>
142
285
  <a-select-option key="fixArray">固定集合</a-select-option>
@@ -149,8 +292,11 @@
149
292
  <p>设置下拉框或级联框的数据源</p>
150
293
  <p>数据源类型分为三种,你可以根据需要选择</p>
151
294
  <p>字典键:选项从字典表(t_dictionary)获取,你只需要选择字典键的名称即可</p>
152
- <p>业务逻辑名称:选项通过发起http请求调用指定的Logic接口获取</p>
295
+ <p>业务逻辑名称:选项通过发起http请求调用指定的业务逻辑(Logic)接口获取</p>
153
296
  <p>固定集合:选项为静态值,JSONArray格式</p>
297
+ <p>当表单类型为 " 级联选择框(多个下拉) " 是数据模式为 [{lable,value,children[{lable,value,children[]},{lable,value,children[]}]}] 形式</p>
298
+ <p>如:</p>
299
+ <json-viewer :value="DemoJson" :expand-depth="parseInt('100')" style="overflow: auto;max-height: 440px"></json-viewer>
154
300
  </template>
155
301
  <a-icon type="info-circle" style="color: rgba(0,0,0,.45)" />
156
302
  </a-popover>
@@ -158,7 +304,7 @@
158
304
  </a-form-model-item>
159
305
  </a-col>
160
306
  <a-col :span="8">
161
- <a-form-model-item label="数据源" prop="selectKey" v-if="(item.formType === 'select' || item.formType === 'cascader') && item.selectType">
307
+ <a-form-model-item label="数据源" prop="selectKey" v-if="(item.formType === 'select' || (item.formType === 'selects' && item.groupIndex == 1) || item.formType === 'cascader') && item.selectType">
162
308
  <a-select
163
309
  show-search
164
310
  v-model="item.selectKey"
@@ -180,9 +326,23 @@
180
326
  </a-form-model-item>
181
327
  </a-col>
182
328
  </a-row>
329
+ <a-form-model-item label="数据源加载方式" prop="selectLoadType" v-if="item.formType === 'select' && item.selectType === 'logic'">
330
+ <a-row :guttor="16">
331
+ <a-col :span="8">
332
+ <a-radio-group v-model="item.lazyLoad" default-value="false" button-style="solid">
333
+ <a-radio-button value="true">
334
+ 懒加载搜索
335
+ </a-radio-button>
336
+ <a-radio-button value="false">
337
+ 一次性加载
338
+ </a-radio-button>
339
+ </a-radio-group>
340
+ </a-col>
341
+ </a-row>
342
+ </a-form-model-item>
183
343
  <a-form-model-item label="表单校验类型" prop="rule">
184
344
  <a-row :gutter="16">
185
- <a-col :span="8">
345
+ <a-col :span="8" v-if="item.formType === 'input' || item.formType === 'textarea'">
186
346
  <a-select v-model="item.rule.type" placeholder="校验类型,可选">
187
347
  <a-select-option key="string">字符串</a-select-option>
188
348
  <a-select-option key="number">数字</a-select-option>
@@ -203,7 +363,7 @@
203
363
  </a-select>
204
364
  </a-col>
205
365
  <a-col :span="8">
206
- <a-radio-group v-model="item.rule.required" v-if="item.rule.type" default-value="true" button-style="solid">
366
+ <a-radio-group v-model="item.rule.required" default-value="false" button-style="solid">
207
367
  <a-radio-button value="true">
208
368
  必选项
209
369
  </a-radio-button>
@@ -238,10 +398,11 @@
238
398
  import XAddForm from '@vue2-client/base-client/components/common/XAddForm/XAddForm'
239
399
  import JsonViewer from 'vue-json-viewer'
240
400
  import FileSaver from 'file-saver'
401
+ import { queryType } from '@/config/CreateQueryConfig'
241
402
  import { mapState } from 'vuex'
242
403
  import { post } from '@vue2-client/services/api/restTools'
243
404
  import { commonApi } from '@vue2-client/services/api/common'
244
-
405
+ const DemoJson = [{ value: 'zhejiang', label: 'Zhejiang', children: [{ value: 'hangzhou', label: 'Hangzhou', children: [{ value: 'xihu', label: 'West Lake' }] }] }]
245
406
  export default {
246
407
  name: 'CreateSimpleFormQuery',
247
408
  components: {
@@ -250,6 +411,7 @@ export default {
250
411
  },
251
412
  data () {
252
413
  return {
414
+ DemoJson,
253
415
  // 页面宽度
254
416
  screenWidth: document.documentElement.clientWidth,
255
417
  // 效果预览模态框是否展示
@@ -269,11 +431,15 @@ export default {
269
431
  item: {
270
432
  key: '',
271
433
  title: '',
272
- rule: {}
434
+ rule: {
435
+ required: 'false'
436
+ }
273
437
  },
274
438
  itemMap: {},
275
439
  selectIndex: null,
276
440
  selectType: undefined,
441
+ joinArray: [],
442
+ groupArray: ['默认组别'],
277
443
  rules: {
278
444
  group: [{ required: true, message: '请输入参数组名称', trigger: 'blur' }],
279
445
  describe: [{ required: true, message: '请输入参数组描述', trigger: 'blur' }]
@@ -293,7 +459,13 @@ export default {
293
459
  this.initView()
294
460
  },
295
461
  computed: {
296
- ...mapState('setting', ['isMobile'])
462
+ ...mapState('setting', ['isMobile']),
463
+ queryTypeV () {
464
+ if (this.item.formType) {
465
+ return queryType.filter(item => item.match.includes(this.item.formType))
466
+ }
467
+ return queryType
468
+ }
297
469
  },
298
470
  props: {
299
471
  visible: {
@@ -322,11 +494,16 @@ export default {
322
494
  // 必选项兼容处理
323
495
  if (columnItem.rule && !isNaN(columnItem.rule.required)) {
324
496
  columnItem.rule.required = columnItem.rule.required.toString()
497
+ } else {
498
+ if (!columnItem.rule) {
499
+ columnItem.rule = {}
500
+ }
501
+ columnItem.rule.required = 'false'
325
502
  }
326
503
  // 下拉框数据源兼容处理
327
504
  if ((columnItem.formType === 'select' || columnItem.formType === 'cascader') && columnItem.selectKey) {
328
505
  // 数据源为logic
329
- if (columnItem.selectKey instanceof String && columnItem.selectKey.startsWith('logic@')) {
506
+ if (columnItem.selectKey.toString().startsWith('logic@')) {
330
507
  columnItem.selectType = 'logic'
331
508
  } else if (columnItem.selectKey instanceof Array || this.isJSON(columnItem.selectKey)) {
332
509
  // 数据源为固定json集合
@@ -341,13 +518,22 @@ export default {
341
518
  this.itemMap[columnItem.key] = Object.assign({
342
519
  key: '',
343
520
  title: '',
344
- rule: {}
521
+ rule: {
522
+ required: 'false'
523
+ }
345
524
  }, columnItem)
346
525
  }
347
526
  }
348
527
  }
349
528
  },
350
529
  methods: {
530
+ // 添加多个下拉框分组标识符
531
+ addGroupName (val) {
532
+ this.item.groupName = undefined
533
+ if (!this.groupArray.find(item => item === val)) {
534
+ this.groupArray.push(val)
535
+ }
536
+ },
351
537
  // 初始化组件
352
538
  initView () {
353
539
  this.result = {}
@@ -424,20 +610,19 @@ export default {
424
610
  delete item.formType
425
611
  }
426
612
  // 校验类型
427
- if (!item.rule.type) {
428
- delete item.rule
613
+ if (item.rule.required) {
614
+ item.rule.required = item.rule.required.toString() === 'true'
429
615
  } else {
430
- if (item.rule.required) {
431
- item.rule.required = item.rule.required.toString() === 'true'
432
- } else {
433
- item.rule.required = true
434
- }
616
+ item.rule.required = false
435
617
  }
436
618
  // 下拉框
437
- if ((item.formType === 'select' || item.formType === 'cascader') && item.selectKey) {
619
+ if ((item.formType === 'select' || (item.formType === 'selects' && item.groupIndex == '1') || item.formType === 'cascader') && item.selectKey) {
438
620
  // 数据源为logic
439
621
  if (item.selectType === 'logic') {
440
- item.selectKey = 'logic@' + item.selectKey
622
+ // 如果已经有了 logic@ 将不再拼接
623
+ if (item.selectKey.substring(0, 6) !== 'logic@') {
624
+ item.selectKey = 'logic@' + item.selectKey
625
+ }
441
626
  } else if (item.selectType === 'fixArray') {
442
627
  // 数据源为固定json集合
443
628
  if (!this.isJSON(item.selectKey)) {
@@ -445,10 +630,17 @@ export default {
445
630
  return
446
631
  }
447
632
  }
448
- delete item.selectType
633
+ if (item.formType !== 'selects') {
634
+ delete item.selectType
635
+ }
449
636
  } else {
637
+ if (item.formType !== 'selects') {
638
+ delete item.group
639
+ delete item.groupIndex
640
+ }
450
641
  delete item.selectType
451
642
  delete item.selectKey
643
+ delete item.selectKeyName
452
644
  }
453
645
  if (this.type === '新增') {
454
646
  this.form.column.push(item)
@@ -458,7 +650,9 @@ export default {
458
650
  this.item = {
459
651
  key: '',
460
652
  title: '',
461
- rule: {}
653
+ rule: {
654
+ required: 'false'
655
+ }
462
656
  }
463
657
  this.$message.success('增加成功')
464
658
  this.dataColumnVisible = false
@@ -523,7 +717,9 @@ export default {
523
717
  this.item = {
524
718
  key: '',
525
719
  title: '',
526
- rule: {}
720
+ rule: {
721
+ required: 'false'
722
+ }
527
723
  }
528
724
  }, 100)
529
725
  },
@@ -532,6 +728,9 @@ export default {
532
728
  item.slot.type = 'badge'
533
729
  item.slotKeyMap = item.selectKey
534
730
  }
731
+ },
732
+ visitAcceptFile () {
733
+ window.open('https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/input/file#attr-accept')
535
734
  }
536
735
  }
537
736
  }
@@ -44,6 +44,7 @@
44
44
  :label="attr.name"
45
45
  :prop="attr.model">
46
46
  <a-select
47
+ v-if="!attr.lazyLoad"
47
48
  v-model="form[attr.model]"
48
49
  :disabled="disabled"
49
50
  show-search
@@ -82,6 +83,22 @@
82
83
  </template>
83
84
  </template>
84
85
  </a-select>
86
+ <a-select
87
+ v-else
88
+ show-search
89
+ v-model="form[attr.model]"
90
+ :disabled="disabled"
91
+ @search="fetchFunction"
92
+ :placeholder="attr.placeholder ? attr.placeholder : '搜索' + attr.name"
93
+ :filter-option="filterOption"
94
+ >
95
+ <a-spin v-if="searching" slot="notFoundContent" size="small" />
96
+ <a-select-option
97
+ v-for="(item,index) in option"
98
+ :key="index"
99
+ :value="Object.keys(item)[0]">{{ item[Object.keys(item)[0]] }}
100
+ </a-select-option>
101
+ </a-select>
85
102
  </a-form-model-item>
86
103
  </x-form-col>
87
104
  <!-- TODO 多选框 -->
@@ -149,12 +166,19 @@
149
166
  <script>
150
167
 
151
168
  import { post } from '@vue2-client/services/api/restTools'
169
+ import { debounce } from 'ant-design-vue/lib/vc-table/src/utils'
152
170
 
153
171
  export default {
154
172
  name: 'XFormItem',
155
173
  data () {
174
+ // 检索去抖
175
+ this.fetchFunction = debounce(this.fetchFunction, 800)
156
176
  return {
157
- option: []
177
+ option: [],
178
+ // 最后检索版本
179
+ lastFetchId: 0,
180
+ // 检索中
181
+ searching: false
158
182
  }
159
183
  },
160
184
  props: {
@@ -192,15 +216,37 @@ export default {
192
216
  }
193
217
  },
194
218
  created () {
195
- if (this.attr.keyName && this.attr.keyName.indexOf('logic@') !== -1) {
196
- const logicName = this.attr.keyName
197
- const logic = logicName.substring(6)
198
- post('/webmeterapi/' + logic, {}).then(res => {
219
+ if (!this.attr.lazyLoad && this.attr.keyName && this.attr.keyName.indexOf('logic@') !== -1) {
220
+ this.getData({}, res => {
199
221
  this.option = res
200
222
  })
201
223
  }
202
224
  },
203
225
  methods: {
226
+ // 懒加载检索方法
227
+ fetchFunction (value) {
228
+ this.lastFetchId += 1
229
+ const fetchId = this.lastFetchId
230
+ this.option = []
231
+ this.searching = true
232
+ this.getData({
233
+ word: value
234
+ }, res => {
235
+ if (fetchId !== this.lastFetchId) {
236
+ return
237
+ }
238
+ this.option = res
239
+ this.searching = false
240
+ })
241
+ },
242
+ // 获取数据
243
+ getData (value, callback) {
244
+ const logicName = this.attr.keyName
245
+ const logic = logicName.substring(6)
246
+ post('/webmeterapi/' + logic, value).then(res => {
247
+ callback(res)
248
+ })
249
+ },
204
250
  filterOption (input, option) {
205
251
  if (option.componentOptions.children[0].text) {
206
252
  return (
@@ -121,7 +121,7 @@
121
121
  :json-data="showColumns"
122
122
  :queryParamsName="queryParamsName"
123
123
  @loadData="loadData"
124
- :form="form"
124
+ :fixedQueryForm="form"
125
125
  />
126
126
  <div v-else-if="operationActiveTabKey === '3'" class="no-data"><a-icon type="frown-o"/>暂无数据</div>
127
127
  </a-card>
@@ -188,8 +188,7 @@ export default {
188
188
  loaded: false,
189
189
  // 查询操作日志表单
190
190
  form: {
191
- f_data_id: this.instructid,
192
- f_org_name: this.selectOrgName
191
+ r_f_data_id: this.instructid
193
192
  },
194
193
  operationTabList: [
195
194
  {