{
 "hidden": false,
 "children": [{
  "configs": {"itemId": "module"},
  "expanded": true,
  "children": [
   {
    "configs": {
     "layout": "fit",
     "itemId": "batchWin",
     "closeAction": "destroy",
     "width": "616",
     "title": "批量订阅",
     "modal": "true",
     "height": "320"
    },
    "expanded": false,
    "children": [{
     "configs": {
      "itemId": "gridUser",
      "selType": "checkboxmodel"
     },
     "expanded": true,
     "children": [
      {
       "configs": {"itemId": "tbar"},
       "expanded": true,
       "children": [
        {
         "configs": {
          "itemId": "deptId",
          "width": "250",
          "keyName": "WB_DEPT",
          "anyMatch": "true"
         },
         "expanded": true,
         "children": [],
         "type": "combo"
        },
        {
         "configs": {
          "itemId": "refresh",
          "text": "刷新",
          "iconCls": "refresh_icon"
         },
         "expanded": false,
         "children": [],
         "type": "item",
         "events": {"click": "app.gridUser.store.load({\
\tout:app.tbar\
});\
"}
        },
        {
         "configs": {
          "itemId": "topic",
          "text": "订阅",
          "iconCls": "set_icon"
         },
         "expanded": false,
         "children": [],
         "type": "item",
         "events": {"click": "var res=app.gridUser.getSelection();\
if(res.length===0){\
\tapp.batchWin.close();\
}else{\
  var userArray=[];\
  Wb.each(res,function(row){\
  userArray.push(row.data.USER_ID+'#'+row.data.DISPLAY_NAME);\
  });\
Wb.confirm('提交稍后将刷新选中订阅',\
function() {\
    var dataArray = [];\
    function getAllNodes(node) {\
        var childnodes = node.childNodes;\
        Ext.each(childnodes,\
        function() { //从节点中取出子节点依次遍历\
            var nd = this;\
            if (nd.id !== '-root') {\
                var data = {\
                    ID: nd.raw.ID,\
                    TOPIC_DESCRIBE: nd.raw.TOPIC_DESCRIBE,\
                    TOPIC_PARENT_ID: nd.raw.TOPIC_PARENT_ID,\
                    TOPIC_PARENT_NAME: nd.raw.TOPIC_PARENT_NAME,\
                    TOPIC_NAME: nd.raw.text,\
                    CHECK_FLAG: nd.raw.checked\
                };\
                dataArray.push(data);\
            }\
            if (nd.hasChildNodes()) { //判断子节点下是否存在子节点\
                getAllNodes(nd); //如果存在子节点 递归\
            }\
        });\
    }\
    getAllNodes(app.topicTree.getRootNode());\
    Wb.requestAg({\
        params: {\
            bean: 'redisTopicService',\
            method: 'topicBatchUserSave',\
            dataArray: dataArray,\
            userArray:userArray\
        },\
        success: function(resp) {\
          app.batchWin.close();\
          Wb.tip('操作成功');\
            //app.gridMyTopic.store.reload();\
        }\
    });\
});\
}"}
        }
       ],
       "type": "toolbar"
      },
      {
       "configs": {
        "itemId": "store",
        "url": "m?xwl=sys/msg/msgSql/userSql"
       },
       "expanded": false,
       "children": [],
       "type": "store"
      },
      {
       "configs": {"itemId": "columns"},
       "expanded": true,
       "children": [
        {
         "configs": {
          "itemId": "userName",
          "dataIndex": "USER_NAME",
          "width": "150",
          "text": "登录名"
         },
         "expanded": false,
         "children": [],
         "type": "column"
        },
        {
         "configs": {
          "itemId": "displayName",
          "dataIndex": "DISPLAY_NAME",
          "width": "240",
          "text": "名称"
         },
         "expanded": false,
         "children": [],
         "type": "column"
        }
       ],
       "type": "array"
      }
     ],
     "type": "grid"
    }],
    "type": "window",
    "events": {"show": "app.gridUser.store.load();"}
   },
   {
    "configs": {
     "layout": "fit",
     "itemId": "topicEditWin",
     "dialog": "true",
     "glyph": "f09e",
     "closeAction": "destroy",
     "title": "频道维护",
     "modal": "true"
    },
    "expanded": true,
    "children": [{
     "configs": {
      "layout": "absolute",
      "itemId": "panelEdit",
      "width": "656",
      "height": "336"
     },
     "expanded": true,
     "children": [
      {
       "configs": {
        "itemId": "ID",
        "hidden": "true",
        "x": "392",
        "width": "240",
        "y": "40",
        "readOnly": "true",
        "height": "22"
       },
       "expanded": false,
       "children": [],
       "type": "text"
      },
      {
       "configs": {
        "itemId": "TOPIC_PARENT_ID",
        "labelAlign": "right",
        "fieldLabel": "父频道ID",
        "x": "6",
        "width": "357",
        "y": "8",
        "labelWidth": "75",
        "readOnly": "true",
        "value": "-",
        "height": "22"
       },
       "expanded": false,
       "children": [],
       "type": "text"
      },
      {
       "configs": {
        "itemId": "TOPIC_PARENT_NAME",
        "labelAlign": "right",
        "fieldLabel": "父频道名称",
        "x": "6",
        "width": "357",
        "y": "32",
        "labelWidth": "75",
        "readOnly": "true",
        "value": "-",
        "height": "22"
       },
       "expanded": false,
       "children": [],
       "type": "text"
      },
      {
       "configs": {
        "itemId": "TOPIC_NAME",
        "labelAlign": "right",
        "fieldLabel": "<span style='color:red'>频道名称<\/span>",
        "x": "16",
        "width": "347",
        "y": "56",
        "labelWidth": "65",
        "height": "22"
       },
       "expanded": false,
       "children": [],
       "type": "text"
      },
      {
       "configs": {
        "itemId": "TOPIC_DESCRIBE",
        "labelAlign": "right",
        "fieldLabel": "频道描述",
        "x": "16",
        "width": "608",
        "y": "80",
        "labelWidth": "65",
        "height": "234"
       },
       "expanded": false,
       "children": [],
       "type": "textarea"
      }
     ],
     "type": "panel"
    }],
    "type": "window",
    "events": {"ok": "if(Wb.verify(app.panelEdit)){\
Wb.requestAg({\
  params: {\
  \tpanelData:Wb.getValue(app.panelEdit),\
    bean:'redisTopicService',\
    method:'topicSave'\
  },\
  success: function(resp) {\
  \twin.close();\
    Wb.tip('保存成功');\
    app.topicTree.store.reload();\
  }\
});\
}"}
   },
   {
    "configs": {"itemId": "tbarMain"},
    "expanded": true,
    "children": [
     {
      "configs": {
       "itemId": "addBtn",
       "text": "增加",
       "iconCls": "table_add_icon"
      },
      "expanded": false,
      "children": [],
      "type": "item",
      "events": {"click": "var rec = app.topicTree.getSelection()[0];\
var topicEditWin = new Ext.window.Window(app._topicEditWin); //app._win指向配置对象而非实例\
app.topicEditWin.show();\
if (rec) {\
    app.TOPIC_PARENT_ID.setValue(rec.raw.ID);\
    app.TOPIC_PARENT_NAME.setValue(rec.raw.text);\
}"}
     },
     {
      "configs": {
       "itemId": "delBtn",
       "textAlign": "center",
       "text": "删除",
       "iconCls": "application_delete_icon"
      },
      "expanded": false,
      "children": [],
      "type": "item",
      "events": {"click": "var rec = app.topicTree.getSelection()[0];\
if (Wb.isEmpty(rec.raw.ID)) {\
  Wb.warn('请选中节点');\
  return;\
}\
Wb.confirm('将初始化该节点: ' + rec.raw.text + ' 以及子节点,是否继续?',\
  function() {\
    Wb.requestAg({\
      params: {\
        bean: 'redisTopicService',\
        method: 'delChannel',\
        id: rec.raw.ID\
      },\
      success: function(resp) {\
        Wb.tip('删除成功');\
        app.topicTree.store.reload();\
      }\
    });\
  });"}
     },
     {
      "configs": {
       "itemId": "editBtn",
       "text": "编辑",
       "iconCls": "record_edit_icon"
      },
      "expanded": false,
      "children": [],
      "type": "item",
      "events": {"click": "var rec = app.topicTree.getSelection()[0];\
var topicEditWin = new Ext.window.Window(app._topicEditWin); //app._win指向配置对象而非实例\
app.topicEditWin.show();\
if (rec) {\
  Wb.apply(rec.raw,{TOPIC_NAME:rec.raw.text});\
  Wb.setReadOnly(app.TOPIC_NAME,true);\
  Wb.setValue(app.panelEdit,rec.raw);\
  \
}"}
     },
     {
      "configs": {
       "itemId": "saveBtn",
       "text": "提交",
       "iconCls": "top_icon"
      },
      "expanded": false,
      "children": [],
      "type": "item",
      "events": {"click": "Wb.confirm('提交稍后将刷新订阅',\
function() {\
    var dataArray = [];\
    function getAllNodes(node) {\
        var childnodes = node.childNodes;\
        Ext.each(childnodes,\
        function() { //从节点中取出子节点依次遍历\
            var nd = this;\
            if (nd.id !== '-root') {\
                var data = {\
                    ID: nd.raw.ID,\
                    TOPIC_DESCRIBE: nd.raw.TOPIC_DESCRIBE,\
                    TOPIC_PARENT_ID: nd.raw.TOPIC_PARENT_ID,\
                    TOPIC_PARENT_NAME: nd.raw.TOPIC_PARENT_NAME,\
                    TOPIC_NAME: nd.raw.text,\
                    CHECK_FLAG: nd.raw.checked\
                };\
                dataArray.push(data);\
            }\
            if (nd.hasChildNodes()) { //判断子节点下是否存在子节点\
                getAllNodes(nd); //如果存在子节点 递归\
            }\
        });\
    }\
    getAllNodes(app.topicTree.getRootNode());\
    Wb.requestAg({\
        params: {\
            bean: 'redisTopicService',\
            method: 'topicUserSave',\
            dataArray: dataArray\
        },\
        success: function(resp) {\
            app.gridMyTopic.store.reload();\
        }\
    });\
});"}
     },
     {
      "configs": {
       "itemId": "syn",
       "text": "初始化",
       "iconCls": "wait_icon"
      },
      "expanded": false,
      "children": [],
      "type": "item",
      "events": {"click": "Wb.confirm('将初始化Redis订阅',function(){\
Wb.requestAg({\
  params: {\
    bean:'redisTopicService',\
    //bean:'feeVesselCtl',\
    method:'init'\
  },\
  success: function(resp) {\
  Wb.tip('初始化成功');\
  }\
});\
});\
"}
     },
     {
      "configs": {
       "itemId": "batchBtn",
       "text": "批量订阅",
       "iconCls": "arrow_divide_icon"
      },
      "expanded": false,
      "children": [],
      "type": "item",
      "events": {"click": "var batchWin = new Ext.window.Window(app._batchWin); //app._win指向配置对象而非实例\
batchWin.show();"}
     },
     {
      "configs": {
       "itemId": "syn1",
       "text": "测试",
       "iconCls": "wait_icon"
      },
      "expanded": false,
      "children": [],
      "type": "item",
      "events": {"click": "Wb.requestAg({\
  params: {\
    bean: 'noticeTestService',\
    //bean:'feeVesselCtl',\
    method: 'test'\
  },\
  success: function(resp) {\
    Wb.tip('初始化成功');\
  }\
});"}
     }
    ],
    "type": "toolbar"
   },
   {
    "configs": {
     "layout": "border",
     "itemId": "viewport1"
    },
    "expanded": true,
    "children": [
     {
      "configs": {
       "layout": "fit",
       "itemId": "panelTopicTree",
       "glyph": "f09e",
       "split": "true",
       "flex": "1",
       "tbar": "app.tbarMain",
       "region": "west",
       "title": "频道信息"
      },
      "expanded": false,
      "children": [{
       "configs": {
        "itemId": "topicTree",
        "tools": "Wb.getTreeTools()",
        "rootVisible": "false",
        "multiSelect": "true"
       },
       "expanded": true,
       "children": [{
        "configs": {
         "itemId": "store",
         "url": "m?xwl=sys/msg/msgSql/topicTreeQuery"
        },
        "expanded": false,
        "children": [],
        "type": "treestore",
        "events": {"beforeload": "operation.params={user:'{#sys.user#}'};"}
       }],
       "type": "tree",
       "events": {
        "selectionchange": "var module = selected[0];\
if (module) {\
  var rec=module.raw;\
 // console.info(rec);\
  //rec.checked='true';\
  app.DESCRIBE.setValue(rec.TOPIC_DESCRIBE);\
}\
",
        "checkchange": "function nodesBuild(node) {\
    Wb.setChecked(node, checked, app.topicTree);\
  //console.info(node.hasChildNodes());\
    if (node.hasChildNodes()) {\
        var childnodes = node.childNodes;\
        node.raw.checked = checked;\
        Ext.each(childnodes,\
        function() { //从节点中取出子节点依次遍历\
            var nd = this;\
            nd.raw.checked = checked;\
            nodesBuild(nd); //如果存在子节点 递归\
        });\
    }else{\
      node.raw.checked = checked;\
    }\
}\
nodesBuild(node);"
       }
      }],
      "type": "panel"
     },
     {
      "configs": {
       "layout": "border",
       "itemId": "panelDescribe",
       "flex": "2.2",
       "region": "center",
       "title": "描述"
      },
      "expanded": true,
      "children": [
       {
        "configs": {
         "layout": "border",
         "border": "false",
         "itemId": "panelTop",
         "flex": "1",
         "region": "north"
        },
        "expanded": true,
        "children": [
         {
          "configs": {
           "layout": "fit",
           "border": "false",
           "itemId": "panelDes",
           "flex": "1",
           "region": "north"
          },
          "expanded": true,
          "children": [{
           "configs": {"itemId": "DESCRIBE"},
           "expanded": true,
           "children": [],
           "type": "textarea"
          }],
          "type": "panel"
         },
         {
          "configs": {
           "layout": "fit",
           "border": "false",
           "itemId": "panelLj",
           "flex": "1",
           "title": "无人订阅消息",
           "region": "center"
          },
          "expanded": true,
          "children": [{
           "configs": {
            "itemId": "gridMsg",
            "gridLine": "true"
           },
           "expanded": false,
           "children": [
            {
             "configs": {"itemId": "tbar"},
             "expanded": true,
             "children": [
              {
               "configs": {
                "itemId": "createdBy",
                "emptyText": "发送人"
               },
               "expanded": false,
               "children": [],
               "type": "text"
              },
              {
               "configs": {
                "itemId": "queryBtnq",
                "text": "查询",
                "iconCls": "search_icon"
               },
               "expanded": false,
               "children": [],
               "type": "item",
               "events": {"click": "app.gridMsg.store.reload();"}
              }
             ],
             "type": "toolbar"
            },
            {
             "configs": {
              "itemId": "store",
              "autoLoad": "true",
              "pageSize": "100",
              "url": "m?xwl=sys/msg/websocketModel/sqlMod/lajiMsg"
             },
             "expanded": false,
             "children": [],
             "type": "store"
            },
            {
             "configs": {"itemId": "columns"},
             "expanded": true,
             "children": [
              {
               "configs": {
                "itemId": "rowColumn",
                "xtype": "rownumberer",
                "width": "45",
                "text": "序号",
                "titleAlign": "center"
               },
               "expanded": false,
               "children": [],
               "type": "column"
              },
              {
               "configs": {
                "itemId": "businessType",
                "dataIndex": "BUSINESS_TYPE",
                "width": "70",
                "text": "业务类型",
                "titleAlign": "center"
               },
               "expanded": false,
               "children": [],
               "type": "column"
              },
              {
               "configs": {
                "itemId": "colChatName",
                "dataIndex": "CHAT_NAME",
                "width": "130",
                "text": "频道",
                "titleAlign": "center"
               },
               "expanded": false,
               "children": [],
               "type": "column"
              },
              {
               "configs": {
                "itemId": "businessUrl",
                "dataIndex": "BUSINESS_URL",
                "width": "230",
                "text": "URL",
                "titleAlign": "center"
               },
               "expanded": false,
               "children": [],
               "type": "column"
              },
              {
               "configs": {
                "itemId": "msgInfo",
                "dataIndex": "MSG_INFO",
                "width": "370",
                "text": "消息内容",
                "autoWrap": "true",
                "titleAlign": "center"
               },
               "expanded": false,
               "children": [],
               "type": "column"
              },
              {
               "configs": {
                "itemId": "taskByName",
                "dataIndex": "CREATED_BY",
                "width": "90",
                "text": "发送人",
                "titleAlign": "center"
               },
               "expanded": false,
               "children": [],
               "type": "column"
              },
              {
               "configs": {
                "itemId": "createdOn",
                "dataIndex": "CREATED_ON",
                "width": "125",
                "text": "发送时间",
                "titleAlign": "center"
               },
               "expanded": false,
               "children": [],
               "type": "column"
              }
             ],
             "type": "array"
            }
           ],
           "type": "grid"
          }],
          "type": "panel"
         }
        ],
        "type": "panel"
       },
       {
        "configs": {
         "layout": "fit",
         "border": "false",
         "itemId": "panelCenter",
         "glyph": "f143",
         "flex": "1",
         "region": "center",
         "title": "我的订阅"
        },
        "expanded": false,
        "children": [{
         "configs": {"itemId": "gridMyTopic"},
         "expanded": true,
         "children": [
          {
           "configs": {
            "itemId": "store",
            "autoLoad": "true",
            "url": "m?xwl=sys/msg/msgSql/queryMyTopic"
           },
           "expanded": false,
           "children": [],
           "type": "store"
          },
          {
           "configs": {"itemId": "columns"},
           "expanded": true,
           "children": [
            {
             "configs": {
              "itemId": "topicName",
              "dataIndex": "TOPIC_NAME",
              "width": "210",
              "text": "频道名称",
              "titleAlign": "center"
             },
             "expanded": false,
             "children": [],
             "type": "column"
            },
            {
             "configs": {
              "itemId": "topicDesc",
              "dataIndex": "TOPIC_DESCRIBE",
              "flex": "1",
              "width": "150",
              "text": "描述",
              "titleAlign": "center"
             },
             "expanded": false,
             "children": [],
             "type": "column"
            }
           ],
           "type": "array"
          }
         ],
         "type": "grid"
        }],
        "type": "panel"
       }
      ],
      "type": "panel"
     }
    ],
    "type": "viewport"
   }
  ],
  "type": "module"
 }],
 "roles": {"default": 1},
 "title": "订阅频道维护",
 "iconCls": "",
 "inframe": false,
 "pageLink": ""
}