地图筛选新增区域选择、小区统计筛选、投放计划新增区域选择

This commit is contained in:
cloud 2020-12-30 20:31:51 +08:00
parent a4b7260db8
commit 9a84951490
10 changed files with 231 additions and 55 deletions

View File

@ -37,8 +37,15 @@ class ajax extends appadmin
// 省市区 // 省市区
if (!empty($_M['form']['province'])) $where .= " AND v_province= '{$_M['form']['province']}' "; 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']['city'])) $where .= " AND v_city= '{$_M['form']['city']}' ";
// if (!empty($_M['form']['district'])) $where .= " AND v_district= '{$_M['form']['district']}'"; if (!empty($_M['form']['district'])) $where .= " AND v_district= '{$_M['form']['district']}'";
// 其他条件
if (!empty($_M['form']['vtype']) || $_M['form']['vtype'] === '0' || $_M['form']['vtype'] === 0) {
$vtype = stringto_array($_M['form']['vtype'], ',');
// 社区类型,分类
$where .= " AND " . $this->tsql->where_arr(['v_type' => $vtype]);
}
$qfield = $_M['form']['allinfo'] === 'all' ? '*' : 'id,v_maplng,v_maplat'; $qfield = $_M['form']['allinfo'] === 'all' ? '*' : 'id,v_maplng,v_maplat';
$array = $this->tsql->table('village') $array = $this->tsql->table('village')
->qfield($qfield) ->qfield($qfield)

File diff suppressed because one or more lines are too long

View File

