Index: ssts-web/src/main/webapp/disinfectsystem/CombinationKits/CombinationKitsForm.js
===================================================================
diff -u
--- ssts-web/src/main/webapp/disinfectsystem/CombinationKits/CombinationKitsForm.js (revision 0)
+++ ssts-web/src/main/webapp/disinfectsystem/CombinationKits/CombinationKitsForm.js (revision 25171)
@@ -0,0 +1,437 @@
+/*
+* Annie 外来器械包绑定表单
+* */
+var windowObj; //窗口
+var formObj; //表单
+var nodeDefinitionsStore;
+/*删除*/
+function deleteItem(ids){
+ var count = nodeDefinitionsStore.getCount();
+ var nodes;
+ for (var i = 0; i < count.length; i++) {
+ nodes = nodeDefinitionsStore.data.items[i];
+ }
+ nodeDefinitionsStore.remove(nodes);
+
+}
+function addAndEditRecord(id) {
+ //按钮
+ function renderDeleteButton(v,p,record){
+ return "";
+ }
+
+ /*保存*/
+ function saves(){
+ var name =top.Ext4.getCmp('name').getValue();
+ var suppler =top.Ext4.getCmp('suppler').getValue();
+ var remark = top.Ext4.getCmp('remark').getValue();
+ var foreignTousseName =top.Ext4.getCmp('foreignTousseName').getValue();
+ var data;
+ var itme=[];
+ var count = nodeDefinitionsStore.getCount();
+ if(count > 0){
+ for (var i = 0; i < count.length; i++) {
+ data = nodeDefinitionsStore.data.items[i];
+ itme.push({id:data.data.id,name:data.data.name,suppler:data.data.suppler,packageType:data.data.packageType})
+
+ }
+ }else{
+ showResult('没有添加器械包数据');
+ return false;
+ }
+ if(!name){
+ showResult('器械包名称不能为空');
+ return false;
+
+ }
+
+ if(id==''){
+ if(!suppler){
+ showResult('请选择供应商');
+ return false;
+ }
+ if(!foreignTousseName){
+ showResult('请选择器械包');
+ return false;
+ }
+ }
+ top.Ext4.Ajax.request({
+ url:WWWROOT+'disinfectSystem/foreignTousseCombinationController/saveForeignTousseCombination.mhtml',
+ params: {
+ id:id,
+ name:name,
+ remark:remark,
+ foreignTousseList:JSON.stringify(itme)
+ },
+ success: function(response, options) {
+ var result = top.Ext4.decode(response.responseText);
+ if(result.success && result.data){
+ showResult(action.result.message);
+ }
+ grid.reloadData();
+ windowObj.close();
+ },
+
+ })
+
+ }
+ /*选择供应商取值*/
+ var appSupplerJsonStore = new top.Ext4.data.Store({
+ pageSize: 50,
+ autoLoad:false,
+ proxy : {
+ type : 'ajax',
+ url:WWWROOT+'/disinfectSystem/baseData/sterilizerController/getAllSterilizer.mhtml',
+ reader : {
+ type : 'json',
+ totalProperty : 'totalCount',
+ root : 'rows'
+ }
+ },
+ fields : [
+ {name : 'id',mapping : 'id'},
+ {name : 'name',mapping : 'name'}
+ ],
+ listeners:{
+ beforeload:function(store, operation, eOpts){
+ var suppler =top.Ext4.getCmp('suppler').getValue();//供应商名称
+ var params = {
+ supplierName:suppler,
+ supplierType:'外来器械租用商'
+ };
+ Ext4.apply(store.proxy.extraParams, params);
+
+ }
+ }
+ });
+
+ /*Annie 选择器械包名称*/
+ var appSupplierNameJsonStore = new top.Ext4.data.Store({
+ pageSize: 50,
+ autoLoad:true,
+ proxy : {
+ type : 'ajax',
+ url:WWWROOT+'/disinfectSystem/baseData/tousseDefinitionController/getForeignTousseDefinitionNames.mhtml',
+ reader : {
+ type : 'json',
+ totalProperty : 'totalCount',
+ root : 'rows'
+ }
+ },
+ fields : [
+ {name : 'id',mapping : 'id'},
+ {name : 'packageType',mapping:'packageType'},
+ {name : 'name',mapping : 'name'}
+ ],
+ listeners:{
+ beforeload:function(store, operation, eOpts){
+ var foreignTousseName =top.Ext4.getCmp('foreignTousseName').getValue();
+ var params = {
+ supplierName:foreignTousseName
+ };
+ Ext4.apply(store.proxy.extraParams, params);
+ }
+ }
+ });
+
+ /**
+ * 转换records,因为Ext4的combo的select事件有点小bug,第二个参数records在API写的是一个数组类型,但是在某种情况下他是一个对象(即:手动输入一个Store存在的数据时),因此写下此函数,转换一下
+ * @param records
+ * @returns
+ */
+ function transformRecords(records) {
+ var record = records;
+ if (records && records.length > 0){
+ record = records[0];
+ }
+ return record;
+ }
+
+ top.Ext4.define('NodeModel', {
+ extend : 'top.Ext4.data.Model',
+ fields: [
+ {name : 'id'},
+ {name : 'name'},
+ {name : 'spelling'},
+ {name : 'wbcode'},
+ {name : 'packageType'},
+ {name : 'suppler'},
+ {name : 'configDateStr'},
+ {name : 'configUser'},
+ {name : 'remark'}]
+ });
+ //请求明细接口
+ nodeDefinitionsStore = top.Ext4.create('top.Ext4.data.Store', {
+ model : "NodeModel"
+ });
+
+ var InstrumentComnTreeGrid = top.Ext4.create('top.Ext4.grid.Panel', {
+ useArrows: true,
+ multiSelect: false,
+ columnLines: true,
+ rowLines: true,
+ cls: 'no-leaf-icons',
+ store : nodeDefinitionsStore,
+ viewConfig : {loadMask : {msg : '正在加载,请稍候...'}},
+ tbar:[
+ {
+ text: "选择供应商:"
+ },
+ {
+ xtype : 'combo',
+ id : 'suppler',
+ name : 'suppler',
+ queryParam : 'spell',
+ minChars : 0,
+ valueField : 'name',
+ displayField : 'name',
+ width : 250,
+ listConfig: {width : 300},
+ matchFieldWidth: false,
+ store : appSupplerJsonStore,
+ lazyInit : true,
+ triggerAction : 'all',
+ hideTrigger : false,
+ typeAhead : false,
+ forceSelection:false,
+ allowBlank : true,
+ pageSize : 100,
+ listeners : {
+ select:function(combo, records, index){
+ appSupplierNameJsonStore.load();
+ var foreignTousseNameComp = top.Ext4.getCmp("foreignTousseName");
+ var counts =appSupplierNameJsonStore.getCount()
+ if(counts >0 ){
+ foreignTousseNameComp.setValue(appSupplierNameJsonStore.getAt(0).getData().name);
+ top.Ext4.getCmp('packageType1').setValue(appSupplierNameJsonStore.getAt(0).getData().packageType);
+ top.Ext4.getCmp('ids').setValue(appSupplierNameJsonStore.getAt(0).getData().id);
+ }else{
+ foreignTousseNameComp.setValue('');
+ }
+ appSupplerJsonStore.load();
+ },
+ specialkey: function(field, event, eOpts) {
+ if (event.getKey() === event.TAB) {
+ event.stopEvent();
+ }
+ }
+ }
+ },
+ {text:"选择器械包"},
+
+ {
+ xtype : 'combo',
+ id : 'foreignTousseName',
+ name : 'foreignTousseName',
+ queryParam : 'spell',
+ minChars : 0,
+ valueField : 'name',
+ displayField : 'name',
+ width : 220,
+ listConfig: {width : 300},
+ matchFieldWidth: false,
+ store : appSupplierNameJsonStore,
+ lazyInit : true,
+ triggerAction : 'all',
+ hideTrigger : false,
+ typeAhead : false,
+ forceSelection:false,
+ allowBlank : true,
+ pageSize : 100,
+ listeners : {
+ select:function(combo, records, index){
+ top.Ext4.getCmp('ids').setValue(records[0].get('id'));
+ top.Ext4.getCmp('packageType1').setValue(records[0].get('packageType'));
+ appSupplerJsonStore.load();
+ var supplerComp = top.Ext4.getCmp("suppler");
+ supplerComp.setValue('');
+ appSupplierNameJsonStore.load();
+
+ },
+ specialkey: function(field, event, eOpts) {
+ if (event.getKey() === event.TAB) {
+ event.stopEvent();
+ }
+ }
+ }
+ },{
+ xtype:'hidden',
+ id : 'packageType1',
+ name : 'packageType'
+ },
+ {
+ xtype:'hidden',
+ id : 'ids',
+ name : 'id'
+ },
+ {
+ text : '添加',
+ width : 60,
+ iconCls : 'btn_ext_add',
+ handler:function(){
+ var suppler=top.Ext4.getCmp('suppler').getRawValue();
+ var foreignTousseName =top.Ext4.getCmp('foreignTousseName').getRawValue()
+ var packageType = top.Ext4.getCmp('packageType')
+ if(!suppler){
+ showResult('请选择供应商');
+ return false;
+ }
+ if(!foreignTousseName){
+ showResult('请选择器械包');
+ return false;
+ }
+ nodeDefinitionsStore.add({
+ "id":top.Ext4.getCmp('ids').getValue(),
+ "name":top.Ext4.getCmp('foreignTousseName').getRawValue(),
+ "packageType":top.Ext4.getCmp('packageType1').getValue(),
+ "suppler":top.Ext4.getCmp('suppler').getValue()});
+
+ }
+ },
+ ],
+ columns: [{
+ header:'供应商', dataIndex:'suppler', width: 200, sortable: false, menuDisabled : true
+ },{
+ header:'器械包名称', dataIndex:'name', width: 200, sortable: false, menuDisabled : true
+ },{
+ header:'包装类型', dataIndex:'packageType', width: 200, sortable: false, menuDisabled : true
+ },{
+ header:'删除', dataIndex:'types', width: 150, sortable: false, menuDisabled : true, renderer:renderDeleteButton
+ }]
+ });
+
+
+ formObj = top.Ext4.create('top.Ext4.form.Panel', {
+ layout : 'vbox',
+ frame : true,
+ border : 0,
+ labelSeparator : ': ',
+ bodyPadding : '5 5 0',
+ autoScroll : true,
+ buttonAlign : 'center',
+ buttons : [{
+ text : '取消',
+ handler : function() {
+ windowObj.close();
+ }
+ },{
+ id:'save',
+ name:'save',
+ text : '保存',
+ handler : function(){
+ saves()
+ }
+ }],
+ fieldDefaults : {
+ labelAlign : 'right',
+ labelWidth : 80
+ },
+ items : [{
+ xtype:'hidden',
+ id:'items',
+ name:'items'
+ },{
+ xtype : 'fieldset',
+ height : 120,
+ width : '100%',
+ layout : 'column',
+ title : '基础数据',
+ items : [{
+ layout : 'form',
+ columnWidth : .33,
+ bodyStyle : {background : '#EBF5EC', border : 0},
+ items : [{
+ xtype : 'textfield',
+ border : 0,
+ fieldLabel : '器械包名称',
+ name : "name",
+ id : "name",
+ enableKeyEvents : true,
+ listeners : {
+
+ }
+ }]
+ },{
+ layout : 'form',
+ columnWidth : .33,
+ bodyStyle : {background : '#EBF5EC', border : 0},
+ items : [{
+ xtype : 'textfield',
+ border : 0,
+ fieldLabel : '拼音码',
+ name : "spelling",
+ id : "spelling",
+ enableKeyEvents : true,
+ listeners : {
+
+ }
+ }]
+ },{
+ layout : 'form',
+ columnWidth : .33,
+ bodyStyle : {background : '#EBF5EC', border : 0},
+ items : [{
+ xtype : 'textfield',
+ border : 0,
+ fieldLabel : '五笔码',
+ name : "wbcode",
+ id : "wbcode",
+ readOnly : false,
+ enableKeyEvents : true,
+ listeners : {
+
+ }
+ }]
+ },{
+ xtype: 'textareafield',
+ columnWidth : 1,
+ width: 509,
+ fieldLabel: '备注',
+ labelAlign: 'right',
+ id:'remark'
+
+ }]
+ },{
+ xtype : 'container',
+ flex : 1,
+ width : '100%',
+ layout : 'fit',
+ items : InstrumentComnTreeGrid
+ }]
+ });
+ windowObj = top.Ext4.create('top.Ext4.window.Window', {
+ layout : 'fit',
+ title : '組合外來器械包',
+ width : 800,
+ height : 500,
+ resizable :false,
+ modal : true,
+ border : false,
+ plain : true,
+ items : formObj
+ });
+ windowObj.show();
+ if(!isUndefinedOrNullOrEmpty(id)){
+ //页面加载请求数据
+ top.Ext4.Ajax.request({
+ url : WWWROOT+'/disinfectSystem/foreignTousseCombinationController/loadDataById.mhtml?id='+id,
+ success : function(response, options) {
+ var result = top.Ext4.decode(response.responseText);
+ if(result.success && result.data){
+ //渲染数据
+ top.Ext4.getCmp('name').setValue(result.data.name);
+ top.Ext4.getCmp('spelling').setValue(result.data.spelling);
+ top.Ext4.getCmp('wbcode').setValue(result.data.wbcode);
+ top.Ext4.getCmp('remark').setValue(result.data.remark);
+ if(result.data.foreignTousseList && result.data.foreignTousseList.length > 0){
+ for (var i = 0; i < result.data.foreignTousseList.length; i++) {
+ nodeDefinitionsStore.add(result.data.foreignTousseList[i]);
+ }
+ }
+ }
+ },
+ failure : function(response, options) {
+ }
+ });
+ }
+}
\ No newline at end of file
Index: ssts-web/src/main/webapp/homepage/menu.jsp
===================================================================
diff -u -r25160 -r25171
--- ssts-web/src/main/webapp/homepage/menu.jsp (.../menu.jsp) (revision 25160)
+++ ssts-web/src/main/webapp/homepage/menu.jsp (.../menu.jsp) (revision 25171)
@@ -2015,6 +2015,16 @@
/**
+ * 《外来器械包组合》菜单
+ */
+var SSTS_ForeignTousseApplication_Combo = true;
+