|
@@ -221,9 +221,7 @@
|
|
|
<!--章节计量情况图-->
|
|
|
<div class="col-6 pl-0">
|
|
|
<div class="card mb-3 <% if (!ctx.tender.info.display.dayMode) { %>bg-dark text-white<% } %>">
|
|
|
- <% if (hadMap === 1) { %>
|
|
|
- <div class="card-body" id="map" style="height: 388px; width: 100%;"></div>
|
|
|
- <% } else if (hadMap === 2) { %>
|
|
|
+ <% if (hadMap === 2) { %>
|
|
|
<div style="position:relative;height: 388px; width: 100%;">
|
|
|
<% if (map_pic) { %>
|
|
|
<% if (!ctx.tender.info.display.dayMode) { %>
|
|
@@ -395,7 +393,7 @@
|
|
|
<!--期进度表-->
|
|
|
<div class="col-6">
|
|
|
<div class="card mb-3 <% if (!ctx.tender.info.display.dayMode) { %>bg-dark text-white<% } %> bottom-height">
|
|
|
- <% if (hadMap === 1 || hadMap === 2) { %>
|
|
|
+ <% if (hadMap === 2) { %>
|
|
|
<div class="card-header"><h6 class="mb-0">章节计量情况表</h6></div>
|
|
|
<div class="card-body">
|
|
|
<div id="jlchart3" style="height: 300px; width: 100%;"></div>
|
|
@@ -411,7 +409,7 @@
|
|
|
<!--月进度表-->
|
|
|
<div class="col-6 pl-0">
|
|
|
<div class="card mb-3 bottom-height <% if (!ctx.tender.info.display.dayMode) { %>bg-dark text-white<% } %>">
|
|
|
- <% if (hadMap === 1 || hadMap === 2) { %>
|
|
|
+ <% if (hadMap === 2) { %>
|
|
|
<div class="card-header">
|
|
|
<ul class="nav nav-tabs card-header-tabs panel-card-tabs <% if (ctx.tender.info.display.dayMode) { %>nav-white-tabs<% } %>" id="change-echarts">
|
|
|
<li class="nav-item">
|
|
@@ -1501,134 +1499,3 @@
|
|
|
};
|
|
|
})
|
|
|
</script>
|
|
|
-<% if (hadMap === 1 || ctx.session.sessionUser.is_admin) { %>
|
|
|
- <script src="/public/js/map/turf.min.js"></script>
|
|
|
- <script src="/public/js/map/gcoord.js"></script>
|
|
|
- <script>
|
|
|
- const tenderMapList = JSON.parse(unescape('<%- escape(JSON.stringify(tenderMapList)) %>'));
|
|
|
- </script>
|
|
|
-<% } %>
|
|
|
-<% if (hadMap === 1) { %>
|
|
|
- <!--<script src="//bj.bcebos.com/v1/mapopen/api-demos/js/mapStyle.js"></script>-->
|
|
|
- <script type="text/javascript" src="https://api.map.baidu.com/api?v=1.0&type=webgl&ak=C3hLZAjuWTaCdwnwoYY83APrwlPEj4v7"></script>
|
|
|
- <script type="text/javascript">
|
|
|
- // 画线
|
|
|
- $(function () {
|
|
|
- const map = new BMapGL.Map("map");
|
|
|
- // 创建地图实例
|
|
|
-
|
|
|
- const polyLineList = [];
|
|
|
- const centerPoint = { lng: <%- map_json.lng %>, lat: <%- map_json.lat %> };
|
|
|
- let level = <%- map_json.level %>;
|
|
|
- const pointList = [];
|
|
|
- const centerList = [];
|
|
|
- for (const tm of tenderMapList) {
|
|
|
- if (tm.map_json) {
|
|
|
- const map_json = JSON.parse(unescape(escape(tm.map_json)));
|
|
|
- const lngLatList = [];
|
|
|
- for (const mj of map_json) {
|
|
|
- const result = gcoord.transform([mj.lng, mj.lat], gcoord.WGS84, gcoord.BD09);
|
|
|
- lngLatList.push(new BMapGL.Point(result[0], result[1]));
|
|
|
- }
|
|
|
- polyLineList.push({
|
|
|
- map: lngLatList,
|
|
|
- color: tm.color,
|
|
|
- });
|
|
|
- const center = JSON.parse(tm.center);
|
|
|
- pointList.push(turf.point([center.lng, center.lat]));
|
|
|
- if (tm.tips) {
|
|
|
- const centerResult = gcoord.transform([map_json[Math.floor(map_json.length/2)].lng, map_json[Math.floor(map_json.length/2)].lat], gcoord.WGS84, gcoord.BD09);
|
|
|
- centerList.push({ map: new BMapGL.Point(centerResult[0], centerResult[1]), color: tm.color, tips: tm.tips });
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (pointList.length > 0) {
|
|
|
- let maxDistance = 0;
|
|
|
- // 中心点计算
|
|
|
- const features = turf.featureCollection(pointList);
|
|
|
- const center = turf.center(features);
|
|
|
- if (center && center.geometry && center.geometry.coordinates && center.geometry.coordinates.length === 2) {
|
|
|
- centerPoint.lng = _.round(center.geometry.coordinates[0], 4);
|
|
|
- centerPoint.lat = _.round(center.geometry.coordinates[1], 4);
|
|
|
- }
|
|
|
- // 地图级别计算
|
|
|
- if (pointList.length === 1) {
|
|
|
- // 只有一条路线
|
|
|
- const map_json = JSON.parse(unescape(escape(tenderMapList[0].map_json)));
|
|
|
- for (const mj of map_json) {
|
|
|
- const distance = turf.distance(turf.point([mj.lng, mj.lat]), turf.point([centerPoint.lng, centerPoint.lat]));
|
|
|
- if (distance > maxDistance) {
|
|
|
- maxDistance = distance;
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- for (const c of pointList) {
|
|
|
- const distance = turf.distance(c, turf.point([centerPoint.lng, centerPoint.lat]));
|
|
|
- if (distance > maxDistance) {
|
|
|
- maxDistance = distance;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (maxDistance === 0) {
|
|
|
- level = 15;
|
|
|
- } else {
|
|
|
- // 级别区间
|
|
|
- // const range = [0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 25, 50, 100, 200, 500, 1000, 2000, 5000, 10000];
|
|
|
- const range = [10000, 5000, 2000, 1000, 500, 200, 100, 50, 25, 20, 10, 5, 2, 1, 0.5, 0.2, 0.1, 0.05, 0.02];
|
|
|
- level = _.findIndex(range, function (item) {
|
|
|
- return item <= maxDistance;
|
|
|
- })
|
|
|
- level = level + 1;
|
|
|
- }
|
|
|
- const result = gcoord.transform([centerPoint.lng, centerPoint.lat], gcoord.WGS84, gcoord.BD09);
|
|
|
- centerPoint.lng = result[0];
|
|
|
- centerPoint.lat = result[1];
|
|
|
-
|
|
|
- }
|
|
|
- // 初始化地图,设置中心点坐标和地图级别
|
|
|
- const point = new BMapGL.Point(centerPoint.lng, centerPoint.lat);
|
|
|
- map.centerAndZoom(point, level);
|
|
|
- // const LocationControl = new BMapGL.LocationControl(); // 添加比例尺控件
|
|
|
- // map.addControl(LocationControl);
|
|
|
- map.enableScrollWheelZoom(true);
|
|
|
- <% if (!ctx.tender.info.display.dayMode) { %>
|
|
|
- map.setMapStyleV2({styleId: '20d4aea41cf71387395f2dc835f1c4b6'});
|
|
|
- <% } %>
|
|
|
- if (polyLineList.length > 0) {
|
|
|
- for (const pl of polyLineList) {
|
|
|
- const polyline = new BMapGL.Polyline(pl.map, {strokeColor: pl.color, strokeWeight:10, strokeOpacity:1});
|
|
|
- map.addOverlay(polyline);
|
|
|
- }
|
|
|
- }
|
|
|
- if (centerList.length > 0) {
|
|
|
- for (const cl of centerList) {
|
|
|
- const opts = {
|
|
|
- position : cl.map, // 指定文本标注所在的地理位置
|
|
|
- offset : new BMapGL.Size(5, 0) //设置文本偏移量
|
|
|
- }
|
|
|
- const label = new BMapGL.Label(cl.tips, opts); // 创建文本标注对象
|
|
|
- label.setStyle({
|
|
|
- height: '18px',
|
|
|
- lineHeight : '18px',
|
|
|
- color : cl.color,
|
|
|
- borderRadius: '5px',
|
|
|
- borderColor: cl.color,
|
|
|
- padding: '0px 5px',
|
|
|
- fontSize : '12px',
|
|
|
- // fontFamily: '微软雅黑',
|
|
|
- });
|
|
|
- map.addOverlay(label);
|
|
|
- // const opts = {
|
|
|
- // width: 0,
|
|
|
- // height: 0,
|
|
|
- // maxwidth: 220,
|
|
|
- // title: '路线标注:',
|
|
|
- // };
|
|
|
- // const infoWindow = new BMapGL.InfoWindow(cl.tips, opts);
|
|
|
- // map.openInfoWindow(infoWindow, cl.map);
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- </script>
|
|
|
-<% } %>
|