vue2-client 1.8.255 → 1.8.256

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.8.255",
3
+ "version": "1.8.256",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <!-- 输入框 -->
3
3
  <x-form-col
4
- v-if="attr.type === 'input'"
4
+ v-if="attr.type === 'input' && show"
5
5
  :flex="attr.flex">
6
6
  <a-form-model-item
7
7
  :ref="attr.model"
@@ -49,7 +49,7 @@
49
49
  </x-form-col>
50
50
  <!-- 下拉框 -->
51
51
  <x-form-col
52
- v-else-if="attr.type === 'select' || (attr.type === 'rate' && mode==='查询')"
52
+ v-else-if="(attr.type === 'select' || (attr.type === 'rate' && mode==='查询')) && show"
53
53
  :flex="attr.flex">
54
54
  <a-form-model-item
55
55
  :ref="attr.model"
@@ -143,7 +143,7 @@
143
143
  </x-form-col>
144
144
  <!-- 多选框 -->
145
145
  <x-form-col
146
- v-else-if="attr.type === 'checkbox'"
146
+ v-else-if="attr.type === 'checkbox' && show"
147
147
  :flex="attr.flex">
148
148
  <a-form-model-item
149
149
  :ref="attr.model"
@@ -210,7 +210,7 @@
210
210
  </x-form-col>
211
211
  <!-- 单选框 -->
212
212
  <x-form-col
213
- v-else-if="attr.type === 'radio'"
213
+ v-else-if="attr.type === 'radio' && show"
214
214
  :flex="attr.flex">
215
215
  <a-form-model-item
216
216
  :ref="attr.model"
@@ -241,7 +241,7 @@
241
241
  </x-form-col>
242
242
  <!-- 日期范围选择器 -->
243
243
  <x-form-col
244
- v-else-if="attr.type === 'rangePicker'"
244
+ v-else-if="attr.type === 'rangePicker' && show"
245
245
  :flex="attr.flex">
246
246
  <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.prop ? attr.prop : attr.model">
247
247
  <a-date-picker
@@ -263,7 +263,7 @@
263
263
  </x-form-col>
264
264
  <!-- 月份选择器 -->
265
265
  <x-form-col
266
- v-else-if="attr.type === 'monthPicker'"
266
+ v-else-if="attr.type === 'monthPicker' && show"
267
267
  :flex="attr.flex">
268
268
  <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.prop ? attr.prop : attr.model">
269
269
  <a-month-picker
@@ -277,7 +277,7 @@
277
277
  </x-form-col>
278
278
  <!-- 年份选择器 -->
279
279
  <x-form-col
280
- v-else-if="attr.type === 'yearPicker'"
280
+ v-else-if="attr.type === 'yearPicker' && show"
281
281
  :flex="attr.flex">
282
282
  <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.prop ? attr.prop : attr.model">
283
283
  <a-date-picker
@@ -295,7 +295,7 @@
295
295
  </x-form-col>
296
296
  <!-- 单日选择器 -->
297
297
  <x-form-col
298
- v-else-if="attr.type === 'datePicker'"
298
+ v-else-if="attr.type === 'datePicker' && show"
299
299
  :flex="attr.flex">
300
300
  <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.prop ? attr.prop : attr.model">
301
301
  <a-range-picker
@@ -317,7 +317,7 @@
317
317
  </x-form-col>
318
318
  <!-- 文本域 -->
319
319
  <a-col
320
- v-else-if="attr.type === 'textarea'"
320
+ v-else-if="attr.type === 'textarea' && show"
321
321
  :xs="24"
322
322
  :sm="24"
323
323
  :md="24"
@@ -340,7 +340,7 @@
340
340
  </a-col>
341
341
  <!-- 文件上传 -->
342
342
  <a-col
343
- v-else-if="attr.type === 'file' || attr.type === 'image'"
343
+ v-else-if="(attr.type === 'file' || attr.type === 'image') && show"
344
344
  :style="layout === 'inline'?{width:'calc(100% - 60px)'}:{}"
345
345
  :xs="24"
346
346
  :sm="24"
@@ -365,7 +365,7 @@
365
365
  </a-col>
366
366
  <!-- 省市区选择框 -->
367
367
  <x-form-col
368
- v-else-if="attr.type === 'citySelect'"
368
+ v-else-if="attr.type === 'citySelect' && show"
369
369
  :flex="attr.flex">
370
370
  <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.prop ? attr.prop : attr.model">
371
371
  <citySelect
@@ -378,7 +378,7 @@
378
378
  </x-form-col>
