Index: ssts-web/src/main/webapp/disinfectsystem/basedatamanager/tousse/idCardInstanceView.js =================================================================== diff -u -r27276 -r34320 --- ssts-web/src/main/webapp/disinfectsystem/basedatamanager/tousse/idCardInstanceView.js (.../idCardInstanceView.js) (revision 27276) +++ ssts-web/src/main/webapp/disinfectsystem/basedatamanager/tousse/idCardInstanceView.js (.../idCardInstanceView.js) (revision 34320) @@ -4,28 +4,28 @@ var singleScanLabel = '单次扫描'; var repeatScanLabel = '多次扫描'; function initQueryValueAndReload() { - + $Id('parm_s_sterilizationDate').value = $Id('sterilizationDate').value; //灭菌开始时间 $Id('parm_s_sterilizationEndDate').value = $Id('sterilizationEndDate').value; //灭菌结束时间 $Id('parm_s_sterilizerName').value = $Id('sterilizerName').value; //灭菌炉名称 $Id('parm_s_frequency').value = $Id('frequency').value; //炉次 $Id('parm_s_tousseGroupName').value = $Id('tousseGroupName').value; //器械包分组 - + //如果当前所选中值与下拉框的值相同时,则采用精确匹配.否则采用模糊匹配 - if(currentSelectedTousseName == Ext.getCmp('tousseName').getRawValue()){ + if (currentSelectedTousseName == Ext.getCmp('tousseName').getRawValue()) { $Id('parm_s_tousseName').value = Ext.getCmp('tousseName').getRawValue(); - }else{ + } else { $Id('parm_s_tousseName').value = ''; $Id('parm_s_tousseNameFuzzy').value = Ext.getCmp('tousseName').getRawValue(); } - - + + var barcode = $Id('barcodeSearch').value; //条码字符串 var barcodeReg = /(\d){9}/; if (barcode.length == 9 && barcodeReg.test(barcode)) { //条码字符串为9数字,扫描码才有意义,否则清空 if (repeatScanLabel == $Id('scanPattern').value) { //启用多次扫描模式 if (barcodes) { - barcodes += ';' + barcode ; + barcodes += ';' + barcode; } else { //启用多次扫描模式的第一次扫描 barcodes = barcode; } @@ -36,251 +36,249 @@ barcode = ''; barcodes = ''; } - + $Id('parm_s_barcodeSearch').value = barcode; $Id('parm_s_barcodes').value = (barcodes.length == 9 ? '' : barcodes); //barcodes长度为9说明用户启用多次扫描模式,并且是第一次扫描 - + Ext.getCmp('barcodeSearch').setValue(''); grid.getStore().lastOptions.params['start'] = 0; grid.dwrReload(); - + } /** * 显示申请单终止原因 */ -function showSelectTousseDiscardCauseWin(){ +function showSelectTousseDiscardCauseWin() { var params = { - time:new Date().getTime() - } + time: new Date().getTime() + } - var endCase = openModalWindowForExt(WWWROOT+"/disinfectsystem/recyclingApplication/selectTousseDiscardCause.jsp",params, "选择废弃原因", "760", "400"); + var endCase = openModalWindowForExt(WWWROOT + "/disinfectsystem/recyclingApplication/selectTousseDiscardCause.jsp", params, "选择废弃原因", "760", "400"); - return endCase; + return endCase; } -function compareDate(DateOne,DateTwo) { - var OneMonth = DateOne.substring(5,DateOne.lastIndexOf ("-")); - var OneDay = DateOne.substring(DateOne.length,DateOne.lastIndexOf ("-")+1); - var OneYear = DateOne.substring(0,DateOne.indexOf ("-")); - var TwoMonth = DateTwo.substring(5,DateTwo.lastIndexOf ("-")); - var TwoDay = DateTwo.substring(DateTwo.length,DateTwo.lastIndexOf ("-")+1); - var TwoYear = DateTwo.substring(0,DateTwo.indexOf ("-")); - if (Date.parse(OneMonth+"/"+OneDay+"/"+OneYear) >= Date.parse(TwoMonth+"/"+TwoDay+"/"+TwoYear)) { +function compareDate(DateOne, DateTwo) { + var OneMonth = DateOne.substring(5, DateOne.lastIndexOf("-")); + var OneDay = DateOne.substring(DateOne.length, DateOne.lastIndexOf("-") + 1); + var OneYear = DateOne.substring(0, DateOne.indexOf("-")); + var TwoMonth = DateTwo.substring(5, DateTwo.lastIndexOf("-")); + var TwoDay = DateTwo.substring(DateTwo.length, DateTwo.lastIndexOf("-") + 1); + var TwoYear = DateTwo.substring(0, DateTwo.indexOf("-")); + if (Date.parse(OneMonth + "/" + OneDay + "/" + OneYear) >= Date.parse(TwoMonth + "/" + TwoDay + "/" + TwoYear)) { return true;//dataone>datetwo - } else { + } else { return false; - } + } } //验证器械包预警期、失效期 -function checkDate(v, p, record,rowIndex,columnIndex,store){ +function checkDate(v, p, record, rowIndex, columnIndex, store) { var validUntil = record.data.validUntil; var warningUntil = record.data.warningUntil; var date = new Date(); var currentDate = ""; - currentDate = date.getFullYear()+"-"; - currentDate += (date.getMonth()+1)+"-"; + currentDate = date.getFullYear() + "-"; + currentDate += (date.getMonth() + 1) + "-"; currentDate += date.getDate(); - var b = compareDate(myDateFormat(warningUntil,p,record),currentDate);//预警期 - var f = compareDate(myDateFormat(validUntil,p,record),currentDate);//失效期 + var b = compareDate(myDateFormat(warningUntil, p, record), currentDate);//预警期 + var f = compareDate(myDateFormat(validUntil, p, record), currentDate);//失效期 var color = ""; - if(!b){ + if (!b) { color = "yellow"; } - if(!f){ + if (!f) { color = "#FF7575"; } - if(v != null){ - return "

" + myDateFormat(v) + "

"; - }else{ + if (v != null) { + return "

" + myDateFormat(v) + "

"; + } else { return ""; } } -function renderCallTousseInstanceInfoShowFun(v, p, record){ +function renderCallTousseInstanceInfoShowFun(v, p, record) { var isComboTousse = (record.data['tousseDefinition.tousseType'] == '聚合包'); - return "" + record.data['showTousseName'] + ""; + return "" + record.data['showTousseName'] + ""; } -function nameAndFrequency(v, p, record){ +function nameAndFrequency(v, p, record) { var name = record.data['sterilizerName']; - if(name!="" && (v!="" && v!=null)){ - return record.data['sterilizerName']+ ",第" + v+"炉"; + if (name != "" && (v != "" && v != null)) { + return record.data['sterilizerName'] + ",第" + v + "炉"; } return ""; } -Ext.onReady(function() { +Ext.onReady(function () { var columns = new Array(); columns.push( - {header : "器械包名称",width : 180,dataIndex : 'tousseName'}, - {header : "条码",width : 70,dataIndex : 'barcode'}, - {header : "状态",width : 80,dataIndex : 'status'}, - {header : "使用次数",width : 80,dataIndex : 'useAmount'}, - {header : "打印时间",width : 150,dataIndex : 'printDate',renderer : myDateFormatBySecond}, - {header : "第一次回收时间",width : 150,dataIndex : 'firstRecyclingTime',renderer : myDateFormatBySecond} + { header: "器械包名称", width: 180, dataIndex: 'tousseName' }, + { header: "条码", width: 70, dataIndex: 'barcode' }, + { header: "状态", width: 80, dataIndex: 'status' }, + { header: "使用次数", width: 80, dataIndex: 'useAmount' }, + { header: "打印时间", width: 150, dataIndex: 'printDate', renderer: myDateFormatBySecond }, + { header: "第一次回收时间", width: 150, dataIndex: 'firstRecyclingTime', renderer: myDateFormatBySecond } ); - + var readerDetail = [ - {name : 'id'}, - {name : 'tousseName'}, - {name : 'barcode'}, - {name : 'status'}, - {name : 'useAmount'}, - {name : 'printDate'}, - {name : 'firstRecyclingTime'} + { name: 'id' }, + { name: 'tousseName' }, + { name: 'barcode' }, + { name: 'status' }, + { name: 'useAmount' }, + { name: 'printDate' }, + { name: 'firstRecyclingTime' } ]; var filters = new Ext.grid.GridFilters({ - filters : [ - {type : 'string',dataIndex : 'tousseName'}, - {type : 'string',dataIndex : 'barcode'}, - {type : 'string',dataIndex : 'status'}, - {type : 'string',dataIndex : 'printDate'}, - {type : 'date',dataIndex : 'firstRecyclingTime'} + filters: [ + { type: 'string', dataIndex: 'tousseName' }, + { type: 'string', dataIndex: 'barcode' }, + { type: 'string', dataIndex: 'status' }, + { type: 'string', dataIndex: 'printDate' }, + { type: 'date', dataIndex: 'firstRecyclingTime' } ] }); var dt = new Date(); - var v = dt.getMonth()+1; - if(v<10){ + var v = dt.getMonth() + 1; + if (v < 10) { v = "0" + v; } - - var tbar = [ - { - text : '废弃', - iconCls : 'Cancel', - hidden:SSTS_SystemWarning_TousseGoods_delete, - handler : function() { - var selectionModel = grid.getSelectionModel(); - var selections = []; - if(!selectionModel.hasSelection()){ - showResult("未选中任何记录!"); - return; - }else{ - selectionModel.each(function(row){ - selections.push(row.data.id); - }); - if(selections.length>0){ - var remark = showSelectTousseDiscardCauseWin(); - if(remark == undefined){ - return ''; - }else { - var loop = setInterval(function() { - if(remark.hidden) { - clearInterval(loop); - - var returnValue = remark.returnValue || ''; + var tbar = [{ + text: '废弃', + iconCls: 'Cancel', + hidden: SSTS_SystemWarning_TousseGoods_delete, + handler: function () { + var selectionModel = grid.getSelectionModel(); + var selections = []; + if (!selectionModel.hasSelection()) { + showResult("未选中任何记录!"); + return; + } else { + selectionModel.each(function (row) { + selections.push(row.data.id); + }); + if (selections.length > 0) { + var remark = showSelectTousseDiscardCauseWin(); - if(returnValue == ''){ - return ''; - } + if (remark == undefined) { + return ''; + } else { + var loop = setInterval(function () { + if (remark.hidden) { + clearInterval(loop); - var ids = selections.join(';'); - Ext.Ajax.request({ - url : WWWROOT + '/disinfectSystem/tousseInstanceAction!deleteTousseGood.do', - params : {ids : ids,reason:returnValue}, - success : function(response, options) { - showResult("废弃成功!"); - grid.dwrReload(); - }, - failure : function(response, options) {} - }); - } - },500); - } + var returnValue = remark.returnValue || ''; + + if (returnValue == '') { + return ''; + } + + var ids = selections.join(';'); + Ext.Ajax.request({ + url: WWWROOT + '/disinfectSystem/tousseInstanceAction!deleteTousseGood.do', + params: { ids: ids, reason: returnValue }, + success: function (response, options) { + showResult("废弃成功!"); + grid.dwrReload(); + }, + failure: function (response, options) { } + }); + } + }, 500); } } } - }, - { - text : '导出', - iconCls : 'btn_ext_download', - handler : function() { - var barcodeSearch = $Id('barcodeSearch').value; - var sterilizationDate = $Id('sterilizationDate').value; - var sterilizationEndDate = $Id('sterilizationEndDate').value; - var sterilizerName = $Id('sterilizerName').value; - var frequency = $Id('frequency').value; - var tousseName = $Id('tousseName').value; - location.href = WWWROOT - + "/disinfectSystem/baseData/tousseDefinitionAction!exportTousseInstanceInfo.do?barcode=" - + barcodeSearch + "&sterilizationDate=" - + sterilizationDate - + "&sterilizationEndDate=" - + sterilizationEndDate + "&sterilizerName=" - + sterilizerName + "&frequency=" - + frequency + "&tousseName=" - + tousseName; - } - }, - { - text : '打印', -// iconCls : 'Cancel', - hidden:SSTS_HistoryPacking_Update, - handler : function() { - var selectionModel = grid.getSelectionModel(); - var selections = []; - if(!selectionModel.hasSelection()){ - showResult("未选中任何记录!"); - return; - }else{ - selectionModel.each(function(row){ - selections.push(row.data.id); + } + }, + { + text: '导出', + iconCls: 'btn_ext_download', + handler: function () { + var barcodeSearch = $Id('barcodeSearch').value; + var sterilizationDate = $Id('sterilizationDate').value; + var sterilizationEndDate = $Id('sterilizationEndDate').value; + var sterilizerName = $Id('sterilizerName').value; + var frequency = $Id('frequency').value; + var tousseName = $Id('tousseName').value; + location.href = WWWROOT + + "/disinfectSystem/baseData/tousseDefinitionAction!exportTousseInstanceInfo.do?barcode=" + + barcodeSearch + "&sterilizationDate=" + + sterilizationDate + + "&sterilizationEndDate=" + + sterilizationEndDate + "&sterilizerName=" + + sterilizerName + "&frequency=" + + frequency + "&tousseName=" + + tousseName; + } + }, + { + text: '打印', + // iconCls : 'Cancel', + hidden: SSTS_HistoryPacking_Update, + handler: function () { + var selectionModel = grid.getSelectionModel(); + var selections = []; + if (!selectionModel.hasSelection()) { + showResult("未选中任何记录!"); + return; + } else { + selectionModel.each(function (row) { + selections.push(row.data.id); + }); + if (selections.length > 0) { + var ids = selections.join(','); + Ext.MessageBox.wait('正在请求数据,请稍候……', '请等待'); + Ext.Ajax.request({ + url: WWWROOT + '/disinfectSystem/packingAction!getTousseInstanceByIdsForPrint.do', + params: { ids: ids }, + success: function (response, options) { + // showResult("废弃成功!"); + // grid.dwrReload(); + hideMessageBox(false); + var tousseesToPrint = Ext.decode(response.responseText); + doPrintLabels(tousseesToPrint); + }, + failure: function (response, options) { + hideMessageBox(false); + } }); - if(selections.length>0){ - var ids = selections.join(','); - Ext.MessageBox.wait('正在请求数据,请稍候……', '请等待'); - Ext.Ajax.request({ - url : WWWROOT + '/disinfectSystem/packingAction!getTousseInstanceByIdsForPrint.do', - params : {ids : ids}, - success : function(response, options) { -// showResult("废弃成功!"); -// grid.dwrReload(); - hideMessageBox(false); - var tousseesToPrint = Ext.decode(response.responseText); - doPrintLabels(tousseesToPrint); - }, - failure : function(response, options) { - hideMessageBox(false); - } - }); - } } } - }]; + } + }]; - grid = new Ext.ux.ForgonPageGrid({ - id : 'tousseInstanceGrid', - pageSize : 20, - renderTo : 'gridDiv', - showLoadMask : true, -// tbar : tbar, - defaultSortField : 'tousseName', - defaultSortDirection : 'ASC', - isCheckboxSelectionModel : true, - rememberSelected : false, - isShowSearchField : false, - columns : columns, - plugins : filters, - frame : false, - border : false - }, - readerDetail, + id: 'tousseInstanceGrid', + pageSize: 20, + renderTo: 'gridDiv', + showLoadMask: true, + // tbar : tbar, + defaultSortField: 'tousseName', + defaultSortDirection: 'ASC', + isCheckboxSelectionModel: true, + rememberSelected: false, + isShowSearchField: false, + columns: columns, + plugins: filters, + frame: false, + border: false + }, + readerDetail, IdCardInstanceTableManager.getIdCardInstanceTableList, null ); new Ext.Viewport({ - layout : 'border', - items : [{ - region : 'center', - margins : '0 0 0 0', - layout : 'fit', - items : grid + layout: 'border', + items: [{ + region: 'center', + margins: '0 0 0 0', + layout: 'fit', + items: grid }] }); });