You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
267 lines
11 KiB
267 lines
11 KiB
import { shortcut, Widget, i18nText } from "@/core"; |
|
import { DownListCombo } from "@/widget"; |
|
|
|
@shortcut() |
|
export class Downlist extends Widget { |
|
static xtype = "demo.down_list"; |
|
|
|
props = { baseCls: "demo-downlist" }; |
|
|
|
mounted() { |
|
const downlist = this.downlist; |
|
const label = this.label; |
|
this.downlist.setValue([ |
|
{ |
|
value: [11, 6], |
|
childValue: 67, |
|
} |
|
]); |
|
downlist.on(DownListCombo.EVENT_CHANGE, (value, fatherValue) => { |
|
label.setValue(JSON.stringify(downlist.getValue())); |
|
}); |
|
|
|
this.downlist.on(DownListCombo.EVENT_SON_VALUE_CHANGE, (value, fatherValue) => { |
|
label.setValue(JSON.stringify(downlist.getValue())); |
|
}); |
|
} |
|
|
|
render() { |
|
const self = this; |
|
|
|
return { |
|
type: "bi.left", |
|
items: [ |
|
{ |
|
type: "bi.down_list_combo", |
|
ref (_ref) { |
|
self.downlist = _ref; |
|
}, |
|
// value: [{"childValue":22,"value":11},{"value":18},{"value":20}], |
|
height: 30, |
|
width: 100, |
|
items: [ |
|
[ |
|
{ |
|
text: "column 1111", |
|
iconCls1: "dot-e-font", |
|
value: 12, |
|
children: [ |
|
{ |
|
text: "column 1.1", |
|
value: 21, |
|
cls: "dot-e-font", |
|
}, |
|
{ |
|
text: "column 1.2", |
|
value: 22, |
|
cls: "dot-e-font", |
|
} |
|
], |
|
} |
|
], |
|
[ |
|
{ |
|
el: { |
|
text: "column 1111", |
|
iconCls1: "dot-e-font", |
|
value: 11, |
|
}, |
|
children: [ |
|
{ |
|
text: "column 1.1", |
|
value: 21, |
|
cls: "dot-e-font", |
|
}, |
|
{ |
|
text: "column 1.2", |
|
value: 22, |
|
cls: "dot-e-font", |
|
} |
|
], |
|
// children: [{ |
|
// text: i18nText("BI-Basic_None"), |
|
// cls: "dot-e-font", |
|
// value: 1 |
|
// }, { |
|
// text: i18nText("BI-Basic_Calculate_Same_Period"), |
|
// cls: "dot-e-font", |
|
// value: 2 |
|
// }, { |
|
// text: i18nText("BI-Basic_Calculate_Same_Ring"), |
|
// cls: "dot-e-font", |
|
// value: 3 |
|
// }, { |
|
// text: i18nText("BI-Basic_Calculate_Same_Period_Rate"), |
|
// cls: "dot-e-font", |
|
// value: 4 |
|
// }, { |
|
// text: i18nText("BI-Basic_Calculate_Same_Ring_Rate"), |
|
// cls: "dot-e-font", |
|
// value: 5 |
|
// }, { |
|
// el: { |
|
// text: i18nText("BI-Basic_Rank"), |
|
// iconCls1: "dot-e-font", |
|
// value: 6 |
|
// }, |
|
// children: [{ |
|
// text: "test1", |
|
// cls: "dot-e-font", |
|
// value: 67 |
|
// }, { |
|
// text: "test2", |
|
// cls: "dot-e-font", |
|
// value: 68 |
|
// }] |
|
// }, { |
|
// text: i18nText("BI-Basic_Rank_In_Group"), |
|
// cls: "dot-e-font", |
|
// value: 7 |
|
// }, { |
|
// text: i18nText("BI-Basic_Sum_Of_All"), |
|
// cls: "dot-e-font", |
|
// value: 8 |
|
// }, { |
|
// text: i18nText("BI-Basic_Sum_Of_All_In_Group"), |
|
// cls: "dot-e-font", |
|
// value: 9 |
|
// }, { |
|
// text: i18nText("BI-Basic_Sum_Of_Above"), |
|
// cls: "dot-e-font", |
|
// value: 10 |
|
// }, { |
|
// text: i18nText("BI-Basic_Sum_Of_Above_In_Group"), |
|
// cls: "dot-e-font", |
|
// value: 11 |
|
// }, { |
|
// text: i18nText("BI-Design_Current_Dimension_Percent"), |
|
// cls: "dot-e-font", |
|
// value: 12 |
|
// }, { |
|
// text: i18nText("BI-Design_Current_Target_Percent"), |
|
// cls: "dot-e-font", |
|
// value: 13 |
|
// }] |
|
} |
|
] |
|
], |
|
}, |
|
{ |
|
type: "bi.down_list_combo", |
|
el: { |
|
type: "bi.button", |
|
ghost: true, |
|
iconPosition: "right", |
|
icon: "column-next-page-h-font", |
|
text: "自定义 trigger 和 icon 的级联下拉框", |
|
}, |
|
listeners: [ |
|
{ |
|
eventName: "EVENT_CHANGE", |
|
action (v) { |
|
console.log("触发值", v); |
|
}, |
|
}, |
|
{ |
|
eventName: "EVENT_SON_VALUE_CHANGE", |
|
action (v) { |
|
console.log("二级菜单触发值", v); |
|
}, |
|
} |
|
], |
|
items: [ |
|
[ |
|
{ |
|
text: "选项一", |
|
value: 1, |
|
icon: { |
|
type: "demo.downlist.icon", |
|
}, |
|
children: [ |
|
{ |
|
text: "选项一", |
|
value: 11, |
|
icon: { |
|
type: "demo.downlist.icon", |
|
}, |
|
}, |
|
{ |
|
text: "选项二", |
|
value: 12, |
|
} |
|
], |
|
}, |
|
{ |
|
text: "选项二", |
|
value: 2, |
|
} |
|
] |
|
], |
|
}, |
|
{ |
|
type: "bi.multi_layer_down_list_combo", |
|
ref (_ref) { |
|
self.downlist = _ref; |
|
}, |
|
// value: [{"childValue":22,"value":11},{"value":18},{"value":20}], |
|
height: 30, |
|
width: 100, |
|
items: [ |
|
[ |
|
{ |
|
el: { |
|
text: "column 1111", |
|
iconCls1: "dot-e-font", |
|
value: 12, |
|
}, |
|
children: [ |
|
{ |
|
text: "column 1.1", |
|
value: 21, |
|
cls: "dot-e-font", |
|
}, |
|
{ |
|
text: "column 1.2", |
|
value: 22, |
|
cls: "dot-e-font", |
|
} |
|
], |
|
} |
|
], |
|
[ |
|
{ |
|
el: { |
|
text: "column 1111", |
|
iconCls1: "dot-e-font", |
|
value: 11, |
|
}, |
|
children: [ |
|
{ |
|
text: "column 1.1", |
|
value: 21, |
|
cls: "dot-e-font", |
|
}, |
|
{ |
|
text: "column 1.2", |
|
value: 22, |
|
cls: "dot-e-font", |
|
} |
|
], |
|
} |
|
] |
|
], |
|
}, |
|
{ |
|
type: "bi.label", |
|
text: "显示选择值", |
|
width: 500, |
|
cls: "layout-bg3", |
|
ref (_ref) { |
|
self.label = _ref; |
|
}, |
|
} |
|
], |
|
vgap: 20, |
|
}; |
|
} |
|
}
|
|
|