diff --git a/frontend/src/business/components/api/automation/scenario/common/ApiBaseComponent.vue b/frontend/src/business/components/api/automation/scenario/common/ApiBaseComponent.vue index 1d1798ec5a..6b15f37c90 100644 --- a/frontend/src/business/components/api/automation/scenario/common/ApiBaseComponent.vue +++ b/frontend/src/business/components/api/automation/scenario/common/ApiBaseComponent.vue @@ -1,22 +1,21 @@ diff --git a/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue b/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue index a0d7bf3649..d2e1515ec7 100644 --- a/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue +++ b/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue @@ -1,14 +1,22 @@ - - @@ -63,7 +69,7 @@ import MsEditRandom from "./EditRandom"; import MsEditListValue from "./EditListValue"; import MsEditCsv from "./EditCsv"; - import {getUUID} from "@/common/js/utils"; + import {_filter, getUUID} from "@/common/js/utils"; export default { name: "MsVariableList", @@ -80,6 +86,9 @@ data() { return { variables: [], + searchType: "", + selectVariable: "", + condition: {}, types: new Map([ ['CONSTANT', '常量'], ['LIST', '列表'], @@ -105,6 +114,12 @@ edit(row) { this.editData = row; }, + tableRowClassName(row) { + if (row.row.hidden) { + return 'ms-variable-hidden-row'; + } + return ''; + }, addParameters(v) { v.id = getUUID(); if (v.type === 'CSV') { @@ -133,10 +148,13 @@ this.visible = false; let saveVariables = []; this.variables.forEach(item => { + item.hidden = undefined; if (item.name && item.name != "") { saveVariables.push(item); } }) + this.selectVariable = ""; + this.searchType = ""; this.$emit('setVariables', saveVariables); }, deleteVariable() { @@ -149,11 +167,46 @@ const index = this.variables.findIndex(d => d.id === row); this.variables.splice(index, 1); }) - } + }, + filter() { + let datas = []; + this.variables.forEach(item => { + if (this.searchType && this.searchType != "" && this.selectVariable && this.selectVariable != "") { + if ((item.type && item.type.toLowerCase().indexOf(this.searchType.toLowerCase()) == -1) || (item.name && item.name.toLowerCase().indexOf(this.selectVariable.toLowerCase()) == -1)) { + item.hidden = true; + } else { + item.hidden = undefined; + } + } + else if (this.selectVariable && this.selectVariable != "") { + if (item.name && item.name.toLowerCase().indexOf(this.selectVariable.toLowerCase()) == -1) { + item.hidden = true; + } else { + item.hidden = undefined; + } + } + else if (this.searchType && this.searchType != "") { + if (item.type && item.type.toLowerCase().indexOf(this.searchType.toLowerCase()) == -1) { + item.hidden = true; + } else { + item.hidden = undefined; + } + } + datas.push(item); + }) + this.variables = datas; + }, + createFilter(queryString) { + return item => { + return (item.type && item.type.toLowerCase().indexOf(queryString.toLowerCase()) !== -1); + }; + }, } } -