n20-common-lib 2.5.37 → 2.5.38

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.37",
3
+ "version": "2.5.38",
4
4
  "private": false,
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -19,6 +19,17 @@
19
19
  overflow-y: auto;
20
20
  }
21
21
 
22
+ .right-tree {
23
+ height: 400px;
24
+ width: 200px;
25
+ margin-left: 15px;
26
+ overflow-y: hidden;
27
+ .menu-tree{
28
+ height: 360px;
29
+ overflow-y: auto;
30
+ }
31
+ }
32
+
22
33
  .el-checkbox {
23
34
  margin: 0;
24
35
  padding-right: 16px;
@@ -66,19 +66,6 @@
66
66
  </el-form-item>
67
67
  </div>
68
68
  <div class="flex-box">
69
- <el-form-item class="flex-1" :label="'审批意见' | $lc" :error="errMsg" :required="required" style="width: 70%">
70
- <el-input
71
- ref="msg-input"
72
- v-model="messageC"
73
- type="textarea"
74
- :placeholder="
75
- ('请输入操作意见(' + messageMax + '字以内),批准该意见为非必填,驳回/作废该意见为必填!') | $lc
76
- "
77
- :maxlength="messageMax"
78
- show-word-limit
79
- :autosize="{ rows: 1 }"
80
- />
81
- </el-form-item>
82
69
  <template v-if="taskId && showBtn">
83
70
  <show-app-opi
84
71
  v-if="opiAndUser || authList.includes('showAppOpi')"
@@ -96,6 +83,19 @@
96
83
  style="width: 18%"
97
84
  />
98
85
  </template>
86
+ <el-form-item class="flex-1" :label="'审批意见' | $lc" :error="errMsg" :required="required" style="width: 70%">
87
+ <el-input
88
+ ref="msg-input"
89
+ v-model="messageC"
90
+ type="textarea"
91
+ :placeholder="
92
+ ('请输入操作意见(' + messageMax + '字以内),批准该意见为非必填,驳回/作废该意见为必填!') | $lc
93
+ "
94
+ :maxlength="messageMax"
95
+ show-word-limit
96
+ :autosize="{ rows: 1 }"
97
+ />
98
+ </el-form-item>
99
99
  </div>
100
100
  <el-form-item v-if="fileKit || fileKitT" label="附加上传">
101
101
  <cl-upload
@@ -24,7 +24,7 @@
24
24
  }}</el-link>
25
25
  </div>
26
26
  <div class="flex-item p-r" style="height: 50%; overflow: auto">
27
- <el-checkbox-group :value="dragList.map((d) => d[labelKey])">
27
+ <el-checkbox-group :value="dragListN.map((d) => d[labelKey])">
28
28
  <template v-if="!columnsGroups">
29
29
  <el-checkbox
30
30
  v-for="(column, i) in columnsAs"
@@ -57,7 +57,7 @@
57
57
  </el-checkbox-group>
58
58
  </div>
59
59
  </div>
60
- <div class="right-c flex-column p-t-m">
60
+ <div class="right-c flex-column p-t-m bd-r" v-if="!hasPX">
61
61
  <div class="m-b">
62
62
  {{ '当前选定项' | $lc }}
63
63
  <el-link type="primary" style="visibility: hidden">{{ '当前选定项' | $lc }}</el-link>
@@ -66,6 +66,42 @@
66
66
  <drag-list :list="dragList" @click="clickItem" :label-key="labelKey" :in-show-column="true" />
67
67
  </div>
68
68
  </div>
69
+ <div class="right-tree flex-column p-t-m" v-else>
70
+ <div class="m-b flex-box flex-lr flex-v">
71
+ {{ '当前选定项' | $lc }}
72
+ <el-link class="m-r-s" :underline="false" icon="n20-icon-xinzeng" @click="add">新增</el-link>
73
+ </div>
74
+ <el-tree
75
+ ref="menu-tree"
76
+ class="menu-tree"
77
+ :data="dragList"
78
+ :props="{
79
+ children: 'children',
80
+ label: 'label'
81
+ }"
82
+ node-key="menuid"
83
+ draggable
84
+ style="width: 200px"
85
+ @node-drop="dropMenu"
86
+ >
87
+ <span slot-scope="{ node, data }" class="menu-item flex-item flex-box flex-lr flex-v">
88
+ <span>
89
+ <i class="n20-drag-icon n20-icon-tuodong"></i>
90
+ <span class="text-ellipsis pointer color-primary" @click="clickItem(data)" v-if="data.label">{{
91
+ data.label
92
+ }}</span>
93
+ <span v-else>{{ '未命名...' }}</span>
94
+ </span>
95
+ <el-link
96
+ v-if="!disabled"
97
+ class="n20-icon-shanchu"
98
+ :underline="false"
99
+ :disabled="inSC && item.checked"
100
+ @click.stop="() => removeMenu(node, data)"
101
+ />
102
+ </span>
103
+ </el-tree>
104
+ </div>
69
105
  </div>
70
106
  </div>
71
107
  <dialogWrap v-drag :visible.sync="configVisible" title="表头设置" width="350px" :close-on-click-modal="false">
@@ -87,6 +123,16 @@
87
123
  <el-button type="primary" @click="configSave">{{ '确定' | $lc }}</el-button>
88
124
  </div>
89
125
  </dialogWrap>