@ -475,8 +475,8 @@ ul.panel-actions > li:first-child {
} }
.panel > .panel-collapse > .table caption, .panel > .table caption, .panel > .table-responsive > .table caption { .panel > .panel-collapse > .table caption, .panel > .table caption, .panel > .table-responsive > .table caption {
padding-left: 30px 30px; padding-left: 30px;
padding-right: 30px 30px padding-right: 30px;
} }
.panel > .table-responsive:first-child > .table:first-child, .panel > .table:first-child { .panel > .table-responsive:first-child > .table:first-child, .panel > .table:first-child {
@ -1149,7 +1149,7 @@ html, body {
/*在帮脑残修复一下*/ /*在帮脑残修复一下*/
table .form-inline .form-group { table .form-inline .form-group {
margin-right: 0px; margin-right: 0;
} }
@media (min-width: 480px) { @media (min-width: 480px) {
@ -1180,7 +1180,7 @@ table .form-inline .form-group {
.launch_affix_save { .launch_affix_save {
position: fixed; position: fixed;
bottom: 0px; bottom: 0;
z-index: 999999; z-index: 999999;
height: 60px; height: 60px;
margin-left: -15px; margin-left: -15px;
@ -1212,14 +1212,14 @@ table .form-inline .form-group {
} }
.page-profile .card-footer { .page-profile .card-footer {
padding: 0px; padding: 0;
border-radius: .215rem; border-radius: .215rem;
background-color: #f6f9fd; background-color: #f6f9fd;
border-top: none; border-top: none;
} }
.page-profile .card-footer > div > div { .page-profile .card-footer > div > div {
padding: 10px 0px; padding: 10px 0;
} }
.page-profile .profile-stat-count { .page-profile .profile-stat-count {
@ -1263,7 +1263,7 @@ li.village-list-item > button.close {
outline: none; outline: none;
} }
.filterList, .villageList{ .filterList, .villageList {
overflow-y: auto; overflow-y: auto;
} }
@ -1298,4 +1298,25 @@ li.village-list-item > p {
.btn-group-toggle-menu a, .btn-group-toggle-menu button { .btn-group-toggle-menu a, .btn-group-toggle-menu button {
display: inherit; display: inherit;
border-radius: 0; border-radius: 0;
}
.tag-purple.tag-outline {
color: #926dde;
border-color: #926dde;
background-color: transparent;
}
.city-js .input-group > .form-control {
width: auto;
}
.maskbj {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
background: rgba(206, 206, 206, 0.7);
z-index: 9;
display: none;
} }

View File

@ -5,7 +5,7 @@ $met_title = $data['app']['appname'];
?> ?>
<include file='sys_admin/head_v2'/> <include file='sys_admin/head_v2'/>
<link href="{$_M['url']['own_tem']}css/appcheck.min.css" rel='stylesheet' type='text/css'> <link href="{$_M['url']['own_tem']}css/appcheck.min.css" rel='stylesheet' type='text/css'>
<div class="appcheck" data-ckitem="{$data.ckitem}"> <div class="appcheck" data-ckitem="{$data.ckitem}" >
<div class="row"> <div class="row">
<div class="col-xs-12 col-md-4 offset-md-4"> <div class="col-xs-12 col-md-4 offset-md-4">
@ -14,8 +14,7 @@ $met_title = $data['app']['appname'];
<div class="topimg"> <div class="topimg">
<div class="topimg-image"> <div class="topimg-image">
<div class="avatar"> <div class="avatar">
<img class="img-circle img-bordered img-bordered-info" src="{$data.app.icon}" <img class="img-circle img-bordered img-bordered-info" src="{$data.app.icon}" alt="image">
alt="image">
</div> </div>
</div> </div>
<div class="topimg-body p-10 p-l-5"> <div class="topimg-body p-10 p-l-5">
@ -30,12 +29,11 @@ $met_title = $data['app']['appname'];
应用进行逐项检测,状态:<i class="icon fa-times-circle"></i> 时会暂停检测,待处理问题后再继续执行检测。 应用进行逐项检测,状态:<i class="icon fa-times-circle"></i> 时会暂停检测,待处理问题后再继续执行检测。
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- Modal --> <!-- Modal -->
<div class="modal fade" id="appmodal" aria-hidden="true" data-keyboard="false" data-backdrop="false" role="dialog" <div class="modal fade" id="appmodal" aria-hidden="true" data-keyboard="false" data-backdrop="false" role="dialog" tabindex="-1">
tabindex="-1">
<div class="modal-dialog modal-center"> <div class="modal-dialog modal-center">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">

View File

@ -36,7 +36,7 @@
*/ */
$(function () { $(function () {
var myDate = new Date().getTime() var myDate = new Date().getTime()
$.include(M.url.own_tem + 'js/appcheck.min.js?' + myDate); $.include(M.url.own_tem + 'js/appcheck.min.js?'+myDate);
$.ajax({ $.ajax({
type : "GET", type : "GET",
@ -61,12 +61,12 @@ $(function () {
}) })
// 表格数据加载状态 // 表格数据加载状态
$('#tableslist').on('processing.dt', function (e, settings, processing) { $('#tableslist').on('processing.dt', function (e, settings, processing) {
if (processing) { if(processing) {
$self.tableProcessing(this) $self.tableProcessing(this)
} }
}) })
$('#tables-list').on('processing.dt', function (e, settings, processing) { $('#tables-list').on('processing.dt', function (e, settings, processing) {
if (processing) { if(processing) {
$self.tableProcessing(this) $self.tableProcessing(this)
} }
}) })
@ -120,7 +120,7 @@ $(function () {
}; };
appfun.prototype = { appfun.prototype = {
isEmpty : function (val) { isEmpty : function (val) {
switch (typeof val) { switch (typeof val) {
case 'undefined': case 'undefined':
return true; return true;
@ -146,7 +146,7 @@ $(function () {
} }
return false; return false;
}, },
select2 : function (drawdt) { select2 : function (drawdt) {
// drawdt true 执行默认操作 false 不执行 // drawdt true 执行默认操作 false 不执行
var $self = this, var $self = this,
select = []; select = [];
@ -211,7 +211,7 @@ $(function () {
}); });
}); });
}, },
datepicker : function () { datepicker: function () {
var $self = this; var $self = this;
M['plugin']['datetimepicker'] = [ M['plugin']['datetimepicker'] = [
M['url']['epl'] + 'time/jquery.datetimepicker.css', M['url']['epl'] + 'time/jquery.datetimepicker.css',
@ -250,7 +250,7 @@ $(function () {
}); });
}) })
}, },
alonetime : function () { alonetime : function () {
var $self = this; var $self = this;
M['plugin']['datetimepicker'] = [ M['plugin']['datetimepicker'] = [
M['url']['epl'] + 'time/jquery.datetimepicker.css', M['url']['epl'] + 'time/jquery.datetimepicker.css',
@ -268,7 +268,7 @@ $(function () {
}); });
}); });
}, },
tableaajx : function (timedom) { tableaajx : function (timedom) {
if (typeof datatable != 'undefined') { if (typeof datatable != 'undefined') {
var $this_datatable = timedom.parents('.dataTable'), var $this_datatable = timedom.parents('.dataTable'),
datatable_index = $this_datatable.index('.dataTable'); datatable_index = $this_datatable.index('.dataTable');
@ -276,7 +276,7 @@ $(function () {
datatable[datatable_index].ajax.reload(); datatable[datatable_index].ajax.reload();
} }
}, },
orders : function () { orders : function () {
var $self = this; var $self = this;
$(document).on('click', 'a.orderby-link', function (event) { $(document).on('click', 'a.orderby-link', function (event) {
var $this = $(this), var $this = $(this),
@ -303,7 +303,7 @@ $(function () {
dom.next().val(type); dom.next().val(type);
$self.tableaajx(dom); $self.tableaajx(dom);
}, },
ownsubmit : function ($form, typestr) { ownsubmit : function ($form, typestr) {
// 插入submit_type字段 // 插入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); $form.find('[name="submit_type"]').val(typestr);
@ -319,11 +319,11 @@ $(function () {
$form.find('[name="all_id"]').val(all_id); $form.find('[name="all_id"]').val(all_id);
} }
}, },
tableProcessing: function (_this_) { tableProcessing:function (_this_){
// 表格数据加载状态 // 表格数据加载状态
var tbody = $(_this_).find('tbody') var tbody = $(_this_).find('tbody')
var colspan = tbody.data('colspan') var colspan = tbody.data('colspan')
var html = `<tr> var html= `<tr>
<td colspan="${colspan}"> <td colspan="${colspan}">
<div class="h-50 vertical-align text-xs-center"><div class="loader vertical-align-middle loader-default"></div></div> <div class="h-50 vertical-align text-xs-center"><div class="loader vertical-align-middle loader-default"></div></div>
</td> </td>

View File

@ -282,7 +282,7 @@ class table_theme
} }
// 输入框搜索 // 输入框搜索
protected function input_select_search() protected function input_select_search($maxWidth = 260)
{ {
global $_M, $_YW; global $_M, $_YW;
$url = $this->select2['url'] ?: $_YW['url']['select']; $url = $this->select2['url'] ?: $_YW['url']['select'];
@ -290,7 +290,7 @@ class table_theme
return '<div class="form-group m-t-5"> return '<div class="form-group m-t-5">
<div class="input-group"> <div class="input-group">
<div class="input-group-addon">' . $title . '</div> <div class="input-group-addon">' . $title . '</div>
<select name="' . $name . '" style="max-width:260px;" data-table-search class="form-control" data-plugin="select2" <select name="' . $name . '" style="max-width:' . $maxWidth . 'px;" data-table-search class="form-control" data-plugin="select2"
data-select2-url="' . $url . '" data-select2-url="' . $url . '"
data-tname="' . $this->select2['tname'] . '" data-tname="' . $this->select2['tname'] . '"
data-fiend="' . $this->select2['fiend'] . '" data-fiend="' . $this->select2['fiend'] . '"
@ -305,7 +305,7 @@ class table_theme
} }
// 输入框搜索 // 输入框搜索
protected function input_select_search_multiple() protected function input_select_search_multiple($maxWidth = 260)
{ {
global $_M, $_YW; global $_M, $_YW;
$url = $this->select2['url'] ?: $_YW['url']['select']; $url = $this->select2['url'] ?: $_YW['url']['select'];
@ -314,7 +314,7 @@ class table_theme
return '<div class="form-group m-t-5"> return '<div class="form-group m-t-5">
<div class="input-group"> <div class="input-group">
<div class="input-group-addon">' . $title . '</div> <div class="input-group-addon">' . $title . '</div>
<select name="' . $name . '" multiple style="max-width:260px;" data-table-search class="form-control" data-plugin="select2" <select name="' . $name . '" multiple style="max-width:' . $maxWidth . 'px;" data-table-search class="form-control" data-plugin="select2"
data-select2-url="' . $url . '" data-select2-url="' . $url . '"
data-tname="' . $this->select2['tname'] . '" data-tname="' . $this->select2['tname'] . '"
data-fiend="' . $this->select2['fiend'] . '" data-fiend="' . $this->select2['fiend'] . '"
@ -437,7 +437,7 @@ class table_theme
} }
// 地图选择 // 地图选择
protected function th_toolmap($title) protected function th_toolmap($title, $html = '<h4>选择小区</h4>')
{ {
global $_M, $_YW; global $_M, $_YW;
return '<div class="form-group m-t-5"> return '<div class="form-group m-t-5">
@ -459,7 +459,7 @@ class table_theme
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span> <span aria-hidden="true">×</span>
</button> </button>
<h4 class="modal-title">选择小区</h4> <div class="modal-title font-size-14">' . $html . '</div>
</div> </div>
<div class="modal-body p-t-0 p-l-15"> <div class="modal-body p-t-0 p-l-15">
<div class="row"> <div class="row">
@ -521,6 +521,63 @@ class table_theme
<!-- End Modal -->'; <!-- End Modal -->';
} }
// 公用城市选择
private $selctCityConfig = [
// 1 为通用 0为模态框样式
'type' => 1,
// true 开启值的变化触发table筛选false则不触发
'tableSearch' => true,
'class' => 'city-js'
];
/**
* @param false[] $display 是否显示
* @param string[] $name name值
* @param array $defaults 默认值
* @return string
*/
protected function th_select_city($display = [false, false], $name = ['v_province', 'v_city', 'v_district'], $defaults = [])
{
global $_M, $_YW;
$cityUrl = load::own_class('cloud', 'new')->city_url();
$title = '选择区域';
$select = function ($mr = 5) use ($_YW, $defaults, $display, $name) {
list($provName, $cityName, $distName) = is_array($name) ? $name : [$name];
list($prov, $city, $dist) = is_array($defaults) ? $defaults : [$defaults];
list($provhd, $cityhd) = is_array($display) ? $display : [$display];
$provhd = $provhd ? '' : 'hidden-xs-up';
$cityhd = $cityhd ? '' : 'hidden-xs-up';
$tableSearch = $this->selctCityConfig['tableSearch'] ? 'data-table-search' : '';
$class = $mr > 0 ? 'm-r-' . $mr : '';
return '<select name="' . $provName . '" class="form-control ' . $class . ' prov ' . $provhd . '"
data-checked="' . ($prov ?: $_YW['c']['mapprov']) . '" ' . $tableSearch . '>
</select>
<select name="' . $cityName . '" class="form-control ' . $class . ' city ' . $cityhd . '"
data-checked="' . ($city ?: $_YW['c']['mapcity']) . '" ' . $tableSearch . '>
</select>
<select name="' . $distName . '" class="form-control ' . $class . ' dist"
data-checked="' . ($dist ?: $_YW['c']['mapdist']) . '" ' . $tableSearch . '>
</select>';
};
$htmla = '<div class="form-group m-t-5 ' . $this->selctCityConfig['class'] . '">
<div class="input-group" data-plugin="select-linkage" data-select-url="' . $cityUrl . '">
<div class="input-group-addon">' . $title . '</div>
' . $select(0) . '
</div>
</div>';
$htmlb = '<div class="' . $this->selctCityConfig['class'] . '">
<div class="form-group" data-plugin="select-linkage" data-select-url="' . $cityUrl . '">
<label class="form-control-label font-weight-600"><h4>选择区域</h4></label>
' . $select(5) . '
</div>
</div>';
return $this->selctCityConfig['type'] ? $htmla : $htmlb;
}
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 各表处理 // | 各表处理
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
@ -832,7 +889,18 @@ class table_theme
//搜索 //搜索
if ($this->search_bool) { if ($this->search_bool) {
$this->search['left'][] = self::th_toolmap('地图筛选'); $html = '';
// 地图区域
$this->selctCityConfig['type'] = 1;
$this->selctCityConfig['class'] = 'city-js';
$html .= self::th_select_city();
$this->search['left'][] = self::th_toolmap('地图筛选',$html);
// 区域
$this->selctCityConfig['class'] = 'search-city-js';
$this->search['left'][] = self::th_select_city();
$para = [['正常-按照广告位置排序', 0], ['推荐-将适合投放的提前排序', 1], ['选中-将选择中广告位提前排序', 2]]; $para = [['正常-按照广告位置排序', 0], ['推荐-将适合投放的提前排序', 1], ['选中-将选择中广告位提前排序', 2]];
$this->search['left'][] = self::para_select($para, ['eaps_order', '广告位排序', $_M['form']['eaps_order']], true, false); $this->search['left'][] = self::para_select($para, ['eaps_order', '广告位排序', $_M['form']['eaps_order']], true, false);
$tsql = load::own_class('tsql', 'new'); $tsql = load::own_class('tsql', 'new');
@ -854,7 +922,7 @@ class table_theme
'allnone' => 0, 'allnone' => 0,
'condition' => 'p_type|||6' 'condition' => 'p_type|||6'
]; ];
$this->search['left'][] = self::input_select_search_multiple(); $this->search['left'][] = self::input_select_search_multiple(160);
//门口方位 //门口方位
$para = $tsql->table('para')->where(['p_type' => 3])->all(); $para = $tsql->table('para')->where(['p_type' => 3])->all();
$this->search['left'][] = self::para_select($para, ['e_bno', '门口方位']); $this->search['left'][] = self::para_select($para, ['e_bno', '门口方位']);
@ -868,7 +936,7 @@ class table_theme
'allnone' => 0, 'allnone' => 0,
'condition' => 'p_type|||0' 'condition' => 'p_type|||0'
]; ];
$this->search['left'][] = self::input_select_search_multiple(); $this->search['left'][] = self::input_select_search_multiple(160);
$this->search['left'][] = self::input_search('e_number', '输入广告位编号'); $this->search['left'][] = self::input_search('e_number', '输入广告位编号');
//状态 //状态
// $this->search[] = self::para_select([['禁用',0],['启用',1]],['e_enable','状态'],true); // $this->search[] = self::para_select([['禁用',0],['启用',1]],['e_enable','状态'],true);
@ -1025,8 +1093,17 @@ class table_theme
'condition' => 'p_type|||6' 'condition' => 'p_type|||6'
]; ];
$this->search[] = self::input_select_search_multiple(); $this->search[] = self::input_select_search_multiple();
// 区域
$this->selctCityConfig['class'] = 'search-city-js';
$this->search['left'][] = self::th_select_city();
$this->search[] = self::th_toolmap('地图筛选'); $html = '';
// 地图区域
$this->selctCityConfig['type'] = 1;
$this->selctCityConfig['class'] = 'city-js';
$html .= self::th_select_city();
$this->search[] = self::th_toolmap('地图筛选',$html);
} }
//底部按钮 //底部按钮

View File

@ -5,13 +5,13 @@ defined('IN_MET') or exit('No permission');
# 数据结构处理 # 数据结构处理
class tsql class tsql
{ {
private $sql = []; private $sql = [];
private $m_name = M_NAME; private $m_name = M_NAME;
private $special = []; private $special = [];
private $ufield = []; private $ufield = [];
private $query; private $query;
private $multi_table = false; //采用分组才会采用子查询计算总数 private $multi_table = false; //采用分组才会采用子查询计算总数
private $debugging = true;
public function __construct() public function __construct()
{ {
@ -19,10 +19,18 @@ class tsql
self::table_unset(); self::table_unset();
} }
# 禁止执行sql只用于SQL语句返回 FALSE 不执行sql语句true 执行sql
public function debugging($sign = false)
{
$this->debugging = $sign;
return $this;
}
# 清空 # 清空
public function table_unset() public function table_unset()
{ {
global $_M; global $_M;
$this->debugging = true;
unset($this->sql, $this->special, $this->ufield); unset($this->sql, $this->special, $this->ufield);
return $this; return $this;
} }
@ -41,7 +49,7 @@ class tsql
# $tname 包含缩写数据名和 缩写名 # $tname 包含缩写数据名和 缩写名
# $join 数据库连接方式 # $join 数据库连接方式
# $sign false 不添加应用文件名前缀 # $sign false 不添加应用文件名前缀
# #
public function tables($tname = [], $join = '', $sign = true) public function tables($tname = [], $join = '', $sign = true)
{ {
global $_M; global $_M;
@ -51,6 +59,15 @@ class tsql
return $this; return $this;
} }
# 多表联合查询专用,满足多语句联合
# $table 为需要联合的语句,必须为数组
public function tablejoin($table = [], $join = ''){
global $_M;
list($name, $ab) = $table;
$this->sql['table'] .= $name . " AS {$ab} {$join} ";
return $this;
}
# 需要特殊处理的值例如counts+1 等类似的 或者执行函数 # 需要特殊处理的值例如counts+1 等类似的 或者执行函数
# 传入的为特殊处理的值,并 非字段名 # 传入的为特殊处理的值,并 非字段名
public function special($_special) public function special($_special)
@ -93,10 +110,9 @@ class tsql
public function group($_group = '', $_having = '') public function group($_group = '', $_having = '')
{ {
global $_M; global $_M;
if (is_array($_group)) $_group = arrayto_string($_group, ','); if (is_array($_group)) $_group = arrayto_string($_group, ',');
if (!empty($_group)) $this->sql['group'] = " GROUP BY " . $_where; if (!empty($_group)) $this->sql['group'] = " GROUP BY " . $_group;
if ($_group) { if (!empty($_group) && !empty($_having)) {
$this->multi_table = true; $this->multi_table = true;
if (is_array($_having)) $_having = self::where_arr($_having); if (is_array($_having)) $_having = self::where_arr($_having);
if (!empty($_having)) $this->sql['group'] .= " HAVING " . $_having; if (!empty($_having)) $this->sql['group'] .= " HAVING " . $_having;
@ -130,7 +146,7 @@ class tsql
return $this; return $this;
} }
# 约束条件下的UPDATE # 约束条件下的UPDATE
public function unique($_unique = '') public function unique($_unique = '')
{ {
global $_M; global $_M;
@ -158,7 +174,7 @@ class tsql
if (!empty($_where) && empty($this->sql['where'])) self::where($_where); if (!empty($_where) && empty($this->sql['where'])) self::where($_where);
$this->query = "DELETE FROM {$this->sql['table']} {$this->sql['where']} "; $this->query = "DELETE FROM {$this->sql['table']} {$this->sql['where']} ";
unset($this->sql); unset($this->sql);
DB::query($this->query); if ($this->debugging) DB::query($this->query);
return $this; return $this;
} }
@ -169,7 +185,7 @@ class tsql
if (empty($this->sql['table']) || empty($this->sql['field'])) return false; if (empty($this->sql['table']) || empty($this->sql['field'])) return false;
$this->query = "UPDATE {$this->sql['table']} SET {$this->sql['field']} {$this->sql['where']} "; $this->query = "UPDATE {$this->sql['table']} SET {$this->sql['field']} {$this->sql['where']} ";
unset($this->sql); unset($this->sql);
DB::query($this->query); if ($this->debugging) DB::query($this->query);
return $this; return $this;
} }
@ -181,13 +197,13 @@ class tsql
if (empty($this->sql['table']) || empty($this->sql['field'])) return false; if (empty($this->sql['table']) || empty($this->sql['field'])) return false;
$this->query = "INSERT INTO {$this->sql['table']} SET {$this->sql['field']} "; $this->query = "INSERT INTO {$this->sql['table']} SET {$this->sql['field']} ";
unset($this->sql); unset($this->sql);
DB::query($this->query); if ($this->debugging) DB::query($this->query);
return $this; return $this;
} }
# 约束字段新增更新unique 值不存在即可实现多条信息插入 # 约束字段新增更新unique 值不存在即可实现多条信息插入
# field 字段需要查询类型的 qfield() # field 字段需要查询类型的 qfield()
# $data 一维二维都可以key = field # $data 一维二维都可以key = field
# $sign false 并且也没有单独调用unique()是多条信息插入, true 为是约束更新插入 # $sign false 并且也没有单独调用unique()是多条信息插入, true 为是约束更新插入
public function adup($data = [], $sign = true) public function adup($data = [], $sign = true)
{ {
@ -213,7 +229,7 @@ class tsql
} }
$this->query = "INSERT INTO {$this->sql['table']} ({$this->sql['field']}) VALUES {$this->sql['values']} {$this->sql['unique']} "; $this->query = "INSERT INTO {$this->sql['table']} ({$this->sql['field']}) VALUES {$this->sql['values']} {$this->sql['unique']} ";
unset($this->sql); unset($this->sql);
DB::query($this->query); if ($this->debugging) DB::query($this->query);
return $this; return $this;
} }
@ -225,7 +241,7 @@ class tsql
if (empty($this->sql['field'])) $this->sql['field'] = '*'; if (empty($this->sql['field'])) $this->sql['field'] = '*';
$this->query = "SELECT {$this->sql['field']} FROM {$this->sql['table']} {$this->sql['where']} {$this->sql['group']} {$this->sql['order']} {$this->sql['limit']} "; $this->query = "SELECT {$this->sql['field']} FROM {$this->sql['table']} {$this->sql['where']} {$this->sql['group']} {$this->sql['order']} {$this->sql['limit']} ";
unset($this->sql); unset($this->sql);
return DB::get_one($this->query); return $this->debugging ? DB::get_one($this->query) : $this;
} }
# 查询更多条数 # 查询更多条数
@ -236,6 +252,7 @@ class tsql
if (empty($this->sql['field'])) $this->sql['field'] = '*'; if (empty($this->sql['field'])) $this->sql['field'] = '*';
$this->query = "SELECT {$this->sql['field']} FROM {$this->sql['table']} {$this->sql['where']} {$this->sql['group']} {$this->sql['order']} {$this->sql['limit']} "; $this->query = "SELECT {$this->sql['field']} FROM {$this->sql['table']} {$this->sql['where']} {$this->sql['group']} {$this->sql['order']} {$this->sql['limit']} ";
unset($this->sql); unset($this->sql);
if ($this->debugging === false) return $this;
$res = []; $res = [];
$result = DB::query($this->query); $result = DB::query($this->query);
while ($val = DB::fetch_array($result)) { while ($val = DB::fetch_array($result)) {
@ -251,6 +268,7 @@ class tsql
if (empty($this->sql['table'])) return false; if (empty($this->sql['table'])) return false;
$this->query = "SHOW FULL COLUMNS FROM .{$this->sql['table']}"; $this->query = "SHOW FULL COLUMNS FROM .{$this->sql['table']}";
unset($this->sql); unset($this->sql);
if ($this->debugging === false) return $this;
$res = []; $res = [];
$rescolumns = DB::query($this->query); $rescolumns = DB::query($this->query);
while ($row = DB::fetch_array($rescolumns)) { while ($row = DB::fetch_array($rescolumns)) {
@ -270,6 +288,7 @@ class tsql
$this->query = " SELECT {$this->sql['field']} FROM {$this->sql['table']} {$this->sql['where']} "; $this->query = " SELECT {$this->sql['field']} FROM {$this->sql['table']} {$this->sql['where']} ";
if ($this->multi_table) $this->query = " SELECT count(*) FROM ($this->query) num "; if ($this->multi_table) $this->query = " SELECT count(*) FROM ($this->query) num ";
if ($this->debugging === false) return $this;
$result = DB::query($this->query); $result = DB::query($this->query);
$fetch_row = DB::fetch_row($result); $fetch_row = DB::fetch_row($result);
return $fetch_row[0]; return $fetch_row[0];

File diff suppressed because one or more lines are too long

View File

@ -47,6 +47,26 @@ trait tdata
$idArr = $vidArr; $idArr = $vidArr;
} }
} }
$funWhere = function ($idArr, &$where) {
if (count($idArr) > 0) {
$strId = arrayto_string($idArr, ',');
$where .= " AND id IN({$strId}) ";
}
};
//区域
$v_province = $this->form['v_province'] && $this->form['v_province'] != '请选择' ? $this->form['v_province'] : '';
$v_city = $this->form['v_city'] && $this->form['v_city'] != '请选择' ? $this->form['v_city'] : '';
$v_district = $this->form['v_district'] && $this->form['v_district'] != '请选择' ? $this->form['v_district'] : '';
if ($v_district && $v_province && $v_city) {
$where = " v_province = '{$this->form['v_province']}' AND v_city = '{$this->form['v_city']}' AND v_district = '{$v_district}' ";
$funWhere($idArr, $where);
$vid = $this->tsql->table('village')->qfield('id')->where($where)->all();
$idArr = array_column($vid, 'id');
if (count($idArr) == 0) $idArr = [-1];
}
return $idArr; return $idArr;
} }

View File

@ -525,9 +525,24 @@ namespace APPMAP {
constructor() { constructor() {
super(); super();
// 在地图弹窗内进行小区条件筛选
$(document).on('change', 'select[name="vtype"]', () => {
this.filter()
})
this.watch(this, 'selectProv', () => {
this.filter()
})
this.watch(this, 'selectCity', () => {
this.filter()
})
this.watch(this, 'selectDist', () => {
this.filter()
})
//模态框 //模态框
$('#selectMapId').on('shown.bs.modal', () => { $('#selectMapId').on('shown.bs.modal', () => {
if(this.selectMapInitType) return false if (this.selectMapInitType) return false
// 设置地图高度,达到满屏效果 // 设置地图高度,达到满屏效果
this.setHeight() this.setHeight()
// 延迟效果可以让模态框加载时看起来没有卡的感觉 // 延迟效果可以让模态框加载时看起来没有卡的感觉
@ -886,6 +901,26 @@ namespace APPMAP {
inputVid.trigger('change') inputVid.trigger('change')
} }
// 根据条件筛选小区
filter() {
// 获取指定的值
let vtype = $('select[name="vtype"]').val()
vtype = vtype ? vtype.join(',') : ''
// 需要将缓存全部删除掉
$('#selectMapId .mapreset').trigger('click')
//清除标注
this.selectMap.clearOverlays()
// 提交后端
this.ajaxlnglatList(this.selectMap, {
id: '',
province: this.selectProv,
city: this.selectCity,
district: this.selectDist,
vtype: vtype,
allinfo: 'all'
}, true)
}
} }
// @ts-ignore // @ts-ignore
@ -900,7 +935,6 @@ namespace APPMAP {
new showMap() new showMap()
} else if ($('#selectMap').length) { } else if ($('#selectMap').length) {
// 地图选择形式 // 地图选择形式
console.log('-------------')
// $('button[data-target="#selectMapId"]').on('click', () => {}) // $('button[data-target="#selectMapId"]').on('click', () => {})
// 目前的形式地图只初始化一次,模态框关闭不影响二次打开继续之前的操作 // 目前的形式地图只初始化一次,模态框关闭不影响二次打开继续之前的操作
new selectMap() new selectMap()