1、增加地图筛选小区的功能

2、统计筛选,排期筛选时增加小区类型
3、投放计划增加复制功能,仅实现了同订单下复制,方便同订单相似广告位的重复排期
This commit is contained in:
cloud 2020-12-06 23:45:46 +08:00
parent c33612f600
commit fe837f0df5
24 changed files with 3062 additions and 982 deletions

3
.gitignore vendored
View File

@ -5,4 +5,5 @@ nbbuild/
dist/
nbdist/
.nb-gradle/
/config/
/config/
/update/

View File

@ -8,213 +8,242 @@ load::own_class('appadmin');
* 配置
* 包含其他功能初始化
*/
class ajax extends appadmin {
class ajax extends appadmin
{
public function __construct() {
global $_M,$_YW;
public function __construct()
{
global $_M, $_YW;
parent::__construct();
}
//own.JS lang语言数组调用
public function doajaxcl() {
global $_M,$_YW;
public function doajaxcl()
{
global $_M, $_YW;
parent::loadp('cmp_a,cmp_ac');
unset($_YW['aop']);
unset($_YW['c']['ac_cache']);
echo parent::jsoncallback($_YW);
}
//将相同区域的信息全部查出
public function doallmap()
{
global $_M, $_YW;
$where = " 1 = 1 AND v_maplng IS NOT NULL AND v_maplat IS NOT NULL ";
if (!empty($_M['form']['id'])) $where .= " AND id != '{$_M['form']['id']}' ";
// 省市区
if (!empty($_M['form']['province'])) $where .= " AND v_province= '{$_M['form']['province']}' ";
if (!empty($_M['form']['city'])) $where .= " AND v_city= '{$_M['form']['city']}' ";
// if (!empty($_M['form']['district'])) $where .= " AND v_district= '{$_M['form']['district']}'";
$qfield = $_M['form']['allinfo'] === 'all' ? '*' : 'id,v_maplng,v_maplat';
$array = $this->tsql->table('village')
->qfield($qfield)
->where($where)
->all();
echo parent::jsoncallback($array);
}
//城市选择
public function docitys() {
global $_M,$_YW;
public function docitys()
{
global $_M, $_YW;
$this->cloud->citydata();
}
//查询广告位编号是否重复
public function doenumber() {
global $_M,$_YW;
$array = $this->tsql->table('elevator')->where(['e_number' => $_M['form']['e_number'] ])->one();
$result['valid'] = $array == false?true:($array['id'] == $_M['form']['id']?true:false);
public function doenumber()
{
global $_M, $_YW;
$array = $this->tsql->table('elevator')->where(['e_number' => $_M['form']['e_number']])->one();
$result['valid'] = $array == false ? true : ($array['id'] == $_M['form']['id'] ? true : false);
//再判断一个排期内是否存在此编号
echo parent::jsoncallback($result);
}
//查询广告位编号是否重复
public function dohnumber() {
global $_M,$_YW;
$array = $this->tsql->table('contract')->where(['h_number' => $_M['form']['h_number'] ])->one();
$result['valid'] = $array == false?true:($array['id'] == $_M['form']['id']?true:false);
public function dohnumber()
{
global $_M, $_YW;
$array = $this->tsql->table('contract')->where(['h_number' => $_M['form']['h_number']])->one();
$result['valid'] = $array == false ? true : ($array['id'] == $_M['form']['id'] ? true : false);
echo parent::jsoncallback($result);
}
//查询投放标题
public function dolatitle() {
global $_M,$_YW;
$ids = stringto_array($_M['form']['ids'],',');
if(count($ids)){
$url = $_M['url']['own_name'].'c=table_on&a=doschedule&s_lid=';
$strid = arrayto_string($ids,',');
public function dolatitle()
{
global $_M, $_YW;
$ids = stringto_array($_M['form']['ids'], ',');
if (count($ids)) {
$url = $_M['url']['own_name'] . 'c=table_on&a=doschedule&s_lid=';
$strid = arrayto_string($ids, ',');
$launch = $this->tsql->table('launch')->where(" id IN({$strid}) ")->all('id');
list($eid,$nid) = $ids;
$eslid = $eid?'<a href="'.$url.$eid.'" title="查看排期">'.$launch[$eid]['l_title'].'</a>':'';
$ntslid = $nid?'<a href="'.$url.$nid.'" title="查看排期">'.$launch[$nid]['l_title'].'</a>':'';
list($eid, $nid) = $ids;
$eslid = $eid ? '<a href="' . $url . $eid . '" title="查看排期">' . $launch[ $eid ]['l_title'] . '</a>' : '';
$ntslid = $nid ? '<a href="' . $url . $nid . '" title="查看排期">' . $launch[ $nid ]['l_title'] . '</a>' : '';
}
echo parent::jsoncallback(['eslid' => $eslid,'ntslid' => $ntslid ]);
echo parent::jsoncallback(['eslid' => $eslid, 'ntslid' => $ntslid]);
}
//广告位排期入库【重要】
public function doapplan() {
global $_M,$_YW;
public function doapplan()
{
global $_M, $_YW;
$form = $_M['form'];
$ap_enumber = $_M['form']['ap_enumber'];
$slid = $form['slid'];
//检查投放订单是否存在
$retarray = ['code' => false,'text' => '投放计划不存在!'];
$launch = $this->tsql->table('launch')
->where(['id' => $slid])
->one();
if($launch == false) {
$retarray = ['code' => false, 'text' => '投放计划不存在!'];
$launch = $this->tsql->table('launch')
->where(['id' => $slid])
->one();
if ($launch == false) {
echo parent::jsoncallback($retarray);
exit;
}
//检查广告位排期时间是否可用,是否合法
$l_starttime = strtotime($form['l_starttime']);
$l_endtime = strtotime($form['l_endtime']);
$daystr = strtotime(date('Y-m-d',time()));
if($l_starttime > $l_endtime && (empty($l_starttime) || empty($l_endtime)) ){
$retarray['text'] = "{$ap_enumber}】投放结束时间({$form['l_starttime']})不能小于开始时间({$form['l_endtime']})";
$l_starttime = strtotime($form['l_starttime']);
$l_endtime = strtotime($form['l_endtime']);
$daystr = strtotime(date('Y-m-d', time()));
if ($l_starttime > $l_endtime && (empty($l_starttime) || empty($l_endtime))) {
$retarray['text'] = "{$ap_enumber}】投放结束时间({$form['l_starttime']})不能小于开始时间({$form['l_endtime']})";
echo parent::jsoncallback($retarray);
exit;
}
//根据广告位编号查询对应广告位信息 e_enable
$elevator = $this->tsql->table('elevator')
->where(['e_number' => $ap_enumber])
->one();
$elstr = $error = $sqlupd = false;
$elevator = $this->tsql->table('elevator')
->where(['e_number' => $ap_enumber])
->one();
$elstr = $error = $sqlupd = false;
// 判断广告位是否存在
if($elevator != false){
if ($elevator != false) {
//进行排期处理
$field = [
's_lid' => $slid,
's_enumber' => $ap_enumber,
's_hnumber' => $form['l_hnumber'],
's_starttime' => $form['l_starttime'],
's_endtime' => $form['l_endtime'],
$field = [
's_lid' => $slid,
's_enumber' => $ap_enumber,
's_hnumber' => $form['l_hnumber'],
's_starttime' => $form['l_starttime'],
's_endtime' => $form['l_endtime'],
];
// 不可通过唯一索引新增和更新数据,因为他会先触发新增的触发器
// 先查询是否存在相应的广告位排期,存在则修改,相反为新增
$enum = $this->tsql->table('schedule')
->qfield('id')
->where(['s_lid' => $slid, 's_enumber' => $ap_enumber ])
->one();
$query1 = $this->tsql->query();
if($enum == false){
->qfield('id')
->where(['s_lid' => $slid, 's_enumber' => $ap_enumber])
->one();
if ($enum == false) {
//判断广告位是否停用
if($elevator['e_enable']){
if ($elevator['e_enable']) {
//新增
$field['id'] = 'UUID()';
$field['id'] = 'UUID()';
$this->tsql->table('schedule')
->special('UUID()')
->field($field)
->add();
$query = $this->tsql->query();
}else{
->special('UUID()')
->field($field)
->add();
} else {
//表示广告位已停用
$elstr = '已禁用';
$elstr = '已禁用';
}
}else{
} else {
//修改
$this->tsql->table('schedule')
->field($field)
->where(['id' => $enum['id']])
->upd();
->field($field)
->where(['id' => $enum['id']])
->upd();
$sqlupd = true;
}
//获取sql执行结果查看是否存在错误
$error = $this->tsql->error();
if($error){
$elstr = $error;
$error = $this->tsql->error();
if ($error) {
$elstr = $error;
// 清楚掉已存在,但修改后无法达到要求的广告位
if($sqlupd){
if ($sqlupd) {
$this->tsql->table('schedule')
->where(['id' => $enum['id'] ])
->del();
->where(['id' => $enum['id']])
->del();
}
}
//广告位地址
$e_address = parent::e_address($elevator);
}else{
$e_address = parent::e_address($elevator);
} else {
// 删除此广告位之前保存的排期记录
$this->tsql->table('schedule')
->where(['s_enumber' => $ap_enumber ])
->del();
->where(['s_enumber' => $ap_enumber])
->del();
// 记录不存在的广告位,保留到最后删除掉相关的选择广告位
$session = load::sys_class('session','new');
$senumber = $session->get('schedule_eid'.$slid);
$session = load::sys_class('session', 'new');
$senumber = $session->get('schedule_eid' . $slid);
$senumber[] = $ap_enumber;
$session->set('schedule_eid'.$slid,$senumber);
$e_address = "{$ap_enumber}";
$elstr = '广告位不存在或者已删除,';
$session->set('schedule_eid' . $slid, $senumber);
$e_address = "{$ap_enumber}";
$elstr = '广告位不存在或者已删除,';
}
$array = $elstr
?['code' => false,'text' => "{$e_address}{$elstr}排期失败。",'eid' =>$ap_enumber,$query,$enum,$field,$query1,$senumber]
:['code' => true,'text' => "{$e_address},排期成功。",'eid' =>$ap_enumber,$senumber];
$array = $elstr
? ['code' => false, 'text' => "{$e_address}{$elstr}排期失败。", 'eid' => $ap_enumber, $enum, $field, $senumber]
: ['code' => true, 'text' => "{$e_address},排期成功。", 'eid' => $ap_enumber, $senumber];
echo parent::jsoncallback($array);
exit;
}
//选中排期的成功广告位保存
public function dolenumber() {
global $_M,$_YW;
$slid = $_M['form']['slid'];
public function dolenumber()
{
global $_M, $_YW;
$slid = $_M['form']['slid'];
// 删除不存在的已选择广告位
$session = load::sys_class('session','new');
$schedule_eid = $session->get('schedule_eid'.$slid)?:[];
$session = load::sys_class('session', 'new');
$schedule_eid = $session->get('schedule_eid' . $slid) ?: [];
$session->del('schedule_eid');
$session->del('schedule_eid'.$slid);
$launch = $this->tsql->table('launch')
->where(['id' => $slid])
->one();
$l_selectenum = arrayto_string(array_unique(array_diff(stringto_array($launch['l_selectenum'],','),$schedule_eid)),',');
$session->del('schedule_eid' . $slid);
$launch = $this->tsql->table('launch')
->where(['id' => $slid])
->one();
$l_selectenum = arrayto_string(array_unique(array_diff(stringto_array($launch['l_selectenum'], ','), $schedule_eid)), ',');
// 排期保存
//查询出所有的
$schedule = $this->tsql->table('schedule')
->where(['s_lid' => $slid])
->all();
$idarr = array_column($schedule, 's_enumber');
$idstr = arrayto_string($idarr,',');
$schedule = $this->tsql->table('schedule')
->where(['s_lid' => $slid])
->all();
$idarr = array_column($schedule, 's_enumber');
$idstr = arrayto_string($idarr, ',');
$this->tsql->table('launch')
->field(['l_selectenum' => $l_selectenum,'l_enumber' => $idstr ])
->where(['id' => $slid])
->upd();
$error = $this->tsql->error();
$num = count($idarr);
$array = $error
?['code' => false,'text' => "选中广告位保存失败,导致排期失败!",'idstr' => $idstr,$schedule_eid]
:['code' => true,'text' => "选中的({$num})个广告位排期记录保存成功。",'idstr' => $idstr,$schedule_eid];
->field(['l_selectenum' => $l_selectenum, 'l_enumber' => $idstr])
->where(['id' => $slid])
->upd();
$error = $this->tsql->error();
$num = count($idarr);
$array = $error
? ['code' => false, 'text' => "选中广告位保存失败,导致排期失败!", 'idstr' => $idstr, $schedule_eid]
: ['code' => true, 'text' => "选中的({$num})个广告位排期记录保存成功。", 'idstr' => $idstr, $schedule_eid];
echo parent::jsoncallback($array);
}
//处理序列表,让他始终大于广告位的总个数
public function dosequence() {
global $_M,$_YW;
public function dosequence()
{
global $_M, $_YW;
$counta = $this->tsql->table('elevator')->count();
$countb = $this->tsql->table('sequence')->count();
$count = $counta + 10 - $countb;
if($count > 0){
for($i = 0; $i < $count; $i++){
if ($count > 0) {
for ($i = 0; $i < $count; $i++) {
$this->tsql->table('sequence')->field(['seq' => null])->add();
}
}
echo parent::jsoncallback([$counta,$countb,$count]);
echo parent::jsoncallback([$counta, $countb, $count]);
}
}
?>

View File

@ -8,59 +8,68 @@ load::own_class('appadmin');
* 配置
* 包含其他功能初始化
*/
class config extends appadmin {
class config extends appadmin
{
public function __construct() {
global $_M,$_YW;
public function __construct()
{
global $_M, $_YW;
parent::__construct();
$this->tname = $_M['form']['tname'];
$this->tname = $_M['form']['tname'];
}
public function __destruct() {
global $_M,$_YW;
if($this->destruct){
if(empty($this->appshow)) $this->appshow = 'app/'.$this->tname;
require $this->show($this->appshow,$this->input);
public function __destruct()
{
global $_M, $_YW;
if ($this->destruct) {
if (empty($this->appshow)) $this->appshow = 'app/' . $this->tname;
require $this->show($this->appshow, $this->input);
}
}
//页初始化
public function doindex(){
global $_M,$_YW;
parent::point('config','doconfig','config');
public function doindex()
{
global $_M, $_YW;
parent::point('config', 'doconfig', 'config');
parent::appurl('index');
parent::appnav(['config__doindex','基础配置']);
$this->input = $this->input + $_YW;
parent::appnav(['config__doindex', '基础配置']);
$this->input = $this->input + $_YW;
//城市json
$this->input['url']['city'] = $this->cloud->city_url();
}
//API配置信息保存
public function doconfig(){
global $_M,$_YW;
$form = $_M['form'];
$form['openid'] = arrayto_string($form['openids'],',');
public function doconfig()
{
global $_M, $_YW;
$form = $_M['form'];
$form['openid'] = arrayto_string($form['openids'], ',');
self::configsql($form);
$this->destruct = false;
turnover($_M['url']['own_form'] . 'a=do'.$this->tname, '操作成功');
turnover($_M['url']['own_form'] . 'a=do' . $this->tname, '操作成功');
}
//配置信息保存
private function configsql($form = [],$lang = '') {
private function configsql($form = [], $lang = '')
{
global $_M;
if(empty($lang)) $lang = $_M['lang'];
if (empty($lang)) $lang = $_M['lang'];
//程序运行必备
$para_a = ['tem_ida','tem_idb','tem_idc','openid'];
$para_b = [];
$para = array_merge($para_a,$para_b);
$arrs = array_intersect_key($form, array_combine($para,$para)); //对比数组
$para_a = ['tem_ida', 'tem_idb', 'tem_idc', 'openid'];
$para_b = ['mapkey','mapprov','mapcity','mapdist','maplng','maplat'];
$para = array_merge($para_a, $para_b);
$arrs = array_intersect_key($form, array_combine($para, $para)); //对比数组
foreach ($arrs as $k => $v) {
$array[] = [$k,$_M['form']['n'],$v,$lang];
$array[] = [$k, $_M['form']['n'], $v, $lang];
}
$this->tsql->table('cloud_config',false)
->qfield('name,m_name,value,lang')
->unique('value=VALUES(value)')
->adup($array);
$this->tsql->table('cloud_config', false)
->qfield('name,m_name,value,lang')
->unique('value=VALUES(value)')
->adup($array);
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,35 +1,39 @@
<?php
defined('IN_MET') or exit('No permission');
load::own_class('appadmin');
class info_off extends appadmin {
class info_off extends appadmin
{
private $form;
// 文字提示
private $tips = '';
//跳转URL
private $returl = '';
//当前时间
private $timedate;
public function __construct() {
public function __construct()
{
global $_M, $_YW;
parent::__construct();
$this->form = $_M['form'];
$this->tname = $_M['form']['tname'];
$this->form = $_M['form'];
$this->tname = $_M['form']['tname'];
$this->timedate = date('Y-m-d H:i:s', time());
}
public function __destruct() {
public function __destruct()
{
global $_M, $_YW;
if ($this->destruct) {
turnover(empty($this->returl) ? $_M['url']['own_name'] . 'c=table_on&a=do' . $this->tname : $this->returl, $this->tips);
}
}
public function doindex() {
public function doindex()
{
global $_M, $_YW;
switch ($this->tname) {
case 'village':
@ -43,83 +47,84 @@ class info_off extends appadmin {
}
}
break;
default:
self::{$this->tname}();
break;
}
}
//场所
private function village() {
private function village()
{
global $_M, $_YW;
$field = [
'v_name' => $this->form['v_name'],
'v_type' => $this->form['v_type'],
'v_province' => $this->form['v_province'],
'v_city' => $this->form['v_city'],
'v_district' => $this->form['v_district'],
'v_address' => $this->form['v_address'],
'v_lxname' => $this->form['v_lxname'],
'v_tel' => $this->form['v_tel'],
'v_price' => $this->form['v_price'],
'v_psize' => $this->form['v_psize'],
'v_name' => $this->form['v_name'],
'v_type' => $this->form['v_type'],
'v_province' => $this->form['v_province'],
'v_city' => $this->form['v_city'],
'v_district' => $this->form['v_district'],
'v_address' => $this->form['v_address'],
'v_maplng' => $this->form['v_maplng'],
'v_maplat' => $this->form['v_maplat'],
'v_lxname' => $this->form['v_lxname'],
'v_tel' => $this->form['v_tel'],
'v_price' => $this->form['v_price'],
'v_psize' => $this->form['v_psize'],
'v_forbidtype' => $this->form['v_forbidtype'],
'v_service' => $this->form['v_service'],
'v_text' => $this->form['v_text']
'v_service' => $this->form['v_service'],
'v_text' => $this->form['v_text']
];
if ($this->form['id']) {
$field['v_updatetime'] = $this->timedate;
$this->tsql->table($this->tname)
->field($field)
->where(['id' => $this->form['id']])
->upd();
->field($field)
->where(['id' => $this->form['id']])
->upd();
$this->tips = '更新成功';
} else {
$field['v_addtime'] = $this->timedate;
$this->tsql->table($this->tname)
->field($field)
->add();
->field($field)
->add();
$this->tips = '新增成功';
}
// 检测sql是否有错误
$error = $this->tsql->error();
dump($error);
EXIT;
if ($error)
$this->tips = '操作失败:' . $error;
if ($error) $this->tips = '操作失败:' . $error;
}
//企业
private function customer() {
private function customer()
{
global $_M, $_YW;
$field = [
'c_allname' => $this->form['c_allname'],
'c_name' => $this->form['c_name'],
'c_allname' => $this->form['c_allname'],
'c_name' => $this->form['c_name'],
'c_province' => $this->form['c_province'],
'c_city' => $this->form['c_city'],
'c_city' => $this->form['c_city'],
'c_district' => $this->form['c_district'],
'c_address' => $this->form['c_address'],
'c_lxname' => $this->form['c_lxname'],
'c_tel' => $this->form['c_tel'],
'c_text' => $this->form['c_text']
'c_address' => $this->form['c_address'],
'c_lxname' => $this->form['c_lxname'],
'c_tel' => $this->form['c_tel'],
'c_text' => $this->form['c_text']
];
if ($this->form['id']) {
$field['c_updatetime'] = $this->timedate;
$this->tsql->table($this->tname)
->field($field)
->where(['id' => $this->form['id']])
->upd();
->field($field)
->where(['id' => $this->form['id']])
->upd();
$this->tips = '更新成功';
} else {
$field['c_addtime'] = $this->timedate;
$this->tsql->table($this->tname)
->field($field)
->add();
->field($field)
->add();
$this->tips = '新增成功';
}
// 检测sql是否有错误
@ -127,30 +132,31 @@ class info_off extends appadmin {
if ($error)
$this->tips = '操作失败:' . $error;
}
//企业联系人
private function workers() {
private function workers()
{
global $_M, $_YW;
$field = [
'w_jid' => $this->form['w_jid'],
'w_jid' => $this->form['w_jid'],
'w_name' => $this->form['w_name'],
'w_tel' => $this->form['w_tel'],
'w_tel' => $this->form['w_tel'],
'w_text' => $this->form['w_text']
];
if ($this->form['id']) {
$field['w_updatetime'] = $this->timedate;
$this->tsql->table($this->tname)
->field($field)
->where(['id' => $this->form['id']])
->upd();
->field($field)
->where(['id' => $this->form['id']])
->upd();
$this->tips = '更新成功';
} else {
$field['w_addtime'] = $this->timedate;
$this->tsql->table($this->tname)
->field($field)
->add();
->field($field)
->add();
$this->tips = '新增成功';
}
// 检测sql是否有错误
@ -158,42 +164,43 @@ class info_off extends appadmin {
if ($error)
$this->tips = '操作失败:' . $error;
}
//广告位
private function elevator($e_bno, $e_aps) {
private function elevator($e_bno, $e_aps)
{
global $_M, $_YW;
$e_number = $this->form['e_number'];
if (!$this->form['id'])
parent::e_number($e_number, $e_bno . $e_aps);
$field = [
'e_number' => $e_number,
'e_vid' => $this->form['e_vid'],
'e_bno' => $e_bno,
'e_aps' => $e_aps,
'e_size' => $this->form['e_size'],
'e_vid' => $this->form['e_vid'],
'e_bno' => $e_bno,
'e_aps' => $e_aps,
'e_size' => $this->form['e_size'],
'e_enable' => $this->form['e_enable'],
'e_label' => $this->form['e_label'],
'e_text' => $this->form['e_text']
'e_label' => $this->form['e_label'],
'e_text' => $this->form['e_text']
];
if ($this->form['id']) {
$this->tsql->table($this->tname)
->field($field)
->where(['id' => $this->form['id']])
->upd();
->field($field)
->where(['id' => $this->form['id']])
->upd();
$this->tips = '更新成功';
} else {
$this->tsql->table($this->tname)
->field($field)
->add();
->field($field)
->add();
$this->tips = '新增成功';
}
// 检测sql是否有错误
$error = $this->tsql->error();
//判断为修改编号则需要清理掉旧的编号
$olde_number = $this->form['olde_number'];
$enumber = $this->form['e_number'];
$enumber = $this->form['e_number'];
if (!$error && $this->form['id'] && $olde_number != $enumber) {
$this->tsql->table('schedule')->where(['s_enumber' => $olde_number])->del();
//清理掉缓存排期表 met_dzadsod_
@ -202,55 +209,56 @@ class info_off extends appadmin {
// ['l_enumber' => '','l_selectenum']
$launch = $this->tsql->table('launch')->where(" find_in_set( '{$olde_number}', l_enumber ) OR find_in_set( '{$olde_number}', l_selectenum ) ")->all();
foreach ($launch as $val) {
$lenumber = arrayto_string(array_unique(stringto_array($val['l_enumber'], ',')), ',');
$l_enumber = preg_replace(["/^{$olde_number}$/", "/^{$olde_number},/", "/,{$olde_number},/", "/,{$olde_number}$/"], [$enumber, "{$enumber},", ",{$enumber},", ",{$enumber}"], $lenumber);
$lselectenum = arrayto_string(array_unique(stringto_array($val['l_selectenum'], ',')), ',');
$lenumber = arrayto_string(array_unique(stringto_array($val['l_enumber'], ',')), ',');
$l_enumber = preg_replace(["/^{$olde_number}$/", "/^{$olde_number},/", "/,{$olde_number},/", "/,{$olde_number}$/"], [$enumber, "{$enumber},", ",{$enumber},", ",{$enumber}"], $lenumber);
$lselectenum = arrayto_string(array_unique(stringto_array($val['l_selectenum'], ',')), ',');
$l_selectenum = preg_replace(["/^{$olde_number}$/", "/^{$olde_number},/", "/,{$olde_number},/", "/,{$olde_number}$/"], [$enumber, "{$enumber},", ",{$enumber},", ",{$enumber}"], $lselectenum);
//修改
$this->tsql->table('launch')->field(['l_enumber' => $l_enumber, 'l_selectenum' => $l_selectenum])->where(['id' => $val['id']])->upd();
}
}
if ($error)
$this->tips = '操作失败:' . $error;
}
//合同录入
private function contract() {
private function contract()
{
global $_M, $_YW;
//报错
if (strtotime($this->form['h_starttime']) > strtotime($this->form['h_endtime'])) {
$this->destruct = false;
parent::scriptgo("投放结束时间({$this->form['h_starttime']})不能小于开始时间({$this->form['h_endtime']})");
}
$field = [
'h_number' => $this->form['h_number'],
'h_signtime' => $this->form['h_signtime'],
'h_cid' => $this->form['h_cid'],
'h_wid' => arrayto_string($this->form['h_wid'], ','),
'h_tprice' => $this->form['h_tprice'],
'h_number' => $this->form['h_number'],
'h_signtime' => $this->form['h_signtime'],
'h_cid' => $this->form['h_cid'],
'h_wid' => arrayto_string($this->form['h_wid'], ','),
'h_tprice' => $this->form['h_tprice'],
'h_starttime' => $this->form['h_starttime'],
'h_endtime' => $this->form['h_endtime'],
'h_endtime' => $this->form['h_endtime'],
'h_noticeday' => arrayto_string(array_unique(stringto_array($this->form['h_noticeday'], ',')), ','), //对数组进行去重处理
'h_text' => $this->form['h_text'],
'h_tower' => $this->form['h_tower'],
'h_texta' => $this->form['h_texta'],
'h_medium' => $this->form['h_medium']
'h_text' => $this->form['h_text'],
'h_tower' => $this->form['h_tower'],
'h_texta' => $this->form['h_texta'],
'h_medium' => $this->form['h_medium']
];
if ($this->form['id']) {
$field['h_updatetime'] = $this->timedate;
$this->tsql->table($this->tname)
->field($field)
->where(['id' => $this->form['id']])
->upd();
->field($field)
->where(['id' => $this->form['id']])
->upd();
$this->tips = '更新成功';
} else {
$field['h_addtime'] = $this->timedate;
$this->tsql->table($this->tname)
->field($field)
->add();
->field($field)
->add();
$this->tips = '新增成功';
}
// 检测sql是否有错误
@ -258,12 +266,13 @@ class info_off extends appadmin {
if ($error)
$this->tips = '操作失败:' . $error;
}
//投放计划保存
private function launch() {
private function launch()
{
global $_M, $_YW;
$this->destruct = false;
// 每次保存都要计算时间是否合法
if (strtotime($this->form['l_starttime']) > strtotime($this->form['l_endtime'])) {
echo parent::jsoncallback([
@ -275,77 +284,78 @@ class info_off extends appadmin {
//不让他包含广告位选中字符
//l_enable 状态字符也暂时不采用
$field = [
'l_hnumber' => $this->form['l_hnumber'],
'l_title' => $this->form['l_title'],
'l_schedule' => $this->form['l_schedule'],
'l_starttime' => $this->form['l_starttime'],
'l_endtime' => $this->form['l_endtime'],
'l_hnumber' => $this->form['l_hnumber'],
'l_title' => $this->form['l_title'],
'l_schedule' => $this->form['l_schedule'],
'l_starttime' => $this->form['l_starttime'],
'l_endtime' => $this->form['l_endtime'],
'l_selectenum' => $this->form['l_selectenum'],
'l_type' => $this->form['l_type'],
'l_text' => $this->form['l_text']
'l_type' => $this->form['l_type'],
'l_text' => $this->form['l_text']
];
if ($this->form['slid']) {
$field['l_updatetime'] = $this->timedate;
$this->tsql->table($this->tname)
->field($field)
->where(['id' => $this->form['slid']])
->upd();
// $query = $this->tsql->query();
->field($field)
->where(['id' => $this->form['slid']])
->upd();
// $query = $this->tsql->query();
$slid = $this->form['slid'];
} else {
$field['l_addtime'] = $this->timedate;
$this->tsql->table($this->tname)
->field($field)
->add();
// $query = $this->tsql->query();
->field($field)
->add();
// $query = $this->tsql->query();
$slid = $this->tsql->id();
}
//查看是否执行错误
$error = $this->tsql->error();
//清理掉非选中的广告位排期,实际执行的是广告位选中后的删除操作,其他地方执行的只有新增和修改
$schedule = $this->tsql->table('schedule')
->where(['s_lid' => $slid])
->all();
$enumber = stringto_array($this->form['l_selectenum'], ',');
->where(['s_lid' => $slid])
->all();
$enumber = stringto_array($this->form['l_selectenum'], ',');
foreach ($schedule as $val) {
if (!in_array($val['s_enumber'], $enumber)) {
$this->tsql->table('schedule')
->where(['id' => $val['id']])
->del();
->where(['id' => $val['id']])
->del();
}
}
//返回结果
$array = $error || $slid == 0 ? ['slid' => $slid, 'code' => false, 'text' => "投放信息处理失败,广告位没有执行排期!错误提示({$error}", $this->form] : ['slid' => $slid, 'code' => true, 'text' => '投放信息处理成功。'];
echo parent::jsoncallback($array);
exit;
}
private function keylist() {
private function keylist()
{
global $_M, $_YW;
$field = [
'k_passkey' => md5($this->form['k_passkey']),
'k_basekey' => base64_encode($this->form['k_passkey']),
'k_wid' => $this->form['k_wid'],
'k_state' => $this->form['k_state'],
'k_text' => $this->form['k_text']
'k_wid' => $this->form['k_wid'],
'k_state' => $this->form['k_state'],
'k_text' => $this->form['k_text']
];
if ($this->form['id']) {
$field['k_updatetime'] = $this->timedate;
$this->tsql->table($this->tname)
->field($field)
->where(['id' => $this->form['id']])
->upd();
->field($field)
->where(['id' => $this->form['id']])
->upd();
$this->tips = '更新成功';
} else {
$field['k_addtime'] = $this->timedate;
$this->tsql->table($this->tname)
->field($field)
->add();
->field($field)
->add();
$this->tips = '新增成功';
}
// 检测sql是否有错误
@ -353,7 +363,7 @@ class info_off extends appadmin {
if ($error)
$this->tips = '操作失败:' . $error;
}
}
?>

View File

@ -45,7 +45,8 @@ class info_on extends appadmin
$para = $this->tsql->table('para')->where(['p_type' => 6])->all();
parent::para_radio($para,'v_type',$this->input['data']['v_type'],$this->input['para']['v_type_radio'])
->setparahtml(6,$this->input['para']['v_type_radio']);
// 百度地图
$this->input['mapkey'] = $_YW['c']['mapkey'];
//城市json
$this->input['url']['city'] = $this->cloud->city_url();
}
@ -164,13 +165,26 @@ class info_on extends appadmin
parent::appnav(['table_on__dolaunch','广告投放']);
parent::appurl(parent::tname(),['slid'=>$slid]);
$fzid = $_M['form']['fzid'];
if($slid){
// 编辑
$this->input['data'] = $this->tsql->table($this->tname)
->where(['id'=>$slid])
->where(['id' => $slid])
->one();
$contract = $this->tsql->table('contract')
->where(['h_number' => $this->input['data']['l_hnumber']])
->one();
}elseif($fzid){
// 复制功能
$this->input['data'] = $this->tsql->table($this->tname)
->where(['id' => $fzid])
->one();
$contract = $this->tsql->table('contract')
->where(['h_number' => $this->input['data']['l_hnumber']])
->one();
// 注销掉不需要的属性
unset($this->input['data']['id'],$this->input['data']['l_enumber'],$this->input['data']['l_schedule'],$this->input['data']['l_enable'],$this->input['data']['l_updatetime'],$this->input['data']['l_addtime']);
}else{
//获取合同的值
$contract = $this->tsql->table('contract')

View File

@ -8,7 +8,7 @@ $met_title = $data['met_title'];
<!--二级导航-->
{$data.nav_sub}
<div class="metadmin-fmbx">
<h3 class='example-title'>微信通知</h3>
<!--<h3 class='example-title'>微信通知</h3>
<dl>
<dt><label class='form-control-label'>合同预约提醒模板ID</label></dt>
<dd class="form-group">
@ -65,8 +65,60 @@ $met_title = $data['met_title'];
</select>
<span class="text-help m-l-10">可设置多个管理员微信,设置后每个合同到期都会收到微信通知</span>
</dd>
</dl>-->
<h3 class='example-title'>百度地图</h3>
<dl>
<dt><label class='form-control-label'>百度地图AK</label></dt>
<dd class="form-group">
<div class="input-group">
<input type="text" name="mapkey"
value="{$data.c.mapkey}"
class="form-control"
placeholder='输入百度地图AK'
required data-fv-notEmpty-message='不能为空'>
</div>
<span class="text-help m-l-10">
百度地图密钥AK【应用类型选择浏览器端】 申请地址:<a href="https://lbsyun.baidu.com/apiconsole/key" target="_blank">https://lbsyun.baidu.com/apiconsole/key</a>
</span>
</dd>
</dl>
<!--新增地图-->
<dl>
<dt><label class='form-control-label'>默认城市</label></dt>
<dd>
<div data-plugin="select-linkage" data-select-url="{$data.url.city}"
class="city-css city-js form-group">
<select name="mapprov" class="form-control m-r-5 prov" data-checked="{$data.c.mapprov}"
required data-fv-notEmpty-message="不能为空"></select>
<select name="mapcity" class="form-control m-r-5 city" data-checked="{$data.c.mapcity}"
required data-fv-notEmpty-message="不能为空"></select>
<select name="mapdist" class="form-control m-r-5 dist" data-checked="{$data.c.mapdist}"
required data-fv-notEmpty-message="不能为空"></select>
</div>
</dd>
</dl>
<dl>
<dt><label class='form-control-label'>地图预览</label></dt>
<dd>
<script type="text/javascript"
src="https://api.map.baidu.com/api?type=webgl&v=1.0&ak={$data.c.mapkey}"></script>
<div id="showmap" class="h-350" data-type="showmap"></div>
</dd>
</dl>
<dl>
<dt><label class='form-control-label'>地图经纬度</label></dt>
<dd class="form-group">
<div class="input-group">
<input type="text" name="maplng" value="{$data.c.maplng}" readonly="readonly"
class="form-control city-mapjs-lng">
<div class="input-group-addon">,</div>
<input type="text" name="maplat" value="{$data.c.maplat}" readonly="readonly"
class="form-control city-mapjs-lat">
</div>
</dd>
</dl>
<!--地图end-->
<dl>
<dt></dt>
<dd>

View File

@ -575,8 +575,7 @@ ul.panel-actions>li:first-child {
.panel>.list-group,.panel>.panel-collapse>.list-group {
margin-bottom: 0
}
.panel>.list-group .list-group-item,.panel>.panel-collapse>.list-group .list-group-item {
.panel>.list-group .list-group-item,.panel>.panel-collapse>.list-group .list-group-item,.panel>.panel-body>.list-group .list-group-item{
border-width: 1px 0;
border-radius: 0
}
@ -1122,6 +1121,7 @@ ul.panel-actions>li:first-child {
/*自定义样式*/
html, body{height: 100%;}
.app-sub-nav .nav-tabs{border-bottom:none;}
.btn-cursor-pointer{cursor:pointer;}
/*把脑残替换的恢复过来*/
@ -1146,12 +1146,20 @@ table .form-inline .form-group {
width: 100%;
}
}
.modal-open .select2-container{
z-index:auto!important;
}
/*CSS*/
@media (min-width: 767px){
.metadmin-fmbx dl .city-css .form-control{
width: auto;
}
.metadmin-fmbx dl .city-css .form-control{
width: auto;
}
.appmain #showmap{
width: 60%;
}
}
.launch_affix_save {
@ -1168,6 +1176,18 @@ table .form-inline .form-group {
text-decoration: line-through;
}
.float-left {
float: left!important
}
.float-right {
float: right!important
}
.float-none {
float: none!important
}
/*统计总页面*/
.page-profile .card-shadow {
@ -1210,3 +1230,35 @@ table .form-inline .form-group {
.h-700{
height: 700px;
}
li.village-list-item > button.close{
position: static!important;
font-size: 1.2rem;
outline: none;
}
.filterList li.village-list-item > button.close{
margin-top: 10px;
}
li.village-list-item > button.close:hover{
color: #f2353c;
}
li.village-list-item>h5{
font-weight: 600!important;
display: inline-block!important;
margin-bottom: .5rem;
}
li.village-list-item>p{
margin-bottom: 0!important;
}
.villageList li.village-list-item>h5{
cursor:pointer
}
.btn-group-toggle-menu{
left: -49px!important;
padding: 5px;
min-width: 120px;
}
.btn-group-toggle-menu a, .btn-group-toggle-menu button{
display: inherit;
border-radius:0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

652
admin/templates/js/bmaps.js Normal file
View File

@ -0,0 +1,652 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var APPMAP;
(function (APPMAP) {
var base = (function () {
function base() {
var _this = this;
this.mapLng = '116.395645';
this.mapLat = '39.929986';
this.mapPoints = {};
this.inputLng = '';
this.inputLat = '';
this.inputPoints = {};
this.cacheMarker = {};
this.allCity = '';
this.selectProv = '';
this.selectCity = '';
this.selectDist = '';
this.address = '';
this.lngDom = {};
this.latDom = {};
this.mapLng = CL.c.maplng || this.mapLng;
this.mapLat = CL.c.maplat || this.mapLat;
this.watch(this, 'inputLng', function () {
_this.setInputLng();
});
this.watch(this, 'inputLat', function () {
_this.setInputLat();
});
this.initHtmlDom();
this.getInputLngLat();
this.syncMapLngLat();
this.getCity();
$(document).on('change keyup', '.city-js select', function () {
if ($(".city-mapjs-address").length)
$(".city-mapjs-address").val('');
});
$(document).on('change keyup', '.city-js select, .city-mapjs-address', function () {
_this.getCity();
});
}
base.prototype.initHtmlDom = function () {
this.lngDom = $(".city-mapjs-lng");
this.latDom = $(".city-mapjs-lat");
};
base.prototype.isEmpty = function (val) {
switch (val) {
case ',':
return true;
case '请选择':
return true;
case '请选择所在地区':
return true;
}
return APPFUN.isEmpty(val);
};
base.prototype.getInputLngLat = function () {
this.inputLng = this.lngDom.val();
this.inputLat = this.latDom.val();
};
base.prototype.syncMapLngLat = function () {
if (!this.isEmpty(this.inputLng) && !this.isEmpty(this.inputLat)) {
this.mapLng = this.inputLng;
this.mapLat = this.inputLat;
}
};
base.prototype.setInputLngLat = function () {
this.setInputLng();
this.setInputLat();
};
base.prototype.setInputLng = function () {
this.lngDom.val(this.inputLng);
this.lngDom.trigger('input');
};
base.prototype.setInputLat = function () {
this.latDom.val(this.inputLat);
this.latDom.trigger('input');
};
base.prototype.getCity = function () {
this.selectProv = this.isCity($(".city-js select.prov").find("option:selected").val());
this.selectCity = this.isCity($(".city-js select.city").find("option:selected").val());
this.selectDist = this.isCity($(".city-js select.dist").find("option:selected").val());
this.address = this.isCity($(".city-mapjs-address").val());
this.allCity = this.selectCity + this.selectDist + this.address;
};
base.prototype.isCity = function (string) {
return !this.isEmpty(string) ? string : '';
};
base.prototype.level = function () {
var level = 12;
if (!this.isEmpty(this.selectProv))
level = 10;
if (!this.isEmpty(this.selectCity))
level = 12;
if (!this.isEmpty(this.selectDist))
level = 14;
if (!this.isEmpty(this.selectDist) && !this.isEmpty(this.address))
level = 15;
return level;
};
base.prototype.watch = function (JsonObj, key, closure) {
var cacheData = {};
cacheData[key] = JsonObj[key];
Object.defineProperty(JsonObj, key, {
enumerable: true,
configurable: true,
get: function () {
return cacheData[key];
},
set: function (newValue) {
var oldValue = cacheData[key];
cacheData[key] = newValue;
if (typeof closure === 'function' && oldValue !== newValue)
closure(newValue, oldValue);
}
});
};
return base;
}());
var initialMap = (function (_super) {
__extends(initialMap, _super);
function initialMap() {
var _this = _super.call(this) || this;
_this.showMap = {};
_this.modalMap = {};
_this.mapType = false;
_this.myGeos = {};
_this.mapLngLatList = {};
_this.mapCacheMarker = {};
_this.myGeos = new BMapGL.Geocoder();
if (!_this.isEmpty(_this.inputLng) && !_this.isEmpty(_this.inputLat)) {
_this.inputPoints = _this.mapPoints = _this.lnglatToPoints(_this.inputLng, _this.inputLat);
}
else {
_this.mapPoints = _this.lnglatToPoints(_this.mapLng, _this.mapLat);
}
return _this;
}
initialMap.prototype.lnglatToPoints = function (lng, lat) {
var point = {};
if (!this.isEmpty(lng) && !this.isEmpty(lat))
point = new BMapGL.Point(lng, lat);
return point;
};
initialMap.prototype.initMap = function (domId, level) {
var map = new BMapGL.Map(domId, { enableMapClick: false });
map.centerAndZoom(this.mapPoints, level || this.level());
map.enableScrollWheelZoom(true);
map.setDisplayOptions({
poiIcon: false
});
return map;
};
initialMap.prototype.setHeadingTilt = function (map) {
map.setTilt(65);
};
initialMap.prototype.citySyncMap = function (mapOjb, level) {
var _this = this;
this.myGeos.getPoint(this.allCity || this.selectProv, function (point) {
if (point) {
_this.mapPoints = point;
_this.mapLng = point.lng;
_this.mapLat = point.lat;
mapOjb.panTo(point);
if (level && level > 0)
mapOjb.setZoom(level);
}
else {
console.log("您选择地址没有解析到结果!");
}
}, this.selectProv);
};
initialMap.prototype.ajaxlnglatList = function (map, formJson, clickEvent, closure) {
var _this = this;
if (clickEvent === void 0) { clickEvent = false; }
$.getJSON(M.url.own_name + "c=ajax&a=doallmap", formJson, function (listJson) {
_this.mapLngLatList = listJson;
$.each(listJson, function (i, val) {
val.maplng = val.v_maplng;
val.maplat = val.v_maplat;
var clickClosure = clickEvent ? _this.addOpenInfo(map, val) : '';
if (!_this.isEmpty(val.maplng) && !_this.isEmpty(val.maplat))
_this.addMapOverlay(map, val.maplng, val.maplat, false, val.id, clickClosure);
});
});
};
initialMap.prototype.myIcon = function () {
return new BMapGL.Icon(M.url.own_tem + "/img/markers.png", new BMapGL.Size(21, 25), {
imageSize: new BMapGL.Size(42, 325),
anchor: new BMapGL.Size(10, 25),
imageOffset: new BMapGL.Size(0, 300)
});
};
initialMap.prototype.addMapOverlay = function (appmapl, lng, lat, icons, listId, clickClosure) {
var _this = this;
if (icons === void 0) { icons = false; }
if (this.isEmpty(lng))
return false;
var points = this.lnglatToPoints(lng, lat);
var marker = new BMapGL.Marker(points);
if (typeof clickClosure === 'function') {
marker.addEventListener("click", function (e) {
clickClosure(e);
});
this.watch(marker, 'domElement', function () {
_this.mapCacheMarker[listId] = $(marker.domElement);
});
}
if (icons) {
this.cacheMarker = marker;
marker.setIcon(this.myIcon());
}
appmapl.addOverlay(marker);
return points;
};
initialMap.prototype.addOpenInfo = function (map, value) {
var _this = this;
var opts = {
maxWidth: 350,
enableAutoPan: true,
title: value.v_name
};
var content = "<p>" + value.v_province + value.v_city + value.v_district + value.v_address + "</p>";
return function (e) {
var p = e.target;
var point = _this.lnglatToPoints(p.getPosition().lng, p.getPosition().lat);
var infoWindow = new BMapGL.InfoWindow(content, opts);
map.openInfoWindow(infoWindow, point);
};
};
return initialMap;
}(base));
var showMap = (function (_super) {
__extends(showMap, _super);
function showMap() {
var _this = _super.call(this) || this;
_this.getMapType();
_this.showInitMap();
_this.watchCity();
return _this;
}
showMap.prototype.showInitMap = function () {
this.showMap = this.initMap("showmap");
this.setHeadingTilt(this.showMap);
if (this.isEmpty(this.inputLng) && this.isEmpty(this.inputLat) && !this.isEmpty(this.allCity))
this.citySyncMap(this.showMap);
if (this.mapType)
this.addMapOverlay(this.showMap, this.inputLng, this.inputLat, true);
};
showMap.prototype.getMapType = function () {
return this.mapType = $('#showmap').data('type') === 'showmap' ? false : true;
};
showMap.prototype.watchCity = function () {
var _this = this;
var $fun = function () {
_this.citySyncMap(_this.showMap);
};
this.watch(this, 'selectProv', $fun);
this.watch(this, 'allCity', $fun);
if (!this.mapType) {
this.watch(this, 'mapLng', function () {
_this.inputLng = _this.mapLng;
});
this.watch(this, 'mapLat', function () {
_this.inputLat = _this.mapLat;
});
}
};
return showMap;
}(initialMap));
var modalMap = (function (_super) {
__extends(modalMap, _super);
function modalMap() {
var _this = _super.call(this) || this;
_this.modalLng = '';
_this.modalLat = '';
_this.modalPoints = {};
$('#mapmodal').on('click', function () {
if (_this.isEmpty(_this.selectCity)) {
$.include(M['url']['static2_vendor'] + 'alertify/alertify.js', function () {
alertify.logPosition("右下角");
alertify.error("请选择城市。");
});
}
else {
var html = '范围:' + _this.selectProv + '<small style="padding-left:15px;">' + _this.allCity + '</small>';
$('h4.modal-title').html(html);
$('#appmaps').modal('show');
}
});
$('#appmaps').on('shown.bs.modal', function () {
setTimeout(function () {
document.body.scrollTop = document.documentElement.scrollTop = 0;
_this.modalInitMap();
var mapId = $('#modalmap').data('mapid') || '';
_this.ajaxlnglatList(_this.modalMap, {
id: mapId,
province: _this.selectProv,
city: _this.selectCity,
district: _this.selectDist
});
_this.modalMap.addEventListener("click", function (e) {
_this.modalMap.removeOverlay(_this.cacheMarker);
_this.modalLng = e.latlng.lng;
_this.modalLat = e.latlng.lat;
_this.modalPoints = _this.addMapOverlay(_this.modalMap, _this.modalLng, _this.modalLat, true);
});
}, 200);
});
$('#appmaps .button-save').on('click', function () {
if (!_this.isEmpty(_this.modalLng) && !_this.isEmpty(_this.modalLat)) {
_this.inputLng = _this.modalLng;
_this.inputLat = _this.modalLat;
if (!_this.isEmpty(_this.showMap)) {
_this.showMap.clearOverlays();
_this.mapPoints = _this.inputPoints = _this.modalPoints;
_this.showMap.panTo(_this.mapPoints);
_this.addMapOverlay(_this.showMap, _this.inputLng, _this.inputLat, true);
}
}
$('#appmaps').modal('hide');
});
$('#appmaps').on('hidden.bs.modal', function () {
_this.modalMap.clearOverlays();
_this.modalLng = _this.modalLat = '';
_this.modalPoints = {};
$('#appmaps').removeData("bs.modal");
_this.modalMap.destroy();
});
return _this;
}
modalMap.prototype.modalInitMap = function () {
this.modalMap = this.initMap("modalmap");
if (!this.isEmpty(this.inputLng) && !this.isEmpty(this.inputLat))
this.addMapOverlay(this.modalMap, this.inputLng, this.inputLat, true);
};
return modalMap;
}(showMap));
var selectMap = (function (_super) {
__extends(selectMap, _super);
function selectMap() {
var _this = _super.call(this) || this;
_this.selectMapInitType = false;
_this.selectMap = {};
_this.drawingManager = {};
_this.overlaysCache = {
overlays: {},
hashCode: '',
drawingMode: ''
};
_this.overlays = {};
_this.hashCode = {};
_this.markerID = {
marker: [],
polyline: [],
circle: [],
rectangle: [],
polygon: []
};
_this.villageFilterList = {};
_this.villageList = {};
$('#selectMapId').on('shown.bs.modal', function () {
if (!_this.selectMapInitType)
_this.setHeight();
setTimeout(function () {
document.body.scrollTop = document.documentElement.scrollTop = 0;
if (!_this.selectMapInitType)
_this.selectInitMap();
_this.ajaxlnglatList(_this.selectMap, {
id: '',
province: _this.selectProv,
city: _this.selectCity,
district: _this.selectDist,
allinfo: 'all'
}, true);
if (!_this.selectMapInitType)
_this.drawingManagerInit();
_this.drawingManager.addEventListener("overlaycomplete", function (e) {
var overlay = e.overlay;
var hashCode = overlay.hashCode;
var drawingMode = e.drawingMode;
_this.overlays[hashCode] = overlay;
_this.hashCode[hashCode] = drawingMode;
_this.overlaysCache = {
overlays: overlay,
hashCode: hashCode,
drawingMode: drawingMode
};
var latLngNum = 0;
_this.villageFilterList = {};
$.each(_this.mapLngLatList, function (i, val) {
latLngNum++;
var points = _this.lnglatToPoints(val.v_maplng, val.v_maplat);
var result = false;
switch (drawingMode) {
case 'polyline':
result = BMapGLLib.GeoUtils.isPointOnPolyline(points, overlay);
break;
case 'circle':
result = BMapGLLib.GeoUtils.isPointInCircle(points, overlay);
break;
case 'rectangle':
var bounds = overlay.getBounds();
result = BMapGLLib.GeoUtils.isPointInRect(points, bounds);
break;
case 'polygon':
result = BMapGLLib.GeoUtils.isPointInPolygon(points, overlay);
break;
default:
break;
}
if (result == true) {
if (!_this.markerID[drawingMode][hashCode])
_this.markerID[drawingMode][hashCode] = [];
_this.markerID[drawingMode][hashCode].push(val.id);
_this.villageFilterList[val.id] = val;
}
if (latLngNum === Object.keys(_this.mapLngLatList).length)
_this.confirmOperate();
});
});
if (_this.selectMapInitType === false)
_this.selectMapInitType = true;
}, 100);
});
$('#selectMapId .mapreset').on('click', function (e) {
_this.mapreset();
_this.listNum('selectMapId');
_this.input();
});
$('#selectMapId').on('click', 'li button', function (e) {
var domLi = $(e.target).parents('li');
_this.delFilterList(domLi.data('id'));
domLi.remove();
});
$('#selectMapId .button-save').on('click', function () {
var keysArr = Object.keys(_this.villageList);
var keysStr = keysArr.toString();
_this.input(keysStr);
$('#selectMapId').modal('hide');
});
$('#selectMapId').on('hidden.bs.modal', function () {
});
$('.villageList ul').on('click', 'li[data-id] h5', function (e) {
var id = $(e.target).parents('li').data('id');
var listInfo = _this.villageList[id];
var point = _this.lnglatToPoints(listInfo.maplng, listInfo.maplat);
_this.selectMap.panTo(point);
_this.mapCacheMarker[id].trigger('click');
});
return _this;
}
selectMap.prototype.setHeight = function () {
var headerHeight = $("#selectMapId .modal-header").outerHeight(true);
var wHeight = $(document.body).height();
var mapHeight = wHeight - headerHeight - 15;
$(".selectMapHeight").height(mapHeight);
var panelHeading = $(".selectMapHeight .panel-heading").outerHeight(true);
var panelFooter = $(".selectMapHeight .panel-footer").outerHeight(true);
var panelBody = $(".selectMapHeight .panel-body").outerHeight(true) - $(".selectMapHeight .panel-body").height();
$(".selectMapHeight .panel-body").height(mapHeight - panelHeading - panelFooter - panelBody);
};
selectMap.prototype.setFilterModalBodyHeight = function () {
var filterListmodalHeight = $("#filterListmodal").outerHeight(true);
var modalHeader = $("#filterListmodal .modal-header").outerHeight(true);
var modalFooter = $("#filterListmodal .modal-footer").outerHeight(true);
var modalBody = $("#filterListmodal .modal-body").outerHeight(true) - $("#filterListmodal .modal-body").height();
$("#filterListmodal .filterList").height(filterListmodalHeight - modalHeader - modalBody - modalFooter);
};
selectMap.prototype.selectInitMap = function () {
this.selectMap = this.initMap("selectMap");
};
selectMap.prototype.drawingManagerInit = function () {
var styleOptions = {
strokeColor: '#5E87DB',
fillColor: '#5E87DB',
strokeWeight: 2,
strokeOpacity: 1,
fillOpacity: 0.2
};
var labelOptions = {
borderRadius: '2px',
background: '#FFFBCC',
border: '1px solid #E1E1E1',
color: '#703A04',
fontSize: '12px',
letterSpacing: '0',
padding: '5px'
};
this.drawingManager = new BMapGLLib.DrawingManager(this.selectMap, {
enableDrawingTool: true,
enableCalculate: true,
drawingToolOptions: {
enableTips: true,
customContainer: 'selectbox_Drawing',
hasCustomStyle: true,
anchor: BMAP_ANCHOR_TOP_RIGHT,
offset: new BMapGL.Size(25, 15),
scale: 1,
drawingModes: [
BMAP_DRAWING_POLYLINE,
BMAP_DRAWING_RECTANGLE,
BMAP_DRAWING_POLYGON,
BMAP_DRAWING_CIRCLE,
]
},
enableSorption: true,
sorptionDistance: 20,
enableGpc: true,
circleOptions: styleOptions,
polylineOptions: styleOptions,
polygonOptions: styleOptions,
rectangleOptions: styleOptions,
labelOptions: labelOptions
});
};
selectMap.prototype.confirmOperate = function () {
var _this = this;
this.addHtmlShow('filterList');
$('#filterListmodal').modal('show');
$('#filterListmodal').on('shown.bs.modal', function () {
_this.listNum('filterListmodal');
_this.setFilterModalBodyHeight();
});
$('#filterListmodal .mapreset').on('click', function (e) {
$('#filterListmodal').modal('hide');
_this.mapresetClose();
});
$('#filterListmodal .button-save').on('click', function () {
$('#filterListmodal').modal('hide');
_this.addHtmlShow('villageList');
});
$('#filterListmodal').on('click', 'li button', function (e) {
var domLi = $(e.target).parents('li');
_this.delFilterList(domLi.data('id'), 'filterList');
domLi.remove();
});
$('#selectMapId').on('hidden.bs.modal', function () {
$('#selectMapId').removeData("bs.modal");
});
};
selectMap.prototype.addHtmlShow = function (domclass) {
var _this = this;
var dom = $("." + domclass).find('ul');
var listNum = domclass === 'filterList' ? 0 : (Object.keys(this.villageList).length || 0);
var initListNum = 0;
$.each(this.villageFilterList, function (i, val) {
if (domclass !== 'filterList') {
if (_this.villageList[i] && Object.keys(_this.villageList[i]).length > 0)
return true;
_this.villageList[i] = val;
}
var li = _this.htmlLi(i, val);
listNum === 0 ? dom.html(li) : dom.prepend(li);
listNum++;
initListNum++;
if (initListNum === Object.keys(_this.villageFilterList).length) {
_this.listNum('selectMapId');
}
});
};
selectMap.prototype.htmlLi = function (key, val) {
var address = val.v_city + val.v_district + val.v_address;
return "<li class=\"list-group-item village-list-item\" data-id=\"" + key + "\">\n <h5>" + val.v_name + "</h5>\n <button type=\"button\" class=\"float-right close\">\n <i class=\"icon wb-close m-0 font-danger\" aria-hidden=\"true\"></i>\n </button>\n <p>\u5730\u5740\uFF1A" + address + "</p>\n </li>";
};
selectMap.prototype.mapresetClose = function () {
var hashCode = this.overlaysCache.hashCode;
var drawingMode = this.overlaysCache.drawingMode;
delete this.overlays[hashCode];
delete this.hashCode[hashCode];
delete this.markerID[drawingMode][hashCode];
this.selectMap.removeOverlay(this.overlaysCache.overlays);
};
selectMap.prototype.mapreset = function () {
var _this = this;
$.each(this.overlays, function (i, val) {
_this.selectMap.removeOverlay(val);
delete _this.overlays[i];
delete _this.hashCode[i];
});
this.markerID = {
marker: [],
polyline: [],
circle: [],
rectangle: [],
polygon: []
};
this.villageList = {};
$('.villageList ul').html("<li class=\"list-group-item\">\u6CA1\u6709\u9009\u4E2D\u5C0F\u533A</li>");
};
selectMap.prototype.delFilterList = function (id, domclass) {
if (domclass === 'filterList') {
delete this.villageFilterList[id];
this.listNum('filterListmodal', 'del');
}
else {
delete this.villageList[id];
this.listNum('selectMapId', 'del');
}
};
selectMap.prototype.listNum = function (domclass, type) {
if (domclass === 'filterListmodal') {
var listNum = this.villageFilterList ? Object.keys(this.villageFilterList).length : 0;
$('#filterListmodal .listNum').html(listNum);
if (listNum === 0 && type === 'del') {
this.mapresetClose();
$('#filterListmodal').modal('hide');
}
}
else {
var listNums = this.villageList ? Object.keys(this.villageList).length : 0;
$('#selectMapId .listNum').html(listNums);
$('button[data-target="#selectMapId"] .listNum').html(listNums > 0 ? listNums : '');
if (listNums === 0 && type === 'del')
this.mapreset();
}
};
selectMap.prototype.input = function (keysStr) {
var inputVid = $('input[name="v_id"]');
inputVid.val(keysStr);
inputVid.trigger('change');
};
return selectMap;
}(initialMap));
function bmaps() {
if ($('#modalmap').length) {
console.log('模态框类型');
new modalMap();
}
else if ($('#showmap').length) {
console.log('纯展示类型');
new showMap();
}
else if ($('#selectMap').length) {
console.log('-------------');
new selectMap();
}
}
APPMAP.bmaps = bmaps;
})(APPMAP || (APPMAP = {}));

View File

@ -4,7 +4,7 @@
* M['tem'] 模板目录路径
* M['user_name'] 页面登录用户名
* met_prevarrow,
met_nextarrow slick插件翻页按钮自定义html
met_nextarrow slick插件翻页按钮自定义html
* M['device_type'] 客户端判断dPC端t平板端m手机端
* M['n'] 当前模块名称
* M['c'] 当前类
@ -34,69 +34,84 @@
* M['url']['api'] app站点地址
* M['url']['editor'] 当前编辑器应用文件夹路径
*/
$(function(){
var myDate=new Date().getTime()
$(function () {
var myDate = new Date().getTime()
$.include(M.url.own_tem + 'js/appcheck.min.js?'+myDate);
$.ajax({
type: "GET",
url: M.url.own_name + 'c=ajax&a=doajaxcl&lang=' + M['langset'],
dataType: "jsonp",
async: false
}).done(function (data) {
type : "GET",
url : M.url.own_name + 'c=ajax&a=doajaxcl&lang=' + M['langset'],
dataType: "jsonp",
async : false
}).done(function (data) {
CL = data;
});
var appfun = function () {
var $self = this;
//有序表处理
$.getJSON(M.url.own_name + 'c=ajax&a=dosequence&lang=' + M['langset'],{},function(json){});
$.getJSON(M.url.own_name + 'c=ajax&a=dosequence&lang=' + M['langset'], {}, function (json) {});
//select2
if($('[data-plugin="select2"]').length) $self.select2(true);
if ($('[data-plugin="select2"]').length) $self.select2(true);
//排期广告位选择
if($('.add_ap_list').length) $.include(M.url.own_tem + 'js/applan.js?'+myDate);
if ($('.add_ap_list').length) $.include(M.url.own_tem + 'js/applan.js?' + myDate);
//表格重绘后回调
$('#tableslist').on( 'draw.dt', function ( e,settings ) {
if($('[data-plugin="alertify"]').length) $self.select2(false);
$('#tableslist').on('draw.dt', function (e, settings) {
if ($('[data-plugin="alertify"]').length) $self.select2(false);
})
// 表格数据加载状态
$('#tableslist').on('processing.dt', function (e, settings, processing) {
if(processing) {
$self.tableProcessing(this)
}
})
$('#tables-list').on('processing.dt', function (e, settings, processing) {
if(processing) {
$self.tableProcessing(this)
}
})
//单个时间初始化
if($('[data-plugin="alonetime"]').length) $self.alonetime();
if ($('[data-plugin="alonetime"]').length) $self.alonetime();
//时间区段选择
if($('[data-plugin="datetosearch"]').length) $self.datepicker();
if ($('[data-plugin="datetosearch"]').length) $self.datepicker();
//导出功能
$(document).on('click','.backups',function (event) {
$(document).on('click', '.backups', function (event) {
var my = $(this);
event.preventDefault();
my.parents('form').metSubmit(0);
var obj = my.parents("form").serialize(),href = my.data('url'),veaps = $('select[name="veaps"]').val();
var obj = my.parents("form").serialize(),
href = my.data('url'),
veaps = $('select[name="veaps"]').val(),
vtype = $('select[name="vtype"]').val();
// 单独给get传递增加veaps的值
if(!$self.isEmpty(veaps)) obj += '&jsadd_veaps=' + veaps.join(',');
window.location.href = href + '&' + obj;
if (!$self.isEmpty(veaps)) obj += '&jsadd_veaps=' + veaps.join(',');
if (!$self.isEmpty(vtype)) obj += '&jsadd_vtype=' + vtype.join(',');
window.location.href = href + '&' + obj;
})
//表格底部自定义按钮
$(document).on('click','[table-zdybtn]',function (event) {
var my = $(this),
$form = my.parents('form'),
$(document).on('click', '[table-zdybtn]', function (event) {
var my = $(this),
$form = my.parents('form'),
typestr = my.data('submit_type');
event.preventDefault();
$self.ownsubmit($form,typestr);
if(my.data('plugin') != 'alertify'){
$self.ownsubmit($form, typestr);
if (my.data('plugin') != 'alertify') {
$form.submit();
return true;
}
})
//排序功能
if($('a.orderby-link').length) $self.orders();
if ($('a.orderby-link').length) $self.orders();
//状态更改
// http://bsify.admui.com/alertify/ 中文说明
$(document).on('click','.btn-cursor-pointer', function () {
var self = $(this);
$(document).on('click', '.btn-cursor-pointer', function () {
var self = $(this);
$.include(M['url']['static2_vendor'] + 'alertify/alertify.js', function () {
alertify
.okBtn("确定")
.cancelBtn("取消")
.confirm('确定更改状态吗?',function () {
$.getJSON(self.data('href'), function(json){
.confirm('确定更改状态吗?', function () {
$.getJSON(self.data('href'), function (json) {
window.location.reload();
})
})
@ -105,7 +120,7 @@ $(function(){
};
appfun.prototype = {
isEmpty: function (val) {
isEmpty : function (val) {
switch (typeof val) {
case 'undefined':
return true;
@ -131,60 +146,61 @@ $(function(){
}
return false;
},
select2:function(drawdt){
select2 : function (drawdt) {
// drawdt true 执行默认操作 false 不执行
var $self = this,select = [];
var $self = this,
select = [];
//选择器
M['plugin']['select2'] = [
M['url']['static2_vendor'] + 'select2/select2.min.css',
M['url']['static2_vendor'] + 'select2/select2.full.min.js',
M['url']['static2_vendor'] + 'select2/i18n/zh-CN.js',
];
$.include(M['plugin']['select2'],function(){
$('[data-plugin="select2"]').each(function(indexs,item){
var _self = $(this),
defaults = _self.data('default'),
select2url = _self.data('select2-url') + '&'+ myDate;
select[indexs] = _self.select2({
placeholder: '输入搜索内容', //提示语
ajax: {
url: select2url,
dataType: 'jsonp',
delay: 500,
data: function (params) {
return {
querys: params.term, //search term
tname: _self.data('tname'), //指定简短表
fiend: _self.data('fiend'), //指定字段值
allnone: _self.data('allnone'), //是否只显示应用的值
source: _self.data('source'), //查看来源标记
condition: _self.data('condition') //查询限制条件
};
},
results: function (data, page) {
return {results: data.results};
}
}
});
$.include(M['plugin']['select2'], function () {
$('[data-plugin="select2"]').each(function (indexs, item) {
var _self = $(this),
defaults = _self.data('default'),
select2url = _self.data('select2-url') + '&' + myDate;
select[indexs] = _self.select2({
placeholder: '输入搜索内容', //提示语
ajax : {
url : select2url,
dataType: 'jsonp',
delay : 500,
data : function (params) {
return {
querys : params.term, //search term
tname : _self.data('tname'), //指定简短表
fiend : _self.data('fiend'), //指定字段值
allnone : _self.data('allnone'), //是否只显示应用的值
source : _self.data('source'), //查看来源标记
condition: _self.data('condition') //查询限制条件
};
},
results : function (data, page) {
return {results: data.results};
}
}
});
//默认值处理
if(!$self.isEmpty(defaults) && drawdt == true){
if (!$self.isEmpty(defaults) && drawdt == true) {
$.getJSON(
select2url,
{
tname: _self.data('tname'), //指定简短表
fiend: _self.data('fiend'), //指定字段值
allnone: _self.data('allnone'), //是否只显示应用的值
source: _self.data('source'), //查看来源标记
tname : _self.data('tname'), //指定简短表
fiend : _self.data('fiend'), //指定字段值
allnone : _self.data('allnone'), //是否只显示应用的值
source : _self.data('source'), //查看来源标记
condition: _self.data('condition'), //查询限制条件
default: defaults, //默认值
division: _self.data('division') //默认值分隔符
},
function(obj){
$.each(obj.results, function(index, ele) {
$.each(ele.children, function(indexop, eleop) {
var option = new Option(eleop.text, eleop.id, true, true);
default : defaults, //默认值
division : _self.data('division') //默认值分隔符
},
function (obj) {
$.each(obj.results, function (index, ele) {
$.each(ele.children, function (indexop, eleop) {
var option = new Option(eleop.text, eleop.id, true, true);
select[indexs].append(option).trigger('change');
})
});
@ -195,117 +211,136 @@ $(function(){
});
});
},
datepicker:function(){
var $self = this;
M['plugin']['datetimepicker']=[
M['url']['epl']+'time/jquery.datetimepicker.css',
M['url']['epl']+'time/jquery.datetimepicker.js'
datepicker: function () {
var $self = this;
M['plugin']['datetimepicker'] = [
M['url']['epl'] + 'time/jquery.datetimepicker.css',
M['url']['epl'] + 'time/jquery.datetimepicker.js'
];
$.include(M['plugin']['datetimepicker'], function () {
var starttime = $('#date_timepicker_start'),
endtime = $('#date_timepicker_end');
var starttime = $('#date_timepicker_start'),
endtime = $('#date_timepicker_end');
starttime.datetimepicker({
lang:M.synchronous=='cn'?'ch':'en',
timepicker:starttime.attr("data-day-type")==2?true:false,
format:starttime.attr("data-day-type")==2?'Y-m-d H:i:s':'Y-m-d',
lang : M.synchronous == 'cn' ? 'ch' : 'en',
timepicker : starttime.attr("data-day-type") == 2 ? true : false,
format : starttime.attr("data-day-type") == 2 ? 'Y-m-d H:i:s' : 'Y-m-d',
// value:starttime.val()?starttime.val():'',
// onShow:function( ct ){
// this.setOptions({
// maxDate:endtime.val()?endtime.val():false
// })
// },
onSelectDate:function(ct,$i){
$self.tableaajx(starttime);
}
});
onSelectDate: function (ct, $i) {
$self.tableaajx(starttime);
}
});
endtime.datetimepicker({
lang:M.synchronous=='cn'?'ch':'en',
timepicker:endtime.attr("data-day-type")==2?true:false,
format:endtime.attr("data-day-type")==2?'Y-m-d H:i:s':'Y-m-d',
lang : M.synchronous == 'cn' ? 'ch' : 'en',
timepicker : endtime.attr("data-day-type") == 2 ? true : false,
format : endtime.attr("data-day-type") == 2 ? 'Y-m-d H:i:s' : 'Y-m-d',
// value:endtime.val()?endtime.val():'',
// onShow:function( ct ){
// this.setOptions({
// minDate:starttime.val()?starttime.val():false
// })
// },
onSelectDate:function(ct,$i){
$self.tableaajx(endtime);
}
});
onSelectDate: function (ct, $i) {
$self.tableaajx(endtime);
}
});
})
},
alonetime:function(){
var $self = this;
M['plugin']['datetimepicker']=[
M['url']['epl']+'time/jquery.datetimepicker.css',
M['url']['epl']+'time/jquery.datetimepicker.js'
alonetime : function () {
var $self = this;
M['plugin']['datetimepicker'] = [
M['url']['epl'] + 'time/jquery.datetimepicker.css',
M['url']['epl'] + 'time/jquery.datetimepicker.js'
];
$.include(M['plugin']['datetimepicker'], function () {
var alonetime = $('[data-plugin="alonetime"]');
var alonetime = $('[data-plugin="alonetime"]');
alonetime.datetimepicker({
lang:M.synchronous=='cn'?'ch':'en',
timepicker:alonetime.attr("data-day-type")==2?true:false,
format:alonetime.attr("data-day-type")==2?'Y-m-d H:i:s':'Y-m-d',
onSelectDate:function(ct,$i){
$self.tableaajx(alonetime);
}
});
lang : M.synchronous == 'cn' ? 'ch' : 'en',
timepicker : alonetime.attr("data-day-type") == 2 ? true : false,
format : alonetime.attr("data-day-type") == 2 ? 'Y-m-d H:i:s' : 'Y-m-d',
onSelectDate: function (ct, $i) {
$self.tableaajx(alonetime);
}
});
});
},
tableaajx:function(timedom){
if(typeof datatable != 'undefined'){
var $this_datatable=timedom.parents('.dataTable'),
datatable_index=$this_datatable.index('.dataTable');
if(datatable_index<0) datatable_index=0;
tableaajx : function (timedom) {
if (typeof datatable != 'undefined') {
var $this_datatable = timedom.parents('.dataTable'),
datatable_index = $this_datatable.index('.dataTable');
if (datatable_index < 0) datatable_index = 0;
datatable[datatable_index].ajax.reload();
}
},
orders:function(){
var $self = this;
$(document).on('click','a.orderby-link',function (event) {
var $this = $(this), arrow = $this.find(".orderby-arrow");
if(arrow.length){
if($this.find(".desc").length){
$self.orderby($this,'asc');
}else{
orders : function () {
var $self = this;
$(document).on('click', 'a.orderby-link', function (event) {
var $this = $(this),
arrow = $this.find(".orderby-arrow");
if (arrow.length) {
if ($this.find(".desc").length) {
$self.orderby($this, 'asc');
} else {
//还原
$self.orderby($this,'');
$self.orderby($this, '');
}
}else{
$self.orderby($this,'desc');
} else {
$self.orderby($this, 'desc');
}
});
},
orderby(dom,type){
var $self = this;
orderby(dom, type) {
var $self = this;
//清楚所有排序
$("a.orderby-link").find(".orderby-arrow").remove();
$("a.orderby-link").next().val('');
//操作当前排序
if(type) dom.append('<span class="orderby-arrow '+type+'"></span>');
if (type) dom.append('<span class="orderby-arrow ' + type + '"></span>');
dom.next().val(type);
$self.tableaajx(dom);
},
ownsubmit:function($form,typestr){
ownsubmit : function ($form, typestr) {
// 插入submit_type字段
if($form.find('[name="submit_type"]').length) $form.append('<input type="hidden" name="submit_type" value=""/>');
if ($form.find('[name="submit_type"]').length) $form.append('<input type="hidden" name="submit_type" value=""/>');
$form.find('[name="submit_type"]').val(typestr);
// 插入表格的all_id字段
if($form.find('.dataTable').length){
var $table = $form.find('.dataTable'),
$checkbox = $table.find('tbody input[type="checkbox"][name="id"]:checked'),
all_id='';
$checkbox.each(function(index, el) {
all_id += all_id?','+$(this).val():$(this).val();
if ($form.find('.dataTable').length) {
var $table = $form.find('.dataTable'),
$checkbox = $table.find('tbody input[type="checkbox"][name="id"]:checked'),
all_id = '';
$checkbox.each(function (index, el) {
all_id += all_id ? ',' + $(this).val() : $(this).val();
})
if(!$form.find('[name="all_id"]').length) $form.append('<input type="hidden" name="all_id"/>');
if (!$form.find('[name="all_id"]').length) $form.append('<input type="hidden" name="all_id"/>');
$form.find('[name="all_id"]').val(all_id);
}
},
tableProcessing:function (_this_){
// 表格数据加载状态
var tbody = $(_this_).find('tbody')
var colspan = tbody.data('colspan')
var html= `<tr>
<td colspan="${colspan}">
<div class="h-50 vertical-align text-xs-center"><div class="loader vertical-align-middle loader-default"></div></div>
</td>
</tr>`
tbody.html(html)
}
};
APPFUN = new appfun();
//地图
if ($('#showmap').length || $('#modalmap').length || $('#selectMap').length) {
$.include(M.url.own_tem + 'js/bmaps.js?' + myDate, function () {
APPMAP.bmaps();
});
}
//缓存
$.ajaxSetup({cache:false});
$.ajaxSetup({cache: false});
});

View File

@ -88,7 +88,7 @@ $met_title = $data['met_title'];
</div>
<table class="dataTable table table-bordered table-hover table-striped w-full m-t-10" id="tables-list" data-table-ajaxurl="{$data.table.ajaxurl}" data-table-pagelength='15' data-plugin="selectable">
<thead>{$data.table.thead}</thead>
<tbody>
<tbody data-colspan="{$data.table.tdcol}">
<tr>
<td colspan="{$data.table.tdcol}">
<div class="h-50 vertical-align text-xs-center"><div class="loader vertical-align-middle loader-default"></div></div>

View File

@ -13,7 +13,7 @@ $met_title = $data['met_title'];
</div>
<table class="dataTable table table-bordered table-hover table-striped w-full m-t-10" id="tableslist" data-table-ajaxurl="{$data.url.ajaxurl}" data-table-pagelength='15' data-plugin="selectable">
<thead>{$data.table.thead}</thead>
<tbody>
<tbody data-colspan="{$data.table.tdcol}">
<tr>
<td colspan="{$data.table.tdcol}">
<div class="h-50 vertical-align text-xs-center"><div class="loader vertical-align-middle loader-default"></div></div>

View File

@ -12,14 +12,14 @@ $met_title = $data['met_title'];
<dl>
<dt><label class='form-control-label'>选择场所</label></dt>
<dd class="form-group">
<select name='v_name' class="form-control" data-plugin="select2"
data-select2-url="{$data.url.select}"
data-tname="{$data.tname}"
data-fiend="v_name"
data-allnone="3"
data-source="add_village"
data-default="{$data.data.v_name}"
data-placeholder="输入场所名"
<select name='v_name' class="form-control" data-plugin="select2"
data-select2-url="{$data.url.select}"
data-tname="{$data.tname}"
data-fiend="v_name"
data-allnone="3"
data-source="add_village"
data-default="{$data.data.v_name}"
data-placeholder="输入场所名"
required data-fv-notEmpty-message='不能为空'>
<option value=""></option>
</select>
@ -34,74 +34,126 @@ $met_title = $data['met_title'];
<dl>
<dt><label class='form-control-label'>场所地址</label></dt>
<dd>
<div data-plugin="select-linkage" data-select-url="{$data.url.city}" class="city-css form-group">
<select name="v_province" class="form-control m-r-5 prov" data-checked="{$data.data.v_province}"
<div data-plugin="select-linkage" data-select-url="{$data.url.city}" class="city-css city-js form-group">
<select name="v_province" class="form-control m-r-5 prov" data-checked="{$data.data.v_province}"
required data-fv-notEmpty-message="不能为空"></select>
<select name="v_city" class="form-control m-r-5 city" data-checked="{$data.data.v_city}"
<select name="v_city" class="form-control m-r-5 city" data-checked="{$data.data.v_city}"
required data-fv-notEmpty-message="不能为空"></select>
<select name="v_district" class="form-control m-r-5 dist" data-checked="{$data.data.v_district}"
<select name="v_district" class="form-control m-r-5 dist" data-checked="{$data.data.v_district}"
required data-fv-notEmpty-message="不能为空"></select>
</div>
<div class="form-group clearfix">
<input type="text" name="v_address" value="{$data.data.v_address}" placeholder="请输入详细地址" class="form-control"
<input type="text" name="v_address" value="{$data.data.v_address}" placeholder="请输入详细地址"
class="form-control city-mapjs-address"
required data-fv-notEmpty-message="不能为空">
</div>
</dd>
</dl>
<!--新增地图-->
<dl>
<dt><label class='form-control-label'>地图预览</label></dt>
<dd>
<!--data-target="#appmaps" data-toggle="modal"-->
<div id="showmap" class="h-350"></div>
<button type="button" class="btn btn-primary btn-sm m-t-10" id="mapmodal">打开地图并标注地点的精确位置</button>
</dd>
</dl>
<dl>
<dt><label class='form-control-label'>地图经纬度</label></dt>
<dd class="form-group">
<div class="input-group">
<input type="text" name="v_maplng" value="{$data.data.v_maplng}" readonly="readonly"
class="form-control city-mapjs-lng"
required data-fv-notEmpty-message="不能为空"
data-target="#appmaps" data-toggle="modal">
<div class="input-group-addon">,</div>
<input type="text" name="v_maplat" value="{$data.data.v_maplat}" readonly="readonly"
class="form-control city-mapjs-lat"
required data-fv-notEmpty-message="不能为空"
data-target="#appmaps" data-toggle="modal">
</div>
</dd>
</dl>
<!-- Modal 百度地图JS V3-->
<script type="text/javascript" src="https://api.map.baidu.com/api?type=webgl&v=1.0&ak={$data.mapkey}"></script>
<div class="modal fade" id="appmaps" aria-hidden="true" data-keyboard="false" role="dialog" tabindex="-1">
<div class="modal-dialog modal-center modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close blue-600" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title"></h4>
</div>
<div class="modal-body">
<div id="modalmap" class="h-400" data-mapid="{$data.data.id}"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary button-save">保存并关闭</button>
</div>
</div>
</div>
</div>
<!-- End Modal -->
<!--地图end-->
<dl>
<dt><label class='form-control-label'>相关联系人</label></dt>
<dd class="form-group">
<input type="text" name="v_lxname"
value="{$data.data.v_lxname}"
class="form-control"
placeholder="请输入联系人姓名">
<input type="text" name="v_lxname"
value="{$data.data.v_lxname}"
class="form-control"
placeholder="请输入联系人姓名">
</dd>
</dl>
<dl>
<dt><label class='form-control-label'>联系电话</label></dt>
<dd>
<input type="text" name="v_tel" value="{$data.data.v_tel}" data-plugin='tokenfield' data-delimiter=','/>
<input type="text" name="v_tel" value="{$data.data.v_tel}" data-plugin='tokenfield'
data-delimiter=','/>
<span class="text-help m-l-10">可备注多个联系电话,输入完成一个回车后再输入下一个</span>
</dd>
</dl>
<dl>
<dt><label class='form-control-label'>场所均价</label></dt>
<dd class="form-group">
<input type="text" name="v_price"
value="{$data.data.v_price}"
class="form-control"
required data-fv-notEmpty-message='不能为空'>
<input type="text" name="v_price"
value="{$data.data.v_price}"
class="form-control"
required data-fv-notEmpty-message='不能为空'>
</dd>
</dl>
<dl>
<dt><label class='form-control-label'>社区居住规模</label></dt>
<dd class="form-group">
<input type="text" name="v_psize"
value="{$data.data.v_psize}"
class="form-control"
required data-fv-notEmpty-message='不能为空'>
<input type="text" name="v_psize"
value="{$data.data.v_psize}"
class="form-control"
required data-fv-notEmpty-message='不能为空'>
</dd>
</dl>
<dl>
<dt><label class='form-control-label'>禁投行业</label></dt>
<dd>
<input type="text" name="v_forbidtype" placeholder="输入禁投行业名称" value="{$data.data.v_forbidtype}" data-plugin='tokenfield' data-delimiter=','/>
<input type="text" name="v_forbidtype" placeholder="输入禁投行业名称" value="{$data.data.v_forbidtype}"
data-plugin='tokenfield' data-delimiter=','/>
<span class="text-help m-l-10">禁投行业标签,可设置多个</span>
</dd>
</dl>
<dl>
<dt><label class='form-control-label'>维保人员</label></dt>
<dd class="form-group">
<input type="text" name="v_service"
value="{$data.data.v_service}"
class="form-control"
placeholder="请输入维保人员姓名">
<input type="text" name="v_service"
value="{$data.data.v_service}"
class="form-control"
placeholder="请输入维保人员姓名">
</dd>
</dl>
<dl>
<dt><label class='form-control-label'>备注</label></dt>
<dd class="form-group">
<textarea name="v_text" rows="5" placeholder='备注描述' class='form-control m-r-10'>{$data.data.v_text}</textarea>
<textarea name="v_text" rows="5" placeholder='备注描述'
class='form-control m-r-10'>{$data.data.v_text}</textarea>
<span class="text-help">简短文字描述备注。</span>
</dd>
</dl>

View File

@ -99,7 +99,7 @@ class appadmin extends admin{
'table_on__dopara' => [
['配置参数'],
[
// 'config__doindex' => ['基础配置'],
'config__doindex' => ['基础配置'],
'table_on__dopara' => ['参数列表']
]
],

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,276 +1,292 @@
<?php
//表对应字段
trait tfield {
trait tfield
{
//广告位统计
protected function tf_elevator($sign = true) {
protected function tf_elevator($sign = true)
{
global $_M, $_YW;
return [
'e_enable' => '状态',
'e_number' => '广告位编号',
'e_vid' => '场所名称',
'e_bno' => '门口方位',
'e_aps' => '广告位位置',
'e_size' => '广告位规格',
'e_label' => '相关标签',
'e_text' => '备注'
'e_vid' => '场所名称',
'e_bno' => '门口方位',
'e_aps' => '广告位位置',
'e_size' => '广告位规格',
'e_label' => '相关标签',
'e_text' => '备注'
];
}
//场所统计
protected function tf_village($sign = true) {
protected function tf_village($sign = true)
{
global $_M, $_YW;
return [
'v_name' => '场所名称',
'v_type' => '场所分类',
'v_totalstr' => '广告状态',
'v_address' => '场所地址',
'v_lxname' => '联系人',
'v_tel' => '联系电话',
'v_price' => '场所均价',
'v_psize' => '居住规模',
'v_addtime' => '录入时间',
'v_name' => '场所名称',
'v_type' => '场所分类',
'v_totalstr' => '广告状态',
'v_address' => '场所地址',
'v_lxname' => '联系人',
'v_tel' => '联系电话',
'v_price' => '场所均价',
'v_psize' => '居住规模',
'v_addtime' => '录入时间',
'v_updatetime' => '修改时间',
'v_forbidtype' => '禁投行业',
'v_service' => '维保人员',
'v_text' => '备注'
'v_lnglat' => '经纬度',
'v_service' => '维保人员',
'v_text' => '备注'
];
}
//广告合同关联表
protected function tf_schedule($sign = '') {
protected function tf_schedule($sign = '')
{
global $_M, $_YW;
//Table
$array = [
'e_enable' => '状态',
'e_number' => '广告位编号',
'e_size' => '广告位规格',
'l_address' => '广告位地址',
'h_cid' => '签定的公司',
'l_hnumber' => '合同编号',
'l_title' => '投放名称',
'e_enable' => '状态',
'e_number' => '广告位编号',
'e_size' => '广告位规格',
'l_address' => '广告位地址',
'h_cid' => '签定的公司',
'l_hnumber' => '合同编号',
'l_title' => '投放名称',
'l_starttime' => '开始时间',
'l_endtime' => '结束时间',
'ltype' => '投放状态' //标记是否已经结束
'l_endtime' => '结束时间',
'ltype' => '投放状态' //标记是否已经结束
];
// 导出专用
$barray = [
'e_enable' => '状态',
'e_number' => '广告位编号',
'e_size' => '广告位规格',
'e_vid' => '场所名称',
'e_bno' => '门口方位',
'e_aps' => '广告位位置',
'h_cid' => '签定的公司',
'l_hnumber' => '合同编号',
'l_title' => '投放名称',
'e_enable' => '状态',
'e_number' => '广告位编号',
'e_size' => '广告位规格',
'e_vid' => '场所名称',
'e_bno' => '门口方位',
'e_aps' => '广告位位置',
'h_cid' => '签定的公司',
'l_hnumber' => '合同编号',
'l_title' => '投放名称',
'l_starttime' => '开始时间',
'l_endtime' => '结束时间',
'ltype' => '投放状态' //标记是否已经结束
'l_endtime' => '结束时间',
'ltype' => '投放状态' //标记是否已经结束
];
return $sign || $this->bsign ? $barray : $array;
}
//合同
protected function tf_contract($sign = true) {
protected function tf_contract($sign = true)
{
global $_M, $_YW;
return [
'h_number' => '合同编号',
'h_medium' => '投放媒介',
'h_signtime' => '签订日期',
'h_cid' => '签定公司',
'h_tprice' => '合同总额',
'h_wid' => '签定人员',
'h_totalnum' => '投放次数',
'h_starttime' => '订单开始时间',
'h_endtime' => '订单结束时间',
'h_noticeday' => '提前通知天数',
'h_addtime' => '录入时间',
'h_number' => '合同编号',
'h_medium' => '投放媒介',
'h_signtime' => '签订日期',
'h_cid' => '签定公司',
'h_tprice' => '合同总额',
'h_wid' => '签定人员',
'h_totalnum' => '投放次数',
'h_starttime' => '订单开始时间',
'h_endtime' => '订单结束时间',
'h_noticeday' => '提前通知天数',
'h_addtime' => '录入时间',
'h_updatetime' => '修改时间',
'h_texta' => '投放周期',
'h_tower' => '投放台数',
'h_text' => '备注'
'h_texta' => '投放周期',
'h_tower' => '投放台数',
'h_text' => '备注'
];
}
//企业资料
protected function tf_customer($sign = true) {
protected function tf_customer($sign = true)
{
global $_M, $_YW;
return [
'c_allname' => '公司名称',
'c_name' => '公司简称',
'c_address' => '公司地址',
'c_lxname' => '联系人',
'c_tel' => '联系电话',
'c_addtime' => '录入时间',
'c_allname' => '公司名称',
'c_name' => '公司简称',
'c_address' => '公司地址',
'c_lxname' => '联系人',
'c_tel' => '联系电话',
'c_addtime' => '录入时间',
'c_updatetime' => '修改时间',
'c_text' => '备注',
'c_text' => '备注',
];
}
//企业联系人
protected function tf_workers($sign = true) {
protected function tf_workers($sign = true)
{
global $_M, $_YW;
return [
// 'w_cid' => '隶属公司',
'w_jid' => '职务id',
'w_name' => '姓名',
'w_tel' => '联系电话',
'w_addtime' => '录入时间',
// 'w_cid' => '隶属公司',
'w_jid' => '职务id',
'w_name' => '姓名',
'w_tel' => '联系电话',
'w_addtime' => '录入时间',
'w_updatetime' => '修改时间',
'w_text' => '备注',
'w_text' => '备注',
];
}
//参数
protected function tf_para($sign = true) {
protected function tf_para($sign = true)
{
global $_M, $_YW;
return [
'p_type' => '参数分类',
'p_type' => '参数分类',
'p_value' => '参数值',
'p_name' => '参数名',
'p_num' => '有多少数据在使用',
'p_name' => '参数名',
'p_num' => '有多少数据在使用',
'p_order' => '排序',
'p_text' => '备注'
'p_text' => '备注'
];
}
// 投放页面选择广告位
protected function tf_launch($sign = true) {
protected function tf_launch($sign = true)
{
global $_M, $_YW;
return [
'l_title' => '名称',
'l_hnumber' => '合同编号',
'l_schedule' => '投放进度',
'l_totalnum' => '广告位个数',
'l_starttime' => '广告开始时间',
'l_endtime' => '广告结束时间',
'l_type' => '广告类型',
'l_text' => '备注',
'l_enumber' => '广告位编组最多显示6个',
'l_addtime' => '录入时间',
'l_title' => '名称',
'l_hnumber' => '合同编号',
'l_schedule' => '投放进度',
'l_totalnum' => '广告位个数',
'l_starttime' => '广告开始时间',
'l_endtime' => '广告结束时间',
'l_type' => '广告类型',
'l_text' => '备注',
'l_enumber' => '广告位编组最多显示6个',
'l_addtime' => '录入时间',
'l_updatetime' => '修改时间'
];
}
// 投放页面选择广告位
protected function tf_applan($sign = true) {
protected function tf_applan($sign = true)
{
global $_M, $_YW;
return [
'e_enable' => '状态',
'e_number' => '广告位编号',
'e_enable' => '状态',
'e_number' => '广告位编号',
'e_address' => '广告位地址', //虚拟字段
'endtitle' => '上个计划名称',
'endstime' => '上个开始时间',
'endetime' => '上个结束时间',
'nowtitle' => '当前计划名称',
'nowstime' => '当前开始时间',
'nowetime' => '当前结束时间',
'endtitle' => '上个计划名称',
'endstime' => '上个开始时间',
'endetime' => '上个结束时间',
'nowtitle' => '当前计划名称',
'nowstime' => '当前开始时间',
'nowetime' => '当前结束时间',
'nexttitle' => '下个计划名称',
'nextstime' => '下个开始时间',
'nextetime' => '下个结束时间',
'endtime' => '最大结束时间',
'e_types' => '状态提示'
'endtime' => '最大结束时间',
'e_types' => '状态提示'
];
}
//广告位查询统计
protected function tf_elevators($sign = true) {
protected function tf_elevators($sign = true)
{
global $_M, $_YW;
return [
'e_enable' => '状态',
'e_number' => '广告位编号',
'e_address' => '广告位地址', //虚拟字段
'e_size' => '广告位规格',
'endtitle' => '上个计划名称',
'endstime' => '上个开始时间',
'endetime' => '上个结束时间',
'nowtitle' => '当前计划名称',
'nowstime' => '当前开始时间',
'nowetime' => '当前结束时间',
'nexttitle' => '下个计划名称',
'nextstime' => '下个开始时间',
'nextetime' => '下个结束时间',
'endtime' => '最大结束时间',
'e_enable' => '状态',
'e_number' => '广告位编号',
'e_address' => '广告位地址', //虚拟字段
'e_size' => '广告位规格',
'endtitle' => '上个计划名称',
'endstime' => '上个开始时间',
'endetime' => '上个结束时间',
'nowtitle' => '当前计划名称',
'nowstime' => '当前开始时间',
'nowetime' => '当前结束时间',
'nexttitle' => '下个计划名称',
'nextstime' => '下个开始时间',
'nextetime' => '下个结束时间',
'endtime' => '最大结束时间',
'e_totalnum' => '投放次数',
'etypes' => '排期状态'
'etypes' => '排期状态'
];
}
//广告位查询统计
protected function tf_villages($sign = true) {
protected function tf_villages($sign = true)
{
global $_M, $_YW;
$array = [
'v_name' => '场所名称',
'v_type' => '场所分类',
'v_name' => '场所名称',
'v_type' => '场所分类',
'v_district' => '所属区域',
'v_address' => '场所地址',
'v_enum' => '广告位',
'v_ebnonum' => '门口方位',
'v_free' => '广告位',
'v_bno' => '门口方位',
'v_lease' => '排期中的个数',
'v_endday' => '到期个数',
'v_prerow' => '预排的个数',
'v_text' => '备注'
'v_address' => '场所地址',
'v_enum' => '广告位',
'v_ebnonum' => '门口方位',
'v_free' => '广告位',
'v_bno' => '门口方位',
'v_lease' => '排期中的个数',
'v_endday' => '到期个数',
'v_prerow' => '预排的个数',
'v_text' => '备注'
];
if ($this->bsign) {
$array['v_free'] = '闲置广告位总数';
$array['v_bno'] = '闲置门口方位';
$array['v_enum'] = '广告位总数';
$array['v_ebnonum'] = '门口方位总数';
$array['v_price'] = '场所均价';
$array['v_psize'] = '居住规模';
$array['v_free'] = '闲置广告位总数';
$array['v_bno'] = '闲置门口方位';
$array['v_enum'] = '广告位总数';
$array['v_ebnonum'] = '门口方位总数';
$array['v_price'] = '场所均价';
$array['v_psize'] = '居住规模';
$array['v_forbidtype'] = '禁投行业';
$array['v_service'] = '维保人员';
$array['v_service'] = '维保人员';
} else {
unset($array['v_district']);
}
return $array;
}
//广告位查询统计
protected function tf_noticeday($sign = true) {
protected function tf_noticeday($sign = true)
{
global $_M, $_YW;
return [
'h_number' => '合同编号',
'h_signtime' => '签订日期',
'h_cid' => '签定公司',
'h_tprice' => '合同总额',
'h_wid' => '签定人员',
'h_number' => '合同编号',
'h_signtime' => '签订日期',
'h_cid' => '签定公司',
'h_tprice' => '合同总额',
'h_wid' => '签定人员',
'h_starttime' => '投放开始时间',
'h_endtime' => '投放结束时间',
'h_text' => '备注',
// 'endtime' => '提醒时间',
'htypes' => '提示说明'
'h_endtime' => '投放结束时间',
'h_text' => '备注',
// 'endtime' => '提醒时间',
'htypes' => '提示说明'
];
}
//前台巡查页面
protected function tf_patrol($sign = true) {
protected function tf_patrol($sign = true)
{
global $_M, $_YW;
return [
'e_number' => '编号',
'e_number' => '编号',
'e_address' => '地址', //虚拟字段
'nowtitle' => '名称',
// 'nowstime' => '开始时间',
// 'nowetime' => '剩余',
'nowtitle' => '名称',
// 'nowstime' => '开始时间',
// 'nowetime' => '剩余',
];
}
//巡查列表
protected function tf_keylist($sign = true) {
protected function tf_keylist($sign = true)
{
global $_M, $_YW;
return [
// 'k_passkey' => '密钥密码',
'k_basekey' => '密文密码',
'k_wid' => '相关联系人',
'k_state' => '密钥状态',
'k_addtime' => '新增时间',
// 'k_passkey' => '密钥密码',
'k_basekey' => '密文密码',
'k_wid' => '相关联系人',
'k_state' => '密钥状态',
'k_addtime' => '新增时间',
'k_updatetime' => '修改时间',
'k_text' => '备注'
'k_text' => '备注'
];
}
}

View File

@ -10,6 +10,8 @@ trait tlist {
protected $btn = [];
//禁用最后的按钮
protected $banbtn = false;
// 开启下拉模式组合按钮
protected $btn_group_toggle = false;
//相关参数缓存
protected static $para = [];
//相关公司缓存
@ -51,7 +53,16 @@ trait tlist {
if (count($this->btn) > 0) {
$btnstr = arrayto_string($this->btn, '');
unset($this->btn);
return '<div class="btn-group" role="group" >' . $btnstr . '</div>';
// 普通按钮组合
$btngroup = '<div class="btn-group" role="group" >'.$btnstr.'</div>';
// 下拉方式的组合按钮组
$btngrouptoggle = '<div class="btn-group" role="group">
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
'.$this->btn_group_toggle.'
</button>
<div class="dropdown-menu btn-group-toggle-menu">'.$btnstr.'</div>
</div>';
return $this->btn_group_toggle?$btngrouptoggle:$btngroup;
}
}
@ -173,9 +184,11 @@ trait tlist {
$val['v_forbidtype'] = parent::tab_tokenfield($val['v_forbidtype'], 2);
$val['v_totalstr'] = $val['noban'] > 0 ? parent::str_color(0, $totalstr, 600) : $totalstr;
$val['v_lnglat'] = $val['v_maplng'].$val['v_maplat'];
//执行操作按钮
if (empty($checked)) {
$this->btn_group_toggle = '操作按钮';
$this->btn[] = '<a href="' . $vnameurl . '" class="btn btn-primary btn-sm">查看广告位</a>';
$addtourl = $this->own_name_info . __FUNCTION__ . '&id=' . $val['id'];
$this->btn[] = '<a href="' . $addtourl . '" class="btn btn-success btn-sm">编辑</a>';
@ -251,6 +264,7 @@ trait tlist {
//执行操作按钮
if (empty($checked)) {
$this->btn_group_toggle = '操作按钮';
$addtourl = $this->own_name_info . 'launch&cid=' . $val['id'];
$this->btn[] = '<a href="' . $addtourl . '" class="btn btn-primary btn-sm">新增投放</a>';
$this->btn[] = '<a href="' . $launchurl . '" class="btn btn-info btn-sm">查看投放</a>';
@ -423,10 +437,13 @@ trait tlist {
//执行操作按钮
if (empty($checked)) {
$this->btn_group_toggle = '操作按钮';
$this->btn[] = '<a href="' . $l_titleurl . '" class="btn btn-info btn-sm">查看排期</a>';
$addtourl = $_M['url']['own_name'] . 'c=backups&a=doindex&tname=schedule&id=' . $val['id'];
$this->btn[] = '<a href="' . $addtourl . '" class="btn btn-warning btn-sm">导出排期</a>';
$addtourl = $this->own_name_info . __FUNCTION__ . '&slid=' . $val['id'];
$addtourl = $this->own_name_info.__FUNCTION__.'&fzid='.$val['id'].'&eaps_order=2';
$this->btn[] = '<a href="'.$addtourl.'" class="btn btn-primary btn-sm">复制</a>';
$addtourl = $this->own_name_info.__FUNCTION__.'&slid='.$val['id'].'&eaps_order=2';
$this->btn[] = '<a href="' . $addtourl . '" class="btn btn-success btn-sm">编辑</a>';
}
return self::assemble($key, $base, $val, $checked);

View File

@ -0,0 +1,911 @@
namespace APPMAP {
// 对城市信息初始化
// 对inpout初始化
class base {
// 当前地图经纬度
protected mapLng: string = '116.395645'
protected mapLat: string = '39.929986'
// 当前地图的经纬度对象
protected mapPoints: object = {}
// input值
protected inputLng: string = ''
protected inputLat: string = ''
// input值对象
protected inputPoints: object = {}
// input生成标注点对象,跟模态框同步的对象标注点
protected cacheMarker: object = {}
// 城市信息
protected allCity: string = ''
protected selectProv: string = ''
protected selectCity: string = ''
protected selectDist: string = ''
protected address: string = ''
// dom
private lngDom: any = {}
private latDom: any = {}
constructor() {
this.mapLng = CL.c.maplng || this.mapLng
this.mapLat = CL.c.maplat || this.mapLat
// 若是inputLng值变化同步到input输入框
this.watch(this, 'inputLng', () => {
this.setInputLng()
})
// 若是inputLat值变化同步到input输入框
this.watch(this, 'inputLat', () => {
this.setInputLat()
})
this.initHtmlDom()
// 进行初始化
this.getInputLngLat()
// 判断input是否有值有的话直接传递给默认值
this.syncMapLngLat()
// 获取城市信息
this.getCity()
// 城市信息
$(document).on('change keyup', '.city-js select', () => {
// 清空详细地址
if ($(".city-mapjs-address").length) $(".city-mapjs-address").val('')
});
// 包含详细地址的变化
$(document).on('change keyup', '.city-js select, .city-mapjs-address', () => {
this.getCity()
});
}
// 全局dom
initHtmlDom() {
// 经纬度
this.lngDom = $(".city-mapjs-lng")
this.latDom = $(".city-mapjs-lat")
}
// 判断是否为空
isEmpty(val: any) {
switch (val) {
case ',':
return true
case '请选择':
return true
case '请选择所在地区':
return true
}
return APPFUN.isEmpty(val)
}
// 获取经纬度
getInputLngLat() {
this.inputLng = this.lngDom.val()
this.inputLat = this.latDom.val()
}
// 同步到地图经纬度
syncMapLngLat() {
if (!this.isEmpty(this.inputLng) && !this.isEmpty(this.inputLat)) {
this.mapLng = this.inputLng
this.mapLat = this.inputLat
}
}
// 对input赋值
setInputLngLat() {
this.setInputLng()
this.setInputLat()
}
setInputLng() {
this.lngDom.val(this.inputLng)
this.lngDom.trigger('input')
}
setInputLat() {
this.latDom.val(this.inputLat)
this.latDom.trigger('input')
}
// 获取地址信息
getCity() {
//获取城市信息
this.selectProv = this.isCity($(".city-js select.prov").find("option:selected").val())
this.selectCity = this.isCity($(".city-js select.city").find("option:selected").val())
this.selectDist = this.isCity($(".city-js select.dist").find("option:selected").val())
this.address = this.isCity($(".city-mapjs-address").val())
// 拼装一个除了省信息以外的地址字符串
this.allCity = this.selectCity + this.selectDist + this.address;
}
// 判断城市信息是否为空
isCity(string: string) {
return !this.isEmpty(string) ? string : ''
}
// 根据城市信息判断地图级别
level() {
let level = 12
// 省份 20km
if (!this.isEmpty(this.selectProv)) level = 10
// 市区 5km
if (!this.isEmpty(this.selectCity)) level = 12
// 县市区 500M
if (!this.isEmpty(this.selectDist)) level = 14
// 详细地址 200M
if (!this.isEmpty(this.selectDist) && !this.isEmpty(this.address)) level = 15
return level;
}
// 对参数进行监听,做出对应的操作
watch(JsonObj: any, key: string, closure?: any) {
// 缓存值
let cacheData: any = {};
cacheData[key] = JsonObj[key];
Object.defineProperty(JsonObj, key, {
enumerable: true, // 该属性可被枚举
configurable: true, // 该属性可以被删除以及属性描述符可以被改变
get() {
// 需要从缓存值获取不能直接obj获取
return cacheData[key]
},
set(newValue) {
const oldValue = cacheData[key];
// 改变原来的值也就是修改JsonObj的值
cacheData[key] = newValue;
if (typeof closure === 'function' && oldValue !== newValue) closure(newValue, oldValue)
}
})
}
}
// 初始一个地图并返回本地图对象
class initialMap extends base {
// 展示类型的地图对象缓存
protected showMap: any = {}
// 模态框地图对象缓存
protected modalMap: any = {}
// 地图模式
protected mapType: boolean = false
protected myGeos: any = {}
// 缓存ajax查询结果
protected mapLngLatList: any = {}
protected mapCacheMarker: any = {}
constructor() {
super()
this.myGeos = new BMapGL.Geocoder();
// 将input信息转为对象,若是input有值 直接初始化后传递给地图
if (!this.isEmpty(this.inputLng) && !this.isEmpty(this.inputLat)) {
this.inputPoints = this.mapPoints = this.lnglatToPoints(this.inputLng, this.inputLat)
} else {
// 若是经纬度不存在,则城市信息存在则以城市信息为准,但是城市信息获取对象有延迟,则需要调整到后面
// 使用默认值对地图的经纬度转成对象
this.mapPoints = this.lnglatToPoints(this.mapLng, this.mapLat)
}
}
// 将字符串经纬度转换成经纬度对象
lnglatToPoints(lng: string, lat: string) {
let point = {}
if (!this.isEmpty(lng) && !this.isEmpty(lat)) point = new BMapGL.Point(lng, lat)
return point
}
// 初始化一个地图
initMap(domId: string, level?: any) {
const map = new BMapGL.Map(domId, {enableMapClick: false});
// 初始化地图,设置中心点坐标和地图级别
map.centerAndZoom(this.mapPoints, level || this.level());
// 开启鼠标滚轮缩放
map.enableScrollWheelZoom(true);
// 地图配置
map.setDisplayOptions({
// 隐藏POI文字
// poiText: false,
// 隐藏POI的Icon
poiIcon: false
})
return map
}
// 旋转地图角度
setHeadingTilt(map: any) {
// 地图当前旋转角度
// map.setHeading(64.5);
// 地图当前状态倾斜角度
map.setTilt(65);
}
// 将城市信息转化为经纬度,并根据经纬度调整地图
citySyncMap(mapOjb: any, level?: number) {
// 异步执行建议在地图加载完成(tilesloaded)后再进行地图调整,否则无效
this.myGeos.getPoint(this.allCity || this.selectProv, (point: any) => {
if (point) {
this.mapPoints = point
this.mapLng = point.lng
this.mapLat = point.lat
mapOjb.panTo(point);
// 让他自动调整地图
if (level && level > 0) mapOjb.setZoom(level);
} else {
console.log("您选择地址没有解析到结果!")
}
}, this.selectProv);
}
// 获取经纬度列表
ajaxlnglatList(map: any, formJson: object, clickEvent: boolean = false, closure?: any) {
$.getJSON(M.url.own_name + "c=ajax&a=doallmap", formJson, (listJson: any) => {
this.mapLngLatList = listJson
$.each(listJson, (i: number, val: any) => {
// 值的转换为了后面统一使用,对应后期数据库的值
val.maplng = val.v_maplng
val.maplat = val.v_maplat
// 根据clickEvent 判断是否要启用标注点的信息提示
const clickClosure = clickEvent ? this.addOpenInfo(map, val) : ''
if (!this.isEmpty(val.maplng) && !this.isEmpty(val.maplat)) this.addMapOverlay(map, val.maplng, val.maplat, false, val.id, clickClosure);
// 暂时考虑加入一个回调
// if (typeof closure === 'function') closure(val);
})
})
}
// 标注图标样式
myIcon() {
return new BMapGL.Icon(
// 图片地址
M.url.own_tem + "/img/markers.png",
// 标注的大小,跟图片上的标注图样大小一致
new BMapGL.Size(21, 25),
// 其他参数
{
// 图片的大小
imageSize: new BMapGL.Size(42, 325),
// 指定定位位置。
// 当标注显示在地图上时,其所指向的地理位置距离图标左上
// 角各偏移10像素和25像素。您可以看到在本例中该位置即是
// 图标中央下端的尖角位置。
anchor: new BMapGL.Size(10, 25),
// 设置图片偏移。
// 当您需要从一幅较大的图片中截取某部分作为标注图标时,您
// 需要指定大图的偏移位置此做法与css sprites技术类似。
// 设置图片偏移
imageOffset: new BMapGL.Size(0, 300)
}
);
}
// 地图点的标注
addMapOverlay(appmapl: any, lng: string, lat: string, icons: boolean = false, listId?, clickClosure?: any) {
if (this.isEmpty(lng)) return false;
// 获取经纬度 创建标注
const points = this.lnglatToPoints(lng, lat)
const marker = new BMapGL.Marker(points);
// 给标注点添加点击回调
if (typeof clickClosure === 'function') {
marker.addEventListener("click", (e: any) => {
clickClosure(e)
})
// 因为marker不会直接存在dom地图打开后才会生成dom
// 将所有的标注点缓存,方便手动触发标注点的点击事件
this.watch(marker, 'domElement', () => {
this.mapCacheMarker[listId] = $(marker.domElement)
})
}
// 标注图标,需要单独标注的颜色,则进行缓存
if (icons) {
// 缓存一下
this.cacheMarker = marker
marker.setIcon(this.myIcon());
}
// 添加到地图
appmapl.addOverlay(marker);
return points
}
// 添加标注信息窗口
addOpenInfo(map: any, value: any) {
const opts = {
// width: 250, // 信息窗口宽度
// height: 80, // 信息窗口高度
maxWidth: 350,
enableAutoPan: true,
title: value.v_name // 信息窗口标题,设置为小区名称
};
// 组织内容
// let content = `<p>类型:${value.}</p>`
let content = `<p>${value.v_province}${value.v_city}${value.v_district}${value.v_address}</p>`
// 返回一个函数方便点击事件二次调用
return (e: any) => {
const p = e.target;
const point = this.lnglatToPoints(p.getPosition().lng, p.getPosition().lat);
const infoWindow = new BMapGL.InfoWindow(content, opts); // 创建信息窗口对象
map.openInfoWindow(infoWindow, point); //开启信息窗口
}
}
}
// 展示型的地图动作操作
class showMap extends initialMap {
constructor() {
super();
// 获取地图状态
this.getMapType()
// 初始化
this.showInitMap()
// 启动城市信息监听
this.watchCity()
}
showInitMap() {
// 初始化地图
this.showMap = this.initMap("showmap")
// 旋转地图角度
this.setHeadingTilt(this.showMap)
// 地图初始化完成后若是没有input的值且又存在城市信息则按照城市信息调整地图
if (this.isEmpty(this.inputLng) && this.isEmpty(this.inputLat) && !this.isEmpty(this.allCity)) this.citySyncMap(this.showMap)
// 根据地图状态处理标记
if (this.mapType) this.addMapOverlay(this.showMap, this.inputLng, this.inputLat, true)
}
getMapType() {
// true 则进行标记
// false 不进行地图标记
return this.mapType = $('#showmap').data('type') === 'showmap' ? false : true;
}
watchCity() {
const $fun = () => {
this.citySyncMap(this.showMap)
}
// 监听指定的参数
this.watch(this, 'selectProv', $fun)
this.watch(this, 'allCity', $fun)
// 只是针对纯展示型地图,不带标记的
if (!this.mapType) {
// 禁止拖拽
// this.showMap.disableDragging()
// 若是地图经纬度变化时是否同步给input
this.watch(this, 'mapLng', () => {
this.inputLng = this.mapLng
})
this.watch(this, 'mapLat', () => {
this.inputLat = this.mapLat
})
}
}
}
// 模态框地图动作操作
class modalMap extends showMap {
// 模态框的缓存信息
protected modalLng: string = ''
protected modalLat: string = ''
// input值对象
protected modalPoints: object = {}
constructor() {
super();
//验证信息
$('#mapmodal').on('click', () => {
// 获取城市信息
// this.getCity()
if (this.isEmpty(this.selectCity)) {
$.include(M['url']['static2_vendor'] + 'alertify/alertify.js', function () {
alertify.logPosition("右下角");
alertify.error("请选择城市。");
})
} else {
const html = '范围:' + this.selectProv + '<small style="padding-left:15px;">' + this.allCity + '</small>';
$('h4.modal-title').html(html)
// 打开模态框
$('#appmaps').modal('show')
}
});
//模态框
$('#appmaps').on('shown.bs.modal', () => {
// 延迟效果可以让模态框加载时看起来没有卡的感觉
setTimeout(() => {
// 解决因页面产品滚动条导致的点击地图获取的经纬度不准确问题
// 让滚动条回滚到顶部
document.body.scrollTop = document.documentElement.scrollTop = 0
// 初始化模态框
this.modalInitMap()
// 主要是用来排除掉当前小区的标记
const mapId = $('#modalmap').data('mapid') || '';
// // ajax查找 当前地区点的标注并添加在地图上
this.ajaxlnglatList(this.modalMap, {
id: mapId,
province: this.selectProv,
city: this.selectCity,
district: this.selectDist
})
//点击百度地图时触发
this.modalMap.addEventListener("click", (e: any) => {
//清除单个标注
this.modalMap.removeOverlay(this.cacheMarker);
//赋值给输入框
this.modalLng = e.latlng.lng
this.modalLat = e.latlng.lat;
// 他变化时要同时针对多个地图直接变化
this.modalPoints = this.addMapOverlay(this.modalMap, this.modalLng, this.modalLat, true)
});
}, 200)
});
// 保存
$('#appmaps .button-save').on('click', () => {
//判断是否同步信息到展示地图
if (!this.isEmpty(this.modalLng) && !this.isEmpty(this.modalLat)) {
//返回值
this.inputLng = this.modalLng
this.inputLat = this.modalLat
//展示图的操作
if (!this.isEmpty(this.showMap)) {
//清除展示地图的标注
this.showMap.clearOverlays();
//地图显示
this.mapPoints = this.inputPoints = this.modalPoints
this.showMap.panTo(this.mapPoints)
//对地图一进行标注
this.addMapOverlay(this.showMap, this.inputLng, this.inputLat, true);
}
}
//关闭对话框
$('#appmaps').modal('hide');
});
// 关闭
$('#appmaps').on('hidden.bs.modal', () => {
//清除标注
this.modalMap.clearOverlays()
// 还原信息
this.modalLng = this.modalLat = ''
this.modalPoints = {}
//清除模态框数据
$('#appmaps').removeData("bs.modal")
// 销毁地图
this.modalMap.destroy()
});
}
modalInitMap() {
// 初始化地图
this.modalMap = this.initMap("modalmap")
// 添加当前经纬度标记
if (!this.isEmpty(this.inputLng) && !this.isEmpty(this.inputLat)) this.addMapOverlay(this.modalMap, this.inputLng, this.inputLat, true);
}
}
// 通过地图选择
class selectMap extends initialMap {
// 目前的形式地图只初始化一次,模态框关闭不影响二次打开继续之前的操作
protected selectMapInitType = false
// 地图实例对象
public selectMap: any = {}
// 地图工具对象
protected drawingManager: any = {}
//本次覆盖物对象缓存
protected overlaysCache = {
overlays: {},
hashCode: '',
drawingMode: ''
}
// 绘制覆盖物缓存 hashCode = 覆盖物对象
protected overlays = {}
// 绘制覆盖物类型对照 hashCode = 类型
// Marker 点 || Circle 圆 || Polyline 线 || Polygon 多边 || rectangle 矩形
protected hashCode = {}
// 绘制覆盖物选中的小区对照 hashCode = 小区ID
protected markerID = {
marker: [],
polyline: [],
circle: [],
rectangle: [],
polygon: []
}
// 选中小区缓存过渡 初次筛选
protected villageFilterList = {}
// 选中的小区数组 id = 小区对象
protected villageList = {}
constructor() {
super();
//模态框
$('#selectMapId').on('shown.bs.modal', () => {
// 设置地图高度,达到满屏效果
if(!this.selectMapInitType) this.setHeight()
// 延迟效果可以让模态框加载时看起来没有卡的感觉
setTimeout(() => {
// 解决因页面产品滚动条导致的点击地图获取的经纬度不准确问题
// 让滚动条回滚到顶部
document.body.scrollTop = document.documentElement.scrollTop = 0
// 初始化模态框
if(!this.selectMapInitType) this.selectInitMap()
// ajax查找 当前地区点的标注并添加在地图上
this.ajaxlnglatList(this.selectMap, {
id: '',
province: this.selectProv,
city: this.selectCity,
district: this.selectDist,
allinfo: 'all'
}, true)
// 初始化绘制工具
if(!this.selectMapInitType) this.drawingManagerInit()
// 绘制结束后的回调
this.drawingManager.addEventListener("overlaycomplete", (e) => {
let overlay = e.overlay
let hashCode = overlay.hashCode
let drawingMode = e.drawingMode
this.overlays[hashCode] = overlay
this.hashCode[hashCode] = drawingMode
// 本次操作的值缓存
this.overlaysCache = {
overlays: overlay,
hashCode: hashCode,
drawingMode: drawingMode
}
// 筛选选中的小区
let latLngNum = 0
// 初始化
this.villageFilterList = {}
$.each(this.mapLngLatList, (i: number, val: any) => {
latLngNum++
// 值的转换为了后面统一使用,对应后期数据库的值
let points = this.lnglatToPoints(val.v_maplng, val.v_maplat)
let result = false
// 只有矩形需要获取覆盖物的范围,其他的直接将覆盖物对象传入即可
switch (drawingMode) {
case 'polyline':
// 折线
result = BMapGLLib.GeoUtils.isPointOnPolyline(points, overlay)
break;
case 'circle':
// 圆
result = BMapGLLib.GeoUtils.isPointInCircle(points, overlay)
break;
case 'rectangle':
// 矩形
let bounds = overlay.getBounds()
result = BMapGLLib.GeoUtils.isPointInRect(points, bounds)
break;
case 'polygon':
// 多边形
result = BMapGLLib.GeoUtils.isPointInPolygon(points, overlay)
break;
default:
break;
}
if (result == true) {
if (!this.markerID[drawingMode][hashCode]) this.markerID[drawingMode][hashCode] = []
this.markerID[drawingMode][hashCode].push(val.id)
// 缓存本次的值
this.villageFilterList[val.id] = val
}
// 打开弹窗 选中小区缓存筛选
if (latLngNum === Object.keys(this.mapLngLatList).length) this.confirmOperate()
})
});
// 标记为已经初始化过
if(this.selectMapInitType === false) this.selectMapInitType = true
}, 100)
});
// 清空
$('#selectMapId .mapreset').on('click', (e: any) => {
// 重置
this.mapreset()
this.listNum('selectMapId')
this.input()
})
// 删除指定小区
$('#selectMapId').on('click', 'li button', (e) => {
const domLi = $(e.target).parents('li')
this.delFilterList(domLi.data('id'))
domLi.remove()
})
// 保存
$('#selectMapId .button-save').on('click', () => {
// 将ID写入某个input
let keysArr = Object.keys(this.villageList)
let keysStr = keysArr.toString()
this.input(keysStr)
//关闭对话框
$('#selectMapId').modal('hide');
});
// 关闭
$('#selectMapId').on('hidden.bs.modal', () => {
//清除标注
// this.modalMap.clearOverlays()
//清除模态框数据
// $('#selectMapId').removeData("bs.modal")
// 销毁地图
// this.selectMap.destroy()
});
// 点击LI地图上打开对应的标注
$('.villageList ul').on('click', 'li[data-id] h5', (e) => {
let id = $(e.target).parents('li').data('id')
let listInfo = this.villageList[id]
// 转移地图核心为标注点
let point: any = this.lnglatToPoints(listInfo.maplng, listInfo.maplat)
this.selectMap.panTo(point);
// 触发标注点的点击事件
this.mapCacheMarker[id].trigger('click')
})
}
// 设置同步地图和选中列表展示的高度
// outerHeight 包含padding margin border
// height 不含padding margin border
setHeight() {
const headerHeight = $("#selectMapId .modal-header").outerHeight(true)
// const footerHeight = $("#selectMapId .modal-footer").height()
const wHeight = $(document.body).height()
const mapHeight = wHeight - headerHeight - 15
// 设置高度
$(".selectMapHeight").height(mapHeight)
// 选中内容高度
const panelHeading = $(".selectMapHeight .panel-heading").outerHeight(true)
const panelFooter = $(".selectMapHeight .panel-footer").outerHeight(true)
const panelBody = $(".selectMapHeight .panel-body").outerHeight(true) - $(".selectMapHeight .panel-body").height()
$(".selectMapHeight .panel-body").height(mapHeight - panelHeading - panelFooter - panelBody)
}
// 设置首次筛选列表内容高度
setFilterModalBodyHeight() {
// 首次筛选的内容高度
const filterListmodalHeight = $("#filterListmodal").outerHeight(true)
const modalHeader = $("#filterListmodal .modal-header").outerHeight(true)
const modalFooter = $("#filterListmodal .modal-footer").outerHeight(true)
const modalBody = $("#filterListmodal .modal-body").outerHeight(true) - $("#filterListmodal .modal-body").height()
$("#filterListmodal .filterList").height(filterListmodalHeight - modalHeader - modalBody - modalFooter)
}
// 初始化地图
selectInitMap() {
this.selectMap = this.initMap("selectMap")
}
// 实例化鼠标绘制工具
drawingManagerInit() {
// 源码:https://github.com/huiyan-fe/BMapGLLib/blob/master/DrawingManager/src/DrawingManager.js#L44
const styleOptions = {
strokeColor: '#5E87DB', // 边线颜色
fillColor: '#5E87DB', // 填充颜色。当参数为空时,圆形没有填充颜色
strokeWeight: 2, // 边线宽度,以像素为单位
strokeOpacity: 1, // 边线透明度取值范围0-1
fillOpacity: 0.2 // 填充透明度取值范围0-1
};
const labelOptions = {
borderRadius: '2px',
background: '#FFFBCC',
border: '1px solid #E1E1E1',
color: '#703A04',
fontSize: '12px',
letterSpacing: '0',
padding: '5px'
};
this.drawingManager = new BMapGLLib.DrawingManager(this.selectMap, {
// isOpen: true, //是否开启绘制模式
enableDrawingTool: true, // 是否显示工具栏
enableCalculate: true, // 绘制是否进行测距(画线时候)、测面(画圆、多边形、矩形)
drawingToolOptions: {
enableTips: true,
customContainer: 'selectbox_Drawing',
hasCustomStyle: true,
anchor: BMAP_ANCHOR_TOP_RIGHT,
offset: new BMapGL.Size(25, 15), // 偏离值,调整工具的位置
scale: 1, // 工具栏缩放比例
drawingModes: [
// BMAP_DRAWING_MARKER,
BMAP_DRAWING_POLYLINE,
BMAP_DRAWING_RECTANGLE,
BMAP_DRAWING_POLYGON,
BMAP_DRAWING_CIRCLE,
]
},
enableSorption: true, // 是否开启边界吸附功能
sorptionDistance: 20, // 边界吸附距离
enableGpc: true, // 是否开启延边裁剪功能
circleOptions: styleOptions, // 圆的样式
polylineOptions: styleOptions, // 线的样式
polygonOptions: styleOptions, // 多边形的样式
rectangleOptions: styleOptions, // 矩形的样式
labelOptions: labelOptions // label的样式
});
}
// 选中区域确定后的处理
confirmOperate() {
// 执行循环结果后的内容
this.addHtmlShow('filterList')
// 打开筛选模态框
$('#filterListmodal').modal('show')
$('#filterListmodal').on('shown.bs.modal', () => {
this.listNum('filterListmodal')
// 处理列表
this.setFilterModalBodyHeight()
})
// 筛选中时重选
$('#filterListmodal .mapreset').on('click', (e: any) => {
//关闭对话框
$('#filterListmodal').modal('hide');
// 主要是取消选中区域覆盖物
this.mapresetClose()
})
// 保存
$('#filterListmodal .button-save').on('click', () => {
//关闭对话框
$('#filterListmodal').modal('hide');
// 并将保存的结果插入到选中小区表
this.addHtmlShow('villageList')
})
// 删除指定小区
$('#filterListmodal').on('click', 'li button', (e) => {
const domLi = $(e.target).parents('li')
this.delFilterList(domLi.data('id'), 'filterList')
domLi.remove()
})
// 关闭
$('#selectMapId').on('hidden.bs.modal', () => {
//清除模态框数据
$('#selectMapId').removeData("bs.modal")
})
}
// 选中区域HTML输出
// 判断输出到哪个dom
addHtmlShow(domclass?) {
let dom = $(`.${domclass}`).find('ul')
// 暂时直接输出,不考虑分页问题
let listNum = domclass === 'filterList' ? 0 : (Object.keys(this.villageList).length || 0)
let initListNum = 0
$.each(this.villageFilterList, (i: number, val: any) => {
// 组织HTML结构
if (domclass !== 'filterList') {
if (this.villageList[i] && Object.keys(this.villageList[i]).length > 0) return true
// 赋值给最终结果
this.villageList[i] = val
}
// 输出html
let li = this.htmlLi(i, val)
listNum === 0 ? dom.html(li) : dom.prepend(li)
listNum++
initListNum++
if (initListNum === Object.keys(this.villageFilterList).length) {
this.listNum('selectMapId')
}
})
}
// 组织HTML结构
htmlLi(key, val) {
// 组织HTML结构
let address = val.v_city + val.v_district + val.v_address
return `<li class="list-group-item village-list-item" data-id="${key}">
<h5>${val.v_name}</h5>
<button type="button" class="float-right close">
<i class="icon wb-close m-0 font-danger" aria-hidden="true"></i>
</button>
<p>${address}</p>
</li>`
}
// 重选,或者取消
mapresetClose() {
// 主要是取消选中区域覆盖物
let hashCode = this.overlaysCache.hashCode
let drawingMode = this.overlaysCache.drawingMode
delete this.overlays[hashCode]
delete this.hashCode[hashCode]
delete this.markerID[drawingMode][hashCode]
this.selectMap.removeOverlay(this.overlaysCache.overlays)
}
// 清空选中的所有内容操作
mapreset() {
// 无法禁止在removeOverlay删除小区标注点换成单个删除
$.each(this.overlays, (i, val: any) => {
this.selectMap.removeOverlay(val)
delete this.overlays[i]
// 后期若是要达到精准需要单独处理
delete this.hashCode[i]
})
// 全部还原
this.markerID = {
marker: [],
polyline: [],
circle: [],
rectangle: [],
polygon: []
}
// 全部还原
this.villageList = {}
$('.villageList ul').html(`<li class="list-group-item">没有选中小区</li>`)
}
// 删除指定的数据
delFilterList(id, domclass?) {
if (domclass === 'filterList') {
delete this.villageFilterList[id]
this.listNum('filterListmodal', 'del')
} else {
delete this.villageList[id]
this.listNum('selectMapId', 'del')
}
}
// 计算选中个数
listNum(domclass?, type?) {
if (domclass === 'filterListmodal') {
let listNum = this.villageFilterList ? Object.keys(this.villageFilterList).length : 0
$('#filterListmodal .listNum').html(listNum)
if (listNum === 0 && type === 'del') {
this.mapresetClose()
//关闭对话框
$('#filterListmodal').modal('hide');
}
} else {
let listNums = this.villageList ? Object.keys(this.villageList).length : 0
$('#selectMapId .listNum').html(listNums)
$('button[data-target="#selectMapId"] .listNum').html(listNums > 0?listNums:'')
if (listNums === 0 && type === 'del') this.mapreset()
}
}
// 将指传递到input
input(keysStr?){
const inputVid = $('input[name="v_id"]')
inputVid.val(keysStr)
inputVid.trigger('change')
}
}
// @ts-ignore
export function bmaps() {
// 模态框
if ($('#modalmap').length) {
console.log('模态框类型')
new modalMap()
} else if ($('#showmap').length) {
console.log('纯展示类型')
// 展示形式
new showMap()
} else if ($('#selectMap').length) {
// 地图选择形式
console.log('-------------')
// $('button[data-target="#selectMapId"]').on('click', () => {})
// 目前的形式地图只初始化一次,模态框关闭不影响二次打开继续之前的操作
new selectMap()
// 测试时自动启动模态框
// $('button[data-target="#selectMapId"]').click()
}
}
}

18
src/admin/templates/js/index.d.ts vendored Normal file
View File

@ -0,0 +1,18 @@
declare let $:any
declare let jQuery:any
declare let APPFUN:{
isEmpty: (a:any)=>{}
}
declare let BMapGL:any
declare let M:any
declare let alertify:any
declare let CL:any
declare let BMAP_ANCHOR_TOP_LEFT:any
declare let BMAP_ANCHOR_BOTTOM_LEFT:any
declare let BMAP_ANCHOR_TOP_RIGHT:any
declare let BMAP_DRAWING_MARKER:any
declare let BMAP_DRAWING_POLYLINE:any
declare let BMAP_DRAWING_RECTANGLE:any
declare let BMAP_DRAWING_POLYGON:any
declare let BMAP_DRAWING_CIRCLE:any
declare let BMapGLLib:any

View File

@ -128,6 +128,8 @@ class update extends admin{
`v_text` text COMMENT '备注',
`v_updatetime` datetime DEFAULT NULL,
`v_addtime` datetime DEFAULT NULL,
`v_maplng` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '小区经度',
`v_maplat` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '小区维度',
PRIMARY KEY (`id`),
UNIQUE KEY `vname` (`v_name`)";

62
tsconfig.json Normal file
View File

@ -0,0 +1,62 @@
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig.json to read more about this file */
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
"module": "umd", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
// "lib": [], /* Specify library files to be included in the compilation. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
"sourceMap": false, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
"outDir": "", /* Redirect output structure to the directory. */
"rootDir": "src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
"removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
"alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
/* Source Map Options */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
/* Advanced Options */
"skipLibCheck": true, /* Skip type checking of declaration files. */
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
}
}