Ext.namespace('Shipping'); Shipping.MainForm = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MainForm.superclass.constructor.call(this); }; function openDialog(typeName) { switch (typeName) { case "message": var openSet = "height=500, width=900, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " + (screen.height - 500) / 2 + ",Left= " + (screen.width - 900) / 2 var openType = "_blank"; var openUrl = "../message/message.aspx?post=1"; window.open(openUrl, openType, openSet); break; case "announce": //如果已打开 var url2 = "../Message/SysAnnounceClientGridSource.aspx?handle=isclose&uid=" + newGuid(); var loader2 = dhtmlxAjax.getSync(url2); var strISDELETE = loader2.xmlDoc.responseText; // var openSet = "height=500, width=900, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " + (screen.height - 500) / 2 + ",Left= " + (screen.width - 900) / 2 var openType = "_blank"; var openUrl = "../message/SysAnnounceClient.aspx"; window.open(openUrl, openType, openSet); break; default: break; } }; function openmsg(msg, msgtype, url) { var eBody = Ext.getBody(); var msgWinConfig = { width: 300, height: 200 }; var msgWin = new Ext.Window({ resizable: false, title: '消息提示', alwaysOnTop: true, bodyStyle: "background-color:#FFFfff;padding:15px 5px 0", html: "" + msg + "", x: eBody.getWidth() - msgWinConfig.width, y: eBody.getHeight(), width: msgWinConfig.width, height: msgWinConfig.height, shadow: false , items: [ ] , listeners: { beforeclose: function () { var win = this; win.flyOut(); return false; } } , flyIn: function () { var myWin = this; myWin.show(); myWin.getEl().shift({ x: eBody.getWidth() - myWin.getWidth(), y: eBody.getHeight() - myWin.getHeight(), opacity: 10, easing: 'easeOut', duration: 30 }); myWin.isFlyIn = true; setTimeout(function () { myWin.flyOut(); }, 10000); } , flyOut: function () { var myWin = this; myWin.getEl().shift({ y: eBody.getHeight() }); myWin.isFlyIn = false; } //自动设置位置 , autoPosition: function () { if (this.isFlyIn) { this.flyIn(); } else { this.flyOut(); } } }); msgWin.flyIn(); }; Ext.extend(Shipping.MainForm, Ext.Panel, { initUIComponents: function () { //#region 20200317 主页面的基础信息store //Ext.define('DsShipping.ux.TABLESTATUS', { // extend: 'Ext.data.Model', // fields: [ // { name: 'TABLENAME', type: 'string' }, // { name: 'MODIFIEDTIME', type: 'string' }, // { name: 'NEEDUPD', type: 'string' } // ] //}); //this.store_TABLESTATUS_Client = Ext.create('DsExt.ux.RefTableStore', { // model: 'DsShipping.ux.ModuleModel', // proxy: { url: '/MvcShipping/MsBaseInfo/GetTABLESTATUS' } //}); //this.store_TABLESTATUS_Server = Ext.create('DsExt.ux.RefTableStore', { // model: 'DsShipping.ux.ModuleModel', // proxy: { url: '/MvcShipping/MsBaseInfo/GetTABLESTATUS' } //}); //Ext.define('DsShipping.ux.InfoclientModel', { // extend: 'Ext.data.Model', // fields: [ // { name: 'id', type: 'string' }, // { name: 'NAME', type: 'string' }, // { name: 'DESCRIPTION', type: 'string' }, // { name: 'MODULEURL', type: 'string' }, // { name: 'SORT', type: 'number' }, // { name: 'PARENTID', type: 'string' }, // { name: 'PARENTNAME', type: 'string' }, // { name: 'TYPE', type: 'number' }, // { name: 'leaf', type: 'bool' }, // { name: 'expanded', type: 'bool' } // ] //}); //#endregion //#region 框架结构 Ext.define('DsShipping.ux.ModuleModel', { extend: 'Ext.data.Model', fields: [ { name: 'id', type: 'string' }, { name: 'NAME', type: 'string' }, { name: 'DESCRIPTION', type: 'string' }, { name: 'MODULEURL', type: 'string' }, { name: 'SORT', type: 'number' }, { name: 'PARENTID', type: 'string' }, { name: 'PARENTNAME', type: 'string' }, { name: 'TYPE', type: 'number' }, { name: 'leaf', type: 'bool' }, { name: 'expanded', type: 'bool' } ] }); Ext.define('DsExt.ux.RefTableStore', { extend: 'Ext.data.Store', constructor: function (config) { var proxy = { type: 'ajax', url: config.proxy.url, reader: { root: 'data' } }; config.proxy = proxy; this.callParent([config]); } }); this.storeModuTree = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.ModuleModel', proxy: { url: '/MvcShipping/MsBaseInfo/GetProModuTreeList' } }); _this = this; this.storeModuTree.load({ params: { condition: "" }, callback: function (r, options, success) { if (success) { if (this.storeModuTree.getCount() > 0) { for (var j = 0; j < this.storeModuTree.getCount(); j += 1) { var member = this.storeModuTree.getAt(j); var pid = member.data.id; var treestore = new Ext.data.TreeStore({ model: 'DsShipping.ux.ModuleModel', nodeParam: 'PARENTID', proxy: { type: 'ajax', url: '/MvcShipping/MsBaseInfo/GetProParentModuTreeList', reader: { id: 'id', root: 'data', totalProperty: 'totalCount' } }, autoLoad: true, root: { name: '根节点', expanded: true, id: pid } }); var tabtree = new Ext.tree.Panel({ region: 'west', title: "" + member.data.DESCRIPTION + "", split: true, width: 180, margins: '0 0 0 0', store: treestore, collapsible: true, rootVisible: false, hideHeaders: true, animate: false, lines: false, useArrows: true, columns: [{ xtype: 'treecolumn', text: '模块名称', width: 178, dataIndex: 'DESCRIPTION' }], listeners: { scope: this, 'itemclick': function (view, record, item, index, e, eOpts) { if (record.data.MODULEURL == '#') return; var finded = false; var children = _this.MainCenter.items; if (children) { for (var i = 0, len = children.length; i < len; i++) { if (children.items[i].id) { if (children.items[i].id == 'pnl' + record.data.NAME) { _this.MainCenter.setActiveTab(i); finded = true; } } } } if (finded == false) { var paneltabitems = new Ext.Panel({ id: 'pnl' + record.data.NAME, layout: "fit", region: "center", autoScroll: true, frame: false, closable: true, bodyStyle: { // background: 'rgba(0, 0, 0, 1) none repeat scroll 0 0 !important' }, title: record.data.PARENTNAME + '-' + record.data.DESCRIPTION, html: ' ' }); this.MainCenter.add(paneltabitems); this.MainCenter.setActiveTab(paneltabitems); this.MainCenter.doLayout(); } } } }); _this.topleft.add(tabtree); }; } else { } } }, scope: this }); this.topleft = Ext.create('Ext.panel.Panel', { title: "功能菜单", layout: "accordion", //设置为手风琴布局 layoutConfig: { animate: true }, width: 180, minWidth: 90, region: "west", //设置方位 split: true, collapsible: true }); var USEHOMEPAGE = get_cookie("USEHOMEPAGE"); if (USEHOMEPAGE == '1') { this.Mainpanel = new Ext.Panel({ title: '首页', region: 'center', iconCls: "img_main", animate: true, autoScroll: true, html: "", frame: true }); } else { this.Mainpanel = new Ext.Panel({ title: '首页', region: 'center', iconCls: "img_main", animate: true, autoScroll: true, // html: "", layout: { type: 'table', columns: 4 }, bodyStyle: { background: 'url(TruckMng/Content/Images/LogonLog.jpg);background-repeat: no-repeat;background-attachment: fixed; background-size:50% 50%; background-position: 100% 100%', padding: '0px' }, items: [ ], frame: false }); } this.MainCenter = new Ext.TabPanel({ activeTab: 0, autoWidth: true, id: 'MainCenter', border: true, frame: false, region: 'center', enableTabScroll: true, items: [ this.Mainpanel, ] }); this.topPart = new Ext.Panel({ html: "东胜物流信息管理系统", region: 'north', layout: { type: 'hbox', pack: 'end', align: 'middle' }, margins: '0 0 5 0', height: 45, bodyStyle: { background: 'url(../../images/masthead.jpg) center', padding: '5px' }, defaults: { anchor: '99%', color: '#FFFFFF', labelStyle: "font-size:'24px'" }, items: [ // { // xtype: 'button', // text: '我的收藏', // height: 40, // icon: "../../images/yellow-folder-open.png" // , // arrowAlign: 'bottom', // padding:'5 5 3 10', // style:'color:#FFFFFF;', // scale: 'large', // menu:[ // { text: '添加到收藏', iconCls: "btnadd", // handler: function (button, event) { // }, // scope: this // }, // {text: 'Item 2'}, // {text: 'Item 3'}, // {text: 'Item 4'} // ] // }, // { // xtype: 'label', // id: 'mycollect', // html: "我的收藏", // height: 40, // padding: '5 5 0 10', // style: 'color:#FFFFFF;', // scale: 'large' // }, // { // xtype: 'label', // id: 'header-content', // padding: '8 0 3 0', //// text: '我的收藏<', // html: "                ", // height: 40, // style: 'color:#FFFFFF;', // scale: 'large' // }, { xtype: 'label', html: "用户名:" + SHOWNAME + "(" + COMPANYNAME + ")        ", height: 40, padding: '5 5 3 10', style: 'color:#FFFFFF;', scale: 'large' }, { xtype: 'label', id: 'dvMessage', padding: '5 5 3 10', html: "我的消息(0/0)    ", height: 40 }, { xtype: 'label', padding: '5 5 3 10', html: "    下载    ", height: 40 }, { xtype: 'label', padding: '5 5 3 10', html: "[退出]", height: 40 } ] }); Ext.apply(this, { items: [this.topPart, this.topleft, this.MainCenter] }); //#endregion //#region 其他 var task = { //Ext的定时器,每隔2秒刷新store。 run: function () { Ext.Ajax.request({ url: '/MvcShipping/MsBaseInfo/GetMessageStr', callback: function (options, success, response) { if (success) { var result = Ext.JSON.decode(response.responseText); if (!result.Success) { return; } else { var messagestr = result.data; var dvMessage = Ext.getCmp('dvMessage'); // dvMessage.setText(messagestr); dvMessage.update("" + messagestr + "    "); } } else { } }, scope: this }); }, interval: 20000 }; Ext.TaskManager.start(task); //启动定时器 Ext.define('SysMessage', { extend: 'Ext.data.Model', fields: [ { name: 'GID', type: 'string' }, { name: 'NAME', type: 'string' }, { name: 'DESCRIPTION', type: 'string' }, { name: 'ISREAD', type: 'bool' }, { name: 'MESSAGECONTENT', type: 'string' }, { name: 'TASKURL', type: 'string' }, { name: 'TASKID', type: 'string' }, { name: 'RECVTYPE', type: 'string' }, { name: 'ISSEND', type: 'string' } ] }); // Notification.requestPermission(function (perm) { // if (perm == "granted") { // this.storeSysMessage = Ext.create('DsExt.ux.RefTableStore', { // model: 'SysMessage', // proxy: { url: '/MvcShipping/MsBaseInfo/GetMessageList' } // }); // var _main = this; // var taskMessage = { //Ext的定时器,每隔2秒刷新store。 // run: function () { // _main.storeSysMessage.load({ params: { optype: "" }, // callback: function (r, options, success) { // if (success) { // if (_main.storeSysMessage.getCount() > 0) { // for (var j = 0; j < _main.storeSysMessage.getCount(); j += 1) { // var member = _main.storeSysMessage.getAt(j); // // openmsg(member.data.MESSAGECONTENT, member.data.NAME, member.data.TASKURL); // var notification = new Notification("东胜消息提醒:", { // dir: "auto", // lang: "hi", // tag: member.data.GID, // vibrate:[200, 100, 200], // icon: "../../images/提醒.ico", // body: member.data.MESSAGECONTENT // }); // } // } // } // } // }); // }, // interval:2000 // }; // Ext.TaskManager.start(taskMessage); //启动定时器 // } //}) Ext.define('DsShipping.ux.UserMainModule', { extend: 'Ext.data.Model', fields: [ { name: 'GID', type: 'string' }, { name: 'MODULEID', type: 'string' }, { name: 'MODULENAME', type: 'string' }, { name: 'MODULETITLE', type: 'string' }, { name: 'MODULEURL', type: 'string' }, { name: 'SORT', type: 'number' }, { name: 'MODULEWIDTH', type: 'number' }, { name: 'ISSYS', type: 'bool' } ] }); this.storeModuUser = Ext.create('DsExt.ux.RefTableStore', { model: 'DsShipping.ux.UserMainModule', proxy: { url: '/MvcShipping/MsMainForm/GetUserDataList' } }); this.storeModuUser.load({ params: { condition: "" }, callback: function (r, options, success) { if (success) { if (this.storeModuUser.getCount() > 0) { for (var j = 0; j < this.storeModuUser.getCount(); j += 1) { var member = this.storeModuUser.getAt(j); var pid = member.data.id; var paneltabitems = new Ext.Panel({ layout: "fit", region: "center", autoScroll: true, frame: true, width: member.data.MODULEWIDTH, height: 350, closable: true, title: member.data.MODULETITLE, html: ' ' }); this.Mainpanel.add(paneltabitems); }; } else { } } }, scope: this }); //#endregion } //end initUIComponents //, RefreshTableStatus: function () { // this.store_TABLESTATUS_Server.load({ // params: { condition: "" }, // callback: function (r, options, success) { // if (success) { // foreach // if (this.storeModuTree.getCount() > 0) { // for (var j = 0; j < this.storeModuTree.getCount(); j += 1) { // var member = this.storeModuTree.getAt(j); // var pid = member.data.id; // var treestore = new Ext.data.TreeStore({ // model: 'DsShipping.ux.ModuleModel', // nodeParam: 'PARENTID', // proxy: { // type: 'ajax', // url: '/MvcShipping/MsBaseInfo/GetProParentModuTreeList', // reader: { // id: 'id', // root: 'data', // totalProperty: 'totalCount' // } // }, // autoLoad: true, // root: { // name: '根节点', // expanded: true, // id: pid // } // }); // var tabtree = new Ext.tree.Panel({ // region: 'west', // title: "" + member.data.DESCRIPTION + "", // split: true, // width: 180, // margins: '0 0 0 0', // store: treestore, // collapsible: true, // rootVisible: false, // hideHeaders: true, // animate: false, // lines: false, // useArrows: true, // columns: [{ // xtype: 'treecolumn', // text: '模块名称', // width: 178, // dataIndex: 'DESCRIPTION' // }], // listeners: { // scope: this, // 'itemclick': function (view, record, item, index, e, eOpts) { // if (record.data.MODULEURL == '#') return; // var finded = false; // var children = _this.MainCenter.items; // if (children) { // for (var i = 0, len = children.length; i < len; i++) { // if (children.items[i].id) { // if (children.items[i].id == 'pnl' + record.data.NAME) { // _this.MainCenter.setActiveTab(i); // finded = true; // } // } // } // } // if (finded == false) { // var paneltabitems = new Ext.Panel({ // id: 'pnl' + record.data.NAME, // layout: "fit", // region: "center", // autoScroll: true, // frame: false, // closable: true, // bodyStyle: { // // background: 'rgba(0, 0, 0, 1) none repeat scroll 0 0 !important' // }, // title: record.data.PARENTNAME + '-' + record.data.DESCRIPTION, // html: ' ' // }); // this.MainCenter.add(paneltabitems); // this.MainCenter.setActiveTab(paneltabitems); // this.MainCenter.doLayout(); // } // } // } // }); // _this.topleft.add(tabtree); // }; // } else { // } // } // }, // scope: this // }); //} //,Check }); function exit() { //var aa = window.child.location; //var bb = aa; //myFrame.window.functionName() }