1 |
- import{_ as Y,d as Z,w as $,x as m,Z as z,r,aD as J,o as v,c as E,H as K,G as b,D as l,l as e,m as F,aQ as W,F as x,E as A,e2 as X,e3 as ee,a as U,e4 as ue,M as g,L as le,h as ae,bx as te}from"./index.js";import{c as ne,d as oe}from"./index.f40ed27e.js";const re={class:"flex justify-end"},de=Z({__name:"edit-dialog",emits:["reload"],setup(se,{expose:k,emit:q}){const{logout:N}=$(),_=m(!1),I=m(""),i=m("create"),C=m(null),M=m(null),c=m(!1),f=m(""),V={menu_name:"",menu_type:"1",menu_img:"",menu_route:"",menu_url:"",private:"1",weight:"1",pid:"0",level:"",id:""},a=m({...V}),B=z({menu_name:[{required:!0,message:"\u8BF7\u8F93\u5165\u83DC\u5355\u540D\u79F0",trigger:"blur"}],menu_type:[{required:!0,message:"\u8BF7\u9009\u62E9\u83DC\u5355\u7C7B\u578B",trigger:"change"}],menu_img:[{required:!0,message:"\u8BF7\u9009\u62E9\u83DC\u5355\u56FE\u6807",trigger:"change"}],menu_route:[{required:!0,message:"\u8BF7\u8F93\u5165\u83DC\u5355\u8DEF\u7531",trigger:"blur"},{min:1,max:50,message:"\u957F\u5EA6\u5728 1 \u5230 50 \u4E2A\u5B57\u7B26",trigger:"blur"}],menu_url:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u4EF6\u5730\u5740",trigger:"blur"},{min:1,max:100,message:"\u957F\u5EA6\u5728 1 \u5230 100 \u4E2A\u5B57\u7B26",trigger:"blur"}],private:[{required:!0,message:"\u8BF7\u9009\u62E9\u9875\u9762\u662F\u5426\u663E\u793A",trigger:"change"}],weight:[{required:!0,message:"\u8BF7\u8F93\u5165\u6392\u5E8F\u6743\u91CD",trigger:"blur"}],level:[{required:!0,message:"\u8BF7\u9009\u62E9\u83DC\u5355\u6743\u9650\u7B49\u7EA7",trigger:"blur"}]});function S(o,t,d){switch(M.value=o,Object.keys(a.value).forEach(n=>{n=="private"?a.value[n]=d==="create"?"1":String(o.is_private):a.value[n]=d==="create"?V[n]:String(o[n])}),t!==""&&d==="create"&&(a.value.pid=t),i.value=d,i.value){case"create":f.value="\u65B0\u5EFA\u83DC\u5355";break;case"edit":f.value="\u7F16\u8F91\u83DC\u5355";break;case"view":f.value="\u83DC\u5355\u8BE6\u60C5";break;default:f.value="\u65B0\u5EFA\u83DC\u5355"}w(),_.value=!0}function L(){return{data:{...a.value},api:ne}}function T(){return{data:{...a.value},api:oe}}function j(){C.value.validate(async o=>{if(o){if(c.value)return;const t=i.value==="create"?T:L;c.value=!0;const{api:d,data:n}=t(),{message:s,code:p}=await d(n);te({code:p,message:s,logout:N,handler:()=>{_.value=!1,c.value=!1,q("reload")}})}})}function w(){const{menu_type:o}=a.value;B.menu_url[0].required=o==="2"}return k({show:S,changeCurrentMenuId:o=>I.value=o}),(o,t)=>{const d=r("el-input"),n=r("el-form-item"),s=r("el-col"),p=r("el-option"),y=r("el-select"),O=r("el-radio"),H=r("el-radio-group"),P=r("el-input-number"),R=r("el-row"),h=r("el-button"),G=r("el-dialog"),Q=J("loading");return v(),E("div",null,[K((v(),b(G,{modelValue:_.value,"onUpdate:modelValue":t[9]||(t[9]=u=>_.value=u),"close-on-click-modal":!1,"close-on-press-escape":!1,center:"","append-to-body":"","destroy-on-close":"",width:"700px",title:f.value},{default:l(()=>[e(F(W),{ref_key:"formRef",ref:C,model:a.value,rules:B,"label-width":"90px",class:"demo-ruleForm","status-icon":""},{default:l(()=>[e(R,null,{default:l(()=>[e(s,{span:24},{default:l(()=>[e(n,{label:"\u83DC\u5355\u540D\u79F0",prop:"menu_name"},{default:l(()=>[e(d,{modelValue:a.value.menu_name,"onUpdate:modelValue":t[0]||(t[0]=u=>a.value.menu_name=u),disabled:i.value==="view",placeholder:"\u83DC\u5355\u540D\u79F0"},null,8,["modelValue","disabled"])]),_:1})]),_:1}),e(s,{span:12},{default:l(()=>[e(n,{label:"\u83DC\u5355\u7C7B\u578B",prop:"menu_type"},{default:l(()=>[e(y,{modelValue:a.value.menu_type,"onUpdate:modelValue":t[1]||(t[1]=u=>a.value.menu_type=u),style:{width:"100%"},onChange:w,disabled:i.value==="view",placeholder:"\u83DC\u5355\u7C7B\u578B"},{default:l(()=>[(v(!0),E(x,null,A(F(X),(u,D)=>(v(),b(p,{key:"type"+u.value+D,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1})]),_:1}),e(s,{span:12},{default:l(()=>[e(n,{label:"\u83DC\u5355\u56FE\u6807",prop:"menu_img"},{default:l(()=>[e(F(ee),{modelValue:a.value.menu_img,"onUpdate:modelValue":t[2]||(t[2]=u=>a.value.menu_img=u)},null,8,["modelValue"]),U(' <IconifyIconOffline icon="user" /> ')]),_:1})]),_:1}),e(s,{span:12},{default:l(()=>[e(n,{label:"\u83DC\u5355\u8DEF\u7531",prop:"menu_route"},{default:l(()=>[e(d,{modelValue:a.value.menu_route,"onUpdate:modelValue":t[3]||(t[3]=u=>a.value.menu_route=u),disabled:i.value==="view",placeholder:"\u83DC\u5355\u8DEF\u7531"},null,8,["modelValue","disabled"])]),_:1})]),_:1}),e(s,{span:12},{default:l(()=>[e(n,{label:"\u9875\u9762\u663E\u793A",prop:"private"},{default:l(()=>[e(H,{modelValue:a.value.private,"onUpdate:modelValue":t[4]||(t[4]=u=>a.value.private=u),disabled:i.value==="view"},{default:l(()=>[(v(!0),E(x,null,A(F(ue),(u,D)=>(v(),b(O,{key:u.value+D,label:u.value,value:u.value},{default:l(()=>[g(le(u.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1})]),_:1}),a.value.menu_type==="2"?(v(),b(s,{key:0,span:24},{default:l(()=>[e(n,{label:"\u9875\u9762\u5730\u5740",prop:"menu_url"},{default:l(()=>[e(d,{modelValue:a.value.menu_url,"onUpdate:modelValue":t[5]||(t[5]=u=>a.value.menu_url=u),placeholder:"\u9875\u9762\u5730\u5740",disabled:i.value==="view"},{prepend:l(()=>[g("views/")]),append:l(()=>[g(".vue")]),_:1},8,["modelValue","disabled"])]),_:1})]),_:1})):U("v-if",!0),e(s,{span:12},{default:l(()=>[e(n,{label:"\u6392\u5E8F\u6743\u91CD",prop:"weight"},{default:l(()=>[e(P,{modelValue:a.value.weight,"onUpdate:modelValue":t[6]||(t[6]=u=>a.value.weight=u),precision:0,style:{width:"100%"},min:1,max:999,disabled:i.value==="view"},null,8,["modelValue","disabled"])]),_:1})]),_:1}),e(s,{span:12},{default:l(()=>[e(n,{"label-width":"120px",label:"\u83DC\u5355\u6743\u9650\u7B49\u7EA7",prop:"level"},{default:l(()=>[e(y,{modelValue:a.value.level,"onUpdate:modelValue":t[7]||(t[7]=u=>a.value.level=u)},{default:l(()=>[e(p,{label:"\u516C\u5171",value:"0"}),e(p,{label:"\u8D85\u7BA1",value:"1"}),e(p,{label:"\u5E73\u53F0\u7AEF",value:"2"}),e(p,{label:"\u4F9B\u5E94\u5546\u7AEF",value:"3"})]),_:1},8,["modelValue"])]),_:1})]),_:1})]),_:1}),ae("div",re,[e(h,{loading:c.value,type:"primary",onClick:j},{default:l(()=>[g("\u4FDD\u5B58")]),_:1},8,["loading"]),e(h,{onClick:t[8]||(t[8]=u=>_.value=!1)},{default:l(()=>[g("\u53D6\u6D88")]),_:1})])]),_:1},8,["model","rules"])]),_:1},8,["modelValue","title"])),[[Q,c.value]])])}}});var pe=Y(de,[["__file","C:/Users/89793/Desktop/projects/settle-vue3/src/views/system/menuOperator/components/edit-dialog.vue"]]);export{pe as default};
|