You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
5.5 KiB
JavaScript

var g=(e,r,i)=>new Promise((f,s)=>{var w=a=>{try{p(i.next(a))}catch(n){s(n)}},h=a=>{try{p(i.throw(a))}catch(n){s(n)}},p=a=>a.done?f(a.value):Promise.resolve(a.value).then(w,h);p((i=i.apply(e,r)).next())});import{a as F,B as q}from"./index-Bv3AVfz1.js";import{u as H,_ as A}from"./useForm-CdUGloRq.js";import"./BasicForm.vue_vue_type_style_index_0_lang-C-Cj0P69.js";import"./componentMap-uxp1OCze.js";import{_ as O}from"./entry/index-CruxN-Hs-1723019140439.js";import"./helper-CuUont7-.js";import"./index-B6biQger.js";import{c as R}from"./rules-Boel_RXz.js";import{n as U,V as x,a6 as P}from"./antd-BY-1PcYE.js";import{t as W,a as L,b as E}from"./index-FjDPDpA0.js";import{u as $}from"./tenant-CuhlaCtW.js";import{u as j}from"./useSize-Cq2xbXH4.js";import{d as G,f as C,c as z,_ as u,a8 as b,a9 as d,k as v,u as t,$ as J,F as K,ab as Q,a0 as S,a1 as D,G as T,ac as X,ad as Z}from"./vue-aEZWZQSa.js";import"./FormItem.vue_vue_type_script_lang-B_ueKfdL.js";import"./RadioButtonGroup.vue_vue_type_script_setup_true_lang-D6-xDLMZ.js";import"./index-BYFe0x3M.js";import"./useSortable-CSRkxIlp.js";import"./download-BageIVpd.js";import"./useLoading-C0EEZ3ab.js";import"./copyTextToClipboard-BBFF3Y3I.js";import"./onMountedOrActivated-BIJ0U1R1.js";import"./style-Bwlk8Loa.js";import"./useWindowSizeFn--jCT5E3A.js";const ee=U(new Date).add(365,"days").startOf("day").format("YYYY-MM-DD HH:mm:ss"),te=[{field:"id",label:"id",component:"Input",show:!1},{field:"tenantId",label:"租户编号",component:"Input",show:!1},{field:"Divider_1",component:"Divider",label:"基本信息",componentProps:{orientation:"center"}},{field:"companyName",label:"企业名称",component:"Input",required:!0},{field:"contactUserName",label:"联系人",component:"Input",required:!0},{field:"contactPhone",label:"联系电话",component:"Input",rules:R("phone",!0)},{field:"Divider_2",component:"Divider",label:"管理员信息",componentProps:{orientation:"center"},ifShow:({model:e})=>!e.tenantId},{field:"username",label:"用户账号",component:"Input",required:!0,ifShow:({model:e})=>!e.tenantId},{field:"password",label:"用户密码",component:"InputPassword",required:!0,ifShow:({model:e})=>!e.tenantId},{field:"Divider_3",component:"Divider",label:"租户设置",componentProps:{orientation:"center"}},{field:"packageId",label:"租户套餐",required:!0,slot:"packageSelect"},{field:"expireTime",label:"过期时间",helpMessage:["已经设置过期时间不允许重置为'无期限'","即在开通时未设置无期限 以后都不允许设置"],component:"DatePicker",defaultValue:ee,componentProps:{showTime:!0,format:"YYYY-MM-DD HH:mm:ss",valueFormat:"YYYY-MM-DD HH:mm:ss"},colProps:{xs:24,sm:24,md:12,lg:12,xl:12}},{field:"accountCount",label:"用户数量",component:"InputNumber",defaultValue:-1,helpMessage:"-1不限制用户数量",componentProps:{min:-1},renderComponentContent({model:e}){return{addonBefore:()=>e.accountCount==-1?"不限制数量":"输入数量"}},colProps:{xs:24,sm:24,md:12,lg:12,xl:12}},{field:"domain",label:"绑定域名",component:"Input",helpMessage:["可填写域名/端口","填写域名如: www.test.com 或者 www.test.com:8080","填写ip:端口如: 127.0.0.1:8080"],componentProps:{addonBefore:"http(s)://"},rules:[{required:!1,message:"绑定域名不需要带http(s)://",trigger:"change",validator(e,r){return r&&(r.startsWith("http://")||r.startsWith("https://"))?Promise.reject(new Error("绑定域名不需要带http(s)://")):Promise.resolve()}}]},{field:"Divider_4",component:"Divider",label:"企业信息",componentProps:{orientation:"center"}},{field:"address",label:"企业地址",component:"Input"},{field:"licenseNumber",label:"企业代码",component:"Input"},{field:"intro",label:"企业介绍",component:"InputTextArea"},{field:"remark",label:"备注",component:"InputTextArea"},{field:"status",label:"状态",component:"Select",defaultValue:"0",show:!1}],ae={class:"flex flex-row items-center gap-1"},oe=["textContent"],ne=G({name:"TenantDrawer",__name:"TenantDrawer",emits:["register","reload"],setup(e,{emit:r}){const i=x.Option,f=r,s=C(!1),w=z(()=>s.value?"编辑租户":"新增租户"),h=j(700),[p,{closeDrawer:a,drawerLoading:n}]=F(l=>g(this,null,function*(){n(!0);const{record:_,update:c,tenantPackageList:m}=l;if(s.value=c,c&&_){const o=yield W(_.id);yield y(o)}I.value=m,n(!1)})),I=C([]),[Y,{setFieldsValue:y,validate:M,resetForm:k}]=H({labelWidth:100,name:"tenant_drawer",showActionButtonGroup:!1,showAdvancedButton:!1,baseColProps:{span:24},schemas:te}),{initTenant:B}=$();function N(){return g(this,null,function*(){try{n(!0);const l=yield M();t(s)?yield L(l):yield E(l),yield B(),f("reload"),a(),yield k()}catch(l){}finally{n(!1)}})}return(l,_)=>(u(),b(t(q),Z(l.$attrs,{title:w.value,width:t(h),showFooter:"",onRegister:t(p),onOk:N,onClose:t(k)}),{default:d(()=>[v(t(A),{onRegister:t(Y)},{packageSelect:d(({model:c,field:m})=>[v(t(x),{value:c[m],"onUpdate:value":o=>c[m]=o,placeholder:"请选择租户套餐",disabled:s.value,allowClear:""},{default:d(()=>[(u(!0),J(K,null,Q(I.value,(o,V)=>(u(),b(t(i),{key:V,value:o.packageId},{default:d(()=>[S("div",ae,[S("span",{textContent:D(o.packageName)},null,8,oe),v(t(P),{color:"blue"},{default:d(()=>[T(" 菜单项目数: "+D(o.menuIds.split(", ").length),1)]),_:2},1024),o.remark?(u(),b(t(P),{key:0,color:"orange"},{default:d(()=>[T(D(o.remark),1)]),_:2},1024)):X("",!0)])]),_:2},1032,["value"]))),128))]),_:2},1032,["value","onUpdate:value","disabled"])]),_:1},8,["onRegister"])]),_:1},16,["title","width","onRegister","onClose"]))}}),Ye=O(ne,[["__scopeId","data-v-1ce0dcf5"]]);export{Ye as default};