popupForm-88e29cf3.js 8.7 KB

1
  1. import{h as z,y as D,r as $,p as m,M as d,N as u,a6 as V,l as B,W as f,V as n,k as e,o as c,q as r,m as R,a0 as k,a4 as _,$ as U,a2 as L,an as q,t as s,a7 as g}from"./vue-a39e6937.js";import{f as K,_ as j}from"./index-ba596ae9.js";import{F as y}from"./index-f0d8af94.js";import{b as w}from"./validate-4ecec794.js";import"./index-434d719f.js";import"./controllerUrls-941681c3.js";import"./index-7e56a0fa.js";const G={class:"title"},H={class:"block-help"},J={class:"block-help"},O={class:"block-help"},Q=z({__name:"popupForm",setup(X){const h=D(),l=q("baTable"),{t}=K(),C=$({title:[w({name:"required",title:t("auth.menu.Rule title")})],pid:[{validator:(I,o,i)=>o&&parseInt(o)==parseInt(l.form.items.id)?i(new Error(t("auth.menu.The superior menu rule cannot be the rule itself"))):i(),trigger:"blur"}],name:[w({name:"required",title:t("auth.menu.Rule name")})],url:[w({name:"url",message:t("auth.menu.Please enter the correct URL")})]});return(I,o)=>{const i=s("el-radio"),S=s("el-radio-group"),p=s("el-form-item"),b=s("el-input"),v=s("el-option"),P=s("el-select"),F=s("el-form"),T=s("el-scrollbar"),x=s("el-button"),M=s("el-dialog"),A=g("drag"),E=g("zoom"),N=g("loading"),W=g("blur");return m(),d(M,{class:"ba-operate-dialog",top:"5vh","close-on-click-modal":!1,"model-value":!!e(l).form.operate,onClose:e(l).toggleForm,"destroy-on-close":!0},{header:u(()=>[V((m(),B("div",G,[f(n(e(l).form.operate?e(t)(e(l).form.operate):""),1)])),[[A,[".ba-operate-dialog",".el-dialog__header"]],[E,".ba-operate-dialog"]])]),footer:u(()=>[c("div",{style:R("width: calc(100% - "+e(l).form.labelWidth/1.8+"px)")},[r(x,{onClick:o[17]||(o[17]=a=>e(l).toggleForm(""))},{default:u(()=>[f(n(e(t)("Cancel")),1)]),_:1}),V((m(),d(x,{loading:e(l).form.submitLoading,onClick:o[18]||(o[18]=a=>e(l).onSubmit(h.value)),type:"primary"},{default:u(()=>[f(n(e(l).form.operateIds&&e(l).form.operateIds.length>1?e(t)("Save and edit next item"):e(t)("Save")),1)]),_:1},8,["loading"])),[[W]])],4)]),default:u(()=>[V((m(),d(T,{class:"ba-table-form-scrollbar"},{default:u(()=>[c("div",{class:L(["ba-operate-form","ba-"+e(l).form.operate+"-form"]),style:R("width: calc(100% - "+e(l).form.labelWidth/2+"px)")},[e(l).form.loading?_("",!0):(m(),d(F,{key:0,ref_key:"formRef",ref:h,onKeyup:o[16]||(o[16]=k(a=>e(l).onSubmit(h.value),["enter"])),model:e(l).form.items,"label-position":"right","label-width":e(l).form.labelWidth+"px",rules:C},{default:u(()=>[r(y,{type:"remoteSelect",prop:"pid",label:e(t)("auth.menu.Superior menu rule"),modelValue:e(l).form.items.pid,"onUpdate:modelValue":o[0]||(o[0]=a=>e(l).form.items.pid=a),placeholder:e(t)("Click Select"),"input-attr":{params:{isTree:!0},field:"title","remote-url":e(l).api.actionUrl.get("index")}},null,8,["label","modelValue","placeholder","input-attr"]),r(p,{label:e(t)("auth.menu.Rule type")},{default:u(()=>[r(S,{modelValue:e(l).form.items.type,"onUpdate:modelValue":o[1]||(o[1]=a=>e(l).form.items.type=a)},{default:u(()=>[r(i,{class:"ba-el-radio",label:"route",border:!0},{default:u(()=>[f(n(e(t)("user.rule.Normal routing")),1)]),_:1}),r(i,{class:"ba-el-radio",label:"menu_dir",border:!0},{default:u(()=>[f(n(e(t)("user.rule.Member center menu contents")),1)]),_:1}),r(i,{class:"ba-el-radio",label:"menu",border:!0},{default:u(()=>[f(n(e(t)("user.rule.Member center menu items")),1)]),_:1}),r(i,{class:"ba-el-radio",label:"nav",border:!0},{default:u(()=>[f(n(e(t)("user.rule.Top bar menu items")),1)]),_:1}),r(i,{class:"ba-el-radio",label:"button",border:!0},{default:u(()=>[f(n(e(t)("user.rule.Page button")),1)]),_:1}),r(i,{class:"ba-el-radio",label:"nav_user_menu",border:!0},{default:u(()=>[f(n(e(t)("user.rule.Top bar user dropdown")),1)]),_:1})]),_:1},8,["modelValue"]),c("div",H,n(e(t)("user.rule.Type "+e(l).form.items.type+" tips")),1)]),_:1},8,["label"]),r(p,{prop:"title",label:e(t)("auth.menu.Rule title")},{default:u(()=>[r(b,{modelValue:e(l).form.items.title,"onUpdate:modelValue":o[2]||(o[2]=a=>e(l).form.items.title=a),type:"string",placeholder:e(t)("Please input field",{field:e(t)("auth.menu.Rule title")})},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),r(p,{prop:"name",label:e(t)("auth.menu.Rule name")},{default:u(()=>[r(b,{modelValue:e(l).form.items.name,"onUpdate:modelValue":o[3]||(o[3]=a=>e(l).form.items.name=a),type:"string",placeholder:e(t)("user.rule.English name")},null,8,["modelValue","placeholder"]),c("div",J,n(e(t)("auth.menu.It will be registered as the web side routing name and used as the server side API authentication")),1)]),_:1},8,["label"]),r(p,{label:e(t)("auth.menu.Routing path")},{default:u(()=>[r(b,{modelValue:e(l).form.items.path,"onUpdate:modelValue":o[4]||(o[4]=a=>e(l).form.items.path=a),type:"string",placeholder:e(t)("user.rule.Web side routing path")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),["nav","button","nav_user_menu"].includes(e(l).form.items.type)?_("",!0):(m(),d(y,{key:0,type:"icon",label:e(t)("auth.menu.Rule Icon"),modelValue:e(l).form.items.icon,"onUpdate:modelValue":o[5]||(o[5]=a=>e(l).form.items.icon=a),"input-attr":{"show-icon-name":!0}},null,8,["label","modelValue"])),["menu_dir","button","route"].includes(e(l).form.items.type)?_("",!0):(m(),d(y,{key:1,label:e(t)("auth.menu.Menu type"),modelValue:e(l).form.items.menu_type,"onUpdate:modelValue":o[6]||(o[6]=a=>e(l).form.items.menu_type=a),type:"radio",data:{content:{tab:e(t)("auth.menu.Menu type tab"),link:e(t)("auth.menu.Menu type link (offsite)"),iframe:"Iframe"},childrenAttr:{border:!0}}},null,8,["label","modelValue","data"])),!["menu_dir","button","route"].includes(e(l).form.items.type)&&e(l).form.items.menu_type!="tab"?(m(),d(p,{key:2,prop:"url",label:e(t)("auth.menu.Link address")},{default:u(()=>[r(b,{modelValue:e(l).form.items.url,"onUpdate:modelValue":o[7]||(o[7]=a=>e(l).form.items.url=a),type:"string",placeholder:e(t)("auth.menu.Please enter the URL address of the link or iframe")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])):_("",!0),e(l).form.items.type=="route"||!["menu_dir","button"].includes(e(l).form.items.type)&&e(l).form.items.menu_type=="tab"?(m(),d(p,{key:3,label:e(t)("auth.menu.Component path")},{default:u(()=>[r(b,{modelValue:e(l).form.items.component,"onUpdate:modelValue":o[8]||(o[8]=a=>e(l).form.items.component=a),type:"string",placeholder:e(t)("user.rule.For example, if you add account/overview as a route only")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])):_("",!0),!["menu_dir","button"].includes(e(l).form.items.type)&&e(l).form.items.menu_type=="tab"?(m(),d(p,{key:4,label:e(t)("auth.menu.Extended properties")},{default:u(()=>[r(P,{class:"w100",modelValue:e(l).form.items.extend,"onUpdate:modelValue":o[9]||(o[9]=a=>e(l).form.items.extend=a),placeholder:e(t)("Please select field",{field:e(t)("auth.menu.Extended properties")})},{default:u(()=>[r(v,{label:e(t)("auth.menu.none"),value:"none"},null,8,["label"]),r(v,{label:e(t)("auth.menu.Add as route only"),value:"add_rules_only"},null,8,["label"]),r(v,{label:e(t)("auth.menu.Add as menu only"),value:"add_menu_only"},null,8,["label"])]),_:1},8,["modelValue","placeholder"]),c("div",O,n(e(t)("user.rule.Web side component path, please start with /src, such as: /src/views/frontend/index")),1)]),_:1},8,["label"])):_("",!0),["menu_dir","menu","nav_user_menu"].includes(e(l).form.items.type)?_("",!0):(m(),d(y,{key:5,label:e(t)("user.rule.no_login_valid"),modelValue:e(l).form.items.no_login_valid,"onUpdate:modelValue":o[10]||(o[10]=a=>e(l).form.items.no_login_valid=a),type:"radio",data:{content:{0:e(t)("user.rule.no_login_valid 0"),1:e(t)("user.rule.no_login_valid 1")},childrenAttr:{border:!0}},attr:{"block-help":e(t)("user.rule.no_login_valid tips")}},null,8,["label","modelValue","data","attr"])),r(p,{label:e(t)("auth.menu.Rule comments")},{default:u(()=>[r(b,{onKeyup:[o[11]||(o[11]=k(U(()=>{},["stop"]),["enter"])),o[12]||(o[12]=k(U(a=>e(l).onSubmit(h.value),["ctrl"]),["enter"]))],modelValue:e(l).form.items.remark,"onUpdate:modelValue":o[13]||(o[13]=a=>e(l).form.items.remark=a),type:"textarea",autosize:{minRows:2,maxRows:5},placeholder:e(t)("Please input field",{field:e(t)("auth.menu.Rule comments")})},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),r(p,{label:e(t)("auth.menu.Rule weight")},{default:u(()=>[r(b,{modelValue:e(l).form.items.weigh,"onUpdate:modelValue":o[14]||(o[14]=a=>e(l).form.items.weigh=a),type:"number",placeholder:e(t)("auth.menu.Please enter the weight of menu rule (sort by)")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),r(y,{label:e(t)("state"),modelValue:e(l).form.items.status,"onUpdate:modelValue":o[15]||(o[15]=a=>e(l).form.items.status=a),type:"radio",data:{content:{0:e(t)("Disable"),1:e(t)("Enable")},childrenAttr:{border:!0}}},null,8,["label","modelValue","data"])]),_:1},8,["model","label-width","rules"]))],6)]),_:1})),[[N,e(l).form.loading]])]),_:1},8,["model-value","onClose"])}}});const re=j(Q,[["__scopeId","data-v-0c37094c"]]);export{re as default};