From b42e29b3df97cc786614fa8ad8a6845de37d8a37 Mon Sep 17 00:00:00 2001 From: dai <851733175@qq.com> Date: Wed, 17 Nov 2021 10:28:49 +0800 Subject: [PATCH] ss --- .../visual/basicinfo/cpts/people-more.vue | 143 ++++++++++++------ 1 file changed, 93 insertions(+), 50 deletions(-) diff --git a/src/views/modules/visual/basicinfo/cpts/people-more.vue b/src/views/modules/visual/basicinfo/cpts/people-more.vue index 0db1f0e9..e035760c 100644 --- a/src/views/modules/visual/basicinfo/cpts/people-more.vue +++ b/src/views/modules/visual/basicinfo/cpts/people-more.vue @@ -90,38 +90,81 @@
-
- {{ field.label }}: - {{ +
+
+
+ {{ field.label }}: + {{ + infoItem[field.columnName] == null + ? "--" + : getOptionLabel( + field.options, + infoItem[field.columnName], + field.itemType + ) + }} + + {{ + infoItem[field.columnName] == null + ? "--" + : infoItem[field.columnName] + }} +
+
+
+
+
+ {{ field.label }}: + {{ + !allInfo[group.tableName] || + allInfo[group.tableName][0][field.columnName] == null + ? "--" + : getOptionLabel( + field.options, + allInfo[group.tableName][0][field.columnName], + field.itemType + ) + }} + + {{ !allInfo[group.tableName] || allInfo[group.tableName][0][field.columnName] == null ? "--" - : getOptionLabel( - field.options, - allInfo[group.tableName][0][field.columnName], - field.itemType - ) - }} - - {{ - !allInfo[group.tableName] || - allInfo[group.tableName][0][field.columnName] == null - ? "--" - : allInfo[group.tableName][0][field.columnName] - }} + : allInfo[group.tableName][0][field.columnName] + }} +
@@ -277,32 +320,33 @@ export default { getOptionLabel(options, value, type = "") { if (Array.isArray(options)) { let valueArr = value.split(","); - return valueArr - .map((val) => { - if (type != "cascader") { + if (type == "cascader") { + if (valueArr.length > 0) { + let level1 = options.find((item) => item.value == valueArr[0]); + console.log("----------------------- cascader", options); + if (level1) { + if (valueArr.length > 1 && level1.children) { + let level2 = level1.children.find( + (item) => item.value == valueArr[1] + ); + if (level2) { + return level1.label + "-" + level2.label; + } + } + return level1.label; + } + } + } else { + return valueArr + .map((val) => { let item = options.find((item) => item.value == val); if (item && item.label) { return item.label; } - } else { - let idx, subIdx; - options.forEach((item, index) => { - if (item.children) { - item.children.forEach((subitem, subIndex) => { - if (subitem.value == val) { - idx = index; - subIdx = subIndex; - } - }); - } - }); - if (idx && subIdx) { - return options[idx].children[subIdx].label; - } - } - return "--"; - }) - .join("、"); + return "--"; + }) + .join("、"); + } } return "--"; }, @@ -377,9 +421,8 @@ export default { this.groupList.forEach((subList, index) => { subList.itemList.forEach(async (item, subIndex) => { if (item.optionSourceType == "remote" && item.optionSourceValue) { - this.groupList[index].itemList.options = await this.getOptions( - item.optionSourceValue - ); + this.groupList[index].itemList[subIndex].options = + await this.getOptions(item.optionSourceValue); } }); });