2 lines
12 KiB
JavaScript
2 lines
12 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-6aaba449"],{"1fb6":function(e,t,a){"use strict";a.r(t);var r=function(){var e=this,t=e.$createElement,a=e._self._c||t;return a("div",{staticClass:"app-container department"},[a("div",{staticClass:"decorate"}),a("div",{staticClass:"filter-container"},[a("el-cascader",{staticClass:"filter-item",attrs:{"show-all-levels":!1,options:e.deptIdList,placeholder:e.$t("listQuery.areaId"),props:{checkStrictly:!0,emitPath:!1,props:{}},clearable:""},on:{change:e.handleFilter},model:{value:e.listQuery.areaPid,callback:function(t){e.$set(e.listQuery,"areaPid",t)},expression:"listQuery.areaPid"}}),a("el-input",{staticClass:"filter-item",attrs:{placeholder:e.$t("area.deptName")},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.handleFilter.apply(null,arguments)}},model:{value:e.listQuery.areaName,callback:function(t){e.$set(e.listQuery,"areaName",t)},expression:"listQuery.areaName"}}),a("span",{staticClass:"btn-item",on:{click:e.handleFilter}},[a("i",{staticClass:"iconfont icon-sousuo"}),e._v(e._s(e.$t("btn.search"))+" ")]),a("span",{staticClass:"btn-item",on:{click:e.clearListQuery}},[a("i",{staticClass:"el-icon-refresh-left"}),e._v(" "+e._s(e.$t("btn.resetting")))]),a("div",{staticClass:"control-container"},[a("span",{directives:[{name:"permission",rawName:"v-permission",value:["area_add_top"],expression:"['area_add_top']"}],staticClass:"btn-item",on:{click:function(t){return e.handleCreate(0)}}},[e._v(e._s(e.$t("menu.addToplevel")))]),a("span",{directives:[{name:"permission",rawName:"v-permission",value:["area_add_child"],expression:"['area_add_child']"}],staticClass:"btn-item",on:{click:function(t){return e.handleCreate(1)}}},[e._v(e._s(e.$t("menu.addChild")))])])],1),a("div",{staticClass:"table-container"},[a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.listLoading,expression:"listLoading"}],attrs:{data:e.data,"row-key":"id","max-height":"580","default-expand-all":"","header-row-class-name":"table-header","row-class-name":"table-row","highlight-current-row":"","tree-props":{children:"children",hasChildren:"hasChildren"}},on:{"current-change":e.handleCurrentChange}},[a("el-table-column",{attrs:{prop:"areaName",align:"left",label:e.$t("area.deptName")}}),a("el-table-column",{attrs:{prop:"areaCode",align:"left",label:e.$t("area.deptCode")}}),a("el-table-column",{attrs:{label:e.$t("area.deptType"),align:"center"},scopedSlots:e._u([{key:"default",fn:function(t){return[1===t.row.level?a("span",[e._v(e._s(e.$t("area.province")))]):e._e(),2===t.row.level?a("span",[e._v(e._s(e.$t("area.city")))]):e._e(),3===t.row.level?a("span",[e._v(e._s(e.$t("area.district")))]):e._e(),4===t.row.level?a("span",[e._v(e._s(e.$t("area.street")))]):e._e()]}}])}),a("el-table-column",{attrs:{prop:"center",align:"left",label:e.$t("area.center")}}),a("el-table-column",{attrs:{label:e.$t("table.operate"),width:"240",align:"left"},scopedSlots:e._u([{key:"default",fn:function(t){return[a("span",{staticClass:"btnCancel",attrs:{title:e.$t("table.update")},on:{click:function(a){return e.handleUpdate(t)}}},[a("i",{staticClass:"iconfont icon-bianji"}),e._v(e._s(e.$t("table.update")))]),a("span",{staticClass:"btnCancel delete",attrs:{title:e.$t("table.delete")},on:{click:function(a){return e.handleDelete(t)}}},[a("i",{staticClass:"iconfont icon-a--"}),e._v(e._s(e.$t("table.delete")))])]}}])})],1)],1),a("el-dialog",{attrs:{"close-on-click-modal":!1,title:e.textMap[e.dialogStatus],visible:e.addDialog},on:{"update:visible":function(t){e.addDialog=t}}},[a("el-scrollbar",{staticStyle:{height:"100%"},attrs:{vertical:!0}},[a("el-form",{ref:"form",attrs:{rules:e.rules,model:e.form,inline:"","label-width":"130px"}},[a("el-form-item",{attrs:{label:e.$t("area.deptName"),prop:"areaName"}},[a("el-input",{attrs:{placeholder:e.$t("pEnter")+e.$t("area.deptName"),maxlength:"20"},model:{value:e.form.areaName,callback:function(t){e.$set(e.form,"areaName",t)},expression:"form.areaName"}})],1),a("el-form-item",{attrs:{label:e.$t("area.deptCode"),prop:"areaCode"}},[a("el-input",{attrs:{placeholder:e.$t("pEnter")+e.$t("area.deptCode")},model:{value:e.form.areaCode,callback:function(t){e.$set(e.form,"areaCode",t)},expression:"form.areaCode"}})],1),a("el-form-item",{attrs:{label:e.$t("area.deptType"),prop:"level"}},[a("el-select",{attrs:{placeholder:e.$t("pSelect"),disabled:"update"===e.dialogStatus},model:{value:e.form.level,callback:function(t){e.$set(e.form,"level",t)},expression:"form.level"}},e._l(e.deptType,(function(e){return a("el-option",{key:e.value,attrs:{label:e.label,value:e.value,disabled:e.disabled}})})),1)],1),a("el-form-item",{attrs:{label:e.$t("area.cityCode"),prop:"cityCode"}},[a("el-input",{attrs:{placeholder:e.$t("pEnter")+e.$t("area.cityCode"),disabled:e.currentRow&&e.currentRow.cityCode},model:{value:e.form.cityCode,callback:function(t){e.$set(e.form,"cityCode",t)},expression:"form.cityCode"}})],1),a("el-form-item",{attrs:{label:e.$t("area.center"),prop:"center"}},[a("el-input",{attrs:{placeholder:e.$t("pEnter")+e.$t("area.center")},model:{value:e.form.center,callback:function(t){e.$set(e.form,"center",t)},expression:"form.center"}})],1)],1)],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("span",{staticClass:"btn-item long",on:{click:function(t){e.addDialog=!1}}},[e._v(e._s(e.$t("btn.cancel")))]),a("span",{staticClass:"btn-item long",on:{click:function(t){"create"===e.dialogStatus?e.createData():e.updateData()}}},[e._v(e._s(e.$t("btn.define")))])])],1)],1)},i=[],s=(a("d81d"),a("d3b7"),a("159b"),a("599c")),l=a("4381"),n={computed:{userName:function(){return this.$store.state.user.userName}},directives:{permission:l["a"]},data:function(){return{listLoading:!1,createStatus:!1,deptPidBox:[],deptIdList:[],deptType:[{value:0,label:this.$t("area.country"),disabled:!1},{value:1,label:this.$t("area.province"),disabled:!1},{value:2,label:this.$t("area.city"),disabled:!1},{value:3,label:this.$t("area.district"),disabled:!1},{value:4,label:this.$t("area.street"),disabled:!1}],textMap:{update:this.$t("table.update"),create:this.$t("table.create")},rules:{areaName:[{required:!0,message:this.$t("pEnter")+this.$t("area.deptName"),trigger:"blur"}],areaCode:[{required:!0,message:this.$t("pEnter")+this.$t("area.areaCode"),trigger:"blur"}],center:[{required:!0,message:this.$t("pEnter")+this.$t("area.center"),trigger:"blur"}],level:[{required:!0,message:this.$t("pSelect")+this.$t("area.level"),trigger:"change"}]},dialogStatus:"",parentName:"",form:{areaCode:null,areaId:null,areaName:null,areaPid:null,center:null,cityCode:null,level:null},currentRow:null,addDialog:!1,total:0,listQuery:{areaName:null,areaPid:null},data:[]}},created:function(){this.getList(),this.getDeptList()},methods:{getAreaIdList:function(e){var t=this;e.length||(e=[e]);var a=e.map((function(e){var a={};return e.subList?(a.children=t.getAreaIdList(e.subList),a.label=e.areaName,a.value=e.areaId,a):(a.label=e.areaName,a.value=e.areaId,a)}));return a},clearListQuery:function(){this.listQuery={areaName:null,areaPid:null},this.getList()},getList:function(){var e=this;this.listLoading=!0,Object(s["b"])(this.listQuery).then((function(t){e.listLoading=!1,e.data=e.filterDeptList(t.data)}))},filterDeptList:function(e){var t=this,a=[];return e.forEach((function(e){var r=e;console.log(e),e&&(e.subList&&(r.children=t.filterDeptList(e.subList)),r.id=e.areaId,a.push(r))})),a},getDeptList:function(){var e=this;Object(s["a"])().then((function(t){e.deptIdList=t.data&&e.getAreaIdList(t.data)}))},handleFilter:function(){this.listLoading=!0,this.getList()},handleUpdate:function(e){var t=this;this.form={areaName:e.row.areaName,areaCode:e.row.areaCode,areaId:e.row.areaId,areaPid:e.row.areaPid,center:e.row.center,cityCode:e.row.cityCode,level:e.row.level},this.dialogStatus="update",this.addDialog=!0,this.parentName=e.row._parent?e.row._parent.deptName:this.$t("type.notHave"),this.$nextTick((function(){t.$refs["form"].clearValidate()}))},updateData:function(){var e=this;this.$refs.form.validate((function(t){t&&Object(s["e"])(e.form).then((function(){e.$notify({title:e.$t("title.success"),message:e.$t("title.updateSuccess"),type:"success",duration:3e3}),e.getList(),e.getDeptList(),e.addDialog=!1}))}))},resetForm:function(){for(var e in this.form)this.form[e]=null},handleCreate:function(e){var t=this;0===e?(this.resetForm(),this.currentRow=null,this.addDialog=!0,this.dialogStatus="create",this.form.deptPid=-1,this.deptType.forEach((function(e){e.disabled=!1})),this.$nextTick((function(){t.$refs["form"].clearValidate()}))):this.currentRow?(this.resetForm(),this.addDialog=!0,this.dialogStatus="create",this.form.areaPid=this.currentRow.areaId,this.form.cityCode=this.currentRow.cityCode,this.deptType.forEach((function(e){e.value<t.currentRow.level&&(e.disabled=!0)})),this.$nextTick((function(){t.$refs["form"].clearValidate()}))):this.$notify({title:this.$t("title.pointOut"),message:this.$t("title.oneData"),type:"warning",duration:3e3})},createData:function(){var e=this;this.createStatus||this.$refs.form.validate((function(t){t&&(e.createStatus=!0,-1===e.form.deptPid?e.form.deptPid=-1:e.form.deptPid=e.currentRow.deptId,Object(s["d"])(e.form).then((function(){e.createStatus=!1,e.$notify({title:e.$t("title.success"),message:e.$t("title.addSuccess"),type:"success",duration:3e3}),e.parentName="",e.currentRow=null,e.getList(),e.getDeptList(),e.addDialog=!1})).catch((function(){e.createStatus=!1})))}))},handleDelete:function(e){var t=this;this.$confirm(this.$t("title.delPointOutDepartment"),this.$t("title.pointOut"),{confirmButtonText:this.$t("title.delete"),cancelButtonText:this.$t("title.cancel"),type:"warning"}).then((function(){Object(s["c"])({deptIds:e.row.deptId}).then((function(){t.getList(),t.$notify({title:t.$t("title.success"),message:t.$t("title.deleteSuccess"),type:"success",duration:3e3})}))}))},handleCurrentChange:function(e){this.currentRow=e||null},getChange:function(e,t){console.log(e,t)}}},o=n,c=a("2877"),d=Object(c["a"])(o,r,i,!1,null,null,null);t["default"]=d.exports},4381:function(e,t,a){"use strict";a("d3b7"),a("caad"),a("2532"),a("d9e2");var r=a("4360"),i={inserted:function(e,t){var a=t.value,i=r["a"].getters&&r["a"].getters.butPermission;if(console.log(i,"roles"),!(a&&a instanceof Array&&a.length>0))throw new Error("need roles! Like v-permission=\"['admin','editor']\"");var s=a,l=i.some((function(e){return s.includes(e)}));if(console.log(l,"hasPermission"),l)r["a"].state.user.permissionFlag[s]=!1;else{r["a"].state.user.permissionFlag[s]=!0,console.log(r["a"].state.user.permissionFlag[s],"permissionRoles");var n=document.createElement("div");n.style.cursor="not-allowed",n.style.display="inline-block",e.style.pointerEvents="none",e.parentNode.insertBefore(n,e),e.parentNode&&e.parentNode.removeChild(e),n.appendChild(e),console.log(e,"permissionRoles")}}},s=function(e){e.directive("permission",i)};window.Vue&&(window["permission"]=i,Vue.use(s)),i.install=s;t["a"]=i},"599c":function(e,t,a){"use strict";a.d(t,"b",(function(){return i})),a.d(t,"a",(function(){return s})),a.d(t,"c",(function(){return l})),a.d(t,"d",(function(){return n})),a.d(t,"e",(function(){return o}));var r=a("b775");function i(e){return Object(r["a"])({url:"user-service/area/getAreaTreeList",method:"get",params:e})}function s(e){return Object(r["a"])({url:"user-service/area/getAreaSubByAreaId",method:"get",params:e})}function l(e){return Object(r["a"])({url:"user-service/area/removeArea",method:"get",params:e})}function n(e){return Object(r["a"])({url:"user-service/area/saveArea",method:"post",data:e})}function o(e){return Object(r["a"])({url:"user-service/area/updateArea",method:"post",data:e})}}}]);
|
|
//# sourceMappingURL=chunk-6aaba449.89d82ba0.js.map
|