n20-common-lib 3.0.14 → 3.0.15

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": "n20-common-lib",
3
- "version": "3.0.14",
3
+ "version": "3.0.15",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -92,10 +92,10 @@
92
92
  <el-form ref="form" :model="form" label-width="80px" :inline="false" size="normal" label-position="top">
93
93
  <el-form-item
94
94
  :label="$lc('视图名称')"
95
- prop="name"
95
+ prop="viewName"
96
96
  :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
97
97
  >
98
- <el-input v-model="form.name" />
98
+ <el-input v-model="form.viewName" />
99
99
  </el-form-item>
100
100
  </el-form>
101
101
  <div slot="footer" class="flex-box flex-c flex-v page-button-shadow">
@@ -173,6 +173,10 @@ export default {
173
173
  checkIds: {
174
174
  type: Array,
175
175
  default: () => []
176
+ },
177
+ bussId: {
178
+ type: String,
179
+ default: ''
176
180
  }
177
181
  },
178
182
  data() {
@@ -224,12 +228,19 @@ export default {
224
228
  saveSt() {
225
229
  // 保存筛选视图
226
230
  const obj = {
227
- ...this.form,
228
- searchForm: this.model
231
+ viewName: this.form.viewName,
232
+ viewType: '0',
233
+ bussId: this.bussId,
234
+ filterId: this.filterId,
235
+ viewConfig: JSON.stringify(this.model)
229
236
  }
230
237
  console.log(obj, 'obj')
231
- this.stVisible = false
232
- this.$message.success('保存成功')
238
+ axios.post(`/bems/query/viewColumn/saveOrUpdateViewInfo`, obj).then((res) => {
239
+ if (res.code === 200) {
240
+ this.stVisible = false
241
+ this.$message.success('保存成功')
242
+ }
243
+ })
233
244
  },
234
245
  // 另存为视图
235
246
  addView() {
@@ -195,6 +195,7 @@ import ClDatePickerPor from '../DatePicker/por.vue'
195
195
  import ClInputNumber from '../InputNumber/index.vue'
196
196
  import ClInputNumberRange from '../InputNumber/numberRange.vue'
197
197
  import ClInputSearch from '../InputSearch/index.vue'
198
+ import axios from '../../utils/axios.js'
198
199
  export default {
199
200
  name: 'AdvancedQuery',
200
201
  components: {
@@ -216,6 +217,10 @@ export default {
216
217
  filterId: {
217
218
  type: String,
218
219
  default: ''
220
+ },
221
+ bussId: {
222
+ type: String,
223
+ default: ''
219
224
  }
220
225
  },
221
226
  data() {
@@ -450,15 +455,15 @@ export default {
450
455
  options: []
451
456
  }
452
457
  },
458
+ mounted() {
459
+ this.getAdvancedQueryFields()
460
+ },
453
461
  methods: {
454
462
  // 查询支持可配置高级查询的字段
455
463
  getAdvancedQueryFields() {
456
- let array = [
457
- {
458
- fileCode: '',
459
- fileName: ''
460
- }
461
- ]
464
+ axios.get('/bems/query/viewColumn/getColumnInfo', { bussId: this.bussId }).then((res) => {
465
+ console.log(res, 'res')
466
+ })
462
467
  },
463
468
  // 修改字段
464
469
  updatefield(field, row) {
@@ -64,9 +64,11 @@
64
64
  <slot name="rightContent"></slot>
65
65
  </div>
66
66
  <cl-advanced-filter
67
+ ref="filter"
67
68
  class="filter"
68
69
  :visible.sync="multiple"
69
70
  :filter-id="filterId"
71
+ :buss-id="bussId"
70
72
  :model="searchValue"
71
73
  only-key="id"
72
74
  :filter-list="filterList"
@@ -98,21 +100,22 @@
98
100
  <el-form ref="form" :model="form" label-width="80px" :inline="false" size="normal" label-position="top">
99
101
  <el-form-item
100
102
  :label="$lc('视图名称')"
101
- prop="name"
103
+ prop="viewName"
102
104
  :rules="[{ required: true, message: '请输入', trigger: 'blur' }]"
103
105
  >
104
- <el-input v-model="form.name" />
106
+ <el-input v-model="form.viewName" />
105
107
  </el-form-item>
106
108
  <div class="flex-box flex-lr flex-v">
107
109
  <div>{{ $lc('数据范围') }}</div>
108
110
  <div style="color: var(--color-primary); cursor: pointer" @click="typeChange">
109
111
  <i class="iconfont icon-switch"></i>
110
- <span v-if="form.viewType === 1"> {{ $lc('高级查询') }}</span>
112
+ <span v-if="form.viewType === '0'"> {{ $lc('高级查询') }}</span>
111
113
  <span v-else> {{ $lc('基础查询') }}</span>
112
114
  </div>
113
115
  </div>
114
116
  <cl-advanced-filter
115
- v-if="form.viewType === 1"
117
+ v-if="form.viewType === '0'"
118
+ ref="filter"
116
119
  :key="key"
117
120
  class="filter"
118
121
  :visible.sync="multiple"
@@ -132,9 +135,18 @@
132
135
  ></slot>
133
136
  </template>
134
137
  </cl-advanced-filter>
135
- <advancedQuery v-else v-model="conditionGroups" :filter-list="filterList" :filter-id="filterId">
138
+ <advancedQuery
139
+ v-else
140
+ v-model="conditionGroups"
141
+ :filter-list="filterList"
142
+ :filter-id="filterId"
143
+ :buss-id="bussId"
144
+ >
136
145
  <!-- 使用作用域插槽传递 slot 类型的过滤器 -->
137
- <template v-for="filter in filterList.filter((item) => item.type === 'slot')" #[filter.slotName]="{ model, value, input, disabled }">
146
+ <template
147
+ v-for="filter in filterList.filter((item) => item.type === 'slot')"
148
+ #[filter.slotName]="{ model, value, input, disabled }"
149
+ >
138
150
  <slot
139
151
  :name="filter.slotName"
140
152
  :model="model"
@@ -159,6 +171,8 @@ import ClAdvancedFilter from '../AdvancedFilter/index.vue'
159
171
  import ClInputSearch from '../InputSearch/index.vue'
160
172
  import ClDragList from '../DragList/index.vue'
161
173
  import ClDialog from '../Dialog/index.vue'
174
+ import axios from '../../utils/axios.js'
175
+
162
176
  export default {
163
177
  name: 'ProFilterView',
164
178
  components: {
@@ -169,6 +183,10 @@ export default {
169
183
  ClDialog
170
184
  },
171
185
  props: {
186
+ bussId: {
187
+ type: String,
188
+ default: ''
189
+ },
172
190
  filterId: {
173
191
  type: String,
174
192
  default: ''
@@ -240,6 +258,15 @@ export default {
240
258
  this.searchValue = { ...this.getInitialSearchValue }
241
259
  },
242
260
  methods: {
261
+ setOptions(id, opts) {
262
+ this.$refs.filter.setOptions(id, opts)
263
+ this.filterList.forEach((item) => {
264
+ if (item.value === id) {
265
+ item.options = opts
266
+ }
267
+ })
268
+ console.log(this.filterList, 'filterList updated')
269
+ },
243
270
  changeFn(value) {
244
271
  console.log('changeFn', value)
245
272
  },
@@ -265,16 +292,17 @@ export default {
265
292
  },
266
293
  // 通过filterId拿取视图列表
267
294
  getFilterList() {
268
- /* this.$axios.get(`/api/v3/filter/${this.userNo}/${this.filterId}`).then((res) => {
295
+ let list = []
296
+ axios.post(`/bems/query/viewColumn/getViewInfo`, { bussId: this.bussId }).then((res) => {
269
297
  console.log(res)
270
- }) */
271
- const list = [
298
+ })
299
+ /* list = [
272
300
  {
273
301
  userNo: '001', // 用户编号
274
302
  pageNo: 'test1', // 页面编号
275
303
  viewId: '2', // 视图编号唯一值
276
304
  name: '测试视图2', // 视图名称
277
- viewType: 1, // 1 基础查询 2高级查询
305
+ viewType: '0', // 0 基础查询 1高级查询
278
306
  keyIds: [1, 3, 14], //选中的条件字段 高级查询则为空
279
307
  searchForm: {
280
308
  //筛选条件值
@@ -292,7 +320,7 @@ export default {
292
320
  name: '高级视图1', // 视图名称
293
321
  keyIds: [], //选中的条件字段 高级查询则为空
294
322
  searchForm: {}, // 普通查询条件值 高级查询则为空
295
- viewType: 2, // 1 基础查询 2高级查询
323
+ viewType: '1', // 0 基础查询 1高级查询
296
324
  conditionGroups: [
297
325
  //高级查询值
298
326
  {
@@ -400,7 +428,7 @@ export default {
400
428
  }
401
429
  ]
402
430
  }
403
- ]
431
+ ] */
404
432
  this.list = [
405
433
  {
406
434
  name: '所有的'
@@ -416,7 +444,7 @@ export default {
416
444
  this.form = {
417
445
  userNo: sessionStorage.getItem('userNo'),
418
446
  pageNo: this.filterId,
419
- type: 1 // 明确设置 type 为 1
447
+ viewType: '0' // 明确设置 type 为 1
420
448
  }
421
449
  this.form.keyIds = this.filterList.map((item) => {
422
450
  return item.id
@@ -446,15 +474,39 @@ export default {
446
474
  },
447
475
  // 保存视图
448
476
  saveSt() {
477
+ let viewConfig
478
+ let keyIds
479
+ if (this.form.viewType === '0') {
480
+ viewConfig = JSON.stringify(this.searchForm)
481
+ keyIds = this.form.keyIds
482
+ } else {
483
+ viewConfig = JSON.stringify(this.conditionGroups)
484
+ keyIds = []
485
+ }
486
+ this.form.viewConfig = viewConfig
487
+ if (this.isAdd) {
488
+ if (this.form.name === '') {
489
+ this.$message.error('请输入视图名称')
490
+ return false
491
+ }
492
+ }
449
493
  // 保存筛选视图
450
494
  const obj = {
451
- ...this.form,
452
- searchForm: this.searchForm,
453
- conditionGroups: this.conditionGroups
495
+ viewName: this.form.viewName,
496
+ viewType: this.form.viewType,
497
+ bussId: this.bussId,
498
+ viewId: this.filterId,
499
+ viewConfig: this.form.viewConfig,
500
+ keyIds
454
501
  }
455
502
  console.log(obj, 'obj')
456
- this.visible = false
457
- this.$message.success('保存成功')
503
+ axios.post('/bems/query/viewColumn/saveOrUpdateViewInfo', obj).then((res) => {
504
+ if (res.code !== 200) {
505
+ return false
506
+ }
507
+ this.visible = false
508
+ this.$message.success('保存成功')
509
+ })
458
510
  },
459
511
  // 删除
460
512
  deleteOne() {
@@ -475,7 +527,7 @@ export default {
475
527
  return false
476
528
  }
477
529
  this.searchForm = item.searchForm
478
- this.searchValue = item.viewType === '1' ? item.searchForm : { ...this.getInitialSearchValue }
530
+ this.searchValue = item.viewType === '0' ? item.searchForm : { ...this.getInitialSearchValue }
479
531
  this.conditionGroups = item.conditionGroups
480
532
  this.selectItem = item
481
533
  this.$emit('filter', this.filterObj)
@@ -486,8 +538,8 @@ export default {
486
538
  },
487
539
  // 查询切换
488
540
  typeChange() {
489
- this.form.viewType = this.form.viewType === 1 ? 2 : 1
490
- if (this.form.viewType === 1) {
541
+ this.form.viewType = this.form.viewType === '0' ? '1' : '0'
542
+ if (this.form.viewType === '0') {
491
543
  this.conditionGroups = []
492
544
  } else {
493
545
  this.searchForm = { ...this.getInitialSearchValue }