import{x as N,r as c,X as D,c as S,h as G,k as H,al as n,y as m,H as E,I as a,A as V,Q as l,z as P,P as Q,a4 as T,M as k}from"./vendor-6ae0c374-1783405707921v=1.0.0.js";import{a as X,b as Z,_ as J}from"./index-71d7b18c-1783405707921v=1.0.0.js";import{g as K,a as W,b as Y,c as $,e as ee}from"./role-ca48e7dd-1783405707921v=1.0.0.js";import{E as R}from"./eleVendor-d42abce8-1783405707921v=1.0.0.js";const oe={class:"form-section clearfix"},le={class:"form-section--bd clearfix"},te=N({__name:"BaseInfo",props:{role_id:{type:String,required:!1}},emits:["addRole"],setup(C,{emit:h}){const p=C,f=h,x=X(),I=Z(),g=c(),t=D({mp_id:"",role_name:"",role_desc:"",role_id:"",role_status:1}),s=D({}),F=c([]),r=c(!1),w={role_status:[{required:!0,message:"\u8BF7\u9009\u62E9\u89D2\u8272\u72B6\u6001",trigger:"change"}],mp_id:[{required:!0,message:"\u8BF7\u9009\u62E9\u6240\u5C5E\u5E94\u7528",trigger:"change"}],role_name:[{required:!0,message:"\u8BF7\u8F93\u5165\u89D2\u8272\u540D\u79F0",trigger:"change"}]},A=S(()=>!!p.role_id||!!s.post_mp_id);G(()=>p.role_id,o=>{o&&y(o)}),H(()=>{var i;const{copy_role_id:o,copy_mp_id:e}=x.query;o&&e&&Object.assign(s,{mp_id:e,post_mp_id:e,role_id:o});const d=p.role_id||((i=s.role_id)!=null?i:"");d&&y(d),M()});const M=async()=>{const o={page:1,size:99},{data:e}=await K(o);F.value=e.list},y=async o=>{const{data:e}=await W({role_id:o});Object.keys(s).length&&(e.role_level="",e.role_pid="",e.company_id="",e.role_id=""),Object.assign(t,e)},j=()=>{g.value.validate(o=>{o&&(r.value=!0,Object.keys(s).length||!p.role_id?q():O())})},q=async()=>{try{r.value=!0;const o=Object.keys(s).length?Y:$,{data:e}=await o({...t,...s});R.success("\u89D2\u8272\u6DFB\u52A0\u6210\u529F\uFF01"),f("addRole",{mp_id:t.mp_id,role_id:e.role_id.toString(),position:"1"})}finally{r.value=!1}},O=async()=>{try{r.value=!0;const{data:o}=await ee(t);R.success("\u89D2\u8272\u7F16\u8F91\u6210\u529F\uFF01"),f("addRole",{mp_id:t.mp_id,role_id:o.role_id.toString(),position:"1"})}finally{r.value=!1}},L=()=>{I.go(-1)};return(o,e)=>{const d=n("el-option"),i=n("el-select"),_=n("el-form-item"),v=n("el-input"),b=n("el-button"),B=n("el-col"),U=n("el-form");return m(),E(U,{ref_key:"ruleFormRef",ref:g,model:t,rules:w,"label-width":"120px",class:"demo-ruleForm"},{default:a(()=>[V("div",oe,[l(B,{span:24},{default:a(()=>[V("div",le,[l(B,{span:12},{default:a(()=>[l(_,{label:"\u6240\u5C5E\u5E94\u7528",prop:"mp_id"},{default:a(()=>[l(i,{modelValue:t.mp_id,"onUpdate:modelValue":e[0]||(e[0]=u=>t.mp_id=u),placeholder:"\u8BF7\u9009\u62E9\u5E94\u7528",disabled:A.value},{default:a(()=>[(m(!0),P(Q,null,T(F.value,(u,z)=>(m(),E(d,{key:z,label:u.mp_name,value:u.mp_id},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1}),l(_,{label:"\u89D2\u8272\u72B6\u6001",prop:"role_status"},{default:a(()=>[l(i,{modelValue:t.role_status,"onUpdate:modelValue":e[1]||(e[1]=u=>t.role_status=u),placeholder:"\u8BF7\u9009\u62E9\u5E94\u7528"},{default:a(()=>[l(d,{label:"\u6709\u6548",value:1}),l(d,{label:"\u65E0\u6548",value:0})]),_:1},8,["modelValue"])]),_:1}),l(_,{label:"\u89D2\u8272\u540D\u79F0",prop:"role_name"},{default:a(()=>[l(v,{modelValue:t.role_name,"onUpdate:modelValue":e[2]||(e[2]=u=>t.role_name=u),placeholder:"\u8BF7\u8F93\u5165\u89D2\u8272\u540D\u79F0"},null,8,["modelValue"])]),_:1}),l(_,{label:"\u89D2\u8272\u63CF\u8FF0",prop:"role_desc"},{default:a(()=>[l(v,{modelValue:t.role_desc,"onUpdate:modelValue":e[3]||(e[3]=u=>t.role_desc=u),placeholder:"\u8BF7\u8F93\u5165\u89D2\u8272\u63CF\u8FF0"},null,8,["modelValue"])]),_:1}),l(_,null,{default:a(()=>[l(b,{onClick:L},{default:a(()=>e[4]||(e[4]=[k("\u53D6\u6D88",-1)])),_:1,__:[4]}),l(b,{type:"primary",loading:r.value,onClick:j},{default:a(()=>e[5]||(e[5]=[k("\u786E\u5B9A",-1)])),_:1,__:[5]},8,["loading"])]),_:1})]),_:1})])]),_:1})])]),_:1},8,["model"])}}});const re=J(te,[["__scopeId","data-v-3f0e512f"],["__file","D:/desktop/huaZhong/huazhong-common/apps/vue-admin/src/views/roleManage/roleManage/components/BaseInfo.vue"]]);export{re as default};
