Index: ssts-web/src/main/webapp/disinfectsystem/basedatamanager/tousse/customTousseForm.js =================================================================== diff -u -r30528 -r33454 --- ssts-web/src/main/webapp/disinfectsystem/basedatamanager/tousse/customTousseForm.js (.../customTousseForm.js) (revision 30528) +++ ssts-web/src/main/webapp/disinfectsystem/basedatamanager/tousse/customTousseForm.js (.../customTousseForm.js) (revision 33454) @@ -4,36 +4,36 @@ var toussePrice; var customTousseDefinitionsStore = new Ext.data.Store({ - proxy : new Ext.data.HttpProxy({ - url : WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!getCustomTousseDefinitionsData.do', - method : 'POST' + proxy: new Ext.data.HttpProxy({ + url: WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!getCustomTousseDefinitionsData.do', + method: 'POST' }), - reader : new Ext.data.JsonReader({ - totalProperty : 'totalCount', - root : 'data' + reader: new Ext.data.JsonReader({ + totalProperty: 'totalCount', + root: 'data' }, [ - {name : 'id',mapping : 'id'}, - {name : 'name',mapping : 'name'} - ] + { name: 'id', mapping: 'id' }, + { name: 'name', mapping: 'name' } + ] ) }); var customMaterialDefinitionStore = new Ext.data.Store({ - proxy : new Ext.data.HttpProxy({ - url : WWWROOT + '/disinfectSystem/baseData/materialDefinitionAction!getMaterialDefinitionData.do', - method : 'POST' + proxy: new Ext.data.HttpProxy({ + url: WWWROOT + '/disinfectSystem/baseData/materialDefinitionAction!getMaterialDefinitionData.do', + method: 'POST' }), - reader : new Ext.data.JsonReader({ - totalProperty : 'totalCount', - root : 'data' + reader: new Ext.data.JsonReader({ + totalProperty: 'totalCount', + root: 'data' }, [ - {name : 'id',mapping : 'id'}, - {name : 'spelling',mapping : 'spelling'}, - {name : 'type',mapping : 'type'}, - {name : 'name',mapping : 'name'}, - {name : 'isImplant',mapping : 'isImplant'}, - {name : 'isRecycling',mapping : 'isRecycling'} + { name: 'id', mapping: 'id' }, + { name: 'spelling', mapping: 'spelling' }, + { name: 'type', mapping: 'type' }, + { name: 'name', mapping: 'name' }, + { name: 'isImplant', mapping: 'isImplant' }, + { name: 'isRecycling', mapping: 'isRecycling' } ]) }); @@ -47,48 +47,48 @@ //是否是填充价格 var fillPrice; -function addMaterial(id,name,type,isImplant){ +function addMaterial(id, name, type, isImplant) { var count1 = top.Ext.getCmp('count1').getValue(); - if(name == ''){ + if (name == '') { showResult("请先选择材料。"); return false; - }else if(count1 == ''){ + } else if (count1 == '') { showResult("请输入数量。"); return false; - }else if(count1 > 9999){ + } else if (count1 > 9999) { showResult("材料数量不能大于9999!"); return false; } var node = top.Ext.getCmp('tousseLeaseColumnTree').getSelectionModel().getSelectedNode(); - if(node == null){//未选择器械包 + if (node == null) {//未选择器械包 showResult("请选择要添加材料的器械包。"); return false; } top.Ext.getCmp("material").setValue(""); top.Ext.getCmp("count1").setValue(""); - var nodeType = node.attributes.type; - if(nodeType != "自定义器械包"){ + var nodeType = node.attributes.type; + if (nodeType != "自定义器械包") { node = node.parentNode; } var added = false; - node.eachChild(function(childNode){ - if(childNode.attributes.material == name){ + node.eachChild(function (childNode) { + if (childNode.attributes.material == name) { showResult("该材料已经在列表中,不能重复添加。"); added = true; } }); - if(added){ + if (added) { return false; } //创建子节点 createChildNode(node, id, name, isImplant, count1, type); } -function changeisRecycling(id,value){ +function changeisRecycling(id, value) { var rootNode = top.Ext.getCmp('tousseLeaseColumnTree').getRootNode(); - - rootNode.eachChild(function(childNode){ - if(childNode.attributes.id == id){ + + rootNode.eachChild(function (childNode) { + if (childNode.attributes.id == id) { childNode.attributes.isRecycling = value; return true; } @@ -104,666 +104,666 @@ * @param callback * @returns */ -function addAndEditCustomTousse(appId,tousseDefId,authority,callback) { +function addAndEditCustomTousse(appId, tousseDefId, authority, callback) { var tousseLeaseColumnTree = new top.Ext.tree.ColumnTree({ - id : 'tousseLeaseColumnTree', - rootVisible:false, - autoScroll:true, - height : 250, - bodyStyle : 'border:1px solid #afd7af', - containerScroll : true, - columns:[{ - header:'器械包名称', - width:205, - dataIndex:'tousseName' - },{ - header:'材料名称', - width:170, - dataIndex:'material' - },{ - header:'是否回收', - width:80, - dataIndex:'isRecycling', - renderer:function(v,p,record){ - if(!record.leaf){ + id: 'tousseLeaseColumnTree', + rootVisible: false, + autoScroll: true, + height: 250, + bodyStyle: 'border:1px solid #afd7af', + containerScroll: true, + columns: [{ + header: '器械包名称', + width: 205, + dataIndex: 'tousseName' + }, { + header: '材料名称', + width: 170, + dataIndex: 'material' + }, { + header: '是否回收', + width: 80, + dataIndex: 'isRecycling', + renderer: function (v, p, record) { + if (!record.leaf) { var id = record.id; - var isRecyclingID = "select_"+id; - var str = ""; + if (record.isRecycling == '是') { str += ""; - }else { + } else { str += ""; } str += "" - return str; + return str; } - } - },{ - header:'是否植入物', - width:80, - dataIndex:'isImplant' - },{ - header:'数量', - width:55, - dataIndex:'amount' - },{ - header:'价格', - width:55, - dataIndex:'toussePrice' - },{ - header:'类型', - width:90, - hidden: true, - dataIndex:'type' - },{ - header:'删除', - width:95, - dataIndex:'deleteButton', - renderer:function(v,p,record){ - var str = ""; - return str; - } - },{ - header:'器械包隐藏名称', - hidden:true, - dataIndex:'fromTousse' - }], - root: new top.Ext.tree.AsyncTreeNode({ - text:'器械包' + } + }, { + header: '是否植入物', + width: 80, + dataIndex: 'isImplant' + }, { + header: '数量', + width: 55, + dataIndex: 'amount' + }, { + header: '价格', + width: 55, + dataIndex: 'toussePrice' + }, { + header: '类型', + width: 90, + hidden: true, + dataIndex: 'type' + }, { + header: '删除', + width: 95, + dataIndex: 'deleteButton', + renderer: function (v, p, record) { + var str = ""; + return str; + } + }, { + header: '器械包隐藏名称', + hidden: true, + dataIndex: 'fromTousse' + }], + root: new top.Ext.tree.AsyncTreeNode({ + text: '器械包' }) - }); - - SupplyRoomConfigTableManager.getStartTimeObject(function(supplyRoomConfig){ + }); + + SupplyRoomConfigTableManager.getStartTimeObject(function (supplyRoomConfig) { toussePrice = supplyRoomConfig.customToussePrice; }); - var treeEditer = new top.Ext.tree.ColumnTreeEditor(tousseLeaseColumnTree, { - completeOnEnter : true, - autosize : true, - allowBlank: false, - selectOnFocus : true, - revertInvalid:true, - ignoreNoChange : true, - clicksToEdit:1 - }); - - treeEditer.on("beforestartedit", function(thiz,el,v){ - var tempNode = thiz.editNode;//将要编辑的节点 - var editCell = thiz.editColIndex; - if(editCell =="isImplant" || editCell == "material" || editCell == 0){//限制编辑单元格 - return false; - } - return true; - }); - - treeEditer.on("complete",function(thiz,newValue,oldValue){ - var editNode = thiz.editNode;//将要编辑的节点 - var attr = editNode.attributes;//将要编辑的节点属性 - var re = /^[1-9]+[0-9]*$/; - var editCell = thiz.editColIndex; - if(editCell != 'toussePrice' && re.test(oldValue)) {//通过匹配oldvalue确定编辑的单元格是数量列 - if(!re.test(newValue)){ - return false; - }else if(re.test(newValue) && newValue > 9999){ - return false; - } - } - if(editCell == 'toussePrice' && newValue < 0){ + var treeEditer = new top.Ext.tree.ColumnTreeEditor(tousseLeaseColumnTree, { + completeOnEnter: true, + autosize: true, + allowBlank: false, + selectOnFocus: true, + revertInvalid: true, + ignoreNoChange: true, + clicksToEdit: 1 + }); + + treeEditer.on("beforestartedit", function (thiz, el, v) { + var tempNode = thiz.editNode;//将要编辑的节点 + var editCell = thiz.editColIndex; + if (editCell == "isImplant" || editCell == "material" || editCell == 0) {//限制编辑单元格 + return false; + } + return true; + }); + + treeEditer.on("complete", function (thiz, newValue, oldValue) { + var editNode = thiz.editNode;//将要编辑的节点 + var attr = editNode.attributes;//将要编辑的节点属性 + var re = /^[1-9]+[0-9]*$/; + var editCell = thiz.editColIndex; + if (editCell != 'toussePrice' && re.test(oldValue)) {//通过匹配oldvalue确定编辑的单元格是数量列 + if (!re.test(newValue)) { return false; - } -/* if(editCell == 'isImplant'){ - if(newValue != '是' && newValue != '否'){ - return false; - }else if(newValue != '是' && newValue != oldValue && typeof(attr.tousseName) == undefined){ - editNode.parentNode.attributes.isImplant = '是'; - } - - }*/ - if(editCell == 'tousseName' && newValue != oldValue && !checkAddedTousseName(newValue)){ + } else if (re.test(newValue) && newValue > 9999) { return false; } - }); - + } + if (editCell == 'toussePrice' && newValue < 0) { + return false; + } + /* if(editCell == 'isImplant'){ + if(newValue != '是' && newValue != '否'){ + return false; + }else if(newValue != '是' && newValue != oldValue && typeof(attr.tousseName) == undefined){ + editNode.parentNode.attributes.isImplant = '是'; + } + + }*/ + if (editCell == 'tousseName' && newValue != oldValue && !checkAddedTousseName(newValue)) { + return false; + } + }); + var btSaveDisabledStatus = false; this.tousseId = tousseDefId; if (appId) {// 申请单 // 检测当前自定义申请单是否已被回收 DWREngine.setAsync(false); - RecyclingApplicationTableManager.isHasRecyclingRecordByRecyclingAppId(appId, function(isHasRecyclingRecord) { + RecyclingApplicationTableManager.isHasRecyclingRecordByRecyclingAppId(appId, function (isHasRecyclingRecord) { btSaveDisabledStatus = isHasRecyclingRecord; }); - RecyclingApplicationTableManager.getTousseDefinitionByApplicationId(appId,function(tousseDefinitionId){ + RecyclingApplicationTableManager.getTousseDefinitionByApplicationId(appId, function (tousseDefinitionId) { tousseId = tousseDefinitionId; }); DWREngine.setAsync(true); } this.callback = callback; this.appId = appId; - if(authority == "00") { + if (authority == "00") { this.fillTousseName = true; this.fillPrice = true; - } else if(authority == "01") { + } else if (authority == "01") { this.fillTousseName = true; this.fillPrice = false; - } else if(authority == "10") { + } else if (authority == "10") { this.fillTousseName = false; this.fillPrice = true; - } else if(authority == "11") { + } else if (authority == "11") { this.fillTousseName = false; this.fillPrice = false; } - + var tousseAndDiposableGoodsStoreForBorrowing; formAppObj = new top.Ext.FormPanel({ - id : 'applicationForm', - frame : true, - labelSeparator : ':', - labelAlign:'right', - bodyStyle : 'padding:5px 5px 0px 5px;', - labelWidth : 100, - width : 500, - items : [{ - xtype : 'hidden', - name : 'departCoding', - id : 'departCoding' - },{ - xtype : 'hidden', - name : 'customTousseInstanceIds', - id : 'customTousseInstanceIds' - },{ - xtype : 'hidden', - name : 'settleAccountsDepartCoding', - id : 'settleAccountsDepartCoding' - },{ - xtype : 'hidden', - name : 'departHidden', - id : 'departHidden' - },{ - xtype : "fieldset", + id: 'applicationForm', + frame: true, + labelSeparator: ':', + labelAlign: 'right', + bodyStyle: 'padding:5px 5px 0px 5px;', + labelWidth: 100, + width: 500, + items: [{ + xtype: 'hidden', + name: 'departCoding', + id: 'departCoding' + }, { + xtype: 'hidden', + name: 'customTousseInstanceIds', + id: 'customTousseInstanceIds' + }, { + xtype: 'hidden', + name: 'settleAccountsDepartCoding', + id: 'settleAccountsDepartCoding' + }, { + xtype: 'hidden', + name: 'departHidden', + id: 'departHidden' + }, { + xtype: "fieldset", title: '基础数据', - bodyStyle : 'padding:1px;', - layout : 'column', - autoHeight : true, - hidden : appId==null, - items : [{ - columnWidth : .5, - layout : 'form', - labelWidth : 70, - items : [{ - xtype : 'textfield', - fieldLabel : '申请人', - maxLength : '16', - id : 'applicant', - name : 'applicant', - allowBlank : fillPrice, - value : $Id('userName')==null?"":$Id('userName').value, - anchor : '95%', - readOnly : true, - cls:'fieldReadOnlyNoRemove' + bodyStyle: 'padding:1px;', + layout: 'column', + autoHeight: true, + hidden: appId == null, + items: [{ + columnWidth: .5, + layout: 'form', + labelWidth: 70, + items: [{ + xtype: 'textfield', + fieldLabel: '申请人', + maxLength: '16', + id: 'applicant', + name: 'applicant', + allowBlank: fillPrice, + value: $Id('userName') == null ? "" : $Id('userName').value, + anchor: '95%', + readOnly: true, + cls: 'fieldReadOnlyNoRemove' }] - },{ - columnWidth : .5, - layout : 'form', - labelWidth : 70, - items : [{ - xtype : 'textfield', - fieldLabel : '时间', - id : 'applicationTime', - name : 'applicationTime', - editable : false, + }, { + columnWidth: .5, + layout: 'form', + labelWidth: 70, + items: [{ + xtype: 'textfield', + fieldLabel: '时间', + id: 'applicationTime', + name: 'applicationTime', + editable: false, allowBlank: true, // value : today, - anchor : '95%', - readOnly:true, - cls:'fieldReadOnlyNoRemove' + anchor: '95%', + readOnly: true, + cls: 'fieldReadOnlyNoRemove' }] - },{ - columnWidth : .5, - layout : 'form', - labelWidth : 70, - items : [{ - xtype : 'combo', - fieldLabel : '申请科室', - id : 'depart', - name : 'depart', - queryParam : 'spell', - minChars : 0, - valueField : 'id', - displayField : 'name', - store : appDepartJsonStoreExt2, - forceSelection : true, - lazyInit : true, - triggerAction : 'all', - hideTrigger : true, - typeAhead : false, - allowBlank : false, - anchor : '100%', - listeners:{ - select:function(combo, record, index){ + }, { + columnWidth: .5, + layout: 'form', + labelWidth: 70, + items: [{ + xtype: 'combo', + fieldLabel: '申请科室', + id: 'depart', + name: 'depart', + queryParam: 'spell', + minChars: 0, + valueField: 'id', + displayField: 'name', + store: appDepartJsonStoreExt2, + forceSelection: true, + lazyInit: true, + triggerAction: 'all', + hideTrigger: true, + typeAhead: false, + allowBlank: false, + anchor: '100%', + listeners: { + select: function (combo, record, index) { var departCoding = top.Ext.getCmp("depart").getValue(); top.Ext.getCmp("departCoding").setValue(departCoding); //截取科室名称 var dept = top.Ext.getCmp("depart").getRawValue(); - if(dept != ""){ + if (dept != "") { var departArray = dept.split("-"); - this.setValue(departArray[departArray.length-1]); + this.setValue(departArray[departArray.length - 1]); } //联动修改结算科室的值 - var index = departJsonStoreExt2.find('id', departCoding); - if (index != -1){ - var result = departJsonStoreExt2.getAt(index); - top.Ext.getCmp("settleAccountsDepartCoding").setValue(result.get('id')); - var settleDepartArray = result.get('name').split("-"); - top.Ext.getCmp("settleAccountsDepart").setValue(settleDepartArray[settleDepartArray.length-1]) - - DWREngine.setAsync(false); - Ext4.Ajax.request({ - url : WWWROOT + '/disinfectSystem/baseData/supplyRoomConfigAction!getSupplyRoomConfigByCoding.do', - params : {'orgUnitCode':departCoding,'type':3}, - timeout : 600000, - success : function(response, options) { - var result= Ext4.JSON.decode(response.responseText); + var index = departJsonStoreExt2.find('id', departCoding); + if (index != -1) { + var result = departJsonStoreExt2.getAt(index); + top.Ext.getCmp("settleAccountsDepartCoding").setValue(result.get('id')); + var settleDepartArray = result.get('name').split("-"); + top.Ext.getCmp("settleAccountsDepart").setValue(settleDepartArray[settleDepartArray.length - 1]) + + DWREngine.setAsync(false); + Ext4.Ajax.request({ + url: WWWROOT + '/disinfectSystem/baseData/supplyRoomConfigAction!getSupplyRoomConfigByCoding.do', + params: { 'orgUnitCode': departCoding, 'type': 3 }, + timeout: 600000, + success: function (response, options) { + var result = Ext4.JSON.decode(response.responseText); //simon-add:如果申请科室配置的默认结算科室不为空,那么设置此值为页面结算科室默认值 - if(!isUndefinedOrNullOrEmpty(result.settleAccountsDepart)&&!isUndefinedOrNullOrEmpty(result.settleAccountsDepartCoding)){ - top.Ext.getCmp('settleAccountsDepart').setValue(result.settleAccountsDepart); + if (!isUndefinedOrNullOrEmpty(result.settleAccountsDepart) && !isUndefinedOrNullOrEmpty(result.settleAccountsDepartCoding)) { + top.Ext.getCmp('settleAccountsDepart').setValue(result.settleAccountsDepart); top.Ext.getCmp('settleAccountsDepartCoding').setValue(result.settleAccountsDepartCoding); } }, - failure : function(response, opts) { + failure: function (response, opts) { showResult(response.responseText); } }); DWREngine.setAsync(true); - + } }, - focus : function(thiz){ + focus: function (thiz) { thiz.selectText(); } } }] }, { - columnWidth : .5, - layout : 'form', - labelWidth : 70, - items : [{ - xtype : 'combo', - fieldLabel : '结算科室', - id : 'settleAccountsDepart', - name : 'settleAccountsDepart', - queryParam : 'spell', - minChars : 0, - valueField : 'id', - displayField : 'name', - store : departJsonStoreExt2, - forceSelection : true, - lazyInit : true, - triggerAction : 'all', - hideTrigger : true, - typeAhead : false, - allowBlank : false, - anchor : '100%', - listeners:{ - select:function(combo, record, index){ - var settleAccountsDepartCoding = top.Ext.getCmp("settleAccountsDepart").getValue(); - top.Ext.getCmp("settleAccountsDepartCoding").setValue(settleAccountsDepartCoding); - //截取科室名称 - var settleAccountsDepart = top.Ext.getCmp("settleAccountsDepart").getRawValue(); - if(settleAccountsDepart != ""){ - var departArray = settleAccountsDepart.split("-"); - this.setValue(departArray[departArray.length-1]); - } - }, - focus : function(thiz){ - thiz.selectText(); - } + columnWidth: .5, + layout: 'form', + labelWidth: 70, + items: [{ + xtype: 'combo', + fieldLabel: '结算科室', + id: 'settleAccountsDepart', + name: 'settleAccountsDepart', + queryParam: 'spell', + minChars: 0, + valueField: 'id', + displayField: 'name', + store: departJsonStoreExt2, + forceSelection: true, + lazyInit: true, + triggerAction: 'all', + hideTrigger: true, + typeAhead: false, + allowBlank: false, + anchor: '100%', + listeners: { + select: function (combo, record, index) { + var settleAccountsDepartCoding = top.Ext.getCmp("settleAccountsDepart").getValue(); + top.Ext.getCmp("settleAccountsDepartCoding").setValue(settleAccountsDepartCoding); + //截取科室名称 + var settleAccountsDepart = top.Ext.getCmp("settleAccountsDepart").getRawValue(); + if (settleAccountsDepart != "") { + var departArray = settleAccountsDepart.split("-"); + this.setValue(departArray[departArray.length - 1]); } - }] - },{ - columnWidth : .5, - layout : 'form', - labelWidth : 70, - items : [{ - xtype : 'combo', - id : 'urgency', - name : 'urgency', - fieldLabel : "紧急度", - value :'普通', - valueField : 'displayName', - displayField : 'displayName', - store : urgencyStore, - triggerAction : 'all', - mode : 'local', - editable : false, - forceSelection : true, - readOnly:true, - allowBlank : false, - anchor : '100%' + }, + focus: function (thiz) { + thiz.selectText(); + } + } }] - },{ - columnWidth : 1, - layout : 'form', - labelWidth : 70, - items : [{ - xtype : 'textarea', - height : 45, - fieldLabel : '备注', - id : 'remark', - name : 'remark', - allowBlank : true, - anchor : '100%' + }, { + columnWidth: .5, + layout: 'form', + labelWidth: 70, + items: [{ + xtype: 'combo', + id: 'urgency', + name: 'urgency', + fieldLabel: "紧急度", + value: '普通', + valueField: 'displayName', + displayField: 'displayName', + store: urgencyStore, + triggerAction: 'all', + mode: 'local', + editable: false, + forceSelection: true, + readOnly: true, + allowBlank: false, + anchor: '100%' }] + }, { + columnWidth: 1, + layout: 'form', + labelWidth: 70, + items: [{ + xtype: 'textarea', + height: 45, + fieldLabel: '备注', + id: 'remark', + name: 'remark', + allowBlank: true, + anchor: '100%' + }] }] - },{ - xtype : "fieldset", + }, { + xtype: "fieldset", title: '器械包信息', - labelAlign:"right", + labelAlign: "right", //bodyStyle:'padding:5px 5px 0px 5px;',//与上面基本信息的fieldset样式保持一致 - layout : 'column', - labelWidth : 70, - columnWidth : 1, - autoHeight : true, - items : [{ - xtype : 'hidden', - name : 'tousseItemId', - id : 'tousseItemId' - },{ - xtype : 'hidden', - name : 'tousseDefinitionId', - id : 'tousseDefinitionId' - },{ - xtype : 'hidden', - name : 'existTousseDefinitionId', - id : 'existTousseDefinitionId' - },{ - xtype : 'hidden', - name : 'isCleanedEntirely', - id : 'isCleanedEntirely' - },{ - xtype : 'hidden', - name : 'tousseType', - id : 'tousseType' - },{ - xtype : 'hidden', - name : 'customTousseInfo', - id : 'customTousseInfo' - },{ - xtype : 'hidden', - name : 'materialId', - id : 'materialId' - },{ - xtype : 'hidden', - name : 'materialType', - id : 'materialType' - },{ - xtype : 'hidden', - name : 'isImplant', - id : 'isImplant' - },{ - xtype : 'hidden', - name : 'isRecycling', - id : 'isRecycling' - },{ - columnWidth : .5, - layout : 'form', - labelWidth : 90, - items : [{ - xtype : 'combo', - fieldLabel : '器械包名称', - id : 'name', - name : 'name', - disabled : !fillTousseName, - queryParam : 'spell', - minChars : 0, - displayField : 'name', - store : customTousseDefinitionsStore, - forceSelection : false, - lazyInit : true, - triggerAction : 'all', - hideTrigger : true, - typeAhead : false, - allowBlank : true, - anchor : '100%', - listeners:{ - focus : function(thiz){ - thiz.selectText(); - }, - specialkey : function(field, ee) { - if (ee.getKey() == Ext.EventObject.ENTER) { - top.Ext.getCmp('count').focus(); - } - } + layout: 'column', + labelWidth: 70, + columnWidth: 1, + autoHeight: true, + items: [{ + xtype: 'hidden', + name: 'tousseItemId', + id: 'tousseItemId' + }, { + xtype: 'hidden', + name: 'tousseDefinitionId', + id: 'tousseDefinitionId' + }, { + xtype: 'hidden', + name: 'existTousseDefinitionId', + id: 'existTousseDefinitionId' + }, { + xtype: 'hidden', + name: 'isCleanedEntirely', + id: 'isCleanedEntirely' + }, { + xtype: 'hidden', + name: 'tousseType', + id: 'tousseType' + }, { + xtype: 'hidden', + name: 'customTousseInfo', + id: 'customTousseInfo' + }, { + xtype: 'hidden', + name: 'materialId', + id: 'materialId' + }, { + xtype: 'hidden', + name: 'materialType', + id: 'materialType' + }, { + xtype: 'hidden', + name: 'isImplant', + id: 'isImplant' + }, { + xtype: 'hidden', + name: 'isRecycling', + id: 'isRecycling' + }, { + columnWidth: .5, + layout: 'form', + labelWidth: 90, + items: [{ + xtype: 'combo', + fieldLabel: '器械包名称', + id: 'name', + name: 'name', + disabled: !fillTousseName, + queryParam: 'spell', + minChars: 0, + displayField: 'name', + store: customTousseDefinitionsStore, + forceSelection: false, + lazyInit: true, + triggerAction: 'all', + hideTrigger: true, + typeAhead: false, + allowBlank: true, + anchor: '100%', + listeners: { + focus: function (thiz) { + thiz.selectText(); + }, + specialkey: function (field, ee) { + if (ee.getKey() == Ext.EventObject.ENTER) { + top.Ext.getCmp('count').focus(); } - }] - },{ - columnWidth : .2, - layout : 'form', - items:[{ - xtype : 'numberfield', - fieldLabel : "申请数量", -// allowBlank : appId!=null?false:true, - allowBlank : true, - allowNegative : false, - allowDecimals : false, - blankText : '请输入数量!', - name : "count", - id : "count", - value : 1, - maxValue:9999, - hidden : appId==null, - hideLabel : appId==null, - anchor : '100%', - listeners:{ - focus : function(thiz){ - thiz.selectText(); - }, - specialkey : function(field, ee) { - if (ee.getKey() == Ext.EventObject.ENTER) { - addTousseLeaseItemCu(); - } - } } - }] - },{ - columnWidth : .3, - layout : 'form', - items:[{ - xtype : 'button', - text : '添加器械包', -// iconCls : 'btn_ext_add', - disabled : !fillTousseName, - handler : function() { - addTousseLeaseItemCu(); - } - }] - },{ - columnWidth : .5, - layout : 'form', - labelWidth : 90, - items : [{ - xtype : 'combo', - fieldLabel : '材料名称', - id : 'material', - name : 'material', - queryParam : 'spell', - minChars : 0, - valueField : 'name', - displayField : 'name', - store : customMaterialDefinitionStore, - forceSelection : true, - lazyInit : false, - triggerAction : 'all', - disabled : !fillTousseName, - hideTrigger : true, - typeAhead : false, - allowBlank : true, - anchor : '100%', - listeners : { - focus : function(thiz){ - thiz.selectText(); - }, - select : function(combo, record, index) { - combo.setValue(record.data.name); - top.Ext.getCmp('materialId').setValue(record.data.id); - top.Ext.getCmp('materialType').setValue(record.data.type); - top.Ext.getCmp('isImplant').setValue(record.data.isImplant); - top.Ext.getCmp('count1').focus(); - }, - specialkey : function(field, ee) { - if (ee.getKey() == Ext.EventObject.ENTER) { - top.Ext.getCmp('count1').focus(); - } - } + } + }] + }, { + columnWidth: .2, + layout: 'form', + items: [{ + xtype: 'numberfield', + fieldLabel: "申请数量", + // allowBlank : appId!=null?false:true, + allowBlank: true, + allowNegative: false, + allowDecimals: false, + blankText: '请输入数量!', + name: "count", + id: "count", + value: 1, + maxValue: 9999, + hidden: appId == null, + hideLabel: appId == null, + anchor: '100%', + listeners: { + focus: function (thiz) { + thiz.selectText(); + }, + specialkey: function (field, ee) { + if (ee.getKey() == Ext.EventObject.ENTER) { + addTousseLeaseItemCu(); + } + } + } + }] + }, { + columnWidth: .3, + layout: 'form', + items: [{ + xtype: 'button', + text: '添加器械包', + // iconCls : 'btn_ext_add', + disabled: !fillTousseName, + handler: function () { + addTousseLeaseItemCu(); + } + }] + }, { + columnWidth: .5, + layout: 'form', + labelWidth: 90, + items: [{ + xtype: 'combo', + fieldLabel: '材料名称', + id: 'material', + name: 'material', + queryParam: 'spell', + minChars: 0, + valueField: 'name', + displayField: 'name', + store: customMaterialDefinitionStore, + forceSelection: true, + lazyInit: false, + triggerAction: 'all', + disabled: !fillTousseName, + hideTrigger: true, + typeAhead: false, + allowBlank: true, + anchor: '100%', + listeners: { + focus: function (thiz) { + thiz.selectText(); + }, + select: function (combo, record, index) { + combo.setValue(record.data.name); + top.Ext.getCmp('materialId').setValue(record.data.id); + top.Ext.getCmp('materialType').setValue(record.data.type); + top.Ext.getCmp('isImplant').setValue(record.data.isImplant); + top.Ext.getCmp('count1').focus(); + }, + specialkey: function (field, ee) { + if (ee.getKey() == Ext.EventObject.ENTER) { + top.Ext.getCmp('count1').focus(); + } + } - } - }] - },{ - columnWidth : .2, - layout : 'form', - items:[{ - xtype : 'numberfield', - fieldLabel : "材料数量", - maxValue : 9999, - id : 'count1', - name : 'count1', - disabled : !fillTousseName, - anchor : '100%', - style : 'text-align: left', - allowDecimals:false, - allowNegative:false, - listeners : { - focus : function(thiz){ - thiz.selectText(); - }, - specialkey : function(field, e) { - if (e.getKey() == Ext.EventObject.ENTER) { - addMaterial(top.Ext.getCmp("materialId").getValue(),top.Ext.getCmp("material").getValue(),top.Ext.getCmp("materialType").getValue(),top.Ext.getCmp("isImplant").getValue()); - top.Ext.getCmp("material").focus(); - } - } - } - }] - },{ - columnWidth : .3, - layout : 'form', - items:[{ - xtype : 'button', - text : '添加材料', - disabled : !fillTousseName, - handler : function() { - addMaterial(top.Ext.getCmp("materialId").getValue(),top.Ext.getCmp("material").getValue(),top.Ext.getCmp("materialType").getValue(),top.Ext.getCmp("isImplant").getValue()); - top.Ext.getCmp("material").focus(); - } - }] - }] - },{ - xtype:"fieldset", - autoScroll:true, - id : 'tousseDefinitionList', - title :'器械包列表', - height:250, -// height : top.screen.height > 1000 ? 210 : 230, - layout:'fit', - items:[ - tousseLeaseColumnTree - ] + } + }] + }, { + columnWidth: .2, + layout: 'form', + items: [{ + xtype: 'numberfield', + fieldLabel: "材料数量", + maxValue: 9999, + id: 'count1', + name: 'count1', + disabled: !fillTousseName, + anchor: '100%', + style: 'text-align: left', + allowDecimals: false, + allowNegative: false, + listeners: { + focus: function (thiz) { + thiz.selectText(); + }, + specialkey: function (field, e) { + if (e.getKey() == Ext.EventObject.ENTER) { + addMaterial(top.Ext.getCmp("materialId").getValue(), top.Ext.getCmp("material").getValue(), top.Ext.getCmp("materialType").getValue(), top.Ext.getCmp("isImplant").getValue()); + top.Ext.getCmp("material").focus(); + } + } + } + }] + }, { + columnWidth: .3, + layout: 'form', + items: [{ + xtype: 'button', + text: '添加材料', + disabled: !fillTousseName, + handler: function () { + addMaterial(top.Ext.getCmp("materialId").getValue(), top.Ext.getCmp("material").getValue(), top.Ext.getCmp("materialType").getValue(), top.Ext.getCmp("isImplant").getValue()); + top.Ext.getCmp("material").focus(); + } + }] + }] + }, { + xtype: "fieldset", + autoScroll: true, + id: 'tousseDefinitionList', + title: '器械包列表', + height: 250, + // height : top.screen.height > 1000 ? 210 : 230, + layout: 'fit', + items: [ + tousseLeaseColumnTree + ] }], - buttons : [{ - text : '打印预览', - hidden:false, - handler : function() { - var config = printConfig.application; - var printParams = getPrintJsonParams("print", appId , config); - printApplyGoods(printParams,1,SSTS_PrintApplicationGoods,tousseWin); - } - },{ - text : '打印', - hidden:false, - handler : function() { - var config = printConfig.application; - var printParams = getPrintJsonParams("print", appId , config); - printApplyGoods(printParams,0,SSTS_PrintApplicationGoods,tousseWin); - } - },{ - id : 'saveBtn', - text : '提交', - hidden : btSaveDisabledStatus, - handler : save + buttons: [{ + text: '打印预览', + hidden: false, + handler: function () { + var config = printConfig.application; + var printParams = getPrintJsonParams("print", appId, config); + printApplyGoods(printParams, 1, SSTS_PrintApplicationGoods, tousseWin); + } }, { - text : '取消', - id : 'saveAndNewBtn', - handler : cancel + text: '打印', + hidden: false, + handler: function () { + var config = printConfig.application; + var printParams = getPrintJsonParams("print", appId, config); + printApplyGoods(printParams, 0, SSTS_PrintApplicationGoods, tousseWin); + } + }, { + id: 'saveBtn', + text: '提交', + hidden: btSaveDisabledStatus, + handler: save + }, { + text: '取消', + id: 'saveAndNewBtn', + handler: cancel }] }); //先加载一次,不然选择了申请科室,结算科室无法联动 - departJsonStoreExt2.load(); + departJsonStoreExt2.load(); var winItems; winItems = new Array({ - region : 'center', - layout : 'fit', - items : [formAppObj] + region: 'center', + layout: 'fit', + items: [formAppObj] }); - + tousseWin = new top.Ext.Window({ - id : 'tousseWin', - layout : 'border', - title : '自定义器械包申请单信息', - border : false, - modal : true, - width : 720, -// height : appId==null?400:575, - height :600, - plain : true, - items : winItems + id: 'tousseWin', + layout: 'border', + title: '自定义器械包申请单信息', + border: false, + modal: true, + width: 720, + // height : appId==null?400:575, + height: 600, + plain: true, + items: winItems }); tousseWin.show(); - - if(appId != null && appId > 0 && !isNaN(appId)) { + + if (appId != null && appId > 0 && !isNaN(appId)) { formAppObj.form.load({ - url : WWWROOT + '/disinfectSystem/customRecyclingApplicationAction!getInvoicePlanInfo.do', - method : 'GET', - params : {invoicePlanId : appId}, - waitMsg : '正在加载数据,请稍候', - success : function(form, action) { + url: WWWROOT + '/disinfectSystem/customRecyclingApplicationAction!getInvoicePlanInfo.do', + method: 'GET', + params: { invoicePlanId: appId }, + waitMsg: '正在加载数据,请稍候', + success: function (form, action) { var InvoicePlan = action.result.data; var recyclingStatus = InvoicePlan.recyclingStatus; var deliverStatus = InvoicePlan.deliverStatus; var printed = InvoicePlan.printed; top.Ext.getCmp('applicant').setValue(InvoicePlan.applicant); top.Ext.getCmp('applicationTime').setValue(InvoicePlan.applicationTimeStr); - top.Ext.getCmp('urgency').setValue(InvoicePlan.urgency); + top.Ext.getCmp('urgency').setValue(InvoicePlan.urgency); top.Ext.getCmp("departCoding").setValue(InvoicePlan.departCoding); top.Ext.getCmp("depart").setValue(InvoicePlan.depart); - top.Ext.getCmp('settleAccountsDepart').setValue(InvoicePlan.settleAccountsDepart); + top.Ext.getCmp('settleAccountsDepart').setValue(InvoicePlan.settleAccountsDepart); top.Ext.getCmp('settleAccountsDepartCoding').setValue(InvoicePlan.settleAccountsDepartCoding); top.Ext.getCmp('remark').setValue(InvoicePlan.remark); - top.Ext.getCmp('urgency').setValue(InvoicePlan.urgency); + top.Ext.getCmp('urgency').setValue(InvoicePlan.urgency); var disabledArr = []; - for(var i = 0; i < InvoicePlan.applicationItems.length; i++){ + for (var i = 0; i < InvoicePlan.applicationItems.length; i++) { var idDisabled = true; var tousseItem = InvoicePlan.applicationItems[i]; var isPacked = tousseItem.isPacked; - if((recyclingStatus == '待回收' || recyclingStatus == '') && deliverStatus == '待发货' && printed == 1 && isPacked == false){ + if ((recyclingStatus == '待回收' || recyclingStatus == '') && deliverStatus == '待发货' && printed == 1 && isPacked == false) { idDisabled = false; } - var parentNode = createParentNode(tousseItem.id,tousseItem.tousseName, tousseItem.amount, tousseItem.type, tousseItem.isImplant, tousseItem.price, tousseItem.isRecycling,idDisabled); + var parentNode = createParentNode(tousseItem.id, tousseItem.tousseName, tousseItem.amount, tousseItem.type, tousseItem.isImplant, tousseItem.price, tousseItem.isRecycling, idDisabled); var materials = tousseItem.materials; - for(var j = 0; j < materials.length; j++){ + for (var j = 0; j < materials.length; j++) { var m = materials[j]; createChildNode(parentNode, m.materialId, m.materialName, m.includeImplant, m.materialAmount, m.type); - } + } disabledArr[i] = idDisabled; } - if(disabledArr.indexOf(false) == -1) { + if (disabledArr.indexOf(false) == -1) { top.Ext.getCmp('saveBtn').disable(); } }, - failure : function(form, action) { + failure: function (form, action) { } }); } var isSupplyRoomUser = validateIsSupplyRoomUser(); - if(!isSupplyRoomUser){ + if (!isSupplyRoomUser) { var departComp = top.Ext.getCmp("depart"); departComp.forceSelection = false; departComp.setValue($Id('depart').value); @@ -773,35 +773,35 @@ var departCodingComp = top.Ext.getCmp("departCoding"); departCodingComp.setValue($Id('departCoding').value); } - if(appId == 0) { + if (appId == 0) { //如果一级供应室用户,则光标定位到“申请科室combo”,否则光标定位到“器械包名称combo” if (isSupplyRoomUser) { top.Ext.getCmp("depart").focus('', 10); } else { top.Ext.getCmp("name").focus('', 10); } //申请科室是否为结算科室 - RecyclingApplicationTableManager.isSettleAccountsDepart($Id('departCoding').value,function(yes){ - if(yes){ - if(!isSupplyRoomUser){ + RecyclingApplicationTableManager.isSettleAccountsDepart($Id('departCoding').value, function (yes) { + if (yes) { + if (!isSupplyRoomUser) { top.Ext.getCmp('settleAccountsDepart').setValue($Id('depart').value); top.Ext.getCmp('settleAccountsDepartCoding').setValue($Id('departCoding').value); } } //simon-add:根据申请科室编码查找此申请科室设置的默认结算科室;如果没有配置默认的结算科室,那么结算科室默认显示为可结算的申请科室 DWREngine.setAsync(false); - Ext4.Ajax.request({ - url : WWWROOT + '/disinfectSystem/baseData/supplyRoomConfigAction!getSupplyRoomConfigByCoding.do', - params : {'orgUnitCode':$Id('departCoding').value,'type':3}, - timeout : 600000, - success : function(response, options) { - var result= Ext4.JSON.decode(response.responseText); - if(!isUndefinedOrNullOrEmpty(result.settleAccountsDepart)&&!isUndefinedOrNullOrEmpty(result.settleAccountsDepartCoding)){ - top.Ext.getCmp('settleAccountsDepart').setValue(result.settleAccountsDepart); + Ext4.Ajax.request({ + url: WWWROOT + '/disinfectSystem/baseData/supplyRoomConfigAction!getSupplyRoomConfigByCoding.do', + params: { 'orgUnitCode': $Id('departCoding').value, 'type': 3 }, + timeout: 600000, + success: function (response, options) { + var result = Ext4.JSON.decode(response.responseText); + if (!isUndefinedOrNullOrEmpty(result.settleAccountsDepart) && !isUndefinedOrNullOrEmpty(result.settleAccountsDepartCoding)) { + top.Ext.getCmp('settleAccountsDepart').setValue(result.settleAccountsDepart); top.Ext.getCmp('settleAccountsDepartCoding').setValue(result.settleAccountsDepartCoding); } }, - failure : function(response, opts) { + failure: function (response, opts) { showResult(response.responseText); } }); @@ -812,19 +812,19 @@ -function validateAndSubmitCustom(){ +function validateAndSubmitCustom() { formAppObj.form.submit({ - url : WWWROOT + '/disinfectSystem/customRecyclingApplicationAction!saveCustomRecyclingApplication.do?customType=true', - method : 'POST', - waitMsg : '正在提交数据,请稍候', - waitTitle : '提交表单', - params : {id : parseInt(appId)}, - success : function(form, action) { + url: WWWROOT + '/disinfectSystem/customRecyclingApplicationAction!saveCustomRecyclingApplication.do?customType=true', + method: 'POST', + waitMsg: '正在提交数据,请稍候', + waitTitle: '提交表单', + params: { id: parseInt(appId) }, + success: function (form, action) { tousseWin.destroy(); showResult(action.result.message); grid.dwrReload(); }, - failure : function(form, action) { + failure: function (form, action) { showResult(action.result.message); } }); @@ -833,14 +833,14 @@ function updatePrice() { var price = top.Ext.getCmp('price').getValue(); Ext.Ajax.request({ - url : WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!updatePrice.do', - params : {id : tousseId, price : top.Ext.getCmp('price').getValue()}, - success : function(response, options) { + url: WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!updatePrice.do', + params: { id: tousseId, price: top.Ext.getCmp('price').getValue() }, + success: function (response, options) { tousseWin.destroy(); showResult('更新成功'); }, - failure : function(response, options) { - + failure: function (response, options) { + } }); } @@ -854,7 +854,7 @@ return false; } this.enable(); - if(getCustomTousseInfo()){ + if (getCustomTousseInfo()) { if (!fillTousseName && fillPrice) { updatePrice(); } else { @@ -871,42 +871,42 @@ /** * 添加物品到“器械包列表”中. */ -function addTousseLeaseItemCu(){ +function addTousseLeaseItemCu() { var tousseName = top.Ext.getCmp('name').getValue().trim(); var count = top.Ext.getCmp('count').getValue(); - if(tousseName == ""){ + if (tousseName == "") { showResult("请输入器械包!"); top.Ext.getCmp('name').setValue(""); top.Ext.getCmp('name').focus(); return false; - }else if(count == ""){ + } else if (count == "") { showResult("请输入数量,数量必须大于0!"); return false; - }else if(count > 9999){ + } else if (count > 9999) { showResult("请输入数量,数量不能大于9999!"); return false; } //数据库有非自定义同名包或列表有同名包或验证失败,则不添加 var result; Ext.Ajax.request({ - url : WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!validateCustomTousseDefinitionName.do', - params : {validateId : "",valifateName:tousseName}, - success : function(response, options) { + url: WWWROOT + '/disinfectSystem/baseData/tousseDefinitionAction!validateCustomTousseDefinitionName.do', + params: { validateId: "", valifateName: tousseName }, + success: function (response, options) { result = Ext.decode(response.responseText); - if(result.stauts!=1){//存在相同的器械包名 + if (result.stauts != 1) {//存在相同的器械包名 showResult(result.message); - }else{ + } else { var rootNode = top.Ext.getCmp('tousseLeaseColumnTree').getRootNode(); - if(checkAddedTousseName(tousseName)){ + if (checkAddedTousseName(tousseName)) { //创建父节点 var node = new top.Ext.tree.TreeNode({ - id:Ext.id(), - text:"", - cls:'master-task', - iconCls:'task-folder', - uiProvider:top.Ext.tree.ColumnNodeUI, - leaf:false, - expanded:true + id: Ext.id(), + text: "", + cls: 'master-task', + iconCls: 'task-folder', + uiProvider: top.Ext.tree.ColumnNodeUI, + leaf: false, + expanded: true }); node.attributes.id = '0'; node.attributes.tousseName = tousseName; @@ -915,49 +915,49 @@ node.attributes.isImplant = "否"; node.attributes.isRecycling = "是"; //加0为了解决改器械包列表包名页面正常显示,但其是改fromTousse的值,而tousseName其实不会被修改的问题fromTousse - node.attributes.fromTousse = '0'+tousseName; + node.attributes.fromTousse = '0' + tousseName; //如果添加的器械包有材料就创建子节点 Ext.Ajax.request({ - url : WWWROOT + '/disinfectSystem/customRecyclingApplicationAction!loadLatestMaterialInstanceListByTousseName.do', - params : {customTousseName : tousseName}, - success : function(response, options) { + url: WWWROOT + '/disinfectSystem/customRecyclingApplicationAction!loadLatestMaterialInstanceListByTousseName.do', + params: { customTousseName: tousseName }, + success: function (response, options) { var tousseDefinition = Ext.decode(response.responseText); top.Ext.getCmp('existTousseDefinitionId').setValue(''); var includeImplantStr; - if(tousseDefinition != null){ + if (tousseDefinition != null) { node.attributes.isRecycling = tousseDefinition.isRecycling; top.Ext.getCmp('existTousseDefinitionId').setValue(tousseDefinition.id); - for(var i = 0 ;i < tousseDefinition.materialInstances.length;i++){ + for (var i = 0; i < tousseDefinition.materialInstances.length; i++) { var materialDefinition = tousseDefinition.materialInstances[i].materialDefinition; var materialName = materialDefinition.name; var specification = materialDefinition.specification; - if(specification != null && specification != ''){ - materialName = materialName+"["+specification+"]"; + if (specification != null && specification != '') { + materialName = materialName + "[" + specification + "]"; } createChildNode(node, materialDefinition.id, materialName, materialDefinition.isImplant, tousseDefinition.materialInstances[i].applyAmount, '器械'); } - - for(var i = 0 ; i < tousseDefinition.diposableGoodsItems.length ; i++){ + + for (var i = 0; i < tousseDefinition.diposableGoodsItems.length; i++) { var diposableGoods = tousseDefinition.diposableGoodsItems[i].diposableGoods; createChildNode(node, diposableGoods.id, diposableGoods.name, '', tousseDefinition.diposableGoodsItems[i].amount, '一次性物品'); } node.attributes.toussePrice = tousseDefinition.price; - }else{ + } else { node.attributes.toussePrice = toussePrice; } rootNode.appendChild(node); top.Ext.getCmp('name').setValue(""); top.Ext.getCmp('count').setValue(""); top.Ext.getCmp('name').focus(); }, - failure : function(form, action) { + failure: function (form, action) { } }); } } }, - failure : function(response, options) { + failure: function (response, options) { result = Ext.decode(response.responseText); showResult(result.cause); } @@ -968,29 +968,29 @@ * 获取自定义器械包列表信息 * return 验证合法返回true,并且获取信息设置到隐藏域customTousseInfo,否则返回false */ -function getCustomTousseInfo(){ +function getCustomTousseInfo() { var customTousseInfo = []; var nodes = top.Ext.getCmp('tousseLeaseColumnTree').getRootNode().childNodes; var msg = ""; - if(nodes.length == 0){ + if (nodes.length == 0) { showResult("未添加自定义器械包!"); return false; } //遍历每一个自定义械包 - for (var i = 0; i < nodes.length; i++){ + for (var i = 0; i < nodes.length; i++) { var n = nodes[i]; var tousseName = n.attributes.tousseName || ''; var isImplant = n.attributes.isImplant || ''; - tousseName = (tousseName == '')?'':tousseName.trim(); - isImplant = (isImplant == '')?'':isImplant.trim(); + tousseName = (tousseName == '') ? '' : tousseName.trim(); + isImplant = (isImplant == '') ? '' : isImplant.trim(); var amount = n.attributes.amount; var isRecycling = n.attributes.isRecycling; var partToussePrice = n.attributes.toussePrice; - if(!tousseName){ + if (!tousseName) { msg = "自定义器械包名称不能为空!"; break; } - if(amount <= 0){ + if (amount <= 0) { msg = "自定义器械包数量必须大于0!"; break; } @@ -999,47 +999,47 @@ var materialNameJson = {}; var materialAmountPass = false; //遍历外来器械包下的每一个材料(如果材料名称有重复,则进行提示不予提交) - for (var j=0; j < materialNodes.length; j++){ + for (var j = 0; j < materialNodes.length; j++) { var materialNode = materialNodes[j]; var materialName = materialNode.attributes.material || ''; - materialName = (materialName == '')?'':materialName.trim(); + materialName = (materialName == '') ? '' : materialName.trim(); var count = materialNode.attributes.amount; var materialIsImplant = materialNode.attributes.isImplant || ''; - materialIsImplant = (materialIsImplant == '')?'':materialIsImplant.trim(); - if(!materialName){ + materialIsImplant = (materialIsImplant == '') ? '' : materialIsImplant.trim(); + if (!materialName) { msg = "材料必须填写名称!"; break; } - if(count > 0){ + if (count > 0) { materialAmountPass = true; } materialInfo.push({ - id : materialNode.attributes.id, - name : materialName, - count : count, - includeImplant : materialIsImplant, - tousseType : materialNode.attributes.type + id: materialNode.attributes.id, + name: materialName, + count: count, + includeImplant: materialIsImplant, + tousseType: materialNode.attributes.type }); materialNameJson[materialName] = materialName; } - if(!materialAmountPass && msg == ""){ + if (!materialAmountPass && msg == "") { msg = "材料数量不能都为0!"; break; } customTousseInfo.push({ - id : n.attributes.id, - tousseName : tousseName, - amount : amount, - isRecycling:isRecycling, - isImplant : isImplant, - materials : materialInfo, - price : partToussePrice + id: n.attributes.id, + tousseName: tousseName, + amount: amount, + isRecycling: isRecycling, + isImplant: isImplant, + materials: materialInfo, + price: partToussePrice }); } - if(msg == ""){ + if (msg == "") { top.Ext.getCmp('customTousseInfo').setValue(JSON.stringify(customTousseInfo)); return true; - }else{ + } else { showResult(msg); return false; } @@ -1050,16 +1050,16 @@ * 选择材料:fromTousse:自定义测试包6,material:尖形整形镊[无钩12cm],tousseName:undefined * 选择器械包:fromTousse:自定义测试包6,material:undefined,tousseName:自定义测试包6 */ -function removeTousseLeaseItem2(fromTousse,material,tousseName){ +function removeTousseLeaseItem2(fromTousse, material, tousseName) { var rootNode = top.Ext.getCmp('tousseLeaseColumnTree').getRootNode();; - rootNode.eachChild(function(childNode){ - if(fromTousse == childNode.attributes.fromTousse){ - if(tousseName != 'undefined'){ + rootNode.eachChild(function (childNode) { + if (fromTousse == childNode.attributes.fromTousse) { + if (tousseName != 'undefined') { childNode.remove(); return false; - }else{ - childNode.eachChild(function(grandsonNode){ - if(material == grandsonNode.attributes.material){ + } else { + childNode.eachChild(function (grandsonNode) { + if (material == grandsonNode.attributes.material) { grandsonNode.remove(); return false; } @@ -1074,16 +1074,16 @@ * @param tousseName * @returns {Boolean} */ -function checkAddedTousseName(tousseName){ +function checkAddedTousseName(tousseName) { var rootNode = top.Ext.getCmp('tousseLeaseColumnTree').getRootNode(); var isTousseAlreadyAdded = false; - rootNode.eachChild(function(pNode){ - if(pNode.attributes.tousseName == tousseName){ + rootNode.eachChild(function (pNode) { + if (pNode.attributes.tousseName == tousseName) { isTousseAlreadyAdded = true; return false; } }); - if(isTousseAlreadyAdded){ + if (isTousseAlreadyAdded) { showResult("该器械包已经在列表中!"); return false; } @@ -1098,17 +1098,17 @@ * @param count * @param type */ -function createChildNode(parentNode, id, materialName, isImplant, count, type){ +function createChildNode(parentNode, id, materialName, isImplant, count, type) { //创建子节点 var childNode = new top.Ext.tree.TreeNode({ - id:Ext.id(), - text:"", - iconCls:'task', - uiProvider:top.Ext.tree.ColumnNodeUI, - leaf:true, - expanded:true + id: Ext.id(), + text: "", + iconCls: 'task', + uiProvider: top.Ext.tree.ColumnNodeUI, + leaf: true, + expanded: true }); - if(isImplant == "是"){ + if (isImplant == "是") { parentNode.attributes.isImplant = isImplant; } childNode.attributes.id = id; @@ -1117,20 +1117,20 @@ childNode.attributes.type = type; childNode.attributes.isImplant = isImplant; //加0为了解决改器械包列表包名页面正常显示,但其是改fromTousse的值,而tousseName其实不会被修改的问题fromTousse - childNode.attributes.fromTousse = "0"+parentNode.attributes.tousseName; - parentNode.insertBefore(childNode,parentNode.firstChild); + childNode.attributes.fromTousse = "0" + parentNode.attributes.tousseName; + parentNode.insertBefore(childNode, parentNode.firstChild); } -function createParentNode(id, tousseName, count, type, isImplant, toussePrice,isRecycling,idDisabled){ +function createParentNode(id, tousseName, count, type, isImplant, toussePrice, isRecycling, idDisabled) { var rootNode = top.Ext.getCmp('tousseLeaseColumnTree').getRootNode(); //创建父节点 var node = new top.Ext.tree.TreeNode({ - id:Ext.id(), - text:"", - cls:'master-task', - iconCls:'task-folder', - uiProvider:top.Ext.tree.ColumnNodeUI, - leaf:false, - expanded:true + id: Ext.id(), + text: "", + cls: 'master-task', + iconCls: 'task-folder', + uiProvider: top.Ext.tree.ColumnNodeUI, + leaf: false, + expanded: true }); node.attributes.id = id; node.attributes.tousseName = tousseName; @@ -1141,7 +1141,7 @@ node.attributes.toussePrice = toussePrice; node.attributes.idDisabled = idDisabled; //加0为了解决改器械包列表包名页面正常显示,但其是改fromTousse的值,而tousseName其实不会被修改的问题fromTousse - node.attributes.fromTousse = '0'+tousseName; + node.attributes.fromTousse = '0' + tousseName; rootNode.appendChild(node); return node; }