From beefcf575fe16c320506642cda8bd341f815154b Mon Sep 17 00:00:00 2001 From: cloud Date: Sun, 26 Jun 2022 15:19:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=95=86=E5=9C=88=E3=80=81?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=B0=E5=9B=BE=E6=B2=A1=E6=9C=89=E6=89=93?= =?UTF-8?q?=E5=BC=80=E8=BF=87=EF=BC=88=E5=88=9D=E5=A7=8B=E5=8C=96=EF=BC=89?= =?UTF-8?q?=E4=B9=8B=E5=89=8D=EF=BC=8C=E8=BF=9B=E8=A1=8C=E4=BA=86=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E6=90=9C=E7=B4=A2=EF=BC=8C=E5=86=8D=E6=89=93=E5=BC=80?= =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E6=97=B6=E4=B8=8D=E8=83=BD=E5=87=86=E7=A1=AE?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E8=A1=A8=E6=A0=BC=E5=86=85=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E3=80=81=E8=AE=A2=E5=8D=95=E5=AF=BC=E5=87=BA=E6=97=B6?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B0=8F=E5=8C=BA=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/ajax.class.php | 6 ++++ admin/info_off.class.php | 1 + admin/select.class.php | 41 +++++++++++++++--------- admin/templates/js/bmaps.js | 33 ++++++++++--------- admin/templates/village.php | 15 +++++++++ include/class/appadmin.class.php | 12 +++++-- include/class/table_theme.class.php | 40 ++++++++++++++++++++--- include/traits/tdata.class.php | 43 ++++++++++++++++++------- include/traits/tfield.class.php | 6 +++- include/traits/tlist.class.php | 44 +++++++++++++++++++++----- src/admin/templates/js/bmaps.ts | 49 ++++++++++++++++++++--------- src/admin/templates/js/own.js | 36 +++++++++++---------- 12 files changed, 237 insertions(+), 89 deletions(-) diff --git a/admin/ajax.class.php b/admin/ajax.class.php index fbfd636..8f1833f 100644 --- a/admin/ajax.class.php +++ b/admin/ajax.class.php @@ -40,6 +40,12 @@ class ajax extends appadmin if (!empty($_M['form']['district'])) $where .= " AND v_district= '{$_M['form']['district']}'"; // 其他条件 + if (!empty($_M['form']['vhcname']) || $_M['form']['vhcname'] === '0' || $_M['form']['vhcname'] === 0) { + $vhcname = stringto_array($_M['form']['vhcname'], ','); + // 社区类型,分类 + $where .= " AND " . $this->tsql->where_arr(['v_hcname' => $vhcname]); + } + if (!empty($_M['form']['vtype']) || $_M['form']['vtype'] === '0' || $_M['form']['vtype'] === 0) { $vtype = stringto_array($_M['form']['vtype'], ','); // 社区类型,分类 diff --git a/admin/info_off.class.php b/admin/info_off.class.php index 4e817ee..cc0617a 100644 --- a/admin/info_off.class.php +++ b/admin/info_off.class.php @@ -62,6 +62,7 @@ class info_off extends appadmin $field = [ 'v_name' => $this->form['v_name'], 'v_type' => $this->form['v_type'], + 'v_hcname' => $this->form['v_hcname'], 'v_province' => $this->form['v_province'], 'v_city' => $this->form['v_city'], 'v_district' => $this->form['v_district'], diff --git a/admin/select.class.php b/admin/select.class.php index a075ee3..00a6b7d 100644 --- a/admin/select.class.php +++ b/admin/select.class.php @@ -5,7 +5,7 @@ defined('IN_MET') or exit('No permission'); load::own_class('appadmin'); load::own_func('appcmp'); -/* +/** * 配置 * 包含其他功能初始化 */ @@ -13,17 +13,17 @@ load::own_func('appcmp'); class select extends appadmin { - /* - * @$querys string 搜索内容 - * @$tname string 指定的查询表 - * @$fiend string 作为返回ID的值 - * @$source string 查询来源页面,用于区分用哪个页面来查询的好做一些特殊处理 - * @$allnone string 是否显示默认值全部,或者当没有搜索结果时将搜索内容当作值返回 - * @$condition string 页面查询限制条件,采用$$$作为多条件分割,|||作为字段名和值的分割 - * @$default string 默认值 - * @$division string 默认值分隔符 - * - * @$where string sql判断语句 + /** + * @param string $querys 搜索内容 + * @param string $tname 指定的查询表 + * @param string $fiend 作为返回ID的值 + * @param string $source 查询来源页面,用于区分用哪个页面来查询的好做一些特殊处理 + * @param string $allnone 是否显示默认值全部,或者当没有搜索结果时将搜索内容当作值返回 + * @param string $condition 页面查询限制条件,采用$$$作为多条件分割,|||作为字段名和值的分割 + * @param string $default 默认值 + * @param string $division 默认值分隔符 + * + * @param string $where sql判断语句 */ //搜索内容 @@ -124,7 +124,11 @@ class select extends appadmin if (strlen($this->querys) == 0) return false; switch ($this->tname) { case 'village': - $this->where = " v_name LIKE '%{$this->querys}%' "; + if ($this->fiend === 'v_hcname') { + $this->where = " v_hcname LIKE '%{$this->querys}%' "; + } else { + $this->where = " v_name LIKE '%{$this->querys}%' "; + } break; case 'customer': $this->where = " c_allname LIKE '%{$this->querys}%' "; @@ -174,7 +178,11 @@ class select extends appadmin global $_M, $_YW; switch ($this->tname) { case 'village': - $fiend = [$val['v_name'], $val['v_province'] . $val['v_city'] . $val['v_district'] . $val['v_address']]; + if ($this->fiend === 'v_hcname') { + $fiend = [$val['v_hcname']]; + } else { + $fiend = [$val['v_name'], $val['v_province'] . $val['v_city'] . $val['v_district'] . $val['v_address']]; + } break; case 'customer': $fiend = [$val['c_name'], $val['c_allname'], $val['c_province'] . $val['c_city'] . $val['c_district'] . $val['c_address']]; @@ -210,7 +218,7 @@ class select extends appadmin global $_M, $_YW; switch ($this->tname) { case 'village': - $fiend = 'v_name'; + $fiend = $this->fiend === 'v_hcname' ? 'v_hcname' : 'v_name'; break; case 'customer': $fiend = 'c_name'; @@ -256,6 +264,9 @@ class select extends appadmin if ($this->tname == 'weuser') { $val['nickname'] = urldecode($val['nickname']); } + // 当搜索的字段 值不存在时 跳过后续处理 + if (!$val[ $fiend ] && $val[ $fiend ] == 0) continue; + // 将信息按照字母分组 $letter = getstrcharter($val[ $fiend ]); $selectlist[ $letter ][] = $val; } diff --git a/admin/templates/js/bmaps.js b/admin/templates/js/bmaps.js index b270c40..addbd43 100644 --- a/admin/templates/js/bmaps.js +++ b/admin/templates/js/bmaps.js @@ -7,6 +7,8 @@ var __extends = (this && this.__extends) || (function () { return extendStatics(d, b); }; return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); @@ -257,7 +259,7 @@ var APPMAP; enableAutoPan: true, title: value.v_name }; - var content = "

