Index: ssts-web/src/main/webapp/disinfectsystem/assestManagement/expensiveGoods/expensiveGoodsWarningView.jsp =================================================================== diff -u -r22159 -r22375 --- ssts-web/src/main/webapp/disinfectsystem/assestManagement/expensiveGoods/expensiveGoodsWarningView.jsp (.../expensiveGoodsWarningView.jsp) (revision 22159) +++ ssts-web/src/main/webapp/disinfectsystem/assestManagement/expensiveGoods/expensiveGoodsWarningView.jsp (.../expensiveGoodsWarningView.jsp) (revision 22375) @@ -1,6 +1,6 @@ <%@ page contentType="text/html; charset=UTF-8"%> <%@ include file="/common/taglibs.jsp"%> -<%@page import="com.forgon.disinfectsystem.entity.assestmanagement.DisposableGoods,com.forgon.Constants"%> +<%@page import="com.forgon.Constants"%> @@ -10,22 +10,30 @@ <%@ include file="/common/includeExtJsAndCss.jsp"%> + + +<%-- 引入ExtJs4.2.5框架 --%> +<%@include file="/common/include_ForgonGrid4.2.5_css.jsp"%> +<%@include file="/common/include_ForgonGrid4.2.5_Js.jsp"%> +<%@include file="/common/include_UseForgonGrid4_Js.jsp"%> + + Index: ssts-web/src/main/webapp/disinfectsystem/assestManagement/expensiveGoods/expensiveGoodsWarningView.js =================================================================== diff -u -r22154 -r22375 --- ssts-web/src/main/webapp/disinfectsystem/assestManagement/expensiveGoods/expensiveGoodsWarningView.js (.../expensiveGoodsWarningView.js) (revision 22154) +++ ssts-web/src/main/webapp/disinfectsystem/assestManagement/expensiveGoods/expensiveGoodsWarningView.js (.../expensiveGoodsWarningView.js) (revision 22375) @@ -3,891 +3,7 @@ var root; var formObj; var formWindow; -var autoFillExternalCodeOfDisposableGoods = false; -var SUPPLIER_TYPE_SUPPLIER = '生产厂家'; -var supplierStore = null; -var selectedRow = null; -var registrationCertificationBatchNumStore = null; -var batchRecord = null; -var expensiveGoodsModelStoreRecord = null; -var selCertification = null; -var expensiveGoodsModelColumnModel = null; - -//高值耗材型号store -var expensiveGoodsModelStore = new top.Ext.data.Store({ - reader : new Ext.data.JsonReader({ - fields : [ - {name : 'id'}, - {name : 'expensiveGoodsModel'}, - {name : 'expensiveGoodsModelDescription'}, - {name : 'expensiveGoodsModelSurfaceStatus'} - ] - }) -}); - - - -//根据厂家id来查询对应的注册证号,并填入 -function fillCertificationsByExpensiveGoodsSupplierId(expensiveGoodsSupplierId){ - if(isUndefinedOrNullOrEmpty(expensiveGoodsSupplierId)) - return false; - registrationCertificationBatchNumStore.removeAll(); - ExpensiveGoodsTableManager.getCertificationsByExpensiveGoodsSupplierId(expensiveGoodsSupplierId, - function(batchesStr){ - var batches = top.Ext4.JSON.decode(batchesStr); - if(batches.length > 0){ - setBatchNumbers(batches,true); - } - }); -} - -//根据高值耗材id来查询对应的型号,并填入 -function fillModelByExpensiveGoodsId(expensiveGoodsModelList){ - if(isUndefinedOrNullOrEmpty(expensiveGoodsModelList)) - return false; - expensiveGoodsModelStore.removeAll(); -// var Models = top.Ext4.JSON.decode(expensiveGoodsModelList); - for(var i = 0;i 0){ -// setBatchNumbers(batches,true); -// } -// }); -} - -function addExpensiveGoods(id) { - expensiveGoodsModelStore.removeAll(); - autoFillExternalCodeOfDisposableGoods = getBoolValueFromJs('sstsConfig.autoFillExternalCodeOfDisposableGoods',autoFillExternalCodeOfDisposableGoods); - var dType = document.getElementById("parm_s_type").value; - var diposableGooodsStore = new Ext.data.SimpleStore({ - fields : [ 'typeName' ], - url : WWWROOT + '/disinfectSystem/expensiveGoodsAction!getExpensiveGoodsType.do' - }); - - - function newRow(){ - var n = top.Ext.getCmp('expensiveGoodsModelGirdId').getStore().getCount();// 获得总行数 - var p = new expensiveGoodsModelStoreRecord({ - expensiveGoodsModel : '', - expensiveGoodsModelDescription : '', - expensiveGoodsModelSurfaceStatus : '' - }); - top.Ext.getCmp('expensiveGoodsModelGirdId').stopEditing();// 停止编辑 - expensiveGoodsModelStore.add(p);// 插入到最后一行 - top.Ext.getCmp('expensiveGoodsModelGirdId').getSelectionModel().selectLastRow(); - top.Ext.getCmp('expensiveGoodsModelGirdId').startEditing(n, 0);// 开始编辑0单元格 - } - - - expensiveGoodsModelColumnModel = new top.Ext.grid.ColumnModel([ - { - header : '型号规格', - dataIndex : 'expensiveGoodsModel', - width : 60, - editor : new top.Ext.form.TextField({ - allowBlank : false, - listeners : { - change : function(textField, newValue, oldValue) { -// var rowIndex = top.Ext.getCmp('expensiveGoodsModelGirdId').getStore().getCount();//grid的行数 -// var configStore = top.Ext.getCmp('expensiveGoodsModelGirdId').getStore(); -// var judge = []; -// judge.push(newValue); -//// for(var i =0 ;i < rowIndex ; i++ ){ -//// var electRecord = configStore.getAt(i); -//// var certification = configStore.getAt(i).data.expensiveGoodsModel; -//// var type = configStore.getAt(i).data.type; -//// if(certification != ''){ -//// if(judge.contains(newValue)){ -//// showResult('已包含相同型号:'+ newValue +',不可重复添加!'); -//// judge.splice(0,judge.length); //数组清空 -//// textField.setValue(oldValue); -//// return false; -//// }else{ -//// judge.push(electRecord.get('expensiveGoodsModel')); -//// } -//// } -//// } -//// textField.setValue(newValue); -// var num3 = selectedRow; -// -// configStore.each(function(record){ -// var certification = record.data.expensiveGoodsModel; -// var num1 = textField.getPosition()[0]; -// var num2 = configStore.indexOf(record); -// if(certification != ''){ -// if(judge.contains(newValue) && num2 != selectedRow){ -// showResult('已包含相同型号:'+ newValue +',不可重复添加!'); -// judge.splice(0,judge.length); //数组清空 -// textField.setValue(oldValue); -// return false; -// }else{ -// judge.push(certification); -// } -// } -// }); - } - } - }) - },{ - header : '说明', - dataIndex : 'expensiveGoodsModelDescription', - width : 60, - editor : new top.Ext.form.TextField() - },{ - header : '表面状态', - dataIndex : 'expensiveGoodsModelSurfaceStatus', - width : 60, - editor : new top.Ext.form.TextField() - } - ]); - - - - //能否作为器械包材料 - var isPartOfTousseMaterialStore = new Ext.data.SimpleStore( { - fields : [ 'value'], - data : [[CONSTANT_YES],[CONSTANT_NO]] - }); - var goodsTypeStore = new Ext.data.SimpleStore( { - fields : [ 'value'], - data : [['普通物品'],['高值耗材']] - }); - - //能否被科室申请 - var isApplicationMaterialStore = new Ext.data.SimpleStore( { - fields : [ 'value'], - data : [[CONSTANT_YES],[CONSTANT_NO]] - }); - - //是否供应室物品 - var yesNoStore = new Ext.data.SimpleStore( { - fields : [ 'value'], - data : [[STR_YES],[STR_NO]] - }); - - - var inventoryGoodsStore = new Ext.data.SimpleStore({ - fields : [ 'value' ], - data : [ ['否' ], ['是' ]] - }); - - supplierStore = new Ext.data.Store({ - pageSize : 100, - proxy : new Ext.data.HttpProxy({ - url : WWWROOT + '/disinfectSystem/baseData/supplierAction!getExpensiveGoodsSupplierData.do?supplierType='+encodeURI(SUPPLIER_TYPE_SUPPLIER), - method : 'POST' - }), - reader : new Ext.data.JsonReader({ - totalProperty : 'totalCount', - root : 'data' - }, [ - {name : 'id',mapping : 'id'}, - {name : 'name',mapping : 'name'} - ]) - }); - - //注册证store - registrationCertificationBatchNumStore = new Ext.data.Store({ - reader : new Ext.data.JsonReader({ - fields : [ - {name : 'id'}, - {name : 'name'}, - {name : 'barcode'}, - {name : 'certification'} - ] - }) - }); - - - expensiveGoodsModelStoreRecord = Ext.data.Record.create([ - {name : 'id'}, - {name : 'expensiveGoodsModel'}, - {name : 'expensiveGoodsModelDescription'}, - {name : 'expensiveGoodsModelSurfaceStatus'} - ]); - -// var modelrecord = new expensiveGoodsModelStoreRecord({id: 1,expensiveGoodsModel: 'name1',expensiveGoodsModelDescription:'description1',expensiveGoodsModelSurfaceStatus:'status1'}); -// var modelrecord1 = new expensiveGoodsModelStoreRecord({id: 1,expensiveGoodsModel: 'name2',expensiveGoodsModelDescription:'description2',expensiveGoodsModelSurfaceStatus:'status2'}); -// var modelrecord2 = new expensiveGoodsModelStoreRecord({id: 1,expensiveGoodsModel: 'name3',expensiveGoodsModelDescription:'description3',expensiveGoodsModelSurfaceStatus:'status3'}); -// expensiveGoodsModelStore.add(modelrecord); -// expensiveGoodsModelStore.add(modelrecord1); -// expensiveGoodsModelStore.add(modelrecord2); - - batchRecord = Ext.data.Record.create([ - {name : 'id'}, - {name : 'certification'} - ]); - - - formObj = new top.Ext.FormPanel( { - id : 'expensiveGoodsForm', - frame : true, - labelAlign:'right', - labelSeparator : ':', - bodyStyle : 'padding:5px 5px 0px 5px', -// autoHeight : true, - height : 350, -// autoScroll : true, - items:[{ - layout : 'column', - items : [{ - columnWidth : 0.3, - layout : 'form', - labelWidth : 70, - items : [{ - xtype : 'hidden', - name : 'id', - id : 'id' - },{ - xtype : 'hidden', - name : 'certificationId', - id : 'certificationId' - },{ - xtype : 'hidden', - name : 'originalFormParams', - id : 'originalFormParams' - },{ - xtype : 'hidden', - name : 'originalGoodsType', - id : 'originalGoodsType' - },{ - xtype : 'hidden', - name : 'orginalName', - id : 'orginalName' - },{ - xtype : 'hidden', - name : 'orginalSpecification', - id : 'orginalSpecification' - },{ - xtype : 'hidden', - name : 'orginalApplicationSpecification', - id : 'orginalApplicationSpecification' - },{ - xtype : 'hidden', - name : 'items', - id : 'items' - },{ - xtype : 'hidden', - name : 'expensiveGoodsSupplierId', - id : 'expensiveGoodsSupplierId' - },{ - xtype : 'hidden', - name : 'notInventoryDeptCode', - id : 'notInventoryDeptCode' - },{ - columnWidth : 1, - layout : 'form', - labelWidth : 110, - items : [{ - xtype : 'textfield', - fieldLabel : '名称', - maxLength : '41', - id : 'name', - name : 'name', - allowBlank : false, - anchor : '95%', - listeners:{ - change:function(field,nV,oV){ - var value = nV.trim(); - field.setValue(value); - } - } - }] - },{ - layout:'column', - items:[{ -// hidden: !sstsConfig.expensiveGoodsInventorySerialNumber, - columnWidth : 1, - layout : 'form', - border:true, - labelWidth :110, - items : [{ - xtype : 'numberfield', - fieldLabel : '物资编码', - maxLength : '16', -// width : 380, - id : 'inventorySerialNumber', - allowBlank : true, - anchor : '95%' - }] - },{ - hidden: !sstsConfig.expensiveGoodsInventorySerialNumber||!sstsConfig.showHrpDiposableGoodByInventorySerialNumber, - columnWidth : .13, - layout : 'form', - border:true, - width: 10, - items : [{//根据物资编码查找hrp高值耗材信息 - xtype: 'button', - iconCls: 'icon_search', - handler: getHrpDiposableGood - }] - } - ] - },{ - columnWidth : 1, - layout : 'form', - labelWidth : 110, - items : [{ - xtype : 'textfield', - fieldLabel : '规格', - maxLength : '41', - id : 'specification', - name : 'specification', - allowBlank : true, - anchor : '95%' - }] - },{ - columnWidth : 1, - layout : 'form', - labelWidth : 110, - items : [{ - xtype : 'textfield', - fieldLabel : '包装规格', - maxLength : '41', - id : 'packageSpec', - name : 'packageSpec', - allowBlank : true, - anchor : '95%' - }] - },{ - columnWidth : 1, - layout : 'form', - labelWidth : 110, - items : [{ - xtype : 'combo', - fieldLabel : "类型", - valueField : 'typeName', - displayField : 'typeName', - store : diposableGooodsStore, - forceSelection : true, - editable : false, - triggerAction : 'all', - name : "type", - id : "type", - value : dType, - anchor : '95%', - listeners : { - select : function(combo , record , index){ - - } - } - }] - },{ - columnWidth : 1, - layout : 'form', - labelWidth : 110, - items : [{ - xtype : 'combo', - fieldLabel : "类别", - valueField : 'name', - displayField : 'name', - store : new Ext.data.SimpleStore({ - data:[['一类'],['二类'],['三类']], - fields:['name'] - }), - mode : 'local', - forceSelection : true, - editable : false, - triggerAction : 'all', - name : "grade", - id : "grade", - anchor : '95%' - }] - },{ - columnWidth : 1, - layout : 'form', - labelWidth : 110, - items : [{ - xtype : 'combo', - fieldLabel : "能否配包", - valueField : 'value', - displayField : 'value', - value: '能', - store : isPartOfTousseMaterialStore, - forceSelection : true, - allowBlank : false, - mode : 'local', - triggerAction : 'all', - name : "isPartOfTousseMaterial", - id : "isPartOfTousseMaterial", - anchor : '95%' - }] - }, { - columnWidth : 1, - layout : 'form', - labelWidth : 110, - items : [{ - xtype : 'combo', - fieldLabel : '能否申请', - valueField : 'value', - displayField : 'value', - value: '能', - store : isApplicationMaterialStore, - forceSelection : true, - allowBlank : false, - mode : 'local', - triggerAction : 'all', - name : "isApplicationMaterial", - id : "isApplicationMaterial", - anchor : '95%' - }] - },{ - columnWidth : 1, - layout : 'form', - labelWidth : 110, - items : [{ - xtype : 'combo', - fieldLabel : '消毒供应中心物品', - valueField : 'value', - displayField : 'value', - value: '是', - store : yesNoStore, - forceSelection : true, - allowBlank : false, - mode : 'local', - triggerAction : 'all', - name : "isSupplyRoomGoods", - id : "isSupplyRoomGoods", - anchor : '95%' - }] - },{ - columnWidth : 1, - layout : 'form', - labelWidth : 110, - items : [{ - xtype : 'combo', - fieldLabel : '包外标签是否打印', - valueField : 'value', - displayField : 'value', - value: '是', - store : yesNoStore, - forceSelection : true, - allowBlank : false, - mode : 'local', - triggerAction : 'all', - name : "printInLabel", - id : "printInLabel", - anchor : '95%' - }] - },{ - columnWidth : 1, - layout : 'form', - labelWidth : 110, - items : [{ - xtype : 'numberfield', - fieldLabel : '最小库存', - allowDecimals : false, - maxLength : '16', - id : 'minStorage', - name : 'minStorage', - anchor : '95%' - }] - }, { - columnWidth : 1, - layout : 'form', - labelWidth : 110, - items : [{ - xtype : 'numberfield', - fieldLabel : '最大库存', - allowDecimals : false, - maxLength : '16', - id : 'maxStorage', - name : 'maxStorage', - anchor : '95%' - }] - },{ - columnWidth : 1, - layout : 'form', - labelWidth : 110, - items : [{ - xtype : 'numberfield', - fieldLabel : '总数', - maxLength : '16', - id : 'amount', - name : 'amount', - allowBlank : true, - anchor : '95%' - }] - },{ - columnWidth: 1, - layout : 'form', - labelWidth : 110, - items : [{ - xtype : 'combo', - id : 'expensiveGoodsSupplier', - name : 'expensiveGoodsSupplier', - fieldLabel : '厂家', - queryParam : 'supplierName', - minChars : 0, - valueField : 'id', - displayField : 'name', - pageSize : 100, -// listConfig: {width: 25}, - store : supplierStore, - forceSelection : true, - lazyInit : true, - triggerAction : 'all', - hideTrigger : true, - emptyText : '', - typeAhead : false, - allowBlank : false, - anchor : '95%', - listeners : { - select : function(combo, record, index) { - top.Ext.getCmp("certification").setValue(''); - var expensiveGoodsSupplierId = record.data.id+''; - fillCertificationsByExpensiveGoodsSupplierId(expensiveGoodsSupplierId); - }, - specialkey : function(field, ee) { - if (ee.getKey() == Ext.EventObject.ENTER) { - top.Ext.getCmp('batchNumber').focus(); - } - } - } - }] - }] - },{ - columnWidth : 0.3, -// title: 'Hrp高值耗材数据', - id :'hrpContrastDefinition', -// hidden:true, - height : 350, - width : 500, - layout : 'column', -// xtype: 'fieldset', - items: [{ - columnWidth : 1, - layout : 'form', - labelWidth : 110, - items : [{ - xtype : 'textfield', - fieldLabel : '拼音码', - id : 'spelling', - name : 'spelling', - readOnly : true, - allowBlank : true, - anchor : '95%' - }] - },{ - columnWidth : 1, - layout : 'form', - labelWidth : 110, - items : [{ - xtype : 'textfield', - fieldLabel : '五笔码', - id : 'wbCode', - name : 'wbCode', - readOnly : true, - allowBlank : true, - anchor : '95%' - }] - }, { - columnWidth : 1, - layout : 'form', - labelWidth : 110, - items : [{ - xtype : 'textfield', - fieldLabel : '收费码', - maxLength : '16', - id : 'chargeCode', - name : 'chargeCode', - allowBlank : true, - anchor : '95%' - }] - }, { - columnWidth : 1, - layout : 'form', - labelWidth : 110, - items : [{ - xtype : 'textfield', - fieldLabel : '平台代码', - maxLength : '16', - id : 'platformCode', - name : 'platformCode', - allowBlank : true, - anchor : '95%' - }] - }, { - columnWidth : 1, - layout : 'form', - labelWidth : 110, - items : [{ - xtype : 'textfield', - fieldLabel : '外部编码', - maxLength : '16', - id : 'externalCode', - name : 'externalCode', - allowBlank : true, - anchor : '95%' - }] - },{ - columnWidth : 1, - layout : 'form', - labelWidth : 110, - items : [{ - xtype : 'numberfield', - fieldLabel : '参考价', - maxLength : '16', - id : 'referencePrice', - name : 'referencePrice', - allowBlank : false, - allowNegative : false, - anchor : '95%' - }] - },{ - columnWidth : 1, - layout : 'form', - labelWidth : 110, - items : [{ - xtype : 'numberfield', - fieldLabel : '最小申请数量', - maxLength : '16', - id : 'minApplyAmount', - name : 'minApplyAmount', - allowBlank : true, - anchor : '95%' - }] - }, { - columnWidth : 1, - layout : 'form', - labelWidth : 110, - items : [{ - xtype : 'numberfield', - fieldLabel : '最大申请数量', - maxLength : '16', - id : 'maxApplyAmount', - name : 'maxApplyAmount', - allowBlank : true, - anchor : '95%' - }] - },{ - columnWidth : 1, - layout : 'form', - labelWidth : 110, - items : [{ - xtype : 'textfield', - fieldLabel : '单位', - maxLength : '16', - id : 'unit', - name : 'unit', - allowBlank : true, - anchor : '95%' - }] - },{ - columnWidth : 1, - layout : 'form', - labelWidth : 110, - items : [{ - xtype : 'numberfield', - fieldLabel : '顺序号', - maxLength : '16', - id : 'sequence', - name : 'sequence', - allowDecimals : false, - allowBlank : true, - anchor : '95%' - }] - },{ - columnWidth : 1, - layout : 'form', - labelWidth : 110, - items : [{ - xtype : 'combo', - fieldLabel : '是否盘点', - id : 'isInventoryGoods', - name : 'isInventoryGoods', - width : 130, - valueField : 'value', - displayField : 'value', - store : inventoryGoodsStore, - forceSelection : true, - allowBlank: true, - mode : 'local', - editable : false, - triggerAction : 'all', - anchor : '95%' - }] - },{ - columnWidth : 1, - layout : 'form', - labelWidth : 110, - items : [{ - xtype : 'combo', - fieldLabel : '是否植入物', - valueField : 'value', - displayField : 'value', - value: '否', - store : yesNoStore, - forceSelection : true, - allowBlank : false, - mode : 'local', - triggerAction : 'all', - name : "isImplant", - id : "isImplant", - anchor : '95%' - }] - },{ - columnWidth : 1, - layout : 'column', - labelWidth : 0, - items : [{ - layout : 'form', - labelWidth : 110, - columnWidth : 1, - items : [{ - xtype : 'combo', - id : 'certification', - name : 'certification', - fieldLabel : '注册证', - valueField : 'certification', - displayField : 'certification', - store : registrationCertificationBatchNumStore, - editable : false, - forceSelection : false, - mode : 'local', - triggerAction : 'all', - typeAhead : false, - allowBlank : false, - anchor : '95%', - listeners : { - blur : function(thiz) {}, - select : function(combo, record, index) { - selCertification = { - id: record.data.id, - certification: record.data.certification - } - } - } - }] - } - ] - }] - } - ,{ - columnWidth : 0.4, - layout : 'column', - // labelWidth : 70, - items : [{ - id : 'expensiveGoodsModelGirdId', - columnWidth : 1, - height: 400, - frame : false, - xtype : 'editorgrid', - store : expensiveGoodsModelStore, - title : "型号列表", - viewConfig: {forceFit:true}, - selModel : new top.Ext.grid.RowSelectionModel({ - singleSelect : false - }), - colModel : expensiveGoodsModelColumnModel, - listeners : { - rowclick : function(grid,rowIndex){ - selectedRow = rowIndex; - } - }, - tbar : [{ - text : '新增', - width : 70 , - iconCls : 'btn_ext_add', - handler : function() { - newRow(); - } - }, { - text : '删除', - iconCls : 'btn_remove', - handler : function() { - var selectModel = top.Ext.getCmp('expensiveGoodsModelGirdId').getSelectionModel(); - var rows = selectModel.getSelections();// 返回值为 Record 数组 - if (rows.length == 0) { - showResult('最少选择一条信息,进行删除!'); - } else { - top.Ext.MessageBox.confirm('提示框', '您确定要进行该操作?', function(btn) { - if (btn == 'yes') { - if (rows) { - for ( var i = 0; i < rows.length; i++) { - expensiveGoodsModelStore.remove(rows[i]); - selectModel.selectPrevious(true); - } - } - } - }); - } - } - }] //tbar - }] - } - ] - - }], - buttons : [{ - id : 'saveBtn', - text : '保存', - handler : save - },{ - id : 'cancleBtn', - text : '取消', - handler : function() { - formWindow.close(); - } - }] - }); - - if($Id("parm_s_type").value != ""){ - top.Ext.getCmp("type").setValue($Id("parm_s_type").value); - } - - formWindow = new top.Ext.Window( { - id : 'expensiveGoodsWin', - layout : 'fit', - title : '高值耗材信息', - width : 1000, - // height : 620, - height : top.screen.height > 800 ? 420 : 420, - modal : true, - // autoHeight : true, - border : false, - plain : true, - items : [ formObj ] - }); - formWindow.show(); - diposableGooodsStore.load(); - // 如果类型不为空,并且配置为自动增加外部编码,那么获取下一个编码,并且填上 - if(!isUndefinedOrNullOrEmpty(dType) && - autoFillExternalCodeOfDisposableGoods){ - ExpensiveGoodsTableManager.getNextExternalCodeOfDisposableGoods(dType,function(externalCode){ - if(!isUndefinedOrNullOrEmpty(externalCode)){ - top.Ext.getCmp("externalCode").setValue(externalCode); - } - }); - } -} - -function onSelCertification(){ - if(selCertification == null){ - return; - } - top.Ext.getCmp('certificationId').setValue(selCertification.id); - top.Ext.getCmp('certification').setValue(selCertification.certification); -} -function setBatchNumbers(batches,fireSelect) { - for(var i = 0;imax){ - showResult('最小库存不能大于最大库存'); - top.Ext.getCmp('minStorage').focus(); - return false; - } - if(minApply > maxApply){ - showResult('最小申请数不能大于最大申请数'); - top.Ext.getCmp('minApplyAmount').focus(); - return false; - } - } - - this.disable(); - validateAndSubmit(); -} - function printBatchNum(barcodeStr){ if(barcodeStr!=null && barcodeStr.length > 0){ Ext.Msg.show({ @@ -1088,6 +79,7 @@ }); } } + function onStorageRecordDetail(grid){ var records = grid.getSelectionModel().getSelections(); if(records.length == 0){ @@ -1180,26 +172,9 @@ showResult("一次只能修改一个高值耗材!"); return false; } - id = records[0].data['id']; - addExpensiveGoods(id); - top.Ext.getCmp('expensiveGoodsForm').form.load({ - url : WWWROOT + '/disinfectSystem/expensiveGoodsAction!loadExpensiveGoods.do', - method : 'GET', - waitMsg : '正在加载数据,请稍候', - params : {id : id}, - success : function(form, action) { - var expensiveGoods = action.result.data; - top.Ext.getCmp("orginalName").setValue(expensiveGoods.name); - top.Ext.getCmp("orginalSpecification").setValue(expensiveGoods.specification); - var expensiveGoodsSupplierId = top.Ext.getCmp("expensiveGoodsSupplierId").getValue(); - fillCertificationsByExpensiveGoodsSupplierId(expensiveGoodsSupplierId); - fillModelByExpensiveGoodsId(expensiveGoods.expensiveGoodsModelLists); -// top.Ext.getCmp("registrationCertification").setValue(expensiveGoods.registrationCertification); -// top.Ext.getCmp("manufactor").setValue(expensiveGoods.expensiveGoodsSupplier); - }, - failure : function(form, action) { - } - }); + var expensiveGoodsId = records[0].data['id']; + var supplierId = records[0].data['expensiveGoodsSupplierId']; + onLoadExpensiveGoodsDefinitionWindow(expensiveGoodsId,supplierId); }; function reloadGrid(type){ @@ -1208,6 +183,7 @@ } function modify(){ + if(SSTS_ExpensiveGoods_Update_hide) return; loadFormData(grid); } @@ -1223,34 +199,34 @@ } //hrp高值耗材信息 -function getHrpDiposableGood(){ - var inventorySerialNumber = top.Ext.getCmp('inventorySerialNumber').getValue(); - if(!inventorySerialNumber){ - showResult("请填写物资编码"); - return false; - } - Ext.Ajax.request({ - url : WWWROOT + '/disinfectSystem/expensiveGoodsAction!getHrpDefinition.do', - params : {inventorySerialNumber : inventorySerialNumber}, - success : function(response, options){ - var obj = Ext.util.JSON.decode(response.responseText); - if(obj.success){ - var data = obj.data; - if (data) { - top.Ext.getCmp("hrpName").setValue(data.name); - top.Ext.getCmp("hrpSpecification").setValue(data.specification); - top.Ext.getCmp("hrpUnit").setValue(data.unit); - top.Ext.getCmp("hrpCost").setValue(data.cost); - top.Ext.getCmp("hrpContrastDefinition").show(); - } else { - showResult("没有该物资编码对应的hrp高值耗材信息"); - } - }else{ - showResult("后台异常,请联系系统管理!"); - } - } - }) -} +//function getHrpDiposableGood(){ +// var inventorySerialNumber = top.Ext.getCmp('inventorySerialNumber').getValue(); +// if(!inventorySerialNumber){ +// showResult("请填写物资编码"); +// return false; +// } +// Ext.Ajax.request({ +// url : WWWROOT + '/disinfectSystem/expensiveGoodsAction!getHrpDefinition.do', +// params : {inventorySerialNumber : inventorySerialNumber}, +// success : function(response, options){ +// var obj = Ext.util.JSON.decode(response.responseText); +// if(obj.success){ +// var data = obj.data; +// if (data) { +// top.Ext.getCmp("hrpName").setValue(data.name); +// top.Ext.getCmp("hrpSpecification").setValue(data.specification); +// top.Ext.getCmp("hrpUnit").setValue(data.unit); +// top.Ext.getCmp("hrpCost").setValue(data.cost); +// top.Ext.getCmp("hrpContrastDefinition").show(); +// } else { +// showResult("没有该物资编码对应的hrp高值耗材信息"); +// } +// }else{ +// showResult("后台异常,请联系系统管理!"); +// } +// } +// }) +//} Ext.onReady(function() { Ext.QuickTips.init(); @@ -1271,24 +247,31 @@ //********* 2、ForgonGrid *********** var columns = [ - {header : "编码",width : 60,dataIndex : 'externalCode'}, - {header : "名称",width : 150,dataIndex : 'name', renderer : rendeColor}, - {header : "规格",width : 100,dataIndex : 'specification'}, + {header : "名称",width : 260,dataIndex : 'name', renderer : rendeColor}, + {header : "生产厂家",width : 200,dataIndex : 'registrationCertification.expensiveGoodsSupplier.companyName'}, + {header : "注册证",width : 250,dataIndex : 'certification'}, +// {header : "规格",width : 100,dataIndex : 'specification'}, + {header : "单位",width : 50,dataIndex : 'unit'}, {header : "类别",width : 80,dataIndex : 'grade'}, - {header : "包装规格",width : 80,dataIndex : 'packageSpec'}, + {header : "类型",width : 80,dataIndex : 'type'}, +// {header : "包装规格",width : 80,dataIndex : 'packageSpec'}, {header : "参考价",width : 60,dataIndex : 'referencePrice'}, + {header : "是否植入物",width : 80,dataIndex : 'isImplant'}, + {header : "收费码",width : 60,dataIndex : 'chargeCode'}, + {header : "平台代码",width : 60,dataIndex : 'platformCode'}, + {header : "物资编码",width : 60,dataIndex : 'inventorySerialNumber'}, {header : "总数",width : 50,dataIndex : 'amount'}, - {header : "最小申请数量",width : 80,dataIndex : 'minApplyAmount'}, - {header : "最大申请数量",width : 80,dataIndex : 'maxApplyAmount'}, - {header : "单位",width : 50,dataIndex : 'unit'}, - {header : "注册证",width : 100,dataIndex : 'certification'}, - {header : "拼音码",width : 90,dataIndex : 'spelling'}, - {header : "五笔码",width : 90,dataIndex : 'wbCode'}, - {header : "能否作为器械包材料",width : 120,dataIndex : 'isPartOfTousseMaterial'}, - {header : "能否被科室申请",width : 100,dataIndex : 'isApplicationMaterial'}, - {header : "是否消毒供应中心领用物品",width : 100,dataIndex : 'isSupplyRoomGoods'}, + {header : "最大库存",width : 60,dataIndex : 'maxStorage'}, {header : "最小库存",width : 60,dataIndex : 'minStorage'}, - {id : 'operationRemark',header : "最大库存",width : 60,dataIndex : 'maxStorage'} + {header : "最大申请数量",width : 80,dataIndex : 'maxApplyAmount'}, + {header : "最小申请数量",width : 80,dataIndex : 'minApplyAmount'}, + {header : "拼音码",width : 150,dataIndex : 'spelling'}, + {header : "五笔码",width : 150,dataIndex : 'wbCode'}, +// {header : "能否作为器械包材料",width : 120,dataIndex : 'isPartOfTousseMaterial'}, +// {header : "能否被科室申请",width : 100,dataIndex : 'isApplicationMaterial'}, +// {header : "是否消毒供应中心领用物品",width : 100,dataIndex : 'isSupplyRoomGoods'}, + {id : 'autoExpandColumnId',header : "外部编码",width : 60,dataIndex : 'externalCode'} +// {id : 'operationRemark',header : "最大库存",width : 60,dataIndex : 'maxStorage'} ]; @@ -1298,8 +281,13 @@ {name : 'externalCode'}, {name : 'specification'}, {name : 'grade'}, - {name : 'packageSpec'}, + {name : 'type'}, +// {name : 'packageSpec'}, {name : 'amount'}, + {name : 'isImplant'}, + {name : 'chargeCode'}, + {name : 'platformCode'}, + {name : 'inventorySerialNumber'}, {name : 'minApplyAmount'}, {name : 'maxApplyAmount'}, {name : 'unit'}, @@ -1311,6 +299,8 @@ {name : 'isPartOfTousseMaterial'}, {name : 'referencePrice'}, {name : 'isApplicationMaterial'}, + {name : "registrationCertification.certification"}, + {name : "registrationCertification.expensiveGoodsSupplier.companyName"}, {name : 'isSupplyRoomGoods'} ]; @@ -1336,22 +326,22 @@ var tbar = [ { text : '添加', -// hidden : SSTS_ExpensiveGoods_Create, + hidden : SSTS_ExpensiveGoods_Create_hide, iconCls : 'btn_ext_application_add', handler : function() { - addExpensiveGoods(0); + onLoadExpensiveGoodsDefinitionWindow(0); } }, '-', { text : '修改', -// hidden : SSTS_ExpensiveGoods_Update, + hidden : SSTS_ExpensiveGoods_Update_hide, iconCls : 'btn_ext_application_edit', id : 'editTbar', handler : function() { loadFormData(grid); } }, '-', { text : '删除', -// hidden : SSTS_ExpensiveGoods_Delete, + hidden : SSTS_ExpensiveGoods_Delete_hide, iconCls : 'btn_ext_application_del', handler : function() { deleteExpensiveGoods(grid); @@ -1363,73 +353,32 @@ handler : function(){ onStorageRecordDetail(grid); } - }, '-' , { + },'-', { text : '打印高值耗材', hidden: true, iconCls : 'icon_print', handler : function(){ printExpensiveDisposableGoodsBarcode(grid); } - }/* - , '-' , { - //用于程序员调试 - text : '更新旧数据', - hidden : false, - handler : function() { - ExpensiveGoodsTableManager.updateOldData(function(msg){showResult(msg);}); - } - }, '-' , { - //将属于供应室领用的高值耗材进行分类 - text : '分类供应室领用类型', - hadden : false, - handler : function() { - ExpensiveGoodsTableManager.updateSupplyRoomExpensiveGoodsType(function(msg){showResult('更新成功,请刷新页面')}); - } } - , '-' , { - text : '导出高值耗材库存', - handler : function() { - window.location.href = WWWROOT+"/disinfectsystem/reportforms/expensiveGoodsStorageReportExportForm.jsp"; - } - }, '-' , { - text : '导出物资收发存汇总', - handler : function() { - window.location.href = WWWROOT+"/disinfectsystem/reportforms/expensiveGoodsPriceStatisticsReportExportForm.jsp"; - } - }, '-' , { - //用于程序员调试 - text : '更新旧数据', - hidden : false, - handler : function() { - ExpensiveGoodsTableManager.updateOldData(function(msg){showResult(msg);}); - } - }, '-', { - text : '导入高值耗材库存EXCEL', - hidden : false, - handler : function() { - location.href = WWWROOT - + "/disinfectsystem/basedatamanager/importbasedata/amendExpensiveGoodsStorage.mhtml"; - } - } - */ ]; grid = new Ext.ux.ForgonPageGrid( { tbar : tbar, pageSize : 20, - defaultSortField : 'externalCode', - title : '高值耗材预警列表', - defaultSortDirection : 'ASC', + defaultSortField : 'id', + title : '高值耗材告警列表', + defaultSortDirection : 'DESC', isCheckboxSelectionModel : true, rememberSelected : false, isShowSearchField : true, plugins: filters, columns : columns, - autoExpandColumn : 'operationRemark', + autoExpandColumn : 'autoExpandColumnId', renderTo : 'gridDiv', frame : false }, readerDetail, - ExpensiveGoodsTableManager.findExpensiveGoodsMinAndMaxStockTableList, + ExpensiveGoodsTableManager.findExpensiveGoodsMinAndMaxStockTableList, null ); Index: ssts-web/src/main/webapp/disinfectsystem/assestManagement/expensiveGoods/expensiveGoodsWarningForm.js =================================================================== diff -u --- ssts-web/src/main/webapp/disinfectsystem/assestManagement/expensiveGoods/expensiveGoodsWarningForm.js (revision 0) +++ ssts-web/src/main/webapp/disinfectsystem/assestManagement/expensiveGoods/expensiveGoodsWarningForm.js (revision 22375) @@ -0,0 +1,888 @@ +var windowObj = null; +var formObj = null; +var expensiveGoodsModelGridObj = null; +var expensiveGoodsSupplierGridObj = null; +var SUPPLIER_TYPE_SUPPLIER = '生产厂家'; +var hiddenResetButton = true; +var oldSelectSupplierId = null; +var newSelectSupplierId = null; + +function changeDateBackground(component,date){ + var color = getDateColor(date); + if(color != ''){ + component.inputEl.removeCls('fieldReadOnlyNoRemoveAndTop'); + component.setFieldStyle("background-color: '#FF7575'; background-image: none;border: 0;"); + }else{ + component.inputEl.addCls('fieldReadOnlyNoRemoveAndTop'); + } +} + +function checkDate(v){ + var date = new Date(); + var currentDate = ""; + currentDate = date.getFullYear()+"-"; + currentDate += (date.getMonth()+1)+"-"; + currentDate += date.getDate(); + var color = ''; + if(!compareDate(myDateFormat(v),currentDate)){ + color = "#FF7575"; + } + if("" != v){ + return "

