
import request from '@/utils/request';
var baseAPI2 = process.env.VUE_APP_LOCAL_API2 + '/';

var HttpReq = function(){
	return {
		//卡车调度系统
		truckDispatching:{
			//系统管理——班次设置
			shiftQuery: function(){
				return request({
					url: '/api/Class',
					method: 'get',
				})
			},
			shiftAdd: function(data){
				return request({
					url: '/api/Class',
					method: 'POST',
					data:data,
				}).then((res) => {
					return res
				})
			},
			shiftUpdate: function(data){
				return request({
					url: '/api/Class',
					method: 'PUT',
					data:data,
				})
			},
			shiftDel: function(data){
				return request({
					url: '/api/Class',
					method: 'Delete',
					data:data,
				})
			},
			//系统管理——数据字典——报警时长
			alarmTimeQuery: function(){
				return request({
					url: '/api/AlarmTime',
					method: 'get',
				})
			},
			alarmTimeAdd: function(data){
				return request({
					url: '/api/AlarmTime',
					method: 'POST',
					data:data,
				}).then((res) => {
					return res
				})
			},
			alarmTimeUpdate: function(data){
				return request({
					url: '/api/AlarmTime',
					method: 'PUT',
					data:data,
				})
			},
			alarmTimetDel: function(data){
				return request({
					url: '/api/AlarmTime',
					method: 'Delete',
					data:data,
				})
			},
			//系统管理——数据字典——疲劳驾驶
			fdriTimeQuery: function(){
				return request({
					url: '/api/FdriTime',
					method: 'get',
				})
			},
			fdriTimeAdd: function(data){
				return request({
					url: '/api/FdriTime',
					method: 'POST',
					data:data,
				}).then((res) => {
					return res
				})
			},
			fdriTimeUpdate: function(data){
				return request({
					url: '/api/FdriTime',
					method: 'PUT',
					data:data,
				})
			},
			fdriTimetDel: function(data){
				return request({
					url: '/api/FdriTime',
					method: 'Delete',
					data:data,
				})
			},
			//系统管理——数据字典——优先级设置
			getPriorityQuery: function(){
				return request({
					url: '/api/Pri',
					method: 'get',
				})
			},
			getPriorityTimeAdd: function(data){
				return request({
					url: '/api/Pri',
					method: 'POST',
					data:data,
				}).then((res) => {
					return res
				})
			},
			getPriorityTimeUpdate: function(data){
				return request({
					url: '/api/Pri',
					method: 'PUT',
					data:data,
				})
			},
			getPriorityTimetDel: function(data){
				return request({
					url: '/api/Pri',
					method: 'Delete',
					data:data,
				})
			},




		},


















		//华菱植物工厂
		plantFactory:{
			//管理员首页：客户总数 终端总数
			getCustomerTotal: function(){
				return request({
					url: '/register/list',
					method: 'get',
				})
			},
			//管理员首页：获取项目总数
			getProjectTotal: function(){
				return request({
					url: '/api/wProject/list',
					method: 'get',
				})
			},
			//管理员首页：传感器总数
			getSensorTotal: function(){
				return request({
					url: '/api/wEquipment/count',
					method: 'get',
				})
			},
			//管理员首页：设备在线
			getEquipmentOnlineTotal: function(){
				return request({
					url: '/api/wEquipment/online',
					method: 'get',
				})
			},
			//管理员首页：设备离线
			getEquipmentOfflineTotal: function(){
				return request({
					url: '/api/wEquipment/offline',
					method: 'get',
				})
			},
			//管理员首页：用户申请
			getUserApplicationTotal: function(){
				return request({
					url: '/register/enabled',
					method: 'get',
				})
			},
			//管理员首页：项目终端数量统计表
			getTerminalsStatisticsTotal: function(){
				return request({
					url: '/api/wRealtime/statistics',
					method: 'get',
				})
			},
			//管理员首页：传感器数目统计表
			getSensorTableList: function(){
				return request({
					url: '/register/enabled',
					method: 'get',
				})
			},
			//用户首页：获取轮播图
			getRotationChart: function(){
				return request({
					url: '/api/wProjectImg',
					method: 'get',
				})
			},
			//设备管理查询
			getDeviceManageList: function(param){
				return request({
					url: '/api/wEquipment',
					method: 'get',
					params:param,
				})
			},
			//设备管理添加
			addDeviceManageList: function(data){
				return request({
					url: '/api/wEquipment',
					method: 'POST',
					data:data,
				}).then((res) => {
					return res
				})
			},
			//设备管理修改
			upDateDeviceManageList: function(data){
				return request({
					url: '/api/wEquipment',
					method: 'PUT',
					data:data,
				})
			},
			//设备管理删除
			removeDeviceManageList: function(data){
				return request({
					url: '/api/wEquipment',
					method: 'Delete',
					data:data,
				})
			},
			//大屏实时数据
			getLargeScreenNowDataList: function(param){
				return request({
					url: '/api/wRealtime',
					method: 'get',
					params:param
				})
			},
			//大屏报警列表
			getLargeScreenAlarmList: function(param){
				return request({
					url: '/api/wAlarm',
					method: 'get',
					params:param
				})
			},


		},
		/** 操作日志 */
		reoperationlog:{
			getLog: function (param, query) {
				return request({
					url: 'api/wOperationLog',
					method: 'get',
					data:query,
					params:param
				})
			}
		},
		/* 项目管理 */
		project:{
			// 获取项目
			getProject: function(param, query){
				return request({
					url: 'api/wProject',
					method: 'get',
					data:query,
					params:param
				})
			},
			getProjectInEquipment: function(param, query){
				return request({
					url: 'work/projectsInEquipment',
					method: 'get',
					data:query
				})
			},
			saveProject: function(data){
				return request({
					//url: 'work/projects',
					url: 'api/wProject',
					method: 'POST',
					data:data,
				}).then((res) => {
					return res
				})
			},
			updateProject: function(data){
				return request({
					url: 'api/wProject',
					method: 'PUT',
					data:data,
				})
			},
			removeProject: function(data){
				return request({
					url: 'api/wProject',
					method: 'Delete',
					data:data,
				})
			},
			getPartList: function(){
				return request({
					url: 'work/projectsMinList',
					method: 'get',
				})
			},
		},
		/* 设备管理 */
		equipment:{
			/* 设备管理 */
			getItem: function(param, query){
				return request({
					url: 'work/equipment',
					method: 'get',
					data:query,
					params:param
				})
			},
			getSelectList: function(param, query){
				return request({
					url: 'work/equipmentSelectList',
					method: 'get',
					data:query,
					params:param
				})
			},
			saveItem: function(data){
				return request({
					url: 'work/equipment',
					method: 'POST',
					data:data,
				}).then((res) => {
					return res
				})
			},
			updateItem: function(data){
				return request({
					url: 'work/equipment',
					method: 'put',
					data:data,
				})
			},
			removeItem: function(data){
				return request({
					url: 'work/equipment',
					method: 'delete',
					data:data,
				})
			},
			getItemById: function(param, query){
				return request({
					url: 'work/equipmentById',
					method: 'get',
					data:query,
					params:param
				})
			},
			getCount: function(param, query){
				return request({
					url: 'work/equipmentCount',
					method: 'get',
				})
			},
			// 指令下发
			setInstruction: function(param, query){
				var data = {url:baseAPI2 + 'api/instruction/sendIns', param:param};
				return request({
					url: 'biz/transmit',
					method: 'post',
					data:data,
				})
			},
			// 下发日志查看
			getInstructionLog: function(param, query){
				var data = {url:baseAPI2 + 'api/instruction/pageInsLog', param:param};
				return request({
					url: 'biz/transmit',
					method: 'get',
					params:data,
				})
			},
		},
		/* 图纸管理 */
		drawing:{
			/* 图纸管理 */
			getItem: function(param, query){
				return request({
					url: 'work/drawing',
					method: 'get',
					data:query,
					params:param
				})
			},
			/* 图纸列表关联points */
			getItemsInPoints: function(param, query){
				return request({
					url: 'work/drawingInPoints',
					method: 'get',
					data:query,
					params:param
				})
			},
			/* 图纸关联项目字段 */
			getItemSubProgram: function(param, query){
				return request({
					url: 'work/drawingSubProgram',
					method: 'get',
					data:query,
					params:param
				})
			},
			/* 图纸设备标记 */
			getNotInProgramSelectList: function(param, query){
				return request({
					url: 'work/drawingNotInProgramSelectList',
					method: 'get',
					data:query,
					params:param
				})
			},
			saveItem: function(data){
				return request({
					url: 'work/drawing',
					method: 'POST',
					data:data,
				}).then((res) => {
					return res
				})
			},
			removeItem: function(data){
				return request({
					url: 'work/drawing',
					method: 'delete',
					data:data,
				})
			},
		},
		drawingpoint:{
			/* 图纸标记列表 */
			getItem: function(param, query){
				return request({
					url: 'work/drawingpoint',
					method: 'get',
					data:query,
					params:param
				})
			},
			
			/* 根据设备反向查询图纸设备标记 */
			getNotInDeviceSelectList: function(param, query){
				return request({
					url: 'work/drawpointNotInDeviceSelectList',
					method: 'get',
					data:query,
					params:param
				})
			},
			saveItem: function(data){
				return request({
					url: 'work/drawingpoint',
					method: 'POST',
					data:data,
				}).then((res) => {
					return res
				})
			},
			/* 更新 */
			updateItem: function(data){
				return request({
					url: 'work/drawingpoint',
					method: 'put',
					data:data,
				})
			},
		},
		/* 实时数据 */
		realtime:{
			/* 实时数据 */
			getItem: function(param, query){
				return request({
					url: 'work/realtime',
					method: 'get',
					data:query,
					params:param
				})
			},
			getItemByCodes: function(param, query){
				return request({
					url: 'work/realtimeByCodes',
					method: 'get',
					data:query,
					params:param
				})
			},
		},
		historys:{
			/* 历史记录 */
			getItem: function(param, query){
				return request({
					//url: 'work/history',
					url: 'api/wHistory',
					method: 'get',
					data:query,
					params:param
				})
			},
			/* 历史记录 */
			getItemBycode: function(param, query){
				return request({
					url: 'work/historyBycode',
					method: 'get',
					data:query,
					params:param
				})
			},
		},
		alarm:{
			/* 获取 */
			getItem: function(param, query){
				return request({
					url: 'work/alarm',
					method: 'get',
					data:query,
					params:param
				})
			},
			/* 报警列表关联项目信息 */
			getListByCodes: function(param, query){
				return request({
					url: 'work/alarmListByCodes',
					method: 'get',
					data:query,
					params:param
				})
			},
			// 按月份统计报警数量
			getItemOnMonthStatistics: function(param, query){
				return request({
					url: 'work/alarmOnMonthStatistics',
					method: 'get',
					data:query,
					params:param
				})
			},
			// 报警列表未解除
			getListNotSolve: function(param, query){
				return request({
					url: 'work/alarmListNotSolve',
					method: 'get',
					data:query,
					params:param
				})
			},
			getList: function(param, query){
				return request({
					//url: 'work/alarmList',
					url: 'api/wAlarm',
					method: 'get',
					data:query,
					params:param
				})
			},
			/* 更新 */
			updateItem: function(data){
				return request({
					//url: 'work/alarm',
					url: 'api/wAlarm',
					method: 'PUT',
					data:data,
				})
			},
			// 统计
			getCount: function(param, query){
				return request({
					url: 'work/alarmCount',
					method: 'get',
				})
			},
		},
		users:{
			/* 获取 */
			getCount: function(param, query){
				return request({
					url: 'biz/usersCount',
					method: 'get',
				})
			},
			/* 获取 */
			getNotActiveCount: function(param, query){
				return request({
					url: 'biz/notActiveCount',
					method: 'get',
				})
			},
		},
		/* 导出Excel */
		export:{
			historyRecord: function(param, query){
				return request({
					url: 'export/history',
					method: 'get',
					data:query,
					params:param
				})
			},
			historyExport: function(param, query){
				return request({
					url: 'api/wHistory/download',
					method: 'get',
					data:query,
					params:param
				})
			},
		},
	};
};

