Ext.namespace('Shipping'); Shipping.MsUserAuthorityIndex = function (config) { Ext.applyIf(this, config); this.initUIComponents(); window.Shipping.MsUserAuthorityIndex.superclass.constructor.call(this); }; Ext.extend(Shipping.MsUserAuthorityIndex, Ext.Panel, { OprationStatus: null, //仅当弹出界面时使用 SelectedRecord: null, opid: '', AUTHORITYID: '', SELECTUSERID:'', initUIComponents: function () { _this = this; //#region 左侧公司部门人员树形结构 Ext.define('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: 'string' }, { name: 'leaf', type: 'bool' }, { name: 'expanded', type: 'bool' } ] }); this.treestore = new Ext.data.TreeStore({ model: 'ModuleModel', nodeParam: 'PARENTID', proxy: { type: 'ajax', url: '/MvcShipping/MsUserAuthority/GetUserTreeRefList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } }, autoLoad: true, root: { name: '根节点', expanded: true, id: '0' } }); this.storeList = Ext.create('Ext.data.Store', { model: 'MsUserAuthority', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsUserAuthority/GetUserAuthorityList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); _thisAuthority = this; this.tabtree = new Ext.tree.Panel({ region: 'west', title: '人员信息', //'业务信息', split: true, width: 320, collapsible: true, margins: '0 0 0 0', store: this.treestore, useArrows: true, rootVisible: false, hideHeaders: true, animate: false, checked: true, lines: false, columns: [{ xtype: 'treecolumn', text: '人员信息', //'模块名称', width: 318, dataIndex: 'DESCRIPTION' }], listeners: { scope: this, 'itemclick': function (_this, record, item, index, e, eOpts) { if (record.data.TYPE == '2') { var userid = record.data.id; this.panelcenter.setTitle(record.data.DESCRIPTION + '权限范围'); _thisAuthority.storeList.load({ params: { start: 0, limit: 500, sort: '', userid: userid }, waitMsg: "正在查询数据...", scope: this }); _thisAuthority.opid = userid; } } } }); //#endregion //#region 右侧【选择人员】【员工可视范围】的人员列表 this.treestore_VISIBLE = new Ext.data.TreeStore({ //树列表数据集 model: 'MsUserAuthorityOp', nodeParam: 'PARENTID', proxy: { type: 'ajax', url: '/MvcShipping/MsUserAuthority/GetUserAuthorityVISIBLETreeList',//GetUserAuthorityOpList reader: { id: 'GID', root: 'data', //data 对应controller里返回的json里的data totalProperty: 'totalCount' } }, autoLoad: true, root: { id: '0', name: '根节点', expanded: true } }); this.tabtree_VISIBLE = new Ext.tree.Panel({ //树形图 region: 'center', split: true, width: 320, //collapsible: true, margins: '0 0 0 0', store: this.treestore_VISIBLE, useArrows: true, rootVisible: false, hideHeaders: true, animate: true, lines: false, tbar: [{ text: '保存', tooltip: '保存', iconCls: "btnsave", handler: function (button, event) { this.onSaveOpVsDetailClick("VS"); }, scope: this }, '-', { text: '更新到此人所有[选择人员]', tooltip: '更新到此人所有[选择人员]', handler: function (button, event) { this.onSaveOpVsAllClick("VS"); }, scope: this }], columns: [{ xtype: 'treecolumn', text: '分公司/部门信息', //'模块名称', width: 318, dataIndex: 'OPNAME' }], listeners: { "checkchange": function (node, checked, eOpts) { travelChildrenChecked(node, checked, eOpts); travelParentChecked(node, checked, eOpts); } } }); this.treestore_OPERATE = new Ext.data.TreeStore({ //树列表数据集 model: 'MsUserAuthorityOp', nodeParam: 'PARENTID', proxy: { type: 'ajax', url: '/MvcShipping/MsUserAuthority/GetUserAuthorityOPERATETreeList',//GetUserAuthorityOpList reader: { id: 'GID', root: 'data', //data 对应controller里返回的json里的data totalProperty: 'totalCount' } }, autoLoad: true, root: { id: '0', name: '根节点', expanded: true } }); this.tabtree_OPERATE = new Ext.tree.Panel({ //树形图 region: 'center', split: true, width: 320, //collapsible: true, margins: '0 0 0 0', store: this.treestore_OPERATE, useArrows: true, rootVisible: false, hideHeaders: true, animate: true, lines: false, tbar: [{ text: '保存', tooltip: '保存', iconCls: "btnsave", handler: function (button, event) { this.onSaveOpVsDetailClick("OP"); }, scope: this }, '-', { text: '更新到此人所有[选择人员]', tooltip: '更新到此人所有[选择人员]', handler: function (button, event) { this.onSaveOpVsAllClick("OP"); }, scope: this }], columns: [{ xtype: 'treecolumn', text: '分公司/部门信息', //'模块名称', width: 318, dataIndex: 'OPNAME' }], listeners: { "checkchange": function (node, checked, eOpts) { travelChildrenChecked(node, checked, eOpts); travelParentChecked(node, checked, eOpts); } } }); //#endregion //#region 权限列表 this.StoreRANGE = Ext.create('Ext.data.Store', { fields: ['BL', 'NUM'] }); this.StoreRANGE.add({ "BL": "全部", "NUM": "0" }); this.StoreRANGE.add({ "BL": "本公司", "NUM": "1" }); this.StoreRANGE.add({ "BL": "本部门", "NUM": "2" }); this.StoreRANGE.add({ "BL": "本人", "NUM": "3" }); this.StoreRANGE.add({ "BL": "无", "NUM": "4" }); this.StoreRANGE.add({ "BL": "选择公司", "NUM": "5" }); this.StoreRANGE.add({ "BL": "选择人员", "NUM": "6" }); this.comboxRANGE = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreRANGE, forceSelection: true, valueField: 'NUM', displayField: 'BL' }); this.comboxRANGE2 = Ext.create('DsExt.ux.RefTableCombox', { store: this.StoreRANGE, forceSelection: true, valueField: 'NUM', displayField: 'BL' }); this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.GridCheckBoxModel = Ext.create('Ext.selection.CheckboxModel'); //定义Grid this.gridList = new Ext.grid.GridPanel({ store: this.storeList, enableHdMenu: false, region: 'center', // width: 410, loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.gridListCellEditing], selModel: this.GridCheckBoxModel, selType: 'cellmodel', columns: [{ sortable: true, dataIndex: 'GID', header: 'GID', hidden: true, width: 120 }, { sortable: true, dataIndex: 'DESCRIPTION', header: '模块名称名称', width: 200 }, { sortable: true, dataIndex: 'VISIBLERANGE', header: '可视范围', editor: this.comboxRANGE, width: 80, renderer: function (value, p, record) { return record.data.VISIBLERANGEREF; } }, { sortable: true, dataIndex: 'OPERATERANGE', header: '操作范围', editor: this.comboxRANGE2, width: 80, renderer: function (value, p, record) { return record.data.OPERATERANGEREF; } } ] }); var VisibleIsload = true; var OperateIsload = true; this.gridList.getSelectionModel().on('select', function (model, record, index) { var USERID = record.data.USERID; var AUTHORITYID = record.data.AUTHORITYID; _thisAuthority.AUTHORITYID = AUTHORITYID; _thisAuthority.SELECTUSERID = USERID; var VISIBLERANGE = record.data.VISIBLERANGE; var OPERATERANGE = record.data.OPERATERANGE; if (VISIBLERANGE == 5) { if (VisibleIsload) { VisibleIsload = false; this.storeListCompanyVs.load({ params: { userid: USERID, authorityid: AUTHORITYID }, callback: function (r, options, success) { if (success) { VisibleIsload = true; } } }); this.panelCompanyVsList.setVisible(true); this.panelOpVsList.setVisible(false); } } else if (VISIBLERANGE == 6) { //选择人员 //isload = false; //this.storeListOpVs.load({ params: { userid: USERID,authorityid:AUTHORITYID}, // callback: function (r, options, success) { // if (success) { // isload = true; // }GetUserAuthorityOp_Tree // } //}); //this.panelCompanyVsList.setVisible(false); //this.panelOpVsList.setVisible(true); if (VisibleIsload) { VisibleIsload = false; this.treestore_VISIBLE.load({ params: { PARENTID: '0', USERID: USERID, AUTHORITYID: this.AUTHORITYID }, waitMsg: "正在刷新数据...", timeout: 6000000, //60秒 scope: this, callback: function (r, options, success) { if (success) { VisibleIsload = true; _this.tabtree_VISIBLE.expandAll(); } } }); this.panelCompanyVsList.setVisible(false); this.panelOpVsList.setVisible(true); } } else if (VISIBLERANGE != 5 && VISIBLERANGE != 6) { this.panelCompanyVsList.setVisible(false); this.panelOpVsList.setVisible(false); } if (OPERATERANGE == 5) { if (OperateIsload) { OperateIsload = false; this.storeListCompanyOp.load({ params: { userid: USERID, authorityid: AUTHORITYID }, callback: function (r, options, success) { if (success) { OperateIsload = true; } } }); this.panelCompanyOpList.setVisible(true); this.panelOpOpList.setVisible(false); } } else if (OPERATERANGE == 6) { // isload = false; // this.storeListOpOp.load({ params: { userid: USERID,authorityid:AUTHORITYID}, // callback: function (r, options, success) { // if (success) { // isload = true; // } // } //}); //this.panelCompanyOpList.setVisible(false); //this.panelOpOpList.setVisible(true); if (OperateIsload) { OperateIsload = false; this.treestore_OPERATE.load({ params: { PARENTID: '0', USERID: USERID, AUTHORITYID: this.AUTHORITYID }, waitMsg: "正在刷新数据...", timeout: 6000000, //60秒 scope: this, callback: function (r, options, success) { if (success) { OperateIsload = true; _this.tabtree_OPERATE.expandAll(); } } }); this.panelCompanyOpList.setVisible(false); this.panelOpOpList.setVisible(true); } } else if (OPERATERANGE != 5 && OPERATERANGE != 6) { this.panelCompanyOpList.setVisible(false); this.panelOpOpList.setVisible(false); } _thisAuthority.formSQLEdit.getForm().findField('USERID').setDisabled(false); _thisAuthority.formSQLEdit.getForm().findField('AUTHORITYID').setDisabled(false); _thisAuthority.formSQLEdit.getForm().findField('VSSQL').setValue(record.data.VSSQL); _thisAuthority.formSQLEdit.getForm().findField('USERID').setValue(record.data.USERID); _thisAuthority.formSQLEdit.getForm().findField('AUTHORITYID').setValue(record.data.AUTHORITYID); _thisAuthority.formSQLEdit.getForm().findField('USERID').setDisabled(true); _thisAuthority.formSQLEdit.getForm().findField('AUTHORITYID').setDisabled(true); }, this); //#endregion //#region formSearch //#region formSearch枚举参照相关 //#endregion //#endregion formSearch //查询工具条 this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { text: "保存", iconCls: "btnsave", handler: function (button, event) { this.onPostDetailClick(button, event); }, scope: this }, '-',{ text: '可视范围复制到全部', tooltip: '可视范围复制到全部', handler: function (button, event) { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请选择要复制的权限范围!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; var VISIBLERANGE=record.data.VISIBLERANGE; var VISIBLERANGEREF=record.data.VISIBLERANGEREF; var i; for (i = 0; i < this.storeList.getCount(); i += 1) { var memberyf = this.storeList.getAt(i); memberyf.set("VISIBLERANGE", VISIBLERANGE); memberyf.set("VISIBLERANGEREF", VISIBLERANGEREF); // memberyf.commit(); }; }, scope: this }, '-',{ text: '操作范围复制到全部', tooltip: '操作范围复制到全部', handler: function (button, event) { var selections = this.gridList.getSelectionModel().getSelection(); if (selections.length == 0) { Ext.Msg.show({ title: '提示', msg: '请选择要复制的权限范围!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } var record = selections[0]; var OPERATERANGE=record.data.OPERATERANGE; var OPERATERANGEREF=record.data.OPERATERANGEREF; var i; for (i = 0; i < this.storeList.getCount(); i += 1) { var memberyf = this.storeList.getAt(i); memberyf.set("OPERATERANGE", OPERATERANGE); memberyf.set("OPERATERANGEREF", OPERATERANGEREF); // memberyf.commit(); }; }, scope: this },'-', { text: "刷新", iconCls: "btnrefresh", handler: function (button, event) { var sql = ''; this.storeList.reload(); }, scope: this } ] }); //#region 公司可视 this.storeListCompanyVs = Ext.create('Ext.data.Store', { model: 'MsUserAuthorityCompany', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsUserAuthority/GetUserAuthorityCompanyList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.gridListCompanyVsCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.gridListCompanyVs = new Ext.grid.GridPanel({ store: this.storeListCompanyVs, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.gridListCompanyVsCellEditing], selType: 'cellmodel', tbar: [{ text: '全选', tooltip: '全选', handler: function (button, event) { var i; for (i = 0; i < this.storeListCompanyVs.getCount(); i += 1) { var memberyf = this.storeListCompanyVs.getAt(i); memberyf.set("VISIBLERANGE", true); memberyf.commit(); }; }, scope: this }, { text: '全清', tooltip: '全清', handler: function (button, event) { var i; for (i = 0; i < this.storeListCompanyVs.getCount(); i += 1) { var memberyf = this.storeListCompanyVs.getAt(i); memberyf.set("VISIBLERANGE",false); memberyf.commit(); }; }, scope: this }, { text: '保存', tooltip: '保存', iconCls: "btnsave", handler: function (button, event) { this.onPostCompanyVsDetailClick(button, event); }, scope: this }, '-', { text: '更新到此人所有[选择公司]', tooltip: '更新到此人所有[选择公司]', handler: function (button, event) { this.onPostCompanyAllClick('VS'); }, scope: this }], columns: [{ sortable: true, dataIndex: 'GID', header: 'GID', hidden: true, width: 120 }, { sortable: true, dataIndex: 'COMPANY', header: '公司名称', width: 160 }, { sortable: true, xtype: 'checkcolumn', dataIndex: 'VISIBLERANGE', header: '可视', stopSelection: false, width: 60 } ] }); this.panelCompanyVsList = new Ext.Panel({ layout: "border", title: '选择公司可视范围', flex : 1, hidden:true, // region: "east", // width:300, items: [this.gridListCompanyVs] }); //#endregion //#region 公司可操作 this.storeListCompanyOp = Ext.create('Ext.data.Store', { model: 'MsUserAuthorityCompany', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsUserAuthority/GetUserAuthorityCompanyList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.gridListCompanyOpCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.gridListCompanyOp = new Ext.grid.GridPanel({ store: this.storeListCompanyOp, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.gridListCompanyOpCellEditing], selType: 'cellmodel', tbar: [{ text: '全选', tooltip: '全选', handler: function (button, event) { var i; for (i = 0; i < this.storeListCompanyOp.getCount(); i += 1) { var memberyf = this.storeListCompanyOp.getAt(i); memberyf.set("OPERATERANGE", true); memberyf.commit(); }; }, scope: this }, { text: '全清', tooltip: '全清', handler: function (button, event) { var i; for (i = 0; i < this.storeListCompanyOp.getCount(); i += 1) { var memberyf = this.storeListCompanyOp.getAt(i); memberyf.set("OPERATERANGE",false); memberyf.commit(); }; }, scope: this }, { text: '保存', tooltip: '保存', iconCls: "btnsave", handler: function (button, event) { this.onPostCompanyOpDetailClick(button, event); }, scope: this }, '-', { text: '更新到此人所有[选择公司]', tooltip: '更新到此人所有[选择公司]', handler: function (button, event) { this.onPostCompanyAllClick('OP'); }, scope: this }], columns: [{ sortable: true, dataIndex: 'GID', header: 'GID', hidden: true, width: 120 }, { sortable: true, dataIndex: 'COMPANY', header: '公司名称', width: 160 }, { sortable: true, xtype: 'checkcolumn', dataIndex: 'OPERATERANGE', header: '可操作', stopSelection: false, width: 60 } ] }); this.panelCompanyOpList = new Ext.Panel({ layout: "border", title: '选择公司可操作范围', flex : 1, hidden:true, // region: "east", // width:300, items: [this.gridListCompanyOp] }); //#endregion //#region 人员可视 this.storeListOpVs = Ext.create('Ext.data.Store', { model: 'MsUserAuthorityOp', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsUserAuthority/GetUserAuthorityOpList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.gridListOpVsCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.gridListOpVs = new Ext.grid.GridPanel({ store: this.storeListOpVs, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.gridListOpVsCellEditing], selType: 'cellmodel', tbar: [{ text: '全选', tooltip: '全选', handler: function (button, event) { var i; for (i = 0; i < this.storeListOpVs.getCount(); i += 1) { var memberyf = this.storeListOpVs.getAt(i); memberyf.set("VISIBLERANGE", true); memberyf.commit(); }; }, scope: this }, { text: '全清', tooltip: '全清', handler: function (button, event) { var i; for (i = 0; i < this.storeListOpVs.getCount(); i += 1) { var memberyf = this.storeListOpVs.getAt(i); memberyf.set("VISIBLERANGE", false); memberyf.commit(); } }, scope: this }, { text: '保存', tooltip: '保存', iconCls: "btnsave", handler: function (button, event) { this.onPostOpVsDetailClick(button, event); }, scope: this }, '-',{ text: '更新到此人所有[选择人员]', tooltip: '更新到此人所有[选择人员]', handler: function (button, event) { this.onPostOpVsAllClick(button, event); }, scope: this }], columns: [{ sortable: true, dataIndex: 'GID', header: 'GID', hidden: true, width: 120 }, { sortable: true, dataIndex: 'OPNAME', header: '人员', width: 200 }, { sortable: true, dataIndex: 'DEPTNAME', header: '部门', width: 120 }, { sortable: true, xtype: 'checkcolumn', dataIndex: 'VISIBLERANGE', header: '可视', stopSelection: false, width: 60 } ] }); this.panelOpVsList = new Ext.Panel({ layout: "border", title: '员工可视范围', flex : 1, hidden:true, // region: "east", // width: 300, items: [ this.tabtree_VISIBLE ] //items: [this.gridListOpVs] }); //#endregion //#region 人员可操作 this.storeListOpOp = Ext.create('Ext.data.Store', { model: 'MsUserAuthorityOp', remoteSort: true, proxy: { type: 'ajax', url: '/MvcShipping/MsUserAuthority/GetUserAuthorityOpList', reader: { id: 'GID', root: 'data', totalProperty: 'totalCount' } } }); this.gridListOpOpCellEditing = Ext.create('Ext.grid.plugin.CellEditing', { clicksToEdit: 1 }); this.gridListOpOp = new Ext.grid.GridPanel({ store: this.storeListOpOp, enableHdMenu: false, region: 'center', loadMask: { msg: "数据加载中,请稍等..." }, trackMouseOver: true, disableSelection: false, plugins: [this.gridListOpOpCellEditing], selType: 'cellmodel', tbar: [{ text: '全选', tooltip: '全选', handler: function (button, event) { var i; for (i = 0; i < this.storeListOpOp.getCount(); i += 1) { var memberyf = this.storeListOpOp.getAt(i); memberyf.set("OPERATERANGE", true); memberyf.commit(); } }, scope: this }, { text: '全清', tooltip: '全清', handler: function (button, event) { var i; for (i = 0; i < this.storeListOpOp.getCount(); i += 1) { var memberyf = this.storeListOpOp.getAt(i); memberyf.set("OPERATERANGE", false); memberyf.commit(); }; }, scope: this }, { text: '保存', tooltip: '保存', iconCls: "btnsave", handler: function (button, event) { this.onPostOpOpDetailClick(button, event); }, scope: this }, '-',{ text: '更新到此人所有[选择人员]', tooltip: '更新到此人所有[选择人员]', handler: function (button, event) { this.onPostOpOpAllClick(button, event); }, scope: this }], columns: [{ sortable: true, dataIndex: 'GID', header: 'GID', hidden: true, width: 120 }, { sortable: true, dataIndex: 'OPNAME', header: '人员', width: 200 }, { sortable: true, dataIndex: 'DEPTNAME', header: '部门', width: 120 }, { sortable: true, xtype: 'checkcolumn', dataIndex: 'OPERATERANGE', header: '可操作', stopSelection: false, width: 60 } ] }); this.panelOpOpList = new Ext.Panel({ layout: "border", title: '员工可操作范围', flex : 1, hidden:true, // region: "east", // width: 300, items: [ //this.gridListOpOp this.tabtree_OPERATE ] }); //#endregion this.panelOpVs = new Ext.Panel({ layout: { type: 'vbox', align : 'stretch', pack : 'start' }, region: "center", //width: 460, items: [this.panelCompanyVsList,this.panelCompanyOpList,this.panelOpVsList,this.panelOpOpList] }); this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 30, items: [this.panelBtn] }); this.formSQLEdit = Ext.widget('form', { title: '权限可视范围sql语句', region: 'south', height:220, frame: true, border: false, split: true, trackResetOnLoad: true, fieldDefaults: { margins: '2 2 2 2', labelAlign: 'right', flex: 1, labelWidth: 70, msgTarget: 'qtip' }, items: [{ xtype: 'container', layout: 'anchor', flex: 2, defaultType: 'textfield', items: [{ fieldLabel: 'USERID', name: 'USERID', hidden: true }, { fieldLabel: 'AUTHORITYID', name: 'AUTHORITYID', hidden: true }, { xtype: 'textareafield', grow: true, //字段是否自动伸展和收缩,默认为false labelSeparator: '', //标签分隔字符 name: 'VSSQL', height: 210, anchor: '100%', enableKeyEvents: true, //激活键盘事件 listeners: { scope: this, 'blur': function blur(combo, eOpts, obj) { _thisAuthority.formSQLEdit.getForm().findField('USERID').setDisabled(false); _thisAuthority.formSQLEdit.getForm().findField('AUTHORITYID').setDisabled(false); var USERID = _thisAuthority.formSQLEdit.getForm().findField('USERID').getValue(); var AUTHORITYID = _thisAuthority.formSQLEdit.getForm().findField('AUTHORITYID').getValue(); var VSSQL = _thisAuthority.formSQLEdit.getForm().findField('VSSQL').getValue(); _thisAuthority.formSQLEdit.getForm().findField('USERID').setDisabled(true); _thisAuthority.formSQLEdit.getForm().findField('AUTHORITYID').setDisabled(true); for (var i = 0; i < _thisAuthority.storeList.getCount(); i += 1) { var member = _thisAuthority.storeList.getAt(i); if (member.data.USERID == USERID&&member.data.AUTHORITYID == AUTHORITYID) { member.set("VSSQL", VSSQL); member.commit(); } } } // } }] }] }); this.panelUserAuthorityList = new Ext.Panel({ layout: "border", region: "west", width:410, items: [this.gridList, this.formSQLEdit ] }); this.panelList = new Ext.Panel({ layout: "border", title: '', region: "center", items: [this.panelUserAuthorityList, this.panelOpVs //this.tabtree2 ] }); this.panelcenter = new Ext.Panel({ title: '权限范围设置', //'委托详细信息', layout: "border", region: 'center', animate: true, autoScroll: true, // containerScroll: true, frame: false, items: [this.panelTop, this.panelList] }); Ext.apply(this, { items: [this.tabtree, this.panelcenter] }); this.gridList.on('edit', function (editor, e, eOpts) { this.gridListAfterEdit(editor, e, eOpts); }, this); this.storeList.on('beforeload', function (store) { // var sql = this.getCondition(); Ext.apply(store.proxy.extraParams, { userid: _thisAuthority.opid }); }, this); this.storeListCompanyVs.on('beforeload', function (store) { Ext.apply(store.proxy.extraParams, { userid: _thisAuthority.opid,authorityid:_thisAuthority.AUTHORITYID }); }, this); this.storeListCompanyOp.on('beforeload', function (store) { Ext.apply(store.proxy.extraParams, { userid: _thisAuthority.opid,authorityid:_thisAuthority.AUTHORITYID }); }, this); this.storeListOpVs.on('beforeload', function (store) { Ext.apply(store.proxy.extraParams, { userid: _thisAuthority.opid,authorityid:_thisAuthority.AUTHORITYID }); }, this); this.storeListOpOp.on('beforeload', function (store) { Ext.apply(store.proxy.extraParams, { userid: _thisAuthority.opid,authorityid:_thisAuthority.AUTHORITYID }); }, this); }, //end initUIComponents gridListAfterEdit: function (editor, e, eOpts) { if (e.value == e.originalValue) return; if (e.field == 'VISIBLERANGE') { var selectrecords = DsStoreQueryBy(this.StoreRANGE, 'NUM', e.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; e.record.set('VISIBLERANGEREF', selectdata.BL); } else { e.record.set('VISIBLERANGEREF', ''); } } else if (e.field == 'OPERATERANGE') { var selectrecords = DsStoreQueryBy(this.StoreRANGE, 'NUM', e.value); if (selectrecords.getCount() > 0) { var selectdata = selectrecords.getAt(0).data; e.record.set('OPERATERANGEREF', selectdata.BL); } else { e.record.set('OPERATERANGEREF', ''); } } }, onPostDetailClick: function (button, event) { // var selections = this.gridList.getSelectionModel().getSelection(); // if (selections.length == 0) { // Ext.Msg.show({ title: '提示', msg: '请先选择报表!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); // return; // } var bodyDrChFeeDatas = []; var i; for (i = 0; i < this.storeList.getCount(); i += 1) { var memberyf = this.storeList.getAt(i); bodyDrChFeeDatas.push(memberyf); }; var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas); _thisfee = this; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsUserAuthority/Save', scope: this, params: { body: jsonChFeeBody, userid: _thisAuthority.opid }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var sql = ''; this.storeList.reload(); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); }, //end save onPostCompanyVsDetailClick: function (button, event) { // var selections = this.gridList.getSelectionModel().getSelection(); // if (selections.length == 0) { // Ext.Msg.show({ title: '提示', msg: '请先选择报表!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); // return; // } var bodyDrChFeeDatas = []; var i; for (i = 0; i < this.storeListCompanyVs.getCount(); i += 1) { var memberyf = this.storeListCompanyVs.getAt(i); bodyDrChFeeDatas.push(memberyf); }; var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas); _thisfee = this; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsUserAuthority/SaveAuthorityCompany', scope: this, params: { body: jsonChFeeBody, rtype:'VS' }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var sql = ''; this.storeListCompanyVs.reload(); this.storeListCompanyOp.reload(); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); }, //end save onPostCompanyOpDetailClick: function (button, event) { // var selections = this.gridList.getSelectionModel().getSelection(); // if (selections.length == 0) { // Ext.Msg.show({ title: '提示', msg: '请先选择报表!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); // return; // } var bodyDrChFeeDatas = []; var i; for (i = 0; i < this.storeListCompanyOp.getCount(); i += 1) { var memberyf = this.storeListCompanyOp.getAt(i); bodyDrChFeeDatas.push(memberyf); }; var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas); _thisfee = this; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsUserAuthority/SaveAuthorityCompany', scope: this, params: { body: jsonChFeeBody, rtype:'OP' }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var sql = ''; this.storeListCompanyOp.reload(); this.storeListCompanyVs.reload(); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); }, //end save onPostCompanyAllClick: function (rtype) { _this = this; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsUserAuthority/SaveAuthorityCompanyVsAll_Tree', scope: this, params: { USERID: _this.SELECTUSERID, AUTHORITYID: _this.AUTHORITYID, rtype: rtype }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { this.storeListCompanyOp.reload(); this.storeListCompanyVs.reload(); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); }, //end save onPostOpVsDetailClick: function (button, event) { // var selections = this.gridList.getSelectionModel().getSelection(); // if (selections.length == 0) { // Ext.Msg.show({ title: '提示', msg: '请先选择报表!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); // return; // } var bodyDrChFeeDatas = []; var i; for (i = 0; i < this.storeListOpVs.getCount(); i += 1) { var memberyf = this.storeListOpVs.getAt(i); bodyDrChFeeDatas.push(memberyf); } var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas); _thisfee = this; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsUserAuthority/SaveAuthorityOpDetail', scope: this, params: { body: jsonChFeeBody, rtype:'VS' }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var sql = ''; this.storeListOpVs.reload(); this.storeListOpOp.reload(); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); }, //end save onPostOpVsAllClick: function (button, event) { // var selections = this.gridList.getSelectionModel().getSelection(); // if (selections.length == 0) { // Ext.Msg.show({ title: '提示', msg: '请先选择报表!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); // return; // } var bodyDrChFeeDatas = []; var i; for (i = 0; i < this.storeListOpVs.getCount(); i += 1) { var memberyf = this.storeListOpVs.getAt(i); bodyDrChFeeDatas.push(memberyf); }; var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas); _thisfee = this; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsUserAuthority/SaveAuthorityOpAll', scope: this, params: { body: jsonChFeeBody, rtype:'VS' }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var sql = ''; this.storeListOpVs.reload(); this.storeListOpOp.reload(); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); }, //end save getTreeNodesJson: function (rtype){ var bodyOpVsDatas = []; if(rtype == "OP") { var selNodes = getTreeLeafNodes(this.tabtree_OPERATE); Ext.each(selNodes, function (node) { if (node.data.leaf == true) bodyOpVsDatas.push(node.data); }); } if (rtype == "VS") { var selNodes = getTreeLeafNodes(this.tabtree_VISIBLE); Ext.each(selNodes, function (node) { if (node.data.leaf == true) bodyOpVsDatas.push(node.data); }); } var jsonOpVsDatas = convertArraysToJson(bodyOpVsDatas); return jsonOpVsDatas; }, onSaveOpVsDetailClick: function (rtype) { var jsonOpVsDatas = this.getTreeNodesJson(rtype); if (jsonOpVsDatas == '') { Ext.Msg.show({ title: '提示', msg: '没有需要保存的数据', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } _this = this; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsUserAuthority/SaveAuthorityOpVSDetail_Tree', scope: this, params: { body: jsonOpVsDatas, rtype: rtype }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { if (rtype == "OP") { this.treestore_OPERATE.load({ params: { PARENTID: '0', USERID: _this.SELECTUSERID, AUTHORITYID: _this.AUTHORITYID }, waitMsg: "正在刷新数据...", timeout: 6000000, //60秒 scope: this, callback: function (r, options, success) { if (success) { _this.tabtree_OPERATE.expandAll(); } } }); } if (rtype == "VS") { this.treestore_VISIBLE.load({ params: { PARENTID: '0', USERID: _this.SELECTUSERID, AUTHORITYID: _this.AUTHORITYID }, waitMsg: "正在刷新数据...", timeout: 6000000, //60秒 scope: this, callback: function (r, options, success) { if (success) { _this.tabtree_VISIBLE.expandAll(); } } }); } } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); }, //end save onSaveOpVsAllClick: function (rtype) { var jsonOpVsDatas = this.getTreeNodesJson(rtype); if (jsonOpVsDatas == '') { Ext.Msg.show({ title: '提示', msg: '没有需要保存的数据', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); return; } _this = this; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsUserAuthority/SaveAuthorityOpVsAll_Tree', scope: this, params: { USERID: _this.SELECTUSERID, AUTHORITYID: _this.AUTHORITYID, rtype:rtype }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { if (rtype == "OP") { this.treestore_OPERATE.load({ params: { PARENTID: '0', USERID: _this.SELECTUSERID, AUTHORITYID: _this.AUTHORITYID }, waitMsg: "正在刷新数据...", timeout: 6000000, //60秒 scope: this, callback: function (r, options, success) { if (success) { _this.tabtree_OPERATE.expandAll(); } } }); } if (rtype == "VS") { this.treestore_VISIBLE.load({ params: { PARENTID: '0', USERID: _this.SELECTUSERID, AUTHORITYID: _this.AUTHORITYID }, waitMsg: "正在刷新数据...", timeout: 6000000, //60秒 scope: this, callback: function (r, options, success) { if (success) { _this.tabtree_VISIBLE.expandAll(); } } }); } } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); }, //end save onPostOpOpAllClick: function (button, event) { // var selections = this.gridList.getSelectionModel().getSelection(); // if (selections.length == 0) { // Ext.Msg.show({ title: '提示', msg: '请先选择报表!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK }); // return; // } var bodyDrChFeeDatas = []; var i; for (i = 0; i < this.storeListOpOp.getCount(); i += 1) { var memberyf = this.storeListOpOp.getAt(i); bodyDrChFeeDatas.push(memberyf); }; var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas); _thisfee = this; Ext.Msg.wait('正在保存数据, 请稍侯..'); Ext.Ajax.request({ waitMsg: '正在保存数据...', url: '/MvcShipping/MsUserAuthority/SaveAuthorityOpAll', scope: this, params: { body: jsonChFeeBody, rtype:'OP' }, callback: function (options, success, response) { if (success) { Ext.MessageBox.hide(); var jsonresult = Ext.JSON.decode(response.responseText); if (jsonresult.Success) { var sql = ''; this.storeListOpOp.reload(); this.storeListOpVs.reload(); } else { Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } else { Ext.Msg.show({ title: '请重试', msg: '服务器响应出错', icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK }); } } }); }, //end save OprationSwap: function () { var ret = new Array(); ret[0] = this.OprationStatus; ret[1] = this.storeList; ret[2] = this.SelectedRecord; return ret; } });