diff --git a/src/main/java/cn/com/tenlion/controller/app/apis/shop/ShopAppController.java b/src/main/java/cn/com/tenlion/controller/app/apis/shop/ShopAppController.java index ba6a293..53dfbfe 100644 --- a/src/main/java/cn/com/tenlion/controller/app/apis/shop/ShopAppController.java +++ b/src/main/java/cn/com/tenlion/controller/app/apis/shop/ShopAppController.java @@ -71,10 +71,6 @@ public class ShopAppController extends DefaultBaseController { } - - - - @ApiOperation(value = "我的店铺分页列表", notes = "我的店铺分页列表接口") @ApiImplicitParams({ @ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"), diff --git a/src/main/java/cn/com/tenlion/controller/app/apis/templateforwardingrecord/TemplateForwardingRecordAppController.java b/src/main/java/cn/com/tenlion/controller/app/apis/templateforwardingrecord/TemplateForwardingRecordAppController.java index d0e77bf..2bfdb8d 100644 --- a/src/main/java/cn/com/tenlion/controller/app/apis/templateforwardingrecord/TemplateForwardingRecordAppController.java +++ b/src/main/java/cn/com/tenlion/controller/app/apis/templateforwardingrecord/TemplateForwardingRecordAppController.java @@ -40,6 +40,7 @@ public class TemplateForwardingRecordAppController extends DefaultBaseController + @ApiOperation(value = "新增", notes = "新增接口") @ApiImplicitParams({ @ApiImplicitParam(name = "token", value = "token", paramType = "header") diff --git a/src/main/java/cn/com/tenlion/controller/app/apis/templateviewrecord/TemplateViewRecordAppController.java b/src/main/java/cn/com/tenlion/controller/app/apis/templateviewrecord/TemplateViewRecordAppController.java index c936755..f01ee46 100644 --- a/src/main/java/cn/com/tenlion/controller/app/apis/templateviewrecord/TemplateViewRecordAppController.java +++ b/src/main/java/cn/com/tenlion/controller/app/apis/templateviewrecord/TemplateViewRecordAppController.java @@ -34,6 +34,22 @@ public class TemplateViewRecordAppController extends DefaultBaseController { @Autowired private ITemplateViewRecordService templateViewRecordService; + @ApiOperation(value = "根据模板使用ID获取其查看信息", notes = "根据模板使用ID获取其查看信息") + @ApiImplicitParams({ + @ApiImplicitParam(name = "token", value = "token", paramType = "header"), + @ApiImplicitParam(name = "templateUseId", value = "模板使用ID", paramType = "path") + }) + @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) + @GetMapping("getByTemplateUseId/{templateUseId}") + public Map getByTemplateUseId(@PathVariable("templateUseId") String templateUseId){ + return templateViewRecordService.getByTemplateUseId(templateUseId); + } + + + + + + @ApiOperation(value = "新增", notes = "新增接口") @ApiImplicitParams({ @ApiImplicitParam(name = "token", value = "token", paramType = "header") diff --git a/src/main/java/cn/com/tenlion/pojo/dtos/templateviewrecord/TemplateViewRecordDTO.java b/src/main/java/cn/com/tenlion/pojo/dtos/templateviewrecord/TemplateViewRecordDTO.java index 6bd8d41..664e845 100644 --- a/src/main/java/cn/com/tenlion/pojo/dtos/templateviewrecord/TemplateViewRecordDTO.java +++ b/src/main/java/cn/com/tenlion/pojo/dtos/templateviewrecord/TemplateViewRecordDTO.java @@ -20,16 +20,8 @@ public class TemplateViewRecordDTO { private String templateUseId; @ApiModelProperty(name = "cardTemplateViewUserId", value = "查看人员Id") private String cardTemplateViewUserId; - @ApiModelProperty(name = "creator", value = "") - private String creator; - @ApiModelProperty(name = "gmtCreate", value = "") - private String gmtCreate; - @ApiModelProperty(name = "modifier", value = "") - private String modifier; - @ApiModelProperty(name = "gmtModified", value = "") - private String gmtModified; - @ApiModelProperty(name = "isDelete", value = "") - private Integer isDelete; + @ApiModelProperty(name = "cardTemplateViewUserIdPhoto", value = "查看人员头像") + private String cardTemplateViewUserIdPhoto; public String getCardTemplateViewRecordId() { return cardTemplateViewRecordId == null ? "" : cardTemplateViewRecordId.trim(); @@ -55,45 +47,12 @@ public class TemplateViewRecordDTO { this.cardTemplateViewUserId = cardTemplateViewUserId; } - public String getCreator() { - return creator == null ? "" : creator.trim(); + + public String getCardTemplateViewUserIdPhoto() { + return cardTemplateViewUserIdPhoto; } - public void setCreator(String creator) { - this.creator = creator; + public void setCardTemplateViewUserIdPhoto(String cardTemplateViewUserIdPhoto) { + this.cardTemplateViewUserIdPhoto = cardTemplateViewUserIdPhoto; } - - public String getGmtCreate() { - return gmtCreate == null ? "" : gmtCreate.trim(); - } - - public void setGmtCreate(String gmtCreate) { - this.gmtCreate = gmtCreate; - } - - public String getModifier() { - return modifier == null ? "" : modifier.trim(); - } - - public void setModifier(String modifier) { - this.modifier = modifier; - } - - public String getGmtModified() { - return gmtModified == null ? "" : gmtModified.trim(); - } - - public void setGmtModified(String gmtModified) { - this.gmtModified = gmtModified; - } - - public Integer getIsDelete() { - return isDelete == null ? 0 : isDelete; - } - - public void setIsDelete(Integer isDelete) { - this.isDelete = isDelete; - } - - } diff --git a/src/main/java/cn/com/tenlion/service/dynamic/impl/DynamicServiceImpl.java b/src/main/java/cn/com/tenlion/service/dynamic/impl/DynamicServiceImpl.java index 65772ed..55fdc20 100644 --- a/src/main/java/cn/com/tenlion/service/dynamic/impl/DynamicServiceImpl.java +++ b/src/main/java/cn/com/tenlion/service/dynamic/impl/DynamicServiceImpl.java @@ -212,7 +212,7 @@ public class DynamicServiceImpl extends DefaultBaseService implements IDynamicSe dto.setUserIcon(userPO.getUserAvatar()); } dto.setUserName("董博"); - dto.setUserIcon("f416ce36-2cc4-4eb0-8a38-224da7bac7de"); + dto.setUserIcon("e453eddd-f7cd-4ddc-a23c-56e6223649d8"); }else{ ShopDTO shop = shopService.get(dto.getDynamicShopId()); if(shop != null) { @@ -220,9 +220,9 @@ public class DynamicServiceImpl extends DefaultBaseService implements IDynamicSe dto.setShopIcon(shop.getShopLogo()); } dto.setShopName("董博的店"); - dto.setShopIcon("f416ce36-2cc4-4eb0-8a38-224da7bac7de"); + dto.setShopIcon("e453eddd-f7cd-4ddc-a23c-56e6223649d8"); } - dto.setDynamicFile("f416ce36-2cc4-4eb0-8a38-224da7bac7de,ecaef298-7998-41cf-8773-4b9395b989c2,f416ce36-2cc4-4eb0-8a38-224da7bac7de,ecaef298-7998-41cf-8773-4b9395b989c2"); + //dto.setDynamicFile("f416ce36-2cc4-4eb0-8a38-224da7bac7de,ecaef298-7998-41cf-8773-4b9395b989c2,f416ce36-2cc4-4eb0-8a38-224da7bac7de,ecaef298-7998-41cf-8773-4b9395b989c2"); } PageInfo pageInfo = new PageInfo<>(dynamicDTOs); return new SuccessResultList<>(dynamicDTOs, pageInfo.getPageNum(), pageInfo.getTotal()); diff --git a/src/main/java/cn/com/tenlion/service/shop/impl/ShopServiceImpl.java b/src/main/java/cn/com/tenlion/service/shop/impl/ShopServiceImpl.java index 74153e0..f5714ee 100644 --- a/src/main/java/cn/com/tenlion/service/shop/impl/ShopServiceImpl.java +++ b/src/main/java/cn/com/tenlion/service/shop/impl/ShopServiceImpl.java @@ -162,23 +162,25 @@ public class ShopServiceImpl extends DefaultBaseService implements IShopService @Override public ShopDTO get(Map params) { ShopDTO shopDTO = shopDao.get(params); - // 通过店铺ID获取店铺行业信息 - List shopDTOS = shopDao.getIndustry(params); - if(null != shopDTOS && shopDTOS.size() > 0) { - StringBuffer industryName = new StringBuffer(); - StringBuffer industryId = new StringBuffer(); - for(ShopDTO dto: shopDTOS) { - industryName.append(dto.getIndustryName()).append(","); - industryId.append(dto.getIndustryId()).append(","); + if(shopDTO != null){ + // 通过店铺ID获取店铺行业信息 + List shopDTOS = shopDao.getIndustry(params); + if(null != shopDTOS && shopDTOS.size() > 0) { + StringBuffer industryName = new StringBuffer(); + StringBuffer industryId = new StringBuffer(); + for(ShopDTO dto: shopDTOS) { + industryName.append(dto.getIndustryName()).append(","); + industryId.append(dto.getIndustryId()).append(","); + } + shopDTO.setIndustryName(industryName.deleteCharAt(industryName.length() - 1).toString()); + shopDTO.setIndustryId(industryId.deleteCharAt(industryId.length() - 1).toString()); + } + // 通过店铺ID获取店铺认证ID + ShopCertificationDTO shopCertificationDTO = shopCertificationDao.getByShopIdAndAuditStatus(params); + if(null != shopCertificationDTO) { + shopDTO.setShopCertificationId(shopCertificationDTO.getShopCertificationId()); + shopDTO.setAuditStatus(shopCertificationDTO.getAuditStatus()); } - shopDTO.setIndustryName(industryName.deleteCharAt(industryName.length() - 1).toString()); - shopDTO.setIndustryId(industryId.deleteCharAt(industryId.length() - 1).toString()); - } - // 通过店铺ID获取店铺认证ID - ShopCertificationDTO shopCertificationDTO = shopCertificationDao.getByShopIdAndAuditStatus(params); - if(null != shopCertificationDTO) { - shopDTO.setShopCertificationId(shopCertificationDTO.getShopCertificationId()); - shopDTO.setAuditStatus(shopCertificationDTO.getAuditStatus()); } return shopDTO; } diff --git a/src/main/java/cn/com/tenlion/service/templateviewrecord/ITemplateViewRecordService.java b/src/main/java/cn/com/tenlion/service/templateviewrecord/ITemplateViewRecordService.java index f3c7021..47a30a8 100644 --- a/src/main/java/cn/com/tenlion/service/templateviewrecord/ITemplateViewRecordService.java +++ b/src/main/java/cn/com/tenlion/service/templateviewrecord/ITemplateViewRecordService.java @@ -19,6 +19,14 @@ import java.util.Map; **/ public interface ITemplateViewRecordService { + + /** + * 根据模板使用ID获取其查看信息 + * @param templateUseId + * @return + */ + Map getByTemplateUseId(String templateUseId); + /** * 新增 * diff --git a/src/main/java/cn/com/tenlion/service/templateviewrecord/impl/TemplateViewRecordServiceImpl.java b/src/main/java/cn/com/tenlion/service/templateviewrecord/impl/TemplateViewRecordServiceImpl.java index d5a13bf..b3708ac 100644 --- a/src/main/java/cn/com/tenlion/service/templateviewrecord/impl/TemplateViewRecordServiceImpl.java +++ b/src/main/java/cn/com/tenlion/service/templateviewrecord/impl/TemplateViewRecordServiceImpl.java @@ -33,6 +33,26 @@ public class TemplateViewRecordServiceImpl extends DefaultBaseService implements @Autowired private ITemplateViewRecordDao templateViewRecordDao; + public Map getByTemplateUseId(String templateUseId){ + Map map = new HashMap<>(); + map.put("templateUseId",templateUseId); + Integer total = this.count(map); + ListPage page = new ListPage(); + page.setParams(map); + page.setPage(1); + page.setRows(5); + SuccessResultList> list = this.listPage(page); + map.clear(); + map.put("total",total); + map.put("list",list); + return map; + } + + + + + + @Override public void save(TemplateViewRecordVO templateViewRecordVO) { saveReturnId(templateViewRecordVO); diff --git a/src/main/resources/mybatis/mapper/templateforwardingrecord/template-forwarding-record-mapper.xml b/src/main/resources/mybatis/mapper/templateforwardingrecord/template-forwarding-record-mapper.xml index aefc1ee..163abb1 100644 --- a/src/main/resources/mybatis/mapper/templateforwardingrecord/template-forwarding-record-mapper.xml +++ b/src/main/resources/mybatis/mapper/templateforwardingrecord/template-forwarding-record-mapper.xml @@ -279,6 +279,10 @@ card_template_forwarding_record t1 WHERE t1.is_delete = 0 + + AND t1.template_use_id = #{templateUseId} + + diff --git a/src/main/resources/mybatis/mapper/templateviewrecord/template-view-record-mapper.xml b/src/main/resources/mybatis/mapper/templateviewrecord/template-view-record-mapper.xml index 1d0b9ff..707421f 100644 --- a/src/main/resources/mybatis/mapper/templateviewrecord/template-view-record-mapper.xml +++ b/src/main/resources/mybatis/mapper/templateviewrecord/template-view-record-mapper.xml @@ -6,11 +6,6 @@ - - - - - @@ -150,12 +145,7 @@ SELECT t1.card_template_view_record_id, t1.template_use_id, - t1.card_template_view_user_id, - t1.creator, - t1.gmt_create, - t1.modifier, - t1.gmt_modified, - t1.is_delete + t1.card_template_view_user_id FROM card_template_view_record t1 WHERE @@ -174,6 +164,10 @@ AND LEFT(t1.gmt_create, 10) #{endTime} + + AND t1.template_use_id = #{templateUseId} + + ORDER BY t1.creator DESC @@ -246,6 +240,10 @@ card_template_view_record t1 WHERE t1.is_delete = 0 + + AND t1.template_use_id = #{templateUseId} + + \ No newline at end of file diff --git a/src/main/resources/static/route/shop/save.html b/src/main/resources/static/route/shop/save.html index 9bb5dd5..d1827b3 100644 --- a/src/main/resources/static/route/shop/save.html +++ b/src/main/resources/static/route/shop/save.html @@ -73,7 +73,7 @@
- +
@@ -92,7 +92,7 @@ {{# } }} {{# if(d[fileName].length < 1) { }} @@ -153,18 +153,12 @@
+ +
- -
-
- -
-
@@ -198,7 +192,12 @@ var laydate = layui.laydate; var map; var viewerObj = {}; + var initLongitude = '109.85017859252311'; + var initLatitude = '40.66017700460503'; + + + //行业信息单击事件 $(document).on('click', '#industryNames', function() { top.dialog.dialogData.industryIds = ''; top.dialog.dialogData.industryNames = ''; @@ -228,14 +227,7 @@ }); }); - // 初始化日期 - function initDate() { - // 日期选择 - laydate.render({ - elem: '#openDate', - format: 'yyyy-MM-dd' - }); - } + // 初始化营业执照图片上传 function initBusinessLicenseUploadFile() { @@ -386,6 +378,7 @@ }); } + //初始化百度地图 function initMap(longitude, latitude) { map = new BMap.Map("mapContainer", {enableMapClick: false,}); var point = new BMap.Point(longitude, latitude); @@ -395,6 +388,8 @@ map.addControl(new BMap.ScaleControl()); map.addControl(new BMap.OverviewMapControl()); map.addControl(new BMap.MapTypeControl()); + map.enableScrollWheelZoom();//启用地图滚轮放大缩小 + map.enableContinuousZoom();//开启缩放平滑 // 点击获取地址 var geocoder= new BMap.Geocoder(); mapMarkPoint(map, point); @@ -405,51 +400,15 @@ point = new BMap.Point(e.point.lng, e.point.lat); mapMarkPoint(map, point); geocoder.getLocation(e.point, function(rs) { - $('#address').val(rs.address); + $('#shopAddress').val(rs.address); }); }); } - initMap('109.85017859252311', '40.66017700460503'); - function mapMarkPoint(map, point) { var marker = new BMap.Marker(point); map.addOverlay(marker); } - $("#searchMap").on('click',function(){ - var searchInput = $('#searchMapId').val(); - if (!searchInput) { - layer.msg("查询内容不能为空"); - return false; - } - var localSearch = new BMap.LocalSearch(map); - localSearch.setSearchCompleteCallback(function (msg) { - if (localSearch.getStatus() == BMAP_STATUS_SUCCESS) { - var poi = msg.getPoi(0); - if (poi) { - initNewMap(poi.point.lng, poi.point.lat); - $('#longitude').val(poi.point.lng); - $('#latitude').val(poi.point.lat); - } - } else { - layer.msg("没有查询结果"); - } - }); - localSearch.search(searchInput); - }); - - function initNewMap(x, y) { - createMap(x, y); - } - - //创建地图函数: - function createMap(x, y) { - initMap(x, y); - } - - function closeBox() { - parent.layer.close(parent.layer.getFrameIndex(window.name)); - } function refreshDownloadTemplet(fileName, file) { var dataRander = {}; @@ -501,38 +460,29 @@ } } - // 初始化审核时间时间戳 - function initAuditDateDateTime() { - laydate.render({ - elem: '#auditDate', - type: 'datetime', - value: new Date(), - trigger: 'click' - }); - } - // 初始化开业时间日期 function initOpenDateDate() { laydate.render({ elem: '#openDate', - type: 'date', - value: new Date(), - trigger: 'click' + format: 'yyyy-MM-dd' }); } // 初始化内容 function initData() { - initDate(); initBusinessLicenseUploadFile(); initShopLogoUploadFile(); initShopVideoUploadFile(); - initAuditDateDateTime(); initOpenDateDate(); + initMap(initLongitude, initLatitude); } initData(); + function closeBox() { + parent.layer.close(parent.layer.getFrameIndex(window.name)); + } + // 提交表单 form.on('submit(submitForm)', function(formData) { top.dialog.confirm(top.dataMessage.commit, function(index) { diff --git a/src/main/resources/static/route/shop/update.html b/src/main/resources/static/route/shop/update.html index b229565..f04925d 100644 --- a/src/main/resources/static/route/shop/update.html +++ b/src/main/resources/static/route/shop/update.html @@ -22,12 +22,7 @@
-
- -
- -
-
+
@@ -41,69 +36,137 @@
- +
- + +
-
- +
+
- + +
+
-
- +
+
- + +
+
-
- +
+
- + +
+
-
- -
- -
-
-
- -
- -
-
-
- -
- -
-
-
- -
- +
+ +
+ +
- + +
+
+
+ +
+ +
- +
- + + + +
+
+
+
+
@@ -112,6 +175,7 @@
+ @@ -131,6 +195,39 @@ var wangEditor = window.wangEditor; var wangEditorObj = {}; var viewerObj = {}; + var initLongitude= '109.85017859252311'; + var initLatitude= '40.66017700460503' + + //行业点击事件 + $(document).on('click', '#industryNames', function() { + top.dialog.dialogData.industryIds = ''; + top.dialog.dialogData.industryNames = ''; + top.dialog.open({ + url: top.restAjax.path('route/industry/industry-tree-check.html', []), + title: '选择行业信息', + width: '1040px', + height: '98%', + onClose: function(data) { + var ids = ''; + var names = ''; + var selectArray = top.dialog.dialogData.selectArray; + if(selectArray != null && selectArray.length > 0) { + var selectedIds = ''; + for (var i = 0, item; item = selectArray[i++];) { + if(ids.length > 0) { + ids += ','; + names += ','; + } + ids += item.id; + names += item.name; + } + } + $("#industryIds").val(ids); + $("#industryNames").val(names); + } + }); + }); + function closeBox() { parent.layer.close(parent.layer.getFrameIndex(window.name)); @@ -171,6 +268,156 @@ }); } + // 初始化营业执照图片上传 + function initBusinessLicenseUploadFile() { + var files = $('#businessLicense').val(); + initFileList('businessLicense', files, function(fileName) { + var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false}); + viewerObj[fileName] = viewer; + }); + + form.on('button(businessLicenseUploadFile)', function(obj) { + var name = this.dataset.name; + var explain = this.dataset.explain; + top.dialog.file({ + type: 'image', + title: '上传'+ explain, + width: '400px', + height: '420px', + maxFileCount: '1', + onClose: function() { + var uploadFileArray = top.dialog.dialogData.uploadFileArray; + if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) { + var files = $('#'+ name).val(); + for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) { + if(files.length > 0) { + files += ','; + } + files += file.data; + } + initFileList(name, files, function(fileName) { + viewerObj[fileName].update(); + }); + } + } + }); + }); + + form.on('button(businessLicenseRemoveFile)', function(obj) { + var name = this.dataset.name; + var id = this.dataset.id; + var files = $('#'+ name).val().replace(id, ''); + files = files.replace(/\,+/g, ','); + if(files.charAt(0) == ',') { + files = files.substring(1); + } + if(files.charAt(files.length - 1) == ',') { + files = files.substring(0, files.length - 1); + } + initFileList(name, files, function(fileName) { + viewerObj[fileName].update(); + }); + }); + } + + // 初始化店铺LOGO图片上传 + function initShopLogoUploadFile() { + var files = $('#shopLogo').val(); + initFileList('shopLogo', files, function(fileName) { + var viewer = new Viewer(document.getElementById(fileName +'FileBox'), {navbar: false}); + viewerObj[fileName] = viewer; + }); + + form.on('button(shopLogoUploadFile)', function(obj) { + var name = this.dataset.name; + var explain = this.dataset.explain; + top.dialog.file({ + type: 'image', + title: '上传'+ explain, + width: '400px', + height: '420px', + maxFileCount: '1', + onClose: function() { + var uploadFileArray = top.dialog.dialogData.uploadFileArray; + if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) { + var files = $('#'+ name).val(); + for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) { + if(files.length > 0) { + files += ','; + } + files += file.data; + } + initFileList(name, files, function(fileName) { + viewerObj[fileName].update(); + }); + } + } + }); + }); + + form.on('button(shopLogoRemoveFile)', function(obj) { + var name = this.dataset.name; + var id = this.dataset.id; + var files = $('#'+ name).val().replace(id, ''); + files = files.replace(/\,+/g, ','); + if(files.charAt(0) == ',') { + files = files.substring(1); + } + if(files.charAt(files.length - 1) == ',') { + files = files.substring(0, files.length - 1); + } + initFileList(name, files, function(fileName) { + viewerObj[fileName].update(); + }); + }); + } + + // 初始化店铺视频,最多1个视频上传 + function initShopVideoUploadFile() { + var files = $('#shopVideo').val(); + initFileList('shopVideo', files, initVideo); + + form.on('button(shopVideoUploadFile)', function(obj) { + var name = this.dataset.name; + var explain = this.dataset.explain; + top.dialog.file({ + type: 'video', + title: '上传'+ explain, + width: '400px', + height: '420px', + maxFileCount: '1', + onClose: function() { + var uploadFileArray = top.dialog.dialogData.uploadFileArray; + if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) { + var files = $('#'+ name).val(); + for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) { + if(files.length > 0) { + files += ','; + } + files += file.data; + } + initFileList(name, files, initVideo); + } + } + }); + }); + + form.on('button(shopVideoRemoveFile)', function(obj) { + var name = this.dataset.name; + var id = this.dataset.id; + var files = $('#'+ name).val().replace(id, ''); + files = files.replace(/\,+/g, ','); + if(files.charAt(0) == ',') { + files = files.substring(1); + } + if(files.charAt(files.length - 1) == ',') { + files = files.substring(0, files.length - 1); + } + initFileList(name, files, initVideo); + }); + } + + // 初始化视频 function initVideo(fileName, data) { for(var i = 0, item; item = data[i++];) { @@ -186,26 +433,55 @@ } } - // 初始化审核时间时间戳 - function initAuditDateDateTime() { - laydate.render({ - elem: '#auditDate', - type: 'datetime', - value: new Date(), - trigger: 'click' - }); - } // 初始化开业时间日期 function initOpenDateDate() { laydate.render({ elem: '#openDate', type: 'date', - value: new Date(), trigger: 'click' }); } + function initMap(longitude, latitude) { + if(longitude == '' || latitude == ''){ + longitude = initLongitude; + latitude = initLatitude; + } + map = new BMap.Map("mapContainer", {enableMapClick: false,}); + var point = new BMap.Point(longitude, latitude); + map.centerAndZoom(point, 13); + map.disableDoubleClickZoom(); + map.addControl(new BMap.NavigationControl()); + map.addControl(new BMap.ScaleControl()); + map.addControl(new BMap.OverviewMapControl()); + map.addControl(new BMap.MapTypeControl()); + map.enableScrollWheelZoom();//启用地图滚轮放大缩小 + map.enableContinuousZoom();//开启缩放平滑 + // 点击获取地址 + var geocoder= new BMap.Geocoder(); + mapMarkPoint(map, point); + map.addEventListener("click", function(e) { + map.clearOverlays(); + $('#shopLongitude').val(e.point.lng); + $('#shopLatitude').val(e.point.lat); + point = new BMap.Point(e.point.lng, e.point.lat); + mapMarkPoint(map, point); + geocoder.getLocation(e.point, function(rs) { + $('#shopAddress').val(rs.address); + }); + }); + } + + + function mapMarkPoint(map, point) { + var marker = new BMap.Marker(point); + map.addOverlay(marker); + } + + + + // 初始化内容 function initData() { @@ -215,10 +491,11 @@ for(var i in data) { dataFormData[i] = data[i] +''; } + dataFormData['industryNames'] = data['industryName'] form.val('dataForm', dataFormData); form.render(null, 'dataForm'); - initAuditDateDateTime(); initOpenDateDate(); + initMap(data.shopLongitude, data.shopLatitude); }, function(code, data) { top.dialog.msg(data.msg); }, function() {