var Dates = function(){
	/* 
		Dates.format('yyyy-MM-dd EE HH:mm:ss')
		Dates.format.call(new Date(), 'yyyy-MM-dd EE HH:mm:ss')
	*/
	var format = function(fmt){
		var Date_ = this.getDate ? this : new Date();
		var o = {           
		"M+" : Date_.getMonth()+1, //月份           
		"d+" : Date_.getDate(), //日           
		"h+" : Date_.getHours()%12 == 0 ? 12 : Date_.getHours()%12, //小时           
		"H+" : Date_.getHours(), //小时           
		"m+" : Date_.getMinutes(), //分           
		"s+" : Date_.getSeconds(), //秒           
		"q+" : Math.floor((Date_.getMonth()+3)/3), //季度           
		"S" : Date_.getMilliseconds() //毫秒           
		};           
		var week = {           
		"0" : "\u65e5",           
		"1" : "\u4e00",           
		"2" : "\u4e8c",           
		"3" : "\u4e09",           
		"4" : "\u56db",           
		"5" : "\u4e94",           
		"6" : "\u516d"          
		};           
		if(/(y+)/.test(fmt)){           
			fmt=fmt.replace(RegExp.$1, (Date_.getFullYear()+"").substr(4 - RegExp.$1.length));           
		}           
		if(/(E+)/.test(fmt)){           
			fmt=fmt.replace(RegExp.$1, ((RegExp.$1.length>1) ? (RegExp.$1.length>2 ? "\u661f\u671f" : "\u5468") : "")+week[Date_.getDay()+""]);           
		}           
		for(var k in o){           
			if(new RegExp("("+ k +")").test(fmt)){           
				fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));           
			}           
		}           
		return fmt;
	}
	
	var getDayStamp = function(){
		var start = new Date(new Date().toLocaleDateString()).getTime() / 1000;
		var end = ~~(new Date().getTime() / 1000);
		return {start:start, end:end};
	}

	return {format:format, getDayStamp:getDayStamp,}
};


