1、通过form页面元素数据填充
$(‘#<?php echo NS;?>form‘).form(‘load‘,<?php echo json_encode($orm->as_array());?>);//loadYiXia
试图页源码:
<form id="<?php echo NS;?>form" method="post" enctype="multipart/form-data" onsubmit="return <?php echo NS;?>submit();" style="margin:0;padding:10px 50px"> <div style="margin:5px"> <input id="<?php echo NS;?>web" name="platform" style="width:300px;" data-options="label:‘*站点:‘,prompt:‘选择站点‘,required:true" /> </div> <div style="margin:5px"> <input class="easyui-textbox" name="name" style="width:300px;" data-options="label:‘*广告位置:‘,prompt:‘广告位置‘,required:true" /> </div> <div style="margin:5px"> <input class="easyui-textbox" name="node" style="width:300px;" data-options="label:‘*标识名称:‘,prompt:‘标识名称,例:aa_bb_1,_aa_bb_1‘,required:true" /> </div> <div style="margin:5px"> <input class="easyui-numberbox" name="width" style="width:300px;" data-options="label:‘*宽度:‘,prompt:‘建议宽度(单位:像数)‘,required:true" /> </div> <div style="margin:5px"> <input class="easyui-numberbox" name="height" style="width:300px;" data-options="label:‘*高度:‘,prompt:‘建议高度(单位:像数)‘,required:true" /> </div> <div style="margin:5px"> <input class="easyui-textbox" name="nopic" style="width:300px;" data-options="label:‘默认图片:‘,prompt:‘默认广告图‘,required:false" /> </div> <div style="margin:5px"> <input class="easyui-textbox" name="remark" style="width:300px;" data-options="label:‘备注:‘,prompt:‘备注‘,required:false" /> </div> </form> <script type="text/javascript"> $(document).ready(function(){ $(‘#<?php echo NS;?>form‘).form(‘load‘,<?php echo json_encode($orm->as_array());?>);//loadYiXia //站点选择 $(‘#<?php echo NS;?>web‘).combobox({ valueField: ‘id‘, textField: ‘name‘, panelHeight: 180, editable: false, data:<?php echo $web;?>, onLoadSuccess:function(){ } }); //下拉框展开收缩动画 $(‘#<?php echo NS;?>web‘).combobox(‘panel‘).panel({ openAnimation:‘slide‘, closeAnimation:‘hide‘ }); }); function <?php echo NS;?>submit() { $.ajax({ type: ‘POST‘, url: ‘/advertise/config/ajax_<?php echo Request::current()->action();echo Request::current()->action()==‘update‘?‘/‘.$orm->pk():‘/0‘;?>‘, data: $(‘#<?php echo NS;?>form‘).serialize(), dataType: "json", beforeSend: function(xhr){ if($(‘#<?php echo NS;?>form‘).form(‘validate‘)){ $.messager.progress(); return true; } return false; }, success: function (res) { $.messager.progress(‘close‘); if(res.status == 200){ $("#<?php echo NS;?>form").parent().dialog("close"); $.messager.alert(‘操作提示‘,res.msg,‘info‘); return true; } $.messager.alert(‘操作提示‘,res.msg,‘error‘); } }); return false; } </script>
print_r($orm->as_array())输出
array ( ‘id‘ => ‘56‘, ‘reorder‘ => ‘0‘, ‘position‘ => ‘1‘, ‘name‘ => ‘text‘, ‘picurl‘ => ‘‘, ‘admode‘ => ‘URL‘, ‘linkurl‘ => ‘‘, ‘codebox‘ => NULL, ‘cityid‘ => ‘0‘, ‘_cityid‘ => ‘全国‘, ‘starttime‘ => ‘2018-11-15 10:49:15‘, ‘endtime‘ => ‘2018-11-15 10:49:18‘, ‘views‘ => ‘0‘, ‘remark‘ => ‘‘, ‘status‘ => ‘1‘, ‘modtime‘ => ‘1542261489‘, ‘addtime‘ => ‘1542250225‘, )
2、EassUI动态改变参数
$("#<?php echo NS; ?>corper").datagrid("options").queryParams.belongcityid = val; $(‘#<?php echo NS; ?>corper‘).datagrid(‘reload‘);
原文地址:https://www.cnblogs.com/hnhycnlc888/p/10987361.html
时间: 2024-11-05 02:18:06