(window["webpackJsonp_cwos-general-device"]=window["webpackJsonp_cwos-general-device"]||[]).push([["chunk-eddab52e"],{"2a12":function(e,a,t){"use strict";t.r(a);var i=function(){var e=this,a=e.$createElement,t=e._self._c||a;return t("qz-wrap",{staticClass:"add-device",scopedSlots:e._u([{key:"footer",fn:function(){return[t("div",{staticClass:"footer"},[t("el-button",{attrs:{size:"medium"},on:{click:function(a){return e.$router.go(-1)}}},[e._v("取消")]),t("el-button",{attrs:{type:"primary",size:"medium",loading:e.submitLoading},on:{click:e.handleSubmitClick}},[e._v("确定")])],1)]},proxy:!0}])},[t("qz-form-wrap",{staticStyle:{width:"100%"}},[t("el-form",{ref:"addDeviceForm"},[t("device-basic-info",{ref:"deviceBasicInfoRef"}),t("el-form-item",{attrs:{label:"设备区域","label-width":"140px",required:""}},[t("device-area",{model:{value:e.addFormData.areaId,callback:function(a){e.$set(e.addFormData,"areaId",a)},expression:"addFormData.areaId"}})],1),t("el-form-item",{attrs:{label:"设备安装位置","label-width":"140px"}},[t("device-location",{ref:"deviceLocationRef"})],1)],1)],1)],1)},r=[],n=(t("a4d3"),t("4de4"),t("4160"),t("e439"),t("dbb4"),t("b64b"),t("d3b7"),t("ac1f"),t("25f0"),t("3ca3"),t("5319"),t("159b"),t("ddb0"),t("ade3")),c=t("d4ec"),s=t("bee2"),o=t("99de"),d=t("7e84"),l=t("262e"),p=t("9ab4"),m=t("60a3"),u=t("313f"),f=t("c051"),h=t("c70e");function v(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);a&&(i=i.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),t.push.apply(t,i)}return t}function A(e){for(var a=1;a0?this.formData.districtId=e[e.length-1]:this.formData.districtId=""}},{key:"mapX_listener",value:function(e){this.submitFormData()}},{key:"created",value:function(){this.getMapTypeTree()}},{key:"mounted",value:function(){this.data&&this.data.mapId&&this.initFormData()}},{key:"deleteItem",value:function(){this.isPreview||this.$emit("delete")}},{key:"mapTypeChange",value:function(e){this.formData={mapId:"",districtId:"",districtIds:[],mapX:"",mapY:""},"gis"===e&&(this.formData.mapId="gis")}},{key:"provincialAreaChange",value:function(e){var a=e[2],t=a.lng,i=a.lat;0!==e.length&&t&&i&&(this.provincialArea=e[0].districtName+e[1].districtName+e[2].districtName,this.setMapMarker(t,i))}},{key:"detailAddressInput",value:function(e){var a=this;e=this.provincialArea+e,this.$refs.fcMap.getLocationByAddress(e).then((function(t){var i=t[0],r=i.lon,n=i.lat;e&&r&&n&&(a.provincialArea=t[0].address,a.setMapMarker(r,n))})).catch((function(e){a.$message.error(e)}))}},{key:"areaMapIdChange",value:function(e){this.areaMapOptions.length&&this.setPicMapImg()}},{key:"addMapBtnClick",value:function(){var e=window.__POWERED_BY_QIANKUN__;e?window.history.pushState({},"","/sub-sysetting-front#/regionMap/list"):(window.history.pushState({},"","/sysetting-front#/regionMap/list"),location.reload())}},{key:"mapClick",value:function(e){this.isPreview||(this.provincialArea=e.formattedAddress,this.setMapMarker(e.lnglatXY[0],e.lnglatXY[1]))}},{key:"markerClick",value:function(e){this.isPreview||(this.formData.mapX=e.x,this.formData.mapY=e.y,this.lonLat="".concat(e.x,",").concat(e.y))}},{key:"getMapTypeTree",value:function(){var e=this;this.service.getMapTypeTree({}).then((function(a){a.success?((a.data||[]).forEach((function(a){e.areaMapOptions.push({label:a.mapName,value:a.id,ext2:a.ext2,mapImg:a.mapImg})})),e.formData.mapId&&e.setPicMapImg()):e.$message.error(a.message)}))}},{key:"initFormData",value:function(){var e=this.data;if(this.formData=Object.assign({},e),e.mapId)if("gis"===e.mapId){if(this.currentMapType="gis",e.mapX){var a=e.mapX,t=void 0===a?"":a,i=e.mapY,r=void 0===i?"":i;this.setMapMarker(t,r),this.lonLat="".concat(t,",").concat(r),this.mapInitinalOptions.center=[t,r],this.provincialArea=e.provincialArea||""}}else this.currentMapType="area",this.picMapData[0]={x:e.mapX,y:e.mapY,marker_width:30,marker_height:30,id:"marker-".concat(this.mapIndex)},this.areaMapOptions.length&&this.setPicMapImg()}},{key:"setMapMarker",value:function(e,a){var t=this;this.lonLat="".concat(e,",").concat(a).replace(/^,$/,"");var i={objectType:"location",objectId:"loca-".concat(this.mapIndex),lon:e,lat:a,msg:{a:1},anchor:"bottom"};this.locations.push(i),this.formData.mapX=e,this.formData.mapY=a,this.$nextTick((function(){t.$refs.fcMap&&t.$refs.fcMap.setFitView()}))}},{key:"setPicMapImg",value:function(){var e=this;this.areaMapOptions.length&&this.areaMapOptions.forEach((function(a){a.value===e.formData.mapId&&(e.mapImg=a.mapImg)}))}},{key:"submitFormData",value:function(){this.$emit("change",this.formData)}},{key:"fullLocation",get:function(){return"".concat(this.provincialArea,"-").concat(this.lonLat).replace(/^-/,"")}}]),a}(p["d"]);l["a"]([Object(p["c"])({})],g.prototype,"data",void 0),l["a"]([Object(p["c"])({default:-1})],g.prototype,"mapIndex",void 0),l["a"]([Object(p["c"])({default:!1})],g.prototype,"isPreview",void 0),l["a"]([Object(p["e"])("formData.districtIds",{immediate:!0,deep:!0})],g.prototype,"districtIds_listener",null),l["a"]([Object(p["e"])("formData.mapX",{immediate:!0,deep:!0})],g.prototype,"mapX_listener",null),g=l["a"]([Object(p["a"])({components:{QzMap:v["a"],Treeselect:u.a}})],g);var I=g,b=I,y=(t("e79a"),t("2877")),k=Object(y["a"])(b,f,h,!1,null,"15710e42",null),w=k.exports,D=(t("5f53"),function(e){function a(){var e;return Object(n["a"])(this,a),e=Object(s["a"])(this,Object(o["a"])(a).apply(this,arguments)),e.deviceLocationList=[],e.deviceLocationInfo=[],e}return Object(d["a"])(a,e),Object(c["a"])(a,[{key:"created",value:function(){}},{key:"mounted",value:function(){this.data?this.initFormData():this.queryDefaultMap()}},{key:"addDeviceLocation",value:function(){2!==this.deviceLocationList.length?this.deviceLocationList.push({}):this.$message.error("最多只能添加2个地图")}},{key:"singleLocationChange",value:function(e,a){this.deviceLocationList.splice(a,1,e)}},{key:"deleteSingleLocation",value:function(e){var a=this,t=this.deviceLocationList.concat();t.splice(e,1),this.deviceLocationList=[],this.$nextTick((function(){a.deviceLocationList=t.concat()}))}},{key:"queryDefaultMap",value:function(){var e=this;this.service.queryMap().then((function(a){var t=a.data[0].modeType;"area"===t?e.service.getMapTypeTree({}).then((function(a){a.success?(a.data||[]).forEach((function(a){if("default"===a.ext2){var t={mapId:a.id,mapImg:a.mapImg};e.deviceLocationList.push(t)}})):e.$message.error(a.message)})):e.deviceLocationList.push({mapId:"gis"})})).catch((function(a){e.$message.error(a)}))}},{key:"initFormData",value:function(){var e=this;this.data.mapInfo&&this.data.mapInfo.forEach((function(a){var t={mapId:a.mapId,mapX:a.mapX,mapY:a.mapY};if("gis"===a.mapId)if(t.districtId=a.districtId,e.data.districtPath&&e.data.districtPath.indexOf("|")>0){var i=e.data.districtPath.split("|");i.shift(),t.districtIds=i,t.provincialArea=e.data.districtMergeName&&e.data.districtMergeName.replace(/,/g,"")}else t.districtIds=[];e.deviceLocationList.push(t)}))}},{key:"_validateForm",value:function(){var e=this;return new Promise((function(a,t){var i=0,r=0;e.deviceLocationList.forEach((function(e){e.mapId||t(new Error("请检查设备安装位置是否填写完整")),"gis"===e.mapId?(i++,i>=2&&t(new Error("最多只能添加1个GIS地图")),e.districtId||t(new Error("请检查设备安装位置是否填写完整"))):(r++,r>=2&&t(new Error("最多只能添加1个平面地图")),e.mapX||t(new Error("请在平面地图选择标点位置")))})),e.formatFormData(),a()}))}},{key:"formatFormData",value:function(){var e={mapInfo:[]};this.deviceLocationList.forEach((function(a){"gis"===a.mapId&&(e.districtId=a.districtId,e.districtIds=a.districtIds),e.mapInfo.push({mapId:a.mapId,mapX:a.mapX,mapY:a.mapY})})),this.deviceLocationInfo=Object.assign({},e)}}]),a}(p["d"]));l["a"]([Object(p["c"])({})],D.prototype,"data",void 0),l["a"]([Object(p["c"])({})],D.prototype,"isPreview",void 0),D=l["a"]([Object(p["a"])({components:{Treeselect:u.a,SingleLocation:w}})],D);var O=D,C=O,L=(t("c687"),Object(y["a"])(C,i,r,!1,null,"20e793ce",null));a["a"]=L.exports},c687:function(e,a,t){"use strict";var i=t("f34e"),r=t.n(i);r.a},e79a:function(e,a,t){"use strict";var i=t("5bf2"),r=t.n(i);r.a},f34e:function(e,a,t){}}]);