提交 39d8a098 authored 作者: chengye's avatar chengye

添加地图功能

上级 14ad895f
<?php
/**
* v2 地图模块
*/
namespace app\em\controller;
use app\admin\controller\Base;
use app\admin\model\DepartmentModel;
use app\admin\model\ElectricMeter;
use app\admin\model\ElectricMeterType;
use app\admin\model\OperatorModel;
use app\admin\model\StaffModel;
use app\admin\model\BaseStationModel;
use think\Exception;
use think\facade\Request;
use think\facade\Session;
class Region extends Base
{
public function region_list(){
if (!Request::instance()->isAjax()){
$this->assign('search_type','');
$this->assign('search_text','');
$this->assign('operator','');
$this->assign('area_id','');
$region=new ElectricMeter();
$operator=new OperatorModel();
$operators = OperatorModel::field('operator_id,operator_name')->where('operator_state','=',1)->select()->toArray();
$this->assign('regions',getTree($region->regions()));
$this->assign('operators',$operators);
return $this->fetch();
}else{
$map=[];
$aa= Request::param('type');
if($aa==1){
$data= Request::param('data');
$search_text=$data['search_text'];
$search_type=$data['search_type'];
if($search_text){
switch ($search_type) {
case '1':
$this->assign('search_text',$search_text);
$map[]=['station_info.station_name','like',"%$search_text%"];
$this->assign('search_type',$search_type);
break;
case '2':
$this->assign('search_text',$search_text);
$map[]=['station_info.station_sp_code','like',"%$search_text%"];
$this->assign('search_type',$search_type);
break;
case '3':
$this->assign('search_text',$search_text);
$map[]=['station_info.proj_number','like',"%$search_text%"];
$this->assign('search_type',$search_type);
break;
}
}else{
$this->assign('search_type','');
$this->assign('search_text','');
}
$operator = $data['operator'];
if($operator){
$map[] = ['station_info.original_sp_id','=',$operator];
$this->assign('operator',$operator);
}else{
$this->assign('operator','');
}
$area_id =$data['area_id'];
if($area_id){
$map[] = ['station_info.area_id','=',$area_id];
$this->assign('area_id',$area_id);
}else{
$this->assign('area_id','');
}
if(!$map){
echo 0;die;
}
//权限检测
$user = Session::get('user');
if(!$user['is_admin']){
$permissionData=check_data();
if($permissionData){
$map[]=$permissionData;
}
}
$map[] = ['d.longitude','neq',""];
$map[] = ['d.latitude','neq',""];
$datalist= BaseStationModel::field('station_id,station_name,proj_number,longitude,latitude')->leftJoin(['station_info_detai'=>'d'],'station_info.station_id = d.stationid')->where($map)->limit(200)->select()->toArray();
}else{
$map1=[];
//权限检测
$user = Session::get('user');
if(!$user['is_admin']){
$permissionData=check_data();
if($permissionData){
$map1[]=$permissionData;
}
}
$position= Request::param('data');
$ff= $position['lng'];
$ee= $position['lat'];
$fff=$ff+"0.200000";
$eee=$ee+"0.200000";
$map1[] = ['d.longitude','between',"$ff,$fff"];
$map1[] = ['d.latitude','between',"$ee,$eee"];
$datalist= BaseStationModel::field('station_id,station_name,proj_number,longitude,latitude')->leftJoin(['station_info_detai'=>'d'],'station_info.station_id = d.stationid')->where($map1)->select()->toArray();
}
if(!$datalist){
echo 0;die;
}
$lats = $lons = array();
foreach ($datalist as $key => $value) {
array_push($lats, $value['latitude']);
array_push($lons, $value['longitude']);
}
$minlat = min($lats);
$maxlat = max($lats);
$minlon = min($lons);
$maxlon = max($lons);
$zpoint = [
'minLat'=>$minlat,
'maxLat'=>$maxlat,
'minLng'=>$minlon,
'maxLng'=>$maxlon
];
$lat = $maxlat - (($maxlat - $minlat) / 2);
$lng = $maxlon - (($maxlon - $minlon) / 2);
$oPoint=array("latitude" => $lat, "longitude" => $lng);
$datalist['datacount'] = 5000;
$datalist['counts'] = 200;
$datalist['oPoint'] = $oPoint;
$datalist['zPoint'] = $zpoint;
if($datalist){
echo json_encode($datalist);
}
}
}
}
\ No newline at end of file
<!DOCTYPE html>
<html class="x-admin-sm">
{include file="public/head" /}
{block name="head"}
{/block}
<body>
<div class="layui-fluid">
{block name="body"}
<div class="layui-row">
<form class="layui-form">
<div class="layui-form-item">
<label for="username" class="layui-form-label">
<span class="x-red">*</span>登录名
</label>
<div class="layui-input-inline">
<input type="text" id="username" name="username" required="" lay-verify="required"
autocomplete="off" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">
<span class="x-red">*</span>将会成为您唯一的登入名
</div>
</div>
<div class="layui-form-item">
<label for="phone" class="layui-form-label">
<span class="x-red">*</span>手机
</label>
<div class="layui-input-inline">
<input type="text" id="phone" name="phone" required="" lay-verify="phone"
autocomplete="off" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">
<span class="x-red">*</span>将会成为您唯一的登入名
</div>
</div>
<div class="layui-form-item">
<label for="L_email" class="layui-form-label">
<span class="x-red">*</span>邮箱
</label>
<div class="layui-input-inline">
<input type="text" id="L_email" name="email" required="" lay-verify="email"
autocomplete="off" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">
<span class="x-red">*</span>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label"><span class="x-red">*</span>角色</label>
<div class="layui-input-block">
<input type="checkbox" name="like1[write]" lay-skin="primary" title="超级管理员" checked="">
<input type="checkbox" name="like1[read]" lay-skin="primary" title="编辑人员">
<input type="checkbox" name="like1[write]" lay-skin="primary" title="宣传人员" checked="">
</div>
</div>
<div class="layui-form-item">
<label for="L_pass" class="layui-form-label">
<span class="x-red">*</span>密码
</label>
<div class="layui-input-inline">
<input type="password" id="L_pass" name="pass" required="" lay-verify="pass"
autocomplete="off" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">
6到16个字符
</div>
</div>
<div class="layui-form-item">
<label for="L_repass" class="layui-form-label">
<span class="x-red">*</span>确认密码
</label>
<div class="layui-input-inline">
<input type="password" id="L_repass" name="repass" required="" lay-verify="repass"
autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label for="L_repass" class="layui-form-label">
</label>
<button class="layui-btn" lay-filter="add" lay-submit="">
增加
</button>
</div>
</form></div>
{/block}
</div>
{block name="js"}
<script>layui.use(['form', 'layer'],
function() {
$ = layui.jquery;
var form = layui.form,
layer = layui.layer;
//自定义验证规则
form.verify({
nikename: function(value) {
if (value.length < 5) {
return '昵称至少得5个字符啊';
}
},
pass: [/(.+){6,12}$/, '密码必须6到12位'],
repass: function(value) {
if ($('#L_pass').val() != $('#L_repass').val()) {
return '两次密码不一致';
}
}
});
//监听提交
form.on('submit(add)',
function(data) {
console.log(data);
//发异步,把数据提交给php
layer.alert("增加成功", {
icon: 6
},
function() {
//关闭当前frame
xadmin.close();
// 可以对父窗口进行刷新
xadmin.father_reload();
});
return false;
});
});</script>
{/block}
</body>
{block name="modal"}
{/block}
</html>
<head>
<meta charset="UTF-8">
<title>广厦网络基站综合支撑平台</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" href="__STATIC__/xadmin/css/font.css">
<link rel="stylesheet" href="__STATIC__/xadmin/css/xadmin.css">
<link rel="stylesheet" href="__STATIC__/xadmin/css/theme10.css">
<link rel="stylesheet" href="__STATIC__/font_1220417_290/iconfont.css">
<link rel="stylesheet" href="__STATIC__/admin/css/style.css">
<script src="__STATIC__/xadmin/lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="__STATIC__/xadmin/js/xadmin.js"></script>
<script>
// 是否开启刷新记忆tab功能
var is_remember = false;
</script>
</head>
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论