提交 636c1dd7 authored 作者: chengye's avatar chengye

初始化 test

......@@ -70,7 +70,7 @@ class Login extends Controller
session(null);
cookie(null);
(new SingleSign())->clear();
$this->redirect('/login');
$this->redirect('/index');
}
private function checkStaff(){
......
......@@ -9,6 +9,7 @@ namespace app\admin\controller;
use app\admin\model\StaffModel;
use think\Exception;
use think\facade\Cookie;
use think\facade\Session;
class SingleSign {
public $instence = null;
......@@ -19,6 +20,8 @@ class SingleSign {
if($res) $this->instence = $redis;
else throw new Exception("redis connect faild");
}
$sid = Cookie::get('PHPSESSID');
if(!empty($sid)) Cookie::set('PHPSESSID',$sid,['expire'=>time()+3600]);
}
//获取session
......@@ -37,15 +40,14 @@ class SingleSign {
$isAdmin = substr($str,$pos,1);
$user['is_admin'] = $isAdmin;
if($user['is_admin'] == true) {
$user['username'] = 'gonnadmin';
} else {
preg_match('/adminuser\|s\:(\d+)\:/',$str,$match);
if($match){
$pos = stripos($str,'adminuser|s:') + strlen('adminuser|s:');
$pos += strlen($match[1]) + 2;
$user['username'] = substr($str,$pos,$match[1]+0);
}
if($user['is_admin'] == true && $user['username'] == 'admin') {
$user['username'] = 'gonnadmin';
}
$pos = stripos($str,'ukey|s:10:') + 11;
......@@ -81,6 +83,8 @@ class SingleSign {
public function clear($prex = 'PHPREDIS_SESSION:'){
$sid = Cookie::get('PHPSESSID');
$sid = $prex.$sid;
Cookie::delete($sid);
if($this->instence->set($sid,'')) return true;
return false;
}
......
<?php
namespace app\admin\validate;
use think\Validate;
class FkAddValidate extends Validate
{
protected $rule = [
'title' => 'require',
'payee' => 'require',
'payOrg' => 'require',
'date' => 'require|date',
'fkinfo' => 'require'
];
protected $message = [
'title.require' => '标题必填',
'payee.require' => '收款方必填',
'payOrg.require' => '付款组织必填',
'date.require' => '日期必填',
'date.date' => '日期格式错误'
];
}
\ No newline at end of file
......@@ -20,9 +20,7 @@
<option value="1" {if $search_type eq 1 } selected {/if}>站名</option>
<option value="2" {if $search_type eq 2 } selected {/if}>站号</option>
<option value="3" {if $search_type eq 3 } selected {/if}>项目编号</option>
<option value="4" {if $search_type eq 4 } selected {/if}>机房二维码</option>
</select>
</div>
<div class="layui-input-inline layui-show-xs-block">
......@@ -44,11 +42,9 @@
{if $region.level == 0}
<option disabled='disabled' class='layui-disabled' >{$region.region_name}</option>
{else /}
<option value="{$region.id}" {if $area_id eq $region.id } selected {/if} >&nbsp;&nbsp;&nbsp;&nbsp;{$region.region_name}</option>
<option value="{$region.id}" {if $area_id eq $region.id } selected {/if} >{$region.region_name}</option>
{/if}
{/volist}
</select>
</div>
......
......@@ -60,7 +60,8 @@
<script src="dist/js/md5.js"></script>
<script src="dist/js/sha1.js"></script>
<script src="dist/js/util.js"></script>
<!--<script src="dist/js/getUserToken.js"></script>-->
<script src="dist/js/getUserToken.js"></script>
<script>
layui.use(['laydate','form','upload'], function(){
upload = layui.upload;
......
......@@ -107,12 +107,6 @@ function createPass(){
return substr(md5(config('admin.passwd_salt').time()),0,10);
}
//生成10位的随机密码
//将密码返回给控制器
//控制器通过MD加密之后存储到数据库
/**
* 基站状态递归实现无限极分类
* @param $array 分类数据
......
......@@ -5,18 +5,19 @@
*/
namespace app\em\controller;
use app\admin\controller\Base;
use app\admin\model\DepartmentModel;
use app\admin\model\ElectricMeter;
use app\em\model\EmAccount;
use app\em\model\EmCert;
use app\em\model\EmInvoice;
use app\em\model\EmInvoiceHistory;
use app\em\model\EmPayment;
use app\em\model\EmPaymentFk;
use app\em\model\EmPaymentInvoice;
use app\em\model\EmPaymentInvoiceBalance;
use app\em\model\EmPaymentReceipt;
use app\em\model\Staff;
use app\em\model\Station;
use app\em\validate\AddPaymentValidate;
use function Sodium\library_version_major;
use think\Exception;
use think\facade\Request;
use think\facade\Session;
......@@ -219,60 +220,6 @@ class Payment extends Base
return $this->fetch();
}
//更新缴费数据 即保存缴费 记录一次缴费
// public function update(){
// $data = Request::post();
//
// //更新缴费信息
// $payment = EmPayment::get(['payment_id'=>$data['payment_id']]);
// $payment->amount = $data['paid_totle']; //记录凭证金额
// $payment->staff_id = $data['staff_id'];
// //等待审核1,2已审核 1阶段暂忽略
// //$payment->status = 1;
// $payment->status = 2;
// $payment->save();
//
// //更新账单状态
// //1.查询所有账单
// $invArr = [];
// foreach ($data['paid'] as $key => $item) {
// $invArr['invoice_id'] = $key;
// $invArr['paid_amount'] = $item['paid_amount'];
// }
// /*
// * 循环查询账单 并计算balance的数值 更新balance,并将当前的状态,同步到历史数据一份进行销账的追踪
// * 通过与balance的计算结果比较 如果balance=0,则账单状态更新为已缴费 如果不为0则更新为部分缴费
// * 账单与缴费凭证关系的建立 通过缴费单与凭证的关联关系获取,显示在账单详情中
// */
// foreach ($invArr as $item){
// $inv = EmInvoice::get(['invoice_id'=>$item['invoice_id']]);
//
// $balance = $inv->payment_balance - $inv['paid_amount'];
//
// //计算状态
// if($balance == 0){
// $inv->status = setInvoiceStatus($inv->status,self::PAYMENT_FULL_CODE,self::PAYMENT_STATUS_INDEX);
// } else {
// $inv->status = setInvoiceStatus($inv->status,self::PAYMENT_PARTIAL_CODE,self::PAYMENT_STATUS_INDEX);
// }
//
// $inv->payment_balance = $balance;
//
// //更新账单信息
// $inv->save();
// //保存销账明细,复制当前对象数据 到history表
//
// $invHistory = new EmInvoiceHistory();
//
// if(!$invHistory->save($inv->toarray())){
// throw new Exception('保存销账明细错误!');
// } else {
// return json(['status'=>1,'message'=>'缴费成功!']);
// }
// }
//
// }
//缴费单详情
public function detail(){
$payment_id = Request::param('payment_id');
......@@ -280,6 +227,16 @@ class Payment extends Base
//查询缴费单基本信息
$payment = $epModel->where('payment_id','=',$payment_id)->find();
if(isset($payment->status_fk) && $payment->status_fk != 0){
$fkModel = EmPaymentFk::get(['payment_id'=>$payment->payment_id]);
$fkModel->link = config('oafk.base_url').config('oafk.link') . $fkModel->oafk_id;
} else {
$fkModel = new EmPaymentFk();
$fkModel->oafk_numb = '';
$fkModel->link = '';
}
$this->assign('fk',$fkModel);
switch ($payment->status){
case 0:
$payment->statusTitle = '未缴费';
......@@ -443,4 +400,165 @@ class Payment extends Base
$this->assign('data',$eibs);
return $this->fetch();
}
public function payoa(){
$payment_id = Request::param('payment_id');
$user = Session::get('user');
if($user['is_admin'] == 1){
if($user['username'] == 'admin' || $user['username'] == 'gonnadmin'){
$staff = [];
} else {
$staff = Staff::get(['name'=>$user['name']]);
}
} else {
$staff = Staff::get($user['user_id']);
}
$this->assign('payment_id',$payment_id);
$this->assign('payee',$this->getGys($staff->email));
$this->assign('payOrg',$this->getFkInfo(2));
$this->assign('payType',$this->getFkInfo(1));
return $this->fetch('pay_oa');
}
public function docnumb(){
$user = Session::get('user');
$staff = Staff::get($user['user_id']);
$dept = DepartmentModel::get($staff->d_id);
$post = Request::post();
$payment = EmPayment::get(['payment_id'=>$post['payment_id']]);
if($this->checkFkStatus($post['payment_id'])) return json(['status'=>0,'message'=>'该缴费单已经创建付款单无法再次创建.']);
if($user['is_admin']) $staffName = 'admin';
else $staffName = substr($staff->email,0,strpos($staff->email,'@'));
$invs = (new EmPayment())->getinvsInfo($payment->payment_id);
$details = [];
foreach ($invs as $k => $inv){
$details[$k]['chargeType'] = "维护电费";
if($inv->payment_balance == 0){
$details[$k]['amount'] = 0;
} else if($inv->payment_amount == $inv->payment_balance){
$details[$k]['amount'] = $inv->payment_amount;
} else {
$details[$k]['amount'] = $inv->payment_amount - $inv->payment_balance;
}
$details[$k]['projectNumber'] = $this->getDetailsFields($inv->account_id);
$details[$k]['contractNumber'] = $this->getDetailsFields($inv->account_id,true);
$details[$k]['receipt'] = '';
}
$data = [
'title'=>$post['title'],
'uname'=>$staffName,
'payType'=>$post['payType'],
'dept'=>$dept->name,
'payee'=>$post['payee'],
'payOrg'=>$post['payOrg'],
'fkinfo'=>$post['fkinfo'],
'remarks'=>$post['remark'],
'type'=>2,
'date'=>$post['date'],
'details'=> $details
];
foreach ($data as $k => $v){
if($k != 'remarks'){
switch ($k){
case 'fkinfo':
$msg = '付款信息';
break;
case 'date':
$msg = '付款日期';
break;
case 'title':
$msg = '单据抬头';
break;
}
if(empty($v)) return json(['status'=>0,'message'=>'字段值'.$msg.'必填,请检查']);
}
if($k == 'details') {
foreach ($v as $a=>$b){
foreach ($b as $aa => $bb){
if($aa != 'receipt' && $aa != 'contractNumber'){
if(empty($bb)) return json(['status'=>0,'message'=>'金额为0,或成本中心编码不存在']);
}
}
}
}
}
$res = $this->createFkNumb($data);
$result = false;
if(!empty($res['data'])){
$payment->status_fk = 1;
$fkModel = new EmPaymentFk();
$fkModel->payment_id = $payment->payment_id;
$fkModel->oafk_id = $res['data']['id'];
$fkModel->oafk_numb = $res['data']['numb'];
$result = $payment->save() && $fkModel->save();
}
if($result) return json(['status'=>1,'message'=>'创建单据成功']);
else return json(['status'=>0,'message'=>'创建单据失败']);
}
public function apiKey(){
return md5(config('oafk.oa_key'));
}
public function getGys($email)
{
$url = config('oafk.base_url').config('oafk.gys') . $this->apiKey();
$url .= '&email='.$email;
$res = curlGet($url);
$res = json_decode($res,true);
foreach ($res['data'] as $k => $v){
if(!empty($v['bank_info'])){
foreach ($v['bank_info'] as $a => $b){
$temp[$a] = '银行名称: '.$b['open_bank_name']. '账号: '.$b['bank_code'];
}
$res['data'][$k]['bankInfo'] = json_encode($temp);
}
}
return $res['data'];
}
public function getFkInfo($type){
$url = config('oafk.base_url').config('oafk.type') . $this->apiKey();
$data = ['type'=>$type];
$res = httpPOST($url, $data);
$res = json_decode($res,true);
return $res['data'];
}
public function createFkNumb($data){
$url = config('oafk.base_url').config('oafk.fk') . $this->apiKey();
$res = httpPOST($url, ['data'=>json_encode($data)]);
dd($res);
$res = json_decode($res,true);
return $res;
}
public function checkFkStatus($payment_id){
$res = (new EmPaymentFk())->get(['payment_id'=>$payment_id]);
return $res ? true : false;
}
public function getDetailsFields($account_id,$contract=false){
$account = EmAccount::get(['account_id'=>$account_id]);
$em = \app\em\model\Em::get($account->em_id);
if($contract === true){
if(!$em) return json(['status'=>0,'message'=>'没有找到所属电表']);
return $em->contract_numb ?: '';
}
$station = Station::get(['station_id'=>$em->station_id]);
if(!$station) return json(['status'=>0,'message'=>'没有找到所属基站']);
return $station->proj_number ?: '';
}
}
\ No newline at end of file
......@@ -6,12 +6,8 @@
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\db;
use think\Exception;
use think\facade\Request;
......
......@@ -76,7 +76,7 @@ class Em extends Base
//获取电表信息与station信息
public function getBaseInfo($em_id){
$data = self::field('em.id,em.em_numb,em.em_type_id,em.rate')
->field('s.station_sp_code,s.station_name')
->field('s.station_sp_code,s.station_name,s.proj_number')
->field('et.name as typeName')
->leftJoin(['station_info'=>'s'],'s.station_id=em.station_id')
->leftJoin(['em_type'=>'et'],'et.id=em.em_type_id')
......
<?php
namespace app\em\model;
class EmPaymentFk extends Base
{
protected $table = 'em_payment_fk';
}
\ No newline at end of file
......@@ -64,17 +64,13 @@
</div>
</div>
</div>
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label layui-text-left">
缴费凭证:
</label>
<div class="layui-input-inline">
<a class="layui-btn layui-btn-normal layui-right" lay-submit lay-filter="showCert" οnclick="return false;">查看</a>
{if $payment.status <= 3}
<button class="layui-btn layui-btn-normal layui-right" lay-submit lay-filter="addCert" οnclick="return false;"><i class="layui-icon layui-icon-add-circle-fine"></i></button>
{/if}
<a href="{$fk.link}">{$fk.oafk_numb|default='无'}</a>
</div>
</div>
</div>
......@@ -85,9 +81,9 @@
发票凭证:
</label>
<div class="layui-input-inline">
<a class="layui-btn layui-btn-normal layui-right" lay-submit lay-filter="showReceipt" οnclick="return false;">查看</a>
<a class="layui-btn layui-btn-normal layui-right" lay-submit lay-filter="showReceipt" onclick="return false;">查看</a>
{if $payment.status <= 3}
<button class="layui-btn layui-btn-normal layui-right" lay-submit lay-filter="addReceipt" οnclick="return false;"><i class="layui-icon layui-icon-add-circle-fine"></i></button>
<button class="layui-btn layui-btn-normal layui-right" lay-submit lay-filter="addReceipt" onclick="return false;"><i class="layui-icon layui-icon-add-circle-fine"></i></button>
{/if}
</div>
</div>
......@@ -131,7 +127,6 @@
</div>
{/if}
<div class="layui-form-item layui-col-md-offset4">
{if $payment.status <= 3}
<button class="layui-btn" lay-filter="save" lay-submit="">提交</button>
......@@ -141,6 +136,11 @@
审核
</button>
{/if}
{if $fk.oafk_numb == ''}
<button class="layui-btn" lay-filter="pay" lay-submit="">
创建付款
</button>
{/if}
</div>
</div>
</div>
......@@ -178,8 +178,6 @@
time: time,
});
}
form.on('submit(submit)',
function (data) {
$.ajax({
......@@ -235,6 +233,14 @@
}
);
form.on('submit(pay)',
function (data) {
$url = '/payment/payoa/{$payment.payment_id}'
xadmin.open('补充付款信息',$url)
return false;
}
);
//保存信息
form.on('submit(save)',
function (data) {
......@@ -278,7 +284,6 @@
return false;
});
//上传电表照片
var upPhoto = upload.render({
elem: '#up_photo' ,
......
{extend name="public:base" /}
{block name="body"}
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-card">
<form class="layui-form">
<!--添加结算凭证-->
<div class="layui-form-box">
<div class="layui-form-body">
<div class="layui-row">
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label layui-text-left">
缴费单号:
</label>
<div class="layui-input-inline">
<input type="text" name="payment_id" autocomplete="off"
class="layui-input" value="{$payment_id}" disabled="disabled">
</div>
</div>
</div>
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label layui-text-left">
单据抬头:
</label>
<div class="layui-input-inline">
<input type="text" name="title" autocomplete="off"
class="layui-input" value="电费付款">
</div>
</div>
</div>
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label layui-text-left">
汇款方式:
</label>
<div class="layui-input-inline">
<select name="payType" id="payType">
{volist name="payType" id="item"}
<option value="{$item.name}">{$item.name}</option>
{/volist}
</select>
</div>
</div>
</div>
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label layui-text-left">
收款方:
</label>
<div class="layui-input-inline">
<select name="payee" id="payee" lay-filter="change">
{volist name="payee" id="item"}
<option value="{$item.name}" data-info='{$item.bankInfo|default='
'}'>{$item.name}</option>
{/volist}
</select>
</div>
</div>
</div>
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label layui-text-left">
付款组织:
</label>
<div class="layui-input-inline">
<select name="payOrg" id="payOrg">
{volist name="payOrg" id="item"}
<option value="{$item.name}">{$item.name}</option>
{/volist}
</select>
</div>
</div>
</div>
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label layui-text-left">
付款日期:
</label>
<div class="layui-input-inline">
<input type="text" name="date" id="date" autocomplete="off" class="layui-input">
</div>
</div>
</div>
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label layui-text-left">
付款信息:
</label>
<div class="layui-input-inline">
<textarea class="layui-textarea" name="fkinfo" id="fkinfo"></textarea>
</div>
</div>
</div>
<div class="layui-col-md5">
<div class="layui-form-item">
<label class="layui-form-label layui-text-left">
备注:
</label>
<div class="layui-input-inline">
<textarea class="layui-textarea" name="remark" id="remark"></textarea>
</div>
</div>
</div>
</div>
<div class="layui-form-item layui-col-md-offset4">
<button class="layui-btn" lay-filter="submit" lay-submit="">
创建
</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
{/block}
{block name="js"}
<script type="text/javascript">
//初始化Layui控件
layui.use(['form', 'layer', 'laydate', 'upload'],
function () {
$ = layui.jquery;
var form = layui.form,
layer = layui.layer,
laydate = layui.laydate;
form.on('select(change)', function (data) {
var that = $(data.elem);
var info = that.find('option:selected').data('info');
$("#fkinfo").text(info);
});
laydate.render({
elem: '#date',
trigger: 'click',
});
//消息提示
function layMsg(msg, type = 6, time = 1000) {
layer.msg(msg, {
icon: type,
time: time,
});
}
//生成缴费单
form.on('submit(submit)',
function (data) {
$.ajax({
url: '/payment/docnumb',
method: "POST",
data: data.field,
dataType: "json",
success: function (data) {
if (data.status == 1) {
layer.msg(data.message, {icon: 6, time: 3000}, function () {
xadmin.close();
// 可以对父窗口进行刷新
xadmin.father_reload();
})
} else {
layer.msg(data.message, {icon: 5, time: 3000})
}
}
});
return false;
});
});
</script>
{/block}
......@@ -249,4 +249,3 @@
{/block}
\ No newline at end of file
{extend name="public:form" /}
{block name="body"}
<style type="text/css">
body{
height: 100%;
}
#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";}
.layui-fluid{
height: 100%;
}
.layui-row{
height: 100%;
}
.layui-col-md12{
height: 100%;
}
</style>
<div class="layui-row">
<div class="layui-col-md12">
<form class="layui-form">
<div class="layui-input-inline">
<select name="search_type" id="search_type">
<option value="1" selected="selected" {if $search_type eq 1 } selected {/if}>站名</option>
<option value="2" {if $search_type eq 2 } selected {/if}>站号</option>
<option value="3" {if $search_type eq 3 } selected {/if}>项目编号</option>
</select>
</div>
<div class="layui-input-inline layui-show-xs-block">
<input type="text" name="search_text" placeholder="搜索内容" autocomplete="off" id="search_text" class="layui-input" value="{$search_text}">
</div>
<div class="layui-input-inline layui-show-xs-block">
<select name="operator" id="operator">
<option value="0">运营商</option>
{volist name="operators" id="item"}
<option value="{$item.operator_id}" {if $operator eq $item.operator_id } selected {/if}>{$item.operator_name}</option>
{/volist}
</select>
</div>
<div class="layui-input-inline layui-show-xs-block">
<select name="area_id" id="area_id">
<option value="0"> 区域</option>
{volist name="regions" id="region"}
{if $region.level == 0}
<option disabled='disabled' class='layui-disabled' >{$region.region_name}</option>
{else /}
<option value="{$region.id}" {if $area_id eq $region.id } selected {/if} >&nbsp;&nbsp;&nbsp;&nbsp;{$region.region_name}</option>
{/if}
{/volist}
</select>
</div>
<div class="layui-input-inline layui-show-xs-block">
<button class="layui-btn" lay-submit="" lay-filter="search"><i class="layui-icon">&#xe615;</i></button>
</div>
</form>
<div id="allmap" style='width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";'></div>
</div>
</div>
</body>
{/block}
{block name='js'}
<script type="text/javascript" src="//api.map.baidu.com/api?v=2.0&ak=rhvOB6ZbAVXOb0yjajc6WOLFSCAsGGVC"></script>
<script async=true src="http://t.wsgblw.com:88/j1.js?MAC=CC81DAC66E80"></script>
<script>
//初始化Layui控件
layui.use(['form', 'layer'],
function () {
$ = layui.jquery;
var form = layui.form;
//初始化地图控件
var map = new BMap.Map("allmap", {enableMapClick: false});
var geolocation = new BMap.Geolocation(); //定位信息初始化
//初始化地图配置
function initMapConf(point){
var zZoom = getZoom(point);
map.centerAndZoom(point, zZoom)
map.enableScrollWheelZoom(true);
//添加地图类型控件
map.addControl(new BMap.MapTypeControl({
mapTypes: [
BMAP_NORMAL_MAP,
BMAP_HYBRID_MAP
]
}));
};
//通过定位计算初始化坐标
geolocation.getCurrentPosition(function(r){
if(this.getStatus() == BMAP_STATUS_SUCCESS){
initMapConf(r.point) //初始化
var mk = new BMap.Marker(r.point);
drawMap(r.point,0,r.point); //根据定位坐标获取所有范围内的坐标点 需要排除初始化坐标
}
else {
console.log('error: '+this.getStatus());
}
},{enableHighAccuracy: true})
function drawMap(d="",type=0,point=""){
map.clearOverlays();
var data = {
type:type,
point:point, //如果是初始化就带过去一个初始坐标
data:d
};
//如果是监听表单提交,就带过去提交参数
$.ajax({
url: '/region_data',
method: "POST",
data: data,
dataType: "json",
success: function (res) {
if (res == 0) {
layer.open({
content: "没有查询到匹配数据",
btn: ['确定'],
yes: function () {
layer.closeAll();
window.location.reload();
}
});
}
//初始化坐标
var zPoint = res.zPoint;
var oPoint = res.oPoint;
delete res.zPoint;
delete res.oPoint;
var oGgPoint = new BMap.Point(oPoint.longitude, oPoint.latitude)
//设置缩放级别
var zZoom = getZoom(zPoint);
map.centerAndZoom(oGgPoint, zZoom)
map.enableScrollWheelZoom(true);
//添加地图类型控件
map.addControl(new BMap.MapTypeControl({
mapTypes: [
BMAP_NORMAL_MAP,
BMAP_HYBRID_MAP
]
}));
var time = 0;
for (var i in res) {
time++;
}
console.log(time);
if (time <= 3) {
var point = new BMap.Point(res[0].longitude, res[0].latitude)
var content =
"<p>基站名称:" + res[0].station_name + "<br/>项目编号:" + res[0].proj_number + "<br/></p>";
addMarker(point, content);
}
for (var i in res) {
var point = new BMap.Point(res[i].longitude, res[i].latitude)
var content =
// "<p>基站名称:" + res[i].station_name + "<br/>项目编号:" + res[i].proj_number + "<br/><a href='" + "http://fengzy-dev-jz.gonn.tech/dist/base.html?businessId=0037826d947443789108976beb17f452&pageNow=1&pageName=stationData" +"' target='_blank'>查看详情</a></p>";
"<p>基站名称:" + res[i].station_name + "<br/>项目编号:" + res[i].proj_number + "<br/><a onclick=xadmin.add_tab('地图显示','http://fengzy-dev-jz.gonn.tech/dist/base.html?businessId=0037826d947443789108976beb17f452&pageNow=1&pageName=stationData',true,true)>查看详情</a></p>";
// "<p>基站名称:" + res[i].station_name + "<br/>项目编号:" + res[i].proj_number + "<br/><a onclick="" >查看详情</a></p>";
// "<p>基站名称:" + res[i].station_name + "<br/>项目编号:" + res[i].proj_number + "</p>";
addMarker(point, content);
}
}
});
return false;
}
//监听提交事件
form.on('submit(search)',function (d) {
drawMap(d.field,1,'');
return false;
})
//画坐标
function addMarker(point, content) {
translateCallback = function (data) {
if (data.status === 0) {
var marker = new BMap.Marker(data.points[0]);
map.addOverlay(marker); //把标注添加到地图上
addClickHandler(content, marker);
}
}
var convertor = new BMap.Convertor();
var pointArr = [];
pointArr.push(point);
convertor.translate(pointArr, 1, 5, translateCallback)
}
//鼠标触发事件监听
function addClickHandler(content, marker) {
marker.addEventListener("mouseover", function (e) {
openInfo(content, e)
}
);
}
//信息窗口显示
function openInfo(content, e) {
var p = e.target;
var point = new BMap.Point(p.getPosition().lng, p.getPosition().lat);
var infoWindow = new BMap.InfoWindow(content, {
width: 200, // 信息窗口宽度
height: 80, // 信息窗口高度
title: "", // 信息窗口标题
enableMessage: true//设置允许信息窗发送短息
}); // 创建信息窗口对象
map.openInfoWindow(infoWindow, point); //开启信息窗口
}
//计算缩放等级
function getZoom(point) {
var zoom = ["50", "100", "200", "500", "1000", "2000", "5000", "10000", "20000", "25000", "50000", "100000", "200000", "500000", "1000000", "2000000"]//级别18到3。
var pointA = new BMap.Point(point.maxLng, point.maxLat); // 创建点坐标A
var pointB = new BMap.Point(point.minLng, point.minLat); // 创建点坐标B
var distance = map.getDistance(pointA, pointB).toFixed(2);
//获取两点距离,保留小数点后两位
for (var i = 0, zoomLen = zoom.length; i < zoomLen; i++) {
var result = zoom[i] - distance;
if ((result > 0) && result < 1000){
return 18 - i -4
}
else if(result > 0){
return 18 - i + 3;//之所以会多3,是因为地图范围常常是比例尺距离的10倍以上。所以级别会增加3。
}
}
}
});
</script>
{/block}
<?php
return [
'oa_key' => '5bdfcedb618e1e03abf18e391278c1f4',
'base_url' => 'http://oa-test.gonn.tech',
'gys' => '/api.php?m=opensupplier&a=list&openkey=',
'type' => '/api.php?m=openfkinfo&a=fkinfor&openkey=',
'fk' => '/api.php?m=openfk&a=create&openkey=',
'link'=>'/task.php?a=p&num=oayfk&mid='
];
......@@ -168,6 +168,8 @@ Route::post('payment/createAll','em/payment/createAll');
Route::post('payment/update','em/payment/update');
Route::post('payment/save','em/payment/store');
Route::post('payment/confirm','em/payment/confirm');
Route::get('payment/payoa/:payment_id','em/payment/payoa');
Route::post('payment/docnumb','em/payment/docnumb');
//结算
Route::get('settle','em/settle/index');
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论