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