imeik-bizui 2.3.8 → 2.4.0
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/dist/bizui/src/CommonDepartmentCascader/index.vue +52 -8
- package/dist/bizui/src/FieldContentDescription/index.vue +1 -1
- package/dist/imeik-bizui.common.js +164 -114
- package/dist/imeik-bizui.common.js.gz +0 -0
- package/dist/imeik-bizui.css +1 -1
- package/dist/imeik-bizui.css.gz +0 -0
- package/dist/imeik-bizui.umd.js +164 -114
- package/dist/imeik-bizui.umd.js.gz +0 -0
- package/dist/imeik-bizui.umd.min.js +4 -4
- package/dist/imeik-bizui.umd.min.js.gz +0 -0
- package/package.json +1 -1
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
specificOrgCode: 指定某个部门节点 如果要制定展示某个部门的数据 通过制定这个属性 比如市场发展中心为virtual-A03
|
|
24
24
|
hasRoot: 指定某个部门节点以后是否展示根节点 有时候根节点只有一项 不想展示可以指定为false
|
|
25
25
|
noVirtual: 不展示虚拟父节点,方便放在其他场景里使用
|
|
26
|
+
showAllLevelsWhenView: 查看的时候是否展示完整路径(如:公司 / 部门 / 子部门)
|
|
26
27
|
|
|
27
28
|
使用示例:
|
|
28
29
|
<CommonDepartmentCascader
|
|
@@ -195,6 +196,14 @@ export default {
|
|
|
195
196
|
}
|
|
196
197
|
},
|
|
197
198
|
computed: {
|
|
199
|
+
/**
|
|
200
|
+
* 查看时每条是否展示完整路径(如:公司 / 部门 / 子部门)
|
|
201
|
+
* 默认不展示
|
|
202
|
+
*/
|
|
203
|
+
showAllLevelsWhenView() {
|
|
204
|
+
return !!this.$attrs.showAllLevelsWhenView
|
|
205
|
+
},
|
|
206
|
+
|
|
198
207
|
/**
|
|
199
208
|
* 不展示虚拟父节点
|
|
200
209
|
* 默认展示,方便部门选择器使用,如果不展示虚拟父节点,方便放在其他场景里使用
|
|
@@ -249,22 +258,31 @@ export default {
|
|
|
249
258
|
/**
|
|
250
259
|
* 展示的文本
|
|
251
260
|
* 根据选中的值从optionMap中获取对应的部门名称
|
|
261
|
+
* showAllLevelsWhenView 为 true 时每条展示完整路径(如:公司 / 部门 / 子部门)
|
|
252
262
|
*/
|
|
253
263
|
plantText() {
|
|
254
264
|
const list = []
|
|
265
|
+
const getDisplayName = (value) => {
|
|
266
|
+
const item = this.optionMap[value]
|
|
267
|
+
if (!item) return ''
|
|
268
|
+
if (this.showAllLevelsWhenView) {
|
|
269
|
+
const pathNames = this.getDepartmentPath(this.options, value)
|
|
270
|
+
return pathNames.length ? pathNames.join(' / ') : item.departmentName
|
|
271
|
+
}
|
|
272
|
+
return item.departmentName
|
|
273
|
+
}
|
|
255
274
|
|
|
256
275
|
if (Array.isArray(this.myValue)) {
|
|
276
|
+
// emitPath 时 myValue 可能是路径数组的数组,取最后一项为当前节点
|
|
257
277
|
this.myValue.forEach((i) => {
|
|
258
|
-
const
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}
|
|
278
|
+
const value = Array.isArray(i) ? i[i.length - 1] : i
|
|
279
|
+
const name = getDisplayName(value)
|
|
280
|
+
if (name) list.push(name)
|
|
262
281
|
})
|
|
263
282
|
} else {
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}
|
|
283
|
+
const value = Array.isArray(this.myValue) ? this.myValue[this.myValue.length - 1] : this.myValue
|
|
284
|
+
const name = getDisplayName(value)
|
|
285
|
+
if (name) list.push(name)
|
|
268
286
|
}
|
|
269
287
|
|
|
270
288
|
return list.join(', ')
|
|
@@ -384,6 +402,32 @@ export default {
|
|
|
384
402
|
})
|
|
385
403
|
},
|
|
386
404
|
|
|
405
|
+
/**
|
|
406
|
+
* 从根节点到目标节点的部门名称路径
|
|
407
|
+
* @param {Array} options - 当前层级的节点列表
|
|
408
|
+
* @param {String|Number} targetValue - 目标节点的值
|
|
409
|
+
* @param {Array} pathNames - 已收集的路径名称
|
|
410
|
+
* @returns {Array} 从根到目标节点的名称数组,未找到返回 []
|
|
411
|
+
*/
|
|
412
|
+
getDepartmentPath(options, targetValue, pathNames = []) {
|
|
413
|
+
if (!options || !options.length) return []
|
|
414
|
+
const field = this.childField
|
|
415
|
+
const valueKey = this.valueField
|
|
416
|
+
for (let i = 0; i < options.length; i++) {
|
|
417
|
+
const item = options[i]
|
|
418
|
+
const name = item.departmentName
|
|
419
|
+
const nextPath = [...pathNames, name]
|
|
420
|
+
if (item[valueKey] === targetValue || item.orgCode === targetValue) {
|
|
421
|
+
return nextPath
|
|
422
|
+
}
|
|
423
|
+
if (item[field] && item[field].length) {
|
|
424
|
+
const found = this.getDepartmentPath(item[field], targetValue, nextPath)
|
|
425
|
+
if (found.length) return found
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
return []
|
|
429
|
+
},
|
|
430
|
+
|
|
387
431
|
/**
|
|
388
432
|
* 处理选项
|
|
389
433
|
* 递归处理部门列表,生成optionMap映射表
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="page-view">
|
|
3
|
-
<p v-if="isView">{{ descript }}</p>
|
|
3
|
+
<p v-if="isView">{{ descript || '-' }}</p>
|
|
4
4
|
<div v-else>
|
|
5
5
|
<p class="bottomText">{{ bottomTextMap }}</p>
|
|
6
6
|
<FieldInput v-model="descript" :attrs="{ ...myAttrs, isView }" @input="onInput"></FieldInput>
|