Index: ssts-web/src/main/webapp/systemmanage/orgUnitExtView.js =================================================================== diff -u -r38878 -r41593 --- ssts-web/src/main/webapp/systemmanage/orgUnitExtView.js (.../orgUnitExtView.js) (revision 38878) +++ ssts-web/src/main/webapp/systemmanage/orgUnitExtView.js (.../orgUnitExtView.js) (revision 41593) @@ -1,130 +1,130 @@ //********* 按钮响应函数 *********** -function addOrgUnit(){ - var parentId = $Id('parm_s_parentId').value; - if(parentId.trim()==""){ - alert("请选择组织单位!"); - return false; - } - location.href=WWWROOT + "/systemmanage/orgUnitExt.jsp?parentId="+parentId+"&editMode=true"; +function addOrgUnit() { + var parentId = $Id('parm_s_parentId').value; + if (parentId.trim() == "") { + alert("请选择组织单位!"); + return false; + } + location.href = WWWROOT + "/systemmanage/orgUnitExt.jsp?parentId=" + parentId + "&editMode=true"; } -function deleteOrgUnit(){ - var ids = grid.getSelectedValues('id', ';'); - if(ids==""){ - alert("请选择要删除的组织单位!"); - return false; - } - Ext.MessageBox.confirm("请确认","是否确定要删除选中的组织机构?",function(button, text){ - if("yes" == button){ - OrgUnitTableManager.deleteOrgUnitByKeyIds(ids, function(result){ - if(result){ - var jsonObj = Ext.decode(result); - if(jsonObj.success){ - reloadTreeAndTable(); - }else{ - showResult(jsonObj.message); - } - } - }); +function deleteOrgUnit() { + var ids = grid.getSelectedValues('id', ';'); + if (ids == "") { + alert("请选择要删除的组织单位!"); + return false; + } + Ext.MessageBox.confirm("请确认", "是否确定要删除选中的组织机构?", function (button, text) { + if ("yes" == button) { + OrgUnitTableManager.deleteOrgUnitByKeyIds(ids, function (result) { + if (result) { + var jsonObj = Ext.decode(result); + if (jsonObj.success) { + reloadTreeAndTable(); + } else { + showResult(jsonObj.message); + } + } + }); } - }); + }); } // 停用/启用科室 -function disableOrEnableDefinition (isDisabled,grid) { - var ids = grid.getSelectedValues('id', ';'); - Ext.Ajax.request({ - url: WWWROOT + '/systemmanage/disableOrEnableOrgUnit.do', - params: { - ids : ids, - isDisabled : isDisabled - }, - success: function(response ,options){ - var jsonObj = Ext.decode(response.responseText); - if(jsonObj!=null && jsonObj.length!=0){ - if(jsonObj.success){ +function disableOrEnableDefinition(isDisabled, grid) { + var ids = grid.getSelectedValues('id', ';'); + Ext.Ajax.request({ + url: WWWROOT + '/systemmanage/disableOrEnableOrgUnit.do', + params: { + ids: ids, + isDisabled: isDisabled + }, + success: function (response, options) { + var jsonObj = Ext.decode(response.responseText); + if (jsonObj != null && jsonObj.length != 0) { + if (jsonObj.success) { alert(isDisabled + '成功!'); $Id("parm_s_status").value = 1; root.reload(); - grid.dwrReload(); - }else{ - alert(isDisabled + '失败!'); - } - } - }, - failure: function(){ - alert(isDisabled + '失败!'); - } - }); + grid.dwrReload(); + } else { + alert(isDisabled + '失败!'); + } + } + }, + failure: function () { + alert(isDisabled + '失败!'); + } + }); } -function search(searchText,searchId){ - if(searchText!=null && searchText.length!=0){ - var treePanel = viewport.findById('west-panel'); - Ext.Ajax.request({ - url: WWWROOT + '/systemmanage/loadOrgUnitById.do', - params: {orgUnitId:searchId}, - success: function(response ,options){ +function search(searchText, searchId) { + if (searchText != null && searchText.length != 0) { + var treePanel = viewport.findById('west-panel'); + Ext.Ajax.request({ + url: WWWROOT + '/systemmanage/loadOrgUnitById.do', + params: { orgUnitId: searchId }, + success: function (response, options) { var jsonObj = Ext.decode(response.responseText); - if(jsonObj!=null && jsonObj.length!=0){ - if(jsonObj.success){ - treePanel.expandPath(jsonObj.data,'id',function(bSuccess, oLastNode){ - if(!bSuccess) return; - //focus 节点,并选中节点!,以下代码不可少 - oLastNode.on('click',function(node,event){ - reloadGrid(node.id); - }); - oLastNode.ensureVisible(); - oLastNode.select(); - oLastNode.fireEvent('click', oLastNode); - }); - }else{ - alert('没有找到相关的组织结构!'); - } - } - }, - failure: function(){ - alert('没有找到相关的组织结构!'); - } - }); - }else{ - alert('请输入组织机构名称!'); - } + if (jsonObj != null && jsonObj.length != 0) { + if (jsonObj.success) { + treePanel.expandPath(jsonObj.data, 'id', function (bSuccess, oLastNode) { + if (!bSuccess) return; + //focus 节点,并选中节点!,以下代码不可少 + oLastNode.on('click', function (node, event) { + reloadGrid(node.id); + }); + oLastNode.ensureVisible(); + oLastNode.select(); + oLastNode.fireEvent('click', oLastNode); + }); + } else { + alert('没有找到相关的组织结构!'); + } + } + }, + failure: function () { + alert('没有找到相关的组织结构!'); + } + }); + } else { + alert('请输入组织机构名称!'); + } } -function moveOrgUnit(){ +function moveOrgUnit() { var sourceOrgUnitKeyId = grid.getSelectedValues('id', ';'); - if(sourceOrgUnitKeyId==null||sourceOrgUnitKeyId==""){ - alert("请选择要移动的组织"); - return ; + if (sourceOrgUnitKeyId == null || sourceOrgUnitKeyId == "") { + alert("请选择要移动的组织"); + return; } - - var destinationOrgUnitKeyIdArray = openModalWindowForExt(WWWROOT + '/common/selOrgUnit.jsp?onlyOneOrg=yes','', '选择部门', '800', '400'); - - if(destinationOrgUnitKeyIdArray == undefined){ + + var destinationOrgUnitKeyIdArray = openModalWindowForExt(WWWROOT + '/common/selOrgUnit.jsp?onlyOneOrg=yes', '', '选择部门', '800', '400'); + + if (destinationOrgUnitKeyIdArray == undefined) { return; - }else { - var loop = setInterval(function() { - if(destinationOrgUnitKeyIdArray.hidden) { + } else { + var loop = setInterval(function () { + if (destinationOrgUnitKeyIdArray.hidden) { clearInterval(loop); var returnValue = destinationOrgUnitKeyIdArray.returnValue || []; - if(returnValue.length > 0){ + if (returnValue.length > 0) { var destinationOrgUnitKeyId = returnValue[0]; - if(sourceOrgUnitKeyId==destinationOrgUnitKeyId){ - alert("源组织不能与目标组织相同"); - return ; + if (sourceOrgUnitKeyId == destinationOrgUnitKeyId) { + alert("源组织不能与目标组织相同"); + return; } - OrgUnitTableManager.moveOrgUnitByKeyIds(sourceOrgUnitKeyId,destinationOrgUnitKeyId,function(){reloadTreeAndTable();}); + OrgUnitTableManager.moveOrgUnitByKeyIds(sourceOrgUnitKeyId, destinationOrgUnitKeyId, function () { reloadTreeAndTable(); }); } - } - },500); + } + }, 500); } } -function moveUp(id){ - OrgUnitTableManager.moveUpOrgUnit(id, function(){reloadTreeAndTable();}); +function moveUp(id) { + OrgUnitTableManager.moveUpOrgUnit(id, function () { reloadTreeAndTable(); }); } -function moveDown(id){ - OrgUnitTableManager.moveDownOrgUnit(id, function(){reloadTreeAndTable();}); +function moveDown(id) { + OrgUnitTableManager.moveDownOrgUnit(id, function () { reloadTreeAndTable(); }); } @@ -135,142 +135,142 @@ */ function handleSetAutoSyncOrgUnit(synWin, checkTimeId) { var timeSet = Ext.getCmp(checkTimeId); - if (!timeSet.isValid()){ + if (!timeSet.isValid()) { return; } DataSynchronizationTableManager.autoSync(timeSet.getValue(), 'orgUnit', { - callback:function(data){ + callback: function (data) { showResult(data); synWin.close(); reloadTreeAndTable(); }, - errorHandler:function(msg){ + errorHandler: function (msg) { showResult('设置主动同步科室发生异常'); synWin.close(); }, - timeout:240000//超时时间4分钟 + timeout: 240000//超时时间4分钟 }); } /** * 自动同步用户 */ -function autoSyncOrgUnit(){ +function autoSyncOrgUnit() { var buttons = [ - {text: "确定", handler: function () {handleSetAutoSyncOrgUnit(synWin, 'timeSet');}}, - {text: "取消", handler: function (obj) {synWin.close();}} + { text: "确定", handler: function () { handleSetAutoSyncOrgUnit(synWin, 'timeSet'); } }, + { text: "取消", handler: function (obj) { synWin.close(); } } ]; var synWin = new Ext.Window({ - title:"设置自动同步时间", + title: "设置自动同步时间", width: 400, height: 120, // plain: true, modal: true, layout: "form", bodyStyle: "padding-top: 10px; padding-left:10px;", - items:[{ + items: [{ xtype: "textfield", - id : 'timeSet', + id: 'timeSet', regex: /^[1-9]\d*$/, regexText: '请输入大于零的整数!', - fieldLabel : "时间(分)", - emptyText : "输入分钟....", + fieldLabel: "时间(分)", + emptyText: "输入分钟....", listeners: { - specialkey: function(field, e){ + specialkey: function (field, e) { if (e.getKey() === e.ENTER) { handleSetAutoSyncOrgUnit(synWin, 'timeSet'); } } } }], - showLock:false, + showLock: false, buttons: buttons }); synWin.show(); } function syncOrgUnit() { - Ext.MessageBox.confirm("请确认","是否确定要同步组织机构信息?",function(button, text){ - if("yes" == button){ + Ext.MessageBox.confirm("请确认", "是否确定要同步组织机构信息?", function (button, text) { + if ("yes" == button) { var mask = new Ext.LoadMask(Ext.getBody(), { - msg : "同步组织机构中...
由于数据量比较大,更新时间可能比较长,请耐心等待。
如超过4分钟,页面还没有响应,请手动刷新页面!" + msg: "同步组织机构中...
由于数据量比较大,更新时间可能比较长,请耐心等待。
如超过4分钟,页面还没有响应,请手动刷新页面!" }); mask.show(); DataSynchronizationTableManager.syncOrgUnit({ - callback:function(data){ - if (data == 'success') { + callback: function (data) { + if (data == 'success') { showResult("同步成功"); reloadTreeAndTable(); } else if (data == 'error') { - showResult("同步失败"); + showResult("同步失败"); } else { - showResult(data); + showResult(data); } mask.hide(); }, - errorHandler:function(msg){ - mask.hide(); + errorHandler: function (msg) { + mask.hide(); }, - timeout:240000//超时时间4分钟 + timeout: 240000//超时时间4分钟 }); - + //执行一次的定时器 - setTimeout(function(){ + setTimeout(function () { showResult("服务器正在处理中,请稍后刷新页面查看结果!"); mask.hide(); reloadTreeAndTable(); - },240000);//超时时间4分钟 + }, 240000);//超时时间4分钟 } }); } function syncOrgUnitAndUser() { - Ext.MessageBox.confirm("请确认","是否确定要同步组织机构与用户信息?",function(button, text){ - if("yes" == button){ + Ext.MessageBox.confirm("请确认", "是否确定要同步组织机构与用户信息?", function (button, text) { + if ("yes" == button) { var mask = new Ext.LoadMask(Ext.getBody(), { - msg : "同步组织机构中...
由于数据量比较大,更新时间可能比较长,请耐心等待。
如超过4分钟,页面还没有响应,请手动刷新页面!" + msg: "同步组织机构中...
由于数据量比较大,更新时间可能比较长,请耐心等待。
如超过4分钟,页面还没有响应,请手动刷新页面!" }); mask.show(); - //超时时间4分钟 + //超时时间4分钟 var timeoutMillionSeconds = 240 * 1000; DataSynchronizationTableManager.syncOrgUnitAndUser({ - callback:function(success){ - result = success; - if (success) { + callback: function (success) { + result = success; + if (success) { showResult("同步成功"); reloadTreeAndTable(); } else { - showResult("同步失败"); + showResult("同步失败"); } mask.hide(); }, - errorHandler:function(msg){ - showResult("服务器正在处理中,请稍后刷新页面查看结果!"); - mask.hide(); + errorHandler: function (msg) { + showResult("服务器正在处理中,请稍后刷新页面查看结果!"); + mask.hide(); }, - timeout:timeoutMillionSeconds //超时时间4分钟 + timeout: timeoutMillionSeconds //超时时间4分钟 }); } }); } -function reloadTreeAndTable(){ - root.reload(); - - var treePanel = viewport.findById('west-panel'); - treePanel.expandPath(path); +function reloadTreeAndTable() { + root.reload(); + + var treePanel = viewport.findById('west-panel'); + treePanel.expandPath(path); //树没有打开所有之前打开的节点,只打开了最近的一个。 $Id("parm_s_status").value = 1; - grid.dwrReload(); + grid.dwrReload(); } -function reloadGrid(parentId){ - if(typeof(parentId) == "undefined" || typeof(parentId) == "object" || null == parentId || parentId == "" ){ - parentId = 0; - } +function reloadGrid(parentId) { + if (typeof (parentId) == "undefined" || typeof (parentId) == "object" || null == parentId || parentId == "") { + parentId = 0; + } $Id("parm_s_parentId").value = parentId; $Id("parm_s_status").value = 1; - grid.dwrReload(); + grid.dwrReload(); } var entityName = "组织机构"; @@ -280,293 +280,329 @@ var path = '/0'; //组织机构Store var orgJsonStore = new Ext.data.Store({ - proxy : new Ext.data.HttpProxy({ - url : WWWROOT + '/systemmanage/getOrgNameBySpellingAndWB!getOrgNameBySpellingAndWB.do', - method : 'POST' + proxy: new Ext.data.HttpProxy({ + url: WWWROOT + '/systemmanage/getOrgNameBySpellingAndWB!getOrgNameBySpellingAndWB.do', + method: 'POST' }), - baseParams :{ - showDisableOrgUnit : false - }, - reader : new Ext.data.JsonReader({ - root : 'data' - },[ - {name : 'name',mapping : 'name',id:'id'} - ] + baseParams: { + showDisableOrgUnit: false + }, + reader: new Ext.data.JsonReader({ + root: 'data' + }, [ + { name: 'name', mapping: 'name', id: 'id' } + ] ) }); -Ext.onReady(function(){ +Ext.onReady(function () { Ext.QuickTips.init(); $Id("parm_s_status").value = 1; -//********* 1、Tree *********** + //********* 1、Tree *********** root = new Ext.tree.AsyncTreeNode({ - text:'组织机构', - id:'0', - draggable:false, //这棵树不可以拖动默认也是false - listeners :{click: reloadGrid} + text: '组织机构', + id: '0', + draggable: false, //这棵树不可以拖动默认也是false + listeners: { click: reloadGrid } }); - - var myLoader = new Ext.tree.TreeLoader({dataUrl:WWWROOT + '/systemmanage/orgUnitTreeLoad.do?showDisableOrgUnit=false'}); - - myLoader.on("beforeload", function(treeLoader, node){ + + var myLoader = new Ext.tree.TreeLoader({ dataUrl: WWWROOT + '/systemmanage/orgUnitTreeLoad.do?showDisableOrgUnit=false' }); + + myLoader.on("beforeload", function (treeLoader, node) { treeLoader.baseParams.parentId = node.id; - treeLoader.baseParams.showDisableOrgUnit = true; + treeLoader.baseParams.showDisableOrgUnit = true; var nodePath = node.getPath(); - if(nodePath != '/0'){ - path = nodePath; - } + if (nodePath != '/0') { + path = nodePath; + } }); - -//********* 2、布局 *********** - -//********* 2、ForgonGrid *********** - function gotoPage(v, p, record){ - ///systemmanage/orgUnit.mhtml?id=54 - return "" + v + ""; + //********* 2、布局 *********** + + + //********* 2、ForgonGrid *********** + function gotoPage(v, p, record) { + ///systemmanage/orgUnit.mhtml?id=54 + return "" + v + ""; } - - function moveUpDown(v, p, record){ - var html = ''; - html += '向上移动'; - html += ''; - html += '向下移动'; - return html; + + function moveUpDown(v, p, record) { + var html = ''; + html += '向上移动'; + html += ''; + html += '向下移动'; + return html; } - + var columns = [ - {id:'operationDescription', header: "名称", width: 150, dataIndex: 'name', renderer : gotoPage, sortable: false}, - {id :'barcode',header : '条码',width: 120, dataIndex: 'barcode', sortable: false}, - {header: "部门编码", width: 120, dataIndex: 'orgUnitCoding', sortable: false, menuDisabled: true,hidden:sstsConfig.enableThirdPartyDepartmentCoding}, - {header: "部门编码", width: 120, dataIndex: 'orgForeignKey', sortable: false, menuDisabled: true,hidden:!sstsConfig.enableThirdPartyDepartmentCoding}, - {header: "负责人", width: 120, dataIndex: 'principal', sortable: false, menuDisabled: true}, - {header: "分管领导", width: 120, dataIndex: 'subLeadName', sortable: false, menuDisabled: true}, - {header: "拼音码", width: 120, dataIndex: 'spelling', sortable: false, menuDisabled: true}, - {header: "五笔码", width: 120, dataIndex: 'wbCode', sortable: false, menuDisabled: true}, - {header: "数据来源", width: 100, dataIndex: 'source', sortable: false, menuDisabled: true}, //(陈家儒改) - {header: "一次性物品价格浮动系数", width: 150, dataIndex: 'disposablePriceFluctuation', sortable: false, menuDisabled: true}, - {id : 'order',header: "排序操作", width: 150, dataIndex: 'id', renderer : moveUpDown, sortable: false, menuDisabled: true} + { id: 'operationDescription', header: "名称", width: 150, dataIndex: 'name', renderer: gotoPage, sortable: false }, + { id: 'barcode', header: '条码', width: 120, dataIndex: 'barcode', sortable: false }, + { header: "部门编码", width: 120, dataIndex: 'orgUnitCoding', sortable: false, menuDisabled: true, hidden: sstsConfig.enableThirdPartyDepartmentCoding }, + { header: "部门编码", width: 120, dataIndex: 'orgForeignKey', sortable: false, menuDisabled: true, hidden: !sstsConfig.enableThirdPartyDepartmentCoding }, + { header: "CHAS 管控标识", width: 120, dataIndex: 'chasControlTag', sortable: false, menuDisabled: true, hidden: !sstsConfig.enableChasSystemTagPush }, + { header: "CHAS 管控科室名称", width: 120, dataIndex: 'chasDeptName', sortable: false, menuDisabled: true, hidden: !sstsConfig.enableChasSystemTagPush }, + { header: "CHAS 管控科室编码", width: 120, dataIndex: 'chasDeptCode', sortable: false, menuDisabled: true, hidden: !sstsConfig.enableChasSystemTagPush }, + { header: "负责人", width: 120, dataIndex: 'principal', sortable: false, menuDisabled: true }, + { header: "分管领导", width: 120, dataIndex: 'subLeadName', sortable: false, menuDisabled: true }, + { header: "拼音码", width: 120, dataIndex: 'spelling', sortable: false, menuDisabled: true }, + { header: "五笔码", width: 120, dataIndex: 'wbCode', sortable: false, menuDisabled: true }, + { header: "数据来源", width: 100, dataIndex: 'source', sortable: false, menuDisabled: true }, + { header: "一次性物品价格浮动系数", width: 150, dataIndex: 'disposablePriceFluctuation', sortable: false, menuDisabled: true }, + { id: 'order', header: "排序操作", width: 150, dataIndex: 'id', renderer: moveUpDown, sortable: false, menuDisabled: true } ]; - + var readerDetail = [ - {name: 'id'}, - {name: 'parentId'}, - {name: 'name'}, - {name: 'barcode'}, - {name: 'orgUnitCoding'}, - {name: 'orgForeignKey'}, - {name: 'principal'}, - {name: 'spelling'}, - {name: 'wbCode'}, - {name: 'source'}, - {name: 'disposablePriceFluctuation'}, - {name: 'subLeadName'} + { name: 'id' }, + { name: 'parentId' }, + { name: 'name' }, + { name: 'barcode' }, + { name: 'orgUnitCoding' }, + { name: 'chasControlTag' }, + { name: 'chasDeptName' }, + { name: 'chasDeptCode' }, + { name: 'orgForeignKey' }, + { name: 'principal' }, + { name: 'spelling' }, + { name: 'wbCode' }, + { name: 'source' }, + { name: 'disposablePriceFluctuation' }, + { name: 'subLeadName' } ]; - + var filters = new Ext.grid.GridFilters({ - filters:[ - {type: 'string', dataIndex: 'name'} - ]}); - - var tbar= [{ - text:"同步组织机构数据", - tooltip : '同步组织机构数据', - iconCls : 'icon_refresh', - hidden : sstsConfig.hiddenOrgunitSyncButton, - handler:function(){ + filters: [ + { type: 'string', dataIndex: 'name' } + ] + }); + + var tbar = [{ + text: "同步组织机构数据", + tooltip: '同步组织机构数据', + iconCls: 'icon_refresh', + hidden: sstsConfig.hiddenOrgunitSyncButton, + handler: function () { syncOrgUnit(); - } - },'-',{ - text:"同步组织机构与用户数据", - tooltip : '同步组织机构与用户数据', - iconCls : 'icon_refresh', - hidden : !sstsConfig.showOrgunitAndUserSyncButton, - handler:function(){ - syncOrgUnitAndUser(); - } - },'-',{ - text : '自动同步组织机构数据', - tooltip:'自动同步组织机构数据', - iconCls:'icon_refresh', - hidden : !sstsConfig.showAutoSyn, - handler:function(){ + } + }, '-', { + text: "同步组织机构与用户数据", + tooltip: '同步组织机构与用户数据', + iconCls: 'icon_refresh', + hidden: !sstsConfig.showOrgunitAndUserSyncButton, + handler: function () { + syncOrgUnitAndUser(); + } + }, '-', { + text: '自动同步组织机构数据', + tooltip: '自动同步组织机构数据', + iconCls: 'icon_refresh', + hidden: !sstsConfig.showAutoSyn, + handler: function () { autoSyncOrgUnit(); } - },'-',{ - text:'添加', - tooltip:'添加'+entityName, - iconCls:'btn_ext_add', - hidden :false, - handler:function(){addOrgUnit();} }, '-', { - text:'删除', - tooltip:'删除选择'+entityName, - iconCls:'btn_remove', - hidden :false, - handler:function (){deleteOrgUnit(grid);} + text: '添加', + tooltip: '添加' + entityName, + iconCls: 'btn_ext_add', + hidden: false, + handler: function () { addOrgUnit(); } }, '-', { - text:'移动', - tooltip:'移动选择'+entityName, - iconCls:'btn_ext_refresh', - hidden :false, - handler:function (){moveOrgUnit(grid);} + text: '删除', + tooltip: '删除选择' + entityName, + iconCls: 'btn_remove', + hidden: false, + handler: function () { deleteOrgUnit(grid); } }, '-', { - text:'打印标签', - iconCls:'icon_print', - hidden :false, - handler:function (){ - var sm = grid.getSelectionModel(); // 获得grid的SelectionModel - if(sm.getSelected()){ - var recs=sm.getSelections(); // 把所有选中项放入数组 - for(var i=0;i