var Tools = function(){
	var elementCompare = function(origin, target){
		var elCheck = Object.prototype.toString, stringEx = (origin.parentNode && origin.nodeType === 1 && target.nodeType === 1) && elCheck.call(origin) || 0;
		if(!stringEx) return dc;
		while(stringEx !== elCheck.call(target)){
			target = target.parentNode;
		}; return target;
	};
	var viewSwitch = function(controlCtn, tagName, viewCtn, activ, index, fn){
		if(!controlCtn.children){
			return;
		}
		var change, views = viewCtn.children, navChange;
		if(controlCtn && typeof controlCtn.nodeName === 'string'){
			var triggers = controlCtn.children, len = triggers.length;
			for(var i=0; i<len; i++){
				var trigger = triggers[i],
					dataset = trigger.dataset;
				dataset ? dataset.id = i : trigger.setAttribute('data-id', i)
			};
			navChange = function(id){
				var fcs = controlCtn.querySelector('.'+activ);
				fcs && fcs.classList.remove(activ);
				triggers[id].classList.add(activ);
			};
			controlCtn.onclick = function(e){
				var tag = e.target || e.srcElement;
				if(tag.nodeName === tagName){
					var item = elementCompare(triggers[0], tag);
					var id = item.dataset && item.dataset.id || item.getAttribute('data-id');
					if(!isNaN(id))change(id)
				}
			};
		};
		(change = function(id){
			id = id * 1;
			if(id == null || isNaN(id)) return console.log('viewSwitch index not is number');
			navChange && navChange(id);
			// content box
			var cfcs = viewCtn.querySelector('div.'+activ), view = views[id];
			cfcs && cfcs.classList.remove(activ);
			view.classList.add(activ);
			fn && fn(id, view)
		})(index);
		return change
	};
	
	/**
	  * 注册移动事件
	  * @param: {Object} opts [top, left, eventOutClose(事件超出容器后关闭, 默认false), showCloseBtn(默认false)]
	  * @param: {HTML} html [strHtml]
	  *	@example1: var slider = moveEvent.register({
						eventEl:canvas,
						disc:'x',
						event:true,
						start: function(e){
							mouseDewn = true;
							that.destX = 0;
						},
						move: function(e){if(mouseDewn){}else{};},
						end: function(e){if(mouseDewn){};},
						dblclick: function(e){},
						click: function(e){},
					});
	  * @author: Kimber
	  * @return: 
	  * @updatetime: 2021/6/18
	  */
	var moveEvent = function(opts){
		var register = function(opts){
			var eventEl = opts.eventEl;
			var sX, sY, estamp, isrMove = !opts.event;
			var addRelationEvent = function(type, fn){
				eventEl.addEventListener(type, fn, false);
			}, removeRelationEvent = function(type, fn){
				eventEl.removeEventListener(type, fn, false);
			};
			var sliderEvent = function(){
				this.eventHandler = function(that){
					this.eventTrigger = function(){
						addRelationEvent('mousemove', that);
						addRelationEvent('mouseup', that);
						//addRelationEvent('mouseout', that);
						//addRelationEvent('mouseover', that);
						addRelationEvent('mouseleave', that);
					};
					this.eventRemove = function(){
						removeRelationEvent('mousemove', that);
						removeRelationEvent('mouseup', that);
						//removeRelationEvent('mouseout', that);
						//removeRelationEvent('mouseover', that);
						removeRelationEvent('mouseleave', that);
					};
					this.addEvent = function(){
						addRelationEvent('mousedown', that)
					};
					this.removeEvent = function(){
						removeRelationEvent('mousedown', that)
					};
					return this
				}.call({}, this);
				this.eventHandler.addEvent();
				opts.event && this.eventHandler.eventTrigger();
			}; sliderEvent.prototype = {
				handleEvent : function(e){;
					switch(e.type){
						case 'mousedown' : this.start(e); break;
						case 'mousemove' : this.move(e); break;
						case 'mouseup' : 
						case 'mouseout' : 
						case 'mouseover' : 
						case 'mouseleave' : this.end(e); break;
					}
				},
				start: function(e){
					sX = e.pageX, sY = e.pageY;
					if(e.timeStamp - estamp < 280 && this.sX === sX && this.sY === sY){
						this.isDb = !this.isDb;
						clearTimeout(this.timeout);
						opts.dblclick && opts.dblclick(e);
					}else{
						opts.start && opts.start(e);
					};
					this.sX = sX;
					this.sY = sY;
					estamp = e.timeStamp;
					!opts.event && this.eventHandler.eventTrigger() || (isrMove = true);
				},
				move: function(e){
					if(isrMove){
						if(opts.disc){
							if(opts.disc === 'y'){
								e.destY = e.pageY - this.sY
							}else{
								e.destX = e.pageX - this.sX
							};
						}else{
							e.destX = e.pageX - this.sX;
							e.destY = e.pageY - this.sY;
						};
					}; opts.move && opts.move(e);
				},
				end: function(e){
					var that = this;
					opts.end && opts.end(e);
					!opts.event && this.eventHandler.eventRemove() || (isrMove = false);
					if(opts.click){
						if(e.type === 'mouseup' && e.timeStamp - estamp < 180 && this.sX === e.pageX && this.sY === e.pageY){
							clearTimeout(this.timeout);
							this.timeout = setTimeout(function(){
								if(that.isDb){
									that.isDb = !that.isDb
								}else{
									opts.click(e);
								};
							}, 150);
						};
					};
				},
			};
			return new sliderEvent()
		};
		var remove = function(sliderEvent){
			sliderEvent && sliderEvent.eventHandler.removeEvent()
		};
		return {register:register, remove:remove};
	};
	
	/**
	  * 元素滑动事件
	  * @param: {Object} opts [top, left, eventOutClose(事件超出容器后关闭, 默认false), showCloseBtn(默认false)]
	  * @param: {HTML} html [strHtml]
	  *	@example1: var slider = registerSlider(canvas, {
						disc:'x',
						event:true,
						start: function(e){
							mouseDewn = true;
							that.destX = 0;
						},
						move: function(e){if(mouseDewn){}else{};},
						end: function(e){if(mouseDewn){};},
					});
	  * @author: Kimber
	  * @return: 
	  * @updatetime: 2021/6/18
	  */
	var registerSlider = function(element, opts){
		var el = typeof element === "string" ? document.getElementById(element) : element;
		if(!el) return console.log('sliderPlate Error Element is a invalid param! ');

		var tagel = opts.tag || el;
		var left, top, moveX, moveY, dpr = 1;
		var addRelationEvent = function(el, type, fn){
			el.addEventListener(type, fn, false);
		}, removeRelationEvent = function(el, type, fn){
			el.removeEventListener(type, fn, false);
		};
		var slider = function(){
			this.eventHandler = function(that){
				this.eventTrigger = function(){
					addRelationEvent(el, 'mousemove', that);
					addRelationEvent(el, 'mouseup', that);
					//addRelationEvent(el, 'mouseout', that);
					//addRelationEvent(el, 'mouseover', that);
					addRelationEvent(el, 'mouseleave', that);
				};
				this.clearTrigger = function(){
					removeRelationEvent(el, 'mousemove', that);
					removeRelationEvent(el, 'mouseup', that);
					//removeRelationEvent(el, 'mouseout', that);
					//removeRelationEvent(el, 'mouseover', that);
					removeRelationEvent(el, 'mouseleave', that);
				};
				this.addEvent = function(){
					addRelationEvent(el, 'mousedown', that)
				};
				this.removeEvent = function(){
					removeRelationEvent(el, 'mousedown', that)
				}; return this
			}.call({}, this);

			return this.init()
		}; slider.prototype = {
			handleEvent : function(e){;
				switch(e.type){
					case 'mousedown' : this.start(e); break;
					case 'mousemove' : this.move(e); break;
					case 'mouseup' : 
					case 'mouseout' : 
					case 'mouseover' : 
					case 'mouseleave' : this.end(e); break;
				}
			},
			init: function(){
				this.eventHandler.addEvent();
				this.backopts = {eventHandler:this.eventHandler, setMoveAbs:this.setMoveAbs, setEndAbs:this.setEndAbs};
				opts.init && opts.init(this.backopts);
				return this.backopts
			},
			start: function(e){
				this.startX = e.pageX;
				this.startY = e.pageY;
				this.eventHandler.eventTrigger();
				opts.start && opts.start(e)
			},
			move: function(e){
				e.distX = (e.pageX - this.startX) * dpr;
				e.distY = (e.pageY - this.startY) * dpr;
				opts.move && opts.move(e)
			},
			end: function(e){
				this.eventHandler.clearTrigger();
				e.distX = (e.pageX - this.startX) * dpr;
				e.distY = (e.pageY - this.startY) * dpr;
				opts.end && opts.end(e)
			},
			setMoveAbs: function(x, y){
				if(x){
					(this || tagel).style.left = '';
				};
				if(y){
					(this || tagel).style.top = '';
				};
				(this || tagel).style['transform'] = 'translate('+x+'px, '+y+'px)' + 'translateZ(0)';
			},
			setEndAbs: function(x, y){
				(this || tagel).style['transform'] = '';
				(this || tagel).style.left = x + 'px';
				(this || tagel).style.top = y + 'px';
			},
		};
		return new slider()
	};

	var removeMoveEvent = function(slider){
		slider && slider.eventHandler.removeEvent()
	};

	return {viewSwitch:viewSwitch, moveEvent:moveEvent(), removeMoveEvent:removeMoveEvent, registerSlider:registerSlider}
};

