123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- var dg;
- var dd;
- var editRow = undefined;
- var method = undefined;
- $(document).ready( function(){
- searchData();
- loadHosAutoComplete('search_hosname','search_hosid','search_hosname_old');
- loadHosAutoComplete('search_hosname1','search_hosid1','search_hosname_old1');
- dd = $("#dd").dialog({
- title: '配置',
- width: 280,
- height: 210,
- closed: true,
- cache: false,
- modal: true,
- buttons:[{
- text:'保存',
- handler:function(){
- var rowData = {};
- var basic_hos_info_id = $('#basic_hos_info_id').val();
- rowData.hos_id=$('#search_hosid1').val();
- rowData.hos_name=$('#search_hosname1').val();
- rowData.region_code=$('#region_code').val();
- rowData.hop_service=$('#hop_service').val();
- rowData.hos_address=$('#hos_address').val();
- rowData.password=$('#password').val();
- if(Commonjs.isEmpty(basic_hos_info_id)){
- Commonjs.ajax("./BasicAction_insertHosInfo.action",rowData,false);
- }else{
- rowData.basic_hos_info_id=basic_hos_info_id;
- Commonjs.ajax("./BasicAction_updateHosInfo.action",rowData,false);
- }
- refreshData();
- dd.dialog('close');
- }
- },{
- text:'关闭',
- handler:function(){
- $('#basic_hos_info_id').val("");
- $('#search_hosname1').val("");
- $('#search_hosid1').val("");
- $('#search_hosname_old1').val("");
- $('#region_code').val("");
- $('#hop_service').val("");
- $('#hos_address').val("");
- $('#password').val("");
- dd.dialog('close');
- }
- }]
- });
- // $('#provinceID').combobox({
- // editable:false,
- // valueField:'provinceid',
- // textField:'provincename',
- // width: 100,
- // onSelect: loadCity
- // });
- // $('#cityID').combobox({
- // editable:false,
- // valueField:'cityid',
- // textField:'cityname',
- // width: 120,
- // onSelect: loadHos
- // });
- // $('#orgID').combobox({
- // valueField:'hospitalid',
- // textField:'hosname',
- // panelWidth: 260 ,
- // });
- // var pd = Commonjs.ajax($.yihu.url,{bizAction:'commonAction.getProvinceByHos'},false).result;
- // $('#provinceID').combobox('loadData',pd);
- });
- function searchData(){
- var hosid = 0;
- if(!isNull($('#search_hosid').val())){
- hosid=$('#search_hosid').val();
- }
- dg = $('#dg').datagrid(
- {
- title : '',
- url : "BasicAction_queryHosInfo.action",
- height : $('#layoutid').layout('panel', 'center').panel(
- 'options').height,
- columns : dataTableColumns,
- queryParams : {
- hospitalId : hosid,
- },
- pagination : true,
- pageSize : 15,
- pageList : [ 10, 15, 20, 30, 50 ],
- fitColumns : true,
- singleSelect : true,
- loadMsg : "正在加载...",
- toolbar:[
- {
- text:'增加',
- iconCls:'icon-add',
- handler:function(){
- dd.dialog('open');
- }
- },'-',{
- text:'修改',
- iconCls:'icon-edit',
- handler:function(){
- var row = dg.datagrid('getSelections')[0];
- $('#basic_hos_info_id').val(row.basic_hos_info_id);
- $('#search_hosname1').val(row.hos_name);
- $('#search_hosid1').val(row.hosid);
- $('#search_hosname_old1').val(row.hos_name);
- $('#region_code').val(row.region_code);
- $('#hop_service').val(row.hop_service);
- $('#hos_address').val(row.hos_address);
- $('#password').val(row.password);
- dd.dialog('open');
- }
- },'-',{
- text:'删除',
- iconCls:'icon-remove',
- handler:function(){
- var rows = dg.datagrid('getSelections');
- var msgMess = '当前已选中'+rows.length+'条记录,删除后无法恢复,是否确定要删除!!';
- if(rows.length > 0){
- $.messager.confirm('确认',msgMess,function(r){
- if(r){
- var ids = [];
- var rowData = {};
- for(var i=0;i<rows.length;i++){
- ids.push(rows[i].basic_hos_info_id);
- }
- rowData.ids = ids.join(',');
- Commonjs.ajax("./BasicAction_deleteHosInfo.action",rowData,false);
- refreshData();
- }
- });
- }else{
- $.messager.alert('提示','请选择要删除的数据!','warning');
- }
- }
- },'-'
- ],
- loadFilter : function(data) {
- var _data={};
- if(data==null||data.totalProperty==0) {
- _data.total=0;
- _data.rows=[];
- return _data;
- }
- _data.total = data.totalProperty;
- _data.rows = data.result;
- return _data;
- },
- onBeforeLoad : function(param) {
- param.limit = param.rows;
- param.start = (param.page - 1) * param.limit;
- },
- onLoadSuccess : function(data) {
- $("#btnEp").linkbutton('enable');
- $("#btnEp1").linkbutton('enable');
- }
- });
- }
- function isNull(value){
- if(value==undefined||value==null||value=='null'||value=='NULL' || value =='undefined' || value=='0' || value==''){
- return true;
- }else{
- return false;
- }
- }
- function refreshData(){
- dg.datagrid('load',{
- bizAction:'./BasicAction_queryHosInfo.action',
- hospitalId:'-1'
- });
- //当用户处于编辑状态,不点保存或更新按钮,应该把重置编辑状态
- editRow = undefined;
- method = undefined;
- }
- function isHosNameChange(o,search_hosname_old,search_hosid){
- if(o.value != $('#'+search_hosname_old).val()){
- $('#'+search_hosid).val(0);
- }
- }
- //加载医院标签库
- function loadHosAutoComplete(id,search_hosid,search_hosname_old)
- {
- $("#"+id).focus().autocomplete(HospitalData,{
- max:15,
- scrollHeight: 300,
- matchContains: true,
- formatItem: function(row, i, max) {
- return row.hosname
- },
- formatMatch: function(row, i, max) {
- return row.hosname +"["+row.spells+"]";
- },
- formatResult: function(row) {
- return row.hosname;
- }
- } );
- $("#"+id).result(function(event, data, formatted) {
- if (data) {
- $('#'+search_hosid).val(data.hospitalid);
- $('#'+search_hosname_old).val(data.hosname);
- } else {
- $('#'+search_hosid).val(0);
- }
- });
- }
- //var loadCity = function(node){
- // $('#cityID').combobox('loadData',Commonjs.ajax
- // ($.yihu.url,{bizAction:'commonAction.getCityByProvince',provinceid:node.provinceid},false).result);
- //}
- //var loadHos = function(node){
- // var provinceid = $('#provinceID').combobox('getValue');
- // $('#orgID').combobox('loadData',Commonjs.ajax
- // ($.yihu.url,{bizAction:'hospital_Action.queryHospitalCombox',
- // isAll:true,provinceid:provinceid,cityId:node.cityid},false).result);
- //}
- var dataTableColumns = [ [
- {
- title:'id',
- field:'basic_hos_info_id',
- checkbox:true
- },{
- field : 'hos_name',
- width : $(this).width() * 0.2,
- title : '医院名称'
- },
- {
- field : 'region_code',
- width : $(this).width() * 0.1,
- title : '区域代码'
- },
- {
- field : 'hop_service',
- width : $(this).width() * 0.4,
- title : 'wsdl地址'
-
- },
- {
- field : 'hos_address',
- width : $(this).width() * 0.2,
- title : '医院地址'
- },
- {
- field : 'password',
- width : $(this).width() * 0.1,
- title : '密码'
- }] ];
|