/** * 单先字段,过滤组件 * @param {*} dlgId 对话框随机id,防止id冲突与数据集id统一命名引用 * @param {*} dsId 绑定过滤数据集ID * @param {*} filterField 过滤字段名 * @param {*} option 扩展选项 * @returns */ export function radioInputQuery(dlgId, option) { let hcRadioGroup = option.hcRadioGroup; if (!(hcRadioGroup && hcRadioGroup.option)) { console.error("单元字段段过滤器,项option属性未配置."); } let hcInputId = "hcRadioInput_" + dlgId; // 组织过滤字段单选项 let radioItems = []; hcRadioGroup.option.forEach((item, i) => { let rItem = Object.assign({ controlName: "HcRadioButton", label: i }, item) radioItems.push(rItem); }) // 单选按钮组 let radioGroup = { controlName: "HcRadioGroup", controlId: "HcRadioGroup_" + dlgId, slot: "prepend", value: 0, children: radioItems, events: { change: function (val) { alert(val); let hcInput = this.getRefCompt(hcInputId); } } } // 过滤编辑器 let hcInput = { controlName: "HcInput", controlId: hcInputId, bindField: radioItems[0].bindField, bindShowField: radioItems[0].bindShowField || "", children: [ radioGroup ] } // 应用个性化输入属性 Object.assign(hcInput, option.hcInput || {}) // 返回布局结构 return hcInputId }