rock_kaoqin_kqdw.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php if(!defined('HOST'))die('not access');?>
  2. <script >
  3. $(document).ready(function(){
  4. var a = $('#view_{rand}').bootstable({
  5. tablename:'kqdw',celleditor:true,fanye:true,url:publicstore('{mode}','{dir}'),storebeforeaction:'kqdwbefore',
  6. columns:[{
  7. text:'规则名称',dataIndex:'name',align:'left',editor:true
  8. },{
  9. text:'经度',dataIndex:'location_x',editor:true
  10. },{
  11. text:'纬度',dataIndex:'location_y',editor:true
  12. },{
  13. text:'经纬度',dataIndex:'xuanz',renderer:function(v,d,i){
  14. return ''+v+'&nbsp;<a href="javascript:;" onclick="changeweizhi{rand}('+i+')">选择位置</a>';
  15. }
  16. },{
  17. text:'位置名称',dataIndex:'address',editor:true
  18. },{
  19. text:'允许误差(米)',dataIndex:'precision',editor:true
  20. },{
  21. text:'无固定地点',dataIndex:'iswgd',editor:true,type:'checkbox'
  22. },{
  23. text:'拍照打卡',dataIndex:'ispz',editor:true,type:'checkbox'
  24. },{
  25. text:'关联其他位置ID',dataIndex:'dwids',editor:true
  26. },{
  27. text:'ID',dataIndex:'id'
  28. }],
  29. itemclick:function(){
  30. btn(false);
  31. },
  32. beforeload:function(){
  33. btn(true);
  34. }
  35. });
  36. function btn(bo){
  37. get('del_{rand}').disabled = bo;
  38. get('edit_{rand}').disabled = bo;
  39. }
  40. var c = {
  41. del:function(){
  42. a.del({url:js.getajaxurl('kqdwdkdatadel','{mode}','{dir}')});
  43. },
  44. clickwin:function(o1,lx){
  45. var gzdata = [{id:'',name:''}];
  46. var das = a.getData();
  47. for(var i in das)gzdata.push(das[i]);
  48. var h = $.bootsform({
  49. title:'位置',height:380,width:400,
  50. tablename:'kqdw',isedit:lx,
  51. submitfields:'name,address,precision,dwids',
  52. items:[{
  53. labelText:'名称',name:'name',required:true
  54. },{
  55. labelText:'位置名称',name:'address',required:true
  56. },{
  57. labelText:'允许误差(米)',name:'precision',type:'number',value:0
  58. },{
  59. labelText:'关联其他地点',name:'dwids',type:'select',valuefields:'id',displayfields:'name',store:gzdata
  60. }],
  61. success:function(){
  62. a.reload();
  63. }
  64. });
  65. if(lx==1)h.setValues(a.changedata);
  66. h.getField('name').focus();
  67. },
  68. search:function(){
  69. var s=get('key_{rand}').value;
  70. a.setparams({key:s},true);
  71. }
  72. };
  73. changeweizhi{rand}=function(oi){
  74. var d = a.getData(oi);
  75. var url = '?m=kaoqin&d=main&a=locationchange';
  76. if(!isempt(d.location_x))url+='&location_x='+d.location_x+'&location_y='+d.location_y+'&scale='+d.scale+'';
  77. openxiangs('选择位置',url,'','backshow{rand}');
  78. }
  79. backshow{rand}=function(d){
  80. d.id = a.changeid;
  81. js.ajax(js.getajaxurl('savaweizz','{mode}','{dir}'),d, function(s){
  82. a.reload();
  83. },'post');
  84. }
  85. js.initbtn(c);
  86. });
  87. </script>
  88. <div>
  89. <table width="100%"><tr>
  90. <td nowrap>
  91. <button class="btn btn-primary" click="clickwin,0" type="button"><i class="icon-plus"></i> 新增</button>
  92. </td>
  93. <td style="padding-left:10px">
  94. <input class="form-control" style="width:200px" id="key_{rand}" placeholder="规则/位置名称">
  95. </td>
  96. <td style="padding-left:10px">
  97. <button class="btn btn-default" click="search" type="button">搜索</button>
  98. </td>
  99. <td width="100%"></td>
  100. <td align="right" nowrap>
  101. <button class="btn btn-info" id="edit_{rand}" click="clickwin,1" disabled type="button"><i class="icon-edit"></i> 编辑 </button> &nbsp;
  102. <button class="btn btn-danger" id="del_{rand}" click="del" disabled type="button"><i class="icon-trash"></i> 删除</button>
  103. </td>
  104. </tr></table>
  105. </div>
  106. <div class="blank10"></div>
  107. <div id="view_{rand}"></div>
  108. <div class="tishi">位置必须从地图上选择哦,无固定地点选中了:任何地点都可以考勤打卡,关联其他位置ID:填写当前页面记录的ID,多个,分开。</div>
粤ICP备19079148号