/**
  * 地图初始化
  * @param: {Object} opts
  *	@example1: 
  * @createtime: 2021/7/2
  */
var CAMap = function(){
	var initMap = function(opts){
		// normal(标准), dark(幻影黑), light(月光银), whitesmoke(远山黛), fresh(草色青), grey(雅士灰), graffiti(涂鸦), macaron(马卡龙), blue(靛青蓝), darkblue(极夜蓝), wine(酱籽)

		var map = new AMap.Map(opts.container, {
			//mask: mask,
			// center: [120.651884,36.962533],
			center: [122.065951,37.487842],
			viewMode: '2D',		// viewMode: '3D',
			//layers: [new AMap.TileLayer.Satellite()],		// 卫星地图
			showLabel: true,
			labelzIndex: 130,
			pitch: 40,
			zoom: opts.zoom || 6,
			mapStyle: 'amap://styles/darkblue',
		});
		this.map = map;
		this.marker = {
			red1:'https://webapi.amap.com/theme/v1.3/markers/n/mark_rs.png',
			red2:'https://a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-red.png',
			Default1:'https://webapi.amap.com/theme/v1.3/markers/n/mark_bs.png',
			Default2:'https://a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png',
		};

		return this
	};initMap.prototype = {
		/**
		  * 添加标记点
		  * @param: {Arrar} arr
		  *	@example1: this.cAMap.addMarkers([{lng:item.lng, lat:item.lat}]);
		  * @return: [marker]
		  * @createtime: 2021/7/2
		  */
		addMarkers: function(arr){
			var len = arr.length;
			var markers = [];
			for(var i=0; i<len; i++){
				var obj = arr[i];
				var marker = new AMap.Marker({
					//icon,
					position: [obj.lng, obj.lat],
					//offset: new AMap.Pixel(devX, devX),
					title: obj.name,
					/* label: {
						deviceid: obj.deviceid,
						name: obj.name,
						online: obj.online
					} */
				});
				markers.push(marker);
			};
			this.map.add(markers);
			return markers
		},
		/**
		  * 设置中心点
		  * @param: {Arrar} arr
		  *	@example1: this.cAMap.setCenter([lng, lat]);
		  * @createtime: 2021/7/2
		  */
		setCenter: function(arr){
			this.map.setCenter(arr)
		}
	};
	return initMap
};


