n20-common-lib 2.5.43 → 2.5.45

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": "2.5.43",
3
+ "version": "2.5.45",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -51,7 +51,6 @@
51
51
  }
52
52
 
53
53
  .el-table {
54
-
55
54
  /* 排序 */
56
55
  .caret-wrapper {
57
56
  display: inline-flex;
@@ -196,23 +195,20 @@ th.vxe-header--column {
196
195
  color: #333;
197
196
  }
198
197
 
199
-
200
- .vxe-table-custom-wrap.vxe-body--column.col--ellipsis:not(.col--actived)>.vxe-cell,
201
- .vxe-table--render-default .vxe-table-custom-wrap.vxe-footer--column.col--ellipsis:not(.col--actived)>.vxe-cell,
202
- .vxe-table--render-default .vxe-table-custom-wrap.vxe-header--column.col--ellipsis:not(.col--actived)>.vxe-cell {
198
+ .vxe-table-custom-wrap.vxe-body--column.col--ellipsis:not(.col--actived) > .vxe-cell,
199
+ .vxe-table--render-default .vxe-table-custom-wrap.vxe-footer--column.col--ellipsis:not(.col--actived) > .vxe-cell,
200
+ .vxe-table--render-default .vxe-table-custom-wrap.vxe-header--column.col--ellipsis:not(.col--actived) > .vxe-cell {
203
201
  overflow: hidden;
204
202
  text-overflow: ellipsis;
205
203
  white-space: wrap !important;
206
204
  }
207
205
 
208
- .vxe-table--render-default.size--small .vxe-table-custom-wrap.vxe-body--column.col--ellipsis>.vxe-cell,
209
- .vxe-table--render-default.size--small .vxe-table-custom-wrap.vxe-footer--column.col--ellipsis>.vxe-cell,
210
- .vxe-table--render-default.size--small .vxe-table-custom-wrap.vxe-header--column.col--ellipsis>.vxe-cell {
206
+ .vxe-table--render-default.size--small .vxe-table-custom-wrap.vxe-body--column.col--ellipsis > .vxe-cell,
207
+ .vxe-table--render-default.size--small .vxe-table-custom-wrap.vxe-footer--column.col--ellipsis > .vxe-cell,
208
+ .vxe-table--render-default.size--small .vxe-table-custom-wrap.vxe-header--column.col--ellipsis > .vxe-cell {
211
209
  max-height: 100%;
212
210
  }
213
211
 
214
-
215
-
216
212
  .vxe-header--column {
217
213
  .vxe-cell {
218
214
  justify-content: center !important;
@@ -229,4 +225,4 @@ th.vxe-header--column {
229
225
  .icon-mini {
230
226
  background-image: url('../../components/TableSetSize/mini.png');
231
227
  }
232
- }
228
+ }
@@ -57,16 +57,16 @@
57
57
  </el-checkbox-group>
58
58
  </div>
59
59
  </div>
60
- <div class="right-c flex-column p-t-m bd-r" v-if="!hasPX">
60
+ <div class="right-c flex-column p-t-m" v-if="!hasPX">
61
61
  <div class="m-b">
62
62
  {{ '当前选定项' | $lc }}
63
63
  <el-link type="primary" style="visibility: hidden">{{ '当前选定项' | $lc }}</el-link>
64
64
  </div>
65
65
  <div class="flex-1 overflow-y">
66
- <drag-list :list="dragList" @click="clickItem" :label-key="labelKey" :in-show-column="true" />
66
+ <drag-list :list="dragList" :label-key="labelKey" :in-show-column="true" @click="clickItem" />
67
67
  </div>
68
68
  </div>
69
- <div class="right-tree flex-column p-t-m" v-else>
69
+ <div v-else class="right-tree flex-column p-t-m">
70
70
  <div class="m-b flex-box flex-lr flex-v">
71
71
  {{ '当前选定项' | $lc }}
72
72
  <el-link class="m-r-s" :underline="false" icon="n20-icon-xinzeng" @click="add">{{
@@ -96,7 +96,12 @@
96
96
  >{{ data.label }}</span
97
97
  >
98
98
  </span>
99
- <el-link class="n20-icon-shanchu" :underline="false" @click.stop="() => removeMenu(node, data)" />
99
+ <el-link
100
+ class="n20-icon-shanchu"
101
+ :underline="false"
102
+ @click.stop="() => removeMenu(node, data)"
103
+ :disabled="data.checked"
104
+ />
100
105
  </span>
101
106
  </el-tree>
102
107
  </div>
@@ -124,7 +129,7 @@
124
129
  ]"
125
130
  prop="width"
126
131
  >
127
- <el-input v-model="configModel.width" class="w-224"></el-input>
132
+ <el-input v-model="configModel.width" class="w-224" />
128
133
  </el-form-item>
129
134
  <el-form-item :label="'是否折行' | $lc">
130
135
  <el-radio-group v-model="configModel.wrap">
@@ -140,7 +145,7 @@
140
145
  <dialogWrap v-drag :visible.sync="configVisibleN" :title="'新增' | $lc" width="350px" :close-on-click-modal="false">
141
146
  <el-form :model="configModelN">
142
147
  <el-form-item :label="'名称' | $lc" required>
143
- <el-input v-model="configModelN.label" class="input-w" :placeholder="'请输入' | $lc"></el-input>
148
+ <el-input v-model="configModelN.label" class="input-w" :placeholder="'请输入' | $lc" />
144
149
  </el-form-item>
145
150
  </el-form>
146
151
  <div slot="footer">
@@ -160,6 +165,7 @@ import axios from '../../utils/axios'
160
165
  import dialogWrap from '../Dialog/index.vue'
161
166
  import dragList from '../DragList/index.vue'
162
167
  import forEachs from '../../utils/forEachs'
168
+ import { Message } from 'element-ui'
163
169
  export default {
164
170
  name: 'ShowColumn',
165
171
  components: { dialogWrap, dragList },
@@ -222,7 +228,8 @@ export default {
222
228
  label: '',
223
229
  prop: '',
224
230
  width: 120,
225
- isNew: true
231
+ isNew: true,
232
+ children: []
226
233
  },
227
234
  userNo: sessionStorage.getItem('userNo'),
228
235
  configVisibleN: false,
@@ -276,7 +283,7 @@ export default {
276
283
  arr.push(item)
277
284
  })
278
285
  this.dragListN = arr
279
- const newArr = arr.filter((item) => {
286
+ /* const newArr = arr.filter((item) => {
280
287
  return item.isNew
281
288
  })
282
289
  newArr.forEach((item) => {
@@ -284,7 +291,7 @@ export default {
284
291
  if (index === -1) {
285
292
  this.columns.push(item)
286
293
  }
287
- })
294
+ }) */
288
295
  },
289
296
  immediate: true,
290
297
  deep: true
@@ -316,14 +323,15 @@ export default {
316
323
  return this.$message.warning($lc('已有重名字段,请修改'))
317
324
  }
318
325
  this.dragList.unshift(this.configModelN)
319
- this.columns = [this.configModelN, ...this.columns]
326
+ // this.columns = [this.configModelN, ...this.columns]
320
327
  this.$message.success($lc('添加成功'))
321
328
  this.configVisibleN = false
322
329
  this.configModelN = {
323
330
  label: '',
324
331
  prop: '',
325
332
  width: 120,
326
- isNew: true
333
+ isNew: true,
334
+ children: []
327
335
  }
328
336
  },
329
337
  removeMenu(node, data) {
@@ -363,6 +371,11 @@ export default {
363
371
  let index = this.dragList.findIndex((d) => d[this.labelKey] === column[this.labelKey])
364
372
  index !== -1 && this.dragList.splice(index, 1)
365
373
  } else {
374
+ let index = this.dragListN.findIndex((d) => d[this.labelKey] === column[this.labelKey])
375
+ if (index !== -1) {
376
+ Message.warning($lc(`子级请在右侧删除!`))
377
+ return false
378
+ }
366
379
  this.dragList.push(column)
367
380
  }
368
381
  },
@@ -384,7 +397,14 @@ export default {
384
397
  let preCols = this.columns.filter((col) => col.static === 'pre')
385
398
  let nextCols = this.columns.filter((col) => col.static === 'next')
386
399
  list.push(...preCols, ...this.dragList, ...nextCols)
387
-
400
+ // 新增校验
401
+ if (!this.isExport) {
402
+ let state = list.findIndex((c) => c.isNew && c.children && c.children.length === 0)
403
+ if (state !== -1) {
404
+ Message.warning($lc(`新增字段必须包含子级!`))
405
+ return false
406
+ }
407
+ }
388
408
  // 自动保存设置的显示列
389
409
  !this.isExport && this.autoSave && this.saveColumns(list)
390
410
 
@@ -413,16 +433,13 @@ function saveTransform(list, labelKey, isFilter) {
413
433
  let listN = []
414
434
  if (!isFilter) {
415
435
  list.forEach((c) => {
416
- if (c.prop && !c.children && !c.isNew && !c.width) {
436
+ if (c.prop && !c.children && !c.isNew && !c.width & !c.isNew) {
417
437
  listN.push({ _colKey: 'prop', _colVal: c.prop })
418
438
  } else if (c.slotName) {
419
439
  listN.push({ _colKey: 'slotName', _colVal: c.slotName })
420
440
  } else if (c.type && ['selection', 'index', 'expand'].includes(c.type)) {
421
441
  listN.push({ _colKey: 'type', _colVal: c.type })
422
442
  } else {
423
- if (c.isNew && !c.children) {
424
- return this.$message.warning($lc(`新增字段必须包含子级!`))
425
- }
426
443
  let sFn = false
427
444
  for (let k in c) {
428
445
  if (typeof c[k] === 'function') sFn = true
@@ -12,7 +12,7 @@
12
12
  show-header-overflow
13
13
  :row-config="{ isHover: true, useKey: true, ...$attrs.rowConfig }"
14
14
  :column-config="{ resizable: true, useKey: true, ...$attrs.columnConfig }"
15
- :scroll-y="{ enabled: true, oSize: 20, gt: 30 }"
15
+ :scroll-y="scrollY"
16
16
  :sort-config="{
17
17
  multiple: false,
18
18
  remote: true,
@@ -38,7 +38,7 @@
38
38
  :field="item.prop"
39
39
  type="checkbox"
40
40
  width="50"
41
- fixed="left"
41
+ :fixed="item.fixed || item.fixed === '' ? item.fixed : 'left'"
42
42
  >
43
43
  <template #header="{ $table, checked, indeterminate, disabled }">
44
44
  <span class="custom-checkbox" @click.stop="toggleAll($table, disabled)">
@@ -56,32 +56,34 @@
56
56
  </template>
57
57
  </vxe-column>
58
58
  <vxe-colgroup
59
- :title="item.label"
60
59
  v-else-if="item.children && item.children.length > 0"
61
60
  :key="'vxe-colgroup-' + i"
61
+ :title="item.label"
62
62
  >
63
63
  <vxe-column
64
64
  v-for="(subItem, i) in item.children"
65
65
  :key="'vxe-table-' + i"
66
- :className="item.wrap ? 'vxe-table-custom-wrap' : ''"
66
+ :class-name="subItem.wrap ? 'vxe-table-custom-wrap' : ''"
67
67
  :formatter="subItem.formatter ? subItem.formatter : 'formatName'"
68
68
  :filters="subItem.filters"
69
69
  :filter-render="subItem.filterRender"
70
70
  :title="subItem.label"
71
71
  :field="subItem.prop"
72
72
  v-bind="subItem"
73
+ :show-overflow="!subItem.wrap"
73
74
  />
74
75
  </vxe-colgroup>
75
76
  <vxe-column
76
77
  v-else
77
- :className="item.wrap ? 'vxe-table-custom-wrap' : ''"
78
78
  :key="'vxe-table-' + i"
79
+ :class-name="item.wrap ? 'vxe-table-custom-wrap' : ''"
79
80
  :formatter="item.formatter ? item.formatter : 'formatName'"
80
81
  :filters="item.filters"
81
82
  :filter-render="item.filterRender"
82
83
  :title="item.label"
83
84
  :field="item.prop"
84
85
  v-bind="item"
86
+ :show-overflow="!item.wrap"
85
87
  />
86
88
  </template>
87
89
  <template #empty>
@@ -104,6 +106,12 @@ export default {
104
106
  empty
105
107
  },
106
108
  props: {
109
+ scrollY: {
110
+ type: Object,
111
+ default: () => {
112
+ return { enabled: true, oSize: 20, gt: 30 }
113
+ }
114
+ },
107
115
  data: {
108
116
  type: Array,
109
117
  default: undefined