日期:2014-05-16  浏览次数:20394 次

EXTJS 化繁为简 减少冗余代码

function createRadioGroup(childOption, fileHtml) {
var radioGroup;
if (childOption.isconclusion == "1") {
radioGroup = {
xtype: "fieldset",
title: childOption.checkoptionName,
layout: "form",
collapsible: true,
items: [
        { 
         xtype: "component", 
         html: "<div style='margin-left:4px;'><font color='#0B6F9E'>审计方式: </font><span class='b'>" 
         + childOption.auditType + "</span></div>",
         cls: "a"
        },{ 
         xtype: "component", 
         html: "<div style='margin-left:4px;'><font color='#0B6F9E'>审计要点: </font><span class='b'>" 
         + childOption.auditPoint + "<span></div>" + fileHtml,
         cls: "a"
        },{ 
         xtype: "textfield", name: "comment" + childOption.checkoptionId, fieldLabel: "审计评语" 
        },{
         xtype: "container", layout: "vbox", padding: "",
items: [
{xtype: "textfield",fieldLabel: "自助值机数量", labelWidth: 100, maxWidth: 400,
name: "selfCheckInCount" + childOption.checkoptionId, flex:1},
{xtype: "textfield",fieldLabel: "自助值机率", labelWidth: 100, maxWidth: 400,
name: "selfCheckInProportion" + childOption.checkoptionId, flex: 1}
]
}
    ],
    listeners: { render: function(t) { t.collapse(); } }
};
} else if(childOption.isdesk == "1") {
radioGroup = {
xtype: "fieldset",
title: childOption.checkoptionName,
layout: "form",
collapsible: true,
items: [

xtype: "radiogroup", cls: "",
items: [
{boxLabel: "全开放柜台 ", name: "desk" + childOption.checkoptionId, inputValue: "publicDesk"},
{boxLabel: "专用柜台", name: "desk" + childOption.checkoptionId, inputValue: "privateDest"}
]

},{ 
         xtype: "component", 
         html: "<div style='margin-left:4px;'><font color='#0B6F9E'>审计方式: </font><span class='b'>" 
         + childOption.auditType + "</span></div>",
         cls: "a"
        },{