Index: ssts-web/src/main/webapp/disinfectsystem/returnMaterialRecord/returnMaterialRecordForm.js =================================================================== diff -u -r30072 -r33468 --- ssts-web/src/main/webapp/disinfectsystem/returnMaterialRecord/returnMaterialRecordForm.js (.../returnMaterialRecordForm.js) (revision 30072) +++ ssts-web/src/main/webapp/disinfectsystem/returnMaterialRecord/returnMaterialRecordForm.js (.../returnMaterialRecordForm.js) (revision 33468) @@ -1,30 +1,30 @@ -function setReturnMaterialRecordForm(result){ +function setReturnMaterialRecordForm(result) { var returnGoodsRecord = top.Ext.decode(result); - if(returnGoodsRecord.success){ + if (returnGoodsRecord.success) { top.Ext.getCmp("id").setValue(returnGoodsRecord.id); top.Ext.getCmp("operator").setValue(returnGoodsRecord.operator); top.Ext.getCmp("depart").setValue(returnGoodsRecord.depart); top.Ext.getCmp("settleAccountsDepart").setValue(returnGoodsRecord.settleAccountsDepart); top.Ext.getCmp("settleAccountsDepartCoding").setValue(returnGoodsRecord.settleAccountsDepartCoding); top.Ext.getCmp("returnTime").setValue(returnGoodsRecord.returnTime); -// Ext.getCmp("signStatus").setValue(returnGoodsRecord.signStatus); + // Ext.getCmp("signStatus").setValue(returnGoodsRecord.signStatus); top.Ext.getCmp("remark").setValue(returnGoodsRecord.remark); top.Ext.getCmp("returnOfPeople").setValue(returnGoodsRecord.returnOfPeople); top.Ext.getCmp("departCoding").setValue(returnGoodsRecord.departCoding); -// top.Ext.getCmp("totalMoney").setValue(returnGoodsRecord.settlementPrice); -// var warehouse = top.Ext.getCmp("warehouse"); -// if(warehouse != null){ -// warehouse.setValue(returnGoodsRecord.warehouseName); -// } + // top.Ext.getCmp("totalMoney").setValue(returnGoodsRecord.settlementPrice); + // var warehouse = top.Ext.getCmp("warehouse"); + // if(warehouse != null){ + // warehouse.setValue(returnGoodsRecord.warehouseName); + // } } } -function removeGridItem(){ +function removeGridItem() { var totalMoney = 0.0; var rows = top.Ext.getCmp('returnGoodsItemGrid').getSelectionModel().getSelections();// 返回值为 if (rows) { - for ( var i = 0; i < rows.length; i++) { + for (var i = 0; i < rows.length; i++) { returnGoodsItemStore.remove(rows[i]); } } @@ -33,183 +33,183 @@ function setTotalMoney() { var totalMoney = 0.0; - returnGoodsItemStore.each(function(record){ - totalMoney = accAdd(totalMoney,accMul(record.data.price,record.data.amount)); + returnGoodsItemStore.each(function (record) { + totalMoney = accAdd(totalMoney, accMul(record.data.price, record.data.amount)); totalMoney = (totalMoney).toFixed(2); }); - top.Ext.getCmp("totalMoney").setValue(totalMoney); + top.Ext.getCmp("totalMoney").setValue(totalMoney); } /** * 精确计算arg1和arg2的和 * @param arg1 * @param arg2 * @return */ -function accAdd(arg1,arg2){ - var r1,r2,m; - try{r1=arg1.toString().split(".")[1].length;}catch(e){r1=0;} - try{r2=arg2.toString().split(".")[1].length;}catch(e){r2=0;} - m=Math.pow(10,Math.max(r1,r2)); - return (arg1*m+arg2*m)/m; +function accAdd(arg1, arg2) { + var r1, r2, m; + try { r1 = arg1.toString().split(".")[1].length; } catch (e) { r1 = 0; } + try { r2 = arg2.toString().split(".")[1].length; } catch (e) { r2 = 0; } + m = Math.pow(10, Math.max(r1, r2)); + return (arg1 * m + arg2 * m) / m; } /** * 精确计算arg1和arg2的乘积 * @param arg1 * @param arg2 * @return */ -function accMul(arg1,arg2) { - arg1 = arg1+''; - arg2 = arg2+''; -// alert('arg1='+arg1+',arg2='+arg2) - var m=0,s1=arg1.toString(),s2=arg2.toString(); - try{m+=s1.split(".")[1].length;}catch(e){} - try{m+=s2.split(".")[1].length;}catch(e){} - return Number(s1.replace(".",""))*Number(s2.replace(".",""))/Math.pow(10,m); -} +function accMul(arg1, arg2) { + arg1 = arg1 + ''; + arg2 = arg2 + ''; + // alert('arg1='+arg1+',arg2='+arg2) + var m = 0, s1 = arg1.toString(), s2 = arg2.toString(); + try { m += s1.split(".")[1].length; } catch (e) { } + try { m += s2.split(".")[1].length; } catch (e) { } + return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m); +} -function addAndEditReturnMaterialRecord(id, enableBtn){ - function checkAmount(amount,canReturnAmout){ - if(parseInt(amount) > parseInt(canReturnAmout)){ +function addAndEditReturnMaterialRecord(id, enableBtn) { + function checkAmount(amount, canReturnAmout) { + if (parseInt(amount) > parseInt(canReturnAmout)) { showResult('退货数量不能大于可退货数量'); return false; } return true; } // 添加材料 - function onAddMaterialClick(){ + function onAddMaterialClick() { var count = top.Ext.getCmp("count1").getValue(); var materialDefId = top.Ext.getCmp('selectedMaterialDefId').getValue(); - var mindex = materialStore.find("id",materialDefId); - if(mindex == -1){ + var mindex = materialStore.find("id", materialDefId); + if (mindex == -1) { showResult('请选择材料'); return; } var price = top.Ext.getCmp("combo_price").getValue(); - if(price+'' == ''){ + if (price + '' == '') { showResult('请选择价格!'); return; } var priceAmount = null; var pindex = priceStore.find('price', price); - if(pindex == -1){ + if (pindex == -1) { showResult('请选择价格!'); return; } priceAmount = priceStore.getAt(pindex).data; - + var amountCanReturn = priceAmount.sentAmount - priceAmount.returnedAmount; var material = materialStore.getAt(mindex); - if(!checkAmount(count,amountCanReturn)){ + if (!checkAmount(count, amountCanReturn)) { return; } var materialItem = new addReturnMaterialItem({ - id:0, - materialName:material.data.name, - amount:count, - price:price, - amountCanReturn:amountCanReturn, - materialDefinitionId:materialDefId + id: 0, + materialName: material.data.name, + amount: count, + price: price, + amountCanReturn: amountCanReturn, + materialDefinitionId: materialDefId }); - + returnGoodsItemStore.add(materialItem); setTotalMoney(); } - - var editableConfig = {editable:false}; + + var editableConfig = { editable: false }; editableConfig.editable = enableBtn; //材料store var materialStore = new Ext.data.Store({ - pageSize: 100, - proxy : new Ext.data.HttpProxy({ - url : WWWROOT + '/disinfectSystem/baseData/materialDefinitionAction!getMaterialDataForReturnMaterialByDepart.do', - method : 'POST' + pageSize: 100, + proxy: new Ext.data.HttpProxy({ + url: WWWROOT + '/disinfectSystem/baseData/materialDefinitionAction!getMaterialDataForReturnMaterialByDepart.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 : 'displayName',mapping : 'displayName'}, - {name : 'spelling',mapping : 'spelling'}, - {name : 'storage',mapping : 'storage'} + { name: 'id', mapping: 'id' }, + { name: 'name', mapping: 'name' }, + { name: 'displayName', mapping: 'displayName' }, + { name: 'spelling', mapping: 'spelling' }, + { name: 'storage', mapping: 'storage' } ]), - listeners : { - beforeload : function(store,option) { + listeners: { + beforeload: function (store, option) { store.baseParams['departCoding'] = getCurrentDepartCoding(); store.baseParams['settleAccountsDepartCoding'] = getSettleAccountsDepartCoding(); } } }); - + var departJsonStore = new Ext.data.Store({ - proxy : new Ext.data.HttpProxy({ - url : WWWROOT + '/disinfectSystem/baseData/supplyRoomConfigAction!getAllOrgUnitName.do', - method : 'POST' + proxy: new Ext.data.HttpProxy({ + url: WWWROOT + '/disinfectSystem/baseData/supplyRoomConfigAction!getAllOrgUnitName.do', + method: 'POST' }), - reader : new Ext.data.JsonReader({ - root : 'data' - },[ - {name : 'id',mapping : 'id'}, - {name : 'name',mapping : 'name'} - ] + reader: new Ext.data.JsonReader({ + root: 'data' + }, [ + { name: 'id', mapping: 'id' }, + { name: 'name', mapping: 'name' } + ] ) }); - - var addReturnMaterialItem = Ext.data.Record.create([{name : 'id'}, - {name : 'materialName'}, - {name : 'amount'}, - {name : 'price'}, - {name : 'amountCanReturn'}, - {name : 'materialDefinitionId'}, - {name : 'settlementPrice'}]); - + + var addReturnMaterialItem = Ext.data.Record.create([{ name: 'id' }, + { name: 'materialName' }, + { name: 'amount' }, + { name: 'price' }, + { name: 'amountCanReturn' }, + { name: 'materialDefinitionId' }, + { name: 'settlementPrice' }]); + //该退货记录已经录入的退货详细信息 var dataReader = new Ext.data.JsonReader({ - fields : [ - {name : 'id'}, - {name : 'materialName'}, - {name : 'price'}, - {name : 'amount'}, - {name : 'materialDefinitionId'}, - {name : 'settlementPrice'} + fields: [ + { name: 'id' }, + { name: 'materialName' }, + { name: 'price' }, + { name: 'amount' }, + { name: 'materialDefinitionId' }, + { name: 'settlementPrice' } ] }); //初始化加载器械包 returnGoodsItemStore = new Ext.data.Store({ - proxy : new Ext.data.HttpProxy({ - url : WWWROOT + '/disinfectSystem/returnMaterialRecordAction!loadReturnMaterialItem.do', - method : 'POST' + proxy: new Ext.data.HttpProxy({ + url: WWWROOT + '/disinfectSystem/returnMaterialRecordAction!loadReturnMaterialItem.do', + method: 'POST' }), - reader : dataReader, - listeners : { - load : function() { + reader: dataReader, + listeners: { + load: function () { setTotalMoney(); } } }); var wareHouseStore = new Ext.data.Store({ - proxy : new Ext.data.HttpProxy({ - url : WWWROOT + '/disinfectSystem/baseData/wareHouseAction!getWareHouseData.do', - method : 'POST' + proxy: new Ext.data.HttpProxy({ + url: WWWROOT + '/disinfectSystem/baseData/wareHouseAction!getWareHouseData.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 : 'orgUnitCode',mapping : 'orgUnitCode'}, + { name: 'id', mapping: 'id' }, + { name: 'name', mapping: 'name' }, + { name: 'orgUnitCode', mapping: 'orgUnitCode' }, ]), - listeners : { - load : function(store,records) { + listeners: { + load: function (store, records) { var id = top.Ext.getCmp('warehouseId').getValue(); var name = top.Ext.getCmp('warehouseName').getValue(); - if(records.length > 0 && (id == null || id == '')){ - id=records[0].data.id; + if (records.length > 0 && (id == null || id == '')) { + id = records[0].data.id; name = records[0].data.name; } top.Ext.getCmp('warehouse').setValue(id); @@ -218,85 +218,85 @@ } } }); - + var priceStore = new Ext.data.Store({ - reader : new Ext.data.JsonReader({ - fields : [ - {name : 'price'}, - {name : 'sentAmount'}, - {name : 'returnedAmount'} + reader: new Ext.data.JsonReader({ + fields: [ + { name: 'price' }, + { name: 'sentAmount' }, + { name: 'returnedAmount' } ] }) }); var PriceRecord = Ext.data.Record.create([ - {name : 'price'}, - {name : 'sentAmount'}, - {name : 'returnedAmount'} - ]); + { name: 'price' }, + { name: 'sentAmount' }, + { name: 'returnedAmount' } + ]); //清空价格 function clearPrice() { priceStore.removeAll(); top.Ext.getCmp("combo_price").setValue(''); } - + // 设置价格 function setPrices(prices) { priceStore.removeAll(); top.Ext.getCmp("combo_price").setValue(''); - if(typeof(prices) == 'undefined' || prices == null){ + if (typeof (prices) == 'undefined' || prices == null) { return; } - for(var i = 0;i 0){ + if (prices.length > 0) { top.Ext.getCmp("combo_price").setValue(prices[0].price); } } - + // 获取当前部门编码 - function getCurrentDepartCoding(){ + function getCurrentDepartCoding() { return top.Ext.getCmp('departCoding').getValue(); } // 获取结算科室的编码 - function getSettleAccountsDepartCoding(){ + function getSettleAccountsDepartCoding() { return top.Ext.getCmp('settleAccountsDepartCoding').getValue(); } //获取当前部门 - function getCurrentDepart(){ + function getCurrentDepart() { return top.Ext.getCmp('depart').getValue(); } // 器械包,科室退货人为空时才能更改退货人科室 - function loadPeopleByStaffNum(staffNumField){ + function loadPeopleByStaffNum(staffNumField) { var staffNum = staffNumField.getValue(); - if(staffNum){ - UserTableManager.getUserObjByName(staffNum,function(user){ - if(user){ + if (staffNum) { + UserTableManager.getUserObjByName(staffNum, function (user) { + if (user) { var fullName = user.split(",")[0]; var orgUnitNames = user.split(",")[1]; var orgUnitCodes = user.split(",")[2]; top.Ext.getCmp('returnOfPeople').setValue(fullName);//设置退货人 var currentDepart = getCurrentDepart(); var currentDepartCoding = getCurrentDepartCoding(); var resetDepart = true; - if(currentDepart != '' || currentDepartCoding != ''){ + if (currentDepart != '' || currentDepartCoding != '') { resetDepart = false; } - if(resetDepart){ - if(orgUnitNames){ + if (resetDepart) { + if (orgUnitNames) { var orgUnitName = orgUnitNames.split(';')[0];//如果有多个,默认拿第一个,当前系统只有一个; - top.Ext.getCmp('depart').setValue(orgUnitName.substring(orgUnitName.lastIndexOf("-")+1));//设置科室 + top.Ext.getCmp('depart').setValue(orgUnitName.substring(orgUnitName.lastIndexOf("-") + 1));//设置科室 } - if(orgUnitCodes){ + if (orgUnitCodes) { var orgUnitCode = orgUnitCodes.split(';')[0]; top.Ext.getCmp('departCoding').setValue(orgUnitCode);//科室代码 } } - - }else{ + + } else { showResult('找不到该员工号所对应的人员信息'); top.Ext.getCmp('returnOfPeople').setValue(); top.Ext.getCmp('depart').setValue(); @@ -305,18 +305,18 @@ updateGoodsComboStatus(); }); } - staffNumField.setValue(); + staffNumField.setValue(); } - - function updateGoodsComboStatus(){ + + function updateGoodsComboStatus() { var departcoding = getCurrentDepartCoding(); var disable = false; - if(isUndefinedOrNullOrEmpty(departcoding)){ + if (isUndefinedOrNullOrEmpty(departcoding)) { disable = true; } top.Ext.getCmp('package1').setDisabled(disable); } - + //获取grid的数据 function getReturnGoodsDetailGridData() { var returnGoodsDetails = buildJSONStringFromStore(returnGoodsItemStore); @@ -325,39 +325,41 @@ } //计算行总价 function rowTotalRender(value, cellmeta, record, rowIndex, columnIndex, store) { - return accMul(record.data.price,record.data.amount); + return accMul(record.data.price, record.data.amount); } var cmArr = new Array(new Ext.grid.RowNumberer(), - {id : 'autoWidth',header : "物品",dataIndex : 'materialName',width : 180,menuDisabled:true}, - {header : "数量",width : 50,dataIndex : 'amount',menuDisabled:true, - editor : new top.Ext.form.NumberField({ - allowBlank : false, - disabled:!enableBtn, - allowNegative : false, - style : 'text-align: left', - allowDecimals : false + { id: 'autoWidth', header: "物品", dataIndex: 'materialName', width: 180, menuDisabled: true }, + { + header: "数量", width: 50, dataIndex: 'amount', menuDisabled: true, + editor: new top.Ext.form.NumberField({ + allowBlank: false, + disabled: !enableBtn, + allowNegative: false, + style: 'text-align: left', + allowDecimals: false }) }, - {header : "可退货数量",width : 120,dataIndex : 'amountCanReturn',menuDisabled:true}, - {header : "单价",width : 120,dataIndex : 'price',menuDisabled:true}, - {header : "金额",width : 60,dataIndex : 'rowTotal',renderer:rowTotalRender,menuDisabled:true}, - {header : '删除',dataIndex:'button',width:60,menuDisabled:true, - renderer: function(v,p,record){ + { header: "可退货数量", width: 120, dataIndex: 'amountCanReturn', menuDisabled: true }, + { header: "单价", width: 120, dataIndex: 'price', menuDisabled: true }, + { header: "金额", width: 60, dataIndex: 'rowTotal', renderer: rowTotalRender, menuDisabled: true }, + { + header: '删除', dataIndex: 'button', width: 60, menuDisabled: true, + renderer: function (v, p, record) { var str = ''; - if(editableConfig.editable){ + if (editableConfig.editable) { str = ""; } - + return str; } }); - + var cm = new top.Ext.grid.ColumnModel(cmArr); - if(id == 0){//添加 + if (id == 0) {//添加 returnGoodsItemStore.removeAll(); - }else{//修改 - returnGoodsItemStore.on("beforeload", function(thiz, options) { + } else {//修改 + returnGoodsItemStore.on("beforeload", function (thiz, options) { thiz.baseParams["id"] = id; }); returnGoodsItemStore.load(); @@ -369,140 +371,140 @@ });*/ form = new top.Ext.FormPanel({ - id : 'returnGoodsRecordForm', - frame : true, - border : 0, - labelSeparator : ':', - bodyStyle : 'padding:5px 5px 0px 5px', - width : 600, - labelAlign:'right', - autoHeight : true, - autoScroll : true, - viewConfig:{ - labelWidth:80 + id: 'returnGoodsRecordForm', + frame: true, + border: 0, + labelSeparator: ':', + bodyStyle: 'padding:5px 5px 0px 5px', + width: 600, + labelAlign: 'right', + autoHeight: true, + autoScroll: true, + viewConfig: { + labelWidth: 80 }, - items : [{ - xtype:"fieldset", - layout:'column', - title :'退货记录信息', - autoHeight:true, - items:[{ - layout : 'column', - items : [{ - xtype : 'hidden', - name : 'id', - id : 'id' - },{ - xtype : 'hidden', - name : 'returnMaterialItems', - id : 'returnMaterialItems' - },{ - xtype : 'hidden', - name : 'departCoding', - id : 'departCoding' - },{ - xtype : 'hidden', - name : 'warehouseId', - id : 'warehouseId' - },{ - xtype : 'hidden', - name : 'warehouseName', - id : 'warehouseName' - },{ - xtype:'hidden', - name:'selectedMaterialDefId', - id:'selectedMaterialDefId' - },{ - columnWidth : .5, - layout : 'form', - items : [{ - xtype : 'textfield', - fieldLabel : '操作人', - maxLength : '16', - id : 'operator', - name : 'operator', - allowBlank : false, - value : $Id('userName').value, - anchor : '80%', - readOnly : true, - cls:'fieldReadOnlyNoRemove' + items: [{ + xtype: "fieldset", + layout: 'column', + title: '退货记录信息', + autoHeight: true, + items: [{ + layout: 'column', + items: [{ + xtype: 'hidden', + name: 'id', + id: 'id' + }, { + xtype: 'hidden', + name: 'returnMaterialItems', + id: 'returnMaterialItems' + }, { + xtype: 'hidden', + name: 'departCoding', + id: 'departCoding' + }, { + xtype: 'hidden', + name: 'warehouseId', + id: 'warehouseId' + }, { + xtype: 'hidden', + name: 'warehouseName', + id: 'warehouseName' + }, { + xtype: 'hidden', + name: 'selectedMaterialDefId', + id: 'selectedMaterialDefId' + }, { + columnWidth: .5, + layout: 'form', + items: [{ + xtype: 'textfield', + fieldLabel: '操作人', + maxLength: '16', + id: 'operator', + name: 'operator', + allowBlank: false, + value: $Id('userName').value, + anchor: '80%', + readOnly: true, + cls: 'fieldReadOnlyNoRemove' }] }, { - columnWidth : .5, - layout : 'form', - items : [{ - xtype : 'datefieldWithMin', - fieldLabel : '时间', - id : 'returnTime', - name : 'returnTime', - editable:false, - disabled:!editableConfig.editable, + columnWidth: .5, + layout: 'form', + items: [{ + xtype: 'datefieldWithMin', + fieldLabel: '时间', + id: 'returnTime', + name: 'returnTime', + editable: false, + disabled: !editableConfig.editable, allowBlank: false, - format:'Y-m-d H:i', -// value: new Date(), - anchor : '80%', - listeners : { - render : function() {//器械包的退货时间,取服务器时间 (cjr) - (!id) ? setStartDate(top.Ext, 'yyyy/MM/dd HH:mm', 'returnTime') : (function(){})(); + format: 'Y-m-d H:i', + // value: new Date(), + anchor: '80%', + listeners: { + render: function () {//器械包的退货时间,取服务器时间 (cjr) + (!id) ? setStartDate(top.Ext, 'yyyy/MM/dd HH:mm', 'returnTime') : (function () { })(); } } }] }, { - columnWidth : .5, - layout : 'form', - items : [{ - xtype : 'textfield', - fieldLabel : '退货人员工号', - id : 'returnOfPeopleBarcode', - name : 'returnOfPeopleBarcode', - disabled:!editableConfig.editable, - allowBlank : true, - listeners : { - specialkey : function(field,e){ - if(e.getKey() == 13){ + columnWidth: .5, + layout: 'form', + items: [{ + xtype: 'textfield', + fieldLabel: '退货人员工号', + id: 'returnOfPeopleBarcode', + name: 'returnOfPeopleBarcode', + disabled: !editableConfig.editable, + allowBlank: true, + listeners: { + specialkey: function (field, e) { + if (e.getKey() == 13) { loadPeopleByStaffNum(field); } } }, - anchor : '80%' + anchor: '80%' }] - } ,{ - columnWidth : .5, - layout : 'form', - items : [{ - xtype : 'textfield', - fieldLabel : '退货人', - id : 'returnOfPeople', - name : 'returnOfPeople', - allowBlank : true, - anchor : '80%', - readOnly : true, - cls:'x-item-disabled' + }, { + columnWidth: .5, + layout: 'form', + items: [{ + xtype: 'textfield', + fieldLabel: '退货人', + id: 'returnOfPeople', + name: 'returnOfPeople', + allowBlank: true, + anchor: '80%', + readOnly: true, + cls: 'x-item-disabled' }] - } , { - columnWidth : .5, - layout : 'form', - items : [{ - xtype : 'combo', - id : 'depart', - name : 'depart', - disabled:!editableConfig.editable, - queryParam : 'spell', - fieldLabel : '退货人科室', - queryParam : 'spell', - minChars : 0, - valueField : 'name', - displayField : 'name', - anchor : '80%', - store : departJsonStore, - forceSelection : true, - lazyInit : true, - triggerAction : 'all', - hideTrigger : true, - typeAhead : false, - allowBlank : false, - listeners :{ - select:function(combo, record, index ){ + }, { + columnWidth: .5, + layout: 'form', + items: [{ + xtype: 'combo', + id: 'depart', + name: 'depart', + disabled: !editableConfig.editable, + queryParam: 'spell', + fieldLabel: '退货人科室', + queryParam: 'spell', + minChars: 0, + valueField: 'name', + displayField: 'name', + anchor: '80%', + store: departJsonStore, + forceSelection: true, + lazyInit: true, + triggerAction: 'all', + hideTrigger: true, + typeAhead: false, + allowBlank: false, + listeners: { + select: function (combo, record, index) { var tem = record.data.id; top.Ext.getCmp('departCoding').setValue(tem); returnGoodsItemStore.removeAll(); @@ -533,335 +535,335 @@ name: 'settleAccountsDepartCoding', id: 'settleAccountsDepartCoding' }, { - columnWidth : .5, - layout : 'form', - items : [{ - xtype : 'combo', - id : 'settleAccountsDepart', - name : 'settleAccountsDepart', - disabled:!editableConfig.editable, - queryParam : 'spell', - fieldLabel : '结算科室', - queryParam : 'spell', - minChars : 0, - valueField : 'name', - displayField : 'name', - anchor : '80%', - store : departJsonStore, - forceSelection : true, - lazyInit : true, - triggerAction : 'all', - hideTrigger : true, - typeAhead : false, - allowBlank : false, - listeners:{ - select:function(combo, record, index ){ + columnWidth: .5, + layout: 'form', + items: [{ + xtype: 'combo', + id: 'settleAccountsDepart', + name: 'settleAccountsDepart', + disabled: !editableConfig.editable, + queryParam: 'spell', + fieldLabel: '结算科室', + queryParam: 'spell', + minChars: 0, + valueField: 'name', + displayField: 'name', + anchor: '80%', + store: departJsonStore, + forceSelection: true, + lazyInit: true, + triggerAction: 'all', + hideTrigger: true, + typeAhead: false, + allowBlank: false, + listeners: { + select: function (combo, record, index) { returnGoodsItemStore.removeAll(); var tem = record.data.id; top.Ext.getCmp('settleAccountsDepartCoding').setValue(tem); } } }] - } ,{ - columnWidth : .5, - layout : 'form', - items:[{ - xtype : 'combo', - fieldLabel : '退货仓库', - id : 'warehouse', - name : 'warehouse', - minChars : 0, - valueField : 'id', - displayField : 'name', - store : wareHouseStore, - forceSelection : true, - lazyInit : false, - triggerAction : 'all', - hideTrigger : true, - typeAhead : false, - anchor : '80%', - allowBlank : false, - listeners : { - select : function(combo, record, index) { + }, { + columnWidth: .5, + layout: 'form', + items: [{ + xtype: 'combo', + fieldLabel: '退货仓库', + id: 'warehouse', + name: 'warehouse', + minChars: 0, + valueField: 'id', + displayField: 'name', + store: wareHouseStore, + forceSelection: true, + lazyInit: false, + triggerAction: 'all', + hideTrigger: true, + typeAhead: false, + anchor: '80%', + allowBlank: false, + listeners: { + select: function (combo, record, index) { top.Ext.getCmp('warehouse').setValue(record.data.name); top.Ext.getCmp('warehouseId').setValue(record.data.id); top.Ext.getCmp('warehouseName').setValue(record.data.name); top.Ext.getCmp('remark').focus(); }, - specialkey : function(field, ee) { + specialkey: function (field, ee) { if (ee.getKey() == Ext.EventObject.ENTER) { top.Ext.getCmp('remark').focus(); } } } - }] - },{ - columnWidth : .5, - layout : 'form', - items : [{ - xtype : 'textfield', - fieldLabel : '总金额', - maxLength : '16', - id : 'totalMoney', - name : 'totalMoney', - anchor : '80%', - readOnly : true, - cls:'x-item-disabled' }] - },{ - columnWidth : 1, - layout : 'form', - items : [{ - xtype : 'textarea', - height : 45, - fieldLabel : '备注', - id : 'remark', - name : 'remark', - disabled:!editableConfig.editable, - allowBlank : true, - anchor : '90%' + }, { + columnWidth: .5, + layout: 'form', + items: [{ + xtype: 'textfield', + fieldLabel: '总金额', + maxLength: '16', + id: 'totalMoney', + name: 'totalMoney', + anchor: '80%', + readOnly: true, + cls: 'x-item-disabled' }] + }, { + columnWidth: 1, + layout: 'form', + items: [{ + xtype: 'textarea', + height: 45, + fieldLabel: '备注', + id: 'remark', + name: 'remark', + disabled: !editableConfig.editable, + allowBlank: true, + anchor: '90%' + }] }] }] - },{ - xtype:"fieldset", - layout:'column', - title :'退货记录明细', - autoHeight:true, - items:[{ - layout : 'form', - columnWidth : 1, - items :[new top.Ext.grid.EditorGridPanel({ - id : 'returnGoodsItemGrid', - store : returnGoodsItemStore, - bodyStyle : 'border:1px solid #afd7af', - cm : cm, - width :720, - height : 270, - autoExpandColumn : 'autoWidth', - border : true, - frame : false, + }, { + xtype: "fieldset", + layout: 'column', + title: '退货记录明细', + autoHeight: true, + items: [{ + layout: 'form', + columnWidth: 1, + items: [new top.Ext.grid.EditorGridPanel({ + id: 'returnGoodsItemGrid', + store: returnGoodsItemStore, + bodyStyle: 'border:1px solid #afd7af', + cm: cm, + width: 720, + height: 270, + autoExpandColumn: 'autoWidth', + border: true, + frame: false, viewConfig: { - forceFit:true + forceFit: true }, - clicksToEdit : 1,// 设置点击几次才可编辑 - selModel : new top.Ext.grid.RowSelectionModel({ - singleSelect : false + clicksToEdit: 1,// 设置点击几次才可编辑 + selModel: new top.Ext.grid.RowSelectionModel({ + singleSelect: false }), - tbar : new top.Ext.Panel({ - border: false, - items:[{ - xtype: 'toolbar', - items: [{ - text : '物品名称 :' - },{ - disabled:!enableBtn, - xtype : 'combo', - id : 'package1', - name : 'package1', - queryParam : 'spell', - minChars : 0, - valueField : 'id', - displayField : 'displayName', - width : 250, - store : materialStore, - pageSize : 100, - listConfig: {width: 300}, - forceSelection : true, - lazyInit : true, - triggerAction : 'all', - hideTrigger : true, - emptyText : '材料的拼音码、五笔码或者名称', - typeAhead : false, - allowBlank : true, - disabled:true, - anchor : '97%', - listeners : { - select : function(combo, record, index) { - top.Ext.getCmp('package1').setValue(); - var depart = getCurrentDepart(); - if(depart == ''){ - showResult("必须先填写部门!"); - return ; - } - var warehouseId = top.Ext.getCmp("warehouseId").getValue(); - if(isUndefinedOrNullOrEmpty(warehouseId)){ - showResult('请先选择仓库!'); - return ; - } - /* - Ext.Ajax.request({ - url: WWWROOT + '/disinfectSystem/baseData/materialDefinitionAction!getMaterialDataForReturnMaterialByDepart.do', - params: { - departCoding: getCurrentDepartCoding(), - settleAccountsDepartCoding:getSettleAccountsDepartCoding() - }, - success: function (response, options) { - var result = Ext.decode(response.responseText); - if(result != null){ - setPrices(result); - } + tbar: new top.Ext.Panel({ + border: false, + items: [{ + xtype: 'toolbar', + items: [{ + text: '物品名称 :' + }, { + disabled: !enableBtn, + xtype: 'combo', + id: 'package1', + name: 'package1', + queryParam: 'spell', + minChars: 0, + valueField: 'id', + displayField: 'displayName', + width: 250, + store: materialStore, + pageSize: 100, + listConfig: { width: 300 }, + forceSelection: true, + lazyInit: true, + triggerAction: 'all', + hideTrigger: true, + emptyText: '材料的拼音码、五笔码或者名称', + typeAhead: false, + allowBlank: true, + disabled: true, + anchor: '97%', + listeners: { + select: function (combo, record, index) { + top.Ext.getCmp('package1').setValue(); + var depart = getCurrentDepart(); + if (depart == '') { + showResult("必须先填写部门!"); + return; + } + var warehouseId = top.Ext.getCmp("warehouseId").getValue(); + if (isUndefinedOrNullOrEmpty(warehouseId)) { + showResult('请先选择仓库!'); + return; + } + /* + Ext.Ajax.request({ + url: WWWROOT + '/disinfectSystem/baseData/materialDefinitionAction!getMaterialDataForReturnMaterialByDepart.do', + params: { + departCoding: getCurrentDepartCoding(), + settleAccountsDepartCoding:getSettleAccountsDepartCoding() + }, + success: function (response, options) { + var result = Ext.decode(response.responseText); + if(result != null){ + setPrices(result); } - });*/ - ReturnMaterialRecordTableManager.loadMaterialPriceAmountInfoCanReturned( - getCurrentDepartCoding(),getSettleAccountsDepartCoding(),record.data.id,warehouseId,function(priceAmountList){ - if(priceAmountList != null){ - setPrices(priceAmountList); - } - }) - top.Ext.getCmp('package1').setValue(record.data.name); - top.Ext.getCmp('selectedMaterialDefId').setValue(record.data.id); - }, - specialkey : function(field, ee) { - if (ee.getKey() == Ext.EventObject.ENTER) { - top.Ext.getCmp('count1').focus(); } + });*/ + ReturnMaterialRecordTableManager.loadMaterialPriceAmountInfoCanReturned( + getCurrentDepartCoding(), getSettleAccountsDepartCoding(), record.data.id, warehouseId, function (priceAmountList) { + if (priceAmountList != null) { + setPrices(priceAmountList); + } + }) + top.Ext.getCmp('package1').setValue(record.data.name); + top.Ext.getCmp('selectedMaterialDefId').setValue(record.data.id); + }, + specialkey: function (field, ee) { + if (ee.getKey() == Ext.EventObject.ENTER) { + top.Ext.getCmp('count1').focus(); } } - },{ - text : '单价 :' - },{ - xtype : 'combo', - id : 'combo_price', - name : 'combo_price', - valueField : 'price', - displayField : 'price', - store : priceStore, - editable : false, - forceSelection : true, - mode : 'local', - triggerAction : 'all', - typeAhead : false, - allowBlank : false, - width : 150, - anchor : '95%', - disabled:!enableBtn - },{ - text : '数量 :' - },{ - xtype : 'numberfield', - id : 'count1', - name : 'count1', - style : 'text-align: left', - anchor : '95%', - width : 50, - disabled:!enableBtn, - allowNegative : false, - allowDecimals : false, - listeners : { - specialkey : function(field, ee) { - if (ee.getKey() == Ext.EventObject.ENTER) { - onAddMaterialClick(); - } + } + }, { + text: '单价 :' + }, { + xtype: 'combo', + id: 'combo_price', + name: 'combo_price', + valueField: 'price', + displayField: 'price', + store: priceStore, + editable: false, + forceSelection: true, + mode: 'local', + triggerAction: 'all', + typeAhead: false, + allowBlank: false, + width: 150, + anchor: '95%', + disabled: !enableBtn + }, { + text: '数量 :' + }, { + xtype: 'numberfield', + id: 'count1', + name: 'count1', + style: 'text-align: left', + anchor: '95%', + width: 50, + disabled: !enableBtn, + allowNegative: false, + allowDecimals: false, + listeners: { + specialkey: function (field, ee) { + if (ee.getKey() == Ext.EventObject.ENTER) { + onAddMaterialClick(); } } - }, - { - text : '添加', - iconCls : 'btn_ext_add', - disabled:!enableBtn, - handler : function() { - onAddMaterialClick(); - } - }] - }] - }), - listeners:{ - afteredit : function(e) { - if(!checkAmount(e.value,e.record.data.amountCanReturn)){ - var col = e.field;//获取被修改的列 - var originalValue = e.originalValue;//获取原始值 - e.record.set(col,originalValue); //将单元格数据返回以前值,record为当前行数据集 - }else{ - setTotalMoney(); - } - } - } + } + }, + { + text: '添加', + iconCls: 'btn_ext_add', + disabled: !enableBtn, + handler: function () { + onAddMaterialClick(); + } + }] + }] + }), + listeners: { + afteredit: function (e) { + if (!checkAmount(e.value, e.record.data.amountCanReturn)) { + var col = e.field;//获取被修改的列 + var originalValue = e.originalValue;//获取原始值 + e.record.set(col, originalValue); //将单元格数据返回以前值,record为当前行数据集 + } else { + setTotalMoney(); + } + } + } })] - }] + }] }], - buttonAlign :'center', - buttons : [{ - text : '打印', - hidden : isShowPrintBtn, - handler : function() { - var title = ""; + buttonAlign: 'center', + buttons: [{ + text: '打印', + hidden: isShowPrintBtn, + handler: function () { + var title = ""; var reIds = top.Ext.getCmp("id").getValue(); Ext.Ajax.request({ - url : WWWROOT + '/disinfectSystem/returnMaterialRecordAction!printReturnMaterial.do', - params : {ids : reIds}, - async : false, - success : function(response, options) { + url: WWWROOT + '/disinfectSystem/returnMaterialRecordAction!printReturnMaterial.do', + params: { ids: reIds }, + async: false, + success: function (response, options) { var operator = top.Ext.getCmp('operator').getValue(); var depart = top.Ext.getCmp('depart').getValue(); var totalMoney = top.Ext.getCmp('totalMoney').getValue(); var remark = top.Ext.getCmp('remark').getValue(); var res = JSON.parse(response.responseText); var returnTime = res.data[0].returnTimeStr; var returnGoodsItems = getReturnMaterialDetailGridDataToPrint(res.data[0].returnGoodsItems); - printReturnMaterialRecord(title,operator,returnTime,depart,totalMoney,remark,returnGoodsItems,0); + printReturnMaterialRecord(title, operator, returnTime, depart, totalMoney, remark, returnGoodsItems, 0); } }); } - },{ - text : '保存', - id : 'saveBtn', - hidden:SSTS_ReturnGoodsRecord_Create && SSTS_ReturnGoodsRecord_Update, - disabled:!enableBtn, - handler : function(){ - top.Ext.MessageBox.confirm("请确认","是否保存"+ entityName + "信息?",function(btn) { - if(btn=='yes') { - if(!form.getForm().isValid()){ + }, { + text: '保存', + id: 'saveBtn', + hidden: SSTS_ReturnGoodsRecord_Create && SSTS_ReturnGoodsRecord_Update, + disabled: !enableBtn, + handler: function () { + top.Ext.MessageBox.confirm("请确认", "是否保存" + entityName + "信息?", function (btn) { + if (btn == 'yes') { + if (!form.getForm().isValid()) { showResult('请正确填写表单各值'); return false; } -// if(top.Ext.getCmp('returnOfPeople').getValue().length<1){ -// showResult('退货人信息不能为空'); -// return false; -// } - - if(returnGoodsItemStore.getCount()<1){ + // if(top.Ext.getCmp('returnOfPeople').getValue().length<1){ + // showResult('退货人信息不能为空'); + // return false; + // } + + if (returnGoodsItemStore.getCount() < 1) { showResult('退货详细信息列表不能为空'); return false; } - + //获取grid数据 getReturnGoodsDetailGridData(); top.Ext.getCmp("depart").enable(); /*top.Ext.getCmp('returnOfPeople').setDisabled(false); top.Ext.getCmp('depart').setDisabled(false);*/ -// return false; + // return false; form.form.submit({ - url : WWWROOT + '/disinfectSystem/returnMaterialRecordAction!save.do', - method : 'POST', - waitMsg : '正在保存数据,请稍候', - waitTitle : '提交表单', - success : function(form, action) { + url: WWWROOT + '/disinfectSystem/returnMaterialRecordAction!save.do', + method: 'POST', + waitMsg: '正在保存数据,请稍候', + waitTitle: '提交表单', + success: function (form, action) { showResult(action.result.message); - if(action.result.success){ + if (action.result.success) { grid.dwrReload(); top.Ext.getCmp('returnGoodsRecordWin').close(); } }, - failure : function(form, action) { + failure: function (form, action) { top.Ext.getCmp("depart").disable();// 禁止修改科室 showResult(action.result.message); } }); } }); } - },{ - text : '取消', - handler : function() { + }, { + text: '取消', + handler: function () { top.Ext.getCmp('returnGoodsRecordWin').close(); } }] }); //打印退货记录的数据处理 function getReturnMaterialDetailGridDataToPrint(result) { - var goodsDetail = []; - for ( var i = 0; i < result.length; i++) { + var goodsDetail = []; + for (var i = 0; i < result.length; i++) { var item = {}; item.id = result[i].id; item.materialName = result[i].materialName; @@ -872,17 +874,17 @@ } return goodsDetail; } - + var win = new top.Ext.Window({ - id : 'returnGoodsRecordWin', - layout : 'fit', - title : entityName + '信息', - width : 780, - modal : true, -// autoHeight : true, - border : false, - plain : true, - items : [ form ] + id: 'returnGoodsRecordWin', + layout: 'fit', + title: entityName + '信息', + width: 780, + modal: true, + // autoHeight : true, + border: false, + plain: true, + items: [form] }); win.show(); } \ No newline at end of file