12 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-57212ffc"],{"0091":function(e,t,r){},"0cd2":function(e,t,r){},"0d6c":function(e,t,r){},6600:function(e,t,r){"use strict";r.r(t);var n=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("el-card",{staticClass:"mead-bike-map",staticStyle:{height:"99%"},attrs:{"body-style":{height:"100%"}},scopedSlots:e._u([{key:"header",fn:function(){return[r("content-header")]},proxy:!0}])},[r("el-row",{staticStyle:{height:"100%"},attrs:{type:"flex",justify:"center"}},[r("div",{staticClass:"amap-page-container"},[r("el-amap",{staticClass:"amap-demo",attrs:{vid:"amap",plugin:e.plugin,center:e.center,"default-cursor":e.defaultCursor,zoom:e.zoom,"amap-manager":e.amapManager,events:e.events}},[r("el-amap-marker",{attrs:{position:e.marker.position,events:e.marker.events,visible:e.marker.visible,draggable:e.marker.draggable,icon:e.marker.icon}}),e._l(e.polygons,function(e,t){return r("el-amap-polygon",{key:t,ref:"polygon_"+t,refInFor:!0,attrs:{vid:t,editable:!0,"fill-opacity":e.fillOpacity,"stroke-color":e.strokeColor,path:e.path,draggable:e.draggable,events:e.events}})})],2)],1),r("div",{staticClass:"form-class"},[r("lz-form",{ref:"form",staticStyle:{width:"100%"},attrs:{"get-data":e.getData,submit:e.onSubmit,errors:e.errors,form:e.form,"edit-mode":e.editMode,rules:e.rules,"label-width":"35%"},on:{"update:errors":function(t){e.errors=t},"update:form":function(t){e.form=t}}},[r("el-form-item",{attrs:{label:"区域名称",required:"",prop:"name"}},[r("el-input",{staticStyle:{width:"80%"},model:{value:e.form.name,callback:function(t){e.$set(e.form,"name",t)},expression:"form.name"}})],1),r("el-form-item",{directives:[{name:"show",rawName:"v-show",value:e.isAdmin,expression:"isAdmin"}],attrs:{label:"区域创建者",prop:"name"}},[r("el-select",{staticStyle:{width:"80%"},attrs:{placeholder:"请选择"},model:{value:e.form.admin_id,callback:function(t){e.$set(e.form,"admin_id",t)},expression:"form.admin_id"}},e._l(e.areaAdmin,function(e){return r("el-option",{key:e.id,attrs:{label:e.name,value:e.id}})}),1)],1),r("el-form-item",{attrs:{label:"区域状态",required:"",prop:"status"}},[r("el-switch",{attrs:{"active-color":"#13ce66","inactive-color":"#ff4949","active-text":"正常","inactive-text":"禁用"},model:{value:e.form.status,callback:function(t){e.$set(e.form,"status",t)},expression:"form.status"}})],1),r("el-form-item",{attrs:{label:"服务时间",required:"",prop:"customer_service_time"}},[r("el-input",{staticStyle:{width:"80%"},model:{value:e.form.customer_service_time,callback:function(t){e.$set(e.form,"customer_service_time",t)},expression:"form.customer_service_time"}})],1),r("el-form-item",{attrs:{label:"服务手机",required:"",prop:"customer_service_phone"}},[r("el-input",{staticStyle:{width:"80%"},model:{value:e.form.customer_service_phone,callback:function(t){e.$set(e.form,"customer_service_phone",t)},expression:"form.customer_service_phone"}}),r("p",{staticStyle:{margin:"10px","font-size":"14px",color:"green"}},[e._v("请在地图中绘制区域")])],1)],1),r("p",{staticStyle:{margin:"10px 22%","font-size":"11px",color:"red"}},[e._v("注:红色范围为辐射范围,绿色为骑行范围")]),r("p",{staticStyle:{margin:"10px 22%","font-size":"11px",color:"red",width:"70%"}},[e._v("注:中心点需要在绘制区域内")])],1)])],1)},a=[],i=(r("7f7f"),r("96cf"),r("3b8d")),o=(r("ac6a"),r("8f9b")),s=r.n(o),c=r("ada3"),u=r("b64d"),l=r("22a6"),f=r("fe06"),p=r("9b02"),m=r.n(p),d=r("f65a"),h=r("5d7e"),b={name:"Form",components:{LzForm:c["a"]},mixins:[f["a"]],data:function(){var e=this,t={props:["text"],template:"\n <div>text from parent: {{text}}</div>"},r=new s.a.AMapManager,n=function(e,t,r){if(!t)return r(new Error("手机号不能为空"));var n=/^1[3|4|5|7|8][0-9]\d{8}$/;if(!n.test(t))return r(new Error("请输入正确的手机号"));r()};return{isAdmin:!1,areaAdmin:[],count:1,slotStyle:{padding:"2px 8px",background:"#eee",color:"#333",border:"1px solid #aaa"},zoom:14,center:[121.5273285,31.21515044],marker:{position:[121.5273285,31.21515044],events:{click:function(){},dragend:function(t){e.form.area_centre={lat:t.lnglat.lat,lng:t.lnglat.lng}}},visible:!0,draggable:!0,icon:"http://resource.bike.hanyiyun.com/admin/area_center_20191130170212.png"},markers:[{position:[121.5273285,31.21515044],events:{click:function(){},dragend:function(t){console.log("---event---: dragend"),e.markers[0].position=[t.lnglat.lng,t.lnglat.lat]}},visible:!0,draggable:!1,template:"<span>1</span>"}],polygons:[{draggable:!1,fillOpacity:.1,path:[[121.5273285,31.21515044],[121.5293285,31.21515044],[121.5293285,31.21915044],[121.5273285,31.21515044]],events:{change:function(){e.form.area_fence=[],e.polygons[0].path.forEach(function(t){var r={lat:t.lat,lng:t.lng};e.form.area_fence.push(r)})},click:function(){}}},{draggable:!1,fillOpacity:.1,strokeColor:"#ff0000",path:[[121.5273285,31.21515044],[121.5293285,31.21515044],[121.5293285,31.21915044],[121.5273285,31.21515044]],events:{change:function(){e.form.area_fushe_fence=[],e.polygons[1].path.forEach(function(t){var r={lat:t.lat,lng:t.lng};e.form.area_fushe_fence.push(r)})},click:function(){}}}],form:{name:"",area_fence:[],area_fushe_fence:[],area_centre:"",status:!0,admin_id:0,customer_service_time:"",customer_service_phone:""},rules:{customer_service_phone:[{validator:n,trigger:"blur"}]},errors:{},defaultCursor:"pointer",amapManager:r,events:{init:function(e){}},componentMarker:{position:[121.5273285,31.21315058],contentRender:function(e,r){return e(t,{style:{backgroundColor:"#fff"},props:{text:"father is here"}},["xxxxxxx"])}},plugin:[{pName:"Geolocation",events:{init:function(e){e.getCurrentPosition(function(e,t){self.lng=113.73350255780726,self.lat=34.78024666564106,self.loaded=!0,t&&t.position&&(self.lng=t.position.lng,self.lat=t.position.lat)})}}},{pName:"Scale",position:"RB",events:{init:function(e){}}},{pName:"ToolBar",events:{init:function(e){}}}]}},created:function(){var e=Object(i["a"])(regeneratorRuntime.mark(function e(){var t,r,n;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:return t=m()(d["a"],"state.users.user.roles",[]),-1!==t.indexOf(h["c"])&&(this.isAdmin=!0),e.next=4,Object(l["d"])();case 4:r=e.sent,n=r.data,this.areaAdmin=n;case 7:case"end":return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}(),methods:{onSubmit:function(){var e=Object(i["a"])(regeneratorRuntime.mark(function e(){return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:if(!this.editMode){e.next=5;break}return e.next=3,Object(u["e"])(this.resourceId,this.form);case 3:e.next=7;break;case 5:return e.next=7,Object(u["d"])(this.form);case 7:case"end":return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}(),getData:function(){var e=Object(i["a"])(regeneratorRuntime.mark(function e(){var t,r,n,a;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:if(t=this,!t.editMode){e.next=23;break}return e.next=4,Object(u["a"])(t.resourceId);case 4:r=e.sent,n=r.data,t.form.admin_id=parseInt(n.admin_id),console.log(t.form.admin_id),t.form.name=n.name,t.form.status=n.status,t.form.customer_service_phone=n.customer_service_phone,t.form.customer_service_time=n.customer_service_time,t.form.area_fence=JSON.parse(n.area_fence),t.form.area_fushe_fence=JSON.parse(n.area_fushe_fence),a=JSON.parse(n.area_centre),t.form.area_centre={lng:a[0],lat:a[1]},t.marker.position=JSON.parse(n.area_centre),t.polygons[0].path=JSON.parse(n.area_fence),t.polygons[1].path=JSON.parse(n.area_fushe_fence),t.center=JSON.parse(n.area_centre),t.markers.position=JSON.parse(n.area_centre),e.next=23;break;case 23:case"end":return e.stop()}},e,this)}));function t(){return e.apply(this,arguments)}return t}()}},g=b,v=(r("ae57"),r("2877")),_=Object(v["a"])(g,n,a,!1,null,"7c690472",null);t["default"]=_.exports},"6cbc":function(e,t,r){"use strict";var n=r("0cd2"),a=r.n(n);a.a},"8a92":function(e,t,r){"use strict";var n=r("0091"),a=r.n(n);a.a},ada3:function(e,t,r){"use strict";r("8e6e"),r("456d");var n=r("bd86"),a=r("75fc"),i=(r("a481"),r("96cf"),r("3b8d")),o=(r("ac6a"),r("28a5"),r("9948")),s=r.n(o),c=r("9b02"),u=r.n(c),l=r("1a38"),f=r("873a"),p=r("a22f");function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function d(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(r,!0).forEach(function(t){Object(n["a"])(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var h,b,g={name:"LzForm",components:{FlexSpacer:p["a"]},inject:{view:{from:"view",default:null}},data:function(){return{loading:!1,stay:!1}},props:{getData:Function,submit:Function,errors:Object,form:Object,submitText:{type:String,default:"保存"},labelPosition:String,inDialog:Boolean,createdRedirect:{type:[String,Function],default:function(){var e=this.$route.path.split("/");return"/"+(e[e.length-2]||"")}},updatedRedirect:{type:[String,Function],default:function(){return this.$router.back.bind(this.$router)}},disableRedirect:Boolean,disableStay:Boolean,editMode:Boolean},computed:{realLabelPosition:function(){return this.labelPosition||(this.$store.state.miniWidth?"top":"right")},miniWidth:function(){return this.$store.state.miniWidth}},created:function(){this.copyMethods()},methods:{copyMethods:function(){var e=this;[l["default"].extends.methods,l["default"].methods].forEach(function(t){s()(t,function(t,r){e[r]=function(){t.apply(this.$refs.form,arguments)}})})},_getData:function(){var e=Object(i["a"])(regeneratorRuntime.mark(function e(){var t=this;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:if(this.loading=!0,this.view&&this.$emit("update:form",this.view.formBak),e.prev=2,e.t0=this.getData,!e.t0){e.next=7;break}return e.next=7,this.getData();case 7:this.$nextTick(function(){t.setInitialValues()}),e.next=13;break;case 10:e.prev=10,e.t1=e["catch"](2),Promise.reject(e.t1);case 13:this.loading=!1;case 14:case"end":return e.stop()}},e,this,[[2,10]])}));function t(){return e.apply(this,arguments)}return t}(),onSubmit:function(){var e=Object(i["a"])(regeneratorRuntime.mark(function e(){var t;return regeneratorRuntime.wrap(function(e){while(1)switch(e.prev=e.next){case 0:if(this.$emit("update:errors",{}),e.prev=1,e.t0=this.submit,!e.t0){e.next=6;break}return e.next=6,this.submit();case 6:if(this.$message.success(Object(f["h"])(this.editMode?"updated":"created")),!this.stay&&!this.disableRedirect){e.next=9;break}return e.abrupt("return");case 9:t=this.editMode?this.updatedRedirect:this.createdRedirect,"string"===typeof t?this.$router.push(t):"function"===typeof t&&t(),e.next=17;break;case 13:e.prev=13,e.t1=e["catch"](1),this.$emit("update:errors",Object(f["j"])(e.t1.response)),422!==u()(e.t1,"response.status")&&Promise.reject(e.t1);case 17:case"end":return e.stop()}},e,this,[[1,13]])}));function t(){return e.apply(this,arguments)}return t}(),onReset:function(){this.$refs.form.resetFields()}},watch:{$route:{handler:function(){this.$active&&this._getData()},immediate:!0}},render:function(e){var t=this,r=this.$slots.default;Array.isArray(r)&&(r=r.map(function(r){var n=r.componentOptions,i=n.propsData,o=i.helper,s=i.label;if(o){o=o.replace(/\n/g,"<br>");var c=e("template",{slot:"label"},[e("span",[s]),e("el-tooltip",{attrs:{effect:"dark",placement:"top-start","popper-class":"form-helper-popper ".concat(t.miniWidth?"mini-width":"")}},[e("div",{slot:"content",domProps:{innerHTML:o}}),e("i",{class:"ml-1 el-icon-question helper"})])]);return e("el-form-item",{props:n.propsData},[c].concat(Object(a["a"])(n.children)))}return r}));!this.disableStay&&e("el-checkbox",{attrs:{title:"表单提交后,留在此页"},model:{value:t.stay,callback:function(e){t.stay=e}}},["留在此页"]);var n=this.$slots.footer||e("el-form-item",{class:"footer"},[e("loading-action",{attrs:{type:"primary",action:this.onSubmit}},[this.submitText]),e("el-button",{on:{click:this.onReset}},["重置"]),this.$slots.footerAppend,e("flex-spacer")]);return e("el-form",{props:d({model:this.form,errors:this.errors,labelPosition:this.realLabelPosition},this.$attrs),on:d({},this.$listeners),class:{"in-dialog":this.inDialog},style:{width:this.inDialog?"auto":"800px"},directives:[{name:"loading",value:this.loading}],ref:"form"},[r,n])}},v=g,_=(r("6cbc"),r("8a92"),r("2877")),y=Object(_["a"])(v,h,b,!1,null,"3084f0c4",null);t["a"]=y.exports},ae57:function(e,t,r){"use strict";var n=r("0d6c"),a=r.n(n);a.a},b64d:function(e,t,r){"use strict";r.d(t,"b",function(){return a}),r.d(t,"c",function(){return i}),r.d(t,"d",function(){return o}),r.d(t,"e",function(){return s}),r.d(t,"a",function(){return c});var n=r("bf9a");function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return n["b"].get("area",{params:e})}function i(e){return n["b"].get("area/".concat(e))}function o(e){return n["b"].post("area",e)}function s(e,t){return n["b"].put("area/".concat(e),t)}function c(e){return n["b"].get("area/".concat(e,"/edit"))}},fe06:function(e,t,r){"use strict";var n=r("873a");t["a"]={provide:function(){return{view:this}},data:function(){return{formField:"form",idField:"id"}},computed:{editMode:function(){return!!this.resourceId},resourceId:function(){return this.$route.params[this.idField]}},created:function(){this.backupForm()},methods:{getResourceId:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"id";return this.$route.params[e]},backupForm:function(){this.formBak=JSON.parse(JSON.stringify(this.$data[this.formField]))},fillForm:function(e){this.$data[this.formField]=Object(n["b"])(this.$data[this.formField],e)}}}}}]);
- //# sourceMappingURL=chunk-57212ffc.e8d60612.js.map
|