{
 "hidden": false,
 "children": [{
  "configs": {"itemId": "module"},
  "expanded": true,
  "children": [{
   "configs": {
    "layout": "fit",
    "itemId": "viewport1"
   },
   "expanded": true,
   "children": [{
    "configs": {
     "layout": "fit",
     "itemId": "panelMain",
     "title": "个人消息管理",
     "iconCls": "mail_icon"
    },
    "expanded": true,
    "children": [{
     "configs": {
      "itemId": "gridMsg",
      "selType": "checkboxmodel",
      "gridLine": "true"
     },
     "expanded": true,
     "children": [
      {
       "configs": {"itemId": "tbar"},
       "expanded": true,
       "children": [
        {
         "configs": {
          "itemId": "sdate",
          "width": "160"
         },
         "expanded": false,
         "children": [],
         "type": "datetime"
        },
        {
         "configs": {
          "itemId": "edate",
          "labelAlign": "right",
          "fieldLabel": "至",
          "width": "185",
          "labelWidth": "24"
         },
         "expanded": false,
         "children": [],
         "type": "datetime"
        },
        {
         "configs": {
          "itemId": "labelItemDate",
          "width": "15"
         },
         "expanded": false,
         "children": [],
         "type": "label"
        },
        {
         "configs": {
          "itemId": "receiveFlag",
          "emptyText": "是否已读",
          "pickList": "[\
\t['0','未读'],\
  \t['1','已读'],\
  \t['A','全部']\
]",
          "width": "65",
          "value": "0"
         },
         "expanded": false,
         "children": [],
         "type": "combo"
        },
        {
         "configs": {
          "itemId": "isMySend",
          "emptyText": "发送/接收",
          "pickList": "[\
\t['S','我发送的'],\
  \t['R','我接收的']\
]",
          "width": "90",
          "value": "R"
         },
         "expanded": false,
         "children": [],
         "type": "combo"
        },
        {
         "configs": {
          "itemId": "labelItemQuery",
          "width": "5"
         },
         "expanded": false,
         "children": [],
         "type": "label"
        },
        {
         "configs": {
          "itemId": "itemQuery",
          "textAlign": "center",
          "text": "查询",
          "iconCls": "search_icon"
         },
         "expanded": false,
         "children": [],
         "type": "item",
         "events": {"click": "app.gridMsg.store.load({\
\tout:app.tbar\
});\
\
"}
        },
        {
         "configs": {
          "itemId": "jumpTo",
          "text": "跳转",
          "iconCls": "arrow_branch_icon"
         },
         "expanded": false,
         "children": [],
         "type": "item",
         "events": {"click": "var rec = app.gridMsg.getSelection()[0];\
if (!rec) {\
  Wb.warn('请选择至少一条记录');\
  return;\
}\
if (Wb.isEmpty(rec.data.BUSINESS_URL)) {\
  Wb.warn('所选记录URL为空!');\
  return;\
}\
app.openUrl(rec.data.BUSINESS_URL,rec.data.BUSINESS_TYPE,rec.data.BUSINESS_KEY);\
"}
        },
        {
         "configs": {
          "itemId": "receiveBtn",
          "text": "标记已读",
          "iconCls": "file_ss_icon"
         },
         "expanded": false,
         "children": [],
         "type": "item",
         "events": {"click": "var rec = app.gridMsg.getSelection()[0];\
if (!rec) {\
  Wb.warn('请选择至少一条记录');\
  return;\
}\
var dataArray = [];\
Wb.each(app.gridMsg.getSelection(), function(row) {\
  dataArray.push(row.data.ID);\
});\
$.ajax({\
  url: \"/sktmq/markMsg\",\
  async: false, //\
  data: {\
    dataArray: JSON.stringify(dataArray)\
  }, //参数值\
  type: \"POST\", //请求方式\
  success: function(req) {\
    Wb.tip(req);\
    app.gridMsg.store.reload();\
    var countWd = app.queryCountNoRd();\
    if (countWd == 0) {\
      document.getElementById(\"msgSpan\").style.display = \"none\";\
      // $(\"#msgSpan\").removeClass(\"layui-badge\");\
    } else {\
      document.getElementById('msgSpan').innerText = countWd;\
    }\
    //请求成功时处理\
  },\
  error: function() {\
    Wb.error('请求出错');\
  }\
});"}
        },
        {
         "configs": {
          "itemId": "sendMsgWin",
          "hidden": "true",
          "text": "发送消息",
          "iconCls": "mail_icon"
         },
         "expanded": false,
         "children": [],
         "type": "item",
         "events": {"click": " Wb.run({\
   url: 'm?xwl=websocketModel/msgWin',\
   contextOwner: app,\
   params: {\
     url: 'm?xwl=supcan/imBillHD/imbillHdView', //消息对应跳转的url\
     businessType:'进口换单',      // 业务类型,\
     businessKey:'1048I88LPV3T7' // 业务主键\
   },\
   success: function(appOld) {\
     var win = new Ext.window.Window(appOld._socketWin); //_window1为配置对象，window1为实例\
     win.show();\
   }\
 });"}
        }
       ],
       "type": "toolbar"
      },
      {
       "configs": {
        "itemId": "store",
        "pageSize": "100",
        "url": "m?xwl=sys/msg/websocketModel/sqlMod/msgManagerSql"
       },
       "expanded": false,
       "children": [],
       "type": "store",
       "events": {"beforeload": "Wb.apply(operation.params,{user:'{#sys.user#}'});"}
      },
      {
       "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": "receiveFlag",
          "xtype": "checkcolumn",
          "dataIndex": "RECEIVE_FLAG",
          "width": "45",
          "disabled": "true",
          "text": "已读",
          "titleAlign": "center"
         },
         "expanded": false,
         "children": [],
         "type": "column"
        },
        {
         "configs": {
          "itemId": "receiveTim",
          "dataIndex": "RECEIVE_TIM",
          "width": "125",
          "text": "读取时间",
          "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": "viewport"
  }],
  "type": "module",
  "events": {
   "finalize": "var dd = new Date();\
dd.setDate(dd.getDate()-7);\
var month = dd.getMonth() + 1;\
var day = dd.getDate();\
if (month < 10) {\
  month = \"0\" + month;\
}\
if (day < 10) {\
  day = \"0\" + day;\
}\
var start = new Date(dd.getFullYear() + \"-\" + month + \"-\" + day + \" 00:00\");\
\
var ds= new Date();\
var months = ds.getMonth() + 1;\
var days = ds.getDate();\
if (months < 10) {\
  months = \"0\" + months;\
}\
if (days < 10) {\
  days = \"0\" + days;\
}\
var end = new Date(ds.getFullYear() + \"-\" + months + \"-\" + days + \" 23:59\");\
\
app.sdate.setValue(start);\
app.edate.setValue(end);\
app.gridMsg.store.load({\
\tout:app.tbar\
});\
",
   "initialize": "Wb.apply(app, {\
    openUrl: function(url, title, id) {\
        Wb.open({\
            url: url,\
            title: title,\
            params: {\
                businessId: id\
            }\
        });\
    },\
    queryCountNoRd: function() {\
        var count = 0;\
        $.ajax({\
            url: \"/sktmq/queryCountNoRd\",\
            async: false,\
            data: {\
                //   msgBean:JSON.stringify(dataJson)\
            },\
            type: \"POST\",\
            success: function(res) {\
                count = res;\
            },\
            error: function() {\
                Wb.tip('获取消息个数请求错误');\
            }\
        });\
        return count;\
    }\
});"
  }
 }],
 "roles": {"default": 1},
 "title": "个人消息管理",
 "iconCls": "",
 "inframe": false,
 "pageLink": ""
}