urit-qf-ui 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- (function(y,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("element-plus"),require("element-plus/dist/index.css"),require("element-plus/es"),require("element-plus/es/components/base/style/css"),require("element-plus/es/components/input/style/css"),require("vue"),require("element-plus/es/components/input-number/style/css"),require("element-plus/es/components/select/style/css"),require("element-plus/es/components/option/style/css"),require("axios"),require("element-plus/es/components/switch/style/css"),require("element-plus/es/components/date-picker/style/css"),require("element-plus/es/components/button/style/css"),require("element-plus/es/components/menu/style/css"),require("element-plus/es/components/sub-menu/style/css"),require("element-plus/es/components/menu-item/style/css"),require("element-plus/es/components/icon/style/css"),require("element-plus/es/components/form/style/css"),require("element-plus/es/components/dialog/style/css"),require("@element-plus/icons-vue"),require("element-plus/es/components/drawer/style/css"),require("element-plus/es/components/table/style/css"),require("element-plus/es/components/table-column/style/css"),require("element-plus/es/components/pagination/style/css"),require("mitt"),require("mqtt")):typeof define=="function"&&define.amd?define(["exports","element-plus","element-plus/dist/index.css","element-plus/es","element-plus/es/components/base/style/css","element-plus/es/components/input/style/css","vue","element-plus/es/components/input-number/style/css","element-plus/es/components/select/style/css","element-plus/es/components/option/style/css","axios","element-plus/es/components/switch/style/css","element-plus/es/components/date-picker/style/css","element-plus/es/components/button/style/css","element-plus/es/components/menu/style/css","element-plus/es/components/sub-menu/style/css","element-plus/es/components/menu-item/style/css","element-plus/es/components/icon/style/css","element-plus/es/components/form/style/css","element-plus/es/components/dialog/style/css","@element-plus/icons-vue","element-plus/es/components/drawer/style/css","element-plus/es/components/table/style/css","element-plus/es/components/table-column/style/css","element-plus/es/components/pagination/style/css","mitt","mqtt"],x):(y=typeof globalThis<"u"?globalThis:y||self,x(y.UritQfUI={},y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.Vue,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.axios,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlusIconsVue,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.mitt,y.mqtt))})(this,function(y,x,I,k,Nt,Rt,e,At,It,zt,Z,Ut,Mt,Ft,Lt,qt,Wt,Ot,jt,Yt,v,Qt,Kt,Gt,Ht,se,re){"use strict";var Pt=Object.defineProperty;var $t=(y,x,I)=>x in y?Pt(y,x,{enumerable:!0,configurable:!0,writable:!0,value:I}):y[x]=I;var w=(y,x,I)=>$t(y,typeof x!="symbol"?x+"":x,I);const ce=e.defineComponent({__name:"UInput",props:{fieldLabel:{},labelPosition:{default:"top"},labelWidth:{},labelAlign:{},required:{type:Boolean},modelValue:{},outlined:{type:Boolean},dense:{type:Boolean},filled:{type:Boolean},borderless:{type:Boolean},label:{},hint:{},error:{type:Boolean},errorMessage:{},type:{},placeholder:{},disable:{type:Boolean},readonly:{type:Boolean},prefix:{},suffix:{},mask:{},maxlength:{}},emits:["update:modelValue"],setup(n,{emit:a}){const t=n,l=a,m=e.computed(()=>{const r={};return t.labelPosition==="left"&&t.labelWidth&&(r.width=typeof t.labelWidth=="number"?`${t.labelWidth}px`:t.labelWidth),t.labelAlign&&(r.textAlign=t.labelAlign),r}),c=e.computed(()=>({"u-input-label-left":t.labelPosition==="left","u-input-label-top":t.labelPosition==="top"})),d={onInput(r){l("update:modelValue",r)}};return(r,o)=>{const i=k.ElInput;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-input",c.value])},[n.fieldLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-input-label",style:e.normalizeStyle(m.value)},[e.createTextVNode(e.toDisplayString(n.fieldLabel)+" ",1),e.createElementVNode("span",{class:e.normalizeClass(["required-star",{"required-star--visible":n.required}])},"*",2)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["u-input-field",{"u-input-field--top":n.labelPosition==="top"}])},[e.createVNode(i,{"model-value":n.modelValue,placeholder:n.placeholder,type:n.type,disabled:n.disable,readonly:n.readonly,maxlength:n.maxlength,"onUpdate:modelValue":d.onInput},null,8,["model-value","placeholder","type","disabled","readonly","maxlength","onUpdate:modelValue"])],2)],2)}}}),C=(n,a)=>{const t=n.__vccOpts||n;for(const[l,m]of a)t[l]=m;return t},P=C(ce,[["__scopeId","data-v-ecf5177c"]]),de={class:"u-input-number-field"},Y=C(e.defineComponent({__name:"UInputNumber",props:{fieldLabel:{},labelPosition:{default:"top"},labelWidth:{},labelAlign:{},required:{type:Boolean},modelValue:{},outlined:{type:Boolean},dense:{type:Boolean},filled:{type:Boolean},borderless:{type:Boolean},label:{},hint:{},error:{type:Boolean},errorMessage:{},type:{},placeholder:{},disable:{type:Boolean},readonly:{type:Boolean},min:{},max:{},step:{},precision:{}},emits:["update:modelValue"],setup(n,{emit:a}){const t=n,l=a,m=e.computed(()=>{const r={};return t.labelPosition==="left"&&t.labelWidth&&(r.width=typeof t.labelWidth=="number"?`${t.labelWidth}px`:t.labelWidth),t.labelAlign&&(r.textAlign=t.labelAlign),r}),c=e.computed(()=>({"u-input-number-label-left":t.labelPosition==="left","u-input-number-label-top":t.labelPosition==="top"})),d={onUpdate(r){l("update:modelValue",r===void 0?0:r)}};return(r,o)=>{const i=k.ElInputNumber;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-input-number",c.value])},[n.fieldLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-input-number-label",style:e.normalizeStyle(m.value)},[e.createTextVNode(e.toDisplayString(n.fieldLabel)+" ",1),e.createElementVNode("span",{class:e.normalizeClass(["required-star",{"required-star--visible":n.required}])},"*",2)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",de,[e.createVNode(i,{"model-value":n.modelValue,placeholder:n.placeholder||"请输入数值",disabled:n.disable,min:n.min,max:n.max,step:n.step,precision:n.precision,controls:!0,"controls-position":"right",style:{width:"100%"},onChange:d.onUpdate},null,8,["model-value","placeholder","disabled","min","max","step","precision","onChange"])])],2)}}}),[["__scopeId","data-v-cb70bd5b"]]),z=Z.create({timeout:3e4,headers:{"Content-Type":"application/json"}});z.interceptors.request.use(n=>{const a=localStorage.getItem("token");return a&&(n.headers.Authorization=`Bearer ${a}`),n},n=>Promise.reject(n)),z.interceptors.response.use(n=>{const a=n.data;if(a&&typeof a=="object"&&!Array.isArray(a)){if(a.status===void 0&&a.code!==void 0){const t=a.code,l=t===0||t===200||Number(t)===0||Number(t)===200;a.status=l?200:Number(t)}if(a.status!==void 0&&a.status!==200){const t=a.message||"请求失败";return console.error("[HTTP Error]",t),Promise.reject(new Error(t))}}return n},n=>{var t,l;const a=((l=(t=n.response)==null?void 0:t.data)==null?void 0:l.message)||n.message||"请求失败";return console.error("[HTTP Error]",a),Promise.reject(n)});const V={get(n,a){return z.get(n,a).then(t=>t.data)},post(n,a,t){return z.post(n,a,t).then(l=>l.data)},instance:z},D={formCfgApi(n,a="forms"){return`/api/form?type=${a}&id=${n}`},dictApi(n){return`/api/dict/full-list?dict_type=${n}`},cascaderApi(n,a=!0){return`/api/dict/tree-list?dict_type=${n}&children=${a}`}},T={},M={};function F(n){const{children:a,...t}=n;return{label:n.label??n.dict_value??String(n.value??""),value:n.value??n.dict_code,...t}}function L(n){return Array.isArray(n)?n.map(a=>{if(!a||typeof a!="object")return a;const t=F(a),l=a.children;return Array.isArray(l)&&l.length>0&&(t.children=L(l)),t}):[]}function q(n){return Array.isArray(n)?n.filter(a=>a&&typeof a=="object").map(a=>F(a)):[]}function me(n){if(!Array.isArray(n))return[];const a=[],t=l=>{for(const m of l){if(!m||typeof m!="object")continue;const c=m.children;a.push(F(m)),Array.isArray(c)&&c.length>0&&t(c)}};return t(n),a}async function $(n){if(!n)return[];if(T[n])return T[n];if(n in M)return await M[n];const a=(async()=>{try{const t=await V.get(D.dictApi(n));if(t.status===200){const l=q(t.data);return T[n]=l,l}return[]}catch(t){return console.error(`[dict] 加载字典 ${n} 失败:`,t),[]}finally{delete M[n]}})();return M[n]=a,a}async function ee(n,a,t=""){if(a==null||a==="")return t;const l=T[n];if(l&&l.length>0)return Q(l,a);const m=await $(n);return m&&m.length>0?Q(m,a):t||String(a)}function Q(n,a){const t=n.find(l=>l.value===a||String(l.value)===String(a));return t?t.label:String(a)}function ue(n,a,t=""){if(a==null||a==="")return t;const l=T[n];return l&&l.length>0?Q(l,a):t||String(a)}async function pe(n){await Promise.all(n.map(a=>$(a)))}function fe(n){n?delete T[n]:Object.keys(T).forEach(a=>{delete T[a]})}function he(n,a){T[n]=a}const ge={class:"u-dict-field"},N=C(e.defineComponent({__name:"UDict",props:{fieldLabel:{},labelPosition:{default:"top"},labelWidth:{},labelAlign:{},required:{type:Boolean},modelValue:{},outlined:{type:Boolean},dense:{type:Boolean},filled:{type:Boolean},borderless:{type:Boolean},label:{},hint:{},error:{type:Boolean},errorMessage:{},type:{},placeholder:{},disable:{type:Boolean},readonly:{type:Boolean},dictType:{}},emits:["update:modelValue"],setup(n,{emit:a}){const t=n,l=a,m=e.reactive({excluded:["fieldLabel","labelPosition","labelWidth","labelAlign","required","modelValue","dictType"],options:[],loading:!1}),c=async()=>{if(t.dictType){m.loading=!0;try{const i=await V.get(D.dictApi(t.dictType));i.status===200?m.options=q(i.data):(console.error("[UDict] 请求失败:",i.message),m.options=[])}catch(i){console.error("[UDict] 加载字典失败:",i),m.options=[]}finally{m.loading=!1}}};e.watch(()=>t.dictType,()=>{c()},{immediate:!0});const d=e.computed(()=>{const i={};return t.labelPosition==="left"&&t.labelWidth&&(i.width=typeof t.labelWidth=="number"?`${t.labelWidth}px`:t.labelWidth),t.labelAlign&&(i.textAlign=t.labelAlign),i}),r=e.computed(()=>({"u-dict-label-left":t.labelPosition==="left","u-dict-label-top":t.labelPosition==="top"})),o={onUpdate(i){l("update:modelValue",i)}};return(i,s)=>{const p=k.ElOption,h=k.ElSelect;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-dict",r.value])},[n.fieldLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-dict-label",style:e.normalizeStyle(d.value)},[e.createTextVNode(e.toDisplayString(n.fieldLabel)+" ",1),e.createElementVNode("span",{class:e.normalizeClass(["required-star",{"required-star--visible":n.required}])},"*",2)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",ge,[e.createVNode(h,{"model-value":n.modelValue,placeholder:n.placeholder||"请选择",loading:m.loading,disabled:n.disable,style:{width:"100%"},onChange:o.onUpdate},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.options,u=>(e.openBlock(),e.createBlock(p,{key:u.value,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:1},8,["model-value","placeholder","loading","disabled","onChange"])])],2)}}}),[["__scopeId","data-v-8bfd4dcf"]]),ye={class:"u-toggle-field"},K=C(e.defineComponent({__name:"UToggle",props:{fieldLabel:{},labelPosition:{default:"left"},labelWidth:{},labelAlign:{},required:{type:Boolean},modelValue:{},dense:{type:Boolean,default:!0},color:{},trueValue:{default:!0},falseValue:{default:!1},label:{},hint:{},disable:{type:Boolean},readonly:{type:Boolean},activeText:{},inactiveText:{},activeColor:{},inactiveColor:{}},emits:["update:modelValue"],setup(n,{emit:a}){const t=n,l=a,m=e.reactive({excluded:["fieldLabel","labelPosition","labelWidth","labelAlign","required","modelValue","trueValue","falseValue","activeText","inactiveText","activeColor","inactiveColor"]}),c=()=>{const o={};return t.labelPosition==="left"&&t.labelWidth&&(o.width=typeof t.labelWidth=="number"?`${t.labelWidth}px`:t.labelWidth),t.labelAlign&&(o.textAlign=t.labelAlign),o},d=e.computed({get:()=>t.modelValue===t.trueValue,set:o=>{l("update:modelValue",o?t.trueValue:t.falseValue)}}),r=e.computed(()=>{const o={};for(const i in t)!m.excluded.includes(i)&&i!=="modelValue"&&(o[i]=t[i]);return o});return(o,i)=>{const s=k.ElSwitch;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-toggle",{"u-toggle-label-left":n.labelPosition==="left"}])},[n.fieldLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-toggle-label",style:e.normalizeStyle(c())},[e.createTextVNode(e.toDisplayString(n.fieldLabel)+" ",1),e.createElementVNode("span",{class:e.normalizeClass(["required-star",{"required-star--visible":n.required}])},"*",2)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",ye,[e.createVNode(s,e.mergeProps({modelValue:d.value,"onUpdate:modelValue":i[0]||(i[0]=p=>d.value=p)},r.value,{"active-text":n.activeText,"inactive-text":n.inactiveText,"active-color":n.activeColor,"inactive-color":n.inactiveColor}),null,16,["modelValue","active-text","inactive-text","active-color","inactive-color"])])],2)}}}),[["__scopeId","data-v-94c1fd38"]]),be={class:"u-cascader-levels"},G=C(e.defineComponent({__name:"UCascader",props:{fieldLabel:{},labelPosition:{default:"top"},labelWidth:{},labelAlign:{},required:{type:Boolean},modelValue:{},options:{},depth:{default:1}},emits:["update:modelValue"],setup(n,{emit:a}){const t=n,l=a,m=()=>{const o={};return t.labelPosition==="left"&&t.labelWidth&&(o.width=typeof t.labelWidth=="number"?`${t.labelWidth}px`:t.labelWidth),t.labelAlign&&(o.textAlign=t.labelAlign),o},c=e.ref([]),d=e.computed(()=>{const o=[];let i=t.options||[];for(let s=0;s<t.depth;s++)if(o.push(i),c.value[s]!==void 0){const p=i.find(h=>h.value===c.value[s]);p&&p.children?i=p.children:i=[]}else i=[];return o});e.watch(()=>t.modelValue,o=>{o!=null?c.value=Array.isArray(o)?o:[o]:c.value=[]},{immediate:!0});const r=(o,i)=>{c.value[o]=i;for(let p=o+1;p<t.depth;p++)c.value[p]=void 0;const s=c.value.filter(p=>p!==void 0);l("update:modelValue",s)};return(o,i)=>{const s=k.ElOption,p=k.ElSelect;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-cascader",{"u-cascader-label-left":n.labelPosition==="left"}])},[n.fieldLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-cascader-label",style:e.normalizeStyle(m())},[e.createTextVNode(e.toDisplayString(n.fieldLabel)+" ",1),e.createElementVNode("span",{class:e.normalizeClass(["required-star",{"required-star--visible":n.required}])},"*",2)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",be,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.depth,h=>(e.openBlock(),e.createElementBlock("div",{key:h-1,class:"u-cascader-level"},[e.createVNode(p,{"model-value":c.value[h-1],options:d.value[h-1]||[],disabled:h>1&&c.value[h-2]===void 0,placeholder:`请选择${h}级`,style:{width:"100%"},onChange:u=>r(h-1,u)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value[h-1]||[],u=>(e.openBlock(),e.createBlock(s,{key:u.value,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:2},1032,["model-value","options","disabled","placeholder","onChange"])]))),128))])],2)}}}),[["__scopeId","data-v-d66c339c"]]),we={class:"u-date-field"},U=C(e.defineComponent({__name:"UDate",props:{fieldLabel:{},labelPosition:{default:"top"},labelWidth:{},labelAlign:{},required:{type:Boolean},modelValue:{},mode:{default:"single"},locale:{default:"zh-CN"},mask:{default:"YYYY-MM-DD"},min:{},max:{}},emits:["update:modelValue"],setup(n,{emit:a}){const t=n,l=a,m=()=>{const o={};return t.labelPosition==="left"&&t.labelWidth&&(o.width=typeof t.labelWidth=="number"?`${t.labelWidth}px`:t.labelWidth),t.labelAlign&&(o.textAlign=t.labelAlign),o},c=e.ref("");e.watch(()=>t.modelValue,o=>{t.mode==="single"?c.value=o||"":t.mode==="multiple"?c.value=Array.isArray(o)?o:o?[o]:[]:t.mode==="range"&&(o&&typeof o=="object"&&o.from&&o.to?c.value=[o.from,o.to]:c.value=[])},{immediate:!0});const d=o=>{o&&(t.mode==="single"||t.mode==="multiple"?l("update:modelValue",o):t.mode==="range"&&o&&o.length===2&&l("update:modelValue",{from:o[0],to:o[1]}))},r=e.computed(()=>t.mode==="range"?"daterange":t.mode==="multiple"?"dates":"date");return(o,i)=>{const s=k.ElDatePicker;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-date",{"u-date-label-left":n.labelPosition==="left"}])},[n.fieldLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-date-label",style:e.normalizeStyle(m())},[e.createTextVNode(e.toDisplayString(n.fieldLabel)+" ",1),e.createElementVNode("span",{class:e.normalizeClass(["required-star",{"required-star--visible":n.required}])},"*",2)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",we,[e.createVNode(s,{modelValue:c.value,"onUpdate:modelValue":i[0]||(i[0]=p=>c.value=p),type:r.value,placeholder:n.locale==="en-US"?"Select date":"选择日期","range-separator":n.locale==="en-US"?"to":"至","start-placeholder":n.locale==="en-US"?"Start date":"开始日期","end-placeholder":n.locale==="en-US"?"End date":"结束日期",format:n.mask.replace("YYYY","YYYY").replace("MM","MM").replace("DD","DD"),"value-format":n.mask.replace("YYYY","YYYY").replace("MM","MM").replace("DD","DD"),onChange:d},null,8,["modelValue","type","placeholder","range-separator","start-placeholder","end-placeholder","format","value-format"])])],2)}}}),[["__scopeId","data-v-9cd05064"]]);function R(n,a="info"){x.ElMessage({message:n,type:a,duration:1e3,showClose:!1})}function _(n){x.ElMessage({message:n,type:"error",duration:2e3,showClose:!1})}function ke(n){R(n,"success")}function Ce(n){R(n,"error")}function Be(n){R(n,"warning")}function xe(n){R(n,"info")}const E={notify:R,success:ke,error:Ce,warning:Be,info:xe,alertError:_},Ve={key:0,class:"u-menu-brand"},_e=["src"],Se={class:"u-menu-brand-text"},Ee={key:1,class:"u-menu-logout"},te=C(e.defineComponent({__name:"UMenu",props:{menuId:{default:"menu"},config:{},mode:{},projectName:{},activePath:{},width:{}},emits:["menu-click","logout"],setup(n,{expose:a,emit:t}){const l=n,m=t,c=e.reactive({config:null,menus:[],activePath:"",iconMap:{},iconsLoaded:!1}),d=e.computed(()=>{var o,i,s,p,h,u,g,f;return{projectName:l.projectName??((o=c.config)==null?void 0:o.projectName)??"",logo:((i=c.config)==null?void 0:i.logo)||"",mode:l.mode??((s=c.config)==null?void 0:s.mode)??"sidebar",isHorizontal:(l.mode??((p=c.config)==null?void 0:p.mode)??"sidebar")==="horizontal",elMode:(l.mode??((h=c.config)==null?void 0:h.mode)??"sidebar")==="horizontal"?"horizontal":"vertical",width:l.width??((u=c.config)==null?void 0:u.width)??220,menus:c.menus,activeIndex:r.getIndexByPath(c.activePath),showLogout:((g=c.config)==null?void 0:g.showLogout)!==!1,logoutText:((f=c.config)==null?void 0:f.logoutText)||"退出登录",iconMap:c.iconMap}}),r={async init(){await r.ensureIcons(),l.config?(c.config=l.config,c.menus=r.normalizeMenus(l.config.menus)):await r.loadConfig(l.menuId),c.activePath=l.activePath||c.activePath},async loadConfig(o){if(o)try{const i=await V.get(D.formCfgApi(o,"menus"));if(i.status!==200){_(i.message||"获取菜单配置失败");return}const s=i.data||{};c.config=s,s.dictType?await r.loadDictMenus(s.dictType):c.menus=r.normalizeMenus(s.menus)}catch(i){_((i==null?void 0:i.message)||"获取菜单配置失败"),c.menus=[]}},async loadDictMenus(o){try{const i=await V.get(D.cascaderApi(o));if(i.status!==200){_(i.message||"获取菜单字典失败");return}c.menus=r.normalizeMenus(L(i.data))}catch(i){_((i==null?void 0:i.message)||"获取菜单字典失败"),c.menus=[]}},normalizeMenus(o){return Array.isArray(o)?o.map(i=>r.normalizeMenuNode(i)).filter(Boolean):[]},normalizeMenuNode(o){if(!o||typeof o!="object")return null;const i=r.parseInfo(o.info),s=o.label??o.dict_value??o.name;if(!s)return null;const p=i.path??o.path??o.dict_code??o.value??"",h=i.type??o.type??"route",u={...o,label:String(s),type:h,path:String(p??""),icon:i.icon??o.icon??""},g=i.id??o.id;g!=null&&g!==""&&(u.id=String(g));const f=i.open??o.open;(f==="new"||f==="self")&&(u.open=f),delete u.children;const b=o.children;return Array.isArray(b)&&b.length>0&&(u.children=b.map(B=>r.normalizeMenuNode(B)).filter(Boolean)),u},parseInfo(o){if(!o)return{};if(typeof o=="object")return o;if(typeof o=="string")try{const i=JSON.parse(o);return i&&typeof i=="object"?i:{}}catch{return{path:o}}return{}},itemIndex(o,i){return o.path||`menu-${i}`},childIndex(o,i,s,p){return s.path?s.path:`${r.itemIndex(o,i)}-${p}`},hasChildren(o){return Array.isArray(o.children)&&o.children.length>0},getIndexByPath(o){if(!o)return"";for(let i=0;i<c.menus.length;i++){const s=c.menus[i];if(s.path===o)return r.itemIndex(s,i);const p=s.children||[];for(let h=0;h<p.length;h++)if(p[h].path===o)return r.childIndex(s,i,p[h],h)}return""},findItemByIndex(o,i){for(let s=0;s<c.menus.length;s++){const p=c.menus[s],h=r.itemIndex(p,s);if(h===o)return{item:p,level:1,indexPath:i||[h],index:o};const u=p.children||[];for(let g=0;g<u.length;g++){const f=u[g],b=r.childIndex(p,s,f,g);if(b===o)return{item:f,level:2,indexPath:i||[h,b],index:o}}}return null},resolveTarget(o){const i=o.type||"route",s=o.path||"";return i==="url"?{type:i,path:s,url:s,open:o.open||"new"}:i==="form"||i==="table"||i==="menu"?{type:i,path:s,id:o.id||s}:{type:"route",path:s,route:s}},handleSelect(o,i){const s=r.findItemByIndex(o,i);if(!s||r.hasChildren(s.item))return;const p=r.resolveTarget(s.item);c.activePath=s.item.path||o;const h={...p,item:s.item,level:s.level,indexPath:s.indexPath,index:o};m("menu-click",h)},handleLogout(){m("logout")},setActivePath(o){c.activePath=o},async ensureIcons(){if(!c.iconsLoaded){c.iconsLoaded=!0;try{const o=await import("@element-plus/icons-vue"),i=o!=null&&o.default?{...o.default,...o}:{...o},s={};for(const[p,h]of Object.entries(i))s[p]=e.markRaw(h);c.iconMap=s}catch(o){console.warn("[UMenu] @element-plus/icons-vue 不可用,菜单图标将被忽略",o)}}},getIcon(o){return o&&c.iconMap[o]||null}};return e.watch(()=>l.menuId,o=>{l.config||r.loadConfig(o)}),e.watch(()=>l.activePath,o=>{c.activePath=o||""}),e.watch(()=>l.config,o=>{o&&(c.config=o,c.menus=r.normalizeMenus(o.menus))}),e.onMounted(()=>{r.init()}),a({loadConfig:r.loadConfig,setActivePath:r.setActivePath}),(o,i)=>{const s=k.ElIcon,p=k.ElMenuItem,h=k.ElSubMenu,u=k.ElMenu,g=k.ElButton;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-menu",[`u-menu--${d.value.mode}`,{"u-menu--no-brand":!d.value.projectName}]]),style:e.normalizeStyle(d.value.isHorizontal?{}:{width:d.value.width+"px"})},[d.value.projectName?(e.openBlock(),e.createElementBlock("div",Ve,[e.renderSlot(o.$slots,"brand",{projectName:d.value.projectName,mode:d.value.mode},()=>[d.value.logo?(e.openBlock(),e.createElementBlock("img",{key:0,class:"u-menu-logo",src:d.value.logo,alt:"logo"},null,8,_e)):e.createCommentVNode("",!0),e.createElementVNode("span",Se,e.toDisplayString(d.value.projectName),1)],!0)])):e.createCommentVNode("",!0),e.createVNode(u,{class:"u-menu-list",mode:d.value.elMode,"default-active":d.value.activeIndex,"unique-opened":!d.value.isHorizontal,onSelect:r.handleSelect},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value.menus,(f,b)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:r.itemIndex(f,b)},[r.hasChildren(f)?(e.openBlock(),e.createBlock(h,{key:0,index:r.itemIndex(f,b)},{title:e.withCtx(()=>[e.renderSlot(o.$slots,"menu-title",{item:f,level:1,index:b},()=>[r.getIcon(f.icon)?(e.openBlock(),e.createBlock(s,{key:0,class:"u-menu-icon"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.getIcon(f.icon))))]),_:2},1024)):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(f.label),1)],!0)]),default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.children,(B,A)=>(e.openBlock(),e.createBlock(p,{key:r.childIndex(f,b,B,A),index:r.childIndex(f,b,B,A)},{default:e.withCtx(()=>[e.renderSlot(o.$slots,"menu-item",{item:B,level:2,index:A,parent:f},()=>[r.getIcon(B.icon)?(e.openBlock(),e.createBlock(s,{key:0,class:"u-menu-icon"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.getIcon(B.icon))))]),_:2},1024)):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(B.label),1)],!0)]),_:2},1032,["index"]))),128))]),_:2},1032,["index"])):(e.openBlock(),e.createBlock(p,{key:1,index:r.itemIndex(f,b)},{default:e.withCtx(()=>[e.renderSlot(o.$slots,"menu-item",{item:f,level:1,index:b,parent:null},()=>[r.getIcon(f.icon)?(e.openBlock(),e.createBlock(s,{key:0,class:"u-menu-icon"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.getIcon(f.icon))))]),_:2},1024)):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(f.label),1)],!0)]),_:2},1032,["index"]))],64))),128))]),_:3},8,["mode","default-active","unique-opened","onSelect"]),d.value.showLogout?(e.openBlock(),e.createElementBlock("div",Ee,[e.renderSlot(o.$slots,"logout",{mode:d.value.mode},()=>[e.createVNode(g,{class:"u-menu-logout-btn",text:"",onClick:r.handleLogout},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.value.logoutText),1)]),_:1},8,["onClick"])],!0)])):e.createCommentVNode("",!0)],6)}}}),[["__scopeId","data-v-fe63251c"]]),De={key:0,class:"form-content"},Te={key:1,class:"form-layout"},Pe={key:0,class:"form-header"},$e={class:"title"},Ne={class:"form-body"},Re={key:1,class:"form-footer"},Ae=C(e.defineComponent({__name:"FormContainer",props:{visible:{type:Boolean},layout:{},title:{},loading:{type:Boolean,default:!1}},emits:["update:visible","close"],setup(n,{emit:a}){const t=n,l=a,{visible:m}=e.toRefs(t),c=e.computed(()=>t.layout.open==="normal"),d=e.computed(()=>t.layout.width||400),r={handleClose(){l("update:visible",!1),l("close")},updateVisible(o){l("update:visible",o)}};return(o,i)=>{const s=k.ElIcon,p=k.ElDialog;return c.value?e.unref(m)?(e.openBlock(),e.createElementBlock("div",Te,[n.title?(e.openBlock(),e.createElementBlock("div",Pe,[e.createElementVNode("div",$e,e.toDisplayString(n.title),1)])):e.createCommentVNode("",!0),e.createElementVNode("div",Ne,[n.loading?(e.openBlock(),e.createBlock(s,{key:0,class:"is-loading",size:40},{default:e.withCtx(()=>[e.createVNode(e.unref(v.Loading))]),_:1})):e.renderSlot(o.$slots,"default",{},void 0,!0,1)]),o.$slots.actions?(e.openBlock(),e.createElementBlock("div",Re,[e.renderSlot(o.$slots,"actions",{},void 0,!0)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(p,{key:0,"model-value":e.unref(m),title:n.title,width:d.value,"close-on-click-modal":!1,"onUpdate:modelValue":r.updateVisible,onClose:r.handleClose},{footer:e.withCtx(()=>[e.renderSlot(o.$slots,"actions",{},void 0,!0)]),default:e.withCtx(()=>[e.unref(m)?(e.openBlock(),e.createElementBlock("div",De,[n.loading?(e.openBlock(),e.createBlock(s,{key:0,class:"is-loading",size:40},{default:e.withCtx(()=>[e.createVNode(e.unref(v.Loading))]),_:1})):e.renderSlot(o.$slots,"default",{},void 0,!0,1)])):e.createCommentVNode("",!0)]),_:3},8,["model-value","title","width","onUpdate:modelValue","onClose"]))}}}),[["__scopeId","data-v-7e522999"]]),Ie=C(e.defineComponent({__name:"FormGrid",props:{fields:{},layout:{}},setup(n){const a=n,t=e.reactive({columns:e.computed(()=>a.layout.columns||1)}),l={getColSpan(m){const c=m.colSpan||1;return Math.min(c,t.columns)}};return(m,c)=>(e.openBlock(),e.createElementBlock("div",{class:"form-grid",style:e.normalizeStyle({"--grid-columns":t.columns})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.fields,d=>(e.openBlock(),e.createElementBlock("div",{key:d.field,class:"form-grid-item",style:e.normalizeStyle({gridColumn:`span ${l.getColSpan(d)}`})},[e.renderSlot(m.$slots,"default",{field:d},void 0,!0)],4))),128))],4))}}),[["__scopeId","data-v-90ed35a4"]]),ze={class:"form-field"},Ue=C(e.defineComponent({__name:"FormField",props:{field:{},modelValue:{},layout:{},disabled:{type:Boolean,default:!1},error:{}},emits:["update:modelValue"],setup(n,{emit:a}){const t=n,l=a,m=e.reactive({componentMap:e.markRaw({input:P,"input-number":Y,dict:N,switch:K,cascader:G,date:U}),cascaderOptions:[]}),c=()=>{t.field.cascaderKey&&V.get(D.cascaderApi(t.field.cascaderKey)).then(s=>{s.status===200&&(m.cascaderOptions=L(s.data))})};e.watch(()=>t.field.cascaderKey,c,{immediate:!0});const d=e.computed(()=>m.componentMap[t.field.type]||P),r=e.computed(()=>{if((t.layout.labelPosition||"top")==="left"){const p=t.layout.labelWidth||0,h=typeof p=="number"?p+4:p;return{marginLeft:typeof h=="number"?`${h}px`:h}}return{}}),o=e.computed(()=>{const{field:s,modelValue:p,layout:h,disabled:u}=t;let g=p;s.type==="switch"&&p==null&&(g=!1);const f={fieldLabel:s.label,modelValue:g,labelPosition:h.labelPosition||"top",disable:u,name:s.field,required:s.required};if(h.labelWidth&&(f.labelWidth=h.labelWidth),h.labelAlign&&(f.labelAlign=h.labelAlign),s.maxlength&&(f.maxlength=s.maxlength),s.placeholder&&(f.placeholder=s.placeholder),s.readonly&&(f.readonly=s.readonly),s.lineCount&&s.lineCount>=2?(f.type="textarea",f.rows=s.lineCount):s.inputType&&(f.type=s.inputType),s.type==="switch"&&(s.activeText&&(f.activeText=s.activeText),s.inactiveText&&(f.inactiveText=s.inactiveText),s.activeColor&&(f.activeColor=s.activeColor),s.inactiveColor&&(f.inactiveColor=s.inactiveColor),s.trueValue!==void 0&&(f.trueValue=s.trueValue),s.falseValue!==void 0&&(f.falseValue=s.falseValue)),s.dictType&&(f.dictType=s.dictType),s.cascaderKey&&(f.options=m.cascaderOptions,f.depth=s.cascaderDepth||2),s.type==="date"){s.mode&&(f.mode=s.mode),s.locale&&(f.locale=s.locale),s.format?f.mask=s.format:s.mask&&(f.mask=s.mask);const b=s.dateMin??s.min,B=s.dateMax??s.max;b!=null&&(f.min=b),B!=null&&(f.max=B)}return s.type==="input-number"&&(s.min!==void 0&&(f.min=s.min),s.max!==void 0&&(f.max=s.max),s.step&&(f.step=s.step),s.precision!==void 0&&(f.precision=s.precision)),f}),i={handleUpdate(s){l("update:modelValue",s)}};return(s,p)=>(e.openBlock(),e.createElementBlock("div",ze,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d.value),e.mergeProps(o.value,{"onUpdate:modelValue":i.handleUpdate}),null,16,["onUpdate:modelValue"])),e.createElementVNode("div",{class:e.normalizeClass(["field-error",{"field-error--visible":n.error}]),style:e.normalizeStyle(r.value)},e.toDisplayString(n.error||""),7)]))}}),[["__scopeId","data-v-10299c8d"]]);class Me{constructor(){w(this,"formConfig",null);w(this,"formData",{});w(this,"loading",!1);w(this,"submitting",!1);w(this,"visible",!1);w(this,"isEditMode",!1);w(this,"errors",[]);w(this,"currentQuery",{})}}let Fe=class{constructor(){w(this,"data",e.reactive(new Me))}parseQuery(a){if(!a)return{};const t={},l=a.split("&");for(const m of l){const[c,d]=m.split("=");c&&(t[c]=d||"")}return t}async fetchFormConfig(a){const t=await V.get(D.formCfgApi(a,"forms"));if(t.status!==200)throw new Error(t.message||"获取表单配置失败");return t.data}async fetchFormData(a,t){const l=t?`${a}?${t}`:a,m=await V.get(l);if(m.status!==200)throw new Error(m.message||"获取表单数据失败");return m.data}async submitForm(a,t){return await V.post(a,t)}buildInitialData(a){const t={};for(const l of a)l.default!==void 0?t[l.field]=l.default:t[l.field]=null;return t}checkIsEditMode(a){return!!a&&a.trim().length>0}validate(){var t;this.data.errors=[];const a=((t=this.data.formConfig)==null?void 0:t.fields)||[];for(const l of a){const m=this.data.formData[l.field];if(l.required&&(m==null||m==="")){this.data.errors.push({field:l.field,message:`${l.label}为必填项`});continue}if(l.rules&&l.rules.length>0&&m){for(const c of l.rules)if(c.pattern&&!new RegExp(c.pattern).test(m)){this.data.errors.push({field:l.field,message:c.message||`${l.label}格式不正确`});break}}}return this.data.errors.length===0}getFieldError(a){const t=this.data.errors.find(l=>l.field===a);return t?t.message:null}clearErrors(){this.data&&(this.data.errors=[])}async openForm(a,t){this.data.loading=!0,this.data.visible=!0,this.clearErrors(),this.data.currentQuery=this.parseQuery(t||"");try{const l=await this.fetchFormConfig(a);if(this.data.formConfig=l,this.data.isEditMode=this.checkIsEditMode(t||""),this.data.formData=this.buildInitialData(l.fields),this.data.isEditMode&&l.api.get&&t){const m=await this.fetchFormData(l.api.get,t),c=this.nestedToFlat(m);this.data.formData={...this.data.formData,...c}}}catch(l){throw console.error("[FormRender] 打开表单失败:",l),this.data.visible=!1,l}finally{this.data.loading=!1}}async doSubmit(){if(!this.data.formConfig)return;if(!this.validate())throw new Error("请完善表单信息");const{api:a}=this.data.formConfig;let t=this.data.isEditMode?a.edit:a.add;if(!t)throw new Error("提交地址未配置");let l={...this.data.formData};l=this.flattenToNested(l),this.data.isEditMode&&this.data.currentQuery.id&&(l.id=Number(this.data.currentQuery.id)),this.data.submitting=!0;try{const m=await this.submitForm(t,l);if(m.status===200)return m.data;throw new Error(m.message||"提交失败")}finally{this.data.submitting=!1}}closeForm(){this&&(this.data.visible=!1,this.data.formConfig=null,this.data.formData={},this.data.isEditMode=!1,this.data.currentQuery={},this.clearErrors())}flattenToNested(a){const t={};for(const l in a){const m=a[l];if(l.includes(".")){const c=l.split(".");let d=t;for(let r=0;r<c.length-1;r++){const o=c[r];d[o]||(d[o]={}),d=d[o]}d[c[c.length-1]]=m}else t[l]=m}return t}nestedToFlat(a,t=""){const l={};for(const m in a){const c=a[m],d=t?`${t}.${m}`:m;c&&typeof c=="object"&&!Array.isArray(c)?Object.keys(c).length===2&&"from"in c&&"to"in c?l[d]=c:Object.assign(l,this.nestedToFlat(c,d)):l[d]=c}return l}};const H=C(e.defineComponent({__name:"FormRender",setup(n,{expose:a}){const t=new Fe,l=e.ref(null),m=e.reactive({currentQuery:{},submitResolve:null}),c=e.computed(()=>{var u;const h={};if(!t.data.isEditMode||!m.currentQuery)return h;for(const g of((u=t.data.formConfig)==null?void 0:u.fields)||[])m.currentQuery[g.field]!==void 0&&(h[g.field]=!0);return h}),d=e.computed(()=>{var h;return((h=t.data.formConfig)==null?void 0:h.layout)||{open:"dialog",columns:1,labelPosition:"top",buttonAlign:"right"}}),r=e.computed(()=>{var h;return((h=t.data.formConfig)==null?void 0:h.fields)||[]}),o=e.computed(()=>{var h,u;return((u=(h=t.data.formConfig)==null?void 0:h.meta)==null?void 0:u.title)||"表单"}),i=e.computed(()=>d.value.buttonAlign||"right"),s=e.computed(()=>d.value.open==="normal"),p={async showForm(h,u){m.currentQuery=t.parseQuery(u||"");try{await t.openForm(h,u)}catch(g){return _((g==null?void 0:g.message)||"打开表单失败"),null}return new Promise(g=>{m.submitResolve=g})},async handleSubmit(){var h,u;try{const g=await t.doSubmit(),f=((u=(h=t.data.formConfig)==null?void 0:h.meta)==null?void 0:u.title)+"保存成功";return E.success(f),m.submitResolve&&(m.submitResolve(g),m.submitResolve=null),s.value||t.closeForm(),g}catch(g){return m.submitResolve&&(m.submitResolve(null),m.submitResolve=null),g!=null&&g.message&&g.message!=="请完善表单信息"&&_(g.message),null}},resolvePending(){m.submitResolve&&(m.submitResolve(null),m.submitResolve=null)},handleCancel(){s.value||(p.resolvePending(),t.closeForm())},getFieldError(h){return t.getFieldError(h)},handleClose(){p.resolvePending(),t.closeForm()}};return a({showForm:p.showForm}),(h,u)=>{const g=k.ElForm,f=k.ElButton;return e.openBlock(),e.createBlock(Ae,{visible:e.unref(t).data.visible,"onUpdate:visible":u[0]||(u[0]=b=>e.unref(t).data.visible=b),layout:d.value,title:o.value,loading:e.unref(t).data.loading,onClose:p.handleClose},{actions:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["form-actions",i.value==="right"?"justify-end":"justify-start"])},[e.createVNode(f,{onClick:p.handleCancel},{default:e.withCtx(()=>[...u[1]||(u[1]=[e.createTextVNode("取消",-1)])]),_:1},8,["onClick"]),e.createVNode(f,{type:"primary",loading:e.unref(t).data.submitting,onClick:p.handleSubmit},{default:e.withCtx(()=>[...u[2]||(u[2]=[e.createTextVNode("提交",-1)])]),_:1},8,["loading","onClick"])],2)]),default:e.withCtx(()=>[e.createVNode(g,{ref_key:"formRef",ref:l,class:"form-render","label-position":"top"},{default:e.withCtx(()=>[e.createVNode(Ie,{fields:r.value,layout:d.value},{default:e.withCtx(({field:b})=>[e.createVNode(Ue,{modelValue:e.unref(t).data.formData[b.field],"onUpdate:modelValue":B=>e.unref(t).data.formData[b.field]=B,field:b,layout:d.value,disabled:c.value[b.field],error:p.getFieldError(b.field)},null,8,["modelValue","onUpdate:modelValue","field","layout","disabled","error"])]),_:1},8,["fields","layout"])]),_:1},512)]),_:1},8,["visible","layout","title","loading","onClose"])}}}),[["__scopeId","data-v-c8356aa3"]]);class Le{constructor(a){this.config=a}async fetchList(a,t){const l={page:t.page,pageSize:t.pageSize,...a},m={};for(const o in l){const i=l[o];i!==""&&i!==null&&i!==void 0&&(m[o]=i)}const c=new URLSearchParams;for(const o in m)c.append(o,String(m[o]));const d=`${this.config.api.list}${c.toString()?"?"+c.toString():""}`,r=await V.get(d);if(r.status===200){const o=r.data;return Array.isArray(o)?{rows:o,total:o.length}:o||{rows:[],total:0}}throw new Error(r.message||"获取列表数据失败")}async deleteRow(a){if(!this.config.api.delete)throw new Error("未配置删除API");const t=this.config.key||"id",l=a[t],m=`${this.config.api.delete}?${encodeURIComponent(t)}=${encodeURIComponent(String(l??""))}`,c=await V.post(m);if(c.status!==200)throw new Error(c.message||"删除失败")}async batchDelete(a){if(!this.config.api.delete)throw new Error("未配置删除API");const t=await V.post(this.config.api.delete,a);if(t.status!==200)throw new Error(t.message||"批量删除失败")}async exportData(a){if(!this.config.api.export)throw new Error("未配置导出API");const l=(await V.post(this.config.api.export,a,{responseType:"blob"})).data,m=window.URL.createObjectURL(l),c=document.createElement("a");c.href=m,c.download=`export_${Date.now()}.xlsx`,c.click(),window.URL.revokeObjectURL(m)}async downloadTemplate(){if(!this.config.api.import)throw new Error("未配置导入API");const t=(await V.get(`${this.config.api.import}/template`,{responseType:"blob"})).data,l=window.URL.createObjectURL(t),m=document.createElement("a");m.href=l,m.download=`template_${Date.now()}.xlsx`,m.click(),window.URL.revokeObjectURL(l)}async importData(a){if(!this.config.api.import)throw new Error("未配置导入API");const t=new FormData;t.append("file",a);const l=await V.post(this.config.api.import,t,{headers:{"Content-Type":"multipart/form-data"}});if(l.status!==200)throw new Error(l.message||"导入失败");return l.data}}class qe{constructor(){w(this,"tableConfig",null);w(this,"rows",[]);w(this,"total",0);w(this,"loading",!1);w(this,"searchParams",{});w(this,"pagination",{page:1,pageSize:20});w(this,"currentRow",null);w(this,"detailVisible",!1);w(this,"detailData",null);w(this,"detailLoading",!1);w(this,"previewVisible",!1);w(this,"previewRow",null)}}let We=class{constructor(){w(this,"data",e.reactive(new qe));w(this,"dataService",null)}async loadConfig(a){var m;const t=D.formCfgApi(a,"tables");console.log("load config url =",t);const l=await V.get(t);if(console.log("---"),l.status!==200)throw new Error(l.message||"获取表格配置失败");this.data.tableConfig=l.data,this.dataService=new Le(l.data),this.data.currentRow=null,this.data.detailVisible=!1,this.data.detailData=null,this.data.previewVisible=!1,this.data.previewRow=null,typeof console<"u"&&console.log("[TableRender] loadConfig:",{tableId:a,hasDetail:this.hasDetail(),detail:(m=this.data.tableConfig)==null?void 0:m.detail}),this.initSearchParams()}initSearchParams(){var l;const a={},t=((l=this.data.tableConfig)==null?void 0:l.search)||[];for(const m of t)a[m.field]="";this.data.searchParams=a}async loadData(){if(!this.dataService)throw new Error("表格配置未加载");this.data.loading=!0;try{const a=await this.dataService.fetchList(this.data.searchParams,this.data.pagination);this.data.rows=a.rows||[],this.data.total=a.total||0,this.syncRowRefs()}finally{this.data.loading=!1}}syncRowRefs(){const{currentRow:a,detailData:t}=this.data;if(!a&&!t)return;const l=this.getKeyField(),m=c=>c&&this.data.rows.find(d=>d[l]===c[l])||null;this.data.currentRow=m(a),this.data.detailData&&(this.data.detailData=m(this.data.detailData),this.data.detailData||(this.data.detailVisible=!1))}async search(){this.data.pagination.page=1,await this.loadData()}async reset(){this.initSearchParams(),this.data.pagination.page=1,await this.loadData()}updateSearchParam(a,t){this.data.searchParams[a]=t}async deleteRow(a){if(!this.dataService)throw new Error("表格配置未加载");await this.dataService.deleteRow(a),await this.loadData(),this.isSameRow(a,this.data.currentRow)&&(this.data.currentRow=null),this.isSameRow(a,this.data.detailData)&&(this.data.detailData=null,this.data.detailVisible=!1),this.isSameRow(a,this.data.previewRow)&&(this.data.previewRow=null,this.data.previewVisible=!1)}isSameRow(a,t){return!a||!t?!1:a[this.getKeyField()]===t[this.getKeyField()]}async changePage(a){this.data.pagination.page=a,await this.loadData()}async changePageSize(a){this.data.pagination.pageSize=a,this.data.pagination.page=1,await this.loadData()}setCurrentRow(a){this.data.currentRow=a,this.hasDetail()&&this.openDetail(a)}getCurrentRow(){return this.data.currentRow}getCurrentKey(){var a;return(a=this.data.currentRow)==null?void 0:a[this.getKeyField()]}async exportData(){if(!this.dataService)throw new Error("表格配置未加载");await this.dataService.exportData(this.data.searchParams)}async downloadTemplate(){if(!this.dataService)throw new Error("表格配置未加载");await this.dataService.downloadTemplate()}async importData(a){if(!this.dataService)throw new Error("表格配置未加载");const t=await this.dataService.importData(a);return await this.loadData(),t}getKeyField(){var a;return((a=this.data.tableConfig)==null?void 0:a.key)||"id"}getFormId(){var a;return(a=this.data.tableConfig)==null?void 0:a.form}getDetailFormId(){var a,t;return(t=(a=this.data.tableConfig)==null?void 0:a.detail)==null?void 0:t.formId}hasDetail(){var t;const a=(t=this.data.tableConfig)==null?void 0:t.detail;return!a||typeof a!="object"||a.enable===!1?!1:a.enable===!0||a.enable!==void 0&&a.enable!==null&&a.enable!==""?!0:!!(a.formId||a.position)}isDetailInline(){var a,t;return((t=(a=this.data.tableConfig)==null?void 0:a.detail)==null?void 0:t.enable)===!0}getDetailMode(){return this.isDetailInline()?"inline":"drawer"}getDetailPosition(){var a,t;return((t=(a=this.data.tableConfig)==null?void 0:a.detail)==null?void 0:t.position)||"right"}getDetailWidth(){var t,l;const a=(l=(t=this.data.tableConfig)==null?void 0:t.detail)==null?void 0:l.width;return typeof a=="number"&&a>0?`${a}px`:typeof a=="string"&&a?a:"400px"}getDetailDirection(){return{left:"ltr",right:"rtl",top:"ttb"}[this.getDetailPosition()]||"rtl"}isDetailOpen(){return this.isDetailInline()||this.data.detailVisible}openDetail(a){this.data.detailData=a,this.data.detailVisible=!0}closeDetail(){this.data.detailVisible=!1,this.isDetailInline()&&(this.data.detailData=null)}openPreview(a){this.data.previewRow=a,this.data.previewVisible=!0}closePreview(){this.data.previewVisible=!1,this.data.previewRow=null}getSearchFields(){var a;return((a=this.data.tableConfig)==null?void 0:a.search)||[]}getColumns(){var a;return((a=this.data.tableConfig)==null?void 0:a.columns)||[]}hasSearch(){return this.getSearchFields().length>0}getToolbar(){var t;const a=(t=this.data.tableConfig)==null?void 0:t.toolbar;return Array.isArray(a)?a:[]}hasToolbar(){return this.getToolbar().length>0}getActions(){var t;const a=(t=this.data.tableConfig)==null?void 0:t.actions;return Array.isArray(a)?a:[]}hasActions(){return this.getActions().length>0}getButtonFormId(a){var t;return(a==null?void 0:a.form)||((t=this.data.tableConfig)==null?void 0:t.form)}getPaginationType(){var a;return((a=this.data.tableConfig)==null?void 0:a.pagination)||"page"}};const Oe={class:"table-search"},je={class:"search-fields"},Ye={class:"search-actions"},Qe=C(e.defineComponent({__name:"TableSearch",props:{fields:{},modelValue:{}},emits:["update:modelValue","search","reset"],setup(n,{emit:a}){const t=n,l=a,m={input:P,dict:N,dept:N,role:N,date:U,daterange:U},c={getComponent(d){return m[d]||P},updateValue(d,r){const o={...t.modelValue,[d]:r};l("update:modelValue",o)},handleSearch(){const d={};for(const r in t.modelValue){const o=t.modelValue[r];d[r]=typeof o=="string"?o.trim():o}l("update:modelValue",d),l("search")},handleReset(){l("reset")}};return(d,r)=>{const o=k.ElButton;return e.openBlock(),e.createElementBlock("div",Oe,[e.createElementVNode("div",je,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.fields,i=>(e.openBlock(),e.createElementBlock("div",{key:i.field,class:"search-field"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(c.getComponent(i.type)),{"model-value":t.modelValue[i.field],"field-label":i.label,"dict-type":i.dictType,mode:i.type==="daterange"?"range":void 0,"label-position":"left","onUpdate:modelValue":s=>c.updateValue(i.field,s)},null,8,["model-value","field-label","dict-type","mode","onUpdate:modelValue"]))]))),128)),e.renderSlot(d.$slots,"search-extra",{params:t.modelValue,update:c.updateValue},void 0,!0)]),e.createElementVNode("div",Ye,[e.createVNode(o,{type:"primary",onClick:c.handleSearch},{default:e.withCtx(()=>[...r[0]||(r[0]=[e.createTextVNode("查询",-1)])]),_:1},8,["onClick"]),e.createVNode(o,{onClick:c.handleReset},{default:e.withCtx(()=>[...r[1]||(r[1]=[e.createTextVNode("重置",-1)])]),_:1},8,["onClick"]),e.renderSlot(d.$slots,"search-actions",{params:t.modelValue,search:c.handleSearch,reset:c.handleReset},void 0,!0)])])}}}),[["__scopeId","data-v-09e61a77"]]),Ke={class:"table-toolbar"},Ge={class:"toolbar-items"},He={key:1},Je=C(e.defineComponent({__name:"TableToolbar",props:{items:{},currentRow:{}},emits:["action"],setup(n,{emit:a}){const t=n,l=a,m=e.reactive({iconMap:{}}),c=e.computed(()=>({hasCurrentRow:!!t.currentRow})),d={needRow(r){return r==="edit"||r==="delete"||r==="preview"},getText(r){return r.text?r.text:{add:"新增",edit:"编辑",delete:"删除",preview:"预览",back:"返回"}[r.action]||""},getButtonType(r){return r.style?r.style==="default"?"":r.style:{add:"primary",edit:"primary",delete:"danger",preview:"primary",back:"primary"}[r.action]||""},isDisabled(r){return r.disabled?!0:d.needRow(r.action)&&!c.value.hasCurrentRow},getIcon(r){return r.icon?m.iconMap[r.icon]:null},handleClick(r){l("action",{action:r.action,item:r,row:t.currentRow})},async ensureIcons(){const r=[...new Set(t.items.map(s=>s.icon).filter(Boolean))];if(r.length===0)return;const o=await import("@element-plus/icons-vue"),i={...m.iconMap};for(const s of r)o[s]&&(i[s]=e.markRaw(o[s]));m.iconMap=e.markRaw(i)}};return e.onMounted(()=>{d.ensureIcons()}),e.watch(()=>t.items,()=>{d.ensureIcons()}),(r,o)=>{const i=k.ElIcon,s=k.ElButton;return e.openBlock(),e.createElementBlock("div",Ke,[e.renderSlot(r.$slots,"toolbar-left",{currentRow:t.currentRow},void 0,!0),e.createElementVNode("div",Ge,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,(p,h)=>(e.openBlock(),e.createBlock(s,{key:h,type:d.getButtonType(p),disabled:d.isDisabled(p),onClick:u=>d.handleClick(p)},{default:e.withCtx(()=>[d.getIcon(p)?(e.openBlock(),e.createBlock(i,{key:0},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d.getIcon(p))))]),_:2},1024)):e.createCommentVNode("",!0),d.getText(p)?(e.openBlock(),e.createElementBlock("span",He,e.toDisplayString(d.getText(p)),1)):e.createCommentVNode("",!0)]),_:2},1032,["type","disabled","onClick"]))),128))]),e.renderSlot(r.$slots,"toolbar-extra",{currentRow:t.currentRow},void 0,!0)])}}}),[["__scopeId","data-v-8f722515"]]),Xe=C(e.defineComponent({__name:"UInputShow",props:{modelValue:{},multiline:{type:Boolean,default:!1},maxLines:{default:0}},setup(n){const a=n,t=e.computed(()=>a.modelValue===null||a.modelValue===void 0?"":String(a.modelValue)),l=e.computed(()=>a.multiline||t.value.includes(`
2
- `)),m=e.computed(()=>a.maxLines>0&&l.value?{display:"-webkit-box",WebkitLineClamp:a.maxLines,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis"}:{});return(c,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-input-show",{"u-input-multiline":l.value}]),style:e.normalizeStyle(m.value)},e.toDisplayString(t.value),7))}}),[["__scopeId","data-v-c78b151e"]]),Ze=C(e.defineComponent({__name:"UDictShow",props:{modelValue:{},dictType:{},defaultText:{default:""}},setup(n){const a=n,t=e.ref(""),l=e.ref(!1),m=async()=>{if(a.modelValue===null||a.modelValue===void 0||a.modelValue===""){t.value=a.defaultText;return}if(!a.dictType){t.value=String(a.modelValue);return}l.value=!0;try{const c=await ee(a.dictType,a.modelValue,a.defaultText);t.value=c}catch(c){console.error("[UDictShow] 翻译失败:",c),t.value=String(a.modelValue)}finally{l.value=!1}};return e.watch(()=>a.modelValue,m,{immediate:!0}),e.watch(()=>a.dictType,()=>{a.dictType&&$(a.dictType).then(()=>m())}),e.onMounted(()=>{a.dictType?$(a.dictType).then(()=>m()):m()}),(c,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-dict-show",{"u-dict-loading":l.value}])},e.toDisplayString(t.value),3))}}),[["__scopeId","data-v-908045c4"]]),ve=C(e.defineComponent({__name:"UToggleShow",props:{modelValue:{},trueText:{default:"开启"},falseText:{default:"关闭"},useYesNo:{type:Boolean,default:!1}},setup(n){const a=n,t=e.computed(()=>a.useYesNo?"是":a.trueText),l=e.computed(()=>a.useYesNo?"否":a.falseText),m=e.computed(()=>a.modelValue===!0||a.modelValue==="true"?t.value:a.modelValue===!1||a.modelValue==="false"?l.value:String(a.modelValue??"")),c=e.computed(()=>a.modelValue===!0||a.modelValue==="true"?"toggle-true":a.modelValue===!1||a.modelValue==="false"?"toggle-false":"toggle-default");return(d,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-toggle-show",c.value])},e.toDisplayString(m.value),3))}}),[["__scopeId","data-v-bac05efc"]]),et=C(e.defineComponent({__name:"UCascaderShow",props:{modelValue:{},cascaderKey:{},separator:{default:" / "},showRawValue:{type:Boolean,default:!0}},setup(n){const a=n,t=e.ref(""),l=e.ref(!1),m=async()=>{if(!a.modelValue||!Array.isArray(a.modelValue)){t.value="";return}const c=a.modelValue;if(a.cascaderKey){l.value=!0;try{const d=await $(a.cascaderKey),o=c.map(i=>{const s=d.find(p=>p.value===i||String(p.value)===String(i));return s?s.label:a.showRawValue?String(i):""}).filter(i=>i!=="");t.value=o.join(a.separator)}catch(d){console.error("[UCascaderShow] 翻译失败:",d),t.value=a.showRawValue?c.join(a.separator):""}finally{l.value=!1}}else t.value=c.join(a.separator)};return e.watch(()=>a.modelValue,m,{immediate:!0}),e.onMounted(()=>{m()}),(c,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-cascader-show",{"u-cascader-loading":l.value}])},e.toDisplayString(t.value),3))}}),[["__scopeId","data-v-5d84df67"]]),tt=C(e.defineComponent({__name:"UDateShow",props:{modelValue:{},mode:{default:"single"},locale:{default:"zh-CN"},format:{},separator:{default:", "},rangeSeparator:{default:" ~ "}},setup(n){const a=n,t=e.computed(()=>a.locale==="en-US"?a.mode==="range"?" - ":", ":a.mode==="range"?a.rangeSeparator:a.separator),l=e.computed(()=>{const d=a.modelValue;return a.mode==="single"?d?m(d,a.format):"":a.mode==="multiple"?d?Array.isArray(d)?d.map(r=>m(r,a.format)).join(t.value):String(d):"":a.mode==="range"?d?typeof d=="object"&&d.from&&d.to?`${m(d.from,a.format)}${t.value}${m(d.to,a.format)}`:Array.isArray(d)&&d.length>=2?`${m(d[0],a.format)}${t.value}${m(d[1],a.format)}`:String(d):"":String(d??"")});function m(d,r){return d||""}const c=e.computed(()=>!l.value);return(d,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-date-show",{"u-date-empty":c.value}])},e.toDisplayString(l.value||(n.locale==="en-US"?"Empty":"暂无")),3))}}),[["__scopeId","data-v-930657df"]]),W=C(e.defineComponent({__name:"UFieldView",props:{type:{default:"text"},modelValue:{},dictType:{},mode:{},locale:{default:"zh-CN"},format:{},text:{},trueText:{default:"开启"},falseText:{default:"关闭"},useYesNo:{type:Boolean,default:!1},cascaderKey:{},multiline:{type:Boolean},defaultText:{default:""}},setup(n){const a=n,t=e.computed(()=>{if(!a.text)return null;const d=a.text.split("/");return d.length>=2?{trueText:d[0].trim(),falseText:d[1].trim()}:null}),l=e.computed(()=>{var d;return a.trueText||((d=t.value)==null?void 0:d.trueText)||"开启"}),m=e.computed(()=>{var d;return a.falseText||((d=t.value)==null?void 0:d.falseText)||"关闭"}),c=e.computed(()=>{switch(a.type){case"dict":return"UDictShow";case"switch":return"UToggleShow";case"cascader":return"UCascaderShow";case"date":return"UDateShow";case"input":case"text":default:return"UInputShow"}});return(d,r)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(c.value==="UDictShow"?Ze:c.value==="UToggleShow"?ve:c.value==="UCascaderShow"?et:c.value==="UDateShow"?tt:Xe),{"model-value":n.modelValue,"dict-type":n.type==="dict"?n.dictType:void 0,"cascader-key":n.type==="cascader"?n.cascaderKey:void 0,mode:n.type==="date"?n.mode:void 0,locale:n.type==="date"?n.locale:void 0,format:n.type==="date"?n.format:void 0,"true-text":n.type==="switch"?l.value:void 0,"false-text":n.type==="switch"?m.value:void 0,"use-yes-no":n.type==="switch"?n.useYesNo:void 0,multiline:n.type==="input"||n.type==="text"?n.multiline:void 0,"default-text":n.type==="dict"?n.defaultText:void 0},null,8,["model-value","dict-type","cascader-key","mode","locale","format","true-text","false-text","use-yes-no","multiline","default-text"]))}}),[["__scopeId","data-v-fedb54d7"]]),at={class:"table-grid"},ot=C(e.defineComponent({inheritAttrs:!1,__name:"TableGrid",props:{rows:{},columns:{},loading:{type:Boolean},actions:{},keyField:{},selection:{type:[String,Boolean]},dictData:{},activeKey:{}},emits:["rowAction","rowClick","selectionChange"],setup(n,{emit:a}){const t=n,l=e.useSlots(),m=a,c=e.computed(()=>({actionList:t.actions||[],actionColumnWidth:r.getActionColumnWidth(),hasUserEmpty:!!l.empty,forwardSlots:Object.keys(l).filter(o=>o!=="default")})),d=e.computed(()=>{const o=t.columns.map(i=>{const s={prop:i.field,label:i.label};return typeof i.width=="number"&&(s.width=i.width),s});return c.value.actionList.length>0&&o.push({prop:"actions",label:"操作",width:c.value.actionColumnWidth,fixed:"right"}),o}),r={actionText(o){return o.text?o.text:{add:"新增",edit:"编辑",delete:"删除",preview:"预览",back:"返回"}[o.action]||""},actionType(o){return o.style?o.style==="default"?"":o.style:{add:"primary",edit:"primary",delete:"danger",preview:"primary",back:"primary"}[o.action]||"primary"},getActionColumnWidth(){const i=(t.actions||[]).reduce((s,p)=>s+Math.max(52,r.actionText(p).length*16+12),0);return Math.max(80,Math.ceil(i)+16)},maskPhone(o){return!o||o.length<7?o:o.replace(/(\d{3})\d{4}(\d{4})/,"$1****$2")},maskIdCard(o){return!o||o.length<8?o:o.replace(/(\d{3})\d{11}(\d{4})/,"$1***********$2")},formatMoney(o){const i=Number(o);return isNaN(i)?String(o):i.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})},formatByType(o,i){if(!o)return"";switch(i){case"phone":return r.maskPhone(o);case"idcard":return r.maskIdCard(o);case"money":return r.formatMoney(o);case"percent":return String(o*100)+"%";default:return i&&i.includes("{}")?i.replace("{}",String(o)):String(o)}},getNestedValue(o,i){if(!i.includes("."))return o[i];const s=i.split(".");let p=o;for(const h of s)if(p&&typeof p=="object"&&h in p)p=p[h];else return;return p},useFieldView(o){return o.type?["dict","switch","cascader","date","input","text"].includes(o.type):!1},rowClassName({row:o}){if(!o||t.activeKey===void 0||t.activeKey===null)return"";const i=t.keyField||"id";return o[i]===t.activeKey?"table-grid-active-row":""},onSelectionChange(o){m("selectionChange",o)},onRowClick(o){m("rowClick",o)},onRowAction(o,i){m("rowAction",{action:o.action,item:o,row:i})}};return(o,i)=>{const s=k.ElTableColumn,p=k.ElButton,h=k.ElTable;return e.openBlock(),e.createElementBlock("div",at,[e.createVNode(h,e.mergeProps({stripe:!0,border:!0,...o.$attrs},{data:t.rows.length?t.rows:[{}],loading:t.loading,"row-key":t.keyField||"id","row-class-name":r.rowClassName,onSelectionChange:r.onSelectionChange,onRowClick:i[0]||(i[0]=u=>r.onRowClick(u))}),e.createSlots({default:e.withCtx(()=>[t.selection?(e.openBlock(),e.createBlock(s,{key:0,type:"selection",width:"55"})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,u=>(e.openBlock(),e.createBlock(s,{key:u.prop,prop:u.prop,label:u.label,width:u.width,fixed:u.fixed},{default:e.withCtx(({row:g})=>[u.prop==="actions"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[Object.keys(g).length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(c.value.actionList,(f,b)=>(e.openBlock(),e.createBlock(p,{key:b,link:"",type:r.actionType(f),disabled:f.disabled===!0,size:"small",onClick:e.withModifiers(B=>r.onRowAction(f,g),["stop"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.actionText(f)),1)]),_:2},1032,["type","disabled","onClick"]))),128)):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[Object.keys(g).length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.columns,f=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:f.field},[f.field===u.prop&&r.useFieldView(f)?(e.openBlock(),e.createBlock(W,{key:0,type:f.type,"model-value":r.getNestedValue(g,f.field),"dict-type":f.dictType,mode:f.mode,locale:f.locale,format:f.format,text:f.text,"true-text":f.trueText,"false-text":f.falseText,"use-yes-no":f.useYesNo,"cascader-key":f.cascaderKey,multiline:f.multiline,"default-text":f.defaultText},null,8,["type","model-value","dict-type","mode","locale","format","text","true-text","false-text","use-yes-no","cascader-key","multiline","default-text"])):f.field===u.prop?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass({"table-grid-format":f.format})},e.toDisplayString(r.formatByType(r.getNestedValue(g,f.field),f.format||"")),3)):e.createCommentVNode("",!0)],64))),128)):e.createCommentVNode("",!0)],64))]),_:2},1032,["prop","label","width","fixed"]))),128)),e.renderSlot(o.$slots,"default",{},void 0,!0)]),_:2},[e.renderList(c.value.forwardSlots,u=>({name:u,fn:e.withCtx(g=>[e.renderSlot(o.$slots,u,e.normalizeProps(e.guardReactiveProps(g||{})),void 0,!0)])})),c.value.hasUserEmpty?void 0:{name:"empty",fn:e.withCtx(()=>[i[1]||(i[1]=e.createElementVNode("div",{class:"no-data"},"暂无数据",-1))]),key:"0"}]),1040,["data","loading","row-key","row-class-name","onSelectionChange"])])}}}),[["__scopeId","data-v-ca606e7b"]]),nt={class:"table-pagination"},lt={class:"page-size-select"},it={class:"total-text"},st={key:1,class:"load-more"},rt={key:2,class:"total-text"},ct=C(e.defineComponent({__name:"TablePagination",props:{page:{},pageSize:{},total:{},type:{}},emits:["update:page","update:pageSize"],setup(n,{emit:a}){const t=n,l=a,m=e.computed(()=>({totalPages:Math.ceil(t.total/t.pageSize),showPagination:t.type==="page"&&t.total>0})),c={onPageChange:d=>{l("update:page",d)},onPageSizeChange:d=>{l("update:pageSize",d)}};return(d,r)=>{const o=k.ElPagination,i=k.ElOption,s=k.ElSelect,p=k.ElButton;return e.openBlock(),e.createElementBlock("div",nt,[m.value.showPagination?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(o,{"current-page":t.page,"page-count":m.value.totalPages,"page-sizes":[10,20,50,100],"page-size":t.pageSize,layout:"total, prev, pager, next, jumper",onCurrentChange:c.onPageChange,onSizeChange:c.onPageSizeChange},null,8,["current-page","page-count","page-size","onCurrentChange","onSizeChange"]),e.createElementVNode("div",lt,[e.createVNode(s,{"model-value":t.pageSize,style:{width:"100px"},onChange:c.onPageSizeChange},{default:e.withCtx(()=>[e.createVNode(i,{value:10,label:"10条/页"}),e.createVNode(i,{value:20,label:"20条/页"}),e.createVNode(i,{value:50,label:"50条/页"}),e.createVNode(i,{value:100,label:"100条/页"})]),_:1},8,["model-value","onChange"]),e.createElementVNode("span",it,"共 "+e.toDisplayString(t.total)+" 条",1)])],64)):t.type==="auto"?(e.openBlock(),e.createElementBlock("div",st,[e.createVNode(p,{disabled:t.page*t.pageSize>=t.total},{default:e.withCtx(()=>[...r[0]||(r[0]=[e.createTextVNode("加载更多",-1)])]),_:1},8,["disabled"])])):t.type==="all"?(e.openBlock(),e.createElementBlock("div",rt,"共 "+e.toDisplayString(t.total)+" 条",1)):e.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-53e593aa"]]),dt={class:"table-detail"},mt={key:0,class:"detail-header"},ut={class:"detail-title"},pt={class:"detail-body"},ft={key:0,class:"detail-status"},ht={key:1,class:"detail-content"},gt={class:"detail-label"},yt={class:"detail-value"},bt={key:2,class:"detail-status"},J=C(e.defineComponent({__name:"TableDetail",props:{showHeader:{type:Boolean},title:{},loading:{type:Boolean},rowData:{},columns:{},emptyText:{}},setup(n){const a=n,t=e.computed(()=>({showHeader:a.showHeader!==!1,title:a.title||"详情",emptyText:a.emptyText||"暂无数据",hasRow:!!a.rowData})),l={getNestedValue(m,c){if(!m||!c)return"";if(!c.includes("."))return m[c];const d=c.split(".");let r=m;for(const o of d)if(r&&typeof r=="object"&&o in r)r=r[o];else return"";return r}};return(m,c)=>(e.openBlock(),e.createElementBlock("div",dt,[t.value.showHeader?(e.openBlock(),e.createElementBlock("div",mt,[e.createElementVNode("div",ut,e.toDisplayString(t.value.title),1)])):e.createCommentVNode("",!0),e.createElementVNode("div",pt,[a.loading?(e.openBlock(),e.createElementBlock("div",ft,"加载中...")):t.value.hasRow?(e.openBlock(),e.createElementBlock("div",ht,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.columns,d=>(e.openBlock(),e.createElementBlock("div",{key:d.field,class:"detail-item"},[e.createElementVNode("div",gt,e.toDisplayString(d.label),1),e.createElementVNode("div",yt,[e.createVNode(W,{type:d.type,"model-value":l.getNestedValue(a.rowData,d.field),"dict-type":d.dictType,mode:d.mode,locale:d.locale,format:d.format,text:d.text,"true-text":d.trueText,"false-text":d.falseText,"use-yes-no":d.useYesNo,"cascader-key":d.cascaderKey,multiline:d.multiline,"default-text":d.defaultText},null,8,["type","model-value","dict-type","mode","locale","format","text","true-text","false-text","use-yes-no","cascader-key","multiline","default-text"])])]))),128))])):(e.openBlock(),e.createElementBlock("div",bt,e.toDisplayString(t.value.emptyText),1)),e.renderSlot(m.$slots,"detail-extra",{rowData:a.rowData,columns:a.columns},void 0,!0)])]))}}),[["__scopeId","data-v-191846c8"]]),wt={class:"table-body"},kt={class:"table-container"},ae=C(e.defineComponent({inheritAttrs:!1,__name:"TableRender",props:{formId:{}},emits:["back","toolbar-action","row-action"],setup(n,{expose:a,emit:t}){const l=["search-extra","search-actions","toolbar-left","toolbar-extra","detail-extra"],m=n,c=e.useAttrs(),d=e.useSlots(),r=t,o=new We,i=e.ref(null),s=e.reactive({searchParams:{},loaded:!1,dictData:{}});e.onMounted(async()=>{m.formId&&await h.loadConfig(m.formId)});const p=e.computed(()=>({tableConfig:o.data.tableConfig,rows:o.data.rows,total:o.data.total,loading:o.data.loading,pagination:o.data.pagination,searchFields:o.getSearchFields(),hasSearch:o.hasSearch(),columns:o.getColumns(),toolbar:o.getToolbar(),hasToolbar:o.hasToolbar(),actions:o.getActions(),currentRow:o.data.currentRow,currentKey:o.getCurrentKey(),showDetail:o.hasDetail(),detailMode:o.getDetailMode(),detailSide:o.getDetailPosition()==="left"?"left":"right",detailWidth:o.getDetailWidth(),detailDirection:o.getDetailDirection(),detailVisible:o.data.detailVisible,detailData:o.data.detailData,detailLoading:o.data.detailLoading,previewVisible:o.data.previewVisible,previewRow:o.data.previewRow,dictData:s.dictData})),h={getTableAttrs(){const{class:u,style:g,...f}=c;return f},getTableSlots(){const u={};for(const g of Object.keys(d))l.includes(g)||(u[g]=!0);return u},async loadConfig(u){try{await o.loadConfig(u)}catch(g){_((g==null?void 0:g.message)||"获取表格配置失败");return}s.searchParams={...o.data.searchParams},s.loaded=!0,await h.loadDictData(),await h.handleLoadData()},async handleLoadData(){try{await o.loadData()}catch(u){_((u==null?void 0:u.message)||"加载数据失败")}},async loadDictData(){const u=o.getColumns(),g=new Set;for(const f of u)f.type==="dict"&&f.dictType&&g.add(f.dictType);for(const f of g)try{const b=await V.get(D.dictApi(f));b.status===200&&(s.dictData[f]=q(b.data))}catch(b){console.error(`[TableRender] 加载字典 ${f} 失败:`,b)}},async handleSearch(){o.data.searchParams={...s.searchParams};try{await o.search()}catch(u){_((u==null?void 0:u.message)||"查询失败")}},async handleReset(){s.searchParams={};try{await o.reset()}catch(u){_((u==null?void 0:u.message)||"重置失败")}},updateSearchParam(u,g){s.searchParams[u]=g},async handlePageChange(u){try{await o.changePage(u)}catch(g){_((g==null?void 0:g.message)||"加载数据失败")}},async handlePageSizeChange(u){try{await o.changePageSize(u)}catch(g){_((g==null?void 0:g.message)||"加载数据失败")}},handleRowClick(u){o.setCurrentRow(u)},handleDetailClose(){o.closeDetail()},handlePreviewClose(){o.closePreview()},handlePreview(u){if(!u){E.warning("请先点击表格中的一行数据");return}o.openPreview(u)},handleToolbarAction(u){r("toolbar-action",u),h.dispatchAction(u)},handleRowAction(u){r("row-action",u),h.dispatchAction(u)},async dispatchAction(u){switch(u.action){case"add":await h.handleAdd(u.item);break;case"edit":await h.handleEdit(u.row,u.item);break;case"delete":await h.handleDelete(u.row,u.item);break;case"preview":h.handlePreview(u.row);break;case"back":r("back",u);break;case"export":await h.handleExport();break;default:await h.handleCustomAction(u)}},async handleAdd(u){const g=u?o.getButtonFormId(u):o.getFormId();if(!g){E.warning("未配置表单,无法新增");return}if(!i.value)return;await i.value.showForm(g)!=null&&await h.handleLoadData()},async handleEdit(u,g){if(!u){E.warning("请先点击表格中的一行数据");return}const f=g?o.getButtonFormId(g):o.getFormId();if(!f){E.warning("未配置表单,无法编辑");return}if(!i.value)return;const b=o.getKeyField();await i.value.showForm(f,`${b}=${u[b]}`)!=null&&await h.handleLoadData()},async handleDelete(u,g){if(!u){E.warning("请先点击表格中的一行数据");return}try{await x.ElMessageBox.confirm((g==null?void 0:g.confirm)||"确定要删除这条数据吗?","确认删除",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"})}catch{return}try{await o.deleteRow(u),E.success("删除成功")}catch(f){_((f==null?void 0:f.message)||"删除失败")}},async handleExport(){try{await o.exportData(),E.success("导出成功")}catch(u){_((u==null?void 0:u.message)||"导出失败")}},async handleCustomAction(u){const{item:g,row:f}=u;if(!(g!=null&&g.url)){E.warning(`未识别的按钮动作:${u.action}`);return}try{await x.ElMessageBox.confirm(g.confirm||"确定执行该操作吗?","确认",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"})}catch{return}try{const b=await V.post(g.url,f||{});if(b.status!==200)throw new Error(b.message||"操作失败");E.success(b.message||"操作成功"),await h.handleLoadData()}catch(b){_((b==null?void 0:b.message)||"操作失败")}}};return a({loadConfig:h.loadConfig}),(u,g)=>{var b,B,A,oe,ne,le;const f=k.ElDrawer;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["table-render",u.$attrs.class]),style:e.normalizeStyle(u.$attrs.style)},[p.value.hasSearch?(e.openBlock(),e.createBlock(Qe,{key:0,fields:p.value.searchFields,modelValue:s.searchParams,"onUpdate:modelValue":g[0]||(g[0]=S=>s.searchParams=S),onSearch:h.handleSearch,onReset:h.handleReset},{"search-extra":e.withCtx(S=>[e.renderSlot(u.$slots,"search-extra",e.normalizeProps(e.guardReactiveProps(S||{})),void 0,!0)]),"search-actions":e.withCtx(S=>[e.renderSlot(u.$slots,"search-actions",e.normalizeProps(e.guardReactiveProps(S||{})),void 0,!0)]),_:3},8,["fields","modelValue","onSearch","onReset"])):e.createCommentVNode("",!0),e.createElementVNode("div",wt,[e.createElementVNode("div",kt,[e.createVNode(ot,e.mergeProps(h.getTableAttrs(),{rows:p.value.rows,columns:p.value.columns,loading:p.value.loading,actions:p.value.actions,"key-field":(b=p.value.tableConfig)==null?void 0:b.key,"dict-data":p.value.dictData,"active-key":p.value.currentKey,onRowAction:h.handleRowAction,onRowClick:h.handleRowClick}),e.createSlots({_:2},[e.renderList(h.getTableSlots(),(S,ie)=>({name:ie,fn:e.withCtx(Tt=>[e.renderSlot(u.$slots,ie,e.normalizeProps(e.guardReactiveProps(Tt||{})),void 0,!0)])}))]),1040,["rows","columns","loading","actions","key-field","dict-data","active-key","onRowAction","onRowClick"]),e.createVNode(ct,{class:"table-pagination",page:p.value.pagination.page,"page-size":p.value.pagination.pageSize,total:p.value.total,type:(B=p.value.tableConfig)==null?void 0:B.pagination,"onUpdate:page":h.handlePageChange,"onUpdate:pageSize":h.handlePageSizeChange},null,8,["page","page-size","total","type","onUpdate:page","onUpdate:pageSize"])]),p.value.showDetail&&p.value.detailMode==="inline"?(e.openBlock(),e.createBlock(J,{key:0,class:e.normalizeClass(["table-detail-inline",`table-detail-inline-${p.value.detailSide}`]),style:e.normalizeStyle({width:p.value.detailWidth}),title:(oe=(A=p.value.tableConfig)==null?void 0:A.meta)==null?void 0:oe.title,loading:p.value.detailLoading,"row-data":p.value.detailData,columns:p.value.columns,"empty-text":p.value.detailSide==="left"?"请点击右侧表格行查看详情":"请点击左侧表格行查看详情"},{"detail-extra":e.withCtx(S=>[e.renderSlot(u.$slots,"detail-extra",e.normalizeProps(e.guardReactiveProps(S||{})),void 0,!0)]),_:3},8,["class","style","title","loading","row-data","columns","empty-text"])):e.createCommentVNode("",!0)]),p.value.showDetail&&p.value.detailMode==="drawer"?(e.openBlock(),e.createBlock(f,{key:1,"model-value":p.value.detailVisible,direction:p.value.detailDirection,size:p.value.detailWidth,title:((le=(ne=p.value.tableConfig)==null?void 0:ne.meta)==null?void 0:le.title)||"详情",onClose:h.handleDetailClose},{default:e.withCtx(()=>[e.createVNode(J,{"show-header":!1,loading:p.value.detailLoading,"row-data":p.value.detailData,columns:p.value.columns},{"detail-extra":e.withCtx(S=>[e.renderSlot(u.$slots,"detail-extra",e.normalizeProps(e.guardReactiveProps(S||{})),void 0,!0)]),_:3},8,["loading","row-data","columns"])]),_:3},8,["model-value","direction","size","title","onClose"])):e.createCommentVNode("",!0),p.value.previewVisible?(e.openBlock(),e.createBlock(f,{key:2,"model-value":!0,direction:p.value.detailDirection,size:p.value.detailWidth,title:"详情",onClose:h.handlePreviewClose},{default:e.withCtx(()=>[e.createVNode(J,{"show-header":!1,"row-data":p.value.previewRow,columns:p.value.columns},{"detail-extra":e.withCtx(S=>[e.renderSlot(u.$slots,"detail-extra",e.normalizeProps(e.guardReactiveProps(S||{})),void 0,!0)]),_:3},8,["row-data","columns"])]),_:3},8,["direction","size","onClose"])):e.createCommentVNode("",!0),p.value.hasToolbar?(e.openBlock(),e.createBlock(Je,{key:3,class:"table-toolbar-bottom",items:p.value.toolbar,"current-row":p.value.currentRow,onAction:h.handleToolbarAction},{"toolbar-left":e.withCtx(S=>[e.renderSlot(u.$slots,"toolbar-left",e.normalizeProps(e.guardReactiveProps(S||{})),void 0,!0)]),"toolbar-extra":e.withCtx(S=>[e.renderSlot(u.$slots,"toolbar-extra",e.normalizeProps(e.guardReactiveProps(S||{})),void 0,!0)]),_:3},8,["items","current-row","onAction"])):e.createCommentVNode("",!0),e.createVNode(H,{ref_key:"formRef",ref:i},null,512)],6)}}}),[["__scopeId","data-v-124fd940"]]);class Ct{constructor(a){w(this,"axiosInstance");w(this,"baseUrl","");this.axiosInstance=Z.create({timeout:1e4,baseURL:""}),this.axiosInstance.defaults.headers["Content-Type"]="application/json;charset=utf-8",this.axiosInstance.interceptors.request.use(t=>(t.headers.token=localStorage.getItem("token"),a.baseUrl?t.baseURL=a.baseUrl:t.baseURL=this.baseUrl||window.location.origin,t),t=>Promise.reject(t)),this.axiosInstance.interceptors.response.use(t=>t.config.responseType==="blob"?t:t.data,t=>Promise.reject(t))}Post(a,t){return this.axiosInstance.post(a,t)}Get(a,t){return this.axiosInstance.get(a,{params:t})}Delete(a,t){return this.axiosInstance.delete(a,{params:t})}Put(a,t){return this.axiosInstance.put(a,t)}Download(a,t){return this.axiosInstance.get(a,{params:t,responseType:"blob"})}}class Bt{constructor(){w(this,"emitter");this.emitter=se()}On(a,t){this.emitter.on(a,t)}Emit(a,t){this.emitter.emit(a,t)}Off(a,t){this.emitter.off(a,t)}}class xt{constructor(a,t){w(this,"mqttClient",null);w(this,"eventBus");this.eventBus=a,this.connect(t).then()}async connect(a){const t={username:a.userName,password:a.password,clientId:`${a.module}_${this.randomStr(10)}`,clean:!0,keepalive:50,connectTimeout:5e3,reconnectPeriod:5e3};let l=a.mqttUrl||"ws://127.0.0.1:5002/ws";if(console.log("connect to mqtt..."),this.mqttClient=re.connect(l,t),!this.mqttClient){console.log("connect mqtt failed");return}this.mqttClient.on("connect",()=>{console.log("=====> mqtt connect success!"),this.mqttClient.subscribe(X,{qos:0},m=>{console.log(m?`mqtt subscribe [${X}] failed`:`mqtt subscribe [${X}] success`)})}),this.mqttClient.on("message",(m,c)=>{const d=c.toString();if(!d){console.error("Received empty message",m);return}let r=null;try{r=JSON.parse(d)}catch(o){console.error("Failed to parse message JSON",m,d,o);return}if(!r||r.Content===void 0||r.Content===null||!r.PType){console.log("parse notice failed!",d);return}r.PType==Vt&&this.eventBus.Emit(r.Route,r.Content)}),this.mqttClient.on(O.OffLine,()=>{console.log("mqtt offline...")}),this.mqttClient.on(O.Reconnect,()=>{console.log("mqtt reconnecting...")}),this.mqttClient.on(O.Close,()=>{console.log("mqtt close")}),this.mqttClient.on(O.Error,m=>{console.log("mqtt error")})}randomStr(a){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let l="";for(let m=0;m<a;m++)l+=t.charAt(Math.floor(Math.random()*t.length));return l}}const X="Notice",Vt="NOTICE",O={OffLine:"offline",Close:"close",Reconnect:"reconnect",Error:"error"};let j;const _t=n=>{if(!n)throw new Error("QfOptions is undefined");if(!j&&n&&(j=new St(n)),!j)throw new Error("Qf not initialized, please call GetQf(options) first");return j};class St{constructor(a){w(this,"EventBus");w(this,"WebApi");w(this,"Mqtt");w(this,"options");this.initQf(a)}initQf(a){if(!a)throw new Error(`StartQf failed! options is ${a}`);this.options=a,console.log("StartQf(), qfOptions=",a),this.EventBus=new Bt,this.WebApi=new Ct(a),this.options.useMqtt&&(this.Mqtt=new xt(this.EventBus,a))}On(a,t){this.EventBus.On(a,t)}Emit(a,t){this.EventBus.Emit(a,t)}Off(a,t){this.EventBus.Off(a,t)}Post(a,t){return this.WebApi.Post(a,t)}Get(a,t){return this.WebApi.Get(a,t)}Delete(a,t){return this.WebApi.Delete(a,t)}Put(a,t){return this.WebApi.Put(a,t)}Download(a,t){return this.WebApi.Download(a,t)}RegNotice(a,t){this.EventBus.On(a,t)}}const Et={UInput:P,UInputNumber:Y,UDict:N,UToggle:K,UCascader:G,UDate:U,UMenu:te,FormRender:H,TableRender:ae,UFieldView:W},Dt={install(n){n.use(x);for(const[a,t]of Object.entries(Et))n.component(a,t)}};y.FormRender=H,y.GetQf=_t,y.TableRender=ae,y.UCascader=G,y.UDate=U,y.UDict=N,y.UFieldView=W,y.UInput=P,y.UInputNumber=Y,y.UMenu=te,y.UToggle=K,y.apis=D,y.clearDictCache=fe,y.default=Dt,y.flattenDictTree=me,y.getDict=$,y.mapDictTree=L,y.normalizeDictNode=F,y.notify=E,y.notifyUtil=R,y.preloadDicts=pe,y.setDictCache=he,y.toDictOptions=q,y.translateDict=ee,y.translateDictSync=ue,Object.defineProperties(y,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(y,V){typeof exports=="object"&&typeof module<"u"?V(exports,require("element-plus"),require("element-plus/dist/index.css"),require("element-plus/es"),require("element-plus/es/components/base/style/css"),require("element-plus/es/components/input/style/css"),require("vue"),require("element-plus/es/components/input-number/style/css"),require("element-plus/es/components/select/style/css"),require("element-plus/es/components/option/style/css"),require("axios"),require("element-plus/es/components/switch/style/css"),require("element-plus/es/components/date-picker/style/css"),require("element-plus/es/components/button/style/css"),require("element-plus/es/components/menu/style/css"),require("element-plus/es/components/sub-menu/style/css"),require("element-plus/es/components/menu-item/style/css"),require("element-plus/es/components/icon/style/css"),require("element-plus/es/components/form/style/css"),require("element-plus/es/components/dialog/style/css"),require("@element-plus/icons-vue"),require("element-plus/es/components/drawer/style/css"),require("element-plus/es/components/table/style/css"),require("element-plus/es/components/table-column/style/css"),require("element-plus/es/components/pagination/style/css"),require("mitt"),require("mqtt")):typeof define=="function"&&define.amd?define(["exports","element-plus","element-plus/dist/index.css","element-plus/es","element-plus/es/components/base/style/css","element-plus/es/components/input/style/css","vue","element-plus/es/components/input-number/style/css","element-plus/es/components/select/style/css","element-plus/es/components/option/style/css","axios","element-plus/es/components/switch/style/css","element-plus/es/components/date-picker/style/css","element-plus/es/components/button/style/css","element-plus/es/components/menu/style/css","element-plus/es/components/sub-menu/style/css","element-plus/es/components/menu-item/style/css","element-plus/es/components/icon/style/css","element-plus/es/components/form/style/css","element-plus/es/components/dialog/style/css","@element-plus/icons-vue","element-plus/es/components/drawer/style/css","element-plus/es/components/table/style/css","element-plus/es/components/table-column/style/css","element-plus/es/components/pagination/style/css","mitt","mqtt"],V):(y=typeof globalThis<"u"?globalThis:y||self,V(y.UritQfUI={},y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.Vue,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.axios,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlusIconsVue,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.mitt,y.mqtt))})(this,function(y,V,M,C,Rt,It,e,At,Mt,Ut,v,zt,Ft,Lt,qt,Wt,jt,Ot,Yt,Qt,ee,Kt,Gt,Ht,Jt,re,ce){"use strict";var $t=Object.defineProperty;var Nt=(y,V,M)=>V in y?$t(y,V,{enumerable:!0,configurable:!0,writable:!0,value:M}):y[V]=M;var w=(y,V,M)=>Nt(y,typeof V!="symbol"?V+"":V,M);const de=e.defineComponent({__name:"UInput",props:{fieldLabel:{},labelPosition:{default:"top"},labelWidth:{},labelAlign:{},required:{type:Boolean},modelValue:{},outlined:{type:Boolean},dense:{type:Boolean},filled:{type:Boolean},borderless:{type:Boolean},label:{},hint:{},error:{type:Boolean},errorMessage:{},type:{},placeholder:{},disable:{type:Boolean},readonly:{type:Boolean},prefix:{},suffix:{},mask:{},maxlength:{}},emits:["update:modelValue"],setup(n,{emit:a}){const t=n,l=a,d=e.computed(()=>{const r={};return t.labelPosition==="left"&&t.labelWidth&&(r.width=typeof t.labelWidth=="number"?`${t.labelWidth}px`:t.labelWidth),t.labelAlign&&(r.textAlign=t.labelAlign),r}),c=e.computed(()=>({"u-input-label-left":t.labelPosition==="left","u-input-label-top":t.labelPosition==="top"})),m={onInput(r){l("update:modelValue",r)}};return(r,o)=>{const s=C.ElInput;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-input",c.value])},[n.fieldLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-input-label",style:e.normalizeStyle(d.value)},[e.createTextVNode(e.toDisplayString(n.fieldLabel)+" ",1),e.createElementVNode("span",{class:e.normalizeClass(["required-star",{"required-star--visible":n.required}])},"*",2)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["u-input-field",{"u-input-field--top":n.labelPosition==="top"}])},[e.createVNode(s,{"model-value":n.modelValue,placeholder:n.placeholder,type:n.type,disabled:n.disable,readonly:n.readonly,maxlength:n.maxlength,"onUpdate:modelValue":m.onInput},null,8,["model-value","placeholder","type","disabled","readonly","maxlength","onUpdate:modelValue"])],2)],2)}}}),k=(n,a)=>{const t=n.__vccOpts||n;for(const[l,d]of a)t[l]=d;return t},$=k(de,[["__scopeId","data-v-ecf5177c"]]),me={class:"u-input-number-field"},Q=k(e.defineComponent({__name:"UInputNumber",props:{fieldLabel:{},labelPosition:{default:"top"},labelWidth:{},labelAlign:{},required:{type:Boolean},modelValue:{},outlined:{type:Boolean},dense:{type:Boolean},filled:{type:Boolean},borderless:{type:Boolean},label:{},hint:{},error:{type:Boolean},errorMessage:{},type:{},placeholder:{},disable:{type:Boolean},readonly:{type:Boolean},min:{},max:{},step:{},precision:{}},emits:["update:modelValue"],setup(n,{emit:a}){const t=n,l=a,d=e.computed(()=>{const r={};return t.labelPosition==="left"&&t.labelWidth&&(r.width=typeof t.labelWidth=="number"?`${t.labelWidth}px`:t.labelWidth),t.labelAlign&&(r.textAlign=t.labelAlign),r}),c=e.computed(()=>({"u-input-number-label-left":t.labelPosition==="left","u-input-number-label-top":t.labelPosition==="top"})),m={onUpdate(r){l("update:modelValue",r===void 0?0:r)}};return(r,o)=>{const s=C.ElInputNumber;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-input-number",c.value])},[n.fieldLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-input-number-label",style:e.normalizeStyle(d.value)},[e.createTextVNode(e.toDisplayString(n.fieldLabel)+" ",1),e.createElementVNode("span",{class:e.normalizeClass(["required-star",{"required-star--visible":n.required}])},"*",2)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",me,[e.createVNode(s,{"model-value":n.modelValue,placeholder:n.placeholder||"请输入数值",disabled:n.disable,min:n.min,max:n.max,step:n.step,precision:n.precision,controls:!0,"controls-position":"right",style:{width:"100%"},onChange:m.onUpdate},null,8,["model-value","placeholder","disabled","min","max","step","precision","onChange"])])],2)}}}),[["__scopeId","data-v-cb70bd5b"]]),U=v.create({timeout:3e4,headers:{"Content-Type":"application/json"}});U.interceptors.request.use(n=>{const a=localStorage.getItem("token");return a&&(n.headers.Authorization=`Bearer ${a}`),n},n=>Promise.reject(n)),U.interceptors.response.use(n=>{const a=n.data;if(a&&typeof a=="object"&&!Array.isArray(a)){if(a.status===void 0&&a.code!==void 0){const t=a.code,l=t===0||t===200||Number(t)===0||Number(t)===200;a.status=l?200:Number(t)}if(a.status!==void 0&&a.status!==200){const t=a.message||"请求失败";return console.error("[HTTP Error]",t),Promise.reject(new Error(t))}}return n},n=>{var t,l;const a=((l=(t=n.response)==null?void 0:t.data)==null?void 0:l.message)||n.message||"请求失败";return console.error("[HTTP Error]",a),Promise.reject(n)});const S={get(n,a){return U.get(n,a).then(t=>t.data)},post(n,a,t){return U.post(n,a,t).then(l=>l.data)},instance:U},D={formCfgApi(n,a="forms"){return`/api/form?type=${a}&id=${n}`},dictApi(n){return`/api/dict/full-list?dict_type=${n}`},cascaderApi(n,a=!0){return`/api/dict/tree-list?dict_type=${n}&children=${a}`}},T={},F={};function L(n){const{children:a,...t}=n;return{label:n.label??n.dict_value??String(n.value??""),value:n.value??n.dict_code,...t}}function q(n){return Array.isArray(n)?n.map(a=>{if(!a||typeof a!="object")return a;const t=L(a),l=a.children;return Array.isArray(l)&&l.length>0&&(t.children=q(l)),t}):[]}function W(n){return Array.isArray(n)?n.filter(a=>a&&typeof a=="object").map(a=>L(a)):[]}function ue(n){if(!Array.isArray(n))return[];const a=[],t=l=>{for(const d of l){if(!d||typeof d!="object")continue;const c=d.children;a.push(L(d)),Array.isArray(c)&&c.length>0&&t(c)}};return t(n),a}async function N(n){if(!n)return[];if(T[n])return T[n];if(n in F)return await F[n];const a=(async()=>{try{const t=await S.get(D.dictApi(n));if(t.status===200){const l=W(t.data);return T[n]=l,l}return[]}catch(t){return console.error(`[dict] 加载字典 ${n} 失败:`,t),[]}finally{delete F[n]}})();return F[n]=a,a}async function te(n,a,t=""){if(a==null||a==="")return t;const l=T[n];if(l&&l.length>0)return K(l,a);const d=await N(n);return d&&d.length>0?K(d,a):t||String(a)}function K(n,a){const t=n.find(l=>l.value===a||String(l.value)===String(a));return t?t.label:String(a)}function pe(n,a,t=""){if(a==null||a==="")return t;const l=T[n];return l&&l.length>0?K(l,a):t||String(a)}async function fe(n){await Promise.all(n.map(a=>N(a)))}function he(n){n?delete T[n]:Object.keys(T).forEach(a=>{delete T[a]})}function ge(n,a){T[n]=a}const ye={class:"u-dict-field"},R=k(e.defineComponent({__name:"UDict",props:{fieldLabel:{},labelPosition:{default:"top"},labelWidth:{},labelAlign:{},required:{type:Boolean},modelValue:{},outlined:{type:Boolean},dense:{type:Boolean},filled:{type:Boolean},borderless:{type:Boolean},label:{},hint:{},error:{type:Boolean},errorMessage:{},type:{},placeholder:{},disable:{type:Boolean},readonly:{type:Boolean},dictType:{}},emits:["update:modelValue"],setup(n,{emit:a}){const t=n,l=a,d=e.reactive({excluded:["fieldLabel","labelPosition","labelWidth","labelAlign","required","modelValue","dictType"],options:[],loading:!1}),c=async()=>{if(t.dictType){d.loading=!0;try{const s=await S.get(D.dictApi(t.dictType));s.status===200?d.options=W(s.data):(console.error("[UDict] 请求失败:",s.message),d.options=[])}catch(s){console.error("[UDict] 加载字典失败:",s),d.options=[]}finally{d.loading=!1}}};e.watch(()=>t.dictType,()=>{c()},{immediate:!0});const m=e.computed(()=>{const s={};return t.labelPosition==="left"&&t.labelWidth&&(s.width=typeof t.labelWidth=="number"?`${t.labelWidth}px`:t.labelWidth),t.labelAlign&&(s.textAlign=t.labelAlign),s}),r=e.computed(()=>({"u-dict-label-left":t.labelPosition==="left","u-dict-label-top":t.labelPosition==="top"})),o={onUpdate(s){l("update:modelValue",s)}};return(s,i)=>{const p=C.ElOption,f=C.ElSelect;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-dict",r.value])},[n.fieldLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-dict-label",style:e.normalizeStyle(m.value)},[e.createTextVNode(e.toDisplayString(n.fieldLabel)+" ",1),e.createElementVNode("span",{class:e.normalizeClass(["required-star",{"required-star--visible":n.required}])},"*",2)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",ye,[e.createVNode(f,{"model-value":n.modelValue,placeholder:n.placeholder||"请选择",loading:d.loading,disabled:n.disable,style:{width:"100%"},onChange:o.onUpdate},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.options,u=>(e.openBlock(),e.createBlock(p,{key:u.value,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:1},8,["model-value","placeholder","loading","disabled","onChange"])])],2)}}}),[["__scopeId","data-v-8bfd4dcf"]]),be={class:"u-toggle-field"},G=k(e.defineComponent({__name:"UToggle",props:{fieldLabel:{},labelPosition:{default:"left"},labelWidth:{},labelAlign:{},required:{type:Boolean},modelValue:{},dense:{type:Boolean,default:!0},color:{},trueValue:{default:!0},falseValue:{default:!1},label:{},hint:{},disable:{type:Boolean},readonly:{type:Boolean},activeText:{},inactiveText:{},activeColor:{},inactiveColor:{}},emits:["update:modelValue"],setup(n,{emit:a}){const t=n,l=a,d=e.reactive({excluded:["fieldLabel","labelPosition","labelWidth","labelAlign","required","modelValue","trueValue","falseValue","activeText","inactiveText","activeColor","inactiveColor"]}),c=()=>{const o={};return t.labelPosition==="left"&&t.labelWidth&&(o.width=typeof t.labelWidth=="number"?`${t.labelWidth}px`:t.labelWidth),t.labelAlign&&(o.textAlign=t.labelAlign),o},m=e.computed({get:()=>t.modelValue===t.trueValue,set:o=>{l("update:modelValue",o?t.trueValue:t.falseValue)}}),r=e.computed(()=>{const o={};for(const s in t)!d.excluded.includes(s)&&s!=="modelValue"&&(o[s]=t[s]);return o});return(o,s)=>{const i=C.ElSwitch;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-toggle",{"u-toggle-label-left":n.labelPosition==="left"}])},[n.fieldLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-toggle-label",style:e.normalizeStyle(c())},[e.createTextVNode(e.toDisplayString(n.fieldLabel)+" ",1),e.createElementVNode("span",{class:e.normalizeClass(["required-star",{"required-star--visible":n.required}])},"*",2)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",be,[e.createVNode(i,e.mergeProps({modelValue:m.value,"onUpdate:modelValue":s[0]||(s[0]=p=>m.value=p)},r.value,{"active-text":n.activeText,"inactive-text":n.inactiveText,"active-color":n.activeColor,"inactive-color":n.inactiveColor}),null,16,["modelValue","active-text","inactive-text","active-color","inactive-color"])])],2)}}}),[["__scopeId","data-v-94c1fd38"]]),we={class:"u-cascader-levels"},H=k(e.defineComponent({__name:"UCascader",props:{fieldLabel:{},labelPosition:{default:"top"},labelWidth:{},labelAlign:{},required:{type:Boolean},modelValue:{},options:{},depth:{default:1}},emits:["update:modelValue"],setup(n,{emit:a}){const t=n,l=a,d=()=>{const o={};return t.labelPosition==="left"&&t.labelWidth&&(o.width=typeof t.labelWidth=="number"?`${t.labelWidth}px`:t.labelWidth),t.labelAlign&&(o.textAlign=t.labelAlign),o},c=e.ref([]),m=e.computed(()=>{const o=[];let s=t.options||[];for(let i=0;i<t.depth;i++)if(o.push(s),c.value[i]!==void 0){const p=s.find(f=>f.value===c.value[i]);p&&p.children?s=p.children:s=[]}else s=[];return o});e.watch(()=>t.modelValue,o=>{o!=null?c.value=Array.isArray(o)?o:[o]:c.value=[]},{immediate:!0});const r=(o,s)=>{c.value[o]=s;for(let p=o+1;p<t.depth;p++)c.value[p]=void 0;const i=c.value.filter(p=>p!==void 0);l("update:modelValue",i)};return(o,s)=>{const i=C.ElOption,p=C.ElSelect;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-cascader",{"u-cascader-label-left":n.labelPosition==="left"}])},[n.fieldLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-cascader-label",style:e.normalizeStyle(d())},[e.createTextVNode(e.toDisplayString(n.fieldLabel)+" ",1),e.createElementVNode("span",{class:e.normalizeClass(["required-star",{"required-star--visible":n.required}])},"*",2)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",we,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.depth,f=>(e.openBlock(),e.createElementBlock("div",{key:f-1,class:"u-cascader-level"},[e.createVNode(p,{"model-value":c.value[f-1],options:m.value[f-1]||[],disabled:f>1&&c.value[f-2]===void 0,placeholder:`请选择${f}级`,style:{width:"100%"},onChange:u=>r(f-1,u)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value[f-1]||[],u=>(e.openBlock(),e.createBlock(i,{key:u.value,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:2},1032,["model-value","options","disabled","placeholder","onChange"])]))),128))])],2)}}}),[["__scopeId","data-v-d66c339c"]]),Ce={class:"u-date-field"},z=k(e.defineComponent({__name:"UDate",props:{fieldLabel:{},labelPosition:{default:"top"},labelWidth:{},labelAlign:{},required:{type:Boolean},modelValue:{},mode:{default:"single"},locale:{default:"zh-CN"},mask:{default:"YYYY-MM-DD"},min:{},max:{}},emits:["update:modelValue"],setup(n,{emit:a}){const t=n,l=a,d=()=>{const o={};return t.labelPosition==="left"&&t.labelWidth&&(o.width=typeof t.labelWidth=="number"?`${t.labelWidth}px`:t.labelWidth),t.labelAlign&&(o.textAlign=t.labelAlign),o},c=e.ref("");e.watch(()=>t.modelValue,o=>{t.mode==="single"?c.value=o||"":t.mode==="multiple"?c.value=Array.isArray(o)?o:o?[o]:[]:t.mode==="range"&&(o&&typeof o=="object"&&o.from&&o.to?c.value=[o.from,o.to]:c.value=[])},{immediate:!0});const m=o=>{o&&(t.mode==="single"||t.mode==="multiple"?l("update:modelValue",o):t.mode==="range"&&o&&o.length===2&&l("update:modelValue",{from:o[0],to:o[1]}))},r=e.computed(()=>t.mode==="range"?"daterange":t.mode==="multiple"?"dates":"date");return(o,s)=>{const i=C.ElDatePicker;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-date",{"u-date-label-left":n.labelPosition==="left"}])},[n.fieldLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-date-label",style:e.normalizeStyle(d())},[e.createTextVNode(e.toDisplayString(n.fieldLabel)+" ",1),e.createElementVNode("span",{class:e.normalizeClass(["required-star",{"required-star--visible":n.required}])},"*",2)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",Ce,[e.createVNode(i,{modelValue:c.value,"onUpdate:modelValue":s[0]||(s[0]=p=>c.value=p),type:r.value,placeholder:n.locale==="en-US"?"Select date":"选择日期","range-separator":n.locale==="en-US"?"to":"至","start-placeholder":n.locale==="en-US"?"Start date":"开始日期","end-placeholder":n.locale==="en-US"?"End date":"结束日期",format:n.mask.replace("YYYY","YYYY").replace("MM","MM").replace("DD","DD"),"value-format":n.mask.replace("YYYY","YYYY").replace("MM","MM").replace("DD","DD"),onChange:m},null,8,["modelValue","type","placeholder","range-separator","start-placeholder","end-placeholder","format","value-format"])])],2)}}}),[["__scopeId","data-v-9cd05064"]]);function I(n,a="info"){V.ElMessage({message:n,type:a,duration:1e3,showClose:!1})}function _(n){V.ElMessage({message:n,type:"error",duration:2e3,showClose:!1})}function ke(n){I(n,"success")}function xe(n){I(n,"error")}function Be(n){I(n,"warning")}function Ve(n){I(n,"info")}const E={notify:I,success:ke,error:xe,warning:Be,info:Ve,alertError:_},Se={key:0,class:"u-menu-brand"},_e=["src"],Ee={class:"u-menu-brand-text"},De={key:1,class:"u-menu-logout"},ae=k(e.defineComponent({__name:"UMenu",props:{menuId:{default:"menu"},config:{},mode:{},projectName:{},activePath:{},width:{}},emits:["menu-click","logout"],setup(n,{expose:a,emit:t}){const l=n,d=t,c=e.reactive({config:null,menus:[],activePath:"",iconMap:{},iconsLoaded:!1}),m=e.computed(()=>{var o,s,i,p,f,u,g,h;return{projectName:l.projectName??((o=c.config)==null?void 0:o.projectName)??"",logo:((s=c.config)==null?void 0:s.logo)||"",mode:l.mode??((i=c.config)==null?void 0:i.mode)??"sidebar",isHorizontal:(l.mode??((p=c.config)==null?void 0:p.mode)??"sidebar")==="horizontal",elMode:(l.mode??((f=c.config)==null?void 0:f.mode)??"sidebar")==="horizontal"?"horizontal":"vertical",width:l.width??((u=c.config)==null?void 0:u.width)??220,menus:c.menus,activeIndex:r.getIndexByPath(c.activePath),showLogout:((g=c.config)==null?void 0:g.showLogout)!==!1,logoutText:((h=c.config)==null?void 0:h.logoutText)||"退出登录",iconMap:c.iconMap}}),r={async init(){await r.ensureIcons(),l.config?(c.config=l.config,c.menus=r.normalizeMenus(l.config.menus)):await r.loadConfig(l.menuId),c.activePath=l.activePath||c.activePath},async loadConfig(o){if(o)try{const s=await S.get(D.formCfgApi(o,"menus"));if(s.status!==200){_(s.message||"获取菜单配置失败");return}const i=s.data||{};c.config=i,i.dictType?await r.loadDictMenus(i.dictType):c.menus=r.normalizeMenus(i.menus)}catch(s){_((s==null?void 0:s.message)||"获取菜单配置失败"),c.menus=[]}},async loadDictMenus(o){try{const s=await S.get(D.cascaderApi(o));if(s.status!==200){_(s.message||"获取菜单字典失败");return}c.menus=r.normalizeMenus(q(s.data))}catch(s){_((s==null?void 0:s.message)||"获取菜单字典失败"),c.menus=[]}},normalizeMenus(o){return Array.isArray(o)?o.map(s=>r.normalizeMenuNode(s)).filter(Boolean):[]},normalizeMenuNode(o){if(!o||typeof o!="object")return null;const s=r.parseInfo(o.info),i=o.label??o.dict_value??o.name;if(!i)return null;const p=s.path??o.path??o.dict_code??o.value??"",f=s.type??o.type??"route",u={...o,label:String(i),type:f,path:String(p??""),icon:s.icon??o.icon??""},g=s.id??o.id;g!=null&&g!==""&&(u.id=String(g));const h=s.open??o.open;(h==="new"||h==="self")&&(u.open=h),delete u.children;const b=o.children;return Array.isArray(b)&&b.length>0&&(u.children=b.map(x=>r.normalizeMenuNode(x)).filter(Boolean)),u},parseInfo(o){if(!o)return{};if(typeof o=="object")return o;if(typeof o=="string")try{const s=JSON.parse(o);return s&&typeof s=="object"?s:{}}catch{return{path:o}}return{}},itemIndex(o,s){return o.path||`menu-${s}`},childIndex(o,s,i,p){return i.path?i.path:`${r.itemIndex(o,s)}-${p}`},hasChildren(o){return Array.isArray(o.children)&&o.children.length>0},getIndexByPath(o){if(!o)return"";for(let s=0;s<c.menus.length;s++){const i=c.menus[s];if(i.path===o)return r.itemIndex(i,s);const p=i.children||[];for(let f=0;f<p.length;f++)if(p[f].path===o)return r.childIndex(i,s,p[f],f)}return""},findItemByIndex(o,s){for(let i=0;i<c.menus.length;i++){const p=c.menus[i],f=r.itemIndex(p,i);if(f===o)return{item:p,level:1,indexPath:s||[f],index:o};const u=p.children||[];for(let g=0;g<u.length;g++){const h=u[g],b=r.childIndex(p,i,h,g);if(b===o)return{item:h,level:2,indexPath:s||[f,b],index:o}}}return null},resolveTarget(o){const s=o.type||"route",i=o.path||"";return s==="url"?{type:s,path:i,url:i,open:o.open||"new"}:s==="form"||s==="table"||s==="menu"?{type:s,path:i,id:o.id||i}:{type:"route",path:i,route:i}},handleSelect(o,s){const i=r.findItemByIndex(o,s);if(!i||r.hasChildren(i.item))return;const p=r.resolveTarget(i.item);c.activePath=i.item.path||o;const f={...p,item:i.item,level:i.level,indexPath:i.indexPath,index:o};d("menu-click",f)},handleLogout(){d("logout")},setActivePath(o){c.activePath=o},async ensureIcons(){if(!c.iconsLoaded){c.iconsLoaded=!0;try{const o=await import("@element-plus/icons-vue"),s=o!=null&&o.default?{...o.default,...o}:{...o},i={};for(const[p,f]of Object.entries(s))i[p]=e.markRaw(f);c.iconMap=i}catch(o){console.warn("[UMenu] @element-plus/icons-vue 不可用,菜单图标将被忽略",o)}}},getIcon(o){return o&&c.iconMap[o]||null}};return e.watch(()=>l.menuId,o=>{l.config||r.loadConfig(o)}),e.watch(()=>l.activePath,o=>{c.activePath=o||""}),e.watch(()=>l.config,o=>{o&&(c.config=o,c.menus=r.normalizeMenus(o.menus))}),e.onMounted(()=>{r.init()}),a({loadConfig:r.loadConfig,setActivePath:r.setActivePath}),(o,s)=>{const i=C.ElIcon,p=C.ElMenuItem,f=C.ElSubMenu,u=C.ElMenu,g=C.ElButton;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-menu",[`u-menu--${m.value.mode}`,{"u-menu--no-brand":!m.value.projectName}]]),style:e.normalizeStyle(m.value.isHorizontal?{}:{width:m.value.width+"px"})},[m.value.projectName?(e.openBlock(),e.createElementBlock("div",Se,[e.renderSlot(o.$slots,"brand",{projectName:m.value.projectName,mode:m.value.mode},()=>[m.value.logo?(e.openBlock(),e.createElementBlock("img",{key:0,class:"u-menu-logo",src:m.value.logo,alt:"logo"},null,8,_e)):e.createCommentVNode("",!0),e.createElementVNode("span",Ee,e.toDisplayString(m.value.projectName),1)],!0)])):e.createCommentVNode("",!0),e.createVNode(u,{class:"u-menu-list",mode:m.value.elMode,"default-active":m.value.activeIndex,"unique-opened":!m.value.isHorizontal,onSelect:r.handleSelect},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value.menus,(h,b)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:r.itemIndex(h,b)},[r.hasChildren(h)?(e.openBlock(),e.createBlock(f,{key:0,index:r.itemIndex(h,b)},{title:e.withCtx(()=>[e.renderSlot(o.$slots,"menu-title",{item:h,level:1,index:b},()=>[r.getIcon(h.icon)?(e.openBlock(),e.createBlock(i,{key:0,class:"u-menu-icon"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.getIcon(h.icon))))]),_:2},1024)):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(h.label),1)],!0)]),default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.children,(x,A)=>(e.openBlock(),e.createBlock(p,{key:r.childIndex(h,b,x,A),index:r.childIndex(h,b,x,A)},{default:e.withCtx(()=>[e.renderSlot(o.$slots,"menu-item",{item:x,level:2,index:A,parent:h},()=>[r.getIcon(x.icon)?(e.openBlock(),e.createBlock(i,{key:0,class:"u-menu-icon"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.getIcon(x.icon))))]),_:2},1024)):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(x.label),1)],!0)]),_:2},1032,["index"]))),128))]),_:2},1032,["index"])):(e.openBlock(),e.createBlock(p,{key:1,index:r.itemIndex(h,b)},{default:e.withCtx(()=>[e.renderSlot(o.$slots,"menu-item",{item:h,level:1,index:b,parent:null},()=>[r.getIcon(h.icon)?(e.openBlock(),e.createBlock(i,{key:0,class:"u-menu-icon"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.getIcon(h.icon))))]),_:2},1024)):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(h.label),1)],!0)]),_:2},1032,["index"]))],64))),128))]),_:3},8,["mode","default-active","unique-opened","onSelect"]),m.value.showLogout?(e.openBlock(),e.createElementBlock("div",De,[e.renderSlot(o.$slots,"logout",{mode:m.value.mode},()=>[e.createVNode(g,{class:"u-menu-logout-btn",text:"",onClick:r.handleLogout},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.value.logoutText),1)]),_:1},8,["onClick"])],!0)])):e.createCommentVNode("",!0)],6)}}}),[["__scopeId","data-v-fe63251c"]]),Te={class:"form-content"},Pe={key:1,class:"form-layout"},$e={key:0,class:"form-header"},Ne={class:"title"},Re={class:"form-body"},Ie={key:1,class:"form-footer"},Ae=k(e.defineComponent({__name:"FormContainer",props:{visible:{type:Boolean},layout:{},title:{},loading:{type:Boolean,default:!1}},emits:["update:visible","close","closed"],setup(n,{emit:a}){const t=n,l=a,{visible:d}=e.toRefs(t),c=e.computed(()=>t.layout.open==="normal"),m=e.computed(()=>t.layout.width||400),r={handleClose(){l("update:visible",!1),l("close")},handleClosed(){l("closed")},updateVisible(o){l("update:visible",o)}};return(o,s)=>{const i=C.ElIcon,p=C.ElDialog;return c.value?e.unref(d)?(e.openBlock(),e.createElementBlock("div",Pe,[n.title?(e.openBlock(),e.createElementBlock("div",$e,[e.createElementVNode("div",Ne,e.toDisplayString(n.title),1)])):e.createCommentVNode("",!0),e.createElementVNode("div",Re,[n.loading?(e.openBlock(),e.createBlock(i,{key:0,class:"is-loading",size:40},{default:e.withCtx(()=>[e.createVNode(e.unref(ee.Loading))]),_:1})):e.renderSlot(o.$slots,"default",{},void 0,!0,1)]),o.$slots.actions?(e.openBlock(),e.createElementBlock("div",Ie,[e.renderSlot(o.$slots,"actions",{},void 0,!0)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(p,{key:0,"model-value":e.unref(d),title:n.title,width:m.value,"close-on-click-modal":!1,"onUpdate:modelValue":r.updateVisible,onClose:r.handleClose,onClosed:r.handleClosed},{footer:e.withCtx(()=>[e.renderSlot(o.$slots,"actions",{},void 0,!0)]),default:e.withCtx(()=>[e.createElementVNode("div",Te,[n.loading?(e.openBlock(),e.createBlock(i,{key:0,class:"is-loading",size:40},{default:e.withCtx(()=>[e.createVNode(e.unref(ee.Loading))]),_:1})):e.renderSlot(o.$slots,"default",{},void 0,!0,1)])]),_:3},8,["model-value","title","width","onUpdate:modelValue","onClose","onClosed"]))}}}),[["__scopeId","data-v-83362259"]]),Me=k(e.defineComponent({__name:"FormGrid",props:{fields:{},layout:{}},setup(n){const a=n,t=e.reactive({columns:e.computed(()=>a.layout.columns||1)}),l={getColSpan(d){const c=d.colSpan||1;return Math.min(c,t.columns)}};return(d,c)=>(e.openBlock(),e.createElementBlock("div",{class:"form-grid",style:e.normalizeStyle({"--grid-columns":t.columns})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.fields,m=>(e.openBlock(),e.createElementBlock("div",{key:m.field,class:"form-grid-item",style:e.normalizeStyle({gridColumn:`span ${l.getColSpan(m)}`})},[e.renderSlot(d.$slots,"default",{field:m},void 0,!0)],4))),128))],4))}}),[["__scopeId","data-v-90ed35a4"]]),Ue={class:"form-field"},ze=k(e.defineComponent({__name:"FormField",props:{field:{},modelValue:{},layout:{},disabled:{type:Boolean,default:!1},error:{}},emits:["update:modelValue"],setup(n,{emit:a}){const t=n,l=a,d=e.reactive({componentMap:e.markRaw({input:$,"input-number":Q,dict:R,switch:G,cascader:H,date:z}),cascaderOptions:[]}),c=()=>{t.field.cascaderKey&&S.get(D.cascaderApi(t.field.cascaderKey)).then(i=>{i.status===200&&(d.cascaderOptions=q(i.data))})};e.watch(()=>t.field.cascaderKey,c,{immediate:!0});const m=e.computed(()=>d.componentMap[t.field.type]||$),r=e.computed(()=>{if((t.layout.labelPosition||"top")==="left"){const p=t.layout.labelWidth||0,f=typeof p=="number"?p+4:p;return{marginLeft:typeof f=="number"?`${f}px`:f}}return{}}),o=e.computed(()=>{const{field:i,modelValue:p,layout:f,disabled:u}=t;let g=p;i.type==="switch"&&p==null&&(g=!1);const h={fieldLabel:i.label,modelValue:g,labelPosition:f.labelPosition||"top",disable:u,name:i.field,required:i.required};if(f.labelWidth&&(h.labelWidth=f.labelWidth),f.labelAlign&&(h.labelAlign=f.labelAlign),i.maxlength&&(h.maxlength=i.maxlength),i.placeholder&&(h.placeholder=i.placeholder),i.readonly&&(h.readonly=i.readonly),i.lineCount&&i.lineCount>=2?(h.type="textarea",h.rows=i.lineCount):i.inputType&&(h.type=i.inputType),i.type==="switch"&&(i.activeText&&(h.activeText=i.activeText),i.inactiveText&&(h.inactiveText=i.inactiveText),i.activeColor&&(h.activeColor=i.activeColor),i.inactiveColor&&(h.inactiveColor=i.inactiveColor),i.trueValue!==void 0&&(h.trueValue=i.trueValue),i.falseValue!==void 0&&(h.falseValue=i.falseValue)),i.dictType&&(h.dictType=i.dictType),i.cascaderKey&&(h.options=d.cascaderOptions,h.depth=i.cascaderDepth||2),i.type==="date"){i.mode&&(h.mode=i.mode),i.locale&&(h.locale=i.locale),i.format?h.mask=i.format:i.mask&&(h.mask=i.mask);const b=i.dateMin??i.min,x=i.dateMax??i.max;b!=null&&(h.min=b),x!=null&&(h.max=x)}return i.type==="input-number"&&(i.min!==void 0&&(h.min=i.min),i.max!==void 0&&(h.max=i.max),i.step&&(h.step=i.step),i.precision!==void 0&&(h.precision=i.precision)),h}),s={handleUpdate(i){l("update:modelValue",i)}};return(i,p)=>(e.openBlock(),e.createElementBlock("div",Ue,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m.value),e.mergeProps(o.value,{"onUpdate:modelValue":s.handleUpdate}),null,16,["onUpdate:modelValue"])),e.createElementVNode("div",{class:e.normalizeClass(["field-error",{"field-error--visible":n.error}]),style:e.normalizeStyle(r.value)},e.toDisplayString(n.error||""),7)]))}}),[["__scopeId","data-v-10299c8d"]]);class Fe{constructor(){w(this,"formConfig",null);w(this,"formData",{});w(this,"loading",!1);w(this,"submitting",!1);w(this,"visible",!1);w(this,"isEditMode",!1);w(this,"errors",[]);w(this,"currentQuery",{})}}let Le=class{constructor(){w(this,"data",e.reactive(new Fe))}parseQuery(a){if(!a)return{};const t={},l=a.split("&");for(const d of l){const[c,m]=d.split("=");c&&(t[c]=m||"")}return t}async fetchFormConfig(a){const t=await S.get(D.formCfgApi(a,"forms"));if(t.status!==200)throw new Error(t.message||"获取表单配置失败");return t.data}async fetchFormData(a,t){const l=t?`${a}?${t}`:a,d=await S.get(l);if(d.status!==200)throw new Error(d.message||"获取表单数据失败");return d.data}async submitForm(a,t){return await S.post(a,t)}buildInitialData(a){const t={};for(const l of a)l.default!==void 0?t[l.field]=l.default:t[l.field]=null;return t}checkIsEditMode(a){return!!a&&a.trim().length>0}validate(){var t;this.data.errors=[];const a=((t=this.data.formConfig)==null?void 0:t.fields)||[];for(const l of a){const d=this.data.formData[l.field];if(l.required&&(d==null||d==="")){this.data.errors.push({field:l.field,message:`${l.label}为必填项`});continue}if(l.rules&&l.rules.length>0&&d){for(const c of l.rules)if(c.pattern&&!new RegExp(c.pattern).test(d)){this.data.errors.push({field:l.field,message:c.message||`${l.label}格式不正确`});break}}}return this.data.errors.length===0}getFieldError(a){const t=this.data.errors.find(l=>l.field===a);return t?t.message:null}clearErrors(){this.data&&(this.data.errors=[])}async openForm(a,t){this.data.loading=!0,this.data.visible=!0,this.clearErrors(),this.data.currentQuery=this.parseQuery(t||"");try{const l=await this.fetchFormConfig(a);if(this.data.formConfig=l,this.data.isEditMode=this.checkIsEditMode(t||""),this.data.formData=this.buildInitialData(l.fields),this.data.isEditMode&&l.api.get&&t){const d=await this.fetchFormData(l.api.get,t),c=this.nestedToFlat(d);this.data.formData={...this.data.formData,...c}}}catch(l){throw console.error("[FormRender] 打开表单失败:",l),this.data.visible=!1,l}finally{this.data.loading=!1}}async doSubmit(){if(!this.data.formConfig)return;if(!this.validate())throw new Error("请完善表单信息");const{api:a}=this.data.formConfig;let t=this.data.isEditMode?a.edit:a.add;if(!t)throw new Error("提交地址未配置");let l={...this.data.formData};l=this.flattenToNested(l),this.data.isEditMode&&this.data.currentQuery.id&&(l.id=Number(this.data.currentQuery.id)),this.data.submitting=!0;try{const d=await this.submitForm(t,l);if(d.status===200)return d.data;throw new Error(d.message||"提交失败")}finally{this.data.submitting=!1}}closeForm(){this&&(this.data.visible=!1)}resetForm(){this.data.formConfig=null,this.data.formData={},this.data.isEditMode=!1,this.data.currentQuery={},this.clearErrors()}flattenToNested(a){const t={};for(const l in a){const d=a[l];if(l.includes(".")){const c=l.split(".");let m=t;for(let r=0;r<c.length-1;r++){const o=c[r];m[o]||(m[o]={}),m=m[o]}m[c[c.length-1]]=d}else t[l]=d}return t}nestedToFlat(a,t=""){const l={};for(const d in a){const c=a[d],m=t?`${t}.${d}`:d;c&&typeof c=="object"&&!Array.isArray(c)?Object.keys(c).length===2&&"from"in c&&"to"in c?l[m]=c:Object.assign(l,this.nestedToFlat(c,m)):l[m]=c}return l}};const J=k(e.defineComponent({__name:"FormRender",setup(n,{expose:a}){const t=new Le,l=e.ref(null),d=e.reactive({currentQuery:{},submitResolve:null}),c=e.computed(()=>{var u;const f={};if(!t.data.isEditMode||!d.currentQuery)return f;for(const g of((u=t.data.formConfig)==null?void 0:u.fields)||[])d.currentQuery[g.field]!==void 0&&(f[g.field]=!0);return f}),m=e.computed(()=>{var f;return((f=t.data.formConfig)==null?void 0:f.layout)||{open:"dialog",columns:1,labelPosition:"top",buttonAlign:"right"}}),r=e.computed(()=>{var f;return((f=t.data.formConfig)==null?void 0:f.fields)||[]}),o=e.computed(()=>{var f,u;return((u=(f=t.data.formConfig)==null?void 0:f.meta)==null?void 0:u.title)||"表单"}),s=e.computed(()=>m.value.buttonAlign||"right"),i=e.computed(()=>m.value.open==="normal"),p={async showForm(f,u){d.currentQuery=t.parseQuery(u||"");try{await t.openForm(f,u)}catch(g){return _((g==null?void 0:g.message)||"打开表单失败"),null}return new Promise(g=>{d.submitResolve=g})},async handleSubmit(){var f,u;try{const g=await t.doSubmit(),h=((u=(f=t.data.formConfig)==null?void 0:f.meta)==null?void 0:u.title)+"保存成功";return E.success(h),d.submitResolve&&(d.submitResolve(g),d.submitResolve=null),i.value||t.closeForm(),g}catch(g){return d.submitResolve&&(d.submitResolve(null),d.submitResolve=null),g!=null&&g.message&&g.message!=="请完善表单信息"&&_(g.message),null}},resolvePending(){d.submitResolve&&(d.submitResolve(null),d.submitResolve=null)},handleCancel(){i.value||(p.resolvePending(),t.closeForm())},getFieldError(f){return t.getFieldError(f)},handleClose(){p.resolvePending(),t.closeForm()},handleClosed(){t.data.visible||t.resetForm()}};return a({showForm:p.showForm}),(f,u)=>{const g=C.ElForm,h=C.ElButton;return e.openBlock(),e.createBlock(Ae,{visible:e.unref(t).data.visible,"onUpdate:visible":u[0]||(u[0]=b=>e.unref(t).data.visible=b),layout:m.value,title:o.value,loading:e.unref(t).data.loading,onClose:p.handleClose,onClosed:p.handleClosed},{actions:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["form-actions",s.value==="right"?"justify-end":"justify-start"])},[e.createVNode(h,{onClick:p.handleCancel},{default:e.withCtx(()=>[...u[1]||(u[1]=[e.createTextVNode("取消",-1)])]),_:1},8,["onClick"]),e.createVNode(h,{type:"primary",loading:e.unref(t).data.submitting,onClick:p.handleSubmit},{default:e.withCtx(()=>[...u[2]||(u[2]=[e.createTextVNode("提交",-1)])]),_:1},8,["loading","onClick"])],2)]),default:e.withCtx(()=>[e.createVNode(g,{ref_key:"formRef",ref:l,class:"form-render","label-position":"top"},{default:e.withCtx(()=>[e.createVNode(Me,{fields:r.value,layout:m.value},{default:e.withCtx(({field:b})=>[e.createVNode(ze,{modelValue:e.unref(t).data.formData[b.field],"onUpdate:modelValue":x=>e.unref(t).data.formData[b.field]=x,field:b,layout:m.value,disabled:c.value[b.field],error:p.getFieldError(b.field)},null,8,["modelValue","onUpdate:modelValue","field","layout","disabled","error"])]),_:1},8,["fields","layout"])]),_:1},512)]),_:1},8,["visible","layout","title","loading","onClose","onClosed"])}}}),[["__scopeId","data-v-b3267c00"]]);class qe{constructor(a){this.config=a}async fetchList(a,t){const l={page:t.page,pageSize:t.pageSize,...a},d={};for(const o in l){const s=l[o];s!==""&&s!==null&&s!==void 0&&(d[o]=s)}const c=new URLSearchParams;for(const o in d)c.append(o,String(d[o]));const m=`${this.config.api.list}${c.toString()?"?"+c.toString():""}`,r=await S.get(m);if(r.status===200){const o=r.data;return Array.isArray(o)?{rows:o,total:o.length}:o||{rows:[],total:0}}throw new Error(r.message||"获取列表数据失败")}async deleteRow(a){if(!this.config.api.delete)throw new Error("未配置删除API");const t=this.config.key||"id",l=a[t],d=`${this.config.api.delete}?${encodeURIComponent(t)}=${encodeURIComponent(String(l??""))}`,c=await S.post(d);if(c.status!==200)throw new Error(c.message||"删除失败")}async batchDelete(a){if(!this.config.api.delete)throw new Error("未配置删除API");const t=await S.post(this.config.api.delete,a);if(t.status!==200)throw new Error(t.message||"批量删除失败")}async exportData(a){if(!this.config.api.export)throw new Error("未配置导出API");const l=(await S.post(this.config.api.export,a,{responseType:"blob"})).data,d=window.URL.createObjectURL(l),c=document.createElement("a");c.href=d,c.download=`export_${Date.now()}.xlsx`,c.click(),window.URL.revokeObjectURL(d)}async downloadTemplate(){if(!this.config.api.import)throw new Error("未配置导入API");const t=(await S.get(`${this.config.api.import}/template`,{responseType:"blob"})).data,l=window.URL.createObjectURL(t),d=document.createElement("a");d.href=l,d.download=`template_${Date.now()}.xlsx`,d.click(),window.URL.revokeObjectURL(l)}async importData(a){if(!this.config.api.import)throw new Error("未配置导入API");const t=new FormData;t.append("file",a);const l=await S.post(this.config.api.import,t,{headers:{"Content-Type":"multipart/form-data"}});if(l.status!==200)throw new Error(l.message||"导入失败");return l.data}}class We{constructor(){w(this,"tableConfig",null);w(this,"rows",[]);w(this,"total",0);w(this,"loading",!1);w(this,"searchParams",{});w(this,"pagination",{page:1,pageSize:20});w(this,"currentRow",null);w(this,"detailVisible",!1);w(this,"detailData",null);w(this,"detailLoading",!1);w(this,"previewVisible",!1);w(this,"previewMounted",!1);w(this,"previewRow",null)}}let je=class{constructor(){w(this,"data",e.reactive(new We));w(this,"dataService",null)}async loadConfig(a){var d;const t=D.formCfgApi(a,"tables");console.log("load config url =",t);const l=await S.get(t);if(console.log("---"),l.status!==200)throw new Error(l.message||"获取表格配置失败");this.data.tableConfig=l.data,this.dataService=new qe(l.data),this.data.currentRow=null,this.data.detailVisible=!1,this.data.detailData=null,this.data.previewVisible=!1,this.data.previewMounted=!1,this.data.previewRow=null,typeof console<"u"&&console.log("[TableRender] loadConfig:",{tableId:a,hasDetail:this.hasDetail(),detail:(d=this.data.tableConfig)==null?void 0:d.detail}),this.initSearchParams()}initSearchParams(){var l;const a={},t=((l=this.data.tableConfig)==null?void 0:l.search)||[];for(const d of t)a[d.field]="";this.data.searchParams=a}async loadData(){if(!this.dataService)throw new Error("表格配置未加载");this.data.loading=!0;try{const a=await this.dataService.fetchList(this.data.searchParams,this.data.pagination);this.data.rows=a.rows||[],this.data.total=a.total||0,this.syncRowRefs()}finally{this.data.loading=!1}}syncRowRefs(){const{currentRow:a,detailData:t}=this.data;if(!a&&!t)return;const l=this.getKeyField(),d=c=>c&&this.data.rows.find(m=>m[l]===c[l])||null;this.data.currentRow=d(a),this.data.detailData&&(this.data.detailData=d(this.data.detailData),this.data.detailData||(this.data.detailVisible=!1))}async search(){this.data.pagination.page=1,await this.loadData()}async reset(){this.initSearchParams(),this.data.pagination.page=1,await this.loadData()}updateSearchParam(a,t){this.data.searchParams[a]=t}async deleteRow(a){if(!this.dataService)throw new Error("表格配置未加载");await this.dataService.deleteRow(a),await this.loadData(),this.isSameRow(a,this.data.currentRow)&&(this.data.currentRow=null),this.isSameRow(a,this.data.detailData)&&this.closeDetail(),this.isSameRow(a,this.data.previewRow)&&this.closePreview()}isSameRow(a,t){return!a||!t?!1:a[this.getKeyField()]===t[this.getKeyField()]}async changePage(a){this.data.pagination.page=a,await this.loadData()}async changePageSize(a){this.data.pagination.pageSize=a,this.data.pagination.page=1,await this.loadData()}setCurrentRow(a){this.data.currentRow=a,this.hasDetail()&&this.openDetail(a)}getCurrentRow(){return this.data.currentRow}getCurrentKey(){var a;return(a=this.data.currentRow)==null?void 0:a[this.getKeyField()]}async exportData(){if(!this.dataService)throw new Error("表格配置未加载");await this.dataService.exportData(this.data.searchParams)}async downloadTemplate(){if(!this.dataService)throw new Error("表格配置未加载");await this.dataService.downloadTemplate()}async importData(a){if(!this.dataService)throw new Error("表格配置未加载");const t=await this.dataService.importData(a);return await this.loadData(),t}getKeyField(){var a;return((a=this.data.tableConfig)==null?void 0:a.key)||"id"}getFormId(){var a;return(a=this.data.tableConfig)==null?void 0:a.form}getDetailFormId(){var a,t;return(t=(a=this.data.tableConfig)==null?void 0:a.detail)==null?void 0:t.formId}hasDetail(){var t;const a=(t=this.data.tableConfig)==null?void 0:t.detail;return!a||typeof a!="object"||a.enable===!1?!1:a.enable===!0||a.enable!==void 0&&a.enable!==null&&a.enable!==""?!0:!!(a.formId||a.position)}isDetailInline(){var a,t;return((t=(a=this.data.tableConfig)==null?void 0:a.detail)==null?void 0:t.enable)===!0}getDetailMode(){return this.isDetailInline()?"inline":"drawer"}getDetailPosition(){var a,t;return((t=(a=this.data.tableConfig)==null?void 0:a.detail)==null?void 0:t.position)||"right"}getDetailWidth(){var t,l;const a=(l=(t=this.data.tableConfig)==null?void 0:t.detail)==null?void 0:l.width;return typeof a=="number"&&a>0?`${a}px`:typeof a=="string"&&a?a:"400px"}getDetailDirection(){return{left:"ltr",right:"rtl",top:"ttb"}[this.getDetailPosition()]||"rtl"}isDetailOpen(){return this.isDetailInline()||this.data.detailVisible}openDetail(a){this.data.detailData=a,this.data.detailVisible=!0}closeDetail(){this.data.detailVisible=!1,this.isDetailInline()&&(this.data.detailData=null)}resetDetail(){this.data.detailVisible||(this.data.detailData=null)}openPreview(a){this.data.previewRow=a,this.data.previewVisible=!0,this.data.previewMounted=!0}closePreview(){this.data.previewVisible=!1}resetPreview(){this.data.previewVisible||(this.data.previewRow=null,this.data.previewMounted=!1)}getSearchFields(){var a;return((a=this.data.tableConfig)==null?void 0:a.search)||[]}getColumns(){var a;return((a=this.data.tableConfig)==null?void 0:a.columns)||[]}hasSearch(){return this.getSearchFields().length>0}getToolbar(){var t;const a=(t=this.data.tableConfig)==null?void 0:t.toolbar;return Array.isArray(a)?a:[]}hasToolbar(){return this.getToolbar().length>0}getActions(){var t;const a=(t=this.data.tableConfig)==null?void 0:t.actions;return Array.isArray(a)?a:[]}hasActions(){return this.getActions().length>0}getButtonFormId(a){var t;return(a==null?void 0:a.form)||((t=this.data.tableConfig)==null?void 0:t.form)}getPaginationType(){var a;return((a=this.data.tableConfig)==null?void 0:a.pagination)||"page"}};const Oe={class:"table-search"},Ye={class:"search-fields"},Qe={class:"search-actions"},Ke=k(e.defineComponent({__name:"TableSearch",props:{fields:{},modelValue:{}},emits:["update:modelValue","search","reset"],setup(n,{emit:a}){const t=n,l=a,d={input:$,dict:R,dept:R,role:R,date:z,daterange:z},c={getComponent(m){return d[m]||$},updateValue(m,r){const o={...t.modelValue,[m]:r};l("update:modelValue",o)},handleSearch(){const m={};for(const r in t.modelValue){const o=t.modelValue[r];m[r]=typeof o=="string"?o.trim():o}l("update:modelValue",m),l("search")},handleReset(){l("reset")}};return(m,r)=>{const o=C.ElButton;return e.openBlock(),e.createElementBlock("div",Oe,[e.createElementVNode("div",Ye,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.fields,s=>(e.openBlock(),e.createElementBlock("div",{key:s.field,class:"search-field"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(c.getComponent(s.type)),{"model-value":t.modelValue[s.field],"field-label":s.label,"dict-type":s.dictType,mode:s.type==="daterange"?"range":void 0,"label-position":"left","onUpdate:modelValue":i=>c.updateValue(s.field,i)},null,8,["model-value","field-label","dict-type","mode","onUpdate:modelValue"]))]))),128)),e.renderSlot(m.$slots,"search-extra",{params:t.modelValue,update:c.updateValue},void 0,!0)]),e.createElementVNode("div",Qe,[e.createVNode(o,{type:"primary",onClick:c.handleSearch},{default:e.withCtx(()=>[...r[0]||(r[0]=[e.createTextVNode("查询",-1)])]),_:1},8,["onClick"]),e.createVNode(o,{onClick:c.handleReset},{default:e.withCtx(()=>[...r[1]||(r[1]=[e.createTextVNode("重置",-1)])]),_:1},8,["onClick"]),e.renderSlot(m.$slots,"search-actions",{params:t.modelValue,search:c.handleSearch,reset:c.handleReset},void 0,!0)])])}}}),[["__scopeId","data-v-09e61a77"]]),Ge={class:"table-toolbar"},He={class:"toolbar-items"},Je={key:1},Xe=k(e.defineComponent({__name:"TableToolbar",props:{items:{},currentRow:{}},emits:["action"],setup(n,{emit:a}){const t=n,l=a,d=e.reactive({iconMap:{}}),c=e.computed(()=>({hasCurrentRow:!!t.currentRow})),m={needRow(r){return r==="edit"||r==="delete"||r==="preview"},getText(r){return r.text?r.text:{add:"新增",edit:"编辑",delete:"删除",preview:"预览",back:"返回"}[r.action]||""},getButtonType(r){return r.style?r.style==="default"?"":r.style:{add:"primary",edit:"primary",delete:"danger",preview:"primary",back:"primary"}[r.action]||""},isDisabled(r){return r.disabled?!0:m.needRow(r.action)&&!c.value.hasCurrentRow},getIcon(r){return r.icon?d.iconMap[r.icon]:null},handleClick(r){l("action",{action:r.action,item:r,row:t.currentRow})},async ensureIcons(){const r=[...new Set(t.items.map(i=>i.icon).filter(Boolean))];if(r.length===0)return;const o=await import("@element-plus/icons-vue"),s={...d.iconMap};for(const i of r)o[i]&&(s[i]=e.markRaw(o[i]));d.iconMap=e.markRaw(s)}};return e.onMounted(()=>{m.ensureIcons()}),e.watch(()=>t.items,()=>{m.ensureIcons()}),(r,o)=>{const s=C.ElIcon,i=C.ElButton;return e.openBlock(),e.createElementBlock("div",Ge,[e.renderSlot(r.$slots,"toolbar-left",{currentRow:t.currentRow},void 0,!0),e.createElementVNode("div",He,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,(p,f)=>(e.openBlock(),e.createBlock(i,{key:f,type:m.getButtonType(p),disabled:m.isDisabled(p),onClick:u=>m.handleClick(p)},{default:e.withCtx(()=>[m.getIcon(p)?(e.openBlock(),e.createBlock(s,{key:0},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m.getIcon(p))))]),_:2},1024)):e.createCommentVNode("",!0),m.getText(p)?(e.openBlock(),e.createElementBlock("span",Je,e.toDisplayString(m.getText(p)),1)):e.createCommentVNode("",!0)]),_:2},1032,["type","disabled","onClick"]))),128))]),e.renderSlot(r.$slots,"toolbar-extra",{currentRow:t.currentRow},void 0,!0)])}}}),[["__scopeId","data-v-8f722515"]]),Ze=k(e.defineComponent({__name:"UInputShow",props:{modelValue:{},multiline:{type:Boolean,default:!1},maxLines:{default:0}},setup(n){const a=n,t=e.computed(()=>a.modelValue===null||a.modelValue===void 0?"":String(a.modelValue)),l=e.computed(()=>a.multiline||t.value.includes(`
2
+ `)),d=e.computed(()=>a.maxLines>0&&l.value?{display:"-webkit-box",WebkitLineClamp:a.maxLines,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis"}:{});return(c,m)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-input-show",{"u-input-multiline":l.value}]),style:e.normalizeStyle(d.value)},e.toDisplayString(t.value),7))}}),[["__scopeId","data-v-c78b151e"]]),ve=k(e.defineComponent({__name:"UDictShow",props:{modelValue:{},dictType:{},defaultText:{default:""}},setup(n){const a=n,t=e.ref(""),l=e.ref(!1),d=async()=>{if(a.modelValue===null||a.modelValue===void 0||a.modelValue===""){t.value=a.defaultText;return}if(!a.dictType){t.value=String(a.modelValue);return}l.value=!0;try{const c=await te(a.dictType,a.modelValue,a.defaultText);t.value=c}catch(c){console.error("[UDictShow] 翻译失败:",c),t.value=String(a.modelValue)}finally{l.value=!1}};return e.watch(()=>a.modelValue,d,{immediate:!0}),e.watch(()=>a.dictType,()=>{a.dictType&&N(a.dictType).then(()=>d())}),e.onMounted(()=>{a.dictType?N(a.dictType).then(()=>d()):d()}),(c,m)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-dict-show",{"u-dict-loading":l.value}])},e.toDisplayString(t.value),3))}}),[["__scopeId","data-v-908045c4"]]),et=k(e.defineComponent({__name:"UToggleShow",props:{modelValue:{},trueText:{default:"开启"},falseText:{default:"关闭"},useYesNo:{type:Boolean,default:!1}},setup(n){const a=n,t=e.computed(()=>a.useYesNo?"是":a.trueText),l=e.computed(()=>a.useYesNo?"否":a.falseText),d=e.computed(()=>a.modelValue===!0||a.modelValue==="true"?t.value:a.modelValue===!1||a.modelValue==="false"?l.value:String(a.modelValue??"")),c=e.computed(()=>a.modelValue===!0||a.modelValue==="true"?"toggle-true":a.modelValue===!1||a.modelValue==="false"?"toggle-false":"toggle-default");return(m,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-toggle-show",c.value])},e.toDisplayString(d.value),3))}}),[["__scopeId","data-v-bac05efc"]]),tt=k(e.defineComponent({__name:"UCascaderShow",props:{modelValue:{},cascaderKey:{},separator:{default:" / "},showRawValue:{type:Boolean,default:!0}},setup(n){const a=n,t=e.ref(""),l=e.ref(!1),d=async()=>{if(!a.modelValue||!Array.isArray(a.modelValue)){t.value="";return}const c=a.modelValue;if(a.cascaderKey){l.value=!0;try{const m=await N(a.cascaderKey),o=c.map(s=>{const i=m.find(p=>p.value===s||String(p.value)===String(s));return i?i.label:a.showRawValue?String(s):""}).filter(s=>s!=="");t.value=o.join(a.separator)}catch(m){console.error("[UCascaderShow] 翻译失败:",m),t.value=a.showRawValue?c.join(a.separator):""}finally{l.value=!1}}else t.value=c.join(a.separator)};return e.watch(()=>a.modelValue,d,{immediate:!0}),e.onMounted(()=>{d()}),(c,m)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-cascader-show",{"u-cascader-loading":l.value}])},e.toDisplayString(t.value),3))}}),[["__scopeId","data-v-5d84df67"]]),at=k(e.defineComponent({__name:"UDateShow",props:{modelValue:{},mode:{default:"single"},locale:{default:"zh-CN"},format:{},separator:{default:", "},rangeSeparator:{default:" ~ "}},setup(n){const a=n,t=e.computed(()=>a.locale==="en-US"?a.mode==="range"?" - ":", ":a.mode==="range"?a.rangeSeparator:a.separator),l=e.computed(()=>{const m=a.modelValue;return a.mode==="single"?m?d(m,a.format):"":a.mode==="multiple"?m?Array.isArray(m)?m.map(r=>d(r,a.format)).join(t.value):String(m):"":a.mode==="range"?m?typeof m=="object"&&m.from&&m.to?`${d(m.from,a.format)}${t.value}${d(m.to,a.format)}`:Array.isArray(m)&&m.length>=2?`${d(m[0],a.format)}${t.value}${d(m[1],a.format)}`:String(m):"":String(m??"")});function d(m,r){return m||""}const c=e.computed(()=>!l.value);return(m,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-date-show",{"u-date-empty":c.value}])},e.toDisplayString(l.value||(n.locale==="en-US"?"Empty":"暂无")),3))}}),[["__scopeId","data-v-930657df"]]),j=k(e.defineComponent({__name:"UFieldView",props:{type:{default:"text"},modelValue:{},dictType:{},mode:{},locale:{default:"zh-CN"},format:{},text:{},trueText:{default:"开启"},falseText:{default:"关闭"},useYesNo:{type:Boolean,default:!1},cascaderKey:{},multiline:{type:Boolean},defaultText:{default:""}},setup(n){const a=n,t=e.computed(()=>{if(!a.text)return null;const m=a.text.split("/");return m.length>=2?{trueText:m[0].trim(),falseText:m[1].trim()}:null}),l=e.computed(()=>{var m;return a.trueText||((m=t.value)==null?void 0:m.trueText)||"开启"}),d=e.computed(()=>{var m;return a.falseText||((m=t.value)==null?void 0:m.falseText)||"关闭"}),c=e.computed(()=>{switch(a.type){case"dict":return"UDictShow";case"switch":return"UToggleShow";case"cascader":return"UCascaderShow";case"date":return"UDateShow";case"input":case"text":default:return"UInputShow"}});return(m,r)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(c.value==="UDictShow"?ve:c.value==="UToggleShow"?et:c.value==="UCascaderShow"?tt:c.value==="UDateShow"?at:Ze),{"model-value":n.modelValue,"dict-type":n.type==="dict"?n.dictType:void 0,"cascader-key":n.type==="cascader"?n.cascaderKey:void 0,mode:n.type==="date"?n.mode:void 0,locale:n.type==="date"?n.locale:void 0,format:n.type==="date"?n.format:void 0,"true-text":n.type==="switch"?l.value:void 0,"false-text":n.type==="switch"?d.value:void 0,"use-yes-no":n.type==="switch"?n.useYesNo:void 0,multiline:n.type==="input"||n.type==="text"?n.multiline:void 0,"default-text":n.type==="dict"?n.defaultText:void 0},null,8,["model-value","dict-type","cascader-key","mode","locale","format","true-text","false-text","use-yes-no","multiline","default-text"]))}}),[["__scopeId","data-v-fedb54d7"]]),ot={class:"table-grid"},nt=k(e.defineComponent({inheritAttrs:!1,__name:"TableGrid",props:{rows:{},columns:{},loading:{type:Boolean},actions:{},keyField:{},selection:{type:[String,Boolean]},dictData:{},activeKey:{}},emits:["rowAction","rowClick","selectionChange"],setup(n,{emit:a}){const t=n,l=e.useSlots(),d=a,c=e.computed(()=>({actionList:t.actions||[],actionColumnWidth:r.getActionColumnWidth(),hasUserEmpty:!!l.empty,forwardSlots:Object.keys(l).filter(o=>o!=="default")})),m=e.computed(()=>{const o=t.columns.map(s=>{const i={prop:s.field,label:s.label};return typeof s.width=="number"&&(i.width=s.width),i});return c.value.actionList.length>0&&o.push({prop:"actions",label:"操作",width:c.value.actionColumnWidth,fixed:"right"}),o}),r={actionText(o){return o.text?o.text:{add:"新增",edit:"编辑",delete:"删除",preview:"预览",back:"返回"}[o.action]||""},actionType(o){return o.style?o.style==="default"?"":o.style:{add:"primary",edit:"primary",delete:"danger",preview:"primary",back:"primary"}[o.action]||"primary"},getActionColumnWidth(){const s=(t.actions||[]).reduce((i,p)=>i+Math.max(52,r.actionText(p).length*16+12),0);return Math.max(80,Math.ceil(s)+16)},maskPhone(o){return!o||o.length<7?o:o.replace(/(\d{3})\d{4}(\d{4})/,"$1****$2")},maskIdCard(o){return!o||o.length<8?o:o.replace(/(\d{3})\d{11}(\d{4})/,"$1***********$2")},formatMoney(o){const s=Number(o);return isNaN(s)?String(o):s.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})},formatByType(o,s){if(!o)return"";switch(s){case"phone":return r.maskPhone(o);case"idcard":return r.maskIdCard(o);case"money":return r.formatMoney(o);case"percent":return String(o*100)+"%";default:return s&&s.includes("{}")?s.replace("{}",String(o)):String(o)}},getNestedValue(o,s){if(!s.includes("."))return o[s];const i=s.split(".");let p=o;for(const f of i)if(p&&typeof p=="object"&&f in p)p=p[f];else return;return p},useFieldView(o){return o.type?["dict","switch","cascader","date","input","text"].includes(o.type):!1},rowClassName({row:o}){if(!o||t.activeKey===void 0||t.activeKey===null)return"";const s=t.keyField||"id";return o[s]===t.activeKey?"table-grid-active-row":""},onSelectionChange(o){d("selectionChange",o)},onRowClick(o){d("rowClick",o)},onRowAction(o,s){d("rowAction",{action:o.action,item:o,row:s})}};return(o,s)=>{const i=C.ElTableColumn,p=C.ElButton,f=C.ElTable;return e.openBlock(),e.createElementBlock("div",ot,[e.createVNode(f,e.mergeProps({stripe:!0,border:!0,...o.$attrs},{data:t.rows.length?t.rows:[{}],loading:t.loading,"row-key":t.keyField||"id","row-class-name":r.rowClassName,onSelectionChange:r.onSelectionChange,onRowClick:s[0]||(s[0]=u=>r.onRowClick(u))}),e.createSlots({default:e.withCtx(()=>[t.selection?(e.openBlock(),e.createBlock(i,{key:0,type:"selection",width:"55"})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,u=>(e.openBlock(),e.createBlock(i,{key:u.prop,prop:u.prop,label:u.label,width:u.width,fixed:u.fixed},{default:e.withCtx(({row:g})=>[u.prop==="actions"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[Object.keys(g).length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(c.value.actionList,(h,b)=>(e.openBlock(),e.createBlock(p,{key:b,link:"",type:r.actionType(h),disabled:h.disabled===!0,size:"small",onClick:e.withModifiers(x=>r.onRowAction(h,g),["stop"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.actionText(h)),1)]),_:2},1032,["type","disabled","onClick"]))),128)):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[Object.keys(g).length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.columns,h=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:h.field},[h.field===u.prop&&r.useFieldView(h)?(e.openBlock(),e.createBlock(j,{key:0,type:h.type,"model-value":r.getNestedValue(g,h.field),"dict-type":h.dictType,mode:h.mode,locale:h.locale,format:h.format,text:h.text,"true-text":h.trueText,"false-text":h.falseText,"use-yes-no":h.useYesNo,"cascader-key":h.cascaderKey,multiline:h.multiline,"default-text":h.defaultText},null,8,["type","model-value","dict-type","mode","locale","format","text","true-text","false-text","use-yes-no","cascader-key","multiline","default-text"])):h.field===u.prop?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass({"table-grid-format":h.format})},e.toDisplayString(r.formatByType(r.getNestedValue(g,h.field),h.format||"")),3)):e.createCommentVNode("",!0)],64))),128)):e.createCommentVNode("",!0)],64))]),_:2},1032,["prop","label","width","fixed"]))),128)),e.renderSlot(o.$slots,"default",{},void 0,!0)]),_:2},[e.renderList(c.value.forwardSlots,u=>({name:u,fn:e.withCtx(g=>[e.renderSlot(o.$slots,u,e.normalizeProps(e.guardReactiveProps(g||{})),void 0,!0)])})),c.value.hasUserEmpty?void 0:{name:"empty",fn:e.withCtx(()=>[s[1]||(s[1]=e.createElementVNode("div",{class:"no-data"},"暂无数据",-1))]),key:"0"}]),1040,["data","loading","row-key","row-class-name","onSelectionChange"])])}}}),[["__scopeId","data-v-ca606e7b"]]),lt={class:"table-pagination"},it={class:"page-size-select"},st={class:"total-text"},rt={key:1,class:"load-more"},ct={key:2,class:"total-text"},dt=k(e.defineComponent({__name:"TablePagination",props:{page:{},pageSize:{},total:{},type:{}},emits:["update:page","update:pageSize"],setup(n,{emit:a}){const t=n,l=a,d=e.computed(()=>({totalPages:Math.ceil(t.total/t.pageSize),showPagination:t.type==="page"&&t.total>0})),c={onPageChange:m=>{l("update:page",m)},onPageSizeChange:m=>{l("update:pageSize",m)}};return(m,r)=>{const o=C.ElPagination,s=C.ElOption,i=C.ElSelect,p=C.ElButton;return e.openBlock(),e.createElementBlock("div",lt,[d.value.showPagination?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(o,{"current-page":t.page,"page-count":d.value.totalPages,"page-sizes":[10,20,50,100],"page-size":t.pageSize,layout:"total, prev, pager, next, jumper",onCurrentChange:c.onPageChange,onSizeChange:c.onPageSizeChange},null,8,["current-page","page-count","page-size","onCurrentChange","onSizeChange"]),e.createElementVNode("div",it,[e.createVNode(i,{"model-value":t.pageSize,style:{width:"100px"},onChange:c.onPageSizeChange},{default:e.withCtx(()=>[e.createVNode(s,{value:10,label:"10条/页"}),e.createVNode(s,{value:20,label:"20条/页"}),e.createVNode(s,{value:50,label:"50条/页"}),e.createVNode(s,{value:100,label:"100条/页"})]),_:1},8,["model-value","onChange"]),e.createElementVNode("span",st,"共 "+e.toDisplayString(t.total)+" 条",1)])],64)):t.type==="auto"?(e.openBlock(),e.createElementBlock("div",rt,[e.createVNode(p,{disabled:t.page*t.pageSize>=t.total},{default:e.withCtx(()=>[...r[0]||(r[0]=[e.createTextVNode("加载更多",-1)])]),_:1},8,["disabled"])])):t.type==="all"?(e.openBlock(),e.createElementBlock("div",ct,"共 "+e.toDisplayString(t.total)+" 条",1)):e.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-53e593aa"]]),mt={class:"table-detail"},ut={key:0,class:"detail-header"},pt={class:"detail-title"},ft={class:"detail-body"},ht={key:0,class:"detail-status"},gt={key:1,class:"detail-content"},yt={class:"detail-label"},bt={class:"detail-value"},wt={key:2,class:"detail-status"},X=k(e.defineComponent({__name:"TableDetail",props:{showHeader:{type:Boolean},title:{},loading:{type:Boolean},rowData:{},columns:{},emptyText:{},extraMode:{}},setup(n){const a=n,t=e.useSlots(),l=e.computed(()=>!!t["detail-extra"]),d=e.computed(()=>l.value),c=e.computed(()=>!l.value||a.extraMode==="append"),m=e.computed(()=>({showHeader:a.showHeader!==!1,title:a.title||"详情",emptyText:a.emptyText||"暂无数据",hasRow:!!a.rowData})),r={getNestedValue(o,s){if(!o||!s)return"";if(!s.includes("."))return o[s];const i=s.split(".");let p=o;for(const f of i)if(p&&typeof p=="object"&&f in p)p=p[f];else return"";return p}};return(o,s)=>(e.openBlock(),e.createElementBlock("div",mt,[m.value.showHeader?(e.openBlock(),e.createElementBlock("div",ut,[e.createElementVNode("div",pt,e.toDisplayString(m.value.title),1)])):e.createCommentVNode("",!0),e.createElementVNode("div",ft,[c.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[a.loading?(e.openBlock(),e.createElementBlock("div",ht,"加载中...")):m.value.hasRow?(e.openBlock(),e.createElementBlock("div",gt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.columns,i=>(e.openBlock(),e.createElementBlock("div",{key:i.field,class:"detail-item"},[e.createElementVNode("div",yt,e.toDisplayString(i.label),1),e.createElementVNode("div",bt,[e.createVNode(j,{type:i.type,"model-value":r.getNestedValue(a.rowData,i.field),"dict-type":i.dictType,mode:i.mode,locale:i.locale,format:i.format,text:i.text,"true-text":i.trueText,"false-text":i.falseText,"use-yes-no":i.useYesNo,"cascader-key":i.cascaderKey,multiline:i.multiline,"default-text":i.defaultText},null,8,["type","model-value","dict-type","mode","locale","format","text","true-text","false-text","use-yes-no","cascader-key","multiline","default-text"])])]))),128))])):(e.openBlock(),e.createElementBlock("div",wt,e.toDisplayString(m.value.emptyText),1))],64)):e.createCommentVNode("",!0),d.value?e.renderSlot(o.$slots,"detail-extra",{rowData:a.rowData,columns:a.columns},void 0,!0,1):e.createCommentVNode("",!0)])]))}}),[["__scopeId","data-v-3314a22f"]]),Ct={class:"table-body"},kt={class:"table-container"},oe=k(e.defineComponent({inheritAttrs:!1,__name:"TableRender",props:{formId:{},detailExtraMode:{}},emits:["back","toolbar-action","row-action"],setup(n,{expose:a,emit:t}){const l=["search-extra","search-actions","toolbar-left","toolbar-extra","detail-extra"],d=n,c=e.useAttrs(),m=e.useSlots(),r=t,o=new je,s=e.ref(null),i=e.reactive({searchParams:{},loaded:!1,dictData:{}});e.onMounted(async()=>{d.formId&&await f.loadConfig(d.formId)});const p=e.computed(()=>({tableConfig:o.data.tableConfig,rows:o.data.rows,total:o.data.total,loading:o.data.loading,pagination:o.data.pagination,searchFields:o.getSearchFields(),hasSearch:o.hasSearch(),columns:o.getColumns(),toolbar:o.getToolbar(),hasToolbar:o.hasToolbar(),actions:o.getActions(),currentRow:o.data.currentRow,currentKey:o.getCurrentKey(),showDetail:o.hasDetail(),detailMode:o.getDetailMode(),detailSide:o.getDetailPosition()==="left"?"left":"right",detailWidth:o.getDetailWidth(),detailDirection:o.getDetailDirection(),detailVisible:o.data.detailVisible,detailData:o.data.detailData,detailLoading:o.data.detailLoading,previewMounted:o.data.previewMounted,previewVisible:o.data.previewVisible,previewRow:o.data.previewRow,dictData:i.dictData})),f={getTableAttrs(){const{class:u,style:g,...h}=c;return h},getTableSlots(){const u={};for(const g of Object.keys(m))l.includes(g)||(u[g]=!0);return u},getDetailSlots(){return m["detail-extra"]?["detail-extra"]:[]},getDetailExtraMode(){return d.detailExtraMode==="append"?"append":"replace"},async loadConfig(u){try{await o.loadConfig(u)}catch(g){_((g==null?void 0:g.message)||"获取表格配置失败");return}i.searchParams={...o.data.searchParams},i.loaded=!0,await f.loadDictData(),await f.handleLoadData()},async handleLoadData(){try{await o.loadData()}catch(u){_((u==null?void 0:u.message)||"加载数据失败")}},async loadDictData(){const u=o.getColumns(),g=new Set;for(const h of u)h.type==="dict"&&h.dictType&&g.add(h.dictType);for(const h of g)try{const b=await S.get(D.dictApi(h));b.status===200&&(i.dictData[h]=W(b.data))}catch(b){console.error(`[TableRender] 加载字典 ${h} 失败:`,b)}},async handleSearch(){o.data.searchParams={...i.searchParams};try{await o.search()}catch(u){_((u==null?void 0:u.message)||"查询失败")}},async handleReset(){i.searchParams={};try{await o.reset()}catch(u){_((u==null?void 0:u.message)||"重置失败")}},updateSearchParam(u,g){i.searchParams[u]=g},async handlePageChange(u){try{await o.changePage(u)}catch(g){_((g==null?void 0:g.message)||"加载数据失败")}},async handlePageSizeChange(u){try{await o.changePageSize(u)}catch(g){_((g==null?void 0:g.message)||"加载数据失败")}},handleRowClick(u){o.setCurrentRow(u)},handleDetailClose(){o.closeDetail()},handleDetailClosed(){o.resetDetail()},handlePreviewClose(){o.closePreview()},handlePreviewClosed(){o.resetPreview()},handlePreview(u){if(!u){E.warning("请先点击表格中的一行数据");return}o.openPreview(u)},handleToolbarAction(u){r("toolbar-action",u),f.dispatchAction(u)},handleRowAction(u){r("row-action",u),f.dispatchAction(u)},async dispatchAction(u){switch(u.action){case"add":await f.handleAdd(u.item);break;case"edit":await f.handleEdit(u.row,u.item);break;case"delete":await f.handleDelete(u.row,u.item);break;case"preview":f.handlePreview(u.row);break;case"back":r("back",u);break;case"export":await f.handleExport();break;default:await f.handleCustomAction(u)}},async handleAdd(u){const g=u?o.getButtonFormId(u):o.getFormId();if(!g){E.warning("未配置表单,无法新增");return}if(!s.value)return;await s.value.showForm(g)!=null&&await f.handleLoadData()},async handleEdit(u,g){if(!u){E.warning("请先点击表格中的一行数据");return}const h=g?o.getButtonFormId(g):o.getFormId();if(!h){E.warning("未配置表单,无法编辑");return}if(!s.value)return;const b=o.getKeyField();await s.value.showForm(h,`${b}=${u[b]}`)!=null&&await f.handleLoadData()},async handleDelete(u,g){if(!u){E.warning("请先点击表格中的一行数据");return}try{await V.ElMessageBox.confirm((g==null?void 0:g.confirm)||"确定要删除这条数据吗?","确认删除",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"})}catch{return}try{await o.deleteRow(u),E.success("删除成功")}catch(h){_((h==null?void 0:h.message)||"删除失败")}},async handleExport(){try{await o.exportData(),E.success("导出成功")}catch(u){_((u==null?void 0:u.message)||"导出失败")}},async handleCustomAction(u){const{item:g,row:h}=u;if(!(g!=null&&g.url)){E.warning(`未识别的按钮动作:${u.action}`);return}try{await V.ElMessageBox.confirm(g.confirm||"确定执行该操作吗?","确认",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"})}catch{return}try{const b=await S.post(g.url,h||{});if(b.status!==200)throw new Error(b.message||"操作失败");E.success(b.message||"操作成功"),await f.handleLoadData()}catch(b){_((b==null?void 0:b.message)||"操作失败")}}};return a({loadConfig:f.loadConfig}),(u,g)=>{var b,x,A,le,ie,se;const h=C.ElDrawer;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["table-render",u.$attrs.class]),style:e.normalizeStyle(u.$attrs.style)},[p.value.hasSearch?(e.openBlock(),e.createBlock(Ke,{key:0,fields:p.value.searchFields,modelValue:i.searchParams,"onUpdate:modelValue":g[0]||(g[0]=B=>i.searchParams=B),onSearch:f.handleSearch,onReset:f.handleReset},{"search-extra":e.withCtx(B=>[e.renderSlot(u.$slots,"search-extra",e.normalizeProps(e.guardReactiveProps(B||{})),void 0,!0)]),"search-actions":e.withCtx(B=>[e.renderSlot(u.$slots,"search-actions",e.normalizeProps(e.guardReactiveProps(B||{})),void 0,!0)]),_:3},8,["fields","modelValue","onSearch","onReset"])):e.createCommentVNode("",!0),e.createElementVNode("div",Ct,[e.createElementVNode("div",kt,[e.createVNode(nt,e.mergeProps(f.getTableAttrs(),{rows:p.value.rows,columns:p.value.columns,loading:p.value.loading,actions:p.value.actions,"key-field":(b=p.value.tableConfig)==null?void 0:b.key,"dict-data":p.value.dictData,"active-key":p.value.currentKey,onRowAction:f.handleRowAction,onRowClick:f.handleRowClick}),e.createSlots({_:2},[e.renderList(f.getTableSlots(),(B,P)=>({name:P,fn:e.withCtx(Pt=>[e.renderSlot(u.$slots,P,e.normalizeProps(e.guardReactiveProps(Pt||{})),void 0,!0)])}))]),1040,["rows","columns","loading","actions","key-field","dict-data","active-key","onRowAction","onRowClick"]),e.createVNode(dt,{class:"table-pagination",page:p.value.pagination.page,"page-size":p.value.pagination.pageSize,total:p.value.total,type:(x=p.value.tableConfig)==null?void 0:x.pagination,"onUpdate:page":f.handlePageChange,"onUpdate:pageSize":f.handlePageSizeChange},null,8,["page","page-size","total","type","onUpdate:page","onUpdate:pageSize"])]),p.value.showDetail&&p.value.detailMode==="inline"?(e.openBlock(),e.createBlock(X,{key:0,class:e.normalizeClass(["table-detail-inline",`table-detail-inline-${p.value.detailSide}`]),style:e.normalizeStyle({width:p.value.detailWidth}),title:(le=(A=p.value.tableConfig)==null?void 0:A.meta)==null?void 0:le.title,loading:p.value.detailLoading,"row-data":p.value.detailData,columns:p.value.columns,"empty-text":p.value.detailSide==="left"?"请点击右侧表格行查看详情":"请点击左侧表格行查看详情","extra-mode":f.getDetailExtraMode()},e.createSlots({_:2},[e.renderList(f.getDetailSlots(),B=>({name:B,fn:e.withCtx(P=>[e.renderSlot(u.$slots,B,e.normalizeProps(e.guardReactiveProps(P||{})),void 0,!0)])}))]),1032,["class","style","title","loading","row-data","columns","empty-text","extra-mode"])):e.createCommentVNode("",!0)]),p.value.showDetail&&p.value.detailMode==="drawer"?(e.openBlock(),e.createBlock(h,{key:1,"model-value":p.value.detailVisible,direction:p.value.detailDirection,size:p.value.detailWidth,title:((se=(ie=p.value.tableConfig)==null?void 0:ie.meta)==null?void 0:se.title)||"详情",onClose:f.handleDetailClose,onClosed:f.handleDetailClosed},{default:e.withCtx(()=>[e.createVNode(X,{"show-header":!1,loading:p.value.detailLoading,"row-data":p.value.detailData,columns:p.value.columns,"extra-mode":f.getDetailExtraMode()},e.createSlots({_:2},[e.renderList(f.getDetailSlots(),B=>({name:B,fn:e.withCtx(P=>[e.renderSlot(u.$slots,B,e.normalizeProps(e.guardReactiveProps(P||{})),void 0,!0)])}))]),1032,["loading","row-data","columns","extra-mode"])]),_:3},8,["model-value","direction","size","title","onClose","onClosed"])):e.createCommentVNode("",!0),p.value.previewMounted?(e.openBlock(),e.createBlock(h,{key:2,"model-value":p.value.previewVisible,direction:p.value.detailDirection,size:p.value.detailWidth,title:"详情",onClose:f.handlePreviewClose,onClosed:f.handlePreviewClosed},{default:e.withCtx(()=>[e.createVNode(X,{"show-header":!1,"row-data":p.value.previewRow,columns:p.value.columns,"extra-mode":f.getDetailExtraMode()},e.createSlots({_:2},[e.renderList(f.getDetailSlots(),B=>({name:B,fn:e.withCtx(P=>[e.renderSlot(u.$slots,B,e.normalizeProps(e.guardReactiveProps(P||{})),void 0,!0)])}))]),1032,["row-data","columns","extra-mode"])]),_:3},8,["model-value","direction","size","onClose","onClosed"])):e.createCommentVNode("",!0),p.value.hasToolbar?(e.openBlock(),e.createBlock(Xe,{key:3,class:"table-toolbar-bottom",items:p.value.toolbar,"current-row":p.value.currentRow,onAction:f.handleToolbarAction},{"toolbar-left":e.withCtx(B=>[e.renderSlot(u.$slots,"toolbar-left",e.normalizeProps(e.guardReactiveProps(B||{})),void 0,!0)]),"toolbar-extra":e.withCtx(B=>[e.renderSlot(u.$slots,"toolbar-extra",e.normalizeProps(e.guardReactiveProps(B||{})),void 0,!0)]),_:3},8,["items","current-row","onAction"])):e.createCommentVNode("",!0),e.createVNode(J,{ref_key:"formRef",ref:s},null,512)],6)}}}),[["__scopeId","data-v-00444d8c"]]);function ne(){var n,a;try{if(typeof document<"u"&&document.baseURI){const t=new URL(document.baseURI).origin;if(t&&t!=="null")return t}}catch{}try{const t=(a=(n=window==null?void 0:window.$wujie)==null?void 0:n.location)==null?void 0:a.origin;if(typeof t=="string"&&t)return t}catch{}return typeof window<"u"?window.location.origin:""}class xt{constructor(a){w(this,"axiosInstance");w(this,"baseUrl","");this.axiosInstance=v.create({timeout:1e4,baseURL:""}),this.axiosInstance.defaults.headers["Content-Type"]="application/json;charset=utf-8",this.axiosInstance.interceptors.request.use(t=>(t.headers.token=localStorage.getItem("token"),a.baseUrl?t.baseURL=a.baseUrl:(this.baseUrl||(this.baseUrl=ne()),t.baseURL=this.baseUrl),t),t=>Promise.reject(t)),this.axiosInstance.interceptors.response.use(t=>t.config.responseType==="blob"?t:t.data,t=>Promise.reject(t))}Post(a,t){return this.axiosInstance.post(a,t)}Get(a,t){return this.axiosInstance.get(a,{params:t})}Delete(a,t){return this.axiosInstance.delete(a,{params:t})}Put(a,t){return this.axiosInstance.put(a,t)}Download(a,t){return this.axiosInstance.get(a,{params:t,responseType:"blob"})}}class Bt{constructor(){w(this,"emitter");this.emitter=re()}On(a,t){this.emitter.on(a,t)}Emit(a,t){this.emitter.emit(a,t)}Off(a,t){this.emitter.off(a,t)}}class Vt{constructor(a,t){w(this,"mqttClient",null);w(this,"eventBus");this.eventBus=a,this.connect(t).then()}async connect(a){const t={username:a.userName,password:a.password,clientId:`${a.module}_${this.randomStr(10)}`,clean:!0,keepalive:50,connectTimeout:5e3,reconnectPeriod:5e3};let l=a.mqttUrl||"ws://127.0.0.1:5002/ws";if(console.log("connect to mqtt..."),this.mqttClient=ce.connect(l,t),!this.mqttClient){console.log("connect mqtt failed");return}this.mqttClient.on("connect",()=>{console.log("=====> mqtt connect success!"),this.mqttClient.subscribe(Z,{qos:0},d=>{console.log(d?`mqtt subscribe [${Z}] failed`:`mqtt subscribe [${Z}] success`)})}),this.mqttClient.on("message",(d,c)=>{const m=c.toString();if(!m){console.error("Received empty message",d);return}let r=null;try{r=JSON.parse(m)}catch(o){console.error("Failed to parse message JSON",d,m,o);return}if(!r||r.Content===void 0||r.Content===null||!r.PType){console.log("parse notice failed!",m);return}r.PType==St&&this.eventBus.Emit(r.Route,r.Content)}),this.mqttClient.on(O.OffLine,()=>{console.log("mqtt offline...")}),this.mqttClient.on(O.Reconnect,()=>{console.log("mqtt reconnecting...")}),this.mqttClient.on(O.Close,()=>{console.log("mqtt close")}),this.mqttClient.on(O.Error,d=>{console.log("mqtt error")})}randomStr(a){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let l="";for(let d=0;d<a;d++)l+=t.charAt(Math.floor(Math.random()*t.length));return l}}const Z="Notice",St="NOTICE",O={OffLine:"offline",Close:"close",Reconnect:"reconnect",Error:"error"};let Y;const _t=n=>{if(!n)throw new Error("QfOptions is undefined");if(!Y&&n&&(Y=new Et(n)),!Y)throw new Error("Qf not initialized, please call GetQf(options) first");return Y};class Et{constructor(a){w(this,"EventBus");w(this,"WebApi");w(this,"Mqtt");w(this,"options");this.initQf(a)}initQf(a){if(!a)throw new Error(`StartQf failed! options is ${a}`);this.options=a,console.log("StartQf(), qfOptions=",a),this.EventBus=new Bt,this.WebApi=new xt(a),this.options.useMqtt&&(this.Mqtt=new Vt(this.EventBus,a))}On(a,t){this.EventBus.On(a,t)}Emit(a,t){this.EventBus.Emit(a,t)}Off(a,t){this.EventBus.Off(a,t)}Post(a,t){return this.WebApi.Post(a,t)}Get(a,t){return this.WebApi.Get(a,t)}Delete(a,t){return this.WebApi.Delete(a,t)}Put(a,t){return this.WebApi.Put(a,t)}Download(a,t){return this.WebApi.Download(a,t)}RegNotice(a,t){this.EventBus.On(a,t)}}const Dt={UInput:$,UInputNumber:Q,UDict:R,UToggle:G,UCascader:H,UDate:z,UMenu:ae,FormRender:J,TableRender:oe,UFieldView:j},Tt={install(n){n.use(V);for(const[a,t]of Object.entries(Dt))n.component(a,t)}};y.FormRender=J,y.GetQf=_t,y.TableRender=oe,y.UCascader=H,y.UDate=z,y.UDict=R,y.UFieldView=j,y.UInput=$,y.UInputNumber=Q,y.UMenu=ae,y.UToggle=G,y.apis=D,y.clearDictCache=he,y.default=Tt,y.flattenDictTree=ue,y.getDict=N,y.mapDictTree=q,y.normalizeDictNode=L,y.notify=E,y.notifyUtil=I,y.preloadDicts=fe,y.resolveBaseUrl=ne,y.setDictCache=ge,y.toDictOptions=W,y.translateDict=te,y.translateDictSync=pe,Object.defineProperties(y,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/dist/qf/http.d.ts CHANGED
@@ -1,4 +1,26 @@
1
1
  import { QfOptions } from './interface.ts';
2
+ /**
3
+ * 解析「免配」时的默认基地址 —— 也就是「后端 = 前端的 IP + 端口」这件事的兜底实现。
4
+ *
5
+ * 优先级(最终由 Http 决定):
6
+ * 1. `QfOptions.baseUrl`(public/config/config.json 的 qfOptions.baseUrl)—— 配了就以它为准,
7
+ * 用于前后端不同机/不同端口/走网关的场景;
8
+ * 2. 本文档自己的地址 `document.baseURI` —— 免配默认值;
9
+ * 3. `window.$wujie.location.origin` —— 无界子应用的兜底;
10
+ * 4. `window.location.origin` —— 最后兜底。
11
+ *
12
+ * ⚠️ 为什么不能直接用 `window.location.origin`(历史写法,已改掉):
13
+ * 被无界(wujie)以微前端方式嵌入时,子应用跑在一个 **同源的 `blob:` 空 iframe** 里,
14
+ * 那个 iframe 的 location 就是**主应用**的地址 → `window.location.origin` 返回主应用的
15
+ * 域名/端口,接口会被打到主应用上去(实测:主应用 8111、子应用 8000,登录请求发成了
16
+ * `POST http://127.0.0.1:8111/api/user/Login`,必然失败)。
17
+ * 而 `document.baseURI` 描述的是**文档自身**的地址 —— 无界会给子应用注入正确的
18
+ * `<base href="子应用地址">`,所以「独立运行」和「被嵌入」两种情况下它都指向子应用自己。
19
+ *
20
+ * 只取 origin(不含路径):与前端的部署路径无关,接口一律按「同 IP + 同端口」发。
21
+ * 需要带路径/别的域名时,在 config.json 里显式配 baseUrl。
22
+ */
23
+ export declare function resolveBaseUrl(): string;
2
24
  export declare class Http {
3
25
  private axiosInstance;
4
26
  private baseUrl;
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- @charset "UTF-8";.u-input[data-v-ecf5177c]{display:flex;width:100%}.u-input.u-input-label-left .u-input-label[data-v-ecf5177c]{padding-top:10px;flex-shrink:0;text-align:right;padding-right:12px;font-size:14px;color:#606266;white-space:nowrap}.u-input.u-input-label-left .u-input-field[data-v-ecf5177c]{flex:1}.u-input.u-input-label-top[data-v-ecf5177c]{flex-direction:column}.u-input.u-input-label-top .u-input-label[data-v-ecf5177c]{width:100%;font-size:14px;color:#606266;margin-bottom:8px;white-space:nowrap}.u-input .required-star[data-v-ecf5177c]{color:#f56c6c;display:inline-block;width:10px}.u-input .required-star[data-v-ecf5177c]:not(.required-star--visible){color:transparent}.u-input .u-input-field--top[data-v-ecf5177c]{width:100%}.u-input-number[data-v-cb70bd5b]{display:flex;width:100%}.u-input-number.u-input-number-label-left .u-input-number-label[data-v-cb70bd5b]{padding-top:10px;flex-shrink:0;text-align:right;padding-right:12px;font-size:14px;color:#606266;white-space:nowrap}.u-input-number.u-input-number-label-left .u-input-number-field[data-v-cb70bd5b]{flex:1}.u-input-number.u-input-number-label-top[data-v-cb70bd5b]{flex-direction:column}.u-input-number.u-input-number-label-top .u-input-number-label[data-v-cb70bd5b]{width:100%;font-size:14px;color:#606266;margin-bottom:8px;white-space:nowrap}.u-input-number .required-star[data-v-cb70bd5b]{color:#f56c6c;display:inline-block;width:10px}.u-input-number .required-star[data-v-cb70bd5b]:not(.required-star--visible){color:transparent}.u-dict[data-v-8bfd4dcf]{display:flex;width:100%}.u-dict.u-dict-label-left .u-dict-label[data-v-8bfd4dcf]{padding-top:10px;flex-shrink:0;text-align:right;padding-right:12px;font-size:14px;color:#606266;white-space:nowrap}.u-dict.u-dict-label-left .u-dict-field[data-v-8bfd4dcf]{flex:1}.u-dict.u-dict-label-top[data-v-8bfd4dcf]{flex-direction:column}.u-dict.u-dict-label-top .u-dict-label[data-v-8bfd4dcf]{width:100%;font-size:14px;color:#606266;margin-bottom:8px;white-space:nowrap}.u-dict .required-star[data-v-8bfd4dcf]{color:#f56c6c;display:inline-block;width:10px}.u-dict .required-star[data-v-8bfd4dcf]:not(.required-star--visible){color:transparent}.u-toggle[data-v-94c1fd38]{display:flex;width:100%}.u-toggle.u-toggle-label-left[data-v-94c1fd38]{flex-direction:row;align-items:flex-start}.u-toggle.u-toggle-label-left .u-toggle-label[data-v-94c1fd38]{padding-top:10px;flex-shrink:0;text-align:right;padding-right:12px;margin-bottom:0;white-space:nowrap}.u-toggle.u-toggle-label-left .u-toggle-field[data-v-94c1fd38]{flex:1}.u-toggle[data-v-94c1fd38]:not(.u-toggle-label-left){flex-direction:column}.u-toggle:not(.u-toggle-label-left) .u-toggle-label[data-v-94c1fd38]{width:100%;margin-bottom:4px;white-space:nowrap}.u-toggle .u-toggle-label[data-v-94c1fd38]{font-size:14px;color:#606266}.u-toggle .u-toggle-label .required-star[data-v-94c1fd38]{color:#f56c6c;display:inline-block;width:10px}.u-toggle .u-toggle-label .required-star[data-v-94c1fd38]:not(.required-star--visible){color:transparent}.u-toggle .u-toggle-field[data-v-94c1fd38]{display:flex;align-items:center}.u-cascader[data-v-d66c339c]{display:flex;width:100%}.u-cascader.u-cascader-label-left[data-v-d66c339c]{flex-direction:row;align-items:flex-start}.u-cascader.u-cascader-label-left .u-cascader-label[data-v-d66c339c]{padding-top:10px;flex-shrink:0;text-align:right;padding-right:12px;margin-bottom:0;white-space:nowrap}.u-cascader.u-cascader-label-left .u-cascader-levels[data-v-d66c339c]{flex:1}.u-cascader[data-v-d66c339c]:not(.u-cascader-label-left){flex-direction:column}.u-cascader:not(.u-cascader-label-left) .u-cascader-label[data-v-d66c339c]{width:100%;margin-bottom:8px;white-space:nowrap}.u-cascader .u-cascader-label[data-v-d66c339c]{font-size:14px;color:#606266}.u-cascader .u-cascader-label .required-star[data-v-d66c339c]{color:#f56c6c;display:inline-block;width:10px}.u-cascader .u-cascader-label .required-star[data-v-d66c339c]:not(.required-star--visible){color:transparent}.u-cascader .u-cascader-levels[data-v-d66c339c]{display:flex;gap:8px;flex-wrap:wrap}.u-cascader .u-cascader-level[data-v-d66c339c]{flex:1;min-width:120px}.u-date[data-v-9cd05064]{display:flex;width:100%}.u-date.u-date-label-left[data-v-9cd05064]{flex-direction:row;align-items:flex-start}.u-date.u-date-label-left .u-date-label[data-v-9cd05064]{padding-top:10px;flex-shrink:0;text-align:right;padding-right:12px;margin-bottom:0;white-space:nowrap}.u-date.u-date-label-left .u-date-field[data-v-9cd05064]{flex:1}.u-date[data-v-9cd05064]:not(.u-date-label-left){flex-direction:column}.u-date:not(.u-date-label-left) .u-date-label[data-v-9cd05064]{width:100%;margin-bottom:8px;white-space:nowrap}.u-date .u-date-label[data-v-9cd05064]{font-size:14px;color:#606266}.u-date .u-date-label .required-star[data-v-9cd05064]{color:#f56c6c;display:inline-block;width:10px}.u-date .u-date-label .required-star[data-v-9cd05064]:not(.required-star--visible){color:transparent}.u-menu[data-v-fe63251c]{display:flex;height:100%;min-height:0;background:#fff}.u-menu .u-menu-icon[data-v-fe63251c]{margin-right:6px}.u-menu.u-menu--sidebar[data-v-fe63251c]{flex-direction:column;border-right:1px solid #e4e7ed}.u-menu.u-menu--sidebar .u-menu-brand[data-v-fe63251c]{flex-shrink:0;display:flex;align-items:center;justify-content:center;padding:16px 12px;border-bottom:1px solid #e4e7ed}.u-menu.u-menu--sidebar .u-menu-list[data-v-fe63251c]{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;border-right:none}.u-menu.u-menu--sidebar .u-menu-logout[data-v-fe63251c]{flex-shrink:0;width:100%;border-top:1px solid #e4e7ed}.u-menu.u-menu--sidebar .u-menu-logout-btn[data-v-fe63251c]{display:block;width:100%}.u-menu.u-menu--horizontal[data-v-fe63251c]{flex-direction:row;align-items:center;width:100%;border-bottom:1px solid #e4e7ed}.u-menu.u-menu--horizontal .u-menu-brand[data-v-fe63251c]{flex-shrink:0;display:flex;align-items:center;padding:0 16px;white-space:nowrap}.u-menu.u-menu--horizontal .u-menu-list[data-v-fe63251c]{flex:1;min-width:0;border-bottom:none}.u-menu.u-menu--horizontal .u-menu-logout[data-v-fe63251c]{flex-shrink:0;display:flex;align-items:center;padding:0 12px;margin-left:auto}.u-menu .u-menu-logo[data-v-fe63251c]{height:28px;margin-right:8px}.u-menu .u-menu-brand-text[data-v-fe63251c]{font-size:18px;font-weight:600;color:#303133;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.form-content[data-v-7e522999]{min-height:100px}.form-layout[data-v-7e522999]{width:100%;background:#fff}.form-header[data-v-7e522999]{display:flex;align-items:center;padding:16px;border-bottom:1px solid #eee}.form-header .title[data-v-7e522999]{font-size:18px;font-weight:500}.form-body[data-v-7e522999]{padding:16px;min-height:100px}.form-footer[data-v-7e522999]{display:flex;justify-content:flex-end;gap:8px;padding:16px;border-top:1px solid #eee}.is-loading[data-v-7e522999]{display:flex;justify-content:center;align-items:center;min-height:100px;color:#409eff}.form-grid[data-v-90ed35a4]{display:grid;grid-template-columns:repeat(var(--grid-columns, 1),minmax(0,1fr));gap:8px;width:100%}.form-grid-item[data-v-90ed35a4]{min-width:0}.form-field[data-v-10299c8d]{width:100%}.field-error[data-v-10299c8d]{color:#f56c6c;font-size:12px;min-height:12px;line-height:1.5;transition:opacity .2s}.field-error[data-v-10299c8d]:not(.field-error--visible){opacity:0}.form-render[data-v-c8356aa3]{width:100%}.form-actions[data-v-c8356aa3]{display:flex;gap:8px}.justify-end[data-v-c8356aa3]{justify-content:flex-end}.justify-start[data-v-c8356aa3]{justify-content:flex-start}.table-search[data-v-09e61a77]{display:flex;align-items:center;flex-wrap:wrap;gap:12px;padding:16px;background:#fff;border-bottom:1px solid #eee}.table-search .search-fields[data-v-09e61a77]{display:flex;flex-wrap:wrap;gap:12px}.table-search .search-field[data-v-09e61a77]{display:flex;align-items:center;gap:8px;min-width:200px}.table-search .search-actions[data-v-09e61a77]{display:flex;gap:8px;flex-shrink:0}.table-toolbar[data-v-8f722515]{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:8px;padding:12px 16px;border-top:1px solid darkgrey}.table-toolbar .toolbar-items[data-v-8f722515]{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.u-input-show[data-v-c78b151e]{font-size:14px;line-height:1.5;color:#333;word-break:break-all}.u-input-show.u-input-multiline[data-v-c78b151e]{white-space:pre-wrap}.u-dict-show[data-v-908045c4]{font-size:14px;line-height:1.5;color:#333}.u-dict-show.u-dict-loading[data-v-908045c4]{color:#999}.u-toggle-show[data-v-bac05efc]{display:inline-block;padding:2px 8px;border-radius:4px;font-size:14px;line-height:1.5}.u-toggle-show.toggle-true[data-v-bac05efc]{background-color:#e6f7ed;color:#52c41a}.u-toggle-show.toggle-false[data-v-bac05efc]{background-color:#fff1f0;color:#ff4d4f}.u-toggle-show.toggle-default[data-v-bac05efc]{color:#999}.u-cascader-show[data-v-5d84df67]{font-size:14px;line-height:1.5;color:#333}.u-cascader-show.u-cascader-loading[data-v-5d84df67]{color:#999}.u-date-show[data-v-930657df]{font-size:14px;line-height:1.5;color:#333}.u-date-show.u-date-empty[data-v-930657df]{color:#999}.u-field-view[data-v-fedb54d7]{display:inline-block}.table-grid[data-v-ca606e7b]{background:#fff}.table-grid .no-data[data-v-ca606e7b]{padding:48px;text-align:center;color:#999}.table-grid[data-v-ca606e7b] .table-grid-active-row td.el-table__cell{background-color:var(--el-color-primary-light-9, #ecf5ff)!important}.table-pagination[data-v-53e593aa]{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;background:#fff;border-top:1px solid #eee}.table-pagination .page-size-select[data-v-53e593aa]{display:flex;align-items:center;gap:12px}.table-pagination .total-text[data-v-53e593aa]{color:#666;font-size:14px}.table-pagination .load-more[data-v-53e593aa]{flex:1;text-align:center}.table-detail[data-v-191846c8]{display:flex;flex-direction:column;height:100%;min-height:0;background:#fff}.table-detail .detail-header[data-v-191846c8]{display:flex;flex-shrink:0;align-items:center;justify-content:space-between;padding:14px 16px;border-bottom:1px solid #ebeef5}.table-detail .detail-header .detail-title[data-v-191846c8]{font-size:15px;font-weight:500}.table-detail .detail-body[data-v-191846c8]{flex:1;min-height:0;overflow:auto}.table-detail .detail-status[data-v-191846c8]{display:flex;align-items:center;justify-content:center;height:100%;padding:24px;color:#999;font-size:13px}.table-detail .detail-content[data-v-191846c8]{padding:4px 16px 16px}.table-detail .detail-item[data-v-191846c8]{display:flex;padding:12px 0;border-bottom:1px solid #eee}.table-detail .detail-item[data-v-191846c8]:last-child{border-bottom:none}.table-detail .detail-item .detail-label[data-v-191846c8]{width:100px;flex-shrink:0;color:#666;font-size:14px}.table-detail .detail-item .detail-value[data-v-191846c8]{flex:1;min-width:0;color:#333;font-size:14px;word-break:break-all}.table-render[data-v-124fd940]{display:flex;flex-direction:column;height:100%;min-height:0;background:#fff}.table-render .table-body[data-v-124fd940]{display:flex;flex:1;min-height:0;overflow:hidden}.table-render .table-container[data-v-124fd940]{flex:1;display:flex;flex-direction:column;min-width:0;overflow:hidden}.table-render .table-pagination[data-v-124fd940]{flex-shrink:0}.table-render .table-detail-inline[data-v-124fd940]{flex-shrink:0;height:100%;overflow:hidden;border-left:1px solid #ebeef5}.table-render .table-detail-inline.table-detail-inline-left[data-v-124fd940]{order:-1;border-left:none;border-right:1px solid #ebeef5}.table-render .table-toolbar-bottom[data-v-124fd940]{flex-shrink:0}
1
+ @charset "UTF-8";.u-input[data-v-ecf5177c]{display:flex;width:100%}.u-input.u-input-label-left .u-input-label[data-v-ecf5177c]{padding-top:10px;flex-shrink:0;text-align:right;padding-right:12px;font-size:14px;color:#606266;white-space:nowrap}.u-input.u-input-label-left .u-input-field[data-v-ecf5177c]{flex:1}.u-input.u-input-label-top[data-v-ecf5177c]{flex-direction:column}.u-input.u-input-label-top .u-input-label[data-v-ecf5177c]{width:100%;font-size:14px;color:#606266;margin-bottom:8px;white-space:nowrap}.u-input .required-star[data-v-ecf5177c]{color:#f56c6c;display:inline-block;width:10px}.u-input .required-star[data-v-ecf5177c]:not(.required-star--visible){color:transparent}.u-input .u-input-field--top[data-v-ecf5177c]{width:100%}.u-input-number[data-v-cb70bd5b]{display:flex;width:100%}.u-input-number.u-input-number-label-left .u-input-number-label[data-v-cb70bd5b]{padding-top:10px;flex-shrink:0;text-align:right;padding-right:12px;font-size:14px;color:#606266;white-space:nowrap}.u-input-number.u-input-number-label-left .u-input-number-field[data-v-cb70bd5b]{flex:1}.u-input-number.u-input-number-label-top[data-v-cb70bd5b]{flex-direction:column}.u-input-number.u-input-number-label-top .u-input-number-label[data-v-cb70bd5b]{width:100%;font-size:14px;color:#606266;margin-bottom:8px;white-space:nowrap}.u-input-number .required-star[data-v-cb70bd5b]{color:#f56c6c;display:inline-block;width:10px}.u-input-number .required-star[data-v-cb70bd5b]:not(.required-star--visible){color:transparent}.u-dict[data-v-8bfd4dcf]{display:flex;width:100%}.u-dict.u-dict-label-left .u-dict-label[data-v-8bfd4dcf]{padding-top:10px;flex-shrink:0;text-align:right;padding-right:12px;font-size:14px;color:#606266;white-space:nowrap}.u-dict.u-dict-label-left .u-dict-field[data-v-8bfd4dcf]{flex:1}.u-dict.u-dict-label-top[data-v-8bfd4dcf]{flex-direction:column}.u-dict.u-dict-label-top .u-dict-label[data-v-8bfd4dcf]{width:100%;font-size:14px;color:#606266;margin-bottom:8px;white-space:nowrap}.u-dict .required-star[data-v-8bfd4dcf]{color:#f56c6c;display:inline-block;width:10px}.u-dict .required-star[data-v-8bfd4dcf]:not(.required-star--visible){color:transparent}.u-toggle[data-v-94c1fd38]{display:flex;width:100%}.u-toggle.u-toggle-label-left[data-v-94c1fd38]{flex-direction:row;align-items:flex-start}.u-toggle.u-toggle-label-left .u-toggle-label[data-v-94c1fd38]{padding-top:10px;flex-shrink:0;text-align:right;padding-right:12px;margin-bottom:0;white-space:nowrap}.u-toggle.u-toggle-label-left .u-toggle-field[data-v-94c1fd38]{flex:1}.u-toggle[data-v-94c1fd38]:not(.u-toggle-label-left){flex-direction:column}.u-toggle:not(.u-toggle-label-left) .u-toggle-label[data-v-94c1fd38]{width:100%;margin-bottom:4px;white-space:nowrap}.u-toggle .u-toggle-label[data-v-94c1fd38]{font-size:14px;color:#606266}.u-toggle .u-toggle-label .required-star[data-v-94c1fd38]{color:#f56c6c;display:inline-block;width:10px}.u-toggle .u-toggle-label .required-star[data-v-94c1fd38]:not(.required-star--visible){color:transparent}.u-toggle .u-toggle-field[data-v-94c1fd38]{display:flex;align-items:center}.u-cascader[data-v-d66c339c]{display:flex;width:100%}.u-cascader.u-cascader-label-left[data-v-d66c339c]{flex-direction:row;align-items:flex-start}.u-cascader.u-cascader-label-left .u-cascader-label[data-v-d66c339c]{padding-top:10px;flex-shrink:0;text-align:right;padding-right:12px;margin-bottom:0;white-space:nowrap}.u-cascader.u-cascader-label-left .u-cascader-levels[data-v-d66c339c]{flex:1}.u-cascader[data-v-d66c339c]:not(.u-cascader-label-left){flex-direction:column}.u-cascader:not(.u-cascader-label-left) .u-cascader-label[data-v-d66c339c]{width:100%;margin-bottom:8px;white-space:nowrap}.u-cascader .u-cascader-label[data-v-d66c339c]{font-size:14px;color:#606266}.u-cascader .u-cascader-label .required-star[data-v-d66c339c]{color:#f56c6c;display:inline-block;width:10px}.u-cascader .u-cascader-label .required-star[data-v-d66c339c]:not(.required-star--visible){color:transparent}.u-cascader .u-cascader-levels[data-v-d66c339c]{display:flex;gap:8px;flex-wrap:wrap}.u-cascader .u-cascader-level[data-v-d66c339c]{flex:1;min-width:120px}.u-date[data-v-9cd05064]{display:flex;width:100%}.u-date.u-date-label-left[data-v-9cd05064]{flex-direction:row;align-items:flex-start}.u-date.u-date-label-left .u-date-label[data-v-9cd05064]{padding-top:10px;flex-shrink:0;text-align:right;padding-right:12px;margin-bottom:0;white-space:nowrap}.u-date.u-date-label-left .u-date-field[data-v-9cd05064]{flex:1}.u-date[data-v-9cd05064]:not(.u-date-label-left){flex-direction:column}.u-date:not(.u-date-label-left) .u-date-label[data-v-9cd05064]{width:100%;margin-bottom:8px;white-space:nowrap}.u-date .u-date-label[data-v-9cd05064]{font-size:14px;color:#606266}.u-date .u-date-label .required-star[data-v-9cd05064]{color:#f56c6c;display:inline-block;width:10px}.u-date .u-date-label .required-star[data-v-9cd05064]:not(.required-star--visible){color:transparent}.u-menu[data-v-fe63251c]{display:flex;height:100%;min-height:0;background:#fff}.u-menu .u-menu-icon[data-v-fe63251c]{margin-right:6px}.u-menu.u-menu--sidebar[data-v-fe63251c]{flex-direction:column;border-right:1px solid #e4e7ed}.u-menu.u-menu--sidebar .u-menu-brand[data-v-fe63251c]{flex-shrink:0;display:flex;align-items:center;justify-content:center;padding:16px 12px;border-bottom:1px solid #e4e7ed}.u-menu.u-menu--sidebar .u-menu-list[data-v-fe63251c]{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;border-right:none}.u-menu.u-menu--sidebar .u-menu-logout[data-v-fe63251c]{flex-shrink:0;width:100%;border-top:1px solid #e4e7ed}.u-menu.u-menu--sidebar .u-menu-logout-btn[data-v-fe63251c]{display:block;width:100%}.u-menu.u-menu--horizontal[data-v-fe63251c]{flex-direction:row;align-items:center;width:100%;border-bottom:1px solid #e4e7ed}.u-menu.u-menu--horizontal .u-menu-brand[data-v-fe63251c]{flex-shrink:0;display:flex;align-items:center;padding:0 16px;white-space:nowrap}.u-menu.u-menu--horizontal .u-menu-list[data-v-fe63251c]{flex:1;min-width:0;border-bottom:none}.u-menu.u-menu--horizontal .u-menu-logout[data-v-fe63251c]{flex-shrink:0;display:flex;align-items:center;padding:0 12px;margin-left:auto}.u-menu .u-menu-logo[data-v-fe63251c]{height:28px;margin-right:8px}.u-menu .u-menu-brand-text[data-v-fe63251c]{font-size:18px;font-weight:600;color:#303133;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.form-content[data-v-83362259]{min-height:100px}.form-layout[data-v-83362259]{width:100%;background:#fff}.form-header[data-v-83362259]{display:flex;align-items:center;padding:16px;border-bottom:1px solid #eee}.form-header .title[data-v-83362259]{font-size:18px;font-weight:500}.form-body[data-v-83362259]{padding:16px;min-height:100px}.form-footer[data-v-83362259]{display:flex;justify-content:flex-end;gap:8px;padding:16px;border-top:1px solid #eee}.is-loading[data-v-83362259]{display:flex;justify-content:center;align-items:center;min-height:100px;color:#409eff}.form-grid[data-v-90ed35a4]{display:grid;grid-template-columns:repeat(var(--grid-columns, 1),minmax(0,1fr));gap:8px;width:100%}.form-grid-item[data-v-90ed35a4]{min-width:0}.form-field[data-v-10299c8d]{width:100%}.field-error[data-v-10299c8d]{color:#f56c6c;font-size:12px;min-height:12px;line-height:1.5;transition:opacity .2s}.field-error[data-v-10299c8d]:not(.field-error--visible){opacity:0}.form-render[data-v-b3267c00]{width:100%}.form-actions[data-v-b3267c00]{display:flex;gap:8px}.justify-end[data-v-b3267c00]{justify-content:flex-end}.justify-start[data-v-b3267c00]{justify-content:flex-start}.table-search[data-v-09e61a77]{display:flex;align-items:center;flex-wrap:wrap;gap:12px;padding:16px;background:#fff;border-bottom:1px solid #eee}.table-search .search-fields[data-v-09e61a77]{display:flex;flex-wrap:wrap;gap:12px}.table-search .search-field[data-v-09e61a77]{display:flex;align-items:center;gap:8px;min-width:200px}.table-search .search-actions[data-v-09e61a77]{display:flex;gap:8px;flex-shrink:0}.table-toolbar[data-v-8f722515]{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:8px;padding:12px 16px;border-top:1px solid darkgrey}.table-toolbar .toolbar-items[data-v-8f722515]{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.u-input-show[data-v-c78b151e]{font-size:14px;line-height:1.5;color:#333;word-break:break-all}.u-input-show.u-input-multiline[data-v-c78b151e]{white-space:pre-wrap}.u-dict-show[data-v-908045c4]{font-size:14px;line-height:1.5;color:#333}.u-dict-show.u-dict-loading[data-v-908045c4]{color:#999}.u-toggle-show[data-v-bac05efc]{display:inline-block;padding:2px 8px;border-radius:4px;font-size:14px;line-height:1.5}.u-toggle-show.toggle-true[data-v-bac05efc]{background-color:#e6f7ed;color:#52c41a}.u-toggle-show.toggle-false[data-v-bac05efc]{background-color:#fff1f0;color:#ff4d4f}.u-toggle-show.toggle-default[data-v-bac05efc]{color:#999}.u-cascader-show[data-v-5d84df67]{font-size:14px;line-height:1.5;color:#333}.u-cascader-show.u-cascader-loading[data-v-5d84df67]{color:#999}.u-date-show[data-v-930657df]{font-size:14px;line-height:1.5;color:#333}.u-date-show.u-date-empty[data-v-930657df]{color:#999}.u-field-view[data-v-fedb54d7]{display:inline-block}.table-grid[data-v-ca606e7b]{background:#fff}.table-grid .no-data[data-v-ca606e7b]{padding:48px;text-align:center;color:#999}.table-grid[data-v-ca606e7b] .table-grid-active-row td.el-table__cell{background-color:var(--el-color-primary-light-9, #ecf5ff)!important}.table-pagination[data-v-53e593aa]{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;background:#fff;border-top:1px solid #eee}.table-pagination .page-size-select[data-v-53e593aa]{display:flex;align-items:center;gap:12px}.table-pagination .total-text[data-v-53e593aa]{color:#666;font-size:14px}.table-pagination .load-more[data-v-53e593aa]{flex:1;text-align:center}.table-detail[data-v-3314a22f]{display:flex;flex-direction:column;height:100%;min-height:0;background:#fff}.table-detail .detail-header[data-v-3314a22f]{display:flex;flex-shrink:0;align-items:center;justify-content:space-between;padding:14px 16px;border-bottom:1px solid #ebeef5}.table-detail .detail-header .detail-title[data-v-3314a22f]{font-size:15px;font-weight:500}.table-detail .detail-body[data-v-3314a22f]{flex:1;min-height:0;overflow:auto}.table-detail .detail-status[data-v-3314a22f]{display:flex;align-items:center;justify-content:center;height:100%;padding:24px;color:#999;font-size:13px}.table-detail .detail-content[data-v-3314a22f]{padding:4px 16px 16px}.table-detail .detail-item[data-v-3314a22f]{display:flex;padding:12px 0;border-bottom:1px solid #eee}.table-detail .detail-item[data-v-3314a22f]:last-child{border-bottom:none}.table-detail .detail-item .detail-label[data-v-3314a22f]{width:100px;flex-shrink:0;color:#666;font-size:14px}.table-detail .detail-item .detail-value[data-v-3314a22f]{flex:1;min-width:0;color:#333;font-size:14px;word-break:break-all}.table-render[data-v-00444d8c]{display:flex;flex-direction:column;height:100%;min-height:0;background:#fff}.table-render .table-body[data-v-00444d8c]{display:flex;flex:1;min-height:0;overflow:hidden}.table-render .table-container[data-v-00444d8c]{flex:1;display:flex;flex-direction:column;min-width:0;overflow:hidden}.table-render .table-container[data-v-00444d8c] .table-grid{flex:1;min-height:0;max-height:var(--table-grid-max-height, none)}.table-render .table-container[data-v-00444d8c] .table-grid>.el-table{height:100%}.table-render .table-pagination[data-v-00444d8c]{flex-shrink:0}.table-render .table-detail-inline[data-v-00444d8c]{flex-shrink:0;height:100%;overflow:hidden;border-left:1px solid #ebeef5}.table-render .table-detail-inline.table-detail-inline-left[data-v-00444d8c]{order:-1;border-left:none;border-right:1px solid #ebeef5}.table-render .table-toolbar-bottom[data-v-00444d8c]{flex-shrink:0}
@@ -23,6 +23,7 @@ declare class FormRender {
23
23
  openForm(formId: string, query?: string): Promise<void>;
24
24
  doSubmit(): Promise<any>;
25
25
  closeForm(): void;
26
+ resetForm(): void;
26
27
  flattenToNested(data: Record<string, any>): Record<string, any>;
27
28
  nestedToFlat(obj: Record<string, any>, prefix?: string): Record<string, any>;
28
29
  }
@@ -12,6 +12,7 @@ export declare class TableRenderData {
12
12
  detailData: any;
13
13
  detailLoading: boolean;
14
14
  previewVisible: boolean;
15
+ previewMounted: boolean;
15
16
  previewRow: any;
16
17
  }
17
18
  export declare class TableRender {
@@ -139,16 +140,36 @@ export declare class TableRender {
139
140
  openDetail(row: any): void;
140
141
  /**
141
142
  * 关闭详情(固定侧栏模式下仅清空内容)
143
+ *
144
+ * ⚠️ 抽屉模式下**不在这里清 detailData**:抽屉是「先播退场动画、动画播完才移除
145
+ * DOM」,此刻清数据会让内容区先变空、抽屉还在滑出 → 观感上「闪一下」。
146
+ * 抽屉模式的内容清理放到退场动画播完(resetDetail,由 @closed 调用)。
147
+ * 固定侧栏(inline)没有动画,照旧立刻清。
142
148
  */
143
149
  closeDetail(): void;
150
+ /**
151
+ * 清理详情内容(抽屉退场动画结束后调用;重复调用无副作用)
152
+ * 防御:动画期间用户又点开了别的行,此时不能清
153
+ */
154
+ resetDetail(): void;
144
155
  /**
145
156
  * 打开预览抽屉(action: preview)
146
157
  */
147
158
  openPreview(row: any): void;
148
159
  /**
149
160
  * 关闭预览抽屉
161
+ *
162
+ * ⚠️ 与 closeForm / closeDetail 同一原则:这里**只**把可见性置 false,
163
+ * 不清 previewRow、也不卸载组件。抽屉要先把退场动画播完才移除 DOM,这一刻
164
+ * 清内容或直接卸载都会让退场动画「唰一下没了」。真正的清理见 resetPreview
165
+ * (由 el-drawer 的 @closed 调用)。
150
166
  */
151
167
  closePreview(): void;
168
+ /**
169
+ * 清理预览(抽屉退场动画结束后调用;重复调用无副作用)
170
+ * 防御:动画期间用户又点开了别的行,此时不能清、也不能卸载
171
+ */
172
+ resetPreview(): void;
152
173
  /**
153
174
  * 获取搜索字段配置
154
175
  */
@@ -20,9 +20,11 @@ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
20
20
  declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
21
21
  close: () => any;
22
22
  "update:visible": (value: boolean) => any;
23
+ closed: () => any;
23
24
  }, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
24
25
  onClose?: (() => any) | undefined;
25
26
  "onUpdate:visible"?: ((value: boolean) => any) | undefined;
27
+ onClosed?: (() => any) | undefined;
26
28
  }>, {
27
29
  loading: boolean;
28
30
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
@@ -6,6 +6,14 @@ type __VLS_Props = {
6
6
  rowData?: Record<string, any>;
7
7
  columns?: TableColumn[];
8
8
  emptyText?: string;
9
+ /**
10
+ * `detail-extra` 插槽与默认字段列表的关系:
11
+ * replace(默认)—— **二选一**:给了插槽就只渲染插槽,一个默认字段都不渲染
12
+ * append —— 旧行为:默认字段列表 + 插槽内容上下共存
13
+ *
14
+ * 页面上通过 TableRender 的 `detail-extra-mode` 传进来,一般不用直接设置。
15
+ */
16
+ extraMode?: 'replace' | 'append';
9
17
  };
10
18
  declare function __VLS_template(): {
11
19
  attrs: Partial<{}>;