/**
  * 文件下载
  * @return: Object
  * @author: Kimber
  * @updatetime: 2021/7/20
  * @createtime: 2021/7/20
  */
var FileStream = function(){
	function s2ab(s) {
		var buf = new ArrayBuffer(s.length);
		var view = new Uint8Array(buf);
		for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;
		return buf;
	};

	/**
	  * 字符转换 Blob 对象
	  * @param: {String} str 
	  * @example1: var aaa = FileStream.toBlob(str);
	  * @return: 
	  * @author: Kimber
	  * @updatetime: 2021/7/20
	  * @createtime: 2021/7/20
	  */
	var toBlob = function(str){
		return new Blob([s2ab(str)], {
			type: "application/octet-stream"
		});
	};
	
	/**
	  * 利用 A标签 下载文件
	  * @param: {Blob} url 
	  * @param: {String} saveName	// 文件名
	  * @example1: FileStream.download(blob, 'Test.xlsx');
	  * @return: 
	  * @author: Kimber
	  * @updatetime: 2021/7/20
	  * @createtime: 2021/7/20
	  */
	var download = function(url, saveName){
		if (typeof url == 'object' && url instanceof Blob) {
			url = URL.createObjectURL(url); // 创建blob地址
		}
		var aLink = document.createElement('a');
		aLink.href = url;
		aLink.download = saveName || ''; // HTML5新增的属性，指定保存文件名，可以不要后缀，注意，file:///模式下不会生效
		var event;
		if (window.MouseEvent) event = new MouseEvent('click');
		else {
			event = document.createEvent('MouseEvents');
			event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
		}
		aLink.dispatchEvent(event);
	};

	return {toBlob:toBlob, download:download}
};


export var HttpReq = HttpReq();
export var Dates = Dates();
export var Tools = Tools();
export var CAMap = CAMap();
export var FileStream = FileStream();


/* exports = {
	HttpReq: HttpReq(),
	Dates: Dates(),
	Tools: Tools(),
}; */

// WEBPACK FOOTER //
// ./src/common/js/common.js