请求条件增加不区分大小写选项

This commit is contained in:
GoEdgeLab
2021-12-12 16:11:25 +08:00
parent 6b7c559af2
commit 8ade6b2ec1
8 changed files with 190 additions and 20 deletions

View File

@@ -20,11 +20,21 @@
<td>
{$ range .components}
{$if not (eq .Type "params") }
<{$ .Component} v-if="condType == '{$ .Type}'" :v-cond="cond"></{$ .Component}>
<{$ .Component} v-if="condType == '{$ .Type}'" :v-cond="cond" ref="component"></{$ .Component}>
{$end}
{$ end}
</td>
</tr>
<tr v-if="paramsCaseInsensitive">
<td>不区分大小写</td>
<td>
<div class="ui checkbox">
<input type="checkbox" v-model="isCaseInsensitive" @change="changeCaseInsensitive"/>
<label></label>
</div>
<p class="comment">选中后表示对比时忽略参数值的大小写。</p>
</td>
</tr>
<!-- 变量相关 -->
<tbody is="http-cond-params" :v-cond="cond" v-if="condType == 'params'"></tbody>

View File

@@ -2,6 +2,8 @@ Tea.context(function () {
this.isUpdating = false
this.cond = null
this.paramsTitle = ""
this.paramsCaseInsensitive = false
this.isCaseInsensitive = false
this.success = NotifyPopup
this.condType = (this.components.length > 0) ? this.components[0].type : ""
@@ -11,6 +13,9 @@ Tea.context(function () {
this.isUpdating = true
this.condType = window.parent.UPDATING_COND.type
this.cond = window.parent.UPDATING_COND
if (typeof (this.cond.isCaseInsensitive) == "boolean") {
this.isCaseInsensitive = this.cond.isCaseInsensitive
}
}
this.changeCondType = function () {
@@ -20,12 +25,31 @@ Tea.context(function () {
})
if (c == null || c.paramsTitle.length == 0) {
that.paramsTitle = "条件参数"
that.paramsCaseInsensitive = false
} else {
that.paramsTitle = c.paramsTitle
if (typeof (c.caseInsensitive) != "undefined") {
that.paramsCaseInsensitive = c.caseInsensitive
that.$delay(function () {
that.changeCaseInsensitive()
})
} else {
that.paramsCaseInsensitive = false
}
}
}
this.$delay(function () {
this.changeCondType()
})
this.changeCaseInsensitive = function () {
let componentRef = this.$refs.component
if (componentRef == null) {
return
}
if (typeof (componentRef.changeCaseInsensitive) == "function") {
componentRef.changeCaseInsensitive(this.isCaseInsensitive)
}
}
})

View File

@@ -14,6 +14,7 @@
<var v-if="cond.type.length == 0 || cond.type == 'params'" style="font-style: normal">{{cond.param}} <var>{{cond.operator}}</var></var>
<var v-if="cond.type.length > 0 && cond.type != 'params'" style="font-style: normal">{{typeName(cond)}}: </var>
{{cond.value}}
<sup v-if="cond.isCaseInsensitive" title="不区分大小写"><i class="icon info small"></i></sup> &nbsp;
<a href="" title="修改" @click.prevent="updateCond(index, cond)"><i class="icon pencil small"></i></a> <a href="" title="删除" @click.prevent="removeCond(index)"><i class="icon remove"></i></a> </span>
<var v-if="index < group.conds.length - 1"> {{group.connector}} &nbsp;</var>
</var>