工业互联网平台脚手架前端代码
houzhongjian
2024-09-18 23db5e5c6bfcbd7030a4003cd4ea18fbb920024f
1
import{d as L,J as R,Q as J,r as d,A as Q,o as V,g as h,B as u,k as t,a,O as f,P as W,I as y,dD as Z,c as j,F as z,i as G,a3 as X,N as Y,D as $,a7 as ee,S as ae,cF as le,av as se,au as ue,W as te,V as oe,Z as de,H as re}from"./index-CHTXMeh8.js";import{_ as ne}from"./Dialog.vue_vue_type_style_index_0_lang-DH0TiLYN.js";import{E as me}from"./el-card-Bdk9qx7q.js";import{C as N}from"./constants-CuOBQ73z.js";import{d as ie,h as ce}from"./tree-BBZY150N.js";import{a as pe,c as ve,u as fe}from"./index-Cc4AdA2J.js";import{g as ke}from"./index-DTm78JRf.js";const Ve=re(L({name:"SystemTenantPackageForm",__name:"TenantPackageForm",emits:["success"],setup(_e,{expose:S,emit:U}){const{t:_}=R(),b=J(),m=d(!1),x=d(""),i=d(!1),C=d(""),o=d({id:null,name:null,remark:null,menuIds:[],status:N.ENABLE}),A=Q({name:[{required:!0,message:"\u5957\u9910\u540D\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],status:[{required:!0,message:"\u72B6\u6001\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}],menuIds:[{required:!0,message:"\u5173\u8054\u7684\u83DC\u5355\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A",trigger:"blur"}]}),k=d(),g=d([]),c=d(!1),n=d(),v=d(!1);S({open:async(s,e)=>{if(m.value=!0,x.value=_("action."+s),C.value=s,T(),g.value=ce(await ke()),e){i.value=!0;try{const r=await pe(e);o.value=r,r.menuIds.forEach(p=>{n.value.setChecked(p,!0,!1)})}finally{i.value=!1}}}});const E=U,F=async()=>{if(k&&await k.value.validate()){i.value=!0;try{const s=o.value;s.menuIds=[...n.value.getCheckedKeys(!1),...n.value.getHalfCheckedKeys()],C.value==="create"?(await ve(s),b.success(_("common.createSuccess"))):(await fe(s),b.success(_("common.updateSuccess"))),m.value=!1,E("success")}finally{i.value=!1}}},T=()=>{var s,e;v.value=!1,c.value=!1,o.value={id:null,name:null,remark:null,menuIds:[],status:N.ENABLE},(s=n.value)==null||s.setCheckedNodes([]),(e=k.value)==null||e.resetFields()},q=()=>{n.value.setCheckedNodes(v.value?g.value:[])},B=()=>{var e;const s=(e=n.value)==null?void 0:e.store.nodesMap;for(let r in s)s[r].expanded!==c.value&&(s[r].expanded=c.value)};return(s,e)=>{const r=ee,p=ae,w=le,D=me,H=se,M=ue,O=te,I=oe,P=ne,K=de;return V(),h(P,{modelValue:a(m),"onUpdate:modelValue":e[6]||(e[6]=l=>y(m)?m.value=l:null),title:a(x)},{footer:u(()=>[t(I,{disabled:a(i),type:"primary",onClick:F},{default:u(()=>[f("\u786E \u5B9A")]),_:1},8,["disabled"]),t(I,{onClick:e[5]||(e[5]=l=>m.value=!1)},{default:u(()=>[f("\u53D6 \u6D88")]),_:1})]),default:u(()=>[W((V(),h(O,{ref_key:"formRef",ref:k,model:a(o),rules:a(A),"label-width":"80px"},{default:u(()=>[t(p,{label:"\u5957\u9910\u540D",prop:"name"},{default:u(()=>[t(r,{modelValue:a(o).name,"onUpdate:modelValue":e[0]||(e[0]=l=>a(o).name=l),placeholder:"\u8BF7\u8F93\u5165\u5957\u9910\u540D"},null,8,["modelValue"])]),_:1}),t(p,{label:"\u83DC\u5355\u6743\u9650"},{default:u(()=>[t(D,{class:"cardHeight"},{header:u(()=>[f(" \u5168\u9009/\u5168\u4E0D\u9009: "),t(w,{modelValue:a(v),"onUpdate:modelValue":e[1]||(e[1]=l=>y(v)?v.value=l:null),"active-text":"\u662F","inactive-text":"\u5426","inline-prompt":"",onChange:q},null,8,["modelValue"]),f(" \u5168\u90E8\u5C55\u5F00/\u6298\u53E0: "),t(w,{modelValue:a(c),"onUpdate:modelValue":e[2]||(e[2]=l=>y(c)?c.value=l:null),"active-text":"\u5C55\u5F00","inactive-text":"\u6298\u53E0","inline-prompt":"",onChange:B},null,8,["modelValue"])]),default:u(()=>[t(a(Z),{ref_key:"treeRef",ref:n,data:a(g),props:a(ie),"empty-text":"\u52A0\u8F7D\u4E2D\uFF0C\u8BF7\u7A0D\u5019","node-key":"id","show-checkbox":""},null,8,["data","props"])]),_:1})]),_:1}),t(p,{label:"\u72B6\u6001",prop:"status"},{default:u(()=>[t(M,{modelValue:a(o).status,"onUpdate:modelValue":e[3]||(e[3]=l=>a(o).status=l)},{default:u(()=>[(V(!0),j(z,null,G(a(X)(a(Y).COMMON_STATUS),l=>(V(),h(H,{key:l.value,label:l.value},{default:u(()=>[f($(l.label),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])]),_:1}),t(p,{label:"\u5907\u6CE8",prop:"remark"},{default:u(()=>[t(r,{modelValue:a(o).remark,"onUpdate:modelValue":e[4]||(e[4]=l=>a(o).remark=l),placeholder:"\u8BF7\u8F93\u5165\u5907\u6CE8"},null,8,["modelValue"])]),_:1})]),_:1},8,["model","rules"])),[[K,a(i)]])]),_:1},8,["modelValue","title"])}}}),[["__scopeId","data-v-f377ba27"]]);export{Ve as default};