126
+ <dialogWrap v-drag :visible.sync="configVisibleN" title="新增" width="350px" :close-on-click-modal="false">
127
+ <el-form :model="configModelN">
128
+ <el-form-item label="名称" required>
129
+ <el-input v-model="configModelN.label" class="input-w" placeholder="请输入"></el-input>
130
+ </el-form-item>
131
+ </el-form>
132
+ <div slot="footer">
133
+ <el-button type="primary" @click="configSaveN">{{ '确定' | $lc }}</el-button>
134
+ </div>
135
+ </dialogWrap>
90
136
  <div slot="footer" class="text-c">
91
137
  <el-button type="primary" @click="setChange">{{ '确定' | $lc }}</el-button>
92
138
  <el-button plain @click="reset">{{ '恢复默认' | $lc }}</el-button>
@@ -99,6 +145,7 @@ import { $lc } from '../../utils/i18n/index'
99
145
  import axios from '../../utils/axios'
100
146
  import dialogWrap from '../Dialog/index.vue'
101
147
  import dragList from '../DragList/index.vue'
148
+ import forEachs from '../../utils/forEachs'
102
149
  export default {
103
150
  name: 'ShowColumn',
104
151
  components: { dialogWrap, dragList },
@@ -142,7 +189,11 @@ export default {
142
189
  },
143
190
  width: {
144
191
  type: String,
145
- default: '800px'
192
+ default: '1000px'
193
+ },
194
+ hasPX: {
195
+ type: Boolean,
196
+ default: false
146
197
  }
147
198
  },
148
199
  data() {
@@ -153,7 +204,15 @@ export default {
153
204
  configModel: {
154
205
  wrap: false
155
206
  },
156
- userNo: sessionStorage.getItem('userNo')
207
+ configModelN: {
208
+ label: '',
209
+ prop: '',
210
+ width: 120,
211
+ isNew: true
212
+ },
213
+ userNo: sessionStorage.getItem('userNo'),
214
+ configVisibleN: false,
215
+ dragListN: []
157
216
  }
158
217
  },
159
218
  computed: {
@@ -184,13 +243,95 @@ export default {
184
243
  }
185
244
  },
186
245
  setState() {
187
- return this.columnsAs.length && this.columnsAs.length === this.dragList.length
246
+ return this.columnsAs.length && this.columnsAs.length === this.dragListN.length
188
247
  },
189
248
  columnsAs() {
190
249
  return this.columns.filter((col) => !col.static)
191
250
  }
192
251
  },
252
+ watch: {
253
+ dragList: {
254
+ handler() {
255
+ let obj = []
256
+ forEachs(this.dragList, (item) => {
257
+ obj.push(item)
258
+ })
259
+ this.dragListN = obj
260
+ const isNew = obj.filter((item) => {
261
+ return item.isNew
262
+ })
263
+ isNew.forEach((item) => {
264
+ if (!this.columns.includes(item)) {
265
+ this.columns.push(item)
266
+ }
267
+ })
268
+ },
269
+ immediate: true,
270
+ deep: true
271
+ }
272
+ },
193
273
  methods: {
274
+ add() {
275
+ this.configVisibleN = true
276
+ this.configModelN.prop = 'prop' + this.configModelN.legnth
277
+ },
278
+ configSaveN() {
279
+ if (!this.configModelN.label) {
280
+ this.$message.warning('请填写名称')
281
+ return false
282
+ }
283
+ const hasLabel = this.dragListN.find((item) => {
284
+ return item.label === this.configModelN.label
285
+ })
286
+ if (hasLabel) {
287
+ this.$message.warning('已有重名字段,请修改')
288
+ return false
289
+ }
290
+ this.dragList.push(this.configModelN)
291
+ this.columns.push(this.configModelN)
292
+ this.$message.success('添加成功')
293
+ this.configVisibleN = false
294
+ this.configModelN = {
295
+ label: '',
296
+ prop: '',
297
+ width: 120,
298
+ isNew: true
299
+ }
300
+ },
301
+ removeMenu(node, data) {
302
+ let children = node.parent.data.children || node.parent.data
303
+ let index = children.findIndex((d) => d.prop === data.prop)
304
+ index !== -1 && children.splice(index, 1)
305
+ this.activeMenu = {}
306
+ this.canApply = true
307
+ /* this.dragListN = this.dragListN.filter((item) => {
308
+ return item.label !== data
309
+ }) */
310
+ },
311
+ dropMenu(ingNode, toNode, type) {
312
+ let toObj = undefined
313
+ let toChild = undefined
314
+ if (type === 'inner') {
315
+ toObj = toNode.data
316
+ toChild = toObj.children
317
+ } else {
318
+ if (Array.isArray(toNode.parent.data)) {
319
+ toObj = {}
320
+ toChild = toNode.parent.data
321
+ } else {
322
+ toObj = toNode.parent.data
323
+ toChild = toObj.children
324
+ }
325
+ }
326
+ toChild?.forEach((item, i) => {
327
+ item.status = 'U'
328
+ item.sortnum = i + 1 + ''
329
+ item.pmid = toObj.menuid || null
330
+ item.parentTreeNo = toObj.treeno || null
331
+ })
332
+
333
+ this.canApply = true
334
+ },
194
335
  clickItem(item) {
195
336
  this.configModel = item
196
337
  this.configVisible = true
@@ -263,7 +404,7 @@ function saveTransform(list, labelKey, isFilter) {
263
404
  let listN = []
264
405
  if (!isFilter) {
265
406
  list.forEach((c) => {
266
- if (c.prop) {
407
+ if (c.prop && !c.children && !c.isNew) {
267
408
  listN.push({ _colKey: 'prop', _colVal: c.prop })
268
409
  } else if (c.slotName) {
269
410
  listN.push({ _colKey: 'slotName', _colVal: c.slotName })