1.4.5.2
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
{$layout "layout_popup"}
|
||||
|
||||
<h3 v-if="!isUpdating">添加子条件</h3>
|
||||
<h3 v-if="isUpdating">修改子条件</h3>
|
||||
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">选择条件类型</td>
|
||||
<td>
|
||||
<select class="ui dropdown auto-width" name="condType" v-model="condType" @change="changeCondType">
|
||||
<option v-for="c in components" :value="c.type">{{c.name}}</option>
|
||||
</select>
|
||||
{$ range .components}
|
||||
<p class="comment" v-if="condType == '{$ .Type}'">{$ .Description}</p>
|
||||
{$ end}
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="condType != 'params'">
|
||||
<td>{{paramsTitle}}</td>
|
||||
<td>
|
||||
{$ range .components}
|
||||
{$if not (eq .Type "params") }
|
||||
<{$ .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>
|
||||
</table>
|
||||
<submit-btn>确定</submit-btn>
|
||||
</form>
|
||||
@@ -0,0 +1,55 @@
|
||||
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 : ""
|
||||
|
||||
// 是否正在修改
|
||||
if (window.parent.UPDATING_COND != null) {
|
||||
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 () {
|
||||
let that = this
|
||||
let c = this.components.$find(function (k, v) {
|
||||
return v.type == that.condType
|
||||
})
|
||||
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)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,59 @@
|
||||
{$layout "layout_popup"}
|
||||
|
||||
<h3 v-if="!isUpdating">添加条件分组</h3>
|
||||
<h3 v-if="isUpdating">修改条件分组</h3>
|
||||
<form method="post" class="ui form" data-tea-success="success" data-tea-action="$">
|
||||
<input type="hidden" name="condGroupJSON" :value="JSON.stringify(group)"/>
|
||||
<table class="ui table definition selectable">
|
||||
<tr>
|
||||
<td class="title">子条件列表</td>
|
||||
<td style="word-break: break-all">
|
||||
<div v-if="group.conds.length > 0">
|
||||
<var v-for="(cond, index) in group.conds" style="font-style: normal;display: inline-block; margin-bottom:0.5em">
|
||||
<span class="ui label small">
|
||||
<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>
|
||||
<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}} </var>
|
||||
</var>
|
||||
<div class="ui divider"></div>
|
||||
</div>
|
||||
<button class="ui button tiny" type="button" @click.prevent="addCond()">+</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>子条件之间关系</td>
|
||||
<td>
|
||||
<select class="ui dropdown auto-width" v-model="group.connector">
|
||||
<option value="and">和</option>
|
||||
<option value="or">或</option>
|
||||
</select>
|
||||
<p class="comment" v-if="group.connector == 'and'">必须满足所有条件才能成立。</p>
|
||||
<p class="comment" v-if="group.connector == 'or'">只要满足其中一个条件即可成立。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2"><more-options-indicator></more-options-indicator></td>
|
||||
</tr>
|
||||
<tbody v-show="moreOptionsVisible">
|
||||
<tr>
|
||||
<td>补充说明</td>
|
||||
<td>
|
||||
<textarea rows="3" v-model="group.description" maxlength="100"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>启用当前分组</td>
|
||||
<td>
|
||||
<div class="ui checkbox">
|
||||
<input type="checkbox" v-model="group.isOn"/>
|
||||
<label></label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<submit-btn>确定</submit-btn>
|
||||
</form>
|
||||
@@ -0,0 +1,72 @@
|
||||
Tea.context(function () {
|
||||
this.success = NotifyPopup
|
||||
|
||||
this.group = {
|
||||
connector: "and", // 默认为and,更符合用户的直觉
|
||||
description: "",
|
||||
isReverse: false,
|
||||
conds: [],
|
||||
isOn: true
|
||||
}
|
||||
|
||||
this.isUpdating = false
|
||||
|
||||
// 是否在修改
|
||||
this.$delay(function () {
|
||||
if (window.parent.UPDATING_COND_GROUP != null) {
|
||||
this.group = window.parent.UPDATING_COND_GROUP
|
||||
this.isUpdating = true
|
||||
} else if (this.group.conds.length == 0) {
|
||||
// 如果尚未有条件,则自动弹出添加界面
|
||||
this.addCond()
|
||||
}
|
||||
})
|
||||
|
||||
// 条件类型名称
|
||||
this.typeName = function (cond) {
|
||||
let c = this.components.$find(function (k, v) {
|
||||
return v.type == cond.type
|
||||
})
|
||||
if (c != null) {
|
||||
return c.name;
|
||||
}
|
||||
return cond.param + " " + cond.operator
|
||||
}
|
||||
|
||||
// 添加条件
|
||||
this.addCond = function () {
|
||||
window.UPDATING_COND = null
|
||||
|
||||
let that = this
|
||||
|
||||
teaweb.popup("/servers/server/settings/conds/addCondPopup", {
|
||||
width: "32em",
|
||||
height: "22em",
|
||||
callback: function (resp) {
|
||||
that.group.conds.push(resp.data.cond)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 删除条件
|
||||
this.removeCond = function (condIndex) {
|
||||
let that = this
|
||||
teaweb.confirm("确定要删除此条件?", function () {
|
||||
that.group.conds.$remove(condIndex)
|
||||
})
|
||||
}
|
||||
|
||||
// 修改条件
|
||||
this.updateCond = function (condIndex, cond) {
|
||||
window.UPDATING_COND = cond
|
||||
let that = this
|
||||
|
||||
teaweb.popup("/servers/server/settings/conds/addCondPopup", {
|
||||
width: "32em",
|
||||
height: "22em",
|
||||
callback: function (resp) {
|
||||
Vue.set(that.group.conds, condIndex, resp.data.cond)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user