{
 "hidden": false,
 "children": [{
  "configs": {"itemId": "module"},
  "expanded": true,
  "children": [
   {
    "configs": {
     "layout": "absolute",
     "dialog": "true",
     "itemId": "win",
     "focusControl": "STRING_FIELD",
     "closeAction": "destroy",
     "width": "400",
     "title": "增删改查",
     "modal": "true",
     "height": "288"
    },
    "expanded": true,
    "children": [
     {
      "configs": {
       "allowBlank": "false",
       "itemId": "ROLE_ID",
       "labelAlign": "right",
       "fieldLabel": "* 角色id",
       "width": "328",
       "x": "8",
       "y": "16",
       "labelWidth": "90",
       "height": "26"
      },
      "expanded": false,
      "children": [],
      "type": "text"
     },
     {
      "configs": {
       "allowBlank": "false",
       "itemId": "ROLE_NAME",
       "labelAlign": "right",
       "fieldLabel": "* 角色名称",
       "width": "328",
       "x": "8",
       "y": "48",
       "labelWidth": "90",
       "height": "26"
      },
      "expanded": false,
      "children": [],
      "type": "text"
     },
     {
      "configs": {
       "allowBlank": "true",
       "itemId": "REMARK",
       "labelAlign": "right",
       "fieldLabel": "角色描述",
       "width": "328",
       "x": "8",
       "y": "80",
       "labelWidth": "90",
       "height": "118"
      },
      "expanded": false,
      "children": [],
      "type": "text"
     },
     {
      "configs": {
       "allowBlank": "true",
       "itemId": "STATUS",
       "hidden": "true",
       "labelAlign": "right",
       "fieldLabel": "角色状态",
       "width": "328",
       "x": "0",
       "y": "136",
       "labelWidth": "90",
       "value": "1",
       "height": "118"
      },
      "expanded": false,
      "children": [],
      "type": "text"
     }
    ],
    "type": "window"
   },
   {
    "configs": {
     "layout": "fit",
     "itemId": "viewport1"
    },
    "expanded": true,
    "children": [{
     "configs": {
      "border": "false",
      "itemId": "grid1",
      "multiSelect": "true"
     },
     "expanded": true,
     "children": [
      {
       "configs": {
        "itemId": "store",
        "autoLoad": "true",
        "url": "m?xwl=admin/role/select"
       },
       "expanded": false,
       "children": [],
       "type": "store"
      },
      {
       "configs": {"itemId": "tbar"},
       "expanded": true,
       "children": [
        {
         "configs": {
          "itemId": "newBtn",
          "tooltip": "添加新的记录",
          "text": "添加",
          "iconCls": "record_add_icon"
         },
         "expanded": false,
         "children": [],
         "type": "item",
         "events": {"click": "var win = new Ext.window.Window(app._win); //app._win指向配置对象而非实例\
win.show();\
win.setIconCls('record_add_icon');\
Wb.setTitle(win, '添加');\
//窗口每次动态生成,方法在窗口销毁时自动销毁\
win.mon(win, 'ok', function() {\
  var values = Wb.getValue(win);\
  Wb.request({\
    url: 'm?xwl=admin/role/insert', //使用basic-insert用于演示基本的操作，更简单的操作可使用'm?xwl=examples/crud/crud-db-access/insert'替代\
    params: values,\
    success: function(resp) {\
     // Wb.apply(values, Wb.decode(resp.responseText)); //把后台返回的ID_FIELD等数据应用到values中\
    //  Wb.add(app.grid1, values); //同步在客户端表格中添加\
      win.close();\
      app.grid1.store.reload();\
    }\
  });\
});"}
        },
        {
         "configs": {
          "itemId": "editBtn",
          "tooltip": "修改选择的记录",
          "text": "修改",
          "iconCls": "record_edit_icon"
         },
         "expanded": false,
         "children": [],
         "type": "item",
         "events": {"click": "var rec = app.grid1.getSelection()[0];\
if (!rec) {\
  Wb.warn('请选择 1 条需要修改的记录。');\
  return;\
}\
var win = new Ext.window.Window(app._win); //app._win指向配置对象而非实例\
win.show();\
win.setIconCls('record_edit_icon');\
Wb.setTitle(win, '修改');\
Wb.setValue(win, rec.data); //把记录数据应用到窗口\
//窗口每次动态生成,方法在窗口销毁时自动销毁\
win.mon(win, 'ok', function() {\
  var values = Wb.applyIf(Wb.getValue(win), Wb.getData(rec, true)); //Wb.getData用于获取记录中的原始值，见Wb.getData方法\
  Wb.request({\
    url: 'm?xwl=admin/role/update',\
    params: values,\
    success: function(resp) {\
      Wb.update(rec, values); //同步在客户端表格中更新\
      win.close();\
    }\
  });\
});"}
        },
        {
         "configs": {
          "itemId": "delBtn",
          "tooltip": "删除选择的记录",
          "text": "删除",
          "iconCls": "record_delete_icon"
         },
         "expanded": false,
         "children": [],
         "type": "item",
         "events": {"click": "/*\
建议使用此方法：\
Wb.del(app.grid1, {\
  url: 'm?xwl=examples/crud/crud-db-access/delete',\
  titleField: 'STRING_FIELD'\
});\
*/\
//使用下面方法用于演示完整的步骤\
var recs = app.grid1.getSelection();\
if (!recs.length) {\
  Wb.warn('请选择需要删除的记录。');\
  return;\
}\
Wb.confirm('确定要删除选择的 ' + recs.length + ' 条记录吗？', function() {\
  Wb.request({\
    url: 'm?xwl=admin/role/delete', //使用basic-delete.xwl用于演示目的，建议使用delete.xwl\
    params: {\
      destroy: Wb.getData(recs, true)\
    },\
    success: function() {\
      Wb.remove(app.grid1, recs);\
    }\
  });\
});"}
        }
       ],
       "type": "toolbar"
      },
      {
       "configs": {"itemId": "columns"},
       "expanded": true,
       "children": [
        {
         "configs": {
          "itemId": "rowNumCol",
          "xtype": "rownumberer"
         },
         "expanded": false,
         "children": [],
         "type": "column"
        },
        {
         "configs": {
          "itemId": "roleidCol",
          "dataIndex": "ROLE_ID",
          "width": "150",
          "text": "角色id"
         },
         "expanded": true,
         "children": [],
         "type": "column"
        },
        {
         "configs": {
          "itemId": "rolenameCol",
          "dataIndex": "ROLE_NAME",
          "width": "200",
          "text": "角色名称"
         },
         "expanded": true,
         "children": [],
         "type": "column"
        },
        {
         "configs": {
          "itemId": "remarkCol",
          "dataIndex": "REMARK",
          "width": "200",
          "text": "角色描述"
         },
         "expanded": true,
         "children": [],
         "type": "column"
        },
        {
         "configs": {
          "itemId": "boolCol",
          "dataIndex": "STATUS",
          "keyName": "bool",
          "text": "状态"
         },
         "expanded": true,
         "children": [],
         "type": "column",
         "events": {"afterrender": "return Wb.kv();"}
        }
       ],
       "type": "array"
      }
     ],
     "type": "grid",
     "events": {"itemdblclick": "app.editBtn.fireEvent('click');"}
    }],
    "type": "viewport"
   }
  ],
  "type": "module"
 }],
 "roles": {"demo": 1},
 "title": "角色维护",
 "iconCls": "",
 "inframe": false,
 "pageLink": ""
}