379
379
  <!-- 地点搜索框 -->
380
380
  <x-form-col
381
- v-else-if="attr.type === 'addressSearch'"
381
+ v-else-if="attr.type === 'addressSearch' && show"
382
382
  :flex="attr.flex">
383
383
  <a-form-model-item
384
384
  :ref="attr.model"
@@ -402,7 +402,7 @@
402
402
  </x-form-col>
403
403
  <!-- 人员选择框 -->
404
404
  <x-form-col
405
- v-else-if="attr.type === 'personSetting'"
405
+ v-else-if="attr.type === 'personSetting' && show"
406
406
  :flex="attr.flex">
407
407
  <a-form-model-item :ref="attr.model" :label="attr.name" :prop="attr.prop ? attr.prop : attr.model">
408
408
  <PersonSetting v-model="form[attr.model]"></PersonSetting>
@@ -410,7 +410,7 @@
410
410
  </x-form-col>
411
411
  <!-- 树形选择框 -->
412
412
  <x-form-col
413
- v-else-if="attr.type === 'treeSelect'"
413
+ v-else-if="attr.type === 'treeSelect' && show"
414
414
  :flex="attr.flex">
415
415
  <x-tree-select
416
416
  v-model="form[attr.model]"
@@ -420,7 +420,7 @@
420
420
  </x-form-col>
421
421
  <!-- 评分框 -->
422
422
  <x-form-col
423
- v-else-if="attr.type === 'rate'"
423
+ v-else-if="attr.type === 'rate' && show"
424
424
  :flex="attr.flex">
425
425
  <a-form-model-item
426
426
  :ref="attr.model"
@@ -470,6 +470,8 @@ export default {
470
470
  searchResult: '',
471
471
  yearShowOne: false,
472
472
  optionForFunc: [],
473
+ // 控制当前表单项是否展示
474
+ show: true,
473
475
  labelAndWrapperCol: [{
474
476
  labelCol: undefined,
475
477
  wrapperCol: undefined
@@ -567,18 +569,23 @@ export default {
567
569
  setForm: {
568
570
  type: Function,
569
571
  default: (val) => {
570
- console.log(val)
571
- }
572
+ console.log(val)
573
+ }
572
574
  },
573
575
  },
574
576
  created () {
575
577
  this.init()
576
- if (this.attr.keyName && (this.attr.keyName.toString().indexOf('async ') !== -1 || this.attr.keyName.toString().indexOf('function') !== -1)) {
578
+ if (this.attr.keyName && (this.attr?.keyName?.toString().indexOf('async ') !== -1 || this.attr?.keyName?.toString()?.indexOf('function') !== -1)) {
577
579
  this.debouncedUpdateOptions = debounce(this.updateOptions, 200)
578
580
  }
579
581
  if (this.attr.dataChangeFunc) {
580
582
  this.debouncedDataChangeFunc = debounce(this.dataChangeFunc, 200)
581
583
  }
584
+ if (this.attr.showFormItemFunc) {
585
+ this.debouncedShowFormItemFunc = debounce(this.showFormItemFunc, 100)
586
+ // 执行一次
587
+ debounce(this.showFormItemFunc, 100)()
588
+ }
582
589
  },
583
590
  computed: {
584
591
  ...mapState('account', { currUser: 'user' })
@@ -600,6 +607,10 @@ export default {
600
607
  if (this.attr.dataChangeFunc) {
601
608
  this.debouncedDataChangeFunc()
602
609
  }
610
+ // 如果有自定义是否展示表单项函数
611
+ if (this.attr.showFormItemFunc) {
612
+ this.debouncedShowFormItemFunc()
613
+ }
603
614
  // 地址搜索框赋值
604
615
  if (this.attr.type === 'addressSearch') {
605
616
  this.$refs.addressSearchCombobox.addressInput = this.form[this.attr.model]
@@ -619,6 +630,13 @@ export default {
619
630
  await executeStrFunction(this.attr.dataChangeFunc, [this.form, this.setForm, this.attr, util])
620
631
  }
621
632
  },
633
+ async showFormItemFunc () {
634
+ if (this.attr.showFormItemFunc) {
635
+ this.show = executeStrFunction(this.attr.showFormItemFunc, [this.form, this.setForm, this.attr, util])
636
+ } else {
637
+ this.show = true
638
+ }
639
+ },
622
640
  init () {
623
641
  if (this.mode === '新增/修改' && !this.attr.flex) {
624
642
  if (['horizontal', 'vertical'].includes(this.layout)) {