diff --git a/frontend/src/business/components/api/definition/components/document/components/ApiInfoCollapse.vue b/frontend/src/business/components/api/definition/components/document/components/ApiInfoCollapse.vue index 1969746ce4..7db961eed5 100644 --- a/frontend/src/business/components/api/definition/components/document/components/ApiInfoCollapse.vue +++ b/frontend/src/business/components/api/definition/components/document/components/ApiInfoCollapse.vue @@ -36,7 +36,7 @@
- { this.tableData.forEach(i => { - this.$refs.expandTable.toggleRowExpansion(i, expand) + if (i.hasAdvancedSetting) { + this.$refs.expandTable.toggleRowExpansion(i, expand) + } }); this.$refs.expandTable.doLayout(); }) @@ -146,6 +148,30 @@ export default { } }, methods: { + getRowClassName({row, rowIndex}) { + let classname = 'autofix-table-row '; + // 通过判断给不需要展开行功能的数据设置样式,通过样式去隐藏展开行图标 + if (!row.hasAdvancedSetting) { + classname += ' hide-expand' + } + return classname; + }, + isNotEmptyValue(value) { + return value && value !== ''; + }, + rowHasAdvancedSetting(tableData) { + let hasAdvancedSetting = false; + if (this.isNotEmptyValue(tableData['min'])) { + hasAdvancedSetting = true; + } else if (this.isNotEmptyValue(tableData['max'])) { + hasAdvancedSetting = true; + } else if (tableData['urlEncode']) { + hasAdvancedSetting = true; + } else if (this.isNotEmptyValue(tableData['description'])) { + hasAdvancedSetting = true; + } + return hasAdvancedSetting; + }, getTableClass() { if (this.language === "zh_TW") { return "test-content document-table tw-table"; @@ -182,6 +208,11 @@ export default { item.isRequired = "false"; } item.id = getUUID(); + if (this.rowHasAdvancedSetting(item)) { + item.hasAdvancedSetting = true; + } else { + item.hasAdvancedSetting = false; + } returnJsonArr.push(item); } } @@ -256,6 +287,11 @@ export default { border-right: 0px solid #EBEEF5 } +/*通过样式隐藏图标*/ +.document-table /deep/ .hide-expand .el-table__expand-column .cell { + visibility: hidden; +} + /*展开按钮未点击的样式是加号带边框*/ .cn-table /deep/ .el-table__expand-icon .el-icon-arrow-right:before { position: unset; diff --git a/frontend/src/business/components/api/definition/components/document/components/ApiRequestInfo.vue b/frontend/src/business/components/api/definition/components/document/components/ApiRequestInfo.vue index f6bba4d54d..697e1c99aa 100644 --- a/frontend/src/business/components/api/definition/components/document/components/ApiRequestInfo.vue +++ b/frontend/src/business/components/api/definition/components/document/components/ApiRequestInfo.vue @@ -3,6 +3,7 @@
{ this.tableData.forEach(i => { - this.$refs.expandTable.toggleRowExpansion(i, expand) + if (i.hasAdvancedSetting) { + this.$refs.expandTable.toggleRowExpansion(i, expand) + } }); this.$refs.expandTable.doLayout(); }) @@ -127,6 +130,30 @@ export default { } }, methods: { + getRowClassName({row, rowIndex}) { + let classname = 'autofix-table-row '; + // 通过判断给不需要展开行功能的数据设置样式,通过样式去隐藏展开行图标 + if (!row.hasAdvancedSetting) { + classname += ' hide-expand'; + } + return classname; + }, + isNotEmptyValue(value) { + return value && value !== ''; + }, + rowHasAdvancedSetting(tableData) { + let hasAdvancedSetting = false; + if (this.isNotEmptyValue(tableData['min'])) { + hasAdvancedSetting = true; + } else if (this.isNotEmptyValue(tableData['max'])) { + hasAdvancedSetting = true; + } else if (tableData['urlEncode']) { + hasAdvancedSetting = true; + } else if (this.isNotEmptyValue(tableData['description'])) { + hasAdvancedSetting = true; + } + return hasAdvancedSetting; + }, getTableClass() { if (this.language === "zh_TW") { return "test-content document-table tw-table"; @@ -174,6 +201,11 @@ export default { var item = jsonArr[index]; if (item.name !== "" && item.name !== null) { item.id = getUUID(); + if (this.rowHasAdvancedSetting(item)) { + item.hasAdvancedSetting = true; + } else { + item.hasAdvancedSetting = false; + } returnJsonArr.push(item); } } @@ -245,6 +277,11 @@ export default { border-right: 0px solid #EBEEF5 } +/*通过样式隐藏图标*/ +.document-table /deep/ .hide-expand .el-table__expand-column .cell { + visibility: hidden; +} + /*修改展开按钮时不旋转*/ .document-table /deep/ .el-table__expand-icon { -webkit-transform: rotate(0deg); diff --git a/frontend/src/business/components/api/definition/components/document/components/plugin/TableAdvancedSetting.vue b/frontend/src/business/components/api/definition/components/document/components/plugin/TableAdvancedSetting.vue index aea3051412..1c816eeaa4 100644 --- a/frontend/src/business/components/api/definition/components/document/components/plugin/TableAdvancedSetting.vue +++ b/frontend/src/business/components/api/definition/components/document/components/plugin/TableAdvancedSetting.vue @@ -34,16 +34,16 @@ export default { initAdvancedValue() { if (this.tableData) { this.advancedValue = {}; - if (this.tableData["min"] && this.isNotEmptyValue(this.tableData["min"])) { + if (this.isNotEmptyValue(this.tableData["min"])) { this.advancedValue["schema.minLength"] = this.tableData["min"]; } - if (this.tableData["max"] && this.isNotEmptyValue(this.tableData["max"])) { + if (this.isNotEmptyValue(this.tableData["max"])) { this.advancedValue["schema.maxLength"] = this.tableData["max"]; } if (this.tableData["urlEncode"]) { this.advancedValue["commons.encode"] = this.$t("commons.yes"); } - if (this.tableData["description"] && this.isNotEmptyValue(this.tableData["description"])) { + if (this.isNotEmptyValue(this.tableData["description"])) { this.advancedValue["commons.description"] = this.tableData["description"]; } if (JSON.stringify(this.advancedValue) === "{}") {