n20-common-lib 3.0.36 → 3.0.37

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.
@@ -9,7 +9,7 @@
9
9
  trigger="click"
10
10
  class="m-r"
11
11
  >
12
- <el-button slot="reference" class="botton" :class="{ activiti: selectedItem !== '所有的' }">
12
+ <el-button slot="reference" class="botton" :class="{ activiti: selectedItem !== '无视图' }">
13
13
  <div class="flex-box flex-v m-r">
14
14
  <i class="v3-icon-inbox"></i>
15
15
  <div class="popover-title" style="margin: 0 8px" :title="selectedItem">{{ selectedItem }}</div>
@@ -28,7 +28,7 @@
28
28
  }}</span>
29
29
  <i v-if="selectedItem === item.viewName" class="el-icon-check selected-icon"></i>
30
30
  <el-dropdown
31
- v-if="selectedItem !== item.viewName && item.viewName !== '所有的'"
31
+ v-if="selectedItem !== item.viewName && item.viewName !== '无视图'"
32
32
  trigger="click"
33
33
  class="proFilterView-list-item__more"
34
34
  @command="(command) => handleCommand(command, item)"
@@ -206,8 +206,8 @@ export default {
206
206
  data() {
207
207
  return {
208
208
  val: '',
209
- list: ['所有的'],
210
- selectedItem: '所有的', // 默认选中第一项
209
+ list: ['无视图'],
210
+ selectedItem: '无视图', // 默认选中第一项
211
211
  stVisible: false,
212
212
  visible: false,
213
213
  isAdd: false,
@@ -322,7 +322,7 @@ export default {
322
322
  })
323
323
  this.list = [
324
324
  {
325
- viewName: '所有的'
325
+ viewName: '无视图'
326
326
  },
327
327
  ...list
328
328
  ]
@@ -337,7 +337,7 @@ export default {
337
337
  .catch((err) => {
338
338
  this.list = [
339
339
  {
340
- viewName: '所有的'
340
+ viewName: '无视图'
341
341
  }
342
342
  ]
343
343
  })
@@ -382,6 +382,7 @@ export default {
382
382
  } else {
383
383
  const parsed = JSON.parse(item.viewConfig || '{}')
384
384
  this.conditionGroups = parsed.conditionGroups || []
385
+
385
386
  this._savedViewConfigs['1'] = { conditionGroups: this.conditionGroups }
386
387
  }
387
388
  },
@@ -402,29 +403,51 @@ export default {
402
403
  viewConfig = JSON.stringify({ conditionGroups: this.conditionGroups })
403
404
  keyIds = []
404
405
  }
406
+ console.log(this.conditionGroups)
405
407
  this.form.viewConfig = viewConfig
406
- if (this.isAdd) {
407
- if (this.form.viewName === '') {
408
+
409
+ const hasEmptyValue = this.conditionGroups.some((group) =>
410
+ group.conditions.some((condition) => {
411
+ const val = condition.value
412
+ return val === null || val === undefined || val === '' || (Array.isArray(val) && val.length === 0)
413
+ })
414
+ )
415
+
416
+ this.$refs.form.validate(async (valid) => {
417
+ if (!valid) {
408
418
  this.$message.error('请输入视图名称')
409
- return false
419
+ return
410
420
  }
411
- }
412
- // 保存筛选视图
413
- const obj = {
414
- viewName: this.form.viewName,
415
- viewType: this.form.viewType,
416
- bussId: this.bussId,
417
- viewConfig: this.form.viewConfig,
418
- keyIds: JSON.stringify(keyIds),
419
- viewId: this.viewId
420
- }
421
- axios.post('/bems/query/viewColumn/saveOrUpdateViewInfo', obj).then((res) => {
422
- if (res.code !== 200) {
423
- return false
421
+
422
+ if (this.form.viewType === '0' && !keyIds.length) {
423
+ this.$message.warning('至少添加一个条件')
424
+ return
424
425
  }
425
- this.visible = false
426
- this.$message.success('保存成功')
427
- this.getFilterList(this.viewId)
426
+ if (this.form.viewType === '1') {
427
+ if (!this.conditionGroups.length || hasEmptyValue) {
428
+ this.$message.warning('至少添加一个条件')
429
+ return
430
+ }
431
+ }
432
+
433
+ // 保存筛选视图
434
+ const obj = {
435
+ viewName: this.form.viewName,
436
+ viewType: this.form.viewType,
437
+ bussId: this.bussId,
438
+ viewConfig: this.form.viewConfig,
439
+ keyIds: JSON.stringify(keyIds),
440
+ viewId: this.viewId
441
+ }
442
+
443
+ axios.post('/bems/query/viewColumn/saveOrUpdateViewInfo', obj).then((res) => {
444
+ if (res.code !== 200) {
445
+ return false
446
+ }
447
+ this.visible = false
448
+ this.$message.success('保存成功')
449
+ this.getFilterList(this.viewId)
450
+ })
428
451
  })
429
452
  },
430
453
  // 删除
@@ -448,7 +471,7 @@ export default {
448
471
  this.stVisible = false
449
472
  this.selectItem = item
450
473
  this.selectedItem = item.viewName
451
- if (item.viewName === '所有的') {
474
+ if (item.viewName === '无视图') {
452
475
  this.selectItem = ''
453
476
  this.searchValue = {}
454
477
  this.conditionGroups = []