815 lines
35 KiB
PHP
815 lines
35 KiB
PHP
<?php
|
||
|
||
/**
|
||
* @author Any
|
||
* @description KISS
|
||
* @date 2021年9月15日
|
||
* @version 1.0.0
|
||
*
|
||
* _____LOG_____
|
||
*
|
||
*/
|
||
use app\widgets\PickFile;
|
||
use app\components\EncryptHelper;
|
||
$this->title = $model->isNewRecord ? '创建门店' : '编辑门店';
|
||
$this->params['breadcrumbs'][] = ['label' => '门店列表' , 'url' => [\Yii::$app->urlManager->createUrl(["admin/store/index"])]];
|
||
$this->params['breadcrumbs'][] = $this->title;
|
||
?>
|
||
<style>
|
||
.layui-input-block {
|
||
margin-left: 160px;
|
||
}
|
||
.layui-form-label {
|
||
width: 120px;
|
||
}
|
||
.laydate-time-list{padding-bottom:0;overflow:hidden}
|
||
.laydate-time-list>li{width:50%!important;}
|
||
.laydate-time-list>li:last-child { display: none;}
|
||
|
||
#container {
|
||
width: 100%;
|
||
height: 80%;
|
||
top:40px;
|
||
}
|
||
|
||
#toolControl {
|
||
position: absolute;
|
||
top: 66px;
|
||
left: 0px;
|
||
right: 0px;
|
||
margin: auto;
|
||
width: 948px;
|
||
z-index: 1001;
|
||
}
|
||
|
||
.toolItem {
|
||
width: 30px;
|
||
height: 30px;
|
||
float: left;
|
||
margin: 1px;
|
||
padding: 4px;
|
||
border-radius: 3px;
|
||
background-size: 30px 30px;
|
||
background-position: 4px 4px;
|
||
background-repeat: no-repeat;
|
||
box-shadow: 0 1px 2px 0 #e4e7ef;
|
||
background-color: #ffffff;
|
||
border: 1px solid #ffffff;
|
||
}
|
||
|
||
.toolItem:hover {
|
||
border-color: #789cff;
|
||
}
|
||
|
||
.active {
|
||
border-color: #d5dff2;
|
||
background-color: #d5dff2;
|
||
}
|
||
|
||
#polygon {
|
||
background-image: url('/statics/images/huizhi.png');
|
||
}
|
||
|
||
#delete {
|
||
background-image: url('/statics/images/shanchu.png');
|
||
}
|
||
#select {
|
||
background-image: url('/statics/images/shanchu.png');
|
||
}
|
||
#enable {
|
||
background-image: url('/statics/images/qiyong.png');
|
||
}
|
||
#disable {
|
||
background-image: url('/statics/images/jinyong.png');
|
||
}
|
||
#setActionMode_draw {
|
||
background-image: url('/statics/images/chuangjian.png');
|
||
}
|
||
#setActionMode_interact {
|
||
background-image: url('/statics/images/bianji.png');
|
||
}
|
||
</style>
|
||
|
||
|
||
<div class="layui-fluid">
|
||
<div class="layui-card">
|
||
<div class="layui-card-header"><?= $this->title ?></div>
|
||
<div class="layui-card-body">
|
||
<div class="layui-row">
|
||
<div class="layui-col-md5">
|
||
<div class="layui-form">
|
||
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label required">门店名称</label>
|
||
<div class="layui-input-inline">
|
||
<input type="text" name="name" placeholder="请输入门店名称" autocomplete="off" class="layui-input" value="<?= $model->name ?>" lay-verify="required" style="width: 200%" onclick="check_action_mode()">
|
||
</div>
|
||
<div class="layui-form-mid layui-word-aux"></div>
|
||
</div>
|
||
|
||
<div class="layui-form-item layui-form" id="district" >
|
||
<label class="layui-form-label required">门店所在地区</label>
|
||
<div class="layui-input-inline" style="width:120px;" v-if="province.length != 0">
|
||
<select class="form-control province layui-select" lay-filter="province"
|
||
name="province_id" v-model="province_id" id="province_id" lay-ignore>
|
||
<option value="" >请选择</option>
|
||
<option v-for="(item,index) in province"
|
||
:value="item.id" :data-index="index">{{item.name}}
|
||
</option>
|
||
</select>
|
||
</div>
|
||
<div class="layui-input-inline" style="width:120px;" v-if="city.length != 0">
|
||
<select class="form-control city layui-select" name="city_id" lay-filter="city" v-model="city_id" id="city_id" lay-ignore>
|
||
<option value="" >请选择</option>
|
||
<option v-for="(item,index) in city"
|
||
:value="item.id" :data-index="index">{{item.name}}
|
||
</option>
|
||
</select>
|
||
</div>
|
||
<div class="layui-input-inline" style="width:120px;" v-if="region.length != 0">
|
||
<select class="form-control city layui-select" name="region_id" lay-filter="region" v-model="region_id" id="region_id" lay-ignore>
|
||
<option value="" >请选择</option>
|
||
<option v-for="(item,index) in region"
|
||
:value="item.id" :data-index="index">{{item.name}}
|
||
</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label required">门店具体位置</label>
|
||
<div class="layui-input-inline">
|
||
<input type="text" name="location_detail" placeholder="请输入门店具体位置" autocomplete="off" class="layui-input" value="<?= $model->location_detail ?>" style="width: 200%" onclick="check_action_mode()">
|
||
</div>
|
||
<div class="layui-form-mid layui-word-aux"></div>
|
||
</div>
|
||
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label required">客服电话</label>
|
||
<div class="layui-input-inline">
|
||
<input type="text" name="phone" placeholder="请输入客服电话" autocomplete="off" class="layui-input" value="<?= $model->phone ?>" lay-verify="required" onclick="check_action_mode()">
|
||
</div>
|
||
<div class="layui-form-mid layui-word-aux"></div>
|
||
</div>
|
||
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label required">营业开始时间</label>
|
||
<div class="layui-input-inline">
|
||
<input type="text" name="begin_time" class="layui-input" value="<?= $model->begin_time ?>" id="begin_time" autocomplete="off" placeholder="HH:mm" readonly="readonly">
|
||
</div>
|
||
</div>
|
||
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label required">营业结束时间</label>
|
||
<div class="layui-input-inline">
|
||
<input type="text" name="end_time" class="layui-input" value="<?= $model->end_time ?>" id="end_time" autocomplete="off" placeholder="HH:mm" readonly="readonly">
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<!-- <div class="layui-form-item">-->
|
||
<!-- <label class="layui-form-label">收益比例</label>-->
|
||
<!-- <div class="layui-input-inline">-->
|
||
<!-- <input type="number" name="ratio" placeholder="请输入收益比例" autocomplete="off" class="layui-input" value="--><?//= $model->ratio ?><!--" lay-verify="required" onclick="check_action_mode()">-->
|
||
<!-- </div>-->
|
||
<!-- <div class="layui-form-mid layui-word-aux">% <span style="color: red">所选区间:0~100</span></div>-->
|
||
<!-- </div>-->
|
||
|
||
<div class="layui-form-item input-static">
|
||
<label class="layui-form-label">门店状态</label>
|
||
<div class="layui-input-block">
|
||
<input type="radio" name="status" value="0" title="停业" <?= $model->status == null || $model->status == 0 ? 'checked' : ''?> lay-filter="static">
|
||
<input type="radio" name="status" value="1" title="营业" <?= $model->status == 1 ? 'checked' : ''?> lay-filter="static">
|
||
</div>
|
||
<div class="layui-form-mid layui-word-aux"></div>
|
||
</div>
|
||
|
||
<div class="layui-form-item">
|
||
<div class="layui-input-block">
|
||
<div class="" >
|
||
<button class="layui-btn" lay-submit="" lay-filter="layui-form-submit">保存</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- <div class="layui-col-md7">-->
|
||
<!-- <div class="layui-form-item layui-hide">-->
|
||
<!-- <label class="layui-form-label">输入城市和关键词搜索</label>-->
|
||
<!-- <div class="layui-input-block" >-->
|
||
<!-- <input type="text" style="width: 120px;float: left" id="mRegion" name="mRegion"-->
|
||
<!-- lay-verify="" placeholder="城市" autocomplete="off"-->
|
||
<!-- class="layui-input" onclick="check_action_mode()">-->
|
||
<!-- <input type="text" style="width: 120px;float: left" id="mKeywords" name="mKeywords"-->
|
||
<!-- lay-verify="" placeholder="关键词" autocomplete="off"-->
|
||
<!-- class="layui-input" onclick="check_action_mode()">-->
|
||
<!-- <button type="button" class="layui-btn" id="mSearch">搜索</button>-->
|
||
<!-- </div>-->
|
||
<!-- <div class="layui-form-mid layui-word-aux" style="margin-left: 110px;"></div>-->
|
||
<!-- </div>-->
|
||
<!-- <div class="layui-form-item" style="margin-top: 1%">-->
|
||
<!-- <body onload="initMap()">-->
|
||
<!-- <div id="container"></div>-->
|
||
<!-- <div id="toolControl" style="top: 0">-->
|
||
<!-- <div class="toolItem" id="enable" title="启用地图"></div>-->
|
||
<!-- <div class="toolItem" id="polygon" title="绘制"></div>-->
|
||
<!-- <div class="toolItem" id="delete" onclick="editor.delete();" title="删除"></div>-->
|
||
<!-- <div class="toolItem" id="select" title="重绘"></div>-->
|
||
<!-- <div class="toolItem" id="setActionMode_interact" title="交互模式"></div>-->
|
||
<!-- </div>-->
|
||
<!-- <div id="info">-->
|
||
<!-- 当前点击坐标为:<span id="position"></span>-->
|
||
<!-- </div>-->
|
||
<!-- </body>-->
|
||
<!-- </div>-->
|
||
|
||
<!-- <div class="layui-form-item">-->
|
||
<!-- <h4><b>地图上方按钮按顺序依次为:</b>【解锁】【绘制】【重绘】【交互模式】</h4>-->
|
||
<!-- <h4><b>绘制:</b>鼠标左键点击及移动即可绘制图形</h4>-->
|
||
<!-- <h4><b>结束:</b>鼠标左键双击即可结束绘制</h4>-->
|
||
<!-- <h4><b>中断:</b>绘制过程中按下esc键可中断该过程</h4>-->
|
||
<!-- <h4><b>注意:</b></h4>-->
|
||
<!-- <span>1.进入页面绘制时需将地图【解锁】,并点击【绘制】</span><br>-->
|
||
<!-- <span>2.点击【重绘】会将所有区域删除,然后点击【绘制】再次做画</span><br>-->
|
||
<!-- <span>3.操作文本框时地图将进入锁定模式,再次绘制区域需点击【解锁】【绘制】</span><br>-->
|
||
<!-- <span>4.【交互模式】进入交互模式则无法进行绘制,只能进行重画</span><br>-->
|
||
<!---->
|
||
<!-- </div>-->
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<script id="map_area_type_html" type="text/html">
|
||
<div class="layui-form">
|
||
<div class="layui-form-item">
|
||
<label class="layui-form-label ">区域类型</label>
|
||
<div class="layui-input-block">
|
||
<input type="radio" name="map_area_type" value="2" title="报警区域" checked="">
|
||
<input type="radio" name="map_area_type" value="1" title="门店区域" >
|
||
<input type="radio" name="map_area_type" value="3" title="停车区域">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</script>
|
||
|
||
|
||
<script charset="utf-8" src="https://map.qq.com/api/gljs?v=1.exp&key=<?=\Yii::$app->params['mapKey']['qqmap']?>"></script>
|
||
<script charset="utf-8" src="https://map.qq.com/api/js?v=2.exp&key=<?=\Yii::$app->params['mapKey']['qqmap']?>"></script>
|
||
<script charset="utf-8" src="https://map.qq.com/api/gljs?libraries=tools&v=1.exp&key=OB4BZ-D4W3U-B7VVO-4PJWW-6TKDJ-WPB77"></script>
|
||
<script type="text/javascript">
|
||
<?php $this->beginBlock('js_script_wrap') ?>
|
||
var _form = null;
|
||
var app = new Vue({
|
||
el: '#district',
|
||
data: {
|
||
province: <?=$district?>,
|
||
city: [],
|
||
region: [],
|
||
province_id: "<?=$model->province_id != null ? $model->province_id : ''?>",
|
||
city_id: "<?=$model->city_id != null ? $model->city_id : ''?>",
|
||
region_id: "<?=$model->region_id != null ? $model->region_id : ''?>",
|
||
}
|
||
});
|
||
app.city = app.province.length != 0 ? app.province[0].list : [];
|
||
app.region = app.city.length != 0 ? app.city[0].list : [];
|
||
$(app.province).each(function (i) {
|
||
if (app.province[i].id == app.province_id) {
|
||
app.city = app.province[i].list;
|
||
return true;
|
||
}
|
||
});
|
||
$(app.city).each(function (i) {
|
||
if (app.city[i].id == app.city_id) {
|
||
app.region = app.city[i].list;
|
||
return true;
|
||
}
|
||
});
|
||
|
||
var center = null
|
||
var searchService,map,markers,map2 = [];
|
||
var marker = null
|
||
var markerLayer = null
|
||
var isNewRecord = '<?= $model->isNewRecord?>'
|
||
var lat = '<?= $model->lat ?>'
|
||
var lng = '<?= $model->lng ?>'
|
||
var area = [];
|
||
var editor; // 编辑器
|
||
var activeType = 'polygon'; // 激活的图形编辑类型
|
||
var is_select = false
|
||
var is_disable = true;
|
||
if(!isNewRecord){
|
||
var area_arr = JSON.parse('<?= $area ?>')
|
||
$.each(area_arr,function (i,e) {
|
||
var paths = []
|
||
$.each(e.paths,function (i_i,e_e) {
|
||
paths.push(new TMap.LatLng(e_e.lat, e_e.lng))
|
||
})
|
||
var tmp = {}
|
||
tmp.id = e.id
|
||
tmp.paths = paths
|
||
tmp.styleId = e.styleId
|
||
tmp.area_type = e.area_type
|
||
area.push(tmp)
|
||
})
|
||
console.log('area编辑',area)
|
||
}
|
||
// document.getElementById('toolControl').addEventListener('click', (e) => {
|
||
// var id = e.target.id;
|
||
// var mode = editor.getActionMode()
|
||
// console.log(mode)
|
||
//
|
||
// if(id === 'enable'){
|
||
// layer.msg('图层解锁,请选择操作')
|
||
// editor.enable()
|
||
// is_disable = false
|
||
// }
|
||
// if(id === 'polygon' && mode === 1){
|
||
// //绘制
|
||
// layer.msg('图层进入绘制模式,如需删除区域请切换为交互模式')
|
||
// editor.setActionMode(TMap.tools.constants.EDITOR_ACTION.DRAW)
|
||
// }
|
||
//
|
||
// if(id === 'setActionMode_draw' && mode === 1){
|
||
// //进入绘制模式
|
||
// layer.msg('图层进入绘制模式,如需删除区域请切换为交互模式')
|
||
// editor.setActionMode(TMap.tools.constants.EDITOR_ACTION.DRAW)
|
||
// return
|
||
// }
|
||
// if(id === 'setActionMode_interact' && mode === 2){
|
||
// //进入交互模式
|
||
// layer.msg('图层进入交互模式,如需绘制区域请切换为绘制模式')
|
||
// editor.setActionMode(TMap.tools.constants.EDITOR_ACTION.INTERACT)
|
||
// return
|
||
// }
|
||
// if(id === 'select' && mode === 2){
|
||
// editor.setActionMode(TMap.tools.constants.EDITOR_ACTION.INTERACT)
|
||
//
|
||
// }
|
||
// if (id !== 'toolControl' && id !== '') {
|
||
// document.getElementById(activeType).className = 'toolItem';
|
||
// editor.setActiveOverlay(activeType);
|
||
// console.log('id',id)
|
||
// if(id === 'select'){
|
||
// console.log('重画前的area',area)
|
||
// var tmp_area_ids = []
|
||
// for (let i in area){
|
||
// tmp_area_ids.push(area[i].id)
|
||
//
|
||
// }
|
||
// console.log('重画中的tmp_area_ids',tmp_area_ids)
|
||
// editor.select(tmp_area_ids)
|
||
// editor.delete()
|
||
// console.log('重画后的area',area)
|
||
// is_select = true
|
||
// console.log('编辑清空--------')
|
||
// area = []
|
||
// console.log('编辑清空--------',area)
|
||
//
|
||
// }
|
||
// }
|
||
// });
|
||
|
||
// var initMap = function () {
|
||
//
|
||
// if (isNewRecord) {
|
||
// center = new TMap.LatLng(24.476404,118.129105);
|
||
// } else {
|
||
// center = new TMap.LatLng(lat, lng);
|
||
// }
|
||
//
|
||
//
|
||
// //初始化地图
|
||
// map = new TMap.Map("container", {
|
||
// zoom: 12,//设置地图缩放级别
|
||
// center: center//设置地图中心点坐标
|
||
// });
|
||
//
|
||
// // // 初始化几何图形及编辑器
|
||
// var polygon = new TMap.MultiPolygon({
|
||
// map: map,
|
||
// styles: {
|
||
// highlight: new TMap.PolygonStyle({
|
||
// color: 'rgba(255, 255, 0, 0.6)'
|
||
// })
|
||
// },
|
||
// geometries:area
|
||
// });
|
||
//
|
||
// editor = new TMap.tools.GeometryEditor({
|
||
// map: map,
|
||
// overlayList: [
|
||
// {
|
||
// overlay: polygon,
|
||
// id: 'polygon',
|
||
// },
|
||
// ],
|
||
// actionMode: TMap.tools.constants.EDITOR_ACTION.INTERACT, // 编辑器的工作模式EDITOR_ACTION.INTERACT|EDITOR_ACTION.DRAW
|
||
// activeOverlayId: 'polygon', // 激活图层
|
||
// snappable: true, // 开启吸附
|
||
// });
|
||
//
|
||
// editor.disable();
|
||
// // 监听绘制结束事件,获取绘制几何图形
|
||
// editor.on('draw_complete', (geometry) => {
|
||
// console.log('监听绘制结束事件,获取绘制几何图形',geometry);
|
||
// if(area.length > 3){
|
||
// layer.msg('只能创建三个区域(警戒区域,门店区域,停车位区域)', {
|
||
// offset: '15px'
|
||
// , icon: 2
|
||
// , time: 3000
|
||
// }, function () {
|
||
// editor.setActionMode(TMap.tools.constants.EDITOR_ACTION.INTERACT)
|
||
// editor.select([geometry.id])
|
||
// editor.delete()
|
||
// editor.setActionMode(TMap.tools.constants.EDITOR_ACTION.DRAW)
|
||
// });
|
||
// return false;
|
||
// }
|
||
//
|
||
// var content = $("#map_area_type_html").html();
|
||
// layer.open({
|
||
// type: 1
|
||
// ,offset: 'auto'
|
||
// ,id: 'layerDemo'
|
||
// ,content: content
|
||
// ,btn: ['确定','重画']
|
||
// ,btnAlign: 'c' //按钮居中
|
||
// ,area: ['530px', '200px'] //宽高
|
||
// // ,area: 'auto' //宽高
|
||
// ,shade: 0.8 //不显示遮罩
|
||
// ,closeBtn:0
|
||
// ,title:'区域内容'
|
||
// ,moveType: 1 //拖拽模式,0或者1
|
||
// ,yes: function(index,layero){
|
||
//
|
||
// var map_area_type = $("input[name='map_area_type']:checked").val()
|
||
// var name = '';
|
||
// if(map_area_type === '1'){
|
||
// //门店
|
||
// name = 'store';
|
||
// }else if(map_area_type === '2'){
|
||
// //报警
|
||
// name = 'call';
|
||
// }else if(map_area_type === '3'){
|
||
// //停车
|
||
// name = 'stop';
|
||
// }
|
||
//
|
||
// if(area.length > 0){
|
||
// $.each(area,function (index,item) {
|
||
// if(item.area_type === 'store' && name === 'store'){
|
||
// layer.msg('一个门店只能创建一个门店区域)', {
|
||
// offset: '15px'
|
||
// , icon: 2
|
||
// , time: 3000
|
||
// }, function () {
|
||
// editor.setActionMode(TMap.tools.constants.EDITOR_ACTION.INTERACT)
|
||
// editor.select([geometry.id])
|
||
// editor.delete()
|
||
// editor.setActionMode(TMap.tools.constants.EDITOR_ACTION.DRAW)
|
||
// });
|
||
// return;
|
||
// }
|
||
//
|
||
// if(item.area_type === 'call' && name === 'call'){
|
||
// layer.msg('一个门店只能创建一个警戒区域)', {
|
||
// offset: '15px'
|
||
// , icon: 2
|
||
// , time: 3000
|
||
// }, function () {
|
||
// editor.setActionMode(TMap.tools.constants.EDITOR_ACTION.INTERACT)
|
||
// editor.select([geometry.id])
|
||
// editor.delete()
|
||
// editor.setActionMode(TMap.tools.constants.EDITOR_ACTION.DRAW)
|
||
// });
|
||
// return;
|
||
// }
|
||
//
|
||
// if(item.area_type === 'stop' && name === 'stop'){
|
||
// layer.msg('一个门店只能创建一个停车区域)', {
|
||
// offset: '15px'
|
||
// , icon: 2
|
||
// , time: 3000
|
||
// }, function () {
|
||
// editor.setActionMode(TMap.tools.constants.EDITOR_ACTION.INTERACT)
|
||
// editor.select([geometry.id])
|
||
// editor.delete()
|
||
// editor.setActionMode(TMap.tools.constants.EDITOR_ACTION.DRAW)
|
||
// });
|
||
// return;
|
||
// }
|
||
// })
|
||
// }
|
||
//
|
||
// geometry.area_type = name
|
||
// if(is_select){
|
||
// area.push(geometry)
|
||
// }
|
||
// console.log('绘制结束后的area',area)
|
||
// layer.close(index)
|
||
// },
|
||
// btn2: function(index, layero){
|
||
// editor.setActionMode(TMap.tools.constants.EDITOR_ACTION.INTERACT)
|
||
// editor.select([geometry.id])
|
||
// editor.delete()
|
||
// editor.setActionMode(TMap.tools.constants.EDITOR_ACTION.DRAW)
|
||
// layer.close(index)
|
||
// },
|
||
//
|
||
// });
|
||
// layui.form.render();
|
||
// });
|
||
//
|
||
// // 监听删除、修改、拆分、合并完成事件
|
||
// let evtList = ['delete', 'adjust', 'split', 'union','select'];
|
||
// evtList.forEach(evtName => {
|
||
// editor.on(evtName + '_complete', evtResult => {
|
||
// console.log('操作',evtName,evtResult)
|
||
// for (let i in evtResult){
|
||
// var id = evtResult[i].id
|
||
// console.log('删除id',id)
|
||
// if(evtName === 'delete'){
|
||
// for (let i in area){
|
||
// if(area[i].id == id){
|
||
// area.splice(i,1)
|
||
// }
|
||
// }
|
||
// console.log('删除后的area',area)
|
||
// }
|
||
//
|
||
// }
|
||
// });
|
||
//
|
||
//
|
||
// });
|
||
//
|
||
// // 监听拆分失败事件,获取拆分失败原因
|
||
// editor.on('split_fail', (res) => {
|
||
// alert(res.message);
|
||
// });
|
||
// // 监听合并失败事件,获取合并失败原因
|
||
// editor.on('union_fail', (res) => {
|
||
// alert(res.message);
|
||
// });
|
||
//
|
||
//
|
||
//
|
||
//
|
||
//
|
||
// var latlngBounds = new qq.maps.LatLngBounds();
|
||
// //调用Poi检索类
|
||
// searchService = new qq.maps.SearchService({
|
||
// complete: function (results) {
|
||
// var pois = results.detail.pois;
|
||
// if (!pois) {
|
||
// layer.alert('关键字搜索不到,请重新输入');
|
||
// return;
|
||
// }
|
||
// for (var i = 0, l = pois.length; i < l; i++) {
|
||
// (function (n) {
|
||
// var poi = pois[n];
|
||
// if(i == 0){
|
||
// map.setCenter(new TMap.LatLng(poi.latLng.lat,poi.latLng.lng));
|
||
// }
|
||
// latlngBounds.extend(poi.latLng);
|
||
// let _marker = new TMap.MultiMarker({
|
||
// id: 'mkr_' + (new Date()).getTime() + '_' + i,
|
||
// map: map,
|
||
// styles: {
|
||
// "marker": new TMap.MarkerStyle({
|
||
// "width": 25,
|
||
// "height": 35,
|
||
// "anchor": {x: 16, y: 32},
|
||
// "src": 'https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/markerDefault.png'
|
||
// })
|
||
// },
|
||
// geometries: [{
|
||
// "id": 'demo',
|
||
// "styleId": 'marker',
|
||
// "position": new TMap.LatLng(poi.latLng.lat, poi.latLng.lng),
|
||
// "properties": {
|
||
// "title": "marker"
|
||
// }
|
||
// }]
|
||
// });
|
||
// _marker.on("click", function(e){
|
||
// locationToAddress(e.latLng.lat,e.latLng.lng);
|
||
// });
|
||
// markers.push(_marker);
|
||
// })(i);
|
||
// }
|
||
// //map.fitBounds(latlngBounds);
|
||
// }
|
||
// });
|
||
// };
|
||
|
||
function check_action_mode() {
|
||
var mode = editor.getActionMode()
|
||
console.log(mode)
|
||
console.log(is_disable)
|
||
if(!is_disable){
|
||
is_disable = true
|
||
editor.disable();
|
||
// editor.setActionMode(TMap.tools.constants.EDITOR_ACTION.DRAW)
|
||
layer.msg('图层进入禁用状态,如需使用请解锁')
|
||
}
|
||
}
|
||
|
||
function locationToAddress(lat,lng)
|
||
{
|
||
var url = '<?= \Yii::$app->urlManager->createUrl(["/api/geocoder/district-info"]) ?>';
|
||
$.ajax(url, {
|
||
type: "GET",
|
||
dataType: "json",
|
||
data: {
|
||
lat:lat,
|
||
lng:lng
|
||
},
|
||
timeout: 10000,
|
||
success: function (res) {
|
||
if (res.code == 0) {
|
||
app.province_id = res.data.province.id;
|
||
app.city_id = res.data.city.id;
|
||
app.region_id = res.data.district.id;
|
||
$(app.province).each(function (i) {
|
||
if (app.province[i].id == app.province_id) {
|
||
app.city = app.province_id != 0 ? app.province[i].list : [];
|
||
$(app.city).each(function (j) {
|
||
if (app.city[j].id == app.city_id) {
|
||
app.region = app.city[j].list;
|
||
app.$forceUpdate();
|
||
setTimeout(function(){
|
||
_form.render('select');
|
||
},500);
|
||
return true;
|
||
}
|
||
});
|
||
return true;
|
||
}
|
||
});
|
||
} else {
|
||
layer.msg(res.msg, {
|
||
offset: '15px'
|
||
, icon: 2
|
||
, time: 1000
|
||
}, function () {
|
||
});
|
||
}
|
||
},
|
||
error: function (xhr, type, err) {
|
||
layer.msg(xhr.responseText, {
|
||
offset: '15px'
|
||
, icon: 2
|
||
, time: 1000
|
||
}, function () {
|
||
});
|
||
},
|
||
complete: function () {
|
||
}
|
||
})
|
||
}
|
||
|
||
layui.config({
|
||
base: '/statics/layuiadmin/' //静态资源所在路径
|
||
}).extend({
|
||
index: 'lib/index' //主入口模块
|
||
}).use(['index', 'user', 'tree','laydate','layer'], function () {
|
||
var $ = layui.$
|
||
, setter = layui.setter
|
||
, tree = layui.tree
|
||
, admin = layui.admin
|
||
, laydate = layui.laydate
|
||
, router = layui.router()
|
||
, search = router.search;
|
||
|
||
laydate.render({
|
||
elem: '#begin_time'
|
||
,type: 'time'
|
||
,format: 'HH:mm' //可任意组合
|
||
,theme:'HH:mm'
|
||
});
|
||
laydate.render({
|
||
elem: '#end_time'
|
||
,type: 'time'
|
||
,format: 'HH:mm' //可任意组合
|
||
,theme:'HH:mm'
|
||
});
|
||
|
||
_form = layui.form
|
||
_form.render();
|
||
|
||
//提交
|
||
var submitLock = false;
|
||
_form.on('submit(layui-form-submit)', function (obj) {
|
||
if (submitLock) {
|
||
return false;
|
||
}
|
||
|
||
submitLock = true;
|
||
//请求登入接口
|
||
console.log(obj)
|
||
var url = '<?= \Yii::$app->urlManager->createUrl(["/admin/store/edit", 'id' => $model->id ? $model->id : 0]) ?>';
|
||
var returnUrl = "<?= $return_url ?>";
|
||
var data = obj.field;
|
||
data.area = JSON.stringify(area);
|
||
data._csrf = _csrf;
|
||
console.log(data)
|
||
$.ajax(url, {
|
||
type: "POST",
|
||
dataType: "json",
|
||
data: data,
|
||
timeout: 10000,
|
||
success: function (res) {
|
||
console.log(res)
|
||
if (res.code == 0) {
|
||
layer.msg(res.msg, {
|
||
offset: '15px'
|
||
, icon: 1
|
||
, time: 1000
|
||
}, function () {
|
||
if(returnUrl){
|
||
location.href = returnUrl;
|
||
} else {
|
||
location.reload();
|
||
}
|
||
});
|
||
} else {
|
||
layer.msg(res.msg, {
|
||
offset: '15px'
|
||
, icon: 2
|
||
, time: 1000
|
||
}, function () {
|
||
submitLock = false;
|
||
});
|
||
}
|
||
},
|
||
error: function (xhr, type, err) {
|
||
layer.msg(xhr.responseText, {
|
||
offset: '15px'
|
||
, icon: 2
|
||
, time: 1000
|
||
}, function () {
|
||
submitLock = false;
|
||
});
|
||
},
|
||
complete: function () {
|
||
submitLock = false;
|
||
}
|
||
})
|
||
});
|
||
|
||
|
||
$(document).on('change','#province_id',function () {
|
||
app.province_id = this.value;
|
||
$(app.province).each(function (i) {
|
||
if (app.province[i].id == app.province_id) {
|
||
app.city = app.province_id != 0 ? app.province[i].list : [];
|
||
app.city_id = app.province_id != 0 ? app.province[i].list[0]['id'] : 0;
|
||
app.region = app.province_id != 0 ? app.city[0].list : [];
|
||
app.region_id = app.province_id != 0 ? app.city[0].list[0]['id'] : 0;
|
||
app.province_id = app.province_id == 0 ? '' : app.province_id;
|
||
app.$forceUpdate();
|
||
setTimeout(function(){
|
||
_form.render('select');
|
||
$("#mRegion").val(app.province_id != 0 ? app.province[i].list[0]['name'] : '');
|
||
},500);
|
||
return true;
|
||
}
|
||
});
|
||
});
|
||
$(document).on('change','#city_id',function () {
|
||
app.city_id = this.value;
|
||
$(app.city).each(function (i) {
|
||
if (app.city[i].id == app.city_id) {
|
||
app.region = app.city[i].list;
|
||
app.region_id = app.city[i].list[0]['id'];
|
||
app.$forceUpdate();
|
||
setTimeout(function(){
|
||
_form.render('select');
|
||
$("#mRegion").val(app.city[i].name);
|
||
},500);
|
||
return true;
|
||
}
|
||
});
|
||
});
|
||
$(document).on('change','#region_id',function () {
|
||
app.region_id = this.value;
|
||
setTimeout(function(){
|
||
_form.render('select');
|
||
},500);
|
||
});
|
||
});
|
||
<?php $this->endBlock(); ?>
|
||
</script>
|
||
<?php $this->registerJs($this->blocks['js_script_wrap'], \yii\web\View::POS_END); ?>
|
||
|
||
|
||
|
||
|
||
|
||
|