" + value.v_province + value.v_city + value.v_district + value.v_address + "

"; + var content = "

".concat(value.v_province).concat(value.v_city).concat(value.v_district).concat(value.v_address, "

"); return function (e) { var p = e.target; var point = _this.lnglatToPoints(p.getPosition().lng, p.getPosition().lat); @@ -285,7 +287,7 @@ var APPMAP; this.addMapOverlay(this.showMap, this.inputLng, this.inputLat, true); }; showMap.prototype.getMapType = function () { - return this.mapType = $('#showmap').data('type') === 'showmap' ? false : true; + return this.mapType = $('#showmap').data('type') !== 'showmap'; }; showMap.prototype.watchCity = function () { var _this = this; @@ -502,7 +504,7 @@ var APPMAP; }; _this.villageFilterList = {}; _this.villageList = {}; - $(document).on('change', 'select[name="vtype"]', function () { + $(document).on('change', 'select[name="vtype"], select[name="vhcname"]', function () { _this.filter(); }); _this.watch(_this, 'selectProv', function () { @@ -518,13 +520,6 @@ var APPMAP; setTimeout(function () { document.body.scrollTop = document.documentElement.scrollTop = 0; _this.selectInitMap(); - _this.ajaxlnglatList(_this.selectMap, { - id: '', - province: _this.selectProv, - city: _this.selectCity, - district: _this.selectDist, - allinfo: 'all' - }, true); _this.drawingManagerInit(); _this.drawingManager.addEventListener("overlaycomplete", function (e) { var overlay = e.overlay; @@ -572,6 +567,7 @@ var APPMAP; }); if (_this.selectMapInitType === false) _this.selectMapInitType = true; + _this.filter(); }, 100); }); $('#selectMapId .mapreset').on('click', function (e) { @@ -692,7 +688,7 @@ var APPMAP; }; selectMap.prototype.addHtmlShow = function (domclass) { var _this = this; - var dom = $("." + domclass).find('ul'); + var dom = $(".".concat(domclass)).find('ul'); var listNum = domclass === 'filterList' ? 0 : (Object.keys(this.villageList).length || 0); var initListNum = 0; $.each(this.villageFilterList, function (i, val) { @@ -712,7 +708,7 @@ var APPMAP; }; selectMap.prototype.htmlLi = function (key, val) { var address = val.v_city + val.v_district + val.v_address; - return "
  • \n
    " + val.v_name + "
    \n \n

    \u5730\u5740\uFF1A" + address + "

    \n
  • "; + return "
  • \n
    ").concat(val.v_name, "
    \n \n

    \u5730\u5740\uFF1A").concat(address, "

    \n
  • "); }; selectMap.prototype.mapresetClose = function () { var hashCode = this.overlaysCache.hashCode; @@ -772,10 +768,16 @@ var APPMAP; inputVid.trigger('change'); }; selectMap.prototype.filter = function () { - var vtype; + if (!this.selectMapInitType) + return false; + var vtype = '', vhcname = ''; + if ($('select[name="vhcname"]').length) { + var vhcnameArr = $('select[name="vhcname"]').val(); + vhcname = vhcnameArr ? vhcnameArr.join(',') : ''; + } if ($('select[name="vtype"]').length) { - vtype = $('select[name="vtype"]').val(); - vtype = vtype ? vtype.join(',') : ''; + var vtypeArr = $('select[name="vtype"]').val(); + vtype = vtypeArr ? vtypeArr.join(',') : ''; } $('#selectMapId .mapreset').trigger('click'); this.selectMap.clearOverlays(); @@ -785,6 +787,7 @@ var APPMAP; city: this.selectCity, district: this.selectDist, vtype: vtype, + vhcname: vhcname, allinfo: 'all' }, true); this.citySyncMap(this.selectMap, this.level()); diff --git a/admin/templates/village.php b/admin/templates/village.php index ef21e1d..61a082b 100644 --- a/admin/templates/village.php +++ b/admin/templates/village.php @@ -31,6 +31,21 @@ $met_title = $data['met_title']; {$data.para.v_type_radio} +
    +
    +
    + +
    +
    diff --git a/include/class/appadmin.class.php b/include/class/appadmin.class.php index cc96865..1b75b6f 100644 --- a/include/class/appadmin.class.php +++ b/include/class/appadmin.class.php @@ -293,7 +293,15 @@ class appadmin extends admin { global $_M, $_YW; $village = $this->tsql->table('village')->where(['id' => $id])->one(); - return $village[ $key ]; + if (is_array($key)) { + $arr = []; + foreach ($key as $val) { + $arr[ $val ] = $village[ $val ]; + } + return $arr; + } else { + return $village[ $key ]; + } } //公司名称 @@ -338,7 +346,7 @@ class appadmin extends admin public function str_color($state, $str, $weight = 'unset') { global $_M, $_YW; - $color = ['red-600', 'green-600', 'cyan-600', 'blue-600','orange-600','purple-600']; + $color = ['red-600', 'green-600', 'cyan-600', 'blue-600', 'orange-600', 'purple-600']; return '' . $str . ''; } diff --git a/include/class/table_theme.class.php b/include/class/table_theme.class.php index 1acb3c6..1c55937 100644 --- a/include/class/table_theme.class.php +++ b/include/class/table_theme.class.php @@ -310,7 +310,7 @@ class table_theme global $_M, $_YW; $url = $this->select2['url'] ?: $_YW['url']['select']; list($name, $title, $value) = self::fiend_data($this->select2['_fiend']); - $condition = $this->select2['condition'] ?: 'p_type|||0'; + $condition = array_key_exists('condition', $this->select2) ? $this->select2['condition'] : 'p_type|||0'; return '
    ' . $title . '
    @@ -643,6 +643,15 @@ class table_theme $this->search[] = self::input_search('v_text', '输入搜索内容'); $this->search[] = self::input_search('v_address', '输入地址'); $this->search[] = self::input_search('v_name', '输入场所名称'); + $this->select2 = [ + '_fiend' => ['v_hcname', '选择商圈', $_M['form']['v_hcname']], + 'placeholder' => '输入搜索商圈', + 'fiend' => 'v_hcname', + 'tname' => 'village', + 'source' => 'search', + 'allnone' => 2 + ]; + $this->search[] = self::input_select_search(); } //底部按钮 @@ -895,8 +904,8 @@ class table_theme $this->selctCityConfig['class'] = 'city-js'; $html .= self::th_select_city(); - $this->search['left'][] = self::th_toolmap('地图筛选',$html); - + $this->search['left'][] = self::th_toolmap('地图筛选', $html); + // 区域 $this->selctCityConfig['class'] = 'search-city-js'; $this->search['left'][] = self::th_select_city(); @@ -904,6 +913,16 @@ class table_theme $para = [['正常-按照广告位置排序', 0], ['推荐-将适合投放的提前排序', 1], ['选中-将选择中广告位提前排序', 2]]; $this->search['left'][] = self::para_select($para, ['eaps_order', '广告位排序', $_M['form']['eaps_order']], true, false); $tsql = load::own_class('tsql', 'new'); + $this->select2 = [ + '_fiend' => ['vhcname', '选择商圈'], + 'placeholder' => '可选择多个商圈', + 'fiend' => 'v_hcname', + 'tname' => 'village', + 'source' => 'search', + 'allnone' => 0, + 'condition' => '' + ]; + $this->search['left'][] = self::input_select_search_multiple(); $this->select2 = [ '_fiend' => ['e_vid', '选择场所', $_M['form']['e_vid']], 'placeholder' => '输入场所名称', @@ -1094,16 +1113,27 @@ class table_theme ]; $this->search[] = self::input_select_search_multiple(); + $this->select2 = [ + '_fiend' => ['vhcname', '选择商圈'], + 'placeholder' => '可选择多个商圈', + 'fiend' => 'v_hcname', + 'tname' => 'village', + 'source' => 'search', + 'allnone' => 0, + 'condition' => '' + ]; + $this->search[] = self::input_select_search_multiple(); + // 区域 $this->selctCityConfig['class'] = 'search-city-js'; - $this->search[] = self::th_select_city(); + $this->search[] = self::th_select_city(); $html = ''; // 地图区域 $this->selctCityConfig['type'] = 1; $this->selctCityConfig['class'] = 'city-js'; $html .= self::th_select_city(); - $this->search[] = self::th_toolmap('地图筛选',$html); + $this->search[] = self::th_toolmap('地图筛选', $html); } //底部按钮 diff --git a/include/traits/tdata.class.php b/include/traits/tdata.class.php index 93967f4..9014488 100644 --- a/include/traits/tdata.class.php +++ b/include/traits/tdata.class.php @@ -29,32 +29,50 @@ trait tdata { global $_M, $_YW; $idArr = $vidArr = []; + + $countvid = function ($idArr = [], $newvid = []) { + // if (count($newvid) == 0) $newvid = [-1]; + if (count($idArr) > 0) { + $idArr = array_intersect($newvid, $idArr); + // 如果交集为空,则确实通过此条件进行了筛选,就要通知SQL没有任何值满足当前条件,将ID设置为0,肯定查找不到 + // if (count($idArr) == 0) $idArr = [-1]; + } else { + $idArr = $newvid; + } + if (count($idArr) == 0) $idArr = [-1]; + return $idArr; + }; + + // 所属商圈 + if (array_key_exists('vhcname', $this->form) && is_array($this->form['vhcname'])) { + $arrvhcname = array_map(function ($para) { return "'{$para}'"; }, $this->form['vhcname']); + $vhcname = arrayto_string($arrvhcname, ','); + $vid = $this->tsql->table('village')->qfield('id')->where("v_hcname IN({$vhcname}) ")->all(); + $idArr = $countvid($idArr, array_column($vid, 'id')); + } + + // 场所类型 if (is_array($this->form['vtype'])) { $vtype = arrayto_string($this->form['vtype'], ','); $vid = $this->tsql->table('village')->qfield('id')->where("v_type IN({$vtype})")->all(); - $idArr = array_column($vid, 'id'); - if (count($idArr) == 0) $idArr = [-1]; + $idArr = $countvid($idArr, array_column($vid, 'id')); } + + // 地图选择 if ($this->form['v_id']) { $vidArr = stringto_array($this->form['v_id'], ','); // 取社区类型和地图筛选的交集,重叠ID,社区类型没有操作则直接按照地图筛选结果 // $idArr = count($idArr) > 0?array_intersect($vidArr,$idArr):$vidArr; - if (count($idArr) > 0) { - $idArr = array_intersect($vidArr, $idArr); - // 如果交集为空,则确实通过此条件进行了筛选,就要通知SQL没有任何值满足当前条件,将ID设置为0,肯定查找不到 - if (count($idArr) == 0) $idArr = [-1]; - } else { - $idArr = $vidArr; - } + $idArr = $countvid($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'] : ''; @@ -149,6 +167,7 @@ trait tdata // 社区类型 // 先查询出需要的ID + if (isset($this->form['jsadd_vhcname'])) $this->form['vhcname'] = stringto_array($this->form['jsadd_vhcname'], ','); if (isset($this->form['jsadd_vtype'])) $this->form['vtype'] = stringto_array($this->form['jsadd_vtype'], ','); $idArr = self::fun_sqlk_vid(); // 通过ID筛选掉不需要的 @@ -413,7 +432,7 @@ trait tdata $this->search_other = ['e_aps', 'e_bno', 'e_vid', 'e_enable']; $where .= self::td_search(); case 'village': - $this->search_input = ['v_name', 'v_text']; + $this->search_input = ['v_name', 'v_text', 'v_hcname']; $where .= self::td_search(); $this->search_link = ['v_province', 'v_city', 'v_district', 'v_address']; diff --git a/include/traits/tfield.class.php b/include/traits/tfield.class.php index 2da484f..0be5282 100644 --- a/include/traits/tfield.class.php +++ b/include/traits/tfield.class.php @@ -27,6 +27,7 @@ trait tfield return [ 'v_name' => '场所名称', 'v_type' => '场所分类', + 'v_hcname' => '所属商圈', 'v_totalstr' => '广告状态', 'v_address' => '场所地址', 'v_lxname' => '联系人', @@ -62,9 +63,11 @@ trait tfield // 导出专用 $barray = [ 'e_enable' => '状态', - 'e_number' => '广告位编号', + // 'e_number' => '广告位编号', 'e_size' => '广告位规格', 'e_vid' => '场所名称', + 'v_vaddress' => '场所地址', + 'v_hcname' => '所属商圈', 'e_bno' => '门口方位', 'e_aps' => '广告位位置', 'h_cid' => '签定的公司', @@ -217,6 +220,7 @@ trait tfield $array = [ 'v_name' => '场所名称', 'v_type' => '场所分类', + 'v_hcname' => '所属商圈', 'v_district' => '所属区域', 'v_address' => '场所地址', 'v_enum' => '广告位', diff --git a/include/traits/tlist.class.php b/include/traits/tlist.class.php index 3bc6f3e..3e12b8a 100644 --- a/include/traits/tlist.class.php +++ b/include/traits/tlist.class.php @@ -93,22 +93,43 @@ trait tlist { global $_M, $_YW; //门口方位 - if (empty(self::$para['e_bno'])) - self::$para['e_bno'] = parent::translate(3); + if (empty(self::$para['e_bno'])) self::$para['e_bno'] = parent::translate(3); //广告位置 - if (empty(self::$para['e_aps'])) - self::$para['e_aps'] = parent::translate(); + if (empty(self::$para['e_aps'])) self::$para['e_aps'] = parent::translate(); //场所 - if (empty(self::$village[ $val['e_vid'] ])) - self::$village[ $val['e_vid'] ] = parent::villagelist($val['e_vid']); + if (array_key_exists('v_hcname', $val) || array_key_exists('v_vaddress', $val)) { + //小区 + if (empty(self::$village[ $val['e_vid'] ])) self::$village[ $val['e_vid'] ] = parent::villagelist($val['e_vid'], ['v_name', 'v_hcname', 'v_district', 'v_city', 'v_province', 'v_address']); + } else { + //小区 + if (empty(self::$village[ $val['e_vid'] ])) self::$village[ $val['e_vid'] ] = parent::villagelist($val['e_vid']); + } if ($sign) { - $val['e_vid'] = self::$village[ $val['e_vid'] ]; + if (array_key_exists('v_hcname', $val) || array_key_exists('v_vaddress', $val)) { + $evid = $val['e_vid']; + $val['e_vid'] = self::$village[ $evid ]['v_name']; + $val['v_hcname'] = self::$village[ $evid ]['v_hcname']; + // $val['v_vaddress'] = self::$village[ $evid ]['v_province'] . self::$village[ $evid ]['v_city'] . self::$village[ $evid ]['v_district'] . self::$village[ $evid ]['v_address']; + $val['v_vaddress'] = self::$village[ $evid ]['v_district'] . self::$village[ $evid ]['v_address']; + } else { + $val['e_vid'] = self::$village[ $val['e_vid'] ]; + } $val['e_bno'] = self::$para['e_bno'][ $val['e_bno'] ]; $val['e_aps'] = self::$para['e_aps'][ $val['e_aps'] ]; } else { + if (array_key_exists('v_hcname', $val) || array_key_exists('v_vaddress', $val)) { + $evid = $val['e_vid']; + $v_hcname = self::$village[ $evid ]['v_hcname']; + $evidname = self::$village[ $evid ]['v_name']; + if ($v_hcname) $evidname .= "(" . $v_hcname . ")"; + // $val['v_vaddress'] = self::$village[ $evid ]['v_province'] . self::$village[ $evid ]['v_city'] . self::$village[ $evid ]['v_district'] . self::$village[ $evid ]['v_address']; + $val['v_vaddress'] = self::$village[ $evid ]['v_district'] . self::$village[ $evid ]['v_address']; + } else { + $evidname = self::$village[ $val['e_vid'] ]; + } $villages = [ - self::$village[ $val['e_vid'] ], + $evidname, self::$para['e_bno'][ $val['e_bno'] ], self::$para['e_aps'][ $val['e_aps'] ] ]; @@ -223,6 +244,9 @@ trait tlist $addtourl = $this->own_name_info . __FUNCTION__ . '&id=' . $val['id']; $this->btn[] = '编辑'; } + + //跳过标记突出处理 + $this->skip_field = ['v_hcname']; return self::assemble($key, $base, $val, $checked); } @@ -245,6 +269,8 @@ trait tlist $val['ltype'] = parent::state_color($s_type, ['已经结束', self::$para['ltype'][ $val['l_schedule'] ]]); $val['h_cid'] = self::$customer[ $val['h_cid'] ]; $val['e_enable'] = $val['e_enable'] == 0 || $this->bsign == false ? parent::state_color($val['e_enable'], ['禁用', '启用']) : ''; + // 显示商圈 + $val['v_hcname'] = $val['v_vaddress'] = ''; self::eaddress($val, 'l_address', $this->bsign); return self::assemble($key, $base, $val, $checked, false); } @@ -589,6 +615,8 @@ trait tlist $val['endtitle'] = $val['endtitle'] ? '' . $val['endtitle'] . '' : ''; $val['nowtitle'] = $val['nowtitle'] ? '' . $val['nowtitle'] . '' : ''; $val['nexttitle'] = $val['nexttitle'] ? '' . $val['nexttitle'] . '' : ''; + // 显示商圈 + $val['v_hcname'] = ''; self::eaddress($val, 'e_address'); $val['endtime'] = strtotime($val['endtime']) < $curtime ? '' . $val['endtime'] . '' : $val['endtime']; diff --git a/src/admin/templates/js/bmaps.ts b/src/admin/templates/js/bmaps.ts index 16b1ec9..c7399cf 100644 --- a/src/admin/templates/js/bmaps.ts +++ b/src/admin/templates/js/bmaps.ts @@ -411,7 +411,7 @@ namespace APPMAP { getMapType() { // true 则进行标记 // false 不进行地图标记 - return this.mapType = $('#showmap').data('type') === 'showmap' ? false : true; + return this.mapType = $('#showmap').data('type') !== 'showmap'; } watchCity() { @@ -710,13 +710,19 @@ namespace APPMAP { constructor() { super(); - // 在地图弹窗内进行小区条件筛选 - $(document).on('change', 'select[name="vtype"]', () => { + // 商圈触发 + // $(document).on('change', 'select[name="vhcname"]', () => { + // this.filter() + // }) + // 场所类型触发 + $(document).on('change', 'select[name="vtype"], select[name="vhcname"]', () => { this.filter() }) + this.watch(this, 'selectProv', () => { this.filter() }) + this.watch(this, 'allCity', () => { this.filter() }) @@ -731,16 +737,18 @@ namespace APPMAP { // 解决因页面产品滚动条导致的点击地图获取的经纬度不准确问题 // 让滚动条回滚到顶部 document.body.scrollTop = document.documentElement.scrollTop = 0 - // 初始化模态框 + // 初始化地图 this.selectInitMap() // ajax查找 当前地区点的标注并添加在地图上 - this.ajaxlnglatList(this.selectMap, { - id: '', - province: this.selectProv, - city: this.selectCity, - district: this.selectDist, - allinfo: 'all' - }, true) + // 问题一:地图没有打开过(初始化)之前,进行了表格搜索,再打开地图时不能准确同步表格内的数据 + // 旧的方案 + // this.ajaxlnglatList(this.selectMap, { + // id: '', + // province: this.selectProv, + // city: this.selectCity, + // district: this.selectDist, + // allinfo: 'all' + // }, true) // 初始化绘制工具 this.drawingManagerInit() // 绘制结束后的回调 @@ -802,6 +810,8 @@ namespace APPMAP { }); // 标记为已经初始化过 if (this.selectMapInitType === false) this.selectMapInitType = true + // 新的方案,解决问题一 + this.filter(); }, 100) }); @@ -1084,11 +1094,21 @@ namespace APPMAP { // 根据条件筛选小区 filter() { + // 若之前没有打开过地图则不执行 + if (!this.selectMapInitType) return false // 获取指定的值 - let vtype: any + let vtype: string = '', vhcname: string = '' + + // 商圈 + if ($('select[name="vhcname"]').length) { + let vhcnameArr = $('select[name="vhcname"]').val() + vhcname = vhcnameArr ? vhcnameArr.join(',') : '' + } + + // 类型 if ($('select[name="vtype"]').length) { - vtype = $('select[name="vtype"]').val() - vtype = vtype ? vtype.join(',') : '' + let vtypeArr = $('select[name="vtype"]').val() + vtype = vtypeArr ? vtypeArr.join(',') : '' } // 需要将缓存全部删除掉 @@ -1102,6 +1122,7 @@ namespace APPMAP { city: this.selectCity, district: this.selectDist, vtype: vtype, + vhcname: vhcname, allinfo: 'all' }, true) // 调整地图核心位置 diff --git a/src/admin/templates/js/own.js b/src/admin/templates/js/own.js index 15e1ae2..73ba28d 100644 --- a/src/admin/templates/js/own.js +++ b/src/admin/templates/js/own.js @@ -36,7 +36,7 @@ */ $(function () { 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({ type : "GET", @@ -61,12 +61,12 @@ $(function () { }) // 表格数据加载状态 $('#tableslist').on('processing.dt', function (e, settings, processing) { - if(processing) { + if (processing) { $self.tableProcessing(this) } }) $('#tables-list').on('processing.dt', function (e, settings, processing) { - if(processing) { + if (processing) { $self.tableProcessing(this) } }) @@ -79,12 +79,14 @@ $(function () { 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(), - vtype = $('select[name="vtype"]').val(); + var obj = my.parents("form").serialize(), + href = my.data('url'), + veaps = $('select[name="veaps"]').val(), + vhcname = $('select[name="vhcname"]').val(), + vtype = $('select[name="vtype"]').val(); // 单独给get传递增加veaps的值 if (!$self.isEmpty(veaps)) obj += '&jsadd_veaps=' + veaps.join(','); + if (!$self.isEmpty(vhcname)) obj += '&jsadd_vhcname=' + vhcname.join(','); if (!$self.isEmpty(vtype)) obj += '&jsadd_vtype=' + vtype.join(','); window.location.href = href + '&' + obj; }) @@ -221,9 +223,9 @@ $(function () { 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({ @@ -235,9 +237,9 @@ $(function () { } }); 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({ @@ -303,7 +305,7 @@ $(function () { 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(''); $form.find('[name="submit_type"]').val(typestr); @@ -319,11 +321,11 @@ $(function () { $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 html= ` + var html = `