| 1 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-123ca128"],{c740:function(e,t,l){"use strict";var a=l("23e7"),r=l("b727").findIndex,i=l("44d2"),n=l("ae40"),o="findIndex",s=!0,c=n(o);o in[]&&Array(1)[o]((function(){s=!1})),a({target:"Array",proto:!0,forced:s||!c},{findIndex:function(e){return r(this,e,arguments.length>1?arguments[1]:void 0)}}),i(o)},ed8f:function(e,t,l){"use strict";l.r(t);var a=function(){var e=this,t=e.$createElement,l=e._self._c||t;return l("div",{staticClass:"ele-body"},[l("el-card",{attrs:{shadow:"never"}},[l("el-form",{staticClass:"ele-form-search",attrs:{model:e.where,"label-width":"77px"},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.query(t)},submit:function(e){e.preventDefault()}}},[l("el-row",{attrs:{gutter:15}},[l("el-col",{attrs:{md:6,sm:12}},[l("el-form-item",{attrs:{label:"城市名称:"}},[l("el-input",{attrs:{placeholder:"请输入城市名称",clearable:""},model:{value:e.where.name,callback:function(t){e.$set(e.where,"name",t)},expression:"where.name"}})],1)],1),l("el-col",{attrs:{md:9,sm:12}},[l("div",{staticClass:"ele-form-actions"},[l("el-button",{staticClass:"ele-btn-icon",attrs:{type:"primary",icon:"el-icon-search"},on:{click:e.query}},[e._v("查询")]),e.permission.includes("sys:city:add")?l("el-button",{staticClass:"ele-btn-icon",attrs:{type:"primary",icon:"el-icon-plus"},on:{click:function(t){return e.add()}}},[e._v("添加")]):e._e(),e.permission.includes("sys:city:expand")?l("el-button",{staticClass:"ele-btn-icon",attrs:{type:"success",icon:"el-icon-_fold"},on:{click:function(t){return e.expendAll()}}},[e._v("展开全部")]):e._e(),e.permission.includes("sys:city:collapse")?l("el-button",{staticClass:"ele-btn-icon",attrs:{type:"warning",icon:"el-icon-_unfold"},on:{click:function(t){return e.foldAll()}}},[e._v("折叠全部")]):e._e()],1)])],1)],1),l("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],ref:"table",attrs:{data:e.data,"row-key":"id","default-expand-all":"",border:"",height:"calc(100vh - 215px)","highlight-current-row":"",lazy:"",load:e.load,"tree-props":{children:"children",hasChildren:"hasChildren"}}},[l("el-table-column",{attrs:{label:"编号",type:"index",width:"60",align:"center",fixed:"left"}}),l("el-table-column",{attrs:{label:"城市名称","show-overflow-tooltip":"","min-width":"200"},scopedSlots:e._u([{key:"default",fn:function(t){var l=t.row;return[e._v(e._s(l.name))]}}])}),l("el-table-column",{attrs:{label:"城市等级",width:"100px",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){var a=t.row;return[l("el-tag",{attrs:{type:["primary","success","warning"][a.level-1],size:"mini"}},[e._v(e._s(["省份","城市","县区"][a.level-1]))])]}}])}),l("el-table-column",{attrs:{prop:"citycode",label:"城市编码","min-width":"100",align:"center"}}),l("el-table-column",{attrs:{prop:"adcode",label:"地里编码","min-width":"100",align:"center"}}),l("el-table-column",{attrs:{prop:"lng",label:"经度","min-width":"100",align:"center"}}),l("el-table-column",{attrs:{prop:"lat",label:"纬度","min-width":"100",align:"center"}}),l("el-table-column",{attrs:{prop:"sort",label:"排序",width:"60px",align:"center"}}),l("el-table-column",{attrs:{label:"创建时间","show-overflow-tooltip":"","min-width":"160",align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){var l=t.row;return[e._v(e._s(e._f("toDateString")(l.create_time)))]}}])}),l("el-table-column",{attrs:{label:"操作",width:"190px",align:"center",resizable:!1,fixed:"right"},scopedSlots:e._u([{key:"default",fn:function(t){var a=t.row;return[e.permission.includes("sys:city:addz")?l("el-link",{attrs:{icon:"el-icon-plus",type:"primary",underline:!1},on:{click:function(t){return e.add(a)}}},[e._v("添加")]):e._e(),e.permission.includes("sys:city:edit")?l("el-link",{attrs:{icon:"el-icon-edit",type:"primary",underline:!1},on:{click:function(t){return e.edit(a)}}},[e._v("修改")]):e._e(),l("el-popconfirm",{staticClass:"ele-action",attrs:{title:"确定要删除此城市吗?"},on:{confirm:function(t){return e.remove(a)}}},[e.permission.includes("sys:city:delete")?l("el-link",{attrs:{slot:"reference",icon:"el-icon-delete",type:"danger",underline:!1},slot:"reference"},[e._v("删除")]):e._e()],1)]}}])})],1)],1),l("el-dialog",{attrs:{title:e.form.id?"修改城市":"添加城市",visible:e.showEdit,width:"400px","destroy-on-close":!0,"lock-scroll":!1},on:{"update:visible":function(t){e.showEdit=t},closed:function(t){e.form={}}}},[l("el-form",{ref:"editForm",attrs:{model:e.form,rules:e.rules,"label-width":"82px"}},[l("el-form-item",{attrs:{label:"城市名称:",prop:"name"}},[l("el-input",{attrs:{placeholder:"请输入城市名称",clearable:""},model:{value:e.form.name,callback:function(t){e.$set(e.form,"name",t)},expression:"form.name"}})],1),l("el-form-item",{attrs:{label:"城市等级:"}},[l("el-radio-group",{model:{value:e.form.level,callback:function(t){e.$set(e.form,"level",t)},expression:"form.level"}},[l("el-radio",{attrs:{label:1}},[e._v("省份")]),l("el-radio",{attrs:{label:2}},[e._v("城市")]),l("el-radio",{attrs:{label:3}},[e._v("县区")])],1)],1),l("el-form-item",{attrs:{label:"城市编码:",prop:"citycode"}},[l("el-input",{attrs:{placeholder:"请输入城市编码",clearable:""},model:{value:e.form.citycode,callback:function(t){e.$set(e.form,"citycode",t)},expression:"form.citycode"}})],1),l("el-form-item",{attrs:{label:"地里编码:",prop:"adcode"}},[l("el-input",{attrs:{placeholder:"请输入地里编码",clearable:""},model:{value:e.form.adcode,callback:function(t){e.$set(e.form,"adcode",t)},expression:"form.adcode"}})],1),l("el-form-item",{attrs:{label:"经度:",prop:"lng"}},[l("el-input",{attrs:{placeholder:"请输入经度",clearable:""},model:{value:e.form.lng,callback:function(t){e.$set(e.form,"lng",t)},expression:"form.lng"}})],1),l("el-form-item",{attrs:{label:"纬度:",prop:"lat"}},[l("el-input",{attrs:{placeholder:"请输入纬度",clearable:""},model:{value:e.form.lat,callback:function(t){e.$set(e.form,"lat",t)},expression:"form.lat"}})],1),l("el-form-item",{attrs:{label:"排序号:",prop:"sort"}},[l("el-input-number",{staticClass:"ele-fluid ele-text-left",attrs:{"controls-position":"right",min:0,placeholder:"请输入排序号"},model:{value:e.form.sort,callback:function(t){e.$set(e.form,"sort",t)},expression:"form.sort"}})],1)],1),l("div",{attrs:{slot:"footer"},slot:"footer"},[l("el-button",{on:{click:function(t){e.showEdit=!1}}},[e._v("取消")]),l("el-button",{attrs:{type:"primary"},on:{click:e.save}},[e._v("保存")])],1)],1)],1)},r=[],i=(l("c740"),l("4160"),l("a434"),l("159b"),l("5530")),n=l("2f62"),o={name:"SysCity",data:function(){return{loading:!0,data:[],where:{},showEdit:!1,form:{},rules:{name:[{required:!0,message:"请输入城市名称",trigger:"blur"}],sort:[{required:!0,message:"请输入排序号",trigger:"blur"}]}}},computed:Object(i["a"])({},Object(n["b"])(["permission"])),mounted:function(){this.query()},methods:{query:function(){var e=this;this.loading=!0,this.$http.get("/city/index",{params:this.where}).then((function(t){e.loading=!1,0===t.data.code?e.data=e.$util.toTreeData(t.data.data,"id","pid"):e.$message.error(t.data.msg||"获取数据失败")})).catch((function(t){e.loading=!1,e.$message.error(t.message)}))},load:function(e,t,l){var a=this;this.where["pid"]=e.id,this.$http.get("/city/index",{params:this.where}).then((function(e){0===e.data.code?l(e.data.data):a.$message.error(e.data.msg)})).catch((function(e){a.$message.error(e.message)}))},add:function(e){this.form={sort:0,pid:e?e.id:null},this.showEdit=!0},edit:function(e){this.form=Object.assign({},e,{pid:e.pid||null}),this.showEdit=!0},save:function(){var e=this;this.$refs["editForm"].validate((function(t){if(!t)return!1;var l=e.$loading({lock:!0});e.$http.post("/city/edit",Object.assign({},e.form,{pid:e.form.pid||0})).then((function(t){l.close(),0===t.data.code?(e.showEdit=!1,e.$message({type:"success",message:t.data.msg}),e.form.id?e.$util.eachTreeData(e.data,(function(t){if(t.id===e.form.id)return Object.assign(t,e.form),!1})):e.query()):e.$message.error(t.data.msg)})).catch((function(t){l.close(),e.$message.error(t.message)}))}))},remove:function(e){var t=this;if(e.children&&e.children.length>0)return this.$message.error("请先删除子节点");var l=this.$loading({lock:!0});this.$http.post("/city/delete",{id:e.id}).then((function(a){l.close(),0===a.data.code?(t.$message({type:"success",message:a.data.msg}),t.$util.eachTreeData(t.data,(function(t){if(t.id===e.pid)return t.children.splice(t.children.findIndex((function(t){return t.id===e.id})),1),!1}))):t.$message.error(a.data.msg)})).catch((function(e){l.close(),t.$message.error(e.message)}))},expendAll:function(){var e=this;this.data.forEach((function(t){e.$refs.table.toggleRowExpansion(t,!0)}))},foldAll:function(){var e=this;this.data.forEach((function(t){e.$refs.table.toggleRowExpansion(t,!1)}))}}},s=o,c=l("2877"),d=Object(c["a"])(s,a,r,!1,null,"75ee44c0",null);t["default"]=d.exports}}]);
|