(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-1ba74b0c"],{"0c3a":function(t,e,a){"use strict";a.r(e);var i=function(){var t=this,e=t.$createElement,a=t._self._c||e;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:t.deptIdList,placeholder:t.$t("listQuery.deptId"),props:{checkStrictly:!0,emitPath:!1,props:{}},clearable:""},on:{change:t.handleFilter},model:{value:t.listQuery.deptId,callback:function(e){t.$set(t.listQuery,"deptId",e)},expression:"listQuery.deptId"}}),a("el-input",{staticClass:"filter-item",attrs:{placeholder:t.$t("department.deptName")},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.handleFilter.apply(null,arguments)}},model:{value:t.listQuery.deptName,callback:function(e){t.$set(t.listQuery,"deptName",e)},expression:"listQuery.deptName"}}),a("span",{staticClass:"btn-item",on:{click:t.handleFilter}},[a("i",{staticClass:"iconfont icon-sousuo"}),t._v(t._s(t.$t("btn.search")))]),a("span",{staticClass:"btn-item",on:{click:t.clearListQuery}},[a("i",{staticClass:"el-icon-refresh-left"}),t._v(" "+t._s(t.$t("btn.resetting")))]),a("div",{staticClass:"control-container"},["super"==t.userName?a("span",{staticClass:"btn-item",on:{click:function(e){return t.handleCreate(0)}}},[t._v(t._s(t.$t("menu.addToplevel")))]):t._e(),a("span",{staticClass:"btn-item",on:{click:function(e){return t.handleCreate(1)}}},[t._v(t._s(t.$t("menu.addChild")))])])],1),a("div",{staticClass:"table-container"},[a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.listLoading,expression:"listLoading"}],attrs:{data:t.data,"row-key":"deptId","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:{"expand-change":t.getChange,"current-change":t.handleCurrentChange}},[a("el-table-column",{attrs:{prop:"deptName",align:"left",label:t.$t("department.deptName")}}),a("el-table-column",{attrs:{label:t.$t("department.deptType"),width:"200",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[1===e.row.deptType?a("span",[t._v(t._s(t.$t("department.company")))]):t._e(),2===e.row.deptType?a("span",[t._v(t._s(t.$t("department.department")))]):t._e()]}}])}),a("el-table-column",{attrs:{prop:"address",align:"left",label:t.$t("table.address")}}),a("el-table-column",{attrs:{label:t.$t("table.operate"),width:"240",align:"left"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("span",{staticClass:"btnCancel",attrs:{title:t.$t("table.update")},on:{click:function(a){return t.handleUpdate(e)}}},[a("i",{staticClass:"iconfont icon-bianji"}),t._v(t._s(t.$t("table.update")))]),a("span",{staticClass:"btnCancel delete",attrs:{title:t.$t("table.delete")},on:{click:function(a){return t.handleDelete(e)}}},[a("i",{staticClass:"iconfont icon-a--"}),t._v(t._s(t.$t("table.delete")))])]}}])})],1)],1),a("el-dialog",{attrs:{"close-on-click-modal":!1,title:t.textMap[t.dialogStatus],visible:t.addDialog},on:{"update:visible":function(e){t.addDialog=e}}},[a("el-scrollbar",{staticStyle:{height:"100%"},attrs:{vertical:!0}},[a("el-form",{ref:"form",attrs:{rules:t.rules,model:t.form,inline:"","label-width":"130px"}},[a("el-form-item",{attrs:{label:t.$t("department.deptName"),prop:"deptName"}},[a("el-input",{attrs:{placeholder:t.$t("pEnter")+t.$t("department.deptName"),maxlength:"20"},model:{value:t.form.deptName,callback:function(e){t.$set(t.form,"deptName",e)},expression:"form.deptName"}})],1),a("el-form-item",{attrs:{label:t.$t("department.deptType"),prop:"deptType"}},[a("el-select",{attrs:{placeholder:t.$t("pSelect"),disabled:"update"===t.dialogStatus},model:{value:t.form.deptType,callback:function(e){t.$set(t.form,"deptType",e)},expression:"form.deptType"}},t._l(t.deptType,(function(t){return a("el-option",{key:t.value,attrs:{label:t.label,value:t.value,disabled:t.disabled}})})),1)],1),a("el-form-item",{attrs:{label:t.$t("table.address"),prop:"address"}},[a("el-input",{attrs:{type:"textarea",placeholder:t.$t("pEnter")+t.$t("table.address"),maxlength:"20"},model:{value:t.form.address,callback:function(e){t.$set(t.form,"address",e)},expression:"form.address"}})],1)],1)],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("span",{staticClass:"btn-item long",on:{click:function(e){t.addDialog=!1}}},[t._v(t._s(t.$t("btn.cancel")))]),a("span",{staticClass:"btn-item long",on:{click:function(e){"create"===t.dialogStatus?t.createData():t.updateData()}}},[t._v(t._s(t.$t("btn.define")))])])],1)],1)},s=[],n=(a("d81d"),a("d3b7"),a("159b"),a("0e8f")),r=a("4381"),d={computed:{userName:function(){return this.$store.state.user.userName},deptId:function(){return this.$store.state.user.deptId}},directives:{permission:r["a"]},data:function(){return{listLoading:!1,createStatus:!1,deptPidBox:[],deptIdList:[],deptType:[{value:1,label:this.$t("department.company"),disabled:!1},{value:2,label:this.$t("department.department"),disabled:!1}],textMap:{update:this.$t("table.update"),create:this.$t("table.create")},rules:{deptName:[{required:!0,message:this.$t("pEnter")+this.$t("department.deptName"),trigger:"blur"}],deptCode:[{required:!0,message:this.$t("pEnter")+this.$t("department.deptCode"),trigger:"blur"}],deptPid:[{required:!0,message:this.$t("pEnter")+this.$t("department.deptPid"),trigger:"change"}],longitude:[{required:!0,message:this.$t("pEnter")+this.$t("table.longitude"),trigger:"blur"}],latitude:[{required:!0,message:this.$t("pEnter")+this.$t("table.latitude"),trigger:"blur"}],deptType:[{required:!0,message:this.$t("pSelect")+this.$t("department.deptType"),trigger:"change"}],address:[{required:!0,message:this.$t("pEnter")+this.$t("table.address"),trigger:"blur"}]},dialogStatus:"",parentName:"",form:{deptId:"",deptName:"",deptCode:"",deptPid:"",deptType:"",longitude:"",latitude:"",address:""},currentRow:null,addDialog:!1,total:0,listQuery:{deptId:null,deptName:null},data:[]}},created:function(){this.getList(),this.getDeptSubByDeptId()},methods:{getdeptIdList:function(t){var e=this;t.length||(t=[t]);var a=t.map((function(t){var a={};return t.subBeanList?(a.children=e.getdeptIdList(t.subBeanList),a.label=t.nodeBean.deptName,a.value=t.nodeBean.deptId,a):(a.label=t.nodeBean.deptName,a.value=t.nodeBean.deptId,a)}));return a},clearListQuery:function(){this.listQuery={deptId:"",deptIds:[],deptName:"",roleCode:"",roleId:"",roleName:""},this.getList()},getList:function(){var t=this;this.listLoading=!0,Object(n["d"])(this.listQuery).then((function(e){t.listLoading=!1,t.data=t.filterDeptList(e.data)}))},filterDeptList:function(t){var e=this,a=[];return t.forEach((function(t){var i=t;console.log(t),t&&(t.subList&&(i.children=e.filterDeptList(t.subList,!0)),t.id=t.deptId+1,a.push(i))})),a},getDeptSubByDeptId:function(){var t=this;Object(n["e"])().then((function(e){t.deptIdList=e.data&&t.getdeptIdList(e.data)}))},handleFilter:function(){this.listLoading=!0,this.getList()},handleUpdate:function(t){var e=this;this.form={deptName:t.row.deptName,deptId:t.row.deptId,deptPid:t.row.deptPid,deptType:t.row.deptType,address:t.row.address,latitude:t.row.latitude,deptCode:t.row.deptCode,longitude:t.row.longitude},this.dialogStatus="update",this.addDialog=!0,this.parentName=t.row._parent?t.row._parent.deptName:this.$t("type.notHave"),this.$nextTick((function(){e.$refs["form"].clearValidate()}))},updateData:function(){var t=this;this.$refs.form.validate((function(e){e&&Object(n["c"])(t.form).then((function(){t.$notify({title:t.$t("title.success"),message:t.$t("title.updateSuccess"),type:"success",duration:3e3}),t.getList(),t.getDeptSubByDeptId(),t.addDialog=!1}))}))},resetForm:function(){for(var t in this.form)this.form[t]=null},handleCreate:function(t){var e=this;0===t?(this.resetForm(),this.addDialog=!0,this.dialogStatus="create",this.form.deptPid=0,this.deptType.forEach((function(t){t.disabled=!1})),this.$nextTick((function(){e.$refs["form"].clearValidate()}))):this.currentRow?(this.resetForm(),this.addDialog=!0,this.dialogStatus="create",this.form.deptPid=this.currentRow.deptId,this.deptType.forEach((function(t){t.value0))throw new Error("need roles! Like v-permission=\"['admin','editor']\"");var n=a,r=s.some((function(t){return n.includes(t)}));if(console.log(r,"hasPermission"),r)i["a"].state.user.permissionFlag[n]=!1;else{i["a"].state.user.permissionFlag[n]=!0,console.log(i["a"].state.user.permissionFlag[n],"permissionRoles");var d=document.createElement("div");d.style.cursor="not-allowed",d.style.display="inline-block",t.style.pointerEvents="none",t.parentNode.insertBefore(d,t),t.parentNode&&t.parentNode.removeChild(t),d.appendChild(t),console.log(t,"permissionRoles")}}},n=function(t){t.directive("permission",s)};window.Vue&&(window["permission"]=s,Vue.use(n)),s.install=n;e["a"]=s}}]); //# sourceMappingURL=chunk-1ba74b0c.befd3147.js.map