{
 "hidden": false,
 "children": [{
  "configs": {"itemId": "module"},
  "expanded": true,
  "children": [
   {
    "configs": {
     "layout": "fit",
     "itemId": "viewport1"
    },
    "expanded": true,
    "children": [{
     "configs": {
      "itemId": "grid1",
      "multiSelect": "true"
     },
     "expanded": true,
     "children": [
      {
       "configs": {
        "itemId": "store",
        "autoLoad": "true",
        "url": "m?xwl=common/report/templateEdit/select"
       },
       "expanded": false,
       "children": [],
       "type": "store"
      },
      {
       "configs": {"itemId": "columns"},
       "expanded": true,
       "children": [
        {
         "configs": {
          "itemId": "row",
          "xtype": "rownumberer"
         },
         "expanded": false,
         "children": [],
         "type": "column"
        },
        {
         "configs": {
          "itemId": "ID",
          "dataIndex": "COD",
          "text": "COD",
          "align": "left"
         },
         "expanded": false,
         "children": [],
         "type": "column"
        },
        {
         "configs": {
          "itemId": "TYP",
          "dataIndex": "TYP",
          "text": "类型",
          "align": "left"
         },
         "expanded": false,
         "children": [],
         "type": "column"
        },
        {
         "configs": {
          "itemId": "JS",
          "dataIndex": "NAME",
          "text": "名称"
         },
         "expanded": false,
         "children": [],
         "type": "column"
        },
        {
         "configs": {
          "itemId": "JS1",
          "dataIndex": "TENANCY_ID",
          "text": "租户"
         },
         "expanded": false,
         "children": [],
         "type": "column"
        },
        {
         "configs": {
          "itemId": "CREATED_BY",
          "dataIndex": "CREATED_BY",
          "text": "创建人",
          "align": "left"
         },
         "expanded": false,
         "children": [],
         "type": "column"
        },
        {
         "configs": {
          "itemId": "CREATED_ON",
          "dataIndex": "CREATED_ON",
          "text": "创建日期",
          "align": "left"
         },
         "expanded": false,
         "children": [],
         "type": "column"
        },
        {
         "configs": {
          "itemId": "UPDATED_BY",
          "dataIndex": "UPDATED_BY",
          "text": "最后修改人",
          "align": "left"
         },
         "expanded": false,
         "children": [],
         "type": "column"
        },
        {
         "configs": {
          "itemId": "UPDATED_ON",
          "dataIndex": "UPDATED_ON",
          "text": "修改时间",
          "align": "left"
         },
         "expanded": false,
         "children": [],
         "type": "column"
        },
        {
         "configs": {
          "itemId": "testButton",
          "renderer": "return '<button type=\"button\" method=\"buttonMethod\" onclick=\"Wb.invoke(this,' + rowIndex + ');\">测试<\/a>';",
          "hidden": "true"
         },
         "expanded": true,
         "children": [],
         "type": "column"
        }
       ],
       "type": "array"
      },
      {
       "configs": {"itemId": "tbar"},
       "expanded": true,
       "children": [
        {
         "configs": {
          "itemId": "id",
          "labelAlign": "right",
          "emptyText": "ID、名称过滤",
          "fieldLabel": "功能过滤",
          "isUpperCase": "true",
          "labelWidth": "80"
         },
         "expanded": false,
         "children": [],
         "type": "text",
         "events": {"specialkey": "if(e.type === \"keydown\" && e.keyCode === 13)\
  app.findmenu.fireEvent('click');"}
        },
        {
         "configs": {
          "itemId": "findmenu",
          "text": "查询",
          "iconCls": "seek_icon"
         },
         "expanded": false,
         "children": [],
         "type": "item",
         "events": {"click": "\
app.grid1.store.load({out:app.tbar});//把所有数据取出来放到out里面"}
        },
        {
         "configs": {
          "itemId": "addmenu",
          "text": "添加",
          "iconCls": "record_add_icon"
         },
         "expanded": false,
         "children": [],
         "type": "item",
         "events": {"click": "app.editwin.setTitle('添加 - 模板功能' );\
app.editwin.setIconCls('record_add_icon');\
app.ID.setDisabled(false);\
app.editwin.show();\
app.setJs(\"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\"?> \\
\" +\
\t\t\t\"<TreeList>\\
\" +\
\t\t\t\"\\t<Properties  sort=\\\"country,shipcity\\\" subtotalFontIndex=\\\"1\\\" subtotalBgColor=\\\"#d3d3d3\\\">\\
\" +\
\t\t\t\"\\t<\/Properties>\\
\" +\
\t\t\t\"\\t<Fonts>\\
\" +\
\t\t\t\"\\t\\t<Font/>\\
\" +\
\t\t\t\"\\t\\t<Font faceName=\\\"Verdana\\\" weight=\\\"700\\\"/>\\
\" +\
\t\t\t\"\\t<\/Fonts>\\
\" +\
\t\t\t\"\\t<Cols>\\
\" +\
\t\t\t\"\\t\\t<Col name=\\\"Country\\\"      width=\\\"100\\\" subtotalExpress=\\\"='共'+@rows+'行'\\\" subtotalAlign=\\\"center\\\">国家<\/Col>\\
\" +\
\t\t\t\"\\t\\t<Col name=\\\"OrderID\\\"      width=\\\"100\\\" align=\\\"center\\\">订单号<\/Col>\\
\" +\
\t\t\t\"\\t<\/Cols>\\
\" +\
\t\t\t\"<\/TreeList>\");\
app.isEdit = false; //标识是否为添加或修改状态，在editWin的ok事件中用到此属性"}
        },
        {
         "configs": {
          "itemId": "modifymenu",
          "text": "修改",
          "iconCls": "record_edit_icon"
         },
         "expanded": false,
         "children": [],
         "type": "item",
         "events": {"click": "var sels = app.grid1.getSelection();\
if (sels.length != 1) {\
  Wb.warn('请选择 1 条需要修改的记录。');\
  return;\
}\
app.selRec = sels[0];\
app.editwin.setTitle('修改功能ID - ' + app.selRec.data.ID);\
app.editwin.setIconCls('record_edit_icon');\
Wb.setValue(app.editwin, app.selRec.data);\
//app.ID.setDisabled(true);\
app.editwin.show();\
app.setJs(app.selRec.data.CONTENT);\
app.isEdit = true; //标识是否为添加或修改状态，在editWin的ok事件中用到此属性"}
        },
        {
         "configs": {
          "itemId": "deletemenu",
          "text": "删除",
          "iconCls": "record_delete_icon"
         },
         "expanded": false,
         "children": [],
         "type": "item",
         "events": {"click": "var sels = app.grid1.getSelection();\
Wb.confirmDo(sels, function() {\
  Wb.request({\
    url: 'm?xwl=controlManage/handset/FunEdit/delete',\
    params: {\
      destroy: Wb.getData(sels, true)\
    },\
    success: function() {\
      Wb.remove(app.grid1, sels);\
    }\
  });\
}, 'ID');"}
        }
       ],
       "type": "toolbar"
      }
     ],
     "type": "grid",
     "events": {"itemdblclick": "app.modifymenu.fireEvent('click');// 双击打开"}
    }],
    "type": "viewport"
   },
   {
    "configs": {
     "layout": "absolute",
     "itemId": "editwin",
     "dialog": "true",
     "closeAction": "hide",
     "autoReset": "true",
     "width": "804",
     "height": "492"
    },
    "expanded": true,
    "children": [
     {
      "configs": {
       "itemId": "COD",
       "allowBlank": "false",
       "labelAlign": "right",
       "fieldLabel": "模板ID",
       "width": "200",
       "x": "0",
       "y": "16",
       "isUpperCase": "true",
       "labelWidth": "60",
       "height": "22"
      },
      "expanded": false,
      "children": [],
      "type": "text"
     },
     {
      "configs": {
       "itemId": "TYP",
       "allowBlank": "false",
       "labelAlign": "right",
       "pickList": "[[\"0\",\"系统模板\"],[\"1\",\"个人模板\"]]",
       "fieldLabel": "类型",
       "width": "200",
       "x": "480",
       "y": "16",
       "labelWidth": "60",
       "disabled": "true",
       "value": "0",
       "height": "22"
      },
      "expanded": false,
      "children": [],
      "type": "combo"
     },
     {
      "configs": {
       "itemId": "NAME",
       "labelAlign": "right",
       "fieldLabel": "名称",
       "width": "280",
       "x": "200",
       "y": "16",
       "labelWidth": "60",
       "height": "22"
      },
      "expanded": false,
      "children": [],
      "type": "text"
     },
     {
      "configs": {
       "itemId": "CONTENT",
       "width": "778",
       "x": "0",
       "y": "48",
       "height": "380"
      },
      "expanded": false,
      "children": [],
      "type": "comp"
     }
    ],
    "type": "window",
    "events": {"ok": "var marks = app.editor.getAllMarks();\
for (var m in marks)\
  if (marks[m].className === \"CodeMirror-lint-mark-error\")\
    return;\
\
var values = Wb.apply(Wb.getValue(app.editwin), {\
  CONTENT: app.editor.getValue()\
});\
\
if (app.isEdit) {\
  //点击修改按钮的处理过程\
  Wb.request({\
    url: 'm?xwl=system/common/report/templateEdit/update',\
    params: Wb.applyIf(values, Wb.getData(app.selRec, true)), //合并窗口和记录数据作为参数，后者为默认值\
    success: function() {\
      //把窗口数据更新到选择记录中\
      Wb.update(app.selRec, values);\
      //隐藏对话框，在模块关闭时自动销毁对话框\
      app.editwin.close();\
      app.findmenu.fireEvent('click');\
    }\
  });\
} else {\
  //点击添加按钮的处理过程\
  Wb.request({\
    url: 'm?xwl=system/common/report/templateEdit/insert',\
    params: values,\
    success: function(resp) {\
      //把服务器返回的数据合并窗口数据（公司名称等数据）添加到表格中\
      Wb.add(app.grid1, Wb.apply(Wb.decode(resp.responseText), values));\
      //隐藏对话框，在模块关闭时自动销毁对话框\
      app.editwin.close();\
      app.findmenu.fireEvent('click');\
    }\
  });\
}"}
   }
  ],
  "type": "module",
  "events": {"initialize": "\
app.buttonMethod = function(rowIndex) {\
  var funId = app.grid1.store.getAt(rowIndex).data.ID;\
  Wb.open({\
    url: \"/appFun?funId=\" + funId,\
    title: funId\
  });\
};\
var config = {\
 mode: 'application/xml',\
  \
    lineNumbers: true,\
    lineWrapping: true,\
    htmlMode: true,\
  //  cursorBlinkRate: -1,\
  showCursorWhenSelecting: true,\
 \
 autofocus:true,\
  theme: Wb.editTheme,\
  isServerScript: true,\
  extraKeys: {\
    'Ctrl-/': 'toggleComment',\
    'Ctrl-,': function(doc) {\
      if (doc.modifyCursor)\
        doc.setCursor(doc.modifyCursor);\
    },\
    'Shift-Ctrl-F': function(doc) {\
      if (doc.options.readOnly)\
        return;\
      var cursor = doc.getCursor(),\
        scroll = doc.getScrollInfo();\
      doc.autoFormatRange({\
        line: 0,\
        ch: 0\
      }, {\
        line: Number.MAX_VALUE,\
        ch: Number.MAX_VALUE\
      });\
      doc.scrollTo(scroll.left, scroll.top);\
      doc.setCursor(cursor);\
    },\
    'Alt-/': 'autocomplete',\
    '.': function(doc) {\
      if (doc.options.readOnly)\
        return;\
      doc.replaceSelection('.');\
      if (doc.hintTimer)\
        clearTimeout(doc.hintTimer);\
      doc.hintTimer = setTimeout(function() {\
        CodeMirror.showHint(doc);\
      }, 100);\
    }\
  }\
};\
\
Wb.apply(app, {\
  /**\
   * 设置脚本编辑器中的脚本内容。\
   * @param {String} value 脚本内容。\
   */\
  setJs: function(value) {\
    app.valueParam = value;\
    if (window.CodeMirror)\
      app.doSetJs();\
    else {\
      Wb.addLink(['wb/libs/cm/cmirror.css', 'wb/libs/cm/cmirror-debug.js'],\
        app.doSetJs\
      );\
    }\
  },\
  doSetJs: function() {\
    if (!app.editor)\
      app.renderEditor();\
    app.editor.setValue(app.valueParam || '');\
    app.editor.clearHistory();\
    setTimeout(function() {\
      app.editor.focus();\
    }, 10);\
  },\
  renderEditor: function() {\
    var comp = app.CONTENT;\
    comp.update('<textarea><\/textarea>');\
    app.editor = CodeMirror.fromTextArea(comp.el.down('textarea', true), config);\
  }\
});"}
 }],
 "roles": {
  "default": 1,
  "xlwmcgs": 1,
  "SWGCWJS": 1,
  "DHSHIP": 1,
  "SWGCWQT": 1,
  "zsadmin": 1
 },
 "title": "模板",
 "iconCls": "ordered_list_icon",
 "inframe": false,
 "pageLink": ""
}