完成签约之后直接添加人员,录入下发凭证
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

4149 lines
131 KiB

  1. webpackJsonp([5],{
  2. /***/ "/nO3":
  3. /***/ (function(module, exports, __webpack_require__) {
  4. module.exports = __webpack_require__.p + "static/img/alert.f2fea34.png";
  5. /***/ }),
  6. /***/ "/ydS":
  7. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8. "use strict";
  9. /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__base_mixins_common_js__ = __webpack_require__("9LO+");
  10. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__base_factory_js__ = __webpack_require__("Brla");
  11. /* harmony default export */ __webpack_exports__["a"] = ({
  12. name: 'bm-navigation',
  13. render: function render() {},
  14. mixins: [Object(__WEBPACK_IMPORTED_MODULE_0__base_mixins_common_js__["a" /* default */])('control')],
  15. props: {
  16. anchor: {
  17. type: String
  18. },
  19. offset: {
  20. type: Object
  21. },
  22. type: {
  23. type: String
  24. },
  25. showZoomInfo: {
  26. type: Boolean
  27. },
  28. enableGeolocation: {
  29. type: Boolean,
  30. default: false
  31. }
  32. },
  33. watch: {
  34. anchor: function anchor() {
  35. this.reload();
  36. },
  37. offset: function offset() {
  38. this.reload();
  39. },
  40. type: function type() {
  41. this.reload();
  42. },
  43. showZoomInfo: function showZoomInfo() {
  44. this.reload();
  45. }
  46. },
  47. methods: {
  48. load: function load() {
  49. var BMap = this.BMap,
  50. map = this.map,
  51. anchor = this.anchor,
  52. offset = this.offset,
  53. type = this.type,
  54. showZoomInfo = this.showZoomInfo,
  55. enableGeolocation = this.enableGeolocation;
  56. this.originInstance = new BMap.NavigationControl({
  57. anchor: global[anchor],
  58. offset: offset && Object(__WEBPACK_IMPORTED_MODULE_1__base_factory_js__["d" /* createSize */])(BMap, offset),
  59. type: global[type],
  60. showZoomInfo: showZoomInfo,
  61. enableGeolocation: enableGeolocation
  62. });
  63. map.addControl(this.originInstance);
  64. }
  65. }
  66. });
  67. /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__("DuR2")))
  68. /***/ }),
  69. /***/ "3tqA":
  70. /***/ (function(module, exports, __webpack_require__) {
  71. /* WEBPACK VAR INJECTION */(function(global) {var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
  72. true ? module.exports = factory() :
  73. typeof define === 'function' && define.amd ? define(factory) :
  74. (global.BMapLib = global.BMapLib || {}, global.BMapLib.MarkerClusterer = factory());
  75. }(this, (function () { 'use strict';
  76. var __commonjs_global = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : this;
  77. function __commonjs(fn, module) { return module = { exports: {} }, fn(module, module.exports, __commonjs_global), module.exports; }
  78. var index$1 = __commonjs(function (module, exports, global) {
  79. (function (root, factory) {
  80. if (typeof exports === 'object') {
  81. module.exports = factory();
  82. } else if (true) {
  83. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  84. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  85. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  86. __WEBPACK_AMD_DEFINE_FACTORY__),
  87. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  88. } else {
  89. root.BMapLib = root.BMapLib || {};
  90. root.BMapLib.TextIconOverlay = root.BMapLib.TextIconOverlay || factory();
  91. }
  92. })(__commonjs_global, function() {
  93. var T,
  94. baidu = T = baidu || {version: "1.3.8"};
  95. var context = {};
  96. //提出guid,防止在与老版本Tangram混用时
  97. //在下一行错误的修改context[undefined]
  98. baidu.guid = "$BAIDU$";
  99. //Tangram可能被放在闭包中
  100. //一些页面级别唯一的属性,需要挂载在context[baidu.guid]上
  101. context[baidu.guid] = context[baidu.guid] || {};
  102. /**
  103. * @ignore
  104. * @namespace baidu.dom 操作dom的方法
  105. */
  106. baidu.dom = baidu.dom || {};
  107. /**
  108. * 从文档中获取指定的DOM元素
  109. * @name baidu.dom.g
  110. * @function
  111. * @grammar baidu.dom.g(id)
  112. * @param {string|HTMLElement} id 元素的id或DOM元素
  113. * @shortcut g,T.G
  114. * @meta standard
  115. * @see baidu.dom.q
  116. *
  117. * @returns {HTMLElement|null} 获取的元素查找不到时返回null,如果参数不合法直接返回参数
  118. */
  119. baidu.dom.g = function (id) {
  120. if ('string' == typeof id || id instanceof String) {
  121. return document.getElementById(id);
  122. } else if (id && id.nodeName && (id.nodeType == 1 || id.nodeType == 9)) {
  123. return id;
  124. }
  125. return null;
  126. };
  127. // 声明快捷方法
  128. baidu.g = baidu.G = baidu.dom.g;
  129. /**
  130. * 获取目标元素所属的document对象
  131. * @name baidu.dom.getDocument
  132. * @function
  133. * @grammar baidu.dom.getDocument(element)
  134. * @param {HTMLElement|string} element 目标元素或目标元素的id
  135. * @meta standard
  136. * @see baidu.dom.getWindow
  137. *
  138. * @returns {HTMLDocument} 目标元素所属的document对象
  139. */
  140. baidu.dom.getDocument = function (element) {
  141. element = baidu.dom.g(element);
  142. return element.nodeType == 9 ? element : element.ownerDocument || element.document;
  143. };
  144. /**
  145. * @ignore
  146. * @namespace baidu.lang 对语言层面的封装包括类型判断模块扩展继承基类以及对象自定义事件的支持
  147. */
  148. baidu.lang = baidu.lang || {};
  149. /**
  150. * 判断目标参数是否string类型或String对象
  151. * @name baidu.lang.isString
  152. * @function
  153. * @grammar baidu.lang.isString(source)
  154. * @param {Any} source 目标参数
  155. * @shortcut isString
  156. * @meta standard
  157. * @see baidu.lang.isObject,baidu.lang.isNumber,baidu.lang.isArray,baidu.lang.isElement,baidu.lang.isBoolean,baidu.lang.isDate
  158. *
  159. * @returns {boolean} 类型判断结果
  160. */
  161. baidu.lang.isString = function (source) {
  162. return '[object String]' == Object.prototype.toString.call(source);
  163. };
  164. // 声明快捷方法
  165. baidu.isString = baidu.lang.isString;
  166. /**
  167. * 从文档中获取指定的DOM元素
  168. * **内部方法**
  169. *
  170. * @param {string|HTMLElement} id 元素的id或DOM元素
  171. * @meta standard
  172. * @return {HTMLElement} DOM元素如果不存在返回null如果参数不合法直接返回参数
  173. */
  174. baidu.dom._g = function (id) {
  175. if (baidu.lang.isString(id)) {
  176. return document.getElementById(id);
  177. }
  178. return id;
  179. };
  180. // 声明快捷方法
  181. baidu._g = baidu.dom._g;
  182. /**
  183. * @ignore
  184. * @namespace baidu.browser 判断浏览器类型和特性的属性
  185. */
  186. baidu.browser = baidu.browser || {};
  187. if (/msie (\d+\.\d)/i.test(navigator.userAgent)) {
  188. //IE 8下,以documentMode为准
  189. //在百度模板中,可能会有$,防止冲突,将$1 写成 \x241
  190. /**
  191. * 判断是否为ie浏览器
  192. * @property ie ie版本号
  193. * @grammar baidu.browser.ie
  194. * @meta standard
  195. * @shortcut ie
  196. * @see baidu.browser.firefox,baidu.browser.safari,baidu.browser.opera,baidu.browser.chrome,baidu.browser.maxthon
  197. */
  198. baidu.browser.ie = baidu.ie = document.documentMode || + RegExp['\x241'];
  199. }
  200. /**
  201. * 获取目标元素的computed style值如果元素的样式值不能被浏览器计算则会返回空字符串IE
  202. *
  203. * @author berg
  204. * @name baidu.dom.getComputedStyle
  205. * @function
  206. * @grammar baidu.dom.getComputedStyle(element, key)
  207. * @param {HTMLElement|string} element 目标元素或目标元素的id
  208. * @param {string} key 要获取的样式名
  209. *
  210. * @see baidu.dom.getStyle
  211. *
  212. * @returns {string} 目标元素的computed style值
  213. */
  214. baidu.dom.getComputedStyle = function(element, key){
  215. element = baidu.dom._g(element);
  216. var doc = baidu.dom.getDocument(element),
  217. styles;
  218. if (doc.defaultView && doc.defaultView.getComputedStyle) {
  219. styles = doc.defaultView.getComputedStyle(element, null);
  220. if (styles) {
  221. return styles[key] || styles.getPropertyValue(key);
  222. }
  223. }
  224. return '';
  225. };
  226. /**
  227. * 提供给setStyle与getStyle使用
  228. */
  229. baidu.dom._styleFixer = baidu.dom._styleFixer || {};
  230. /**
  231. * 提供给setStyle与getStyle使用
  232. */
  233. baidu.dom._styleFilter = baidu.dom._styleFilter || [];
  234. /**
  235. * 为获取和设置样式的过滤器
  236. * @private
  237. * @meta standard
  238. */
  239. baidu.dom._styleFilter.filter = function (key, value, method) {
  240. for (var i = 0, filters = baidu.dom._styleFilter, filter; filter = filters[i]; i++) {
  241. if (filter = filter[method]) {
  242. value = filter(key, value);
  243. }
  244. }
  245. return value;
  246. };
  247. /**
  248. * @ignore
  249. * @namespace baidu.string 操作字符串的方法
  250. */
  251. baidu.string = baidu.string || {};
  252. /**
  253. * 将目标字符串进行驼峰化处理
  254. * @name baidu.string.toCamelCase
  255. * @function
  256. * @grammar baidu.string.toCamelCase(source)
  257. * @param {string} source 目标字符串
  258. * @remark
  259. * 支持单词以-_分隔
  260. * @meta standard
  261. *
  262. * @returns {string} 驼峰化处理后的字符串
  263. */
  264. baidu.string.toCamelCase = function (source) {
  265. //提前判断,提高getStyle等的效率 thanks xianwei
  266. if (source.indexOf('-') < 0 && source.indexOf('_') < 0) {
  267. return source;
  268. }
  269. return source.replace(/[-_][^-_]/g, function (match) {
  270. return match.charAt(1).toUpperCase();
  271. });
  272. };
  273. /**
  274. * 获取目标元素的样式值
  275. * @name baidu.dom.getStyle
  276. * @function
  277. * @grammar baidu.dom.getStyle(element, key)
  278. * @param {HTMLElement|string} element 目标元素或目标元素的id
  279. * @param {string} key 要获取的样式名
  280. * @remark
  281. *
  282. * 为了精简代码本模块默认不对任何浏览器返回值进行归一化处理如使用getStyle时不同浏览器下可能返回rgb颜色或hex颜色也不会修复浏览器的bug和差异性如设置IE的float属性叫styleFloatfirefox则是cssFloat<br />
  283. * baidu.dom._styleFixer和baidu.dom._styleFilter可以为本模块提供支持<br />
  284. * 其中_styleFilter能对颜色和px进行归一化处理_styleFixer能对displayfloatopacitytextOverflow的浏览器兼容性bug进行处理
  285. * @shortcut getStyle
  286. * @meta standard
  287. * @see baidu.dom.setStyle,baidu.dom.setStyles, baidu.dom.getComputedStyle
  288. *
  289. * @returns {string} 目标元素的样式值
  290. */
  291. baidu.dom.getStyle = function (element, key) {
  292. var dom = baidu.dom;
  293. element = dom.g(element);
  294. key = baidu.string.toCamelCase(key);
  295. //computed style, then cascaded style, then explicitly set style.
  296. var value = element.style[key] ||
  297. (element.currentStyle ? element.currentStyle[key] : "") ||
  298. dom.getComputedStyle(element, key);
  299. // 在取不到值的时候,用fixer进行修正
  300. if (!value) {
  301. var fixer = dom._styleFixer[key];
  302. if(fixer){
  303. value = fixer.get ? fixer.get(element) : baidu.dom.getStyle(element, fixer);
  304. }
  305. }
  306. /* 检查结果过滤器 */
  307. if (fixer = dom._styleFilter) {
  308. value = fixer.filter(key, value, 'get');
  309. }
  310. return value;
  311. };
  312. // 声明快捷方法
  313. baidu.getStyle = baidu.dom.getStyle;
  314. if (/opera\/(\d+\.\d)/i.test(navigator.userAgent)) {
  315. /**
  316. * 判断是否为opera浏览器
  317. * @property opera opera版本号
  318. * @grammar baidu.browser.opera
  319. * @meta standard
  320. * @see baidu.browser.ie,baidu.browser.firefox,baidu.browser.safari,baidu.browser.chrome
  321. */
  322. baidu.browser.opera = + RegExp['\x241'];
  323. }
  324. /**
  325. * 判断是否为webkit内核
  326. * @property isWebkit
  327. * @grammar baidu.browser.isWebkit
  328. * @meta standard
  329. * @see baidu.browser.isGecko
  330. */
  331. baidu.browser.isWebkit = /webkit/i.test(navigator.userAgent);
  332. /**
  333. * 判断是否为gecko内核
  334. * @property isGecko
  335. * @grammar baidu.browser.isGecko
  336. * @meta standard
  337. * @see baidu.browser.isWebkit
  338. */
  339. baidu.browser.isGecko = /gecko/i.test(navigator.userAgent) && !/like gecko/i.test(navigator.userAgent);
  340. /**
  341. * 判断是否严格标准的渲染模式
  342. * @property isStrict
  343. * @grammar baidu.browser.isStrict
  344. * @meta standard
  345. */
  346. baidu.browser.isStrict = document.compatMode == "CSS1Compat";
  347. /**
  348. * 获取目标元素相对于整个文档左上角的位置
  349. * @name baidu.dom.getPosition
  350. * @function
  351. * @grammar baidu.dom.getPosition(element)
  352. * @param {HTMLElement|string} element 目标元素或目标元素的id
  353. * @meta standard
  354. *
  355. * @returns {Object} 目标元素的位置键值为top和left的Object
  356. */
  357. baidu.dom.getPosition = function (element) {
  358. element = baidu.dom.g(element);
  359. var doc = baidu.dom.getDocument(element),
  360. browser = baidu.browser,
  361. getStyle = baidu.dom.getStyle,
  362. // Gecko 1.9版本以下用getBoxObjectFor计算位置
  363. // 但是某些情况下是有bug的
  364. // 对于这些有bug的情况
  365. // 使用递归查找的方式
  366. BUGGY_GECKO_BOX_OBJECT = browser.isGecko > 0 &&
  367. doc.getBoxObjectFor &&
  368. getStyle(element, 'position') == 'absolute' &&
  369. (element.style.top === '' || element.style.left === ''),
  370. pos = {"left":0,"top":0},
  371. viewport = (browser.ie && !browser.isStrict) ? doc.body : doc.documentElement,
  372. parent,
  373. box;
  374. if(element == viewport){
  375. return pos;
  376. }
  377. if(element.getBoundingClientRect){ // IE and Gecko 1.9+
  378. //当HTML或者BODY有border width时, 原生的getBoundingClientRect返回值是不符合预期的
  379. //考虑到通常情况下 HTML和BODY的border只会设成0px,所以忽略该问题.
  380. box = element.getBoundingClientRect();
  381. pos.left = Math.floor(box.left) + Math.max(doc.documentElement.scrollLeft, doc.body.scrollLeft);
  382. pos.top = Math.floor(box.top) + Math.max(doc.documentElement.scrollTop, doc.body.scrollTop);
  383. // IE会给HTML元素添加一个border,默认是medium(2px)
  384. // 但是在IE 6 7 的怪异模式下,可以被html { border: 0; } 这条css规则覆盖
  385. // 在IE7的标准模式下,border永远是2px,这个值通过clientLeft 和 clientTop取得
  386. // 但是。。。在IE 6 7的怪异模式,如果用户使用css覆盖了默认的medium
  387. // clientTop和clientLeft不会更新
  388. pos.left -= doc.documentElement.clientLeft;
  389. pos.top -= doc.documentElement.clientTop;
  390. var htmlDom = doc.body,
  391. // 在这里,不使用element.style.borderLeftWidth,只有computedStyle是可信的
  392. htmlBorderLeftWidth = parseInt(getStyle(htmlDom, 'borderLeftWidth')),
  393. htmlBorderTopWidth = parseInt(getStyle(htmlDom, 'borderTopWidth'));
  394. if(browser.ie && !browser.isStrict){
  395. pos.left -= isNaN(htmlBorderLeftWidth) ? 2 : htmlBorderLeftWidth;
  396. pos.top -= isNaN(htmlBorderTopWidth) ? 2 : htmlBorderTopWidth;
  397. }
  398. } else {
  399. // safari/opera/firefox
  400. parent = element;
  401. do {
  402. pos.left += parent.offsetLeft;
  403. pos.top += parent.offsetTop;
  404. // safari里面,如果遍历到了一个fixed的元素,后面的offset都不准了
  405. if (browser.isWebkit > 0 && getStyle(parent, 'position') == 'fixed') {
  406. pos.left += doc.body.scrollLeft;
  407. pos.top += doc.body.scrollTop;
  408. break;
  409. }
  410. parent = parent.offsetParent;
  411. } while (parent && parent != element);
  412. // 对body offsetTop的修正
  413. if(browser.opera > 0 || (browser.isWebkit > 0 && getStyle(element, 'position') == 'absolute')){
  414. pos.top -= doc.body.offsetTop;
  415. }
  416. // 计算除了body的scroll
  417. parent = element.offsetParent;
  418. while (parent && parent != doc.body) {
  419. pos.left -= parent.scrollLeft;
  420. // see https://bugs.opera.com/show_bug.cgi?id=249965
  421. if (!browser.opera || parent.tagName != 'TR') {
  422. pos.top -= parent.scrollTop;
  423. }
  424. parent = parent.offsetParent;
  425. }
  426. }
  427. return pos;
  428. };
  429. /**
  430. * @ignore
  431. * @namespace baidu.event 屏蔽浏览器差异性的事件封装
  432. * @property target 事件的触发元素
  433. * @property pageX 鼠标事件的鼠标x坐标
  434. * @property pageY 鼠标事件的鼠标y坐标
  435. * @property keyCode 键盘事件的键值
  436. */
  437. baidu.event = baidu.event || {};
  438. /**
  439. * 事件监听器的存储表
  440. * @private
  441. * @meta standard
  442. */
  443. baidu.event._listeners = baidu.event._listeners || [];
  444. /**
  445. * 为目标元素添加事件监听器
  446. * @name baidu.event.on
  447. * @function
  448. * @grammar baidu.event.on(element, type, listener)
  449. * @param {HTMLElement|string|window} element 目标元素或目标元素id
  450. * @param {string} type 事件类型
  451. * @param {Function} listener 需要添加的监听器
  452. * @remark
  453. *
  454. 1. 不支持跨浏览器的鼠标滚轮事件监听器添加<br>
  455. 2. 改方法不为监听器灌入事件对象以防止跨iframe事件挂载的事件对象获取失败
  456. * @shortcut on
  457. * @meta standard
  458. * @see baidu.event.un
  459. *
  460. * @returns {HTMLElement|window} 目标元素
  461. */
  462. baidu.event.on = function (element, type, listener) {
  463. type = type.replace(/^on/i, '');
  464. element = baidu.dom._g(element);
  465. var realListener = function (ev) {
  466. // 1. 这里不支持EventArgument, 原因是跨frame的事件挂载
  467. // 2. element是为了修正this
  468. listener.call(element, ev);
  469. },
  470. lis = baidu.event._listeners,
  471. filter = baidu.event._eventFilter,
  472. afterFilter,
  473. realType = type;
  474. type = type.toLowerCase();
  475. // filter过滤
  476. if(filter && filter[type]){
  477. afterFilter = filter[type](element, type, realListener);
  478. realType = afterFilter.type;
  479. realListener = afterFilter.listener;
  480. }
  481. // 事件监听器挂载
  482. if (element.addEventListener) {
  483. element.addEventListener(realType, realListener, false);
  484. } else if (element.attachEvent) {
  485. element.attachEvent('on' + realType, realListener);
  486. }
  487. // 将监听器存储到数组中
  488. lis[lis.length] = [element, type, listener, realListener, realType];
  489. return element;
  490. };
  491. // 声明快捷方法
  492. baidu.on = baidu.event.on;
  493. /**
  494. * 返回一个当前页面的唯一标识字符串
  495. * @name baidu.lang.guid
  496. * @function
  497. * @grammar baidu.lang.guid()
  498. * @version 1.1.1
  499. * @meta standard
  500. *
  501. * @returns {String} 当前页面的唯一标识字符串
  502. */
  503. (function(){
  504. //不直接使用window,可以提高3倍左右性能
  505. var guid = context[baidu.guid];
  506. baidu.lang.guid = function() {
  507. return "TANGRAM__" + (guid._counter ++).toString(36);
  508. };
  509. guid._counter = guid._counter || 1;
  510. })();
  511. /**
  512. * 所有类的实例的容器
  513. * key为每个实例的guid
  514. * @meta standard
  515. */
  516. context[baidu.guid]._instances = context[baidu.guid]._instances || {};
  517. /**
  518. * 判断目标参数是否为function或Function实例
  519. * @name baidu.lang.isFunction
  520. * @function
  521. * @grammar baidu.lang.isFunction(source)
  522. * @param {Any} source 目标参数
  523. * @version 1.2
  524. * @see baidu.lang.isString,baidu.lang.isObject,baidu.lang.isNumber,baidu.lang.isArray,baidu.lang.isElement,baidu.lang.isBoolean,baidu.lang.isDate
  525. * @meta standard
  526. * @returns {boolean} 类型判断结果
  527. */
  528. baidu.lang.isFunction = function (source) {
  529. // chrome下,'function' == typeof /a/ 为true.
  530. return '[object Function]' == Object.prototype.toString.call(source);
  531. };
  532. /**
  533. *
  534. * @ignore
  535. * @class Tangram继承机制提供的一个基类用户可以通过继承baidu.lang.Class来获取它的属性及方法
  536. * @name baidu.lang.Class
  537. * @grammar baidu.lang.Class(guid)
  538. * @param {string} guid 对象的唯一标识
  539. * @meta standard
  540. * @remark baidu.lang.Class和它的子类的实例均包含一个全局唯一的标识guidguid是在构造函数中生成的因此继承自baidu.lang.Class的类应该直接或者间接调用它的构造函数<br>baidu.lang.Class的构造函数中产生guid的方式可以保证guid的唯一性及每个实例都有一个全局唯一的guid
  541. * @meta standard
  542. * @see baidu.lang.inherits,baidu.lang.Event
  543. */
  544. baidu.lang.Class = function(guid) {
  545. this.guid = guid || baidu.lang.guid();
  546. context[baidu.guid]._instances[this.guid] = this;
  547. };
  548. context[baidu.guid]._instances = context[baidu.guid]._instances || {};
  549. /**
  550. * 释放对象所持有的资源主要是自定义事件
  551. * @name dispose
  552. * @grammar obj.dispose()
  553. */
  554. baidu.lang.Class.prototype.dispose = function(){
  555. delete context[baidu.guid]._instances[this.guid];
  556. for(var property in this){
  557. if (!baidu.lang.isFunction(this[property])) {
  558. delete this[property];
  559. }
  560. }
  561. this.disposed = true;
  562. };
  563. /**
  564. * 重载了默认的toString方法使得返回信息更加准确一些
  565. * @return {string} 对象的String表示形式
  566. */
  567. baidu.lang.Class.prototype.toString = function(){
  568. return "[object " + (this._className || "Object" ) + "]";
  569. };
  570. /**
  571. * @ignore
  572. * @class 自定义的事件对象
  573. * @name baidu.lang.Event
  574. * @grammar baidu.lang.Event(type[, target])
  575. * @param {string} type 事件类型名称为了方便区分事件和一个普通的方法事件类型名称必须以"on"(小写)开头
  576. * @param {Object} [target]触发事件的对象
  577. * @meta standard
  578. * @remark 引入该模块会自动为Class引入3个事件扩展方法addEventListenerremoveEventListener和dispatchEvent
  579. * @meta standard
  580. * @see baidu.lang.Class
  581. */
  582. baidu.lang.Event = function (type, target) {
  583. this.type = type;
  584. this.returnValue = true;
  585. this.target = target || null;
  586. this.currentTarget = null;
  587. };
  588. /**
  589. * 注册对象的事件监听器引入baidu.lang.Event后Class的子类实例才会获得该方法
  590. * @grammar obj.addEventListener(type, handler[, key])
  591. * @param {string} type 自定义事件的名称
  592. * @param {Function} handler 自定义事件被触发时应该调用的回调函数
  593. * @param {string} [key] 为事件监听函数指定的名称可在移除时使用如果不提供方法会默认为它生成一个全局唯一的key
  594. * @remark 事件类型区分大小写如果自定义事件名称不是以小写"on"开头该方法会给它加上"on"再进行判断"click""onclick"会被认为是同一种事件
  595. */
  596. baidu.lang.Class.prototype.addEventListener = function (type, handler, key) {
  597. if (!baidu.lang.isFunction(handler)) {
  598. return;
  599. }
  600. !this.__listeners && (this.__listeners = {});
  601. var t = this.__listeners, id;
  602. if (typeof key == "string" && key) {
  603. if (/[^\w\-]/.test(key)) {
  604. throw("nonstandard key:" + key);
  605. } else {
  606. handler.hashCode = key;
  607. id = key;
  608. }
  609. }
  610. type.indexOf("on") != 0 && (type = "on" + type);
  611. typeof t[type] != "object" && (t[type] = {});
  612. id = id || baidu.lang.guid();
  613. handler.hashCode = id;
  614. t[type][id] = handler;
  615. };
  616. /**
  617. * 移除对象的事件监听器引入baidu.lang.Event后Class的子类实例才会获得该方法
  618. * @grammar obj.removeEventListener(type, handler)
  619. * @param {string} type 事件类型
  620. * @param {Function|string} handler 要移除的事件监听函数或者监听函数的key
  621. * @remark 如果第二个参数handler没有被绑定到对应的自定义事件中什么也不做
  622. */
  623. baidu.lang.Class.prototype.removeEventListener = function (type, handler) {
  624. if (typeof handler != "undefined") {
  625. if ( (baidu.lang.isFunction(handler) && ! (handler = handler.hashCode))
  626. || (! baidu.lang.isString(handler))
  627. ){
  628. return;
  629. }
  630. }
  631. !this.__listeners && (this.__listeners = {});
  632. type.indexOf("on") != 0 && (type = "on" + type);
  633. var t = this.__listeners;
  634. if (!t[type]) {
  635. return;
  636. }
  637. if (typeof handler != "undefined") {
  638. t[type][handler] && delete t[type][handler];
  639. } else {
  640. for(var guid in t[type]){
  641. delete t[type][guid];
  642. }
  643. }
  644. };
  645. /**
  646. * 派发自定义事件使得绑定到自定义事件上面的函数都会被执行引入baidu.lang.Event后Class的子类实例才会获得该方法
  647. * @grammar obj.dispatchEvent(event, options)
  648. * @param {baidu.lang.Event|String} event Event对象或事件名称(1.1.1起支持)
  649. * @param {Object} options 扩展参数,所含属性键值会扩展到Event对象上(1.2起支持)
  650. * @remark 处理会调用通过addEventListenr绑定的自定义事件回调函数之外还会调用直接绑定到对象上面的自定义事件例如<br>
  651. myobj.onMyEvent = function(){}<br>
  652. myobj.addEventListener("onMyEvent", function(){});
  653. */
  654. baidu.lang.Class.prototype.dispatchEvent = function (event, options) {
  655. if (baidu.lang.isString(event)) {
  656. event = new baidu.lang.Event(event);
  657. }
  658. !this.__listeners && (this.__listeners = {});
  659. // 20100603 添加本方法的第二个参数,将 options extend到event中去传递
  660. options = options || {};
  661. for (var i in options) {
  662. event[i] = options[i];
  663. }
  664. var i, t = this.__listeners, p = event.type;
  665. event.target = event.target || this;
  666. event.currentTarget = this;
  667. p.indexOf("on") != 0 && (p = "on" + p);
  668. baidu.lang.isFunction(this[p]) && this[p].apply(this, arguments);
  669. if (typeof t[p] == "object") {
  670. for (i in t[p]) {
  671. t[p][i].apply(this, arguments);
  672. }
  673. }
  674. return event.returnValue;
  675. };
  676. baidu.lang.inherits = function (subClass, superClass, className) {
  677. var key, proto,
  678. selfProps = subClass.prototype,
  679. clazz = new Function();
  680. clazz.prototype = superClass.prototype;
  681. proto = subClass.prototype = new clazz();
  682. for (key in selfProps) {
  683. proto[key] = selfProps[key];
  684. }
  685. subClass.prototype.constructor = subClass;
  686. subClass.superClass = superClass.prototype;
  687. // 类名标识,兼容Class的toString,基本没用
  688. if ("string" == typeof className) {
  689. proto._className = className;
  690. }
  691. };
  692. // 声明快捷方法
  693. baidu.inherits = baidu.lang.inherits;
  694. /**
  695. * 图片的路径
  696. * @private
  697. * @type {String}
  698. */
  699. var _IMAGE_PATH = 'http://api.map.baidu.com/library/TextIconOverlay/1.2/src/images/m';
  700. /**
  701. * 图片的后缀名
  702. * @private
  703. * @type {String}
  704. */
  705. var _IMAGE_EXTENSION = 'png';
  706. /**
  707. *@exports TextIconOverlay as BMapLib.TextIconOverlay
  708. */
  709. /**
  710. * TextIconOverlay
  711. * @class 此类表示地图上的一个覆盖物该覆盖物由文字和图标组成从Overlay继承文字通常是数字0-9或字母A-Z 而文字与图标之间有一定的映射关系
  712. *该覆盖物适用于以下类似的场景需要在地图上添加一系列覆盖物这些覆盖物之间用不同的图标和文字来区分文字可能表示了该覆盖物的某一属性值根据该文字和一定的映射关系自动匹配相应颜色和大小的图标
  713. *
  714. *@constructor
  715. *@param {Point} position 表示一个经纬度坐标位置
  716. *@param {String} text 表示该覆盖物显示的文字信息
  717. *@param {Json Object} options 可选参数可选项包括<br />
  718. *"<b>styles</b>":{Array<IconStyle>} 一组图标风格单个图表风格包括以下几个属性<br />
  719. * url {String} 图片的url地址(必选)<br />
  720. * size {Size} 图片的大小必选<br />
  721. * anchor {Size} 图标定位在地图上的位置相对于图标左上角的偏移值默认偏移值为图标的中心位置可选<br />
  722. * offset {Size} 图片相对于可视区域的偏移值此功能的作用等同于CSS中的background-position属性可选<br />
  723. * textSize {Number} 文字的大小可选默认10<br />
  724. * textColor {String} 文字的颜色可选默认black<br />
  725. */
  726. var TextIconOverlay = function(position, text, options){
  727. try {
  728. BMap;
  729. } catch (e) {
  730. throw Error('Baidu Map JS API is not ready yet!');
  731. }
  732. T.lang.inherits(TextIconOverlay, BMap.Overlay, "TextIconOverlay");
  733. this._position = position;
  734. this._text = text;
  735. this._options = options || {};
  736. this._styles = this._options['styles'] || [];
  737. (!this._styles.length) && this._setupDefaultStyles();
  738. };
  739. TextIconOverlay.prototype._setupDefaultStyles = function(){
  740. var sizes = [53, 56, 66, 78, 90];
  741. for(var i = 0, size; size = sizes[i]; i++){
  742. this._styles.push({
  743. url:_IMAGE_PATH + i + '.' + _IMAGE_EXTENSION,
  744. size: new BMap.Size(size, size)
  745. });
  746. }//for循环的简洁写法
  747. };
  748. /**
  749. *继承Overlay的intialize方法自定义覆盖物时必须
  750. *@param {Map} map BMap.Map的实例化对象
  751. *@return {HTMLElement} 返回覆盖物对应的HTML元素
  752. */
  753. TextIconOverlay.prototype.initialize = function(map){
  754. this._map = map;
  755. this._domElement = document.createElement('div');
  756. this._updateCss();
  757. this._updateText();
  758. this._updatePosition();
  759. this._bind();
  760. this._map.getPanes().markerMouseTarget.appendChild(this._domElement);
  761. return this._domElement;
  762. };
  763. /**
  764. *继承Overlay的draw方法自定义覆盖物时必须
  765. *@return 无返回值
  766. */
  767. TextIconOverlay.prototype.draw = function(){
  768. this._map && this._updatePosition();
  769. };
  770. /**
  771. *获取该覆盖物上的文字
  772. *@return {String} 该覆盖物上的文字
  773. */
  774. TextIconOverlay.prototype.getText = function(){
  775. return this._text;
  776. };
  777. /**
  778. *设置该覆盖物上的文字
  779. *@param {String} text 要设置的文字通常是字母A-Z或数字0-9
  780. *@return 无返回值
  781. */
  782. TextIconOverlay.prototype.setText = function(text){
  783. if(text && (!this._text || (this._text.toString() != text.toString()))){
  784. this._text = text;
  785. this._updateText();
  786. this._updateCss();
  787. this._updatePosition();
  788. }
  789. };
  790. /**
  791. *获取该覆盖物的位置
  792. *@return {Point} 该覆盖物的经纬度坐标
  793. */
  794. TextIconOverlay.prototype.getPosition = function () {
  795. return this._position;
  796. };
  797. /**
  798. *设置该覆盖物的位置
  799. *@param {Point} position 要设置的经纬度坐标
  800. *@return 无返回值
  801. */
  802. TextIconOverlay.prototype.setPosition = function (position) {
  803. if(position && (!this._position || !this._position.equals(position))){
  804. this._position = position;
  805. this._updatePosition();
  806. }
  807. };
  808. /**
  809. *由文字信息获取风格数组的对应索引值
  810. *内部默认的对应函数为文字转换为数字除以10的结果比如文字8返回索引0文字25返回索引2.
  811. *如果需要自定义映射关系请覆盖该函数
  812. *@param {String} text 文字
  813. *@param {Array<IconStyle>} styles 一组图标风格
  814. *@return {Number} 对应的索引值
  815. */
  816. TextIconOverlay.prototype.getStyleByText = function(text, styles){
  817. var count = parseInt(text);
  818. var index = parseInt(count / 10);
  819. index = Math.max(0, index);
  820. index = Math.min(index, styles.length - 1);
  821. return styles[index];
  822. };
  823. /**
  824. *更新相应的CSS
  825. *@return 无返回值
  826. */
  827. TextIconOverlay.prototype._updateCss = function(){
  828. if (!this._domElement) {
  829. return
  830. }
  831. var style = this.getStyleByText(this._text, this._styles);
  832. this._domElement.style.cssText = this._buildCssText(style);
  833. };
  834. /**
  835. *更新覆盖物的显示文字
  836. *@return 无返回值
  837. */
  838. TextIconOverlay.prototype._updateText = function(){
  839. if (this._domElement) {
  840. this._domElement.innerHTML = this._text;
  841. }
  842. };
  843. /**
  844. *调整覆盖物在地图上的位置更新覆盖物的显示文字
  845. *@return 无返回值
  846. */
  847. TextIconOverlay.prototype._updatePosition = function(){
  848. if (this._domElement && this._position) {
  849. var style = this._domElement.style;
  850. var pixelPosition= this._map.pointToOverlayPixel(this._position);
  851. pixelPosition.x -= Math.ceil(parseInt(style.width) / 2);
  852. pixelPosition.y -= Math.ceil(parseInt(style.height) / 2);
  853. style.left = pixelPosition.x + "px";
  854. style.top = pixelPosition.y + "px";
  855. }
  856. };
  857. /**
  858. * 为该覆盖物的HTML元素构建CSS
  859. * @param {IconStyle} 一个图标的风格
  860. * @return {String} 构建完成的CSSTEXT
  861. */
  862. TextIconOverlay.prototype._buildCssText = function(style) {
  863. //根据style来确定一些默认值
  864. var url = style['url'];
  865. var size = style['size'];
  866. var anchor = style['anchor'];
  867. var offset = style['offset'];
  868. var textColor = style['textColor'] || 'black';
  869. var textSize = style['textSize'] || 10;
  870. var csstext = [];
  871. if (T.browser["ie"] < 7) {
  872. csstext.push('filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(' +
  873. 'sizingMethod=scale,src="' + url + '");');
  874. } else {
  875. csstext.push('background-image:url(' + url + ');');
  876. var backgroundPosition = '0 0';
  877. (offset instanceof BMap.Size) && (backgroundPosition = offset.width + 'px' + ' ' + offset.height + 'px');
  878. csstext.push('background-position:' + backgroundPosition + ';');
  879. }
  880. if (size instanceof BMap.Size){
  881. if (anchor instanceof BMap.Size) {
  882. if (anchor.height > 0 && anchor.height < size.height) {
  883. csstext.push('height:' + (size.height - anchor.height) + 'px; padding-top:' + anchor.height + 'px;');
  884. }
  885. if(anchor.width > 0 && anchor.width < size.width){
  886. csstext.push('width:' + (size.width - anchor.width) + 'px; padding-left:' + anchor.width + 'px;');
  887. }
  888. } else {
  889. csstext.push('height:' + size.height + 'px; line-height:' + size.height + 'px;');
  890. csstext.push('width:' + size.width + 'px; text-align:center;');
  891. }
  892. }
  893. csstext.push('cursor:pointer; color:' + textColor + '; position:absolute; font-size:' +
  894. textSize + 'px; font-family:Arial,sans-serif; font-weight:bold');
  895. return csstext.join('');
  896. };
  897. /**
  898. * 当鼠标点击该覆盖物时会触发该事件
  899. * @name TextIconOverlay#click
  900. * @event
  901. * @param {Event Object} e 回调函数会返回event参数包括以下返回值
  902. * <br />"<b>type</b> : {String}
  903. * <br />"<b>target</b>{BMapLib.TextIconOverlay}
  904. *
  905. */
  906. /**
  907. * 当鼠标进入该覆盖物区域时会触发该事件
  908. * @name TextIconOverlay#mouseover
  909. * @event
  910. * @param {Event Object} e 回调函数会返回event参数包括以下返回值
  911. * <br />"<b>type</b> : {String}
  912. * <br />"<b>target</b>{BMapLib.TextIconOverlay}
  913. * <br />"<b>point</b> : {BMap.Point} BMap.Point
  914. * <br />"<b>pixel</b>{BMap.pixel} BMap.Pixel
  915. *
  916. * @example <b>参考示例</b><br />
  917. * myTextIconOverlay.addEventListener("mouseover", function(e) { alert(e.point); });
  918. */
  919. /**
  920. * 当鼠标离开该覆盖物区域时会触发该事件
  921. * @name TextIconOverlay#mouseout
  922. * @event
  923. * @param {Event Object} e 回调函数会返回event参数包括以下返回值
  924. * <br />"<b>type</b> : {String}
  925. * <br />"<b>target</b>{BMapLib.TextIconOverlay}
  926. * <br />"<b>point</b> : {BMap.Point} BMap.Point
  927. * <br />"<b>pixel</b>{BMap.pixel} BMap.Pixel
  928. *
  929. * @example <b>参考示例</b><br />
  930. * myTextIconOverlay.addEventListener("mouseout", function(e) { alert(e.point); });
  931. */
  932. /**
  933. * 为该覆盖物绑定一系列事件
  934. * 当前支持click mouseover mouseout
  935. * @return 无返回值
  936. */
  937. TextIconOverlay.prototype._bind = function(){
  938. if (!this._domElement){
  939. return;
  940. }
  941. var me = this;
  942. var map = this._map;
  943. var BaseEvent = T.lang.Event;
  944. function eventExtend(e, be){
  945. var elem = e.srcElement || e.target;
  946. var x = e.clientX || e.pageX;
  947. var y = e.clientY || e.pageY;
  948. if (e && be && x && y && elem){
  949. var offset = T.dom.getPosition(map.getContainer());
  950. be.pixel = new BMap.Pixel(x - offset.left, y - offset.top);
  951. be.point = map.pixelToPoint(be.pixel);
  952. }
  953. return be;
  954. }//给事件参数增加pixel和point两个值
  955. T.event.on(this._domElement,"mouseover", function(e){
  956. me.dispatchEvent(eventExtend(e, new BaseEvent("onmouseover")));
  957. });
  958. T.event.on(this._domElement,"mouseout", function(e){
  959. me.dispatchEvent(eventExtend(e, new BaseEvent("onmouseout")));
  960. });
  961. T.event.on(this._domElement,"click", function(e){
  962. me.dispatchEvent(eventExtend(e, new BaseEvent("onclick")));
  963. });
  964. };
  965. return TextIconOverlay;
  966. });
  967. });
  968. var TextIconOverlay = (index$1 && typeof index$1 === 'object' && 'default' in index$1 ? index$1['default'] : index$1);
  969. /**
  970. * 获取一个扩展的视图范围把上下左右都扩大一样的像素值
  971. * @param {Map} map BMap.Map的实例化对象
  972. * @param {BMap.Bounds} bounds BMap.Bounds的实例化对象
  973. * @param {Number} gridSize 要扩大的像素值
  974. *
  975. * @return {BMap.Bounds} 返回扩大后的视图范围
  976. */
  977. var getExtendedBounds = function(map, bounds, gridSize){
  978. bounds = cutBoundsInRange(bounds);
  979. var pixelNE = map.pointToPixel(bounds.getNorthEast());
  980. var pixelSW = map.pointToPixel(bounds.getSouthWest());
  981. pixelNE.x += gridSize;
  982. pixelNE.y -= gridSize;
  983. pixelSW.x -= gridSize;
  984. pixelSW.y += gridSize;
  985. var newNE = map.pixelToPoint(pixelNE);
  986. var newSW = map.pixelToPoint(pixelSW);
  987. return new BMap.Bounds(newSW, newNE);
  988. };
  989. /**
  990. * 按照百度地图支持的世界范围对bounds进行边界处理
  991. * @param {BMap.Bounds} bounds BMap.Bounds的实例化对象
  992. *
  993. * @return {BMap.Bounds} 返回不越界的视图范围
  994. */
  995. var cutBoundsInRange = function (bounds) {
  996. var maxX = getRange(bounds.getNorthEast().lng, -180, 180);
  997. var minX = getRange(bounds.getSouthWest().lng, -180, 180);
  998. var maxY = getRange(bounds.getNorthEast().lat, -74, 74);
  999. var minY = getRange(bounds.getSouthWest().lat, -74, 74);
  1000. return new BMap.Bounds(new BMap.Point(minX, minY), new BMap.Point(maxX, maxY));
  1001. };
  1002. /**
  1003. * 对单个值进行边界处理
  1004. * @param {Number} i 要处理的数值
  1005. * @param {Number} min 下边界值
  1006. * @param {Number} max 上边界值
  1007. *
  1008. * @return {Number} 返回不越界的数值
  1009. */
  1010. var getRange = function (i, mix, max) {
  1011. mix && (i = Math.max(i, mix));
  1012. max && (i = Math.min(i, max));
  1013. return i;
  1014. };
  1015. /**
  1016. * 判断给定的对象是否为数组
  1017. * @param {Object} source 要测试的对象
  1018. *
  1019. * @return {Boolean} 如果是数组返回true否则返回false
  1020. */
  1021. var isArray = function (source) {
  1022. return '[object Array]' === Object.prototype.toString.call(source);
  1023. };
  1024. /**
  1025. * 返回item在source中的索引位置
  1026. * @param {Object} item 要测试的对象
  1027. * @param {Array} source 数组
  1028. *
  1029. * @return {Number} 如果在数组内返回索引否则返回-1
  1030. */
  1031. var indexOf = function(item, source){
  1032. var index = -1;
  1033. if(isArray(source)){
  1034. if (source.indexOf) {
  1035. index = source.indexOf(item);
  1036. } else {
  1037. for (var i = 0, m; m = source[i]; i++) {
  1038. if (m === item) {
  1039. index = i;
  1040. break;
  1041. }
  1042. }
  1043. }
  1044. }
  1045. return index;
  1046. };
  1047. /**
  1048. *@exports MarkerClusterer as BMapLib.MarkerClusterer
  1049. */
  1050. /**
  1051. * MarkerClusterer
  1052. * @class 用来解决加载大量点要素到地图上产生覆盖现象的问题并提高性能
  1053. * @constructor
  1054. * @param {Map} map 地图的一个实例
  1055. * @param {Json Object} options 可选参数可选项包括<br />
  1056. * markers {Array<Marker>} 要聚合的标记数组<br />
  1057. * girdSize {Number} 聚合计算时网格的像素大小默认60<br />
  1058. * maxZoom {Number} 最大的聚合级别大于该级别就不进行相应的聚合<br />
  1059. * minClusterSize {Number} 最小的聚合数量小于该数量的不能成为一个聚合默认为2<br />
  1060. * isAverangeCenter {Boolean} 聚合点的落脚位置是否是所有聚合在内点的平均值默认为否落脚在聚合内的第一个点<br />
  1061. * styles {Array<IconStyle>} 自定义聚合后的图标风格请参考TextIconOverlay类<br />
  1062. */
  1063. var MarkerClusterer = function(map, options){
  1064. try {
  1065. BMap;
  1066. } catch (e) {
  1067. throw Error('Baidu Map JS API is not ready yet!');
  1068. }
  1069. if (!map){
  1070. return;
  1071. }
  1072. this._map = map;
  1073. this._markers = [];
  1074. this._clusters = [];
  1075. var opts = options || {};
  1076. this._gridSize = opts["gridSize"] || 60;
  1077. this._maxZoom = opts["maxZoom"] || 18;
  1078. this._minClusterSize = opts["minClusterSize"] || 2;
  1079. this._isAverageCenter = false;
  1080. if (opts['isAverageCenter'] != undefined) {
  1081. this._isAverageCenter = opts['isAverageCenter'];
  1082. }
  1083. this._styles = opts["styles"] || [];
  1084. var that = this;
  1085. this._map.addEventListener("zoomend",function(){
  1086. that._redraw();
  1087. });
  1088. this._map.addEventListener("moveend",function(){
  1089. that._redraw();
  1090. });
  1091. var mkrs = opts["markers"];
  1092. isArray(mkrs) && this.addMarkers(mkrs);
  1093. };
  1094. /**
  1095. * 添加要聚合的标记数组
  1096. * @param {Array<Marker>} markers 要聚合的标记数组
  1097. *
  1098. * @return 无返回值
  1099. */
  1100. MarkerClusterer.prototype.addMarkers = function(markers){
  1101. if (!markers.length) {
  1102. return
  1103. }
  1104. for(var i = 0, len = markers.length; i <len ; i++){
  1105. this._pushMarkerTo(markers[i]);
  1106. }
  1107. this._createClusters();
  1108. };
  1109. /**
  1110. * 把一个标记添加到要聚合的标记数组中
  1111. * @param {BMap.Marker} marker 要添加的标记
  1112. *
  1113. * @return 无返回值
  1114. */
  1115. MarkerClusterer.prototype._pushMarkerTo = function(marker){
  1116. var index = indexOf(marker, this._markers);
  1117. if(index === -1){
  1118. marker.isInCluster = false;
  1119. this._markers.push(marker);//Marker拖放后enableDragging不做变化,忽略
  1120. }
  1121. };
  1122. /**
  1123. * 添加一个聚合的标记
  1124. * @param {BMap.Marker} marker 要聚合的单个标记
  1125. * @return 无返回值
  1126. */
  1127. MarkerClusterer.prototype.addMarker = function(marker) {
  1128. this._pushMarkerTo(marker);
  1129. this._createClusters();
  1130. };
  1131. /**
  1132. * 根据所给定的标记创建聚合点
  1133. * @return 无返回值
  1134. */
  1135. MarkerClusterer.prototype._createClusters = function(){
  1136. var mapBounds = this._map.getBounds();
  1137. if (!mapBounds.getCenter()) {
  1138. return
  1139. }
  1140. var extendedBounds = getExtendedBounds(this._map, mapBounds, this._gridSize);
  1141. for(var i = 0, marker; marker = this._markers[i]; i++){
  1142. if(!marker.isInCluster && extendedBounds.containsPoint(marker.getPosition()) ){
  1143. this._addToClosestCluster(marker);
  1144. }
  1145. }
  1146. };
  1147. /**
  1148. * 根据标记的位置把它添加到最近的聚合中
  1149. * @param {BMap.Marker} marker 要进行聚合的单个标记
  1150. *
  1151. * @return 无返回值
  1152. */
  1153. MarkerClusterer.prototype._addToClosestCluster = function (marker){
  1154. var distance = 4000000;
  1155. var clusterToAddTo = null;
  1156. var position = marker.getPosition();
  1157. for(var i = 0, cluster; cluster = this._clusters[i]; i++){
  1158. var center = cluster.getCenter();
  1159. if(center){
  1160. var d = this._map.getDistance(center, marker.getPosition());
  1161. if(d < distance){
  1162. distance = d;
  1163. clusterToAddTo = cluster;
  1164. }
  1165. }
  1166. }
  1167. if (clusterToAddTo && clusterToAddTo.isMarkerInClusterBounds(marker)){
  1168. clusterToAddTo.addMarker(marker);
  1169. } else {
  1170. var cluster = new Cluster(this);
  1171. cluster.addMarker(marker);
  1172. this._clusters.push(cluster);
  1173. }
  1174. };
  1175. /**
  1176. * 清除上一次的聚合的结果
  1177. * @return 无返回值
  1178. */
  1179. MarkerClusterer.prototype._clearLastClusters = function(){
  1180. for(var i = 0, cluster; cluster = this._clusters[i]; i++){
  1181. cluster.remove();
  1182. }
  1183. this._clusters = [];//置空Cluster数组
  1184. this._removeMarkersFromCluster();//把Marker的cluster标记设为false
  1185. };
  1186. /**
  1187. * 清除某个聚合中的所有标记
  1188. * @return 无返回值
  1189. */
  1190. MarkerClusterer.prototype._removeMarkersFromCluster = function(){
  1191. for(var i = 0, marker; marker = this._markers[i]; i++){
  1192. marker.isInCluster = false;
  1193. }
  1194. };
  1195. /**
  1196. * 把所有的标记从地图上清除
  1197. * @return 无返回值
  1198. */
  1199. MarkerClusterer.prototype._removeMarkersFromMap = function(){
  1200. for(var i = 0, marker; marker = this._markers[i]; i++){
  1201. marker.isInCluster = false;
  1202. var label = marker.getLabel();
  1203. this._map.removeOverlay(marker);
  1204. marker.setLabel(label);
  1205. }
  1206. };
  1207. /**
  1208. * 删除单个标记
  1209. * @param {BMap.Marker} marker 需要被删除的marker
  1210. *
  1211. * @return {Boolean} 删除成功返回true否则返回false
  1212. */
  1213. MarkerClusterer.prototype._removeMarker = function(marker) {
  1214. var index = indexOf(marker, this._markers);
  1215. if (index === -1) {
  1216. return false;
  1217. }
  1218. this._map.removeOverlay(marker);
  1219. this._markers.splice(index, 1);
  1220. return true;
  1221. };
  1222. /**
  1223. * 删除单个标记
  1224. * @param {BMap.Marker} marker 需要被删除的marker
  1225. *
  1226. * @return {Boolean} 删除成功返回true否则返回false
  1227. */
  1228. MarkerClusterer.prototype.removeMarker = function(marker) {
  1229. var success = this._removeMarker(marker);
  1230. if (success) {
  1231. this._clearLastClusters();
  1232. this._createClusters();
  1233. }
  1234. return success;
  1235. };
  1236. /**
  1237. * 删除一组标记
  1238. * @param {Array<BMap.Marker>} markers 需要被删除的marker数组
  1239. *
  1240. * @return {Boolean} 删除成功返回true否则返回false
  1241. */
  1242. MarkerClusterer.prototype.removeMarkers = function(markers) {
  1243. var success = false;
  1244. for (var i = 0; i < markers.length; i++) {
  1245. var r = this._removeMarker(markers[i]);
  1246. success = success || r;
  1247. }
  1248. if (success) {
  1249. this._clearLastClusters();
  1250. this._createClusters();
  1251. }
  1252. return success;
  1253. };
  1254. /**
  1255. * 从地图上彻底清除所有的标记
  1256. * @return 无返回值
  1257. */
  1258. MarkerClusterer.prototype.clearMarkers = function() {
  1259. this._clearLastClusters();
  1260. this._removeMarkersFromMap();
  1261. this._markers = [];
  1262. };
  1263. /**
  1264. * 重新生成比如改变了属性等
  1265. * @return 无返回值
  1266. */
  1267. MarkerClusterer.prototype._redraw = function () {
  1268. this._clearLastClusters();
  1269. this._createClusters();
  1270. };
  1271. /**
  1272. * 获取网格大小
  1273. * @return {Number} 网格大小
  1274. */
  1275. MarkerClusterer.prototype.getGridSize = function() {
  1276. return this._gridSize;
  1277. };
  1278. /**
  1279. * 设置网格大小
  1280. * @param {Number} size 网格大小
  1281. * @return 无返回值
  1282. */
  1283. MarkerClusterer.prototype.setGridSize = function(size) {
  1284. this._gridSize = size;
  1285. this._redraw();
  1286. };
  1287. /**
  1288. * 获取聚合的最大缩放级别
  1289. * @return {Number} 聚合的最大缩放级别
  1290. */
  1291. MarkerClusterer.prototype.getMaxZoom = function() {
  1292. return this._maxZoom;
  1293. };
  1294. /**
  1295. * 设置聚合的最大缩放级别
  1296. * @param {Number} maxZoom 聚合的最大缩放级别
  1297. * @return 无返回值
  1298. */
  1299. MarkerClusterer.prototype.setMaxZoom = function(maxZoom) {
  1300. this._maxZoom = maxZoom;
  1301. this._redraw();
  1302. };
  1303. /**
  1304. * 获取聚合的样式风格集合
  1305. * @return {Array<IconStyle>} 聚合的样式风格集合
  1306. */
  1307. MarkerClusterer.prototype.getStyles = function() {
  1308. return this._styles;
  1309. };
  1310. /**
  1311. * 设置聚合的样式风格集合
  1312. * @param {Array<IconStyle>} styles 样式风格数组
  1313. * @return 无返回值
  1314. */
  1315. MarkerClusterer.prototype.setStyles = function(styles) {
  1316. this._styles = styles;
  1317. this._redraw();
  1318. };
  1319. /**
  1320. * 获取单个聚合的最小数量
  1321. * @return {Number} 单个聚合的最小数量
  1322. */
  1323. MarkerClusterer.prototype.getMinClusterSize = function() {
  1324. return this._minClusterSize;
  1325. };
  1326. /**
  1327. * 设置单个聚合的最小数量
  1328. * @param {Number} size 单个聚合的最小数量
  1329. * @return 无返回值
  1330. */
  1331. MarkerClusterer.prototype.setMinClusterSize = function(size) {
  1332. this._minClusterSize = size;
  1333. this._redraw();
  1334. };
  1335. /**
  1336. * 获取单个聚合的落脚点是否是聚合内所有标记的平均中心
  1337. * @return {Boolean} true或false
  1338. */
  1339. MarkerClusterer.prototype.isAverageCenter = function() {
  1340. return this._isAverageCenter;
  1341. };
  1342. /**
  1343. * 获取聚合的Map实例
  1344. * @return {Map} Map的示例
  1345. */
  1346. MarkerClusterer.prototype.getMap = function() {
  1347. return this._map;
  1348. };
  1349. /**
  1350. * 获取所有的标记数组
  1351. * @return {Array<Marker>} 标记数组
  1352. */
  1353. MarkerClusterer.prototype.getMarkers = function() {
  1354. return this._markers;
  1355. };
  1356. /**
  1357. * 获取聚合的总数量
  1358. * @return {Number} 聚合的总数量
  1359. */
  1360. MarkerClusterer.prototype.getClustersCount = function() {
  1361. var count = 0;
  1362. for(var i = 0, cluster; cluster = this._clusters[i]; i++){
  1363. cluster.isReal() && count++;
  1364. }
  1365. return count;
  1366. };
  1367. /**
  1368. * @ignore
  1369. * Cluster
  1370. * @class 表示一个聚合对象该聚合包含有N个标记这N个标记组成的范围并有予以显示在Map上的TextIconOverlay等
  1371. * @constructor
  1372. * @param {MarkerClusterer} markerClusterer 一个标记聚合器示例
  1373. */
  1374. function Cluster(markerClusterer){
  1375. this._markerClusterer = markerClusterer;
  1376. this._map = markerClusterer.getMap();
  1377. this._minClusterSize = markerClusterer.getMinClusterSize();
  1378. this._isAverageCenter = markerClusterer.isAverageCenter();
  1379. this._center = null;//落脚位置
  1380. this._markers = [];//这个Cluster中所包含的markers
  1381. this._gridBounds = null;//以中心点为准,向四边扩大gridSize个像素的范围,也即网格范围
  1382. this._isReal = false; //真的是个聚合
  1383. this._clusterMarker = new TextIconOverlay(this._center, this._markers.length, {"styles":this._markerClusterer.getStyles()});
  1384. //this._map.addOverlay(this._clusterMarker);
  1385. }
  1386. /**
  1387. * 向该聚合添加一个标记
  1388. * @param {Marker} marker 要添加的标记
  1389. * @return 无返回值
  1390. */
  1391. Cluster.prototype.addMarker = function(marker){
  1392. if(this.isMarkerInCluster(marker)){
  1393. return false;
  1394. }//也可用marker.isInCluster判断,外面判断OK,这里基本不会命中
  1395. if (!this._center){
  1396. this._center = marker.getPosition();
  1397. this.updateGridBounds();//
  1398. } else {
  1399. if(this._isAverageCenter){
  1400. var l = this._markers.length + 1;
  1401. var lat = (this._center.lat * (l - 1) + marker.getPosition().lat) / l;
  1402. var lng = (this._center.lng * (l - 1) + marker.getPosition().lng) / l;
  1403. this._center = new BMap.Point(lng, lat);
  1404. this.updateGridBounds();
  1405. }//计算新的Center
  1406. }
  1407. marker.isInCluster = true;
  1408. this._markers.push(marker);
  1409. var len = this._markers.length;
  1410. if(len < this._minClusterSize ){
  1411. this._map.addOverlay(marker);
  1412. //this.updateClusterMarker();
  1413. return true;
  1414. } else if (len === this._minClusterSize) {
  1415. for (var i = 0; i < len; i++) {
  1416. var label = this._markers[i].getLabel();
  1417. this._markers[i].getMap() && this._map.removeOverlay(this._markers[i]);
  1418. this._markers[i].setLabel(label);
  1419. }
  1420. }
  1421. this._map.addOverlay(this._clusterMarker);
  1422. this._isReal = true;
  1423. this.updateClusterMarker();
  1424. return true;
  1425. };
  1426. /**
  1427. * 判断一个标记是否在该聚合中
  1428. * @param {Marker} marker 要判断的标记
  1429. * @return {Boolean} true或false
  1430. */
  1431. Cluster.prototype.isMarkerInCluster= function(marker){
  1432. if (this._markers.indexOf) {
  1433. return this._markers.indexOf(marker) != -1;
  1434. } else {
  1435. for (var i = 0, m; m = this._markers[i]; i++) {
  1436. if (m === marker) {
  1437. return true;
  1438. }
  1439. }
  1440. }
  1441. return false;
  1442. };
  1443. /**
  1444. * 判断一个标记是否在该聚合网格范围中
  1445. * @param {Marker} marker 要判断的标记
  1446. * @return {Boolean} true或false
  1447. */
  1448. Cluster.prototype.isMarkerInClusterBounds = function(marker) {
  1449. return this._gridBounds.containsPoint(marker.getPosition());
  1450. };
  1451. Cluster.prototype.isReal = function(marker) {
  1452. return this._isReal;
  1453. };
  1454. /**
  1455. * 更新该聚合的网格范围
  1456. * @return 无返回值
  1457. */
  1458. Cluster.prototype.updateGridBounds = function() {
  1459. var bounds = new BMap.Bounds(this._center, this._center);
  1460. this._gridBounds = getExtendedBounds(this._map, bounds, this._markerClusterer.getGridSize());
  1461. };
  1462. /**
  1463. * 更新该聚合的显示样式也即TextIconOverlay
  1464. * @return 无返回值
  1465. */
  1466. Cluster.prototype.updateClusterMarker = function () {
  1467. if (this._map.getZoom() > this._markerClusterer.getMaxZoom()) {
  1468. this._clusterMarker && this._map.removeOverlay(this._clusterMarker);
  1469. for (var i = 0, marker; marker = this._markers[i]; i++) {
  1470. this._map.addOverlay(marker);
  1471. }
  1472. return;
  1473. }
  1474. if (this._markers.length < this._minClusterSize) {
  1475. this._clusterMarker.hide();
  1476. return;
  1477. }
  1478. this._clusterMarker.setPosition(this._center);
  1479. this._clusterMarker.setText(this._markers.length);
  1480. this._clusterMarker.addEventListener && !this._clusterMarker._hasClickEvent && this._clusterMarker.addEventListener("click", function(event){
  1481. this._clusterMarker._hasClickEvent = true;
  1482. this._markers && this._map.setViewport(this.getBounds());
  1483. }.bind(this));
  1484. };
  1485. /**
  1486. * 删除该聚合
  1487. * @return 无返回值
  1488. */
  1489. Cluster.prototype.remove = function(){
  1490. for (var i = 0, m; m = this._markers[i]; i++) {
  1491. var label = this._markers[i].getLabel();
  1492. this._markers[i].getMap() && this._map.removeOverlay(this._markers[i]);
  1493. this._markers[i].setLabel(label);
  1494. }//清除散的标记点
  1495. this._map.removeOverlay(this._clusterMarker);
  1496. this._markers.length = 0;
  1497. delete this._markers;
  1498. };
  1499. /**
  1500. * 获取该聚合所包含的所有标记的最小外接矩形的范围
  1501. * @return {BMap.Bounds} 计算出的范围
  1502. */
  1503. Cluster.prototype.getBounds = function() {
  1504. var bounds = new BMap.Bounds(this._center,this._center);
  1505. for (var i = 0, marker; marker = this._markers[i]; i++) {
  1506. bounds.extend(marker.getPosition());
  1507. }
  1508. return bounds;
  1509. };
  1510. /**
  1511. * 获取该聚合的落脚点
  1512. * @return {BMap.Point} 该聚合的落脚点
  1513. */
  1514. Cluster.prototype.getCenter = function() {
  1515. return this._center;
  1516. };
  1517. return MarkerClusterer;
  1518. })));
  1519. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__("DuR2")))
  1520. /***/ }),
  1521. /***/ "7AC4":
  1522. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1523. "use strict";
  1524. /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__base_mixins_common_js__ = __webpack_require__("9LO+");
  1525. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__base_factory_js__ = __webpack_require__("Brla");
  1526. /* harmony default export */ __webpack_exports__["a"] = ({
  1527. name: 'bm-scale',
  1528. render: function render() {},
  1529. mixins: [Object(__WEBPACK_IMPORTED_MODULE_0__base_mixins_common_js__["a" /* default */])('control')],
  1530. props: {
  1531. anchor: {
  1532. type: String
  1533. },
  1534. offset: {
  1535. type: Object
  1536. }
  1537. },
  1538. watch: {
  1539. anchor: function anchor() {
  1540. this.reload();
  1541. },
  1542. offset: function offset() {
  1543. this.reload();
  1544. }
  1545. },
  1546. methods: {
  1547. load: function load() {
  1548. var BMap = this.BMap,
  1549. map = this.map,
  1550. anchor = this.anchor,
  1551. offset = this.offset;
  1552. this.originInstance = new BMap.ScaleControl({
  1553. anchor: global[anchor],
  1554. offset: offset && Object(__WEBPACK_IMPORTED_MODULE_1__base_factory_js__["d" /* createSize */])(BMap, offset)
  1555. });
  1556. map.addControl(this.originInstance);
  1557. }
  1558. }
  1559. });
  1560. /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__("DuR2")))
  1561. /***/ }),
  1562. /***/ "8Hu+":
  1563. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1564. "use strict";
  1565. /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__base_mixins_common_js__ = __webpack_require__("9LO+");
  1566. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__base_bindEvent_js__ = __webpack_require__("HpPs");
  1567. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__base_factory_js__ = __webpack_require__("Brla");
  1568. //
  1569. //
  1570. //
  1571. //
  1572. //
  1573. //
  1574. /* harmony default export */ __webpack_exports__["a"] = ({
  1575. name: 'bm-info-window',
  1576. mixins: [Object(__WEBPACK_IMPORTED_MODULE_0__base_mixins_common_js__["a" /* default */])('overlay')],
  1577. props: {
  1578. show: {
  1579. type: Boolean
  1580. },
  1581. position: {
  1582. type: Object
  1583. },
  1584. title: {
  1585. type: String
  1586. },
  1587. width: {
  1588. type: Number
  1589. },
  1590. height: {
  1591. type: Number
  1592. },
  1593. maxWidth: {
  1594. type: Number
  1595. },
  1596. offset: {
  1597. type: Object
  1598. },
  1599. maximize: {
  1600. type: Boolean
  1601. },
  1602. autoPan: {
  1603. type: Boolean
  1604. },
  1605. closeOnClick: {
  1606. type: Boolean,
  1607. default: true
  1608. },
  1609. message: {
  1610. type: String
  1611. }
  1612. },
  1613. watch: {
  1614. show: function show(val) {
  1615. val ? this.openInfoWindow() : this.closeInfoWindow();
  1616. },
  1617. 'position.lng': function positionLng(val, oldVal) {
  1618. this.reload();
  1619. },
  1620. 'position.lat': function positionLat(val, oldVal) {
  1621. this.reload();
  1622. },
  1623. 'offset.width': function offsetWidth(val, oldVal) {
  1624. this.reload();
  1625. },
  1626. 'offset.height': function offsetHeight(val) {
  1627. this.reload();
  1628. },
  1629. maxWidth: function maxWidth() {
  1630. this.reload();
  1631. },
  1632. width: function width(val) {
  1633. this.originInstance.setWidth(val);
  1634. },
  1635. height: function height(val) {
  1636. this.originInstance.setHeight(val);
  1637. },
  1638. title: function title(val) {
  1639. this.originInstance.setTitle(val);
  1640. },
  1641. maximize: function maximize(val) {
  1642. val ? this.originInstance.enableMaximize() : this.originInstance.disableMaximize();
  1643. },
  1644. autoPan: function autoPan(val) {
  1645. val ? this.originInstance.enableAutoPan() : this.originInstance.disableAutoPan();
  1646. },
  1647. closeOnClick: function closeOnClick(val) {
  1648. val ? this.originInstance.enableCloseOnClick() : this.originInstance.disableCloseOnClick();
  1649. }
  1650. },
  1651. methods: {
  1652. redraw: function redraw() {
  1653. this.originInstance.redraw();
  1654. },
  1655. load: function load() {
  1656. var BMap = this.BMap,
  1657. map = this.map,
  1658. show = this.show,
  1659. title = this.title,
  1660. width = this.width,
  1661. height = this.height,
  1662. maxWidth = this.maxWidth,
  1663. offset = this.offset,
  1664. autoPan = this.autoPan,
  1665. closeOnClick = this.closeOnClick,
  1666. message = this.message,
  1667. maximize = this.maximize,
  1668. bindObserver = this.bindObserver,
  1669. $parent = this.$parent;
  1670. var $content = this.$el;
  1671. var overlay = new BMap.InfoWindow($content, {
  1672. width: width,
  1673. height: height,
  1674. title: title,
  1675. maxWidth: maxWidth,
  1676. offset: Object(__WEBPACK_IMPORTED_MODULE_2__base_factory_js__["d" /* createSize */])(BMap, offset),
  1677. enableAutoPan: autoPan,
  1678. enableCloseOnClick: closeOnClick,
  1679. enableMessage: typeof message === 'undefined',
  1680. message: message
  1681. });
  1682. maximize ? overlay.enableMaximize() : overlay.disableMaximize();
  1683. __WEBPACK_IMPORTED_MODULE_1__base_bindEvent_js__["a" /* default */].call(this, overlay);
  1684. this.originInstance = overlay;
  1685. overlay.redraw();[].forEach.call($content.querySelectorAll('img'), function ($img) {
  1686. $img.onload = function () {
  1687. return overlay.redraw();
  1688. };
  1689. });
  1690. bindObserver();
  1691. this.$container = $parent.originInstance && $parent.originInstance.openInfoWindow ? $parent.originInstance : map;
  1692. show && this.openInfoWindow();
  1693. },
  1694. bindObserver: function bindObserver() {
  1695. var MutationObserver = global.MutationObserver;
  1696. if (!MutationObserver) {
  1697. return;
  1698. }
  1699. var $el = this.$el,
  1700. originInstance = this.originInstance;
  1701. this.observer = new MutationObserver(function (mutations) {
  1702. return originInstance.redraw();
  1703. });
  1704. this.observer.observe($el, { attributes: true, childList: true, characterData: true, subtree: true });
  1705. },
  1706. openInfoWindow: function openInfoWindow() {
  1707. var BMap = this.BMap,
  1708. $container = this.$container,
  1709. position = this.position,
  1710. originInstance = this.originInstance;
  1711. $container.openInfoWindow(originInstance, Object(__WEBPACK_IMPORTED_MODULE_2__base_factory_js__["c" /* createPoint */])(BMap, position));
  1712. },
  1713. closeInfoWindow: function closeInfoWindow() {
  1714. this.$container.closeInfoWindow(this.originInstance);
  1715. }
  1716. }
  1717. });
  1718. /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__("DuR2")))
  1719. /***/ }),
  1720. /***/ "9LO+":
  1721. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1722. "use strict";
  1723. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck__ = __webpack_require__("Zrlr");
  1724. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck__);
  1725. var types = {
  1726. control: {
  1727. unload: 'removeControl'
  1728. },
  1729. layer: {
  1730. unload: 'removeTileLayer'
  1731. },
  1732. overlay: {
  1733. unload: 'removeOverlay'
  1734. },
  1735. contextMenu: {
  1736. unload: 'removeContextMenu'
  1737. }
  1738. };
  1739. var getParent = function getParent($component) {
  1740. return $component.abstract || $component.$el === $component.$children[0].$el ? getParent($component.$parent) : $component;
  1741. };
  1742. function destroyInstance() {
  1743. var unload = this.unload,
  1744. renderByParent = this.renderByParent,
  1745. $parent = this.$parent;
  1746. if (renderByParent) {
  1747. $parent.reload();
  1748. }
  1749. unload();
  1750. }
  1751. var Mixin = function Mixin(prop) {
  1752. __WEBPACK_IMPORTED_MODULE_0_babel_runtime_helpers_classCallCheck___default()(this, Mixin);
  1753. this.methods = {
  1754. ready: function ready() {
  1755. var $parent = getParent(this.$parent);
  1756. var BMap = this.BMap = $parent.BMap;
  1757. var map = this.map = $parent.map;
  1758. this.load();
  1759. this.$emit('ready', {
  1760. BMap: BMap,
  1761. map: map
  1762. });
  1763. },
  1764. transmitEvent: function transmitEvent(e) {
  1765. this.$emit(e.type.replace(/^on/, ''), e);
  1766. },
  1767. reload: function reload() {
  1768. var _this = this;
  1769. this && this.BMap && this.$nextTick(function () {
  1770. _this.unload();
  1771. _this.$nextTick(_this.load);
  1772. });
  1773. },
  1774. unload: function unload() {
  1775. var map = this.map,
  1776. originInstance = this.originInstance;
  1777. try {
  1778. switch (prop.type) {
  1779. case 'search':
  1780. return originInstance.clearResults();
  1781. case 'autoComplete':
  1782. case 'lushu':
  1783. return originInstance.dispose();
  1784. case 'markerClusterer':
  1785. return originInstance.clearMarkers();
  1786. default:
  1787. map[types[prop.type].unload](originInstance);
  1788. }
  1789. } catch (e) {}
  1790. }
  1791. };
  1792. this.computed = {
  1793. renderByParent: function renderByParent() {
  1794. return this.$parent.preventChildrenRender;
  1795. }
  1796. };
  1797. this.mounted = function () {
  1798. var $parent = getParent(this.$parent);
  1799. var map = $parent.map;
  1800. var ready = this.ready;
  1801. map ? ready() : $parent.$on('ready', ready);
  1802. };
  1803. this.destroyed = destroyInstance;
  1804. this.beforeDestroy = destroyInstance;
  1805. };
  1806. /* harmony default export */ __webpack_exports__["a"] = (function (type) {
  1807. return new Mixin({ type: type });
  1808. });
  1809. /***/ }),
  1810. /***/ "Brla":
  1811. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1812. "use strict";
  1813. /* harmony export (immutable) */ __webpack_exports__["c"] = createPoint;
  1814. /* unused harmony export createPixel */
  1815. /* unused harmony export createBounds */
  1816. /* harmony export (immutable) */ __webpack_exports__["d"] = createSize;
  1817. /* harmony export (immutable) */ __webpack_exports__["a"] = createIcon;
  1818. /* harmony export (immutable) */ __webpack_exports__["b"] = createLabel;
  1819. function createPoint(BMap) {
  1820. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1821. var lng = options.lng,
  1822. lat = options.lat;
  1823. return new BMap.Point(lng, lat);
  1824. }
  1825. function createPixel(BMap) {
  1826. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1827. var x = options.x,
  1828. y = options.y;
  1829. return new BMap.Pixel(x, y);
  1830. }
  1831. function createBounds(BMap) {
  1832. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1833. var sw = options.sw,
  1834. ne = options.ne;
  1835. return new BMap.Bounds(createPoint(BMap, sw), createPoint(BMap, ne));
  1836. }
  1837. function createSize(BMap) {
  1838. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1839. var width = options.width,
  1840. height = options.height;
  1841. return new BMap.Size(width, height);
  1842. }
  1843. function createIcon(BMap) {
  1844. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1845. var url = options.url,
  1846. size = options.size,
  1847. _options$opts = options.opts,
  1848. opts = _options$opts === undefined ? {} : _options$opts;
  1849. return new BMap.Icon(url, createSize(BMap, size), {
  1850. anchor: opts.anchor && createSize(BMap, opts.anchor),
  1851. imageSize: opts.imageSize && createSize(BMap, opts.imageSize),
  1852. imageOffset: opts.imageOffset && createSize(BMap, opts.imageOffset),
  1853. infoWindowAnchor: opts.infoWindowAnchor && createSize(BMap, opts.infoWindowAnchor),
  1854. printImageUrl: opts.printImageUrl
  1855. });
  1856. }
  1857. function createLabel(BMap) {
  1858. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1859. var content = options.content,
  1860. opts = options.opts;
  1861. return new BMap.Label(content, {
  1862. offset: opts.offset && createSize(BMap, opts.offset),
  1863. position: opts.position && createPoint(BMap, opts.position),
  1864. enableMassClear: opts.enableMassClear
  1865. });
  1866. }
  1867. /***/ }),
  1868. /***/ "HpPs":
  1869. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1870. "use strict";
  1871. // CONCATENATED MODULE: ./node_modules/vue-baidu-map/components/base/events.js
  1872. /* harmony default export */ var events = ({
  1873. 'bm-map': ['click', 'dblclick', 'rightclick', 'rightdblclick', 'maptypechange', 'mousemove', 'mouseover', 'mouseout', 'movestart', 'moving', 'moveend', 'zoomstart', 'zoomend', 'addoverlay', 'addcontrol', 'removecontrol', 'removeoverlay', 'clearoverlays', 'dragstart', 'dragging', 'dragend', 'addtilelayer', 'removetilelayer', 'load', 'resize', 'hotspotclick', 'hotspotover', 'hotspotout', 'tilesloaded', 'touchstart', 'touchmove', 'touchend', 'longpress'],
  1874. 'bm-geolocation': ['locationSuccess', 'locationError'],
  1875. 'bm-overview-map': ['viewchanged', 'viewchanging'],
  1876. 'bm-marker': ['click', 'dblclick', 'mousedown', 'mouseup', 'mouseout', 'mouseover', 'remove', 'infowindowclose', 'infowindowopen', 'dragstart', 'dragging', 'dragend', 'rightclick'],
  1877. 'bm-polyline': ['click', 'dblclick', 'mousedown', 'mouseup', 'mouseout', 'mouseover', 'remove', 'lineupdate'],
  1878. 'bm-polygon': ['click', 'dblclick', 'mousedown', 'mouseup', 'mouseout', 'mouseover', 'remove', 'lineupdate'],
  1879. 'bm-circle': ['click', 'dblclick', 'mousedown', 'mouseup', 'mouseout', 'mouseover', 'remove', 'lineupdate'],
  1880. 'bm-label': ['click', 'dblclick', 'mousedown', 'mouseup', 'mouseout', 'mouseover', 'remove', 'rightclick'],
  1881. 'bm-info-window': ['close', 'open', 'maximize', 'restore', 'clickclose'],
  1882. 'bm-ground': ['click', 'dblclick'],
  1883. 'bm-autocomplete': ['onconfirm', 'onhighlight'],
  1884. 'bm-point-collection': ['click', 'mouseover', 'mouseout']
  1885. });
  1886. // CONCATENATED MODULE: ./node_modules/vue-baidu-map/components/base/bindEvent.js
  1887. /* harmony default export */ var bindEvent = __webpack_exports__["a"] = (function (instance, eventList) {
  1888. var _this = this;
  1889. var ev = eventList || events[this.$options.name];
  1890. ev && ev.forEach(function (event) {
  1891. var hasOn = event.slice(0, 2) === 'on';
  1892. var eventName = hasOn ? event.slice(2) : event;
  1893. var listener = _this.$listeners[eventName];
  1894. listener && instance.addEventListener(event, listener.fns);
  1895. });
  1896. });
  1897. /***/ }),
  1898. /***/ "LVSh":
  1899. /***/ (function(module, exports) {
  1900. // removed by extract-text-webpack-plugin
  1901. /***/ }),
  1902. /***/ "NTBm":
  1903. /***/ (function(module, exports, __webpack_require__) {
  1904. module.exports = __webpack_require__.p + "static/img/yellow.762c207.gif";
  1905. /***/ }),
  1906. /***/ "PVXw":
  1907. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1908. "use strict";
  1909. /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__base_mixins_common_js__ = __webpack_require__("9LO+");
  1910. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__base_bindEvent_js__ = __webpack_require__("HpPs");
  1911. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__base_factory_js__ = __webpack_require__("Brla");
  1912. //
  1913. //
  1914. //
  1915. //
  1916. //
  1917. //
  1918. /* harmony default export */ __webpack_exports__["a"] = ({
  1919. name: 'bm-marker',
  1920. mixins: [Object(__WEBPACK_IMPORTED_MODULE_0__base_mixins_common_js__["a" /* default */])('overlay')],
  1921. props: {
  1922. position: {},
  1923. offset: {},
  1924. icon: {},
  1925. massClear: {
  1926. type: Boolean,
  1927. default: true
  1928. },
  1929. dragging: {
  1930. type: Boolean,
  1931. default: false
  1932. },
  1933. clicking: {
  1934. type: Boolean,
  1935. default: true
  1936. },
  1937. raiseOnDrag: {
  1938. type: Boolean,
  1939. default: false
  1940. },
  1941. draggingCursor: {
  1942. type: String
  1943. },
  1944. rotation: {
  1945. type: Number
  1946. },
  1947. shadow: {
  1948. type: Object
  1949. },
  1950. title: {
  1951. type: String
  1952. },
  1953. label: {
  1954. type: Object
  1955. },
  1956. animation: {
  1957. type: String
  1958. },
  1959. top: {
  1960. type: Boolean,
  1961. default: false
  1962. },
  1963. zIndex: {
  1964. type: Number,
  1965. default: 0
  1966. }
  1967. },
  1968. watch: {
  1969. 'position.lng': function positionLng(val, oldVal) {
  1970. var BMap = this.BMap,
  1971. originInstance = this.originInstance,
  1972. position = this.position,
  1973. renderByParent = this.renderByParent,
  1974. $parent = this.$parent;
  1975. if (val !== oldVal && val >= -180 && val <= 180) {
  1976. originInstance.setPosition(Object(__WEBPACK_IMPORTED_MODULE_2__base_factory_js__["c" /* createPoint */])(BMap, { lng: val, lat: position.lat }));
  1977. }
  1978. renderByParent && $parent.reload();
  1979. },
  1980. 'position.lat': function positionLat(val, oldVal) {
  1981. var BMap = this.BMap,
  1982. originInstance = this.originInstance,
  1983. position = this.position,
  1984. renderByParent = this.renderByParent,
  1985. $parent = this.$parent;
  1986. if (val !== oldVal && val >= -74 && val <= 74) {
  1987. originInstance.setPosition(Object(__WEBPACK_IMPORTED_MODULE_2__base_factory_js__["c" /* createPoint */])(BMap, { lng: position.lng, lat: val }));
  1988. }
  1989. renderByParent && $parent.reload();
  1990. },
  1991. 'offset.width': function offsetWidth(val, oldVal) {
  1992. var BMap = this.BMap,
  1993. originInstance = this.originInstance;
  1994. if (val !== oldVal) {
  1995. originInstance.setOffset(new BMap.Size(val, this.offset.height));
  1996. }
  1997. },
  1998. 'offset.height': function offsetHeight(val, oldVal) {
  1999. var BMap = this.BMap,
  2000. originInstance = this.originInstance;
  2001. if (val !== oldVal) {
  2002. originInstance.setOffset(new BMap.Size(this.offset.width, val));
  2003. }
  2004. },
  2005. icon: {
  2006. deep: true,
  2007. handler: function handler(val) {
  2008. var BMap = this.BMap,
  2009. originInstance = this.originInstance,
  2010. rotation = this.rotation;
  2011. originInstance && originInstance.setIcon(Object(__WEBPACK_IMPORTED_MODULE_2__base_factory_js__["a" /* createIcon */])(BMap, val));
  2012. rotation && originInstance && originInstance.setRotation(rotation);
  2013. }
  2014. },
  2015. massClear: function massClear(val) {
  2016. val ? this.originInstance.enableMassClear() : this.originInstance.disableMassClear();
  2017. },
  2018. dragging: function dragging(val) {
  2019. val ? this.originInstance.enableDragging() : this.originInstance.disableDragging();
  2020. },
  2021. clicking: function clicking() {
  2022. this.reload();
  2023. },
  2024. raiseOnDrag: function raiseOnDrag() {
  2025. this.reload();
  2026. },
  2027. draggingCursor: function draggingCursor(val) {
  2028. this.originInstance.setDraggingCursor(val);
  2029. },
  2030. rotation: function rotation(val) {
  2031. this.originInstance.setRotation(val);
  2032. },
  2033. shadow: function shadow(val) {
  2034. this.originInstance.setShadow(val);
  2035. },
  2036. title: function title(val) {
  2037. this.originInstance.setTitle(val);
  2038. },
  2039. label: function label(val) {
  2040. this.reload();
  2041. },
  2042. animation: function animation(val) {
  2043. this.originInstance.setAnimation(global[val]);
  2044. },
  2045. top: function top(val) {
  2046. this.originInstance.setTop(val);
  2047. },
  2048. zIndex: function zIndex(val) {
  2049. this.originInstance.setZIndex(val);
  2050. }
  2051. },
  2052. methods: {
  2053. load: function load() {
  2054. var BMap = this.BMap,
  2055. map = this.map,
  2056. position = this.position,
  2057. offset = this.offset,
  2058. icon = this.icon,
  2059. massClear = this.massClear,
  2060. dragging = this.dragging,
  2061. clicking = this.clicking,
  2062. raiseOnDrag = this.raiseOnDrag,
  2063. draggingCursor = this.draggingCursor,
  2064. rotation = this.rotation,
  2065. shadow = this.shadow,
  2066. title = this.title,
  2067. label = this.label,
  2068. animation = this.animation,
  2069. top = this.top,
  2070. renderByParent = this.renderByParent,
  2071. $parent = this.$parent,
  2072. zIndex = this.zIndex;
  2073. var overlay = new BMap.Marker(new BMap.Point(position.lng, position.lat), {
  2074. offset: offset,
  2075. icon: icon && Object(__WEBPACK_IMPORTED_MODULE_2__base_factory_js__["a" /* createIcon */])(BMap, icon),
  2076. enableMassClear: massClear,
  2077. enableDragging: dragging,
  2078. enableClicking: clicking,
  2079. raiseOnDrag: raiseOnDrag,
  2080. draggingCursor: draggingCursor,
  2081. rotation: rotation,
  2082. shadow: shadow,
  2083. title: title
  2084. });
  2085. this.originInstance = overlay;
  2086. label && overlay && overlay.setLabel(Object(__WEBPACK_IMPORTED_MODULE_2__base_factory_js__["b" /* createLabel */])(BMap, label));
  2087. overlay.setTop(top);
  2088. overlay.setZIndex(zIndex);
  2089. __WEBPACK_IMPORTED_MODULE_1__base_bindEvent_js__["a" /* default */].call(this, overlay);
  2090. if (renderByParent) {
  2091. $parent.reload();
  2092. } else {
  2093. map.addOverlay(overlay);
  2094. }
  2095. overlay.setAnimation(global[animation]);
  2096. }
  2097. }
  2098. });
  2099. /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__("DuR2")))
  2100. /***/ }),
  2101. /***/ "S4eb":
  2102. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2103. "use strict";
  2104. /* unused harmony export isPoint */
  2105. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return checkType; });
  2106. /* unused harmony export getPosition */
  2107. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__factory__ = __webpack_require__("Brla");
  2108. var isPoint = function isPoint(obj) {
  2109. return obj.lng && obj.lat;
  2110. };
  2111. var checkType = function checkType(val) {
  2112. return Object.prototype.toString.call(val).slice(8, -1);
  2113. };
  2114. var getPosition = function getPosition(BMap, point) {
  2115. return isPoint(point) ? Object(__WEBPACK_IMPORTED_MODULE_0__factory__["c" /* createPoint */])(BMap, point) : point;
  2116. };
  2117. /***/ }),
  2118. /***/ "SP3F":
  2119. /***/ (function(module, exports, __webpack_require__) {
  2120. module.exports = __webpack_require__.p + "static/img/red.6dbe9e9.gif";
  2121. /***/ }),
  2122. /***/ "Txow":
  2123. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2124. "use strict";
  2125. /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_promise__ = __webpack_require__("//Fk");
  2126. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_promise___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_promise__);
  2127. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_get_iterator__ = __webpack_require__("BO1k");
  2128. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_get_iterator___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_get_iterator__);
  2129. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__base_bindEvent_js__ = __webpack_require__("HpPs");
  2130. /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__base_util_js__ = __webpack_require__("S4eb");
  2131. //
  2132. //
  2133. //
  2134. //
  2135. //
  2136. //
  2137. //
  2138. //
  2139. /* harmony default export */ __webpack_exports__["a"] = ({
  2140. name: 'bm-map',
  2141. props: {
  2142. ak: {
  2143. type: String
  2144. },
  2145. center: {
  2146. type: [Object, String]
  2147. },
  2148. zoom: {
  2149. type: Number
  2150. },
  2151. minZoom: {
  2152. type: Number
  2153. },
  2154. maxZoom: {
  2155. type: Number
  2156. },
  2157. highResolution: {
  2158. type: Boolean,
  2159. default: true
  2160. },
  2161. mapClick: {
  2162. type: Boolean,
  2163. default: true
  2164. },
  2165. mapType: {
  2166. type: String
  2167. },
  2168. dragging: {
  2169. type: Boolean,
  2170. default: true
  2171. },
  2172. scrollWheelZoom: {
  2173. type: Boolean,
  2174. default: false
  2175. },
  2176. doubleClickZoom: {
  2177. type: Boolean,
  2178. default: true
  2179. },
  2180. keyboard: {
  2181. type: Boolean,
  2182. default: true
  2183. },
  2184. inertialDragging: {
  2185. type: Boolean,
  2186. default: true
  2187. },
  2188. continuousZoom: {
  2189. type: Boolean,
  2190. default: true
  2191. },
  2192. pinchToZoom: {
  2193. type: Boolean,
  2194. default: true
  2195. },
  2196. autoResize: {
  2197. type: Boolean,
  2198. default: true
  2199. },
  2200. theme: {
  2201. type: Array
  2202. },
  2203. mapStyle: {
  2204. type: Object
  2205. }
  2206. },
  2207. watch: {
  2208. center: function center(val, oldVal) {
  2209. var map = this.map,
  2210. zoom = this.zoom;
  2211. if (Object(__WEBPACK_IMPORTED_MODULE_3__base_util_js__["a" /* checkType */])(val) === 'String' && val !== oldVal) {
  2212. map.centerAndZoom(val, zoom);
  2213. }
  2214. },
  2215. 'center.lng': function centerLng(val, oldVal) {
  2216. var BMap = this.BMap,
  2217. map = this.map,
  2218. zoom = this.zoom,
  2219. center = this.center;
  2220. if (val !== oldVal && val >= -180 && val <= 180) {
  2221. map.centerAndZoom(new BMap.Point(val, center.lat), zoom);
  2222. }
  2223. },
  2224. 'center.lat': function centerLat(val, oldVal) {
  2225. var BMap = this.BMap,
  2226. map = this.map,
  2227. zoom = this.zoom,
  2228. center = this.center;
  2229. if (val !== oldVal && val >= -74 && val <= 74) {
  2230. map.centerAndZoom(new BMap.Point(center.lng, val), zoom);
  2231. }
  2232. },
  2233. zoom: function zoom(val, oldVal) {
  2234. var map = this.map;
  2235. if (val !== oldVal && val >= 3 && val <= 19) {
  2236. map.setZoom(val);
  2237. }
  2238. },
  2239. minZoom: function minZoom(val) {
  2240. var map = this.map;
  2241. map.setMinZoom(val);
  2242. },
  2243. maxZoom: function maxZoom(val) {
  2244. var map = this.map;
  2245. map.setMaxZoom(val);
  2246. },
  2247. highResolution: function highResolution() {
  2248. this.reset();
  2249. },
  2250. mapClick: function mapClick() {
  2251. this.reset();
  2252. },
  2253. mapType: function mapType(val) {
  2254. var map = this.map;
  2255. map.setMapType(global[val]);
  2256. },
  2257. dragging: function dragging(val) {
  2258. var map = this.map;
  2259. val ? map.enableDragging() : map.disableDragging();
  2260. },
  2261. scrollWheelZoom: function scrollWheelZoom(val) {
  2262. var map = this.map;
  2263. val ? map.enableScrollWheelZoom() : map.disableScrollWheelZoom();
  2264. },
  2265. doubleClickZoom: function doubleClickZoom(val) {
  2266. var map = this.map;
  2267. val ? map.enableDoubleClickZoom() : map.disableDoubleClickZoom();
  2268. },
  2269. keyboard: function keyboard(val) {
  2270. var map = this.map;
  2271. val ? map.enableKeyboard() : map.disableKeyboard();
  2272. },
  2273. inertialDragging: function inertialDragging(val) {
  2274. var map = this.map;
  2275. val ? map.enableInertialDragging() : map.disableInertialDragging();
  2276. },
  2277. continuousZoom: function continuousZoom(val) {
  2278. var map = this.map;
  2279. val ? map.enableContinuousZoom() : map.disableContinuousZoom();
  2280. },
  2281. pinchToZoom: function pinchToZoom(val) {
  2282. var map = this.map;
  2283. val ? map.enablePinchToZoom() : map.disablePinchToZoom();
  2284. },
  2285. autoResize: function autoResize(val) {
  2286. var map = this.map;
  2287. val ? map.enableAutoResize() : map.disableAutoResize();
  2288. },
  2289. theme: function theme(val) {
  2290. var map = this.map;
  2291. map.setMapStyle({ styleJson: val });
  2292. },
  2293. 'mapStyle.features': {
  2294. handler: function handler(val, oldVal) {
  2295. var map = this.map,
  2296. mapStyle = this.mapStyle;
  2297. var style = mapStyle.style,
  2298. styleJson = mapStyle.styleJson;
  2299. map.setMapStyle({
  2300. styleJson: styleJson,
  2301. features: val,
  2302. style: style
  2303. });
  2304. },
  2305. deep: true
  2306. },
  2307. 'mapStyle.style': function mapStyleStyle(val, oldVal) {
  2308. var map = this.map,
  2309. mapStyle = this.mapStyle;
  2310. var features = mapStyle.features,
  2311. styleJson = mapStyle.styleJson;
  2312. map.setMapStyle({
  2313. styleJson: styleJson,
  2314. features: features,
  2315. style: val
  2316. });
  2317. },
  2318. 'mapStyle.styleJson': {
  2319. handler: function handler(val, oldVal) {
  2320. var map = this.map,
  2321. mapStyle = this.mapStyle;
  2322. var features = mapStyle.features,
  2323. style = mapStyle.style;
  2324. map.setMapStyle({
  2325. styleJson: val,
  2326. features: features,
  2327. style: style
  2328. });
  2329. },
  2330. deep: true
  2331. },
  2332. mapStyle: function mapStyle(val) {
  2333. var map = this.map,
  2334. theme = this.theme;
  2335. !theme && map.setMapStyle(val);
  2336. }
  2337. },
  2338. methods: {
  2339. setMapOptions: function setMapOptions() {
  2340. var map = this.map,
  2341. minZoom = this.minZoom,
  2342. maxZoom = this.maxZoom,
  2343. mapType = this.mapType,
  2344. dragging = this.dragging,
  2345. scrollWheelZoom = this.scrollWheelZoom,
  2346. doubleClickZoom = this.doubleClickZoom,
  2347. keyboard = this.keyboard,
  2348. inertialDragging = this.inertialDragging,
  2349. continuousZoom = this.continuousZoom,
  2350. pinchToZoom = this.pinchToZoom,
  2351. autoResize = this.autoResize;
  2352. minZoom && map.setMinZoom(minZoom);
  2353. maxZoom && map.setMaxZoom(maxZoom);
  2354. mapType && map.setMapType(global[mapType]);
  2355. dragging ? map.enableDragging() : map.disableDragging();
  2356. scrollWheelZoom ? map.enableScrollWheelZoom() : map.disableScrollWheelZoom();
  2357. doubleClickZoom ? map.enableDoubleClickZoom() : map.disableDoubleClickZoom();
  2358. keyboard ? map.enableKeyboard() : map.disableKeyboard();
  2359. inertialDragging ? map.enableInertialDragging() : map.disableInertialDragging();
  2360. continuousZoom ? map.enableContinuousZoom() : map.disableContinuousZoom();
  2361. pinchToZoom ? map.enablePinchToZoom() : map.disablePinchToZoom();
  2362. autoResize ? map.enableAutoResize() : map.disableAutoResize();
  2363. },
  2364. init: function init(BMap) {
  2365. if (this.map) {
  2366. return;
  2367. }
  2368. var $el = this.$refs.view;
  2369. var _iteratorNormalCompletion = true;
  2370. var _didIteratorError = false;
  2371. var _iteratorError = undefined;
  2372. try {
  2373. for (var _iterator = __WEBPACK_IMPORTED_MODULE_1_babel_runtime_core_js_get_iterator___default()(this.$slots.default || []), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  2374. var $node = _step.value;
  2375. if ($node.componentOptions && $node.componentOptions.tag === 'bm-view') {
  2376. this.hasBmView = true;
  2377. $el = $node.elm;
  2378. }
  2379. }
  2380. } catch (err) {
  2381. _didIteratorError = true;
  2382. _iteratorError = err;
  2383. } finally {
  2384. try {
  2385. if (!_iteratorNormalCompletion && _iterator.return) {
  2386. _iterator.return();
  2387. }
  2388. } finally {
  2389. if (_didIteratorError) {
  2390. throw _iteratorError;
  2391. }
  2392. }
  2393. }
  2394. var map = new BMap.Map($el, { enableHighResolution: this.highResolution, enableMapClick: this.mapClick });
  2395. this.map = map;
  2396. var setMapOptions = this.setMapOptions,
  2397. zoom = this.zoom,
  2398. getCenterPoint = this.getCenterPoint,
  2399. theme = this.theme,
  2400. mapStyle = this.mapStyle;
  2401. theme ? map.setMapStyle({ styleJson: theme }) : map.setMapStyle(mapStyle);
  2402. setMapOptions();
  2403. __WEBPACK_IMPORTED_MODULE_2__base_bindEvent_js__["a" /* default */].call(this, map);
  2404. // 此处强行初始化一次地图 回避一个由于错误的 center 字符串导致初始化失败抛出的错误
  2405. map.reset();
  2406. map.centerAndZoom(getCenterPoint(), zoom);
  2407. this.$emit('ready', { BMap: BMap, map: map });
  2408. // Debug
  2409. // global.map = map
  2410. // global.mapComponent = this
  2411. },
  2412. getCenterPoint: function getCenterPoint() {
  2413. var center = this.center,
  2414. BMap = this.BMap;
  2415. switch (Object(__WEBPACK_IMPORTED_MODULE_3__base_util_js__["a" /* checkType */])(center)) {
  2416. case 'String':
  2417. return center;
  2418. case 'Object':
  2419. return new BMap.Point(center.lng, center.lat);
  2420. default:
  2421. return new BMap.Point();
  2422. }
  2423. },
  2424. initMap: function initMap(BMap) {
  2425. this.BMap = BMap;
  2426. this.init(BMap);
  2427. },
  2428. getMapScript: function getMapScript() {
  2429. if (!global.BMap) {
  2430. var ak = this.ak || this._BMap().ak;
  2431. global.BMap = {};
  2432. global.BMap._preloader = new __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_promise___default.a(function (resolve, reject) {
  2433. global._initBaiduMap = function () {
  2434. resolve(global.BMap);
  2435. global.document.body.removeChild($script);
  2436. global.BMap._preloader = null;
  2437. global._initBaiduMap = null;
  2438. };
  2439. var $script = document.createElement('script');
  2440. global.document.body.appendChild($script);
  2441. $script.src = 'https://api.map.baidu.com/api?v=2.0&ak=' + ak + '&callback=_initBaiduMap';
  2442. });
  2443. return global.BMap._preloader;
  2444. } else if (!global.BMap._preloader) {
  2445. return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_core_js_promise___default.a.resolve(global.BMap);
  2446. } else {
  2447. return global.BMap._preloader;
  2448. }
  2449. },
  2450. reset: function reset() {
  2451. var getMapScript = this.getMapScript,
  2452. initMap = this.initMap;
  2453. getMapScript().then(initMap);
  2454. }
  2455. },
  2456. mounted: function mounted() {
  2457. this.reset();
  2458. },
  2459. data: function data() {
  2460. return {
  2461. hasBmView: false
  2462. };
  2463. }
  2464. });
  2465. /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__("DuR2")))
  2466. /***/ }),
  2467. /***/ "tjHi":
  2468. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  2469. "use strict";
  2470. Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
  2471. // EXTERNAL MODULE: ./node_modules/babel-runtime/helpers/toConsumableArray.js
  2472. var toConsumableArray = __webpack_require__("Gu7T");
  2473. var toConsumableArray_default = /*#__PURE__*/__webpack_require__.n(toConsumableArray);
  2474. // EXTERNAL MODULE: ./node_modules/babel-runtime/core-js/map.js
  2475. var core_js_map = __webpack_require__("ifoU");
  2476. var map_default = /*#__PURE__*/__webpack_require__.n(core_js_map);
  2477. // EXTERNAL MODULE: ./node_modules/babel-runtime/core-js/json/stringify.js
  2478. var stringify = __webpack_require__("mvHQ");
  2479. var stringify_default = /*#__PURE__*/__webpack_require__.n(stringify);
  2480. // EXTERNAL MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./node_modules/vue-baidu-map/components/map/Map.vue
  2481. var Map = __webpack_require__("Txow");
  2482. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-470f2580","hasScoped":false,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./node_modules/vue-baidu-map/components/map/Map.vue
  2483. var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[(!_vm.hasBmView)?_c('div',{ref:"view",staticStyle:{"width":"100%","height":"100%"}}):_vm._e(),_vm._v(" "),_vm._t("default")],2)}
  2484. var staticRenderFns = []
  2485. var esExports = { render: render, staticRenderFns: staticRenderFns }
  2486. /* harmony default export */ var map_Map = (esExports);
  2487. // CONCATENATED MODULE: ./node_modules/vue-baidu-map/components/map/Map.vue
  2488. var normalizeComponent = __webpack_require__("VU/8")
  2489. /* script */
  2490. /* template */
  2491. /* template functional */
  2492. var __vue_template_functional__ = false
  2493. /* styles */
  2494. var __vue_styles__ = null
  2495. /* scopeId */
  2496. var __vue_scopeId__ = null
  2497. /* moduleIdentifier (server only) */
  2498. var __vue_module_identifier__ = null
  2499. var Component = normalizeComponent(
  2500. Map["a" /* default */],
  2501. map_Map,
  2502. __vue_template_functional__,
  2503. __vue_styles__,
  2504. __vue_scopeId__,
  2505. __vue_module_identifier__
  2506. )
  2507. /* harmony default export */ var components_map_Map = (Component.exports);
  2508. // EXTERNAL MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./node_modules/vue-baidu-map/components/controls/Scale.vue
  2509. var Scale = __webpack_require__("7AC4");
  2510. // CONCATENATED MODULE: ./node_modules/vue-baidu-map/components/controls/Scale.vue
  2511. var Scale_normalizeComponent = __webpack_require__("VU/8")
  2512. /* script */
  2513. /* template */
  2514. var __vue_template__ = null
  2515. /* template functional */
  2516. var Scale___vue_template_functional__ = false
  2517. /* styles */
  2518. var Scale___vue_styles__ = null
  2519. /* scopeId */
  2520. var Scale___vue_scopeId__ = null
  2521. /* moduleIdentifier (server only) */
  2522. var Scale___vue_module_identifier__ = null
  2523. var Scale_Component = Scale_normalizeComponent(
  2524. Scale["a" /* default */],
  2525. __vue_template__,
  2526. Scale___vue_template_functional__,
  2527. Scale___vue_styles__,
  2528. Scale___vue_scopeId__,
  2529. Scale___vue_module_identifier__
  2530. )
  2531. /* harmony default export */ var controls_Scale = (Scale_Component.exports);
  2532. // EXTERNAL MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./node_modules/vue-baidu-map/components/controls/Navigation.vue
  2533. var Navigation = __webpack_require__("/ydS");
  2534. // CONCATENATED MODULE: ./node_modules/vue-baidu-map/components/controls/Navigation.vue
  2535. var Navigation_normalizeComponent = __webpack_require__("VU/8")
  2536. /* script */
  2537. /* template */
  2538. var Navigation___vue_template__ = null
  2539. /* template functional */
  2540. var Navigation___vue_template_functional__ = false
  2541. /* styles */
  2542. var Navigation___vue_styles__ = null
  2543. /* scopeId */
  2544. var Navigation___vue_scopeId__ = null
  2545. /* moduleIdentifier (server only) */
  2546. var Navigation___vue_module_identifier__ = null
  2547. var Navigation_Component = Navigation_normalizeComponent(
  2548. Navigation["a" /* default */],
  2549. Navigation___vue_template__,
  2550. Navigation___vue_template_functional__,
  2551. Navigation___vue_styles__,
  2552. Navigation___vue_scopeId__,
  2553. Navigation___vue_module_identifier__
  2554. )
  2555. /* harmony default export */ var controls_Navigation = (Navigation_Component.exports);
  2556. // EXTERNAL MODULE: ./node_modules/bmaplib.markerclusterer/index.js
  2557. var bmaplib_markerclusterer = __webpack_require__("3tqA");
  2558. var bmaplib_markerclusterer_default = /*#__PURE__*/__webpack_require__.n(bmaplib_markerclusterer);
  2559. // EXTERNAL MODULE: ./node_modules/vue-baidu-map/components/base/factory.js
  2560. var factory = __webpack_require__("Brla");
  2561. // EXTERNAL MODULE: ./node_modules/vue-baidu-map/components/base/mixins/common.js
  2562. var common = __webpack_require__("9LO+");
  2563. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./node_modules/vue-baidu-map/components/extra/MarkerClusterer.vue
  2564. //
  2565. //
  2566. //
  2567. //
  2568. //
  2569. //
  2570. /* harmony default export */ var MarkerClusterer = ({
  2571. name: 'bml-marker-clusterer',
  2572. mixins: [Object(common["a" /* default */])('markerClusterer')],
  2573. props: {
  2574. gridSize: {
  2575. type: Object
  2576. },
  2577. maxZoom: {
  2578. type: Number
  2579. },
  2580. minClusterSize: {
  2581. type: Number
  2582. },
  2583. styles: {
  2584. type: Array,
  2585. default: function _default() {
  2586. return [];
  2587. }
  2588. },
  2589. averageCenter: {
  2590. type: Boolean,
  2591. default: false
  2592. }
  2593. },
  2594. watch: {
  2595. gridSize: {
  2596. handler: function handler(val) {
  2597. var BMap = this.BMap,
  2598. originInstance = this.originInstance;
  2599. originInstance.setGridSize(BMap, val.map);
  2600. },
  2601. deep: true
  2602. },
  2603. maxZoom: function maxZoom(val) {
  2604. var originInstance = this.originInstance;
  2605. originInstance.setMaxZoom(val);
  2606. },
  2607. minClusterSize: {
  2608. handler: function handler(val) {
  2609. var BMap = this.BMap,
  2610. originInstance = this.originInstance;
  2611. originInstance.setMinClusterSize(Object(factory["d" /* createSize */])(BMap, val));
  2612. },
  2613. deep: true
  2614. },
  2615. styles: {
  2616. handler: function handler(val) {
  2617. var BMap = this.BMap,
  2618. originInstance = this.originInstance;
  2619. var obj = JSON.parse(stringify_default()(val)).map(function (item) {
  2620. item.size = item.size && Object(factory["d" /* createSize */])(BMap, item.size);
  2621. return item;
  2622. });
  2623. originInstance.setStyles(obj);
  2624. },
  2625. deep: true
  2626. },
  2627. averageCenter: function averageCenter(val) {
  2628. this.reload();
  2629. }
  2630. },
  2631. methods: {
  2632. load: function load() {
  2633. var _this = this;
  2634. var BMap = this.BMap,
  2635. map = this.map,
  2636. gridSize = this.gridSize,
  2637. minClusterSize = this.minClusterSize,
  2638. maxZoom = this.maxZoom,
  2639. styles = this.styles,
  2640. averageCenter = this.averageCenter;
  2641. this.originInstance = new bmaplib_markerclusterer_default.a(map, {
  2642. gridSize: gridSize && Object(factory["d" /* createSize */])(BMap, gridSize),
  2643. maxZoom: maxZoom,
  2644. minClusterSize: minClusterSize && Object(factory["d" /* createSize */])(BMap, minClusterSize),
  2645. styles: styles.map(function (item) {
  2646. item.size = Object(factory["d" /* createSize */])(BMap, item.size);
  2647. return item;
  2648. }),
  2649. isAverageCenter: averageCenter
  2650. });
  2651. this.$nextTick(function () {
  2652. var markers = _this.$children.map(function (inst) {
  2653. return inst.originInstance;
  2654. }).filter(function (marker) {
  2655. return marker instanceof BMap.Marker;
  2656. });
  2657. _this.originInstance.addMarkers(markers);
  2658. });
  2659. }
  2660. },
  2661. beforeCreate: function beforeCreate() {
  2662. this.preventChildrenRender = true;
  2663. }
  2664. });
  2665. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-02bae26d","hasScoped":false,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./node_modules/vue-baidu-map/components/extra/MarkerClusterer.vue
  2666. var MarkerClusterer_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('span',[_vm._t("default")],2)}
  2667. var MarkerClusterer_staticRenderFns = []
  2668. var MarkerClusterer_esExports = { render: MarkerClusterer_render, staticRenderFns: MarkerClusterer_staticRenderFns }
  2669. /* harmony default export */ var extra_MarkerClusterer = (MarkerClusterer_esExports);
  2670. // CONCATENATED MODULE: ./node_modules/vue-baidu-map/components/extra/MarkerClusterer.vue
  2671. var MarkerClusterer_normalizeComponent = __webpack_require__("VU/8")
  2672. /* script */
  2673. /* template */
  2674. /* template functional */
  2675. var MarkerClusterer___vue_template_functional__ = false
  2676. /* styles */
  2677. var MarkerClusterer___vue_styles__ = null
  2678. /* scopeId */
  2679. var MarkerClusterer___vue_scopeId__ = null
  2680. /* moduleIdentifier (server only) */
  2681. var MarkerClusterer___vue_module_identifier__ = null
  2682. var MarkerClusterer_Component = MarkerClusterer_normalizeComponent(
  2683. MarkerClusterer,
  2684. extra_MarkerClusterer,
  2685. MarkerClusterer___vue_template_functional__,
  2686. MarkerClusterer___vue_styles__,
  2687. MarkerClusterer___vue_scopeId__,
  2688. MarkerClusterer___vue_module_identifier__
  2689. )
  2690. /* harmony default export */ var components_extra_MarkerClusterer = (MarkerClusterer_Component.exports);
  2691. // EXTERNAL MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./node_modules/vue-baidu-map/components/overlays/Marker.vue
  2692. var Marker = __webpack_require__("PVXw");
  2693. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-8b00e1e8","hasScoped":false,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./node_modules/vue-baidu-map/components/overlays/Marker.vue
  2694. var Marker_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',[_vm._t("default")],2)}
  2695. var Marker_staticRenderFns = []
  2696. var Marker_esExports = { render: Marker_render, staticRenderFns: Marker_staticRenderFns }
  2697. /* harmony default export */ var overlays_Marker = (Marker_esExports);
  2698. // CONCATENATED MODULE: ./node_modules/vue-baidu-map/components/overlays/Marker.vue
  2699. var Marker_normalizeComponent = __webpack_require__("VU/8")
  2700. /* script */
  2701. /* template */
  2702. /* template functional */
  2703. var Marker___vue_template_functional__ = false
  2704. /* styles */
  2705. var Marker___vue_styles__ = null
  2706. /* scopeId */
  2707. var Marker___vue_scopeId__ = null
  2708. /* moduleIdentifier (server only) */
  2709. var Marker___vue_module_identifier__ = null
  2710. var Marker_Component = Marker_normalizeComponent(
  2711. Marker["a" /* default */],
  2712. overlays_Marker,
  2713. Marker___vue_template_functional__,
  2714. Marker___vue_styles__,
  2715. Marker___vue_scopeId__,
  2716. Marker___vue_module_identifier__
  2717. )
  2718. /* harmony default export */ var components_overlays_Marker = (Marker_Component.exports);
  2719. // EXTERNAL MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./node_modules/vue-baidu-map/components/overlays/InfoWindow.vue
  2720. var InfoWindow = __webpack_require__("8Hu+");
  2721. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-6b5c0453","hasScoped":false,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./node_modules/vue-baidu-map/components/overlays/InfoWindow.vue
  2722. var InfoWindow_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{directives:[{name:"show",rawName:"v-show",value:(_vm.show),expression:"show"}]},[_vm._t("default")],2)}
  2723. var InfoWindow_staticRenderFns = []
  2724. var InfoWindow_esExports = { render: InfoWindow_render, staticRenderFns: InfoWindow_staticRenderFns }
  2725. /* harmony default export */ var overlays_InfoWindow = (InfoWindow_esExports);
  2726. // CONCATENATED MODULE: ./node_modules/vue-baidu-map/components/overlays/InfoWindow.vue
  2727. var InfoWindow_normalizeComponent = __webpack_require__("VU/8")
  2728. /* script */
  2729. /* template */
  2730. /* template functional */
  2731. var InfoWindow___vue_template_functional__ = false
  2732. /* styles */
  2733. var InfoWindow___vue_styles__ = null
  2734. /* scopeId */
  2735. var InfoWindow___vue_scopeId__ = null
  2736. /* moduleIdentifier (server only) */
  2737. var InfoWindow___vue_module_identifier__ = null
  2738. var InfoWindow_Component = InfoWindow_normalizeComponent(
  2739. InfoWindow["a" /* default */],
  2740. overlays_InfoWindow,
  2741. InfoWindow___vue_template_functional__,
  2742. InfoWindow___vue_styles__,
  2743. InfoWindow___vue_scopeId__,
  2744. InfoWindow___vue_module_identifier__
  2745. )
  2746. /* harmony default export */ var components_overlays_InfoWindow = (InfoWindow_Component.exports);
  2747. // EXTERNAL MODULE: ./src/api/index.js + 5 modules
  2748. var api = __webpack_require__("gyMJ");
  2749. // EXTERNAL MODULE: ./node_modules/moment/moment.js
  2750. var moment = __webpack_require__("PJh5");
  2751. var moment_default = /*#__PURE__*/__webpack_require__.n(moment);
  2752. // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/views/doorMagnetism/home.vue
  2753. //
  2754. //
  2755. //
  2756. //
  2757. //
  2758. //
  2759. //
  2760. //
  2761. //
  2762. //
  2763. //
  2764. //
  2765. //
  2766. //
  2767. //
  2768. //
  2769. //
  2770. //
  2771. //
  2772. //
  2773. //
  2774. //
  2775. //
  2776. //
  2777. //
  2778. //
  2779. //
  2780. //
  2781. //
  2782. //
  2783. //
  2784. //
  2785. //
  2786. //
  2787. //
  2788. //
  2789. //
  2790. //
  2791. //
  2792. //
  2793. //
  2794. //
  2795. //
  2796. //
  2797. //
  2798. //
  2799. //
  2800. //
  2801. //
  2802. //
  2803. //
  2804. //
  2805. //
  2806. //
  2807. //
  2808. //
  2809. //
  2810. //
  2811. //
  2812. //
  2813. //
  2814. //
  2815. //
  2816. //
  2817. //
  2818. //
  2819. //
  2820. //
  2821. //
  2822. //
  2823. //
  2824. //
  2825. //
  2826. //
  2827. //
  2828. //
  2829. //
  2830. //
  2831. //
  2832. //
  2833. //
  2834. //
  2835. //
  2836. //
  2837. //
  2838. //
  2839. //
  2840. //
  2841. //
  2842. //
  2843. //
  2844. //
  2845. //
  2846. //
  2847. //
  2848. //
  2849. //
  2850. //
  2851. //
  2852. //
  2853. //
  2854. // import AMap from 'AMap'
  2855. /* harmony default export */ var home = ({
  2856. // inject: ['reload'],
  2857. name: "Home",
  2858. data: function data() {
  2859. var self = this;
  2860. return {
  2861. selectoption: [],
  2862. selectoptionValue: '',
  2863. Processed: 0,
  2864. openDoorlog: 0,
  2865. closeDoorlog: 0,
  2866. fcDoorlog: 0,
  2867. map: {
  2868. zoom: 10,
  2869. width: "100%",
  2870. height: "100%",
  2871. center: {
  2872. lng: 114.064552,
  2873. lat: 22.548457
  2874. }
  2875. },
  2876. points: [{
  2877. lng: 114.064552,
  2878. lat: 22.548457
  2879. }],
  2880. markers: [],
  2881. infoWindow: {
  2882. lng: 114.064552,
  2883. lat: 22.548457,
  2884. show: false,
  2885. info: {
  2886. air: 0,
  2887. area: 12313,
  2888. areaEnergy: '深圳市',
  2889. code: "440300A055",
  2890. energy: 7922.66,
  2891. lat: "22.548457",
  2892. lng: "114.064552",
  2893. name: "",
  2894. water: 0
  2895. }
  2896. },
  2897. center: [114.064552, 22.548457],
  2898. lng: 0,
  2899. lat: 0,
  2900. loaded: false,
  2901. zoom: 19,
  2902. alarmList: [],
  2903. settime: 0,
  2904. fault: 0,
  2905. alert: 0,
  2906. a1: 0,
  2907. a2: 0,
  2908. a3: 0,
  2909. Statistics: {
  2910. projectSum: 0,
  2911. deviceSum: 0,
  2912. bindingSum: 0,
  2913. islineSum: 0,
  2914. unlineSum: 0,
  2915. lowElectricity: 0,
  2916. openlook: 0,
  2917. closelook: 0,
  2918. openDoorlog: 0,
  2919. closeDoorlog: 0,
  2920. fcDoorlog: 0,
  2921. Processed: 0
  2922. },
  2923. settime1: '',
  2924. unlineDevice: '',
  2925. unlinedeviceSum: 0,
  2926. allunline: [],
  2927. settime2: null,
  2928. audiosrc: __webpack_require__("8R8w"),
  2929. prelist: [],
  2930. userInfo: { type: '' }
  2931. };
  2932. },
  2933. components: {
  2934. BaiduMap: components_map_Map,
  2935. BmScale: controls_Scale,
  2936. BmNavigation: controls_Navigation,
  2937. BmMarkerClusterer: components_extra_MarkerClusterer,
  2938. BmMarker: components_overlays_Marker,
  2939. BmInfoWindow: components_overlays_InfoWindow
  2940. },
  2941. created: function created() {
  2942. this.userInfo = JSON.parse(localStorage.getItem('info'));
  2943. // this.selectoption = JSON.parse(localStorage.getItem('selectoption'))
  2944. // this.selectoptionValue = localStorage.getItem('tenantId')
  2945. // var _this = this
  2946. // // this.$refs.audio.play()
  2947. // this.getalertDevice()
  2948. // this.settime2 = setInterval(function() {
  2949. // _this.getalertDevice()
  2950. // }, 3000)
  2951. },
  2952. activated: function activated() {
  2953. var _this = this;
  2954. this.settime1 = setInterval(function () {
  2955. _this.getReportList();
  2956. _this.getSum();
  2957. }, 30000);
  2958. },
  2959. beforeDestroy: function beforeDestroy() {
  2960. window.clearInterval(this.settime1);
  2961. this.settime1 = null;
  2962. },
  2963. beforeRouteLeave: function beforeRouteLeave(to, from, next) {
  2964. window.clearInterval(this.settime1);
  2965. this.settime1 = null;
  2966. next();
  2967. },
  2968. mounted: function mounted() {
  2969. var _this = this;
  2970. this.Statistics.openlook = this.$store.state.openlook;
  2971. this.getSum();
  2972. this.getReportList();
  2973. this.settime1 = setInterval(function () {
  2974. _this.getReportList();
  2975. _this.getSum();
  2976. }, 30000);
  2977. },
  2978. watch: {
  2979. '$store.state.Statistics.openlook': function $storeStateStatisticsOpenlook() {
  2980. this.Statistics.openlook = this.$store.state.Statistics.openlook;
  2981. }
  2982. },
  2983. methods: {
  2984. // selectTenantId(e) {
  2985. // localStorage.setItem('tenantId', e)
  2986. // this.reload()
  2987. // },
  2988. validate: function validate(arr1, arr2) {
  2989. if (!arr1 instanceof Array || !arr2 instanceof Array) {
  2990. return true;
  2991. }
  2992. if (arr1.length != arr2.length) {
  2993. return false;
  2994. }
  2995. var arr1Str = stringify_default()(arr1);
  2996. for (var i = 0; i < arr2.length; i++) {
  2997. if (arr1Str.indexOf(stringify_default()(arr2[i])) == -1) {
  2998. return false;
  2999. }
  3000. }
  3001. return true;
  3002. },
  3003. unique: function unique(arr, u_key) {
  3004. var map = new map_default.a();
  3005. arr.forEach(function (item, index) {
  3006. if (!map.has(item[u_key])) {
  3007. map.set(item[u_key], item);
  3008. }
  3009. });
  3010. return [].concat(toConsumableArray_default()(map.values()));
  3011. },
  3012. getalertDevice: function getalertDevice() {
  3013. var _this2 = this;
  3014. // if (this.currentPage > this.carouselPage) {
  3015. // this.currentPage = 1
  3016. // }
  3017. var data = {
  3018. pageNum: 1,
  3019. pageSize: 1,
  3020. orderType: 'desc',
  3021. orderBy: "createAt",
  3022. q: stringify_default()({
  3023. lockStatus: 1
  3024. })
  3025. };
  3026. Object(api["i" /* httpPostno */])(data, this.$api.getList).then(function (res) {
  3027. if (res.success) {
  3028. _this2.$store.commit('updatedata', res.data.total);
  3029. }
  3030. });
  3031. var data = {
  3032. pageNum: this.currentPage,
  3033. pageSize: this.pageSize,
  3034. orderType: 'desc',
  3035. orderBy: "createAt",
  3036. q: stringify_default()({
  3037. operateCode: 1,
  3038. startTime: moment_default()().subtract('days', 0).format('YYYY-MM-DD 00:00:00'),
  3039. endTime: moment_default()().format('YYYY-MM-DD HH:mm:ss')
  3040. })
  3041. };
  3042. Object(api["i" /* httpPostno */])(data, this.$api.getReportList).then(function (res) {
  3043. if (res.success) {
  3044. // if (res.data.total > 0) {
  3045. // } else {
  3046. // this.$refs.audio.pause()
  3047. // this.vocieStatus = true
  3048. // }
  3049. res.data.list.map(function (li) {
  3050. li.createAt = moment_default()(li.createAt).format('YYYY/MM/DD HH:mm:ss');
  3051. });
  3052. var time = new Date();
  3053. var list = [];
  3054. res.data.list.map(function (li) {
  3055. var time = moment_default()(time).valueOf();
  3056. var time1 = moment_default()(li.createAt).valueOf();
  3057. li['sharkFlag'] = false;
  3058. if (time - time1 < 6000) {
  3059. list.push(li);
  3060. li['sharkFlag'] = true;
  3061. }
  3062. });
  3063. _this2.poplist(list);
  3064. // this.alarmList = res.data.list
  3065. _this2.unlinedeviceSum = res.data.total;
  3066. _this2.tableData = res.data.list;
  3067. _this2.pageTotal = res.data.total;
  3068. } else {
  3069. _this2.$message.error(res.msg);
  3070. }
  3071. });
  3072. },
  3073. poplist: function poplist(list) {
  3074. var _this3 = this;
  3075. var list1 = this.unique(list, 'imei');
  3076. var tt = this.validate(this.prelist, list1);
  3077. if (tt) {} else {
  3078. this.prelist = list1;
  3079. if (list1.length == 0) {
  3080. this.$refs.audio.pause();
  3081. } else {
  3082. if (!this.vocieStatus) {
  3083. this.$refs.audio.play();
  3084. this.vocieStatus = false;
  3085. setTimeout(function () {
  3086. _this3.$refs.audio.pause();
  3087. }, 10000);
  3088. }
  3089. }
  3090. list1.map(function (li) {
  3091. setTimeout(function () {
  3092. _this3.$notify({
  3093. title: li.name,
  3094. offset: 200,
  3095. duration: 2000,
  3096. message: li.createAt + ' 开门警报',
  3097. type: 'warning'
  3098. });
  3099. }, 3000);
  3100. });
  3101. }
  3102. },
  3103. getSum: function getSum() {
  3104. var _this4 = this;
  3105. var data = {};
  3106. Object(api["f" /* httpGetno */])(data, this.$api.getEnterprise).then(function (res) {
  3107. if (res.success) {
  3108. _this4.Statistics.projectSum = res.data.total;
  3109. }
  3110. });
  3111. var data1 = {
  3112. pageSize: 0,
  3113. pageNum: 0
  3114. };
  3115. Object(api["i" /* httpPostno */])(data1, this.$api.getList).then(function (res) {
  3116. if (res.success) {
  3117. var arr = [0, 0, 0, 0];
  3118. var st = [0, 0, 0];
  3119. var unlineList = [];
  3120. var bindSum = 0;
  3121. res.data.list.forEach(function (li) {
  3122. if (li.isOnline == 1) {
  3123. arr[0] += 1;
  3124. } else if (li.isOnline == 0) {
  3125. arr[1] += 1;
  3126. }
  3127. if (li.roomId) {
  3128. bindSum += 1;
  3129. }
  3130. if (li.lockStatus == 1) {
  3131. arr[2] += 1;
  3132. unlineList.push(li);
  3133. } else if (li.lockStatus == 0) {
  3134. arr[3] += 1;
  3135. }
  3136. if (li.battery >= 0 && li.battery <= 15) {
  3137. st[0] += 1;
  3138. } else if (li.battery > 15 && li.battery <= 60) {
  3139. st[1] += 1;
  3140. } else if (li.battery > 60 && li.battery <= 100) {
  3141. st[2] += 1;
  3142. }
  3143. });
  3144. _this4.Statistics.deviceSum = res.data.total;
  3145. _this4.Statistics.unlineSum = arr[1];
  3146. _this4.Statistics.islineSum = arr[0];
  3147. _this4.Statistics.openlook = arr[2];
  3148. _this4.Statistics.closelook = arr[3];
  3149. _this4.Statistics.bindingSum = bindSum;
  3150. _this4.Statistics.deviceBattery = st;
  3151. _this4.Statistics.lowElectricity = st[0];
  3152. _this4.Statistics.unlineList = unlineList;
  3153. _this4.infoWindow.info.air = res.data.total;
  3154. _this4.drawLine();
  3155. _this4.drawLine1();
  3156. _this4.getalert();
  3157. }
  3158. });
  3159. },
  3160. handler: function handler(_ref) {
  3161. var BMap = _ref.BMap,
  3162. map = _ref.map;
  3163. map.setMapStyle({
  3164. style: "midnight"
  3165. });
  3166. },
  3167. infoWindowClose: function infoWindowClose(e) {
  3168. this.infoWindow.show = false;
  3169. },
  3170. infoWindowOpen: function infoWindowOpen(e) {
  3171. this.infoWindow.show = true;
  3172. },
  3173. lookDetail: function lookDetail(data, target) {
  3174. var _this5 = this;
  3175. this.infoWindow.show = true;
  3176. return;
  3177. this.infoWindow.info = data;
  3178. this.activeName = data.name;
  3179. //为弹窗口标题添加title
  3180. this.$nextTick(function () {
  3181. var win = document.querySelector(".BMap_bubble_title");
  3182. win.title = _this5.activeName;
  3183. });
  3184. if (target == 'left') {
  3185. //点击的是左侧列表项,则不需要滚动
  3186. this.map.center = {
  3187. lng: data.lng,
  3188. lat: data.lat
  3189. };
  3190. this.map.zoom = 15;
  3191. return;
  3192. }
  3193. //滚动到指定元素位置
  3194. this.$nextTick(function () {
  3195. var obj = document.querySelector(".active");
  3196. var scrollTop = obj.offsetTop;
  3197. _this5.$refs.box.scrollTop = scrollTop - 180;
  3198. });
  3199. },
  3200. getReportList: function getReportList() {
  3201. var _this6 = this;
  3202. var data = {
  3203. pageNum: 1,
  3204. pageSize: 20,
  3205. orderType: 'desc',
  3206. orderBy: "createAt"
  3207. };
  3208. Object(api["i" /* httpPostno */])(data, this.$api.getReportList).then(function (res) {
  3209. if (res.success) {
  3210. res.data.list.map(function (li) {
  3211. li.createAt = moment_default()(li.createAt).format('YYYY/MM/DD HH:mm:ss');
  3212. });
  3213. _this6.alarmList = res.data.list;
  3214. } else {
  3215. _this6.$message.error(res.msg);
  3216. }
  3217. }).catch(function (error) {
  3218. _this6.$message.error(error.msg);
  3219. });
  3220. },
  3221. // 根据类型和指定天数范围获取报警记录
  3222. getOrderReport: function getOrderReport() {
  3223. // 设备报警
  3224. var Statistics = this.Statistics;
  3225. this.Processed = Statistics.Processed;
  3226. this.openDoorlog = Statistics.openDoorlog;
  3227. this.closeDoorlog = Statistics.closeDoorlog;
  3228. this.fcDoorlog = Statistics.fcDoorlog;
  3229. },
  3230. getalert: function getalert() {
  3231. var _this7 = this;
  3232. var str1 = {
  3233. day: 7
  3234. };
  3235. Object(api["i" /* httpPostno */])(str1, this.$api.monitorReport).then(function (res) {
  3236. if (res.success) {
  3237. var dat = [0, 0, 0, 0, 0, 0, 0],
  3238. dat1 = [0, 0, 0, 0, 0, 0, 0],
  3239. dat2 = [0, 0, 0, 0, 0, 0, 0],
  3240. dat3 = [0, 0, 0, 0, 0, 0, 0];
  3241. var day8 = moment_default()().subtract('days', 6).format('YYYY/MM/DD');
  3242. var day7 = moment_default()().subtract('days', 5).format('YYYY/MM/DD');
  3243. var day6 = moment_default()().subtract('days', 4).format('YYYY/MM/DD');
  3244. var day5 = moment_default()().subtract('days', 3).format('YYYY/MM/DD');
  3245. var day4 = moment_default()().subtract('days', 2).format('YYYY/MM/DD');
  3246. var day3 = moment_default()().subtract('days', 1).format('YYYY/MM/DD');
  3247. var day2 = moment_default()().subtract('days', 0).format('YYYY/MM/DD');
  3248. var i = 0;
  3249. res.data.map(function (li) {
  3250. if (li.code == 1) {
  3251. if (li.order == day8) {
  3252. dat[0] += li.count;
  3253. } else if (li.order == day7) {
  3254. dat[1] += li.count;
  3255. } else if (li.order == day6) {
  3256. dat[2] += li.count;
  3257. } else if (li.order == day5) {
  3258. dat[3] += li.count;
  3259. } else if (li.order == day4) {
  3260. dat[4] += li.count;
  3261. } else if (li.order == day3) {
  3262. dat[5] += li.count;
  3263. } else if (li.order == day2) {
  3264. console.log(li);
  3265. dat[6] += li.count;
  3266. }
  3267. } else if (li.code == 2) {
  3268. if (li.order == day8) {
  3269. dat3[0] += li.count;
  3270. } else if (li.order == day7) {
  3271. dat3[1] += li.count;
  3272. } else if (li.order == day6) {
  3273. dat3[2] += li.count;
  3274. } else if (li.order == day5) {
  3275. dat3[3] += li.count;
  3276. } else if (li.order == day4) {
  3277. dat3[4] += li.count;
  3278. } else if (li.order == day3) {
  3279. dat3[5] += li.count;
  3280. } else if (li.order == day2) {
  3281. dat3[6] += li.count;
  3282. }
  3283. } else if (li.code == 4) {
  3284. if (li.order == day8) {
  3285. dat1[0] += li.count;
  3286. } else if (li.order == day7) {
  3287. dat1[1] += li.count;
  3288. } else if (li.order == day6) {
  3289. dat1[2] += li.count;
  3290. } else if (li.order == day5) {
  3291. dat1[3] += li.count;
  3292. } else if (li.order == day4) {
  3293. dat1[4] += li.count;
  3294. } else if (li.order == day3) {
  3295. dat1[5] += li.count;
  3296. } else if (li.order == day2) {
  3297. dat1[6] += li.count;
  3298. }
  3299. } else if (li.code == 17) {
  3300. if (li.order == day8) {
  3301. dat2[0] += li.count;
  3302. } else if (li.order == day7) {
  3303. dat2[1] += li.count;
  3304. } else if (li.order == day6) {
  3305. dat2[2] += li.count;
  3306. } else if (li.order == day5) {
  3307. dat2[3] += li.count;
  3308. } else if (li.order == day4) {
  3309. dat2[4] += li.count;
  3310. } else if (li.order == day3) {
  3311. dat2[5] += li.count;
  3312. } else if (li.order == day2) {
  3313. dat2[6] += li.count;
  3314. }
  3315. }
  3316. });
  3317. var allertLog = {};
  3318. _this7.openDoorlog = dat[6];
  3319. _this7.closeDoorlog = dat2[6];
  3320. _this7.fcDoorlog = dat1[6];
  3321. _this7.LowElectricity = dat3[6];
  3322. allertLog.openDoorlog = dat;
  3323. allertLog.closeDoorlog = dat2;
  3324. allertLog.fcDoorlog = dat1;
  3325. allertLog.LowElectricity = dat3;
  3326. var myChart = _this7.$echarts.init(_this7.$refs.myChart2);
  3327. // 绘制图表
  3328. var str = new Array(7);
  3329. for (var i = 0; i < 7; i++) {
  3330. str[i] = moment_default()().subtract(i, 'days').format('MM月DD号');
  3331. }
  3332. myChart.setOption({
  3333. tooltip: {
  3334. trigger: 'item'
  3335. },
  3336. legend: {
  3337. data: ['开门报警', '关门报警', '防拆报警', '低电报警'],
  3338. left: '4%',
  3339. // x:'left',
  3340. top: '8%',
  3341. textStyle: {
  3342. fontSize: 12,
  3343. color: '#F1F1F3'
  3344. }
  3345. },
  3346. xAxis: {
  3347. type: 'category',
  3348. boundaryGap: false,
  3349. axisLabel: {
  3350. textStyle: {
  3351. color: "#fff"
  3352. }
  3353. },
  3354. axisLine: {
  3355. lineStyle: {
  3356. color: "rgba(219,225,255,1)",
  3357. width: 1,
  3358. type: "solid"
  3359. }
  3360. },
  3361. data: [str[6], str[5], str[4], str[3], str[2], str[1], str[0]]
  3362. },
  3363. yAxis: {
  3364. type: 'value',
  3365. axisLabel: {
  3366. textStyle: {
  3367. color: "#fff"
  3368. }
  3369. },
  3370. axisLine: {
  3371. lineStyle: {
  3372. color: "rgba(219,225,255,1)",
  3373. width: 1,
  3374. type: "solid"
  3375. }
  3376. }
  3377. },
  3378. series: [{
  3379. name: "开门报警",
  3380. data: [allertLog.openDoorlog[0], allertLog.openDoorlog[1], allertLog.openDoorlog[2], allertLog.openDoorlog[3], allertLog.openDoorlog[4], allertLog.openDoorlog[5], allertLog.openDoorlog[6]],
  3381. type: 'line',
  3382. stack: 'Total',
  3383. areaStyle: {},
  3384. emphasis: {
  3385. focus: 'series'
  3386. }
  3387. }, {
  3388. name: "关门报警",
  3389. data: [allertLog.closeDoorlog[0], allertLog.closeDoorlog[1], allertLog.closeDoorlog[2], allertLog.closeDoorlog[3], allertLog.closeDoorlog[4], allertLog.closeDoorlog[5], allertLog.closeDoorlog[6]],
  3390. type: 'line',
  3391. stack: 'Total',
  3392. areaStyle: {},
  3393. emphasis: {
  3394. focus: 'series'
  3395. }
  3396. }, {
  3397. name: "防拆报警",
  3398. data: [allertLog.fcDoorlog[0], allertLog.fcDoorlog[1], allertLog.fcDoorlog[2], allertLog.fcDoorlog[3], allertLog.fcDoorlog[4], allertLog.fcDoorlog[5], allertLog.fcDoorlog[6]],
  3399. type: 'line',
  3400. stack: 'Total',
  3401. areaStyle: {},
  3402. emphasis: {
  3403. focus: 'series'
  3404. }
  3405. }, {
  3406. name: "低电报警",
  3407. data: [allertLog.LowElectricity[0], allertLog.LowElectricity[1], allertLog.LowElectricity[2], allertLog.LowElectricity[3], allertLog.LowElectricity[4], allertLog.LowElectricity[5], allertLog.LowElectricity[6]],
  3408. type: 'line',
  3409. stack: 'Total',
  3410. areaStyle: {},
  3411. emphasis: {
  3412. focus: 'series'
  3413. }
  3414. }]
  3415. });
  3416. }
  3417. });
  3418. },
  3419. drawLine2: function drawLine2() {
  3420. // 基于准备好的dom,初始化echarts实例
  3421. var myChart = this.$echarts.init(this.$refs.myChart2);
  3422. // 绘制图表
  3423. var str = new Array(7);
  3424. for (var i = 0; i < 7; i++) {
  3425. str[i] = moment_default()().subtract(i, 'days').format('MM月DD号');
  3426. }
  3427. var allertLog = this.Statistics;
  3428. myChart.setOption({
  3429. tooltip: {
  3430. trigger: 'item'
  3431. },
  3432. legend: {
  3433. data: ['开门报警', '关门报警', '防拆报警', '低电报警'],
  3434. right: '10%',
  3435. top: '8%',
  3436. x: 'left',
  3437. textStyle: {
  3438. fontSize: 12,
  3439. color: '#F1F1F3'
  3440. }
  3441. },
  3442. xAxis: {
  3443. type: 'category',
  3444. boundaryGap: false,
  3445. axisLabel: {
  3446. interval: 0,
  3447. rotate: 45,
  3448. textStyle: {
  3449. color: "#fff"
  3450. }
  3451. },
  3452. axisLine: {
  3453. lineStyle: {
  3454. color: "rgba(219,225,255,1)",
  3455. width: 1,
  3456. type: "solid"
  3457. }
  3458. },
  3459. data: [str[6], str[5], str[4], str[3], str[2], str[1], str[0]]
  3460. },
  3461. yAxis: {
  3462. type: 'value',
  3463. axisLabel: {
  3464. textStyle: {
  3465. color: "#fff"
  3466. }
  3467. },
  3468. axisLine: {
  3469. lineStyle: {
  3470. color: "rgba(219,225,255,1)",
  3471. width: 1,
  3472. type: "solid"
  3473. }
  3474. }
  3475. },
  3476. series: [{
  3477. name: "开门报警",
  3478. data: [allertLog.openDoorlog[0], allertLog.openDoorlog[1], allertLog.openDoorlog[2], allertLog.openDoorlog[3], allertLog.openDoorlog[4], allertLog.openDoorlog[5], allertLog.openDoorlog[6]],
  3479. type: 'line',
  3480. stack: 'Total',
  3481. areaStyle: {},
  3482. emphasis: {
  3483. focus: 'series'
  3484. }
  3485. }, {
  3486. name: "关门报警",
  3487. data: [allertLog.closeDoorlog[0], allertLog.closeDoorlog[1], allertLog.closeDoorlog[2], allertLog.closeDoorlog[3], allertLog.closeDoorlog[4], allertLog.closeDoorlog[5], allertLog.closeDoorlog[6]],
  3488. type: 'line',
  3489. stack: 'Total',
  3490. areaStyle: {},
  3491. emphasis: {
  3492. focus: 'series'
  3493. }
  3494. }, {
  3495. name: "防拆报警",
  3496. data: [allertLog.fcDoorlog[0], allertLog.fcDoorlog[1], allertLog.fcDoorlog[2], allertLog.fcDoorlog[3], allertLog.fcDoorlog[4], allertLog.fcDoorlog[5], allertLog.fcDoorlog[6]],
  3497. type: 'line',
  3498. stack: 'Total',
  3499. areaStyle: {},
  3500. emphasis: {
  3501. focus: 'series'
  3502. }
  3503. }, {
  3504. name: "低电报警",
  3505. data: [allertLog.fcDoorlog[0], allertLog.fcDoorlog[1], allertLog.fcDoorlog[2], allertLog.fcDoorlog[3], allertLog.fcDoorlog[4], allertLog.fcDoorlog[5], allertLog.fcDoorlog[6]],
  3506. type: 'line',
  3507. stack: 'Total',
  3508. areaStyle: {},
  3509. emphasis: {
  3510. focus: 'series'
  3511. }
  3512. }]
  3513. });
  3514. },
  3515. // 统计设备总数和房间总数
  3516. drawLine1: function drawLine1() {
  3517. // 基于准备好的dom,初始化echarts实例
  3518. var myChart = this.$echarts.init(this.$refs.myChart1);
  3519. // 绘制图表
  3520. var Statistics = this.Statistics;
  3521. myChart.setOption({
  3522. tooltip: {
  3523. trigger: 'item'
  3524. },
  3525. legend: {
  3526. show: false
  3527. },
  3528. series: [{
  3529. name: '设备电量状态',
  3530. type: 'pie',
  3531. radius: '50%',
  3532. data: [{
  3533. value: Statistics.deviceBattery[0],
  3534. name: '低电'
  3535. }, {
  3536. value: Statistics.deviceBattery[1],
  3537. name: '电量(15%-60%)'
  3538. }, {
  3539. value: Statistics.deviceBattery[2],
  3540. name: '电量(60%-100%)'
  3541. }],
  3542. emphasis: {
  3543. itemStyle: {
  3544. shadowBlur: 10,
  3545. shadowOffsetX: 0,
  3546. shadowColor: 'rgba(255, 255, 255, 0.5)'
  3547. }
  3548. }
  3549. }]
  3550. });
  3551. },
  3552. drawLine: function drawLine() {
  3553. // 基于准备好的dom,初始化echarts实例
  3554. var myChart = this.$echarts.init(this.$refs.myChart);
  3555. var Statistics = this.Statistics;
  3556. // 绘制图表
  3557. myChart.setOption({
  3558. title: {
  3559. text: '',
  3560. textAlign: 'center',
  3561. x: 'center',
  3562. y: 'center',
  3563. textStyle: {
  3564. color: '#ffffff' //字体颜色
  3565. }
  3566. },
  3567. tooltip: {},
  3568. xAxis: {
  3569. data: ["项目总数", "设备总数", "已绑定数量", "在线数量", "离线数量", "低电数量", "门开数量", "门关数量"],
  3570. axisLabel: {
  3571. interval: 0,
  3572. rotate: 45,
  3573. textStyle: {
  3574. color: "#fff",
  3575. fontSize: 12
  3576. }
  3577. },
  3578. axisLine: {
  3579. lineStyle: {
  3580. color: "rgba(219,225,255,1)",
  3581. width: 0.5,
  3582. type: "solid"
  3583. }
  3584. }
  3585. },
  3586. legend: {
  3587. textStyle: {
  3588. color: "#fff"
  3589. },
  3590. show: false
  3591. },
  3592. yAxis: {
  3593. name: '单位/个',
  3594. axisLabel: {
  3595. textStyle: {
  3596. color: "#fff"
  3597. }
  3598. },
  3599. axisLine: {
  3600. lineStyle: {
  3601. color: "rgba(219,225,255,1)",
  3602. width: 1,
  3603. type: "solid"
  3604. }
  3605. }
  3606. },
  3607. series: [{
  3608. name: '',
  3609. type: 'bar',
  3610. itemStyle: {
  3611. barWidth: 10,
  3612. normal: {
  3613. label: {
  3614. show: true, //开启显示
  3615. position: 'top', //在上方显示
  3616. textStyle: { //数值样式
  3617. color: 'white',
  3618. fontSize: 10
  3619. }
  3620. }
  3621. }
  3622. },
  3623. data: [{
  3624. value: Statistics.projectSum,
  3625. itemStyle: {
  3626. color: '#00BFB4'
  3627. }
  3628. }, {
  3629. value: Statistics.deviceSum,
  3630. itemStyle: {
  3631. color: '#32ECFF'
  3632. }
  3633. }, {
  3634. value: Statistics.bindingSum,
  3635. itemStyle: {
  3636. color: '#EB55FF'
  3637. }
  3638. }, {
  3639. value: Statistics.islineSum,
  3640. itemStyle: {
  3641. color: '#00BFB4'
  3642. }
  3643. }, {
  3644. value: Statistics.unlineSum,
  3645. itemStyle: {
  3646. color: '#32ECFF'
  3647. }
  3648. }, {
  3649. value: Statistics.lowElectricity,
  3650. itemStyle: {
  3651. color: '#EB55FF'
  3652. }
  3653. }, {
  3654. value: Statistics.openlook,
  3655. itemStyle: {
  3656. color: '#00BFB4'
  3657. }
  3658. }, {
  3659. value: Statistics.closelook,
  3660. itemStyle: {
  3661. color: '#32ECFF'
  3662. }
  3663. }]
  3664. }]
  3665. });
  3666. }
  3667. }
  3668. });
  3669. // CONCATENATED MODULE: ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-789f624e","hasScoped":true,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./src/views/doorMagnetism/home.vue
  3670. var home_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"home main-cont1"},[_c('el-badge',{staticClass:"item",attrs:{"value":_vm.Statistics.openlook}},[_c('router-link',{attrs:{"to":"EquipmentList"}},[_c('img',{staticClass:"alertimg",attrs:{"src":__webpack_require__("/nO3"),"alt":""}})])],1),_vm._v(" "),_c('div',{staticClass:"flexcolum"},[_c('div',{staticClass:"columdiv columdiv1"},[_c('div',{staticStyle:{"position":"relative"}},[_c('div',{ref:"myChart",attrs:{"id":"myChart"}}),_vm._v(" "),(_vm.userInfo.type==0)?_c('div',{staticClass:"selectoptions"},[_c('selectoption')],1):_vm._e()]),_vm._v(" "),_c('div',{staticClass:"fault"},[_vm._m(0),_vm._v(" "),_c('div',{staticClass:"textlist"},[_c('div',{staticClass:"textli"},[_c('div',[_vm._v("今日开门报警")]),_vm._v(" "),_c('div',{staticClass:"red"},[_vm._v(_vm._s(_vm.openDoorlog)+"起")])]),_vm._v(" "),_c('div',{staticClass:"textli"},[_c('div',[_vm._v("已关门报警")]),_vm._v(" "),_c('div',{staticClass:"red"},[_vm._v(_vm._s(_vm.closeDoorlog)+"起")])]),_vm._v(" "),_c('div',{staticClass:"textli"},[_c('div',[_vm._v("今日防拆报警")]),_vm._v(" "),_c('div',{staticClass:"orange"},[_vm._v(_vm._s(_vm.fcDoorlog)+"起")])]),_vm._v(" "),_c('div',{staticClass:"textli"},[_c('div',[_vm._v("防拆处理")]),_vm._v(" "),_c('div',{staticClass:"orange"},[_vm._v(_vm._s(_vm.fcDoorlog)+"起")])])])])]),_vm._v(" "),_c('div',{staticClass:"columdiv"},[_c('div',{ref:"myChart1",attrs:{"id":"myChart1"}}),_vm._v(" "),_c('div',{staticClass:"fault fault1"},[_c('div',{staticClass:"table"},[_c('table',{staticClass:"tablexontent"},[_vm._m(1),_vm._v(" "),_c('div',{staticClass:"alarm"},_vm._l((_vm.alarmList),function(item,index){return _c('tr',{key:index},[_c('th',[_vm._v(_vm._s(item.createAt))]),_vm._v(" "),_c('th',[_vm._v(_vm._s(item.name))]),_vm._v(" "),_c('th',[(item.operateCode==0)?_c('span',[_vm._v("心跳")]):_vm._e(),_vm._v(" "),(item.operateCode==1)?_c('span',[_vm._v("门已打开报警")]):_vm._e(),_vm._v(" "),(item.operateCode==2)?_c('span',[_vm._v("低电压告警")]):_vm._e(),_vm._v(" "),(item.operateCode==4)?_c('span',[_vm._v("防拆报警")]):_vm._e(),_vm._v(" "),(item.operateCode==5)?_c('span',[_vm._v("设备故障")]):_vm._e(),_vm._v(" "),(item.operateCode==13)?_c('span',[_vm._v("设备测试")]):_vm._e(),_vm._v(" "),(item.operateCode==17)?_c('span',[_vm._v("门已关")]):_vm._e(),_vm._v(" "),(item.operateCode==18)?_c('span',[_vm._v("低电压恢复与上电开机")]):_vm._e(),_vm._v(" "),(item.operateCode==20)?_c('span',[_vm._v("防拆恢复")]):_vm._e(),_vm._v(" "),(item.operateCode==21)?_c('span',[_vm._v("故障恢复")]):_vm._e(),_vm._v(" "),(item.operateCode==170)?_c('span',[_vm._v("设备ACK")]):_vm._e(),_vm._v(" "),(item.operateCode==30)?_c('span',[_vm._v("添加子设备")]):_vm._e(),_vm._v(" "),(item.operateCode==31)?_c('span',[_vm._v("删除子设备")]):_vm._e()])])}),0)])])]),_vm._v(" "),_c('audio',{ref:"audio",staticClass:"voice",attrs:{"muted":"","src":_vm.audiosrc,"controls":"controls","autoplay":false,"loop":""}}),_vm._v(" "),_c('div',{ref:"myChart2",attrs:{"id":"myChart2"}})])])],1)}
  3671. var home_staticRenderFns = [function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"imglist"},[_c('div',{staticClass:"imgli"},[_c('img',{attrs:{"src":__webpack_require__("NTBm")}})]),_vm._v(" "),_c('div',{staticClass:"imgli"},[_c('img',{attrs:{"src":__webpack_require__("SP3F")}})])])},function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('tr',{staticClass:"rowtitle"},[_c('th',[_vm._v("报警时间")]),_vm._v(" "),_c('th',[_vm._v("房间名称")]),_vm._v(" "),_c('th',[_vm._v("报警内容")])])}]
  3672. var home_esExports = { render: home_render, staticRenderFns: home_staticRenderFns }
  3673. /* harmony default export */ var doorMagnetism_home = (home_esExports);
  3674. // CONCATENATED MODULE: ./src/views/doorMagnetism/home.vue
  3675. function injectStyle (ssrContext) {
  3676. __webpack_require__("LVSh")
  3677. }
  3678. var home_normalizeComponent = __webpack_require__("VU/8")
  3679. /* script */
  3680. /* template */
  3681. /* template functional */
  3682. var home___vue_template_functional__ = false
  3683. /* styles */
  3684. var home___vue_styles__ = injectStyle
  3685. /* scopeId */
  3686. var home___vue_scopeId__ = "data-v-789f624e"
  3687. /* moduleIdentifier (server only) */
  3688. var home___vue_module_identifier__ = null
  3689. var home_Component = home_normalizeComponent(
  3690. home,
  3691. doorMagnetism_home,
  3692. home___vue_template_functional__,
  3693. home___vue_styles__,
  3694. home___vue_scopeId__,
  3695. home___vue_module_identifier__
  3696. )
  3697. /* harmony default export */ var views_doorMagnetism_home = __webpack_exports__["default"] = (home_Component.exports);
  3698. /***/ })
  3699. });