ysarea.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <?
  2. include("../config/conn.php");
  3. include("../config/function.php");
  4. AdminSes_audit();
  5. $bh=$_GET[bh];
  6. while0("*","yjcode_pro where bh='".$bh."'");if(!$row=mysql_fetch_array($res)){exit;}
  7. if($_GET[control]=="add"){
  8. if(!strstr($adminqx,",0,") && !strstr($adminqx,",0101,")){Audit_alert("权限不够","default.php");}
  9. $area="|".sqlzhuru($_POST[area1]).",".sqlzhuru($_POST[add2]).",".sqlzhuru($_POST[add3])."|";
  10. if(strstr($row[ysarea],$area)==""){$areav=$row[ysarea].$area;updatetable("yjcode_pro","ysarea='".$areav."' where id=".$row[id]);}
  11. php_toheader("ysarea.php?bh=".$bh);
  12. }elseif($_GET[control]=="del"){
  13. if(!strstr($adminqx,",0,") && !strstr($adminqx,",0101,")){Audit_alert("权限不够","default.php");}
  14. $a=preg_split("/xcf/",$_GET[aid]);
  15. $str=$row[ysarea];
  16. for($i=0;$i<=count($a);$i++){
  17. if($a[$i]!=""){
  18. $ss="|".$a[$i]."|";
  19. $str=str_replace($ss,"",$str);
  20. }
  21. }
  22. updatetable("yjcode_pro","ysarea='".$str."' where id=".$row[id]);
  23. php_toheader("ysarea.php?bh=".$bh);
  24. }
  25. ?>
  26. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  27. <html xmlns="http://www.w3.org/1999/xhtml">
  28. <head>
  29. <meta http-equiv="x-ua-compatible" content="ie=7" />
  30. <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  31. <title>销售区域设置</title>
  32. <style type="text/css">
  33. body{margin:0;font-size:12px;text-align:center;color:#333;word-wrap:break-word;font-family:"Microsoft YaHei",微软雅黑,"MicrosoftJhengHei",华文细黑,STHeiti,MingLiu;}
  34. *{margin:0 auto;padding:0;}
  35. ul{list-style-type:none;margin:0;padding:0;}
  36. .uk{float:left;margin:10px 0 0 0;width:600px;font-size:14px;border-bottom:#e1e1e2 solid 1px;}
  37. .uk li{float:left;}
  38. .uk .l1{width:530px;height:45px;padding:0 0 0 10px;}
  39. .uk .l1 .fd{float:left;margin:2px 3px 0 0;}
  40. .uk .l1 .inp{float:left;border:#CCCCCC solid 1px;height:31px;margin-right:2px;font-family:"Microsoft YaHei",微软雅黑,"MicrosoftJhengHei",华文细黑,STHeiti,MingLiu;}
  41. .uk .l2{width:60px;height:45px;}
  42. .uk .l2 input{float:left;color:#fff;font-size:14px;width:50px;height:31px;border:0;background-color:#ff6600;cursor:pointer;}
  43. .u1{float:left;width:290px;height:30px;text-align:left;border-bottom:#e1e1e2 solid 1px;border-right:#e1e1e2 solid 1px;font-size:14px;}
  44. .u1 li{float:left;}
  45. .u1 .l1{width:20px;padding:6px 0 0 10px;}
  46. .u1 .l2{width:260px;padding:5px 0 0 0;height:22px;overflow:hidden;}
  47. .control{float:left;width:600px;height:35px;border-bottom:#e1e1e2 solid 1px;background-color:#F5F6FA;}
  48. .control a{float:left;margin:5px 0 0 10px;padding:4px 10px 0 10px;height:21px;background-color:#1E9FFF;color:#fff;text-decoration:none;}
  49. .list{float:left;width:600px;height:364px;overflow-y:scroll;}
  50. </style>
  51. <script language="javascript" src="../js/jquery.min.js"></script>
  52. <script language="javascript" src="../js/layer.js"></script>
  53. <script language="javascript">
  54. function area1cha(){
  55. farea2.location="../tem/area2.php?area1id="+document.getElementById("area1").value;
  56. }
  57. function tj(){
  58. layer.msg('正在提交', {icon: 16 ,time: 0,shade :0.25});
  59. f1.action="ysarea.php?control=add&bh=<?=$bh?>";
  60. }
  61. function areadel(){
  62. var c=document.getElementsByName("C1");
  63. str="";
  64. for(i=0;i<c.length;i++){
  65. if(c[i].checked){
  66. if(str==""){str=c[i].value;}else{str=str+"xcf"+c[i].value;}
  67. }
  68. }
  69. if(str==""){alert("请至少选择一条数据");return false;}
  70. location.href="ysarea.php?control=del&bh=<?=$bh?>&aid="+str;
  71. }
  72. var selon=0;
  73. function selonc(){
  74. c=document.getElementsByName("C1");
  75. if(selon==0){
  76. for(i=0;i<c.length;i++){c[i].checked="checked";}
  77. selon=1;
  78. }else{
  79. for(i=0;i<c.length;i++){c[i].checked=false;}
  80. selon=0;
  81. }
  82. }
  83. </script>
  84. </head>
  85. <body>
  86. <form name="f1" method="post" onsubmit="return tj()">
  87. <input type="hidden" value="area" name="yjcode" />
  88. <ul class="uk">
  89. <li class="l1"><? include("../tem/area.php");?></li>
  90. <li class="l2"><input type="submit" value="添加" /></li>
  91. </ul>
  92. </form>
  93. <div class="control">
  94. <a href="javascript:void(0);" onclick="selonc()" class="a1">全选/反选</a>
  95. <a href="javascript:void(0);" onclick="areadel()" class="a2">删除</a>
  96. </div>
  97. <div class="list">
  98. <?
  99. $a=preg_split("/\|/",$row[ysarea]);
  100. for($i=1;$i<=count($a);$i++){
  101. if($a[$i]!=""){
  102. $areav="";
  103. if(strstr($a[$i],"0,0,0")!=""){$areav="全国";}
  104. $b=preg_split("/,/",$a[$i]);
  105. for($j=0;$j<3;$j++){
  106. $areav=$areav." ".returnarea($b[$j]);
  107. }
  108. ?>
  109. <label>
  110. <ul class="u1">
  111. <li class="l1"><input name="C1" type="checkbox" value="<?=$a[$i]?>" /></li>
  112. <li class="l2"><?=$areav?></li>
  113. </ul>
  114. </label>
  115. <? }}?>
  116. </div>
  117. </body>
  118. </html>