// 浏览条件列表 Vue.component("http-request-conds-view", { props: ["v-conds"], data: function () { let conds = this.vConds if (conds == null) { conds = { isOn: true, connector: "or", groups: [] } } if (conds.groups == null) { conds.groups = [] } let that = this conds.groups.forEach(function (group) { group.conds.forEach(function (cond) { cond.typeName = that.typeName(cond) }) }) return { initConds: conds } }, computed: { // 之所以使用computed,是因为需要动态更新 conds: function () { return this.initConds } }, methods: { typeName: function (cond) { let c = window.REQUEST_COND_COMPONENTS.$find(function (k, v) { return v.type == cond.type }) if (c != null) { return c.name; } return cond.param + " " + cond.operator }, updateConds: function (conds) { this.initConds = conds }, notifyChange: function () { let that = this if (this.initConds.groups != null) { this.initConds.groups.forEach(function (group) { group.conds.forEach(function (cond) { cond.typeName = that.typeName(cond) }) }) this.$forceUpdate() } } }, template: `
{{cond.param}} {{cond.operator}} {{cond.typeName}}: {{cond.value}} {{group.connector}}  
{{group.description}}
` })