" + myDateFormat(v) + "

"; + }else{ + return ''; + } +} +function getDateColor(myDate){ + if(isUndefinedOrNullOrEmpty(myDate)) return ''; + var date = new Date(); + var currentDate = ""; + currentDate = date.getFullYear()+"-"; + currentDate += (date.getMonth()+1)+"-"; + currentDate += date.getDate(); + var color = ''; + if(!compareDate(myDate,currentDate)){ + color = "#FF7575"; + } + return color; +} + +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 { + return false; + } +} + +//新添加一个型号 +var newRow = function(){ + var n = expensiveGoodsModelStore.getCount();// 获得总行数 + expensiveGoodsModelStore.add({'model':'','description':'','surfaceStatus':''}); + expensiveGoodsModelGridObj.getPlugin('firstCellEditor').startEditByPosition({ + row : n, + column : 0 + }); +} + +//通过生产厂家id来查询注册证store +var loadCertificationStoreByExpensiveGoodsSupplierId = function(id){ + if(isUndefinedOrNullOrEmpty(id)){ + return ; + } + registrationCertificationStore.load({ + params: { + id: id + }, + callback : function(){ + if(oldSelectSupplierId != newSelectSupplierId){ + if(registrationCertificationStore.count() == 1){ + top.Ext4.getCmp("certification").setValue(registrationCertificationStore.first().data.certification); + top.Ext4.getCmp("certificationId").setValue(registrationCertificationStore.first().data.id); + top.Ext4.getCmp("registrationCertificationValidityTime").setValue(registrationCertificationStore.first().data.validityTime); + + changeDateBackground(top.Ext4.getCmp("registrationCertificationValidityTime"),registrationCertificationStore.first().data.validityTime); + }else{ + top.Ext4.getCmp("certification").setValue(''); + top.Ext4.getCmp("registrationCertificationValidityTime").setValue(''); + top.Ext4.getCmp("certificationId").setValue(''); + top.Ext4.getCmp("registrationCertificationValidityTime").inputEl.addCls('fieldReadOnlyNoRemoveAndTop'); + } + } + } + }); +} + +//通过后台查询的数据,填充型号store +var fillexpensiveGoodsModelGridStore = function(expensiveGoodsModelList){ + if(isUndefinedOrNullOrEmpty(expensiveGoodsModelList)) + return false; + expensiveGoodsModelStore.removeAll(); + for(var i = 0;imax){ + showResult('最小库存不能大于最大库存'); + top.Ext4.getCmp('minStorage').focus(); + return false; + } + if(minApply > maxApply){ + showResult('最小申请数不能大于最大申请数'); + top.Ext4.getCmp('minApplyAmount').focus(); + return false; + } + } + + var hasEmptyModel = false; + expensiveGoodsModelStore.each(function(record){ + if(record.data.model == ''){ + hasEmptyModel = true; + return false; + } + }); + if(hasEmptyModel){ + showResult("高值耗材型号规格不能为空!"); + return false; + } + + var orginalName = top.Ext4.getCmp("orginalName").getValue(); + var name = top.Ext4.getCmp("name").getValue(); + var msg = ''; + var id = top.Ext4.getCmp('id').getValue(); + + if(!isUndefinedOrNullOrEmpty(id)){ + if(!stringLooksEquals(orginalName,name)){ + msg = "是否确定修改高值耗材名称?" + } + } + if(msg == ''){ + saveAndSubmit(); + return ; + } + + top.Ext4.Msg.show({ + title : "请确认1", + msg : msg, + buttons : Ext4.Msg.YESNOCANCEL, + icon: Ext4.Msg.QUESTION, + fn: function(btn) { + if (btn === 'yes') { + saveAndSubmit(); + } + }, + model : true + }); +} + +//保存 +var save = function(){ + validateForm(); +} +var saveAndSubmit = function(){ + top.Ext4.getCmp('saveBtn').disable(); + + var modelArray=new Array(); + expensiveGoodsModelStore.each(function(record) { + modelArray.push(record.data); + }); + + formObj.submit({ + url : WWWROOT + '/disinfectSystem/expensiveGoodsAction!saveExpensiveGoods.do', + method : 'post', + params : { expensiveGoodsModelLists:top.Ext4.JSON.encode(modelArray), + supplierName:top.Ext4.getCmp('expensiveGoodsSupplier').getRawValue()}, + success: function(form, action) { + var result = Ext4.decode(action.response.responseText); + if(isUndefinedOrNullOrEmpty(result.errorMessage)){ + showResult('保存成功'); + windowObj.close(); + grid.dwrReload(); + }else{ + showResult('保存出错, ' + result.errorMessage); + top.Ext4.getCmp('saveBtn').enable(); + } + }, + failure : function(form, action) { + showResult('保存出错'); + top.Ext4.getCmp('saveBtn').enable(); + } + }); +} + +//生产厂家的store +var manufacturerStore = Ext4.create('Ext4.data.Store',{ + autoLoad : true, + pageSize : 20, + fields : [{name : 'name'}, + {name : 'id'}, + {name : 'productionCertificate'}, + {name : 'productionValidityTime'}, + {name : 'businessLicense'}, + {name : 'licenseValidityTime'}], + proxy : { + type : 'ajax', + url : WWWROOT + '/disinfectSystem/baseData/supplierAction!getExpensiveGoodsSupplierData.do?supplierType='+encodeURI(SUPPLIER_TYPE_SUPPLIER), + reader : { + type : 'json', + root : 'data' + } + } +}); + +//供应商的Store +var supplierStore = Ext4.create('Ext4.data.Store',{ + fields :[ + {name : 'supplierName'}, + {name : 'businessCertificate'}, + {name : 'businessValidityTime'}, + {name : 'businessLicense'}, + {name : 'licenseValidityTime'}, + {name : 'authorizerCompany'}, + {name : 'validityTime'}, + {name : 'level'}], + proxy : { + type : 'ajax', + url : WWWROOT + '/disinfectSystem/expensiveGoodsAction!getSupplyChain.do', + reader : { + type : 'json', + root : 'data' + } + } +}); + +//注册证的store +Ext4.define('registrationCertificationModel',{ + extend : 'Ext4.data.Model', + fields : [{ name : 'id'}, + {name : 'certification', type : 'string'}, + {name : 'validityTime', type : 'string'}] +}); +var registrationCertificationStore = Ext4.create('Ext4.data.Store',{ +// pageSize : 5, + model : 'registrationCertificationModel', + proxy : { + type : 'ajax', + url : WWWROOT + '/disinfectSystem/expensiveGoodsAction!getCertificationsByExpensiveGoodsSupplierId.do', + reader : { + type : 'json', + root : 'data' + } + } +}); + +//高值耗材型号store +var expensiveGoodsModelStore = Ext4.create('Ext4.data.Store',{ + fields : [{name : 'id'},{name : 'model'},{name : 'description'},{name : 'surfaceStatus'}] +}); +var expensiveGoodsTypeStore = Ext4.create('Ext4.data.Store',{ + fields : [{name : 'typeName'}], + proxy : { + type : 'ajax', + url : WWWROOT + '/disinfectSystem/expensiveGoodsAction!getExpensiveGoodsType.do', + reader : { + type : 'array' + } + } +}); + +var canOrNoStore = Ext4.create('Ext4.data.Store',{ + fields : [{name : 'value'}], + data : [{value : CONSTANT_CAN}, + {value : CONSTANT_NO}] +}); + +var yesOrNoStore = Ext4.create('Ext4.data.Store',{ + fields : [{name : 'value'}], + data : [{value : CONSTANT_YES}, + {value : CONSTANT_NO}] +}); + +//隐藏项 +var hiddenItems =[ + { + xtype : 'hidden', + name : 'id', + id : 'id' + },{ + xtype : 'hidden', + name : 'certificationId', + id : 'certificationId' + },{ + xtype : 'hidden', + name : 'orginalName', + id : 'orginalName' + },{ + xtype : 'hidden', + name : 'expensiveGoodsSupplierId', + id : 'expensiveGoodsSupplierId' + } +]; + +var columnOfName = { + fieldLabel : '名称', + id : 'name', + name : 'name', + allowBlank : false, + listeners:{ + change:function(field,nV,oV){ + var value = nV.trim(); + field.setValue(value); + } + } +}; +//第一列的选项 +var column1Items = [{ + fieldLabel : '拼音码', + id : 'spelling', + name : 'spelling', +// anchor : '95%', + fieldCls : 'fieldReadOnlyNoRemoveAndTop', + readOnly : true + },{ + xtype : 'numberfield', + fieldLabel : '参考价', + maxLength : '16', + id : 'referencePrice', + name : 'referencePrice', + hideTrigger : true, + allowBlank : false, + minValue: 0 + }, { + xtype : 'combo', + fieldLabel : "类型", + valueField : 'typeName', + displayField : 'typeName', + store : expensiveGoodsTypeStore, + editable : false, + triggerAction : 'all', + queryMode : 'local', + lastQuery: '', + name : "type", + id : "type" + },{ + xtype : 'combo', + fieldLabel : "类别", + valueField : 'name', + displayField : 'name', + store : new Ext4.data.Store({ + data:[{name : '一类'},{name : '二类'},{name : '三类'}], + fields:[{name : 'name'}] + }), + value : '一类', + forceSelection : true, + editable : false, + triggerAction : 'all', + name : "grade", + id : "grade" + },{ + xtype : 'combo', + fieldLabel : '能否申请', + valueField : 'value', + displayField : 'value', + value: CONSTANT_CAN, + store : canOrNoStore, + forceSelection : true, + editable : false, + allowBlank : false, + triggerAction : 'all', + name : "isApplicationMaterial", + id : "isApplicationMaterial" + },{ + xtype : 'numberfield', + fieldLabel : '最小库存', + allowDecimals : false, + maxLength : '16', + id : 'minStorage', + name : 'minStorage', + minValue: 0 + }, { + xtype : 'numberfield', + fieldLabel : '最大库存', + allowDecimals : false, + maxLength : '16', + id : 'maxStorage', + name : 'maxStorage', + minValue: 0 + },{ + xtype : 'numberfield', + fieldLabel : '总数', + maxLength : '16', + id : 'amount', + name : 'amount', + allowBlank : true, + minValue: 0 + },{ + xtype : 'numberfield', + fieldLabel : '顺序号', + maxLength : '16', + id : 'sequence', + name : 'sequence', + allowDecimals : false + },{ + fieldLabel : '单位', + maxLength : '16', + id : 'unit', + name : 'unit' + } + ]; + +var columnOfManufaturer = { + xtype : 'combo', + id : 'expensiveGoodsSupplier', + name : 'expensiveGoodsSupplier', + fieldLabel : '厂家', + queryParam : 'supplierName', + minChars : 0, + valueField : 'id', + displayField : 'name', + // pageSize : 5, + store : manufacturerStore, + lazyInit : true, + triggerAction : 'all', + hideTrigger : true, + allowBlank : false, + listeners : { + select : function(combo, record, index) { + oldSelectSupplierId = newSelectSupplierId; + newSelectSupplierId = record[0].data.id; + loadCertificationStoreByExpensiveGoodsSupplierId(record[0].data.id+''); + top.Ext4.getCmp('manufacturerBusinessLicense').setValue(record[0].data.businessLicense); + top.Ext4.getCmp('manufacturerProductionCertificate').setValue(record[0].data.productionCertificate); + top.Ext4.getCmp('licenseValidityTime').setValue(record[0].data.licenseValidityTime); + top.Ext4.getCmp('productionValidityTime').setValue(record[0].data.productionValidityTime); + + changeDateBackground(top.Ext4.getCmp("productionValidityTime"),record[0].data.productionValidityTime); + changeDateBackground(top.Ext4.getCmp("licenseValidityTime"),record[0].data.licenseValidityTime); + } + } + }; + +var columnOfRegistration = { + xtype : 'combo', + id : 'certification', + name : 'certification', + fieldLabel : '注册证', + valueField : 'certification', + displayField : 'certification', + queryMode : 'local', + store : registrationCertificationStore, + editable : false, + triggerAction: 'all', + lastQuery: '', + allowBlank : false, + listeners : { + select : function(combo, records, index) { + top.Ext4.getCmp('certificationId').setValue(records[0].data.id); + top.Ext4.getCmp('registrationCertificationValidityTime').setValue(records[0].data.validityTime); + + changeDateBackground(top.Ext4.getCmp("registrationCertificationValidityTime"),records[0].data.validityTime); + } + } + }; + +//第二列的选项 +var column2Items = [{ + fieldLabel : '五笔码', + id : 'wbCode', + name : 'wbCode', + fieldCls : 'fieldReadOnlyNoRemoveAndTop', + readOnly : true + },{ + fieldLabel : '收费码', + maxLength : '16', + id : 'chargeCode', + name : 'chargeCode' + },{ + fieldLabel : '平台代码', + maxLength : '16', + id : 'platformCode', + name : 'platformCode' + }, { + fieldLabel : '外部编码', + maxLength : '16', + id : 'externalCode', + name : 'externalCode' + },{ + xtype : 'numberfield', + fieldLabel : '最小申请数量', + maxLength : '16', + id : 'minApplyAmount', + name : 'minApplyAmount', + minValue: 0 + }, { + xtype : 'numberfield', + fieldLabel : '最大申请数量', + maxLength : '16', + id : 'maxApplyAmount', + name : 'maxApplyAmount', + minValue: 0 + },{ + xtype : 'combo', + fieldLabel : '是否盘点', + id : 'isInventoryGoods', + name : 'isInventoryGoods', + valueField : 'value', + displayField : 'value', + value : CONSTANT_YES, + store : yesOrNoStore, + forceSelection : true, + editable : false, + triggerAction : 'all' + },{ + xtype : 'combo', + fieldLabel : '是否植入物', + valueField : 'value', + displayField : 'value', + value: CONSTANT_NO, + store : yesOrNoStore, + forceSelection : true, + allowBlank : false, + triggerAction : 'all', + name : "isImplant", + id : "isImplant" + },{ +// hidden: !sstsConfig.expensiveGoodsInventorySerialNumber, + xtype : 'numberfield', + fieldLabel : '物资编码', + maxLength : '16', + id : 'inventorySerialNumber', + name : 'inventorySerialNumber', + minValue: 0 + } + ]; + +var manufacturerColumn1Items = [{ + fieldLabel : '', + fieldCls : 'fieldReadOnlyNoRemoveAndTop', + readOnly : true + },{ + id : 'manufacturerBusinessLicense', + name : 'manufacturerBusinessLicense', + fieldLabel : '营业执照', + fieldCls : 'fieldReadOnlyNoRemoveAndTop', + readOnly : true + },{ + id : 'manufacturerProductionCertificate', + name : 'manufacturerProductionCertificate', + fieldLabel : '生产许可证', + fieldCls : 'fieldReadOnlyNoRemoveAndTop', + readOnly : true + }]; + +var manufacturerColumn2Items = [{ + fieldLabel : '注册证有效期', + id : 'registrationCertificationValidityTime', + name : 'registrationCertificationValidityTime' + },{ + fieldLabel : '营业执照有效期', + id : 'licenseValidityTime', + name : 'licenseValidityTime' + },{ + fieldLabel : '生产许可证有效期', + id : 'productionValidityTime', + name : 'productionValidityTime' + }]; + + +//加载高值耗材定义界面(根据selectedId来判断是新建还是修改) +var onLoadExpensiveGoodsDefinitionWindow = function(selectedId,supplierId){ + + if(isUndefinedOrNullOrEmpty(selectedId)){ + selectedId = 0; + } + + //型号列表 + expensiveGoodsModelGridObj = Ext4.create('top.Ext4.grid.Panel',{ +// id : 'expensiveGoodsModelGrid', + plugins: { + ptype: 'cellediting', + pluginId : 'firstCellEditor', + clicksToEdit: 2 + }, + selType: 'rowmodel', + store: expensiveGoodsModelStore, + listeners : { + validateedit : function(editor,context){ + var valid = true; + if(context.colIdx != 0) //只对第一列进行校验 + return true; + if(context.value == context.originalValue) //值没有改变,不进行校验 + return false; + var judge = []; + expensiveGoodsModelStore.each(function(record){ + var indexOfStore = expensiveGoodsModelStore.indexOf(record); + judge.push(record.data.model); + if(judge.contains(context.value)){ + showResult('已包含相同型号:'+ context.value +',不可重复添加!\n'+'当前编辑行(第'+(context.rowIdx+1)+'行)与第'+(indexOfStore+1)+'行冲突!'); + valid = false; + return false; + } + }); + if(!valid){ + return false; //有重复值,返回false + } + } + }, + columns: [ + { text: '型号规格', dataIndex: 'model', flex : 10,editor : {xtype : 'textfield', allowBlank : false}}, + { text: '说明', dataIndex: 'description', flex : 3,editor : 'textfield'}, + { text: '表面状态', dataIndex: 'surfaceStatus', flex : 3,editor : 'textfield'} + ], + tbar : [{ + text : '新增', +// width : 70, + iconCls : 'btn_ext_add', + handler : function() { + newRow(); + } + }, { + text : '删除', + iconCls : 'btn_remove', + handler : function() { + var selectModel = expensiveGoodsModelGridObj.getSelectionModel(); + var rows = selectModel.getSelection();// 返回值为 Model 数组 + if (rows.length == 0) { + showResult('最少选择一条信息,进行删除!'); + } else { + top.Ext4.MessageBox.confirm('提示框', '您确定要删除选中的型号吗?', function(btn) { + if (btn == 'yes') { + if (rows) { + for ( var i = 0; i < rows.length; i++) { + expensiveGoodsModelStore.remove(rows[i]); + selectModel.selectPrevious(true); + } + } + } + }); + } + } + }] //tbar + }); + + //供应商列表 + expensiveGoodsSupplierGridObj = Ext4.create('top.Ext4.grid.Panel',{ + store: supplierStore, + columns: [ + { text: '供应商', dataIndex: 'supplierName', flex : 4}, + { text: '经营许可证', dataIndex: 'businessCertificate', flex : 4}, + { text: '经营许可证有效期', dataIndex: 'businessValidityTime', width : 120,align : 'center',renderer : checkDate}, + { text: '营业执照', dataIndex: 'businessLicense', flex : 4}, + { text: '营业执照有效期', dataIndex: 'licenseValidityTime', width : 100,align : 'center',renderer : checkDate}, + { text: '授权方', dataIndex: 'authorizerCompany', flex : 4}, + { text: '授权有效期', dataIndex: 'validityTime', width : 80,align : 'center',renderer : checkDate}, + { text: '供应链级别', dataIndex: 'level', flex : 1} + ] + }); + + +// frame : true, +// border : 0, +// labelSeparator : ':', +// bodyPadding : '5 5 0', +// autoScroll : true, +// buttonAlign : 'center', + //表单整体 + formObj = Ext4.create('top.Ext4.form.Panel',{ +// frame : true, + border : false, + bodyStyle: 'background:transparent;', + labelSeparator : ':', + fieldDefaults : { + labelAlign : 'right', + labelWidth : 110, + maxLength : '41' + }, + layout : 'column', + items : [ +// + { + columnWidth : 1, +// xtype : 'fieldset', + defaultType : 'textfield', + border : false, + layout : 'form', + anchor : "90%", +// plain : false, + bodyStyle: 'background:transparent;', +// frame : true, + items : columnOfName + + },{ + columnWidth : 0.5, + defaultType : 'textfield', +// border : false, + layout : 'form', +// plain : true, +// frame : true, + border : false, + bodyStyle: 'background:transparent;', + items : column1Items.concat(hiddenItems) + },{ + columnWidth : 0.5, + defaultType : 'textfield', + border : false, + layout : 'form', +// frame : true, + bodyStyle: 'background:transparent;', + items : column2Items + },{ + columnWidth : 1, + frame : true, + border : true, + layout : 'column', + items : [{ + columnWidth : 1, + defaultType : 'textfield', + border : false, + layout : 'form', +// frame : true, + bodyStyle: 'background:transparent;', + defaults : { + labelWidth : 106 + }, + items : columnOfManufaturer + },{ + columnWidth : 1, + defaultType : 'textfield', + border : false, + layout : 'form', +// frame : true, + bodyStyle: 'background:transparent;', + defaults : { + labelWidth : 106 + }, + items : columnOfRegistration + },{ + columnWidth : 0.6, + defaultType : 'textfield', + layout : 'form', + border : false, + bodyStyle: 'background:transparent;', + defaults : { + labelWidth : 106 + }, + items : manufacturerColumn1Items + },{ + columnWidth : 0.4, + defaultType : 'textfield', + layout : 'form', + border : false, + bodyStyle: 'background:transparent;', + defaults : { + labelAlign : 'right', + labelWidth : 110, +// fieldCls : 'fieldReadOnlyNoRemoveAndTop', + readOnly : true + }, + items : manufacturerColumn2Items + } + ]} + ] + }); + + + //窗口 + windowObj = Ext4.create('top.Ext4.window.Window', { + title: '高值耗材定义', + height: 600, + width: 1000, + autoScroll : true, + layout : 'column', + modal : true, +// border : false, +// plain : true, + buttonAlign : 'center', + items : [ + { + columnWidth : 1, + layout : 'column', + items : [{ + columnWidth : .5, + title : '基本信息', +// height : 400, + frame : true, + items : formObj + },{ + columnWidth : .5, + title : '型号信息', + height : 440, + frame : false, + items : expensiveGoodsModelGridObj + }] + + } + ,{ + columnWidth : 1, + title : '供应商信息', + height : 150, +// padding : "10 0 0 0", + items : expensiveGoodsSupplierGridObj + } + ], + listeners : { + close : function(){ + expensiveGoodsModelStore.removeAll(); + registrationCertificationStore.removeAll(); + supplierStore.removeAll(); + }, + show : function(){ //把型号grid设置为多选模式 + expensiveGoodsModelGridObj.getSelectionModel().setSelectionMode("MULTI"); + } + }, + buttons: [{ +// id : 'saveBtn', +// text: '保存', +// handler: save +// }, { + text: '取消', + handler: function() { + windowObj.close(); + } + }] + }); + + windowObj.show(); + expensiveGoodsTypeStore.load(); //加载高值耗材类型store + top.Ext4.getCmp('type').setValue(document.getElementById("parm_s_type").value); + if(selectedId == 0){ + return ;//新建的不从后台获取数据 + } + + formObj.getForm().load({ + url : WWWROOT + '/disinfectSystem/expensiveGoodsAction!loadExpensiveGoods.do', + method : 'post', + waitMsg : '正在加载数据,请稍候', + params : { id : selectedId}, + success : function(form ,action){ + var expensiveGoods = action.result.data; + top.Ext4.getCmp("orginalName").setValue(expensiveGoods.name); + loadCertificationStoreByExpensiveGoodsSupplierId(expensiveGoods.expensiveGoodsSupplierId); + oldSelectSupplierId = newSelectSupplierId = expensiveGoods.expensiveGoodsSupplierId; + fillexpensiveGoodsModelGridStore(expensiveGoods.expensiveGoodsModelLists); + + changeDateBackground(top.Ext4.getCmp("registrationCertificationValidityTime"),expensiveGoods.registrationCertificationValidityTime); + changeDateBackground(top.Ext4.getCmp("productionValidityTime"),expensiveGoods.productionValidityTime); + changeDateBackground(top.Ext4.getCmp("licenseValidityTime"),expensiveGoods.licenseValidityTime); + + supplierStore.load({ + params : { + id : selectedId, + supplierId : expensiveGoods.expensiveGoodsSupplierId + } + }); + } + }); + + +} +