import{A as o}from"./ActionBar.1725b1a3.js";import{F as i}from"./FormLayout.c7820bdd.js";import{n}from"./vueComponentNormalizer.9ef17bb1.js";/* empty css                                                    *//* empty css                                                     */import{S as s}from"./SearchTreeMenu.cf3d6165.js";import{f as l,d as c,c as m,u as f}from"./org.23184f20.js";/* empty css                                                              *//* empty css                                                                   *//* empty css                                                               */import"./index.f5168bf8.js";var u=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"v-page"},[r("SearchTreeMenu",{ref:"treeMenuRef",attrs:{title:"\u7EC4\u7EC7\u673A\u6784\u5217\u8868","tree-data":e.org_list},on:{"current-change":e.change,onCreate:e.toCreateOrg,onDelete:e.toDeleteOrg}}),e.active_org?r("div",{staticClass:"v-ctx"},[r("FormLayout",{ref:"formLayoutRef",attrs:{items:e.formItems,model:e.active_org,rules:e.rules,"label-width":"110px","label-position":"right"}}),r("ActionBar",{attrs:{center:""},on:{onConfirm:e.onConfirm,onCancel:e.onCancel}})],1):e._e()],1)},d=[];const g={components:{SearchTreeMenu:s,FormLayout:i,ActionBar:o},data:()=>({search:"",org_list:[],active_org:null}),created(){this.formItems=[{prop:"name",label:"\u7EC4\u7EC7\u673A\u6784\u540D\u79F0",model:{tag:"el-input",attrs:{maxlength:"16",placeholder:"\u8BF7\u8F93\u5165\u7EC4\u7EC7\u673A\u6784\u540D\u79F0"}}},{prop:"desc",label:"\u7EC4\u7EC7\u673A\u6784\u63CF\u8FF0",model:{tag:"el-input",type:"textarea",attrs:{"show-word-limit":!0,rows:5,placeholder:"\u8BF7\u8F93\u5165\u7EC4\u7EC7\u673A\u6784\u63CF\u8FF0"}}}],this.rules={name:{required:!0,message:"\u8BF7\u8F93\u5165\u7EC4\u7EC7\u673A\u6784\u540D\u79F0",trigger:"blur"}},this.findAllOrg()},methods:{async findAllOrg(){const{data:e}=await l(),{tree:t}=e.toTree();this.org_list=Object.freeze(t)},change(e){this.active_org=JSON.parse(JSON.stringify(e))},toCreateOrg(){var e;this.active_org={name:"",desc:"",pid:((e=this.$refs.treeMenuRef.getCurrentNode())==null?void 0:e.id)||0}},async toDeleteOrg(e){await this.$confirm("\u5C06\u5220\u9664\u4E00\u4E2A\u7EC4\u7EC7, \u662F\u5426\u7EE7\u7EED?"),await c(e.id),this.onCancel(),this.findAllOrg()},async onConfirm(){await this.$refs.formLayoutRef.validate(),await(this.active_org.id?f:m)(this.active_org),this.onCancel(),this.findAllOrg()},onCancel(){this.active_org=null,this.$refs.treeMenuRef.setCurrentKey()}}},a={};var p=n(g,u,d,!1,h,null,null,null);function h(e){for(let t in a)this[t]=a[t]}const S=function(){return p.exports}();export{S as default};
