urit-qf-ui 0.2.4 → 0.2.6
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.
- package/README.md +242 -145
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1536 -1398
- package/dist/index.umd.cjs +2 -2
- package/dist/qf/http.d.ts +22 -0
- package/dist/style.css +1 -1
- package/dist/ts/form-render.d.ts +1 -0
- package/dist/ts/model.d.ts +1 -0
- package/dist/ts/table-render.d.ts +21 -0
- package/dist/uform/FormContainer.vue.d.ts +2 -0
- package/dist/uform/TableDetail.vue.d.ts +8 -0
- package/dist/uform/TableGrid.vue.d.ts +13 -1
- package/dist/uform/TableRender.vue.d.ts +148 -13
- package/package.json +1 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -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-195aa0e8"]]);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(b,B){typeof exports=="object"&&typeof module<"u"?B(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"],B):(b=typeof globalThis<"u"?globalThis:b||self,B(b.UritQfUI={},b.ElementPlus,b.ElementPlus,b.ElementPlus,b.ElementPlus,b.ElementPlus,b.Vue,b.ElementPlus,b.ElementPlus,b.ElementPlus,b.axios,b.ElementPlus,b.ElementPlus,b.ElementPlus,b.ElementPlus,b.ElementPlus,b.ElementPlus,b.ElementPlus,b.ElementPlus,b.ElementPlus,b.ElementPlusIconsVue,b.ElementPlus,b.ElementPlus,b.ElementPlus,b.ElementPlus,b.mitt,b.mqtt))})(this,function(b,B,M,C,Mt,Ut,e,zt,Ft,Lt,ee,qt,Wt,Ot,jt,Yt,Qt,Kt,Ht,Gt,te,Jt,Xt,Zt,vt,de,me){"use strict";var At=Object.defineProperty;var It=(b,B,M)=>B in b?At(b,B,{enumerable:!0,configurable:!0,writable:!0,value:M}):b[B]=M;var w=(b,B,M)=>It(b,typeof B!="symbol"?B+"":B,M);const ue=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,s=a,c=e.computed(()=>{const m={};return t.labelPosition==="left"&&t.labelWidth&&(m.width=typeof t.labelWidth=="number"?`${t.labelWidth}px`:t.labelWidth),t.labelAlign&&(m.textAlign=t.labelAlign),m}),d=e.computed(()=>({"u-input-label-left":t.labelPosition==="left","u-input-label-top":t.labelPosition==="top"})),r={onInput(m){s("update:modelValue",m)}};return(m,o)=>{const l=C.ElInput;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-input",d.value])},[n.fieldLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-input-label",style:e.normalizeStyle(c.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(l,{"model-value":n.modelValue,placeholder:n.placeholder,type:n.type,disabled:n.disable,readonly:n.readonly,maxlength:n.maxlength,"onUpdate:modelValue":r.onInput},null,8,["model-value","placeholder","type","disabled","readonly","maxlength","onUpdate:modelValue"])],2)],2)}}}),k=(n,a)=>{const t=n.__vccOpts||n;for(const[s,c]of a)t[s]=c;return t},N=k(ue,[["__scopeId","data-v-ecf5177c"]]),pe={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,s=a,c=e.computed(()=>{const m={};return t.labelPosition==="left"&&t.labelWidth&&(m.width=typeof t.labelWidth=="number"?`${t.labelWidth}px`:t.labelWidth),t.labelAlign&&(m.textAlign=t.labelAlign),m}),d=e.computed(()=>({"u-input-number-label-left":t.labelPosition==="left","u-input-number-label-top":t.labelPosition==="top"})),r={onUpdate(m){s("update:modelValue",m===void 0?0:m)}};return(m,o)=>{const l=C.ElInputNumber;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-input-number",d.value])},[n.fieldLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-input-number-label",style:e.normalizeStyle(c.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",pe,[e.createVNode(l,{"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:r.onUpdate},null,8,["model-value","placeholder","disabled","min","max","step","precision","onChange"])])],2)}}}),[["__scopeId","data-v-cb70bd5b"]]),U=ee.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,s=t===0||t===200||Number(t)===0||Number(t)===200;a.status=s?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,s;const a=((s=(t=n.response)==null?void 0:t.data)==null?void 0:s.message)||n.message||"请求失败";return console.error("[HTTP Error]",a),Promise.reject(n)});const V={get(n,a){return U.get(n,a).then(t=>t.data)},post(n,a,t){return U.post(n,a,t).then(s=>s.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),s=a.children;return Array.isArray(s)&&s.length>0&&(t.children=q(s)),t}):[]}function W(n){return Array.isArray(n)?n.filter(a=>a&&typeof a=="object").map(a=>L(a)):[]}function fe(n){if(!Array.isArray(n))return[];const a=[],t=s=>{for(const c of s){if(!c||typeof c!="object")continue;const d=c.children;a.push(L(c)),Array.isArray(d)&&d.length>0&&t(d)}};return t(n),a}async function R(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 V.get(D.dictApi(n));if(t.status===200){const s=W(t.data);return T[n]=s,s}return[]}catch(t){return console.error(`[dict] 加载字典 ${n} 失败:`,t),[]}finally{delete F[n]}})();return F[n]=a,a}async function ae(n,a,t=""){if(a==null||a==="")return t;const s=T[n];if(s&&s.length>0)return K(s,a);const c=await R(n);return c&&c.length>0?K(c,a):t||String(a)}function K(n,a){const t=n.find(s=>s.value===a||String(s.value)===String(a));return t?t.label:String(a)}function he(n,a,t=""){if(a==null||a==="")return t;const s=T[n];return s&&s.length>0?K(s,a):t||String(a)}async function ge(n){await Promise.all(n.map(a=>R(a)))}function ye(n){n?delete T[n]:Object.keys(T).forEach(a=>{delete T[a]})}function be(n,a){T[n]=a}const we={class:"u-dict-field"},A=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,s=a,c=e.reactive({excluded:["fieldLabel","labelPosition","labelWidth","labelAlign","required","modelValue","dictType"],options:[],loading:!1}),d=async()=>{if(t.dictType){c.loading=!0;try{const l=await V.get(D.dictApi(t.dictType));l.status===200?c.options=W(l.data):(console.error("[UDict] 请求失败:",l.message),c.options=[])}catch(l){console.error("[UDict] 加载字典失败:",l),c.options=[]}finally{c.loading=!1}}};e.watch(()=>t.dictType,()=>{d()},{immediate:!0});const r=e.computed(()=>{const l={};return t.labelPosition==="left"&&t.labelWidth&&(l.width=typeof t.labelWidth=="number"?`${t.labelWidth}px`:t.labelWidth),t.labelAlign&&(l.textAlign=t.labelAlign),l}),m=e.computed(()=>({"u-dict-label-left":t.labelPosition==="left","u-dict-label-top":t.labelPosition==="top"})),o={onUpdate(l){s("update:modelValue",l)}};return(l,i)=>{const u=C.ElOption,f=C.ElSelect;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-dict",m.value])},[n.fieldLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-dict-label",style:e.normalizeStyle(r.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",we,[e.createVNode(f,{"model-value":n.modelValue,placeholder:n.placeholder||"请选择",loading:c.loading,disabled:n.disable,style:{width:"100%"},onChange:o.onUpdate},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.options,p=>(e.openBlock(),e.createBlock(u,{key:p.value,label:p.label,value:p.value},null,8,["label","value"]))),128))]),_:1},8,["model-value","placeholder","loading","disabled","onChange"])])],2)}}}),[["__scopeId","data-v-8bfd4dcf"]]),Ce={class:"u-toggle-field"},H=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,s=a,c=e.reactive({excluded:["fieldLabel","labelPosition","labelWidth","labelAlign","required","modelValue","trueValue","falseValue","activeText","inactiveText","activeColor","inactiveColor"]}),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},r=e.computed({get:()=>t.modelValue===t.trueValue,set:o=>{s("update:modelValue",o?t.trueValue:t.falseValue)}}),m=e.computed(()=>{const o={};for(const l in t)!c.excluded.includes(l)&&l!=="modelValue"&&(o[l]=t[l]);return o});return(o,l)=>{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(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,e.mergeProps({modelValue:r.value,"onUpdate:modelValue":l[0]||(l[0]=u=>r.value=u)},m.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"]]),ke={class:"u-cascader-levels"},G=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,s=a,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.ref([]),r=e.computed(()=>{const o=[];let l=t.options||[];for(let i=0;i<t.depth;i++)if(o.push(l),d.value[i]!==void 0){const u=l.find(f=>f.value===d.value[i]);u&&u.children?l=u.children:l=[]}else l=[];return o});e.watch(()=>t.modelValue,o=>{o!=null?d.value=Array.isArray(o)?o:[o]:d.value=[]},{immediate:!0});const m=(o,l)=>{d.value[o]=l;for(let u=o+1;u<t.depth;u++)d.value[u]=void 0;const i=d.value.filter(u=>u!==void 0);s("update:modelValue",i)};return(o,l)=>{const i=C.ElOption,u=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(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",ke,[(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(u,{"model-value":d.value[f-1],options:r.value[f-1]||[],disabled:f>1&&d.value[f-2]===void 0,placeholder:`请选择${f}级`,style:{width:"100%"},onChange:p=>m(f-1,p)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value[f-1]||[],p=>(e.openBlock(),e.createBlock(i,{key:p.value,label:p.label,value:p.value},null,8,["label","value"]))),128))]),_:2},1032,["model-value","options","disabled","placeholder","onChange"])]))),128))])],2)}}}),[["__scopeId","data-v-d66c339c"]]),xe={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,s=a,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.ref("");e.watch(()=>t.modelValue,o=>{t.mode==="single"?d.value=o||"":t.mode==="multiple"?d.value=Array.isArray(o)?o:o?[o]:[]:t.mode==="range"&&(o&&typeof o=="object"&&o.from&&o.to?d.value=[o.from,o.to]:d.value=[])},{immediate:!0});const r=o=>{o&&(t.mode==="single"||t.mode==="multiple"?s("update:modelValue",o):t.mode==="range"&&o&&o.length===2&&s("update:modelValue",{from:o[0],to:o[1]}))},m=e.computed(()=>t.mode==="range"?"daterange":t.mode==="multiple"?"dates":"date");return(o,l)=>{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(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",xe,[e.createVNode(i,{modelValue:d.value,"onUpdate:modelValue":l[0]||(l[0]=u=>d.value=u),type:m.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:r},null,8,["modelValue","type","placeholder","range-separator","start-placeholder","end-placeholder","format","value-format"])])],2)}}}),[["__scopeId","data-v-9cd05064"]]);function I(n,a="info"){B.ElMessage({message:n,type:a,duration:1e3,showClose:!1})}function _(n){B.ElMessage({message:n,type:"error",duration:2e3,showClose:!1})}function Se(n){I(n,"success")}function Be(n){I(n,"error")}function Ve(n){I(n,"warning")}function _e(n){I(n,"info")}const E={notify:I,success:Se,error:Be,warning:Ve,info:_e,alertError:_},Ee={key:0,class:"u-menu-brand"},De=["src"],Te={class:"u-menu-brand-text"},Pe={key:1,class:"u-menu-logout"},oe=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 s=n,c=t,d=e.reactive({config:null,menus:[],activePath:"",iconMap:{},iconsLoaded:!1}),r=e.computed(()=>{var o,l,i,u,f,p,h,g;return{projectName:s.projectName??((o=d.config)==null?void 0:o.projectName)??"",logo:((l=d.config)==null?void 0:l.logo)||"",mode:s.mode??((i=d.config)==null?void 0:i.mode)??"sidebar",isHorizontal:(s.mode??((u=d.config)==null?void 0:u.mode)??"sidebar")==="horizontal",elMode:(s.mode??((f=d.config)==null?void 0:f.mode)??"sidebar")==="horizontal"?"horizontal":"vertical",width:s.width??((p=d.config)==null?void 0:p.width)??220,menus:d.menus,activeIndex:m.getIndexByPath(d.activePath),showLogout:((h=d.config)==null?void 0:h.showLogout)!==!1,logoutText:((g=d.config)==null?void 0:g.logoutText)||"退出登录",iconMap:d.iconMap}}),m={async init(){await m.ensureIcons(),s.config?(d.config=s.config,d.menus=m.normalizeMenus(s.config.menus)):await m.loadConfig(s.menuId),d.activePath=s.activePath||d.activePath},async loadConfig(o){if(o)try{const l=await V.get(D.formCfgApi(o,"menus"));if(l.status!==200){_(l.message||"获取菜单配置失败");return}const i=l.data||{};d.config=i,i.dictType?await m.loadDictMenus(i.dictType):d.menus=m.normalizeMenus(i.menus)}catch(l){_((l==null?void 0:l.message)||"获取菜单配置失败"),d.menus=[]}},async loadDictMenus(o){try{const l=await V.get(D.cascaderApi(o));if(l.status!==200){_(l.message||"获取菜单字典失败");return}d.menus=m.normalizeMenus(q(l.data))}catch(l){_((l==null?void 0:l.message)||"获取菜单字典失败"),d.menus=[]}},normalizeMenus(o){return Array.isArray(o)?o.map(l=>m.normalizeMenuNode(l)).filter(Boolean):[]},normalizeMenuNode(o){if(!o||typeof o!="object")return null;const l=m.parseInfo(o.info),i=o.label??o.dict_value??o.name;if(!i)return null;const u=l.path??o.path??o.dict_code??o.value??"",f=l.type??o.type??"route",p={...o,label:String(i),type:f,path:String(u??""),icon:l.icon??o.icon??""},h=l.id??o.id;h!=null&&h!==""&&(p.id=String(h));const g=l.open??o.open;(g==="new"||g==="self")&&(p.open=g),delete p.children;const y=o.children;return Array.isArray(y)&&y.length>0&&(p.children=y.map(x=>m.normalizeMenuNode(x)).filter(Boolean)),p},parseInfo(o){if(!o)return{};if(typeof o=="object")return o;if(typeof o=="string")try{const l=JSON.parse(o);return l&&typeof l=="object"?l:{}}catch{return{path:o}}return{}},itemIndex(o,l){return o.path||`menu-${l}`},childIndex(o,l,i,u){return i.path?i.path:`${m.itemIndex(o,l)}-${u}`},hasChildren(o){return Array.isArray(o.children)&&o.children.length>0},getIndexByPath(o){if(!o)return"";for(let l=0;l<d.menus.length;l++){const i=d.menus[l];if(i.path===o)return m.itemIndex(i,l);const u=i.children||[];for(let f=0;f<u.length;f++)if(u[f].path===o)return m.childIndex(i,l,u[f],f)}return""},findItemByIndex(o,l){for(let i=0;i<d.menus.length;i++){const u=d.menus[i],f=m.itemIndex(u,i);if(f===o)return{item:u,level:1,indexPath:l||[f],index:o};const p=u.children||[];for(let h=0;h<p.length;h++){const g=p[h],y=m.childIndex(u,i,g,h);if(y===o)return{item:g,level:2,indexPath:l||[f,y],index:o}}}return null},resolveTarget(o){const l=o.type||"route",i=o.path||"";return l==="url"?{type:l,path:i,url:i,open:o.open||"new"}:l==="form"||l==="table"||l==="menu"?{type:l,path:i,id:o.id||i}:{type:"route",path:i,route:i}},handleSelect(o,l){const i=m.findItemByIndex(o,l);if(!i||m.hasChildren(i.item))return;const u=m.resolveTarget(i.item);d.activePath=i.item.path||o;const f={...u,item:i.item,level:i.level,indexPath:i.indexPath,index:o};c("menu-click",f)},handleLogout(){c("logout")},setActivePath(o){d.activePath=o},async ensureIcons(){if(!d.iconsLoaded){d.iconsLoaded=!0;try{const o=await import("@element-plus/icons-vue"),l=o!=null&&o.default?{...o.default,...o}:{...o},i={};for(const[u,f]of Object.entries(l))i[u]=e.markRaw(f);d.iconMap=i}catch(o){console.warn("[UMenu] @element-plus/icons-vue 不可用,菜单图标将被忽略",o)}}},getIcon(o){return o&&d.iconMap[o]||null}};return e.watch(()=>s.menuId,o=>{s.config||m.loadConfig(o)}),e.watch(()=>s.activePath,o=>{d.activePath=o||""}),e.watch(()=>s.config,o=>{o&&(d.config=o,d.menus=m.normalizeMenus(o.menus))}),e.onMounted(()=>{m.init()}),a({loadConfig:m.loadConfig,setActivePath:m.setActivePath}),(o,l)=>{const i=C.ElIcon,u=C.ElMenuItem,f=C.ElSubMenu,p=C.ElMenu,h=C.ElButton;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-menu",[`u-menu--${r.value.mode}`,{"u-menu--no-brand":!r.value.projectName}]]),style:e.normalizeStyle(r.value.isHorizontal?{}:{width:r.value.width+"px"})},[r.value.projectName?(e.openBlock(),e.createElementBlock("div",Ee,[e.renderSlot(o.$slots,"brand",{projectName:r.value.projectName,mode:r.value.mode},()=>[r.value.logo?(e.openBlock(),e.createElementBlock("img",{key:0,class:"u-menu-logo",src:r.value.logo,alt:"logo"},null,8,De)):e.createCommentVNode("",!0),e.createElementVNode("span",Te,e.toDisplayString(r.value.projectName),1)],!0)])):e.createCommentVNode("",!0),e.createVNode(p,{class:"u-menu-list",mode:r.value.elMode,"default-active":r.value.activeIndex,"unique-opened":!r.value.isHorizontal,onSelect:m.handleSelect},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value.menus,(g,y)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:m.itemIndex(g,y)},[m.hasChildren(g)?(e.openBlock(),e.createBlock(f,{key:0,index:m.itemIndex(g,y)},{title:e.withCtx(()=>[e.renderSlot(o.$slots,"menu-title",{item:g,level:1,index:y},()=>[m.getIcon(g.icon)?(e.openBlock(),e.createBlock(i,{key:0,class:"u-menu-icon"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m.getIcon(g.icon))))]),_:2},1024)):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(g.label),1)],!0)]),default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.children,(x,$)=>(e.openBlock(),e.createBlock(u,{key:m.childIndex(g,y,x,$),index:m.childIndex(g,y,x,$)},{default:e.withCtx(()=>[e.renderSlot(o.$slots,"menu-item",{item:x,level:2,index:$,parent:g},()=>[m.getIcon(x.icon)?(e.openBlock(),e.createBlock(i,{key:0,class:"u-menu-icon"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m.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(u,{key:1,index:m.itemIndex(g,y)},{default:e.withCtx(()=>[e.renderSlot(o.$slots,"menu-item",{item:g,level:1,index:y,parent:null},()=>[m.getIcon(g.icon)?(e.openBlock(),e.createBlock(i,{key:0,class:"u-menu-icon"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m.getIcon(g.icon))))]),_:2},1024)):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(g.label),1)],!0)]),_:2},1032,["index"]))],64))),128))]),_:3},8,["mode","default-active","unique-opened","onSelect"]),r.value.showLogout?(e.openBlock(),e.createElementBlock("div",Pe,[e.renderSlot(o.$slots,"logout",{mode:r.value.mode},()=>[e.createVNode(h,{class:"u-menu-logout-btn",text:"",onClick:m.handleLogout},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.value.logoutText),1)]),_:1},8,["onClick"])],!0)])):e.createCommentVNode("",!0)],6)}}}),[["__scopeId","data-v-fe63251c"]]),$e={class:"form-content"},Ne={key:1,class:"form-layout"},Re={key:0,class:"form-header"},Ae={class:"title"},Ie={class:"form-body"},Me={key:1,class:"form-footer"},Ue=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,s=a,{visible:c}=e.toRefs(t),d=e.computed(()=>t.layout.open==="normal"),r=e.computed(()=>t.layout.width||400),m={handleClose(){s("update:visible",!1),s("close")},handleClosed(){s("closed")},updateVisible(o){s("update:visible",o)}};return(o,l)=>{const i=C.ElIcon,u=C.ElDialog;return d.value?e.unref(c)?(e.openBlock(),e.createElementBlock("div",Ne,[n.title?(e.openBlock(),e.createElementBlock("div",Re,[e.createElementVNode("div",Ae,e.toDisplayString(n.title),1)])):e.createCommentVNode("",!0),e.createElementVNode("div",Ie,[n.loading?(e.openBlock(),e.createBlock(i,{key:0,class:"is-loading",size:40},{default:e.withCtx(()=>[e.createVNode(e.unref(te.Loading))]),_:1})):e.renderSlot(o.$slots,"default",{},void 0,!0,1)]),o.$slots.actions?(e.openBlock(),e.createElementBlock("div",Me,[e.renderSlot(o.$slots,"actions",{},void 0,!0)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(u,{key:0,"model-value":e.unref(c),title:n.title,width:r.value,"close-on-click-modal":!1,"onUpdate:modelValue":m.updateVisible,onClose:m.handleClose,onClosed:m.handleClosed},{footer:e.withCtx(()=>[e.renderSlot(o.$slots,"actions",{},void 0,!0)]),default:e.withCtx(()=>[e.createElementVNode("div",$e,[n.loading?(e.openBlock(),e.createBlock(i,{key:0,class:"is-loading",size:40},{default:e.withCtx(()=>[e.createVNode(e.unref(te.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"]]),ze=k(e.defineComponent({__name:"FormGrid",props:{fields:{},layout:{}},setup(n){const a=n,t=e.reactive({columns:e.computed(()=>a.layout.columns||1)}),s={getColSpan(c){const d=c.colSpan||1;return Math.min(d,t.columns)}};return(c,d)=>(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,r=>(e.openBlock(),e.createElementBlock("div",{key:r.field,class:"form-grid-item",style:e.normalizeStyle({gridColumn:`span ${s.getColSpan(r)}`})},[e.renderSlot(c.$slots,"default",{field:r},void 0,!0)],4))),128))],4))}}),[["__scopeId","data-v-90ed35a4"]]),Fe={class:"form-field"},Le=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,s=a,c=e.reactive({componentMap:e.markRaw({input:N,"input-number":Q,dict:A,switch:H,cascader:G,date:z}),cascaderOptions:[]}),d=()=>{t.field.cascaderKey&&V.get(D.cascaderApi(t.field.cascaderKey)).then(i=>{i.status===200&&(c.cascaderOptions=q(i.data))})};e.watch(()=>t.field.cascaderKey,d,{immediate:!0});const r=e.computed(()=>c.componentMap[t.field.type]||N),m=e.computed(()=>{if((t.layout.labelPosition||"top")==="left"){const u=t.layout.labelWidth||0,f=typeof u=="number"?u+4:u;return{marginLeft:typeof f=="number"?`${f}px`:f}}return{}}),o=e.computed(()=>{const{field:i,modelValue:u,layout:f,disabled:p}=t;let h=u;i.type==="switch"&&u==null&&(h=!1);const g={fieldLabel:i.label,modelValue:h,labelPosition:f.labelPosition||"top",disable:p,name:i.field,required:i.required};if(f.labelWidth&&(g.labelWidth=f.labelWidth),f.labelAlign&&(g.labelAlign=f.labelAlign),i.maxlength&&(g.maxlength=i.maxlength),i.placeholder&&(g.placeholder=i.placeholder),i.readonly&&(g.readonly=i.readonly),i.lineCount&&i.lineCount>=2?(g.type="textarea",g.rows=i.lineCount):i.inputType&&(g.type=i.inputType),i.type==="switch"&&(i.activeText&&(g.activeText=i.activeText),i.inactiveText&&(g.inactiveText=i.inactiveText),i.activeColor&&(g.activeColor=i.activeColor),i.inactiveColor&&(g.inactiveColor=i.inactiveColor),i.trueValue!==void 0&&(g.trueValue=i.trueValue),i.falseValue!==void 0&&(g.falseValue=i.falseValue)),i.dictType&&(g.dictType=i.dictType),i.cascaderKey&&(g.options=c.cascaderOptions,g.depth=i.cascaderDepth||2),i.type==="date"){i.mode&&(g.mode=i.mode),i.locale&&(g.locale=i.locale),i.format?g.mask=i.format:i.mask&&(g.mask=i.mask);const y=i.dateMin??i.min,x=i.dateMax??i.max;y!=null&&(g.min=y),x!=null&&(g.max=x)}return i.type==="input-number"&&(i.min!==void 0&&(g.min=i.min),i.max!==void 0&&(g.max=i.max),i.step&&(g.step=i.step),i.precision!==void 0&&(g.precision=i.precision)),g}),l={handleUpdate(i){s("update:modelValue",i)}};return(i,u)=>(e.openBlock(),e.createElementBlock("div",Fe,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),e.mergeProps(o.value,{"onUpdate:modelValue":l.handleUpdate}),null,16,["onUpdate:modelValue"])),e.createElementVNode("div",{class:e.normalizeClass(["field-error",{"field-error--visible":n.error}]),style:e.normalizeStyle(m.value)},e.toDisplayString(n.error||""),7)]))}}),[["__scopeId","data-v-10299c8d"]]);class qe{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 We=class{constructor(){w(this,"data",e.reactive(new qe))}parseQuery(a){if(!a)return{};const t={},s=a.split("&");for(const c of s){const[d,r]=c.split("=");d&&(t[d]=r||"")}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 s=t?`${a}?${t}`:a,c=await V.get(s);if(c.status!==200)throw new Error(c.message||"获取表单数据失败");return c.data}async submitForm(a,t){return await V.post(a,t)}buildInitialData(a){const t={};for(const s of a)s.default!==void 0?t[s.field]=s.default:t[s.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 s of a){const c=this.data.formData[s.field];if(s.required&&(c==null||c==="")){this.data.errors.push({field:s.field,message:`${s.label}为必填项`});continue}if(s.rules&&s.rules.length>0&&c){for(const d of s.rules)if(d.pattern&&!new RegExp(d.pattern).test(c)){this.data.errors.push({field:s.field,message:d.message||`${s.label}格式不正确`});break}}}return this.data.errors.length===0}getFieldError(a){const t=this.data.errors.find(s=>s.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 s=await this.fetchFormConfig(a);if(this.data.formConfig=s,this.data.isEditMode=this.checkIsEditMode(t||""),this.data.formData=this.buildInitialData(s.fields),this.data.isEditMode&&s.api.get&&t){const c=await this.fetchFormData(s.api.get,t),d=this.nestedToFlat(c);this.data.formData={...this.data.formData,...d}}}catch(s){throw console.error("[FormRender] 打开表单失败:",s),this.data.visible=!1,s}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 s={...this.data.formData};s=this.flattenToNested(s),this.data.isEditMode&&this.data.currentQuery.id&&(s.id=Number(this.data.currentQuery.id)),this.data.submitting=!0;try{const c=await this.submitForm(t,s);if(c.status===200)return c.data;throw new Error(c.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 s in a){const c=a[s];if(s.includes(".")){const d=s.split(".");let r=t;for(let m=0;m<d.length-1;m++){const o=d[m];r[o]||(r[o]={}),r=r[o]}r[d[d.length-1]]=c}else t[s]=c}return t}nestedToFlat(a,t=""){const s={};for(const c in a){const d=a[c],r=t?`${t}.${c}`:c;d&&typeof d=="object"&&!Array.isArray(d)?Object.keys(d).length===2&&"from"in d&&"to"in d?s[r]=d:Object.assign(s,this.nestedToFlat(d,r)):s[r]=d}return s}};const J=k(e.defineComponent({__name:"FormRender",setup(n,{expose:a}){const t=new We,s=e.ref(null),c=e.reactive({currentQuery:{},submitResolve:null}),d=e.computed(()=>{var p;const f={};if(!t.data.isEditMode||!c.currentQuery)return f;for(const h of((p=t.data.formConfig)==null?void 0:p.fields)||[])c.currentQuery[h.field]!==void 0&&(f[h.field]=!0);return f}),r=e.computed(()=>{var f;return((f=t.data.formConfig)==null?void 0:f.layout)||{open:"dialog",columns:1,labelPosition:"top",buttonAlign:"right"}}),m=e.computed(()=>{var f;return((f=t.data.formConfig)==null?void 0:f.fields)||[]}),o=e.computed(()=>{var f,p;return((p=(f=t.data.formConfig)==null?void 0:f.meta)==null?void 0:p.title)||"表单"}),l=e.computed(()=>r.value.buttonAlign||"right"),i=e.computed(()=>r.value.open==="normal"),u={async showForm(f,p){c.currentQuery=t.parseQuery(p||"");try{await t.openForm(f,p)}catch(h){return _((h==null?void 0:h.message)||"打开表单失败"),null}return new Promise(h=>{c.submitResolve=h})},async handleSubmit(){var f,p;try{const h=await t.doSubmit(),g=((p=(f=t.data.formConfig)==null?void 0:f.meta)==null?void 0:p.title)+"保存成功";return E.success(g),c.submitResolve&&(c.submitResolve(h),c.submitResolve=null),i.value||t.closeForm(),h}catch(h){return c.submitResolve&&(c.submitResolve(null),c.submitResolve=null),h!=null&&h.message&&h.message!=="请完善表单信息"&&_(h.message),null}},resolvePending(){c.submitResolve&&(c.submitResolve(null),c.submitResolve=null)},handleCancel(){i.value||(u.resolvePending(),t.closeForm())},getFieldError(f){return t.getFieldError(f)},handleClose(){u.resolvePending(),t.closeForm()},handleClosed(){t.data.visible||t.resetForm()}};return a({showForm:u.showForm}),(f,p)=>{const h=C.ElForm,g=C.ElButton;return e.openBlock(),e.createBlock(Ue,{visible:e.unref(t).data.visible,"onUpdate:visible":p[0]||(p[0]=y=>e.unref(t).data.visible=y),layout:r.value,title:o.value,loading:e.unref(t).data.loading,onClose:u.handleClose,onClosed:u.handleClosed},{actions:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["form-actions",l.value==="right"?"justify-end":"justify-start"])},[e.createVNode(g,{onClick:u.handleCancel},{default:e.withCtx(()=>[...p[1]||(p[1]=[e.createTextVNode("取消",-1)])]),_:1},8,["onClick"]),e.createVNode(g,{type:"primary",loading:e.unref(t).data.submitting,onClick:u.handleSubmit},{default:e.withCtx(()=>[...p[2]||(p[2]=[e.createTextVNode("提交",-1)])]),_:1},8,["loading","onClick"])],2)]),default:e.withCtx(()=>[e.createVNode(h,{ref_key:"formRef",ref:s,class:"form-render","label-position":"top"},{default:e.withCtx(()=>[e.createVNode(ze,{fields:m.value,layout:r.value},{default:e.withCtx(({field:y})=>[e.createVNode(Le,{modelValue:e.unref(t).data.formData[y.field],"onUpdate:modelValue":x=>e.unref(t).data.formData[y.field]=x,field:y,layout:r.value,disabled:d.value[y.field],error:u.getFieldError(y.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 Oe{constructor(a){this.config=a}async fetchList(a,t){const s={page:t.page,pageSize:t.pageSize,...a},c={};for(const o in s){const l=s[o];l!==""&&l!==null&&l!==void 0&&(c[o]=l)}const d=new URLSearchParams;for(const o in c)d.append(o,String(c[o]));const r=`${this.config.api.list}${d.toString()?"?"+d.toString():""}`,m=await V.get(r);if(m.status===200){const o=m.data;return Array.isArray(o)?{rows:o,total:o.length}:o||{rows:[],total:0}}throw new Error(m.message||"获取列表数据失败")}async deleteRow(a){if(!this.config.api.delete)throw new Error("未配置删除API");const t=this.config.key||"id",s=a[t],c=`${this.config.api.delete}?${encodeURIComponent(t)}=${encodeURIComponent(String(s??""))}`,d=await V.post(c);if(d.status!==200)throw new Error(d.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 s=(await V.post(this.config.api.export,a,{responseType:"blob"})).data,c=window.URL.createObjectURL(s),d=document.createElement("a");d.href=c,d.download=`export_${Date.now()}.xlsx`,d.click(),window.URL.revokeObjectURL(c)}async downloadTemplate(){if(!this.config.api.import)throw new Error("未配置导入API");const t=(await V.get(`${this.config.api.import}/template`,{responseType:"blob"})).data,s=window.URL.createObjectURL(t),c=document.createElement("a");c.href=s,c.download=`template_${Date.now()}.xlsx`,c.click(),window.URL.revokeObjectURL(s)}async importData(a){if(!this.config.api.import)throw new Error("未配置导入API");const t=new FormData;t.append("file",a);const s=await V.post(this.config.api.import,t,{headers:{"Content-Type":"multipart/form-data"}});if(s.status!==200)throw new Error(s.message||"导入失败");return s.data}}class je{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 Ye=class{constructor(){w(this,"data",e.reactive(new je));w(this,"dataService",null)}async loadConfig(a){var c;const t=D.formCfgApi(a,"tables");console.log("load config url =",t);const s=await V.get(t);if(console.log("---"),s.status!==200)throw new Error(s.message||"获取表格配置失败");this.data.tableConfig=s.data,this.dataService=new Oe(s.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:(c=this.data.tableConfig)==null?void 0:c.detail}),this.initSearchParams()}initSearchParams(){var s;const a={},t=((s=this.data.tableConfig)==null?void 0:s.search)||[];for(const c of t)a[c.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 s=this.getKeyField(),c=d=>d&&this.data.rows.find(r=>r[s]===d[s])||null;this.data.currentRow=c(a),this.data.detailData&&(this.data.detailData=c(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,s;const a=(s=(t=this.data.tableConfig)==null?void 0:t.detail)==null?void 0:s.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 Qe={class:"table-search"},Ke={class:"search-fields"},He={class:"search-actions"},Ge=k(e.defineComponent({__name:"TableSearch",props:{fields:{},modelValue:{}},emits:["update:modelValue","search","reset"],setup(n,{emit:a}){const t=n,s=a,c={input:N,dict:A,dept:A,role:A,date:z,daterange:z},d={getComponent(r){return c[r]||N},updateValue(r,m){const o={...t.modelValue,[r]:m};s("update:modelValue",o)},handleSearch(){const r={};for(const m in t.modelValue){const o=t.modelValue[m];r[m]=typeof o=="string"?o.trim():o}s("update:modelValue",r),s("search")},handleReset(){s("reset")}};return(r,m)=>{const o=C.ElButton;return e.openBlock(),e.createElementBlock("div",Qe,[e.createElementVNode("div",Ke,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.fields,l=>(e.openBlock(),e.createElementBlock("div",{key:l.field,class:"search-field"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d.getComponent(l.type)),{"model-value":t.modelValue[l.field],"field-label":l.label,"dict-type":l.dictType,mode:l.type==="daterange"?"range":void 0,"label-position":"left","onUpdate:modelValue":i=>d.updateValue(l.field,i)},null,8,["model-value","field-label","dict-type","mode","onUpdate:modelValue"]))]))),128)),e.renderSlot(r.$slots,"search-extra",{params:t.modelValue,update:d.updateValue},void 0,!0)]),e.createElementVNode("div",He,[e.createVNode(o,{type:"primary",onClick:d.handleSearch},{default:e.withCtx(()=>[...m[0]||(m[0]=[e.createTextVNode("查询",-1)])]),_:1},8,["onClick"]),e.createVNode(o,{onClick:d.handleReset},{default:e.withCtx(()=>[...m[1]||(m[1]=[e.createTextVNode("重置",-1)])]),_:1},8,["onClick"]),e.renderSlot(r.$slots,"search-actions",{params:t.modelValue,search:d.handleSearch,reset:d.handleReset},void 0,!0)])])}}}),[["__scopeId","data-v-0281d2ce"]]),Je={class:"table-toolbar"},Xe={class:"toolbar-items"},Ze={key:1},ve=k(e.defineComponent({__name:"TableToolbar",props:{items:{},currentRow:{}},emits:["action"],setup(n,{emit:a}){const t=n,s=a,c=e.reactive({iconMap:{}}),d=e.computed(()=>({hasCurrentRow:!!t.currentRow})),r={needRow(m){return m==="edit"||m==="delete"||m==="preview"},getText(m){return m.text?m.text:{add:"新增",edit:"编辑",delete:"删除",preview:"预览",back:"返回"}[m.action]||""},getButtonType(m){return m.style?m.style==="default"?"":m.style:{add:"primary",edit:"primary",delete:"danger",preview:"primary",back:"primary"}[m.action]||""},isDisabled(m){return m.disabled?!0:r.needRow(m.action)&&!d.value.hasCurrentRow},getIcon(m){return m.icon?c.iconMap[m.icon]:null},handleClick(m){s("action",{action:m.action,item:m,row:t.currentRow})},async ensureIcons(){const m=[...new Set(t.items.map(i=>i.icon).filter(Boolean))];if(m.length===0)return;const o=await import("@element-plus/icons-vue"),l={...c.iconMap};for(const i of m)o[i]&&(l[i]=e.markRaw(o[i]));c.iconMap=e.markRaw(l)}};return e.onMounted(()=>{r.ensureIcons()}),e.watch(()=>t.items,()=>{r.ensureIcons()}),(m,o)=>{const l=C.ElIcon,i=C.ElButton;return e.openBlock(),e.createElementBlock("div",Je,[e.renderSlot(m.$slots,"toolbar-left",{currentRow:t.currentRow},void 0,!0),e.createElementVNode("div",Xe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,(u,f)=>(e.openBlock(),e.createBlock(i,{key:f,type:r.getButtonType(u),disabled:r.isDisabled(u),onClick:p=>r.handleClick(u)},{default:e.withCtx(()=>[r.getIcon(u)?(e.openBlock(),e.createBlock(l,{key:0},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.getIcon(u))))]),_:2},1024)):e.createCommentVNode("",!0),r.getText(u)?(e.openBlock(),e.createElementBlock("span",Ze,e.toDisplayString(r.getText(u)),1)):e.createCommentVNode("",!0)]),_:2},1032,["type","disabled","onClick"]))),128))]),e.renderSlot(m.$slots,"toolbar-extra",{currentRow:t.currentRow},void 0,!0)])}}}),[["__scopeId","data-v-0538c013"]]),et=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)),s=e.computed(()=>a.multiline||t.value.includes(`
|
|
2
|
+
`)),c=e.computed(()=>a.maxLines>0&&s.value?{display:"-webkit-box",WebkitLineClamp:a.maxLines,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis"}:{});return(d,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-input-show",{"u-input-multiline":s.value}]),style:e.normalizeStyle(c.value)},e.toDisplayString(t.value),7))}}),[["__scopeId","data-v-c78b151e"]]),tt=k(e.defineComponent({__name:"UDictShow",props:{modelValue:{},dictType:{},defaultText:{default:""}},setup(n){const a=n,t=e.ref(""),s=e.ref(!1),c=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}s.value=!0;try{const d=await ae(a.dictType,a.modelValue,a.defaultText);t.value=d}catch(d){console.error("[UDictShow] 翻译失败:",d),t.value=String(a.modelValue)}finally{s.value=!1}};return e.watch(()=>a.modelValue,c,{immediate:!0}),e.watch(()=>a.dictType,()=>{a.dictType&&R(a.dictType).then(()=>c())}),e.onMounted(()=>{a.dictType?R(a.dictType).then(()=>c()):c()}),(d,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-dict-show",{"u-dict-loading":s.value}])},e.toDisplayString(t.value),3))}}),[["__scopeId","data-v-908045c4"]]),at=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),s=e.computed(()=>a.useYesNo?"否":a.falseText),c=e.computed(()=>a.modelValue===!0||a.modelValue==="true"?t.value:a.modelValue===!1||a.modelValue==="false"?s.value:String(a.modelValue??"")),d=e.computed(()=>a.modelValue===!0||a.modelValue==="true"?"toggle-true":a.modelValue===!1||a.modelValue==="false"?"toggle-false":"toggle-default");return(r,m)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-toggle-show",d.value])},e.toDisplayString(c.value),3))}}),[["__scopeId","data-v-bac05efc"]]),ot=k(e.defineComponent({__name:"UCascaderShow",props:{modelValue:{},cascaderKey:{},separator:{default:" / "},showRawValue:{type:Boolean,default:!0}},setup(n){const a=n,t=e.ref(""),s=e.ref(!1),c=async()=>{if(!a.modelValue||!Array.isArray(a.modelValue)){t.value="";return}const d=a.modelValue;if(a.cascaderKey){s.value=!0;try{const r=await R(a.cascaderKey),o=d.map(l=>{const i=r.find(u=>u.value===l||String(u.value)===String(l));return i?i.label:a.showRawValue?String(l):""}).filter(l=>l!=="");t.value=o.join(a.separator)}catch(r){console.error("[UCascaderShow] 翻译失败:",r),t.value=a.showRawValue?d.join(a.separator):""}finally{s.value=!1}}else t.value=d.join(a.separator)};return e.watch(()=>a.modelValue,c,{immediate:!0}),e.onMounted(()=>{c()}),(d,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-cascader-show",{"u-cascader-loading":s.value}])},e.toDisplayString(t.value),3))}}),[["__scopeId","data-v-5d84df67"]]),nt=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),s=e.computed(()=>{const r=a.modelValue;return a.mode==="single"?r?c(r,a.format):"":a.mode==="multiple"?r?Array.isArray(r)?r.map(m=>c(m,a.format)).join(t.value):String(r):"":a.mode==="range"?r?typeof r=="object"&&r.from&&r.to?`${c(r.from,a.format)}${t.value}${c(r.to,a.format)}`:Array.isArray(r)&&r.length>=2?`${c(r[0],a.format)}${t.value}${c(r[1],a.format)}`:String(r):"":String(r??"")});function c(r,m){return r||""}const d=e.computed(()=>!s.value);return(r,m)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-date-show",{"u-date-empty":d.value}])},e.toDisplayString(s.value||(n.locale==="en-US"?"Empty":"暂无")),3))}}),[["__scopeId","data-v-930657df"]]),O=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 r=a.text.split("/");return r.length>=2?{trueText:r[0].trim(),falseText:r[1].trim()}:null}),s=e.computed(()=>{var r;return a.trueText||((r=t.value)==null?void 0:r.trueText)||"开启"}),c=e.computed(()=>{var r;return a.falseText||((r=t.value)==null?void 0:r.falseText)||"关闭"}),d=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(r,m)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d.value==="UDictShow"?tt:d.value==="UToggleShow"?at:d.value==="UCascaderShow"?ot:d.value==="UDateShow"?nt:et),{"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"?s.value:void 0,"false-text":n.type==="switch"?c.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-05ef52d9"]]),lt={class:"table-grid"},X="col-",it=160,st=k(e.defineComponent({inheritAttrs:!1,__name:"TableGrid",props:{rows:{},columns:{},loading:{type:Boolean},actions:{},actionsWidth:{},keyField:{},selection:{type:[String,Boolean]},dictData:{},activeKey:{}},emits:["rowAction","rowClick","selectionChange"],setup(n,{emit:a}){const t=n,s=e.useSlots(),c=a;function d(l){return l==="actions"||l==="actions-extra"||l.startsWith(X)}const r=e.computed(()=>{var l,i;return{actionList:t.actions||[],actionColumnWidth:t.actionsWidth??((l=t.actions)!=null&&l.length?o.getActionColumnWidth():it),hasUserEmpty:!!s.empty,forwardSlots:Object.keys(s).filter(u=>u!=="default"&&!d(u)),colSlots:Object.keys(s).filter(u=>u.startsWith(X)),hasActionsSlot:!!s.actions,hasActionsExtra:!!s["actions-extra"],showActionColumn:(((i=t.actions)==null?void 0:i.length)||0)>0||!!s.actions||!!s["actions-extra"]}}),m=e.computed(()=>{const l=t.columns.map(i=>{const u={prop:i.field,label:i.label};return typeof i.width=="number"&&(u.width=i.width),u});return r.value.showActionColumn&&l.push({prop:"actions",label:"操作",width:r.value.actionColumnWidth,fixed:"right"}),l}),o={colSlotName(l){return X+l},hasColSlot(l){return r.value.colSlots.includes(o.colSlotName(l))},actionText(l){return l.text?l.text:{add:"新增",edit:"编辑",delete:"删除",preview:"预览",back:"返回"}[l.action]||""},actionType(l){return l.style?l.style==="default"?"":l.style:{add:"primary",edit:"primary",delete:"danger",preview:"primary",back:"primary"}[l.action]||"primary"},getActionColumnWidth(){const i=(t.actions||[]).reduce((u,f)=>u+Math.max(52,o.actionText(f).length*16+12),0);return Math.max(80,Math.ceil(i)+16)},maskPhone(l){return!l||l.length<7?l:l.replace(/(\d{3})\d{4}(\d{4})/,"$1****$2")},maskIdCard(l){return!l||l.length<8?l:l.replace(/(\d{3})\d{11}(\d{4})/,"$1***********$2")},formatMoney(l){const i=Number(l);return isNaN(i)?String(l):i.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})},formatByType(l,i){if(!l)return"";switch(i){case"phone":return o.maskPhone(l);case"idcard":return o.maskIdCard(l);case"money":return o.formatMoney(l);case"percent":return String(l*100)+"%";default:return i&&i.includes("{}")?i.replace("{}",String(l)):String(l)}},getNestedValue(l,i){if(!i.includes("."))return l[i];const u=i.split(".");let f=l;for(const p of u)if(f&&typeof f=="object"&&p in f)f=f[p];else return;return f},useFieldView(l){return l.type?["dict","switch","cascader","date","input","text"].includes(l.type):!1},rowClassName({row:l}){if(!l||t.activeKey===void 0||t.activeKey===null)return"";const i=t.keyField||"id";return l[i]===t.activeKey?"table-grid-active-row":""},onSelectionChange(l){c("selectionChange",l)},onRowClick(l){c("rowClick",l)},onRowAction(l,i){c("rowAction",{action:l.action,item:l,row:i})}};return(l,i)=>{const u=C.ElTableColumn,f=C.ElButton,p=C.ElTable;return e.openBlock(),e.createElementBlock("div",lt,[e.createVNode(p,e.mergeProps({stripe:!0,border:!0,...l.$attrs},{data:t.rows.length?t.rows:[{}],loading:t.loading,"row-key":t.keyField||"id","row-class-name":o.rowClassName,onSelectionChange:o.onSelectionChange,onRowClick:i[0]||(i[0]=h=>o.onRowClick(h))}),e.createSlots({default:e.withCtx(()=>[t.selection?(e.openBlock(),e.createBlock(u,{key:0,type:"selection",width:"55"})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,h=>(e.openBlock(),e.createBlock(u,{key:h.prop,prop:h.prop,label:h.label,width:h.width,fixed:h.fixed},{default:e.withCtx(({row:g})=>[Object.keys(g).length>0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[h.prop==="actions"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[r.value.hasActionsSlot?e.renderSlot(l.$slots,"actions",{row:g,actions:r.value.actionList},void 0,!0,1):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(r.value.actionList,(y,x)=>(e.openBlock(),e.createBlock(f,{key:x,link:"",type:o.actionType(y),disabled:y.disabled===!0,size:"small",onClick:e.withModifiers($=>o.onRowAction(y,g),["stop"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.actionText(y)),1)]),_:2},1032,["type","disabled","onClick"]))),128)),e.renderSlot(l.$slots,"actions-extra",{row:g},void 0,!0)],64)):o.hasColSlot(h.prop)?e.renderSlot(l.$slots,o.colSlotName(h.prop),{row:g,value:o.getNestedValue(g,h.prop),column:h},void 0,!0,1):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:2},e.renderList(t.columns,y=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:y.field},[y.field===h.prop&&o.useFieldView(y)?(e.openBlock(),e.createBlock(O,{key:0,type:y.type,"model-value":o.getNestedValue(g,y.field),"dict-type":y.dictType,mode:y.mode,locale:y.locale,format:y.format,text:y.text,"true-text":y.trueText,"false-text":y.falseText,"use-yes-no":y.useYesNo,"cascader-key":y.cascaderKey,multiline:y.multiline,"default-text":y.defaultText},null,8,["type","model-value","dict-type","mode","locale","format","text","true-text","false-text","use-yes-no","cascader-key","multiline","default-text"])):y.field===h.prop?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass({"table-grid-format":y.format})},e.toDisplayString(o.formatByType(o.getNestedValue(g,y.field),y.format||"")),3)):e.createCommentVNode("",!0)],64))),128))],64)):e.createCommentVNode("",!0)]),_:2},1032,["prop","label","width","fixed"]))),128)),e.renderSlot(l.$slots,"default",{},void 0,!0)]),_:2},[e.renderList(r.value.forwardSlots,h=>({name:h,fn:e.withCtx(g=>[e.renderSlot(l.$slots,h,e.normalizeProps(e.guardReactiveProps(g||{})),void 0,!0)])})),r.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-d3eed11d"]]),rt={class:"table-pagination"},ct={class:"page-size-select"},dt={class:"total-text"},mt={key:1,class:"load-more"},ut={key:2,class:"total-text"},pt=k(e.defineComponent({__name:"TablePagination",props:{page:{},pageSize:{},total:{},type:{}},emits:["update:page","update:pageSize"],setup(n,{emit:a}){const t=n,s=a,c=e.computed(()=>({totalPages:Math.ceil(t.total/t.pageSize),showPagination:t.type==="page"&&t.total>0})),d={onPageChange:r=>{s("update:page",r)},onPageSizeChange:r=>{s("update:pageSize",r)}};return(r,m)=>{const o=C.ElPagination,l=C.ElOption,i=C.ElSelect,u=C.ElButton;return e.openBlock(),e.createElementBlock("div",rt,[c.value.showPagination?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(o,{"current-page":t.page,"page-count":c.value.totalPages,"page-sizes":[10,20,50,100],"page-size":t.pageSize,layout:"total, prev, pager, next, jumper",onCurrentChange:d.onPageChange,onSizeChange:d.onPageSizeChange},null,8,["current-page","page-count","page-size","onCurrentChange","onSizeChange"]),e.createElementVNode("div",ct,[e.createVNode(i,{"model-value":t.pageSize,style:{width:"100px"},onChange:d.onPageSizeChange},{default:e.withCtx(()=>[e.createVNode(l,{value:10,label:"10条/页"}),e.createVNode(l,{value:20,label:"20条/页"}),e.createVNode(l,{value:50,label:"50条/页"}),e.createVNode(l,{value:100,label:"100条/页"})]),_:1},8,["model-value","onChange"]),e.createElementVNode("span",dt,"共 "+e.toDisplayString(t.total)+" 条",1)])],64)):t.type==="auto"?(e.openBlock(),e.createElementBlock("div",mt,[e.createVNode(u,{disabled:t.page*t.pageSize>=t.total},{default:e.withCtx(()=>[...m[0]||(m[0]=[e.createTextVNode("加载更多",-1)])]),_:1},8,["disabled"])])):t.type==="all"?(e.openBlock(),e.createElementBlock("div",ut,"共 "+e.toDisplayString(t.total)+" 条",1)):e.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-2ca77d18"]]),ft={class:"table-detail"},ht={key:0,class:"detail-header"},gt={class:"detail-title"},yt={class:"detail-body"},bt={key:0,class:"detail-status"},wt={key:1,class:"detail-content"},Ct={class:"detail-label"},kt={class:"detail-value"},xt={key:2,class:"detail-status"},Z=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(),s=e.computed(()=>!!t["detail-extra"]),c=e.computed(()=>s.value),d=e.computed(()=>!s.value||a.extraMode==="append"),r=e.computed(()=>({showHeader:a.showHeader!==!1,title:a.title||"详情",emptyText:a.emptyText||"暂无数据",hasRow:!!a.rowData})),m={getNestedValue(o,l){if(!o||!l)return"";if(!l.includes("."))return o[l];const i=l.split(".");let u=o;for(const f of i)if(u&&typeof u=="object"&&f in u)u=u[f];else return"";return u}};return(o,l)=>(e.openBlock(),e.createElementBlock("div",ft,[r.value.showHeader?(e.openBlock(),e.createElementBlock("div",ht,[e.createElementVNode("div",gt,e.toDisplayString(r.value.title),1)])):e.createCommentVNode("",!0),e.createElementVNode("div",yt,[d.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[a.loading?(e.openBlock(),e.createElementBlock("div",bt,"加载中...")):r.value.hasRow?(e.openBlock(),e.createElementBlock("div",wt,[(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",Ct,e.toDisplayString(i.label),1),e.createElementVNode("div",kt,[e.createVNode(O,{type:i.type,"model-value":m.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",xt,e.toDisplayString(r.value.emptyText),1))],64)):e.createCommentVNode("",!0),c.value?e.renderSlot(o.$slots,"detail-extra",{rowData:a.rowData,columns:a.columns},void 0,!0,1):e.createCommentVNode("",!0)])]))}}),[["__scopeId","data-v-7e47b0ba"]]),St={class:"table-body"},Bt={class:"table-container"},ne=k(e.defineComponent({inheritAttrs:!1,__name:"TableRender",props:{formId:{},detailExtraMode:{}},emits:["back","toolbar-action","row-action"],setup(n,{expose:a,emit:t}){const s=["search-extra","search-actions","toolbar-left","toolbar-extra","detail-extra"],c=n,d=e.useAttrs(),r=e.useSlots(),m=t,o=new Ye,l=e.ref(null),i=e.reactive({searchParams:{},loaded:!1,dictData:{}});e.onMounted(async()=>{c.formId&&await f.loadConfig(c.formId)});const u=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:p,style:h,...g}=d;return g},getTableSlots(){const p={};for(const h of Object.keys(r))s.includes(h)||(p[h]=!0);return p},getDetailSlots(){return r["detail-extra"]?["detail-extra"]:[]},getDetailExtraMode(){return c.detailExtraMode==="append"?"append":"replace"},async loadConfig(p){try{await o.loadConfig(p)}catch(h){_((h==null?void 0:h.message)||"获取表格配置失败");return}i.searchParams={...o.data.searchParams},i.loaded=!0,await f.loadDictData(),await f.handleLoadData()},async handleLoadData(){try{await o.loadData()}catch(p){_((p==null?void 0:p.message)||"加载数据失败")}},async loadDictData(){const p=o.getColumns(),h=new Set;for(const g of p)g.type==="dict"&&g.dictType&&h.add(g.dictType);for(const g of h)try{const y=await V.get(D.dictApi(g));y.status===200&&(i.dictData[g]=W(y.data))}catch(y){console.error(`[TableRender] 加载字典 ${g} 失败:`,y)}},async handleSearch(){o.data.searchParams={...i.searchParams};try{await o.search()}catch(p){_((p==null?void 0:p.message)||"查询失败")}},async handleReset(){i.searchParams={};try{await o.reset()}catch(p){_((p==null?void 0:p.message)||"重置失败")}},updateSearchParam(p,h){i.searchParams[p]=h},async handlePageChange(p){try{await o.changePage(p)}catch(h){_((h==null?void 0:h.message)||"加载数据失败")}},async handlePageSizeChange(p){try{await o.changePageSize(p)}catch(h){_((h==null?void 0:h.message)||"加载数据失败")}},handleRowClick(p){o.setCurrentRow(p)},handleDetailClose(){o.closeDetail()},handleDetailClosed(){o.resetDetail()},handlePreviewClose(){o.closePreview()},handlePreviewClosed(){o.resetPreview()},handlePreview(p){if(!p){E.warning("请先点击表格中的一行数据");return}o.openPreview(p)},handleToolbarAction(p){m("toolbar-action",p),f.dispatchAction(p)},handleRowAction(p){m("row-action",p),f.dispatchAction(p)},async dispatchAction(p){switch(p.action){case"add":await f.handleAdd(p.item);break;case"edit":await f.handleEdit(p.row,p.item);break;case"delete":await f.handleDelete(p.row,p.item);break;case"preview":f.handlePreview(p.row);break;case"back":m("back",p);break;case"export":await f.handleExport();break;default:await f.handleCustomAction(p)}},async handleAdd(p){const h=p?o.getButtonFormId(p):o.getFormId();if(!h){E.warning("未配置表单,无法新增");return}if(!l.value)return;await l.value.showForm(h)!=null&&await f.handleLoadData()},async handleEdit(p,h){if(!p){E.warning("请先点击表格中的一行数据");return}const g=h?o.getButtonFormId(h):o.getFormId();if(!g){E.warning("未配置表单,无法编辑");return}if(!l.value)return;const y=o.getKeyField();await l.value.showForm(g,`${y}=${p[y]}`)!=null&&await f.handleLoadData()},async handleDelete(p,h){if(!p){E.warning("请先点击表格中的一行数据");return}try{await B.ElMessageBox.confirm((h==null?void 0:h.confirm)||"确定要删除这条数据吗?","确认删除",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"})}catch{return}try{await o.deleteRow(p),E.success("删除成功")}catch(g){_((g==null?void 0:g.message)||"删除失败")}},async handleExport(){try{await o.exportData(),E.success("导出成功")}catch(p){_((p==null?void 0:p.message)||"导出失败")}},async handleCustomAction(p){const{item:h,row:g}=p;if(!(h!=null&&h.url)){E.warning(`未识别的按钮动作:${p.action}`);return}try{await B.ElMessageBox.confirm(h.confirm||"确定执行该操作吗?","确认",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"})}catch{return}try{const y=await V.post(h.url,g||{});if(y.status!==200)throw new Error(y.message||"操作失败");E.success(y.message||"操作成功"),await f.handleLoadData()}catch(y){_((y==null?void 0:y.message)||"操作失败")}}};return a({loadConfig:f.loadConfig}),(p,h)=>{var y,x,$,ie,se,re,ce;const g=C.ElDrawer;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["table-render",p.$attrs.class]),style:e.normalizeStyle(p.$attrs.style)},[u.value.hasSearch?(e.openBlock(),e.createBlock(Ge,{key:0,fields:u.value.searchFields,modelValue:i.searchParams,"onUpdate:modelValue":h[0]||(h[0]=S=>i.searchParams=S),onSearch:f.handleSearch,onReset:f.handleReset},{"search-extra":e.withCtx(S=>[e.renderSlot(p.$slots,"search-extra",e.normalizeProps(e.guardReactiveProps(S||{})),void 0,!0)]),"search-actions":e.withCtx(S=>[e.renderSlot(p.$slots,"search-actions",e.normalizeProps(e.guardReactiveProps(S||{})),void 0,!0)]),_:3},8,["fields","modelValue","onSearch","onReset"])):e.createCommentVNode("",!0),e.createElementVNode("div",St,[e.createElementVNode("div",Bt,[e.createVNode(st,e.mergeProps(f.getTableAttrs(),{rows:u.value.rows,columns:u.value.columns,loading:u.value.loading,actions:u.value.actions,"actions-width":(y=u.value.tableConfig)==null?void 0:y.actionsWidth,"key-field":(x=u.value.tableConfig)==null?void 0:x.key,"dict-data":u.value.dictData,"active-key":u.value.currentKey,onRowAction:f.handleRowAction,onRowClick:f.handleRowClick}),e.createSlots({_:2},[e.renderList(f.getTableSlots(),(S,P)=>({name:P,fn:e.withCtx(Rt=>[e.renderSlot(p.$slots,P,e.normalizeProps(e.guardReactiveProps(Rt||{})),void 0,!0)])}))]),1040,["rows","columns","loading","actions","actions-width","key-field","dict-data","active-key","onRowAction","onRowClick"]),e.createVNode(pt,{class:"table-pagination",page:u.value.pagination.page,"page-size":u.value.pagination.pageSize,total:u.value.total,type:($=u.value.tableConfig)==null?void 0:$.pagination,"onUpdate:page":f.handlePageChange,"onUpdate:pageSize":f.handlePageSizeChange},null,8,["page","page-size","total","type","onUpdate:page","onUpdate:pageSize"])]),u.value.showDetail&&u.value.detailMode==="inline"?(e.openBlock(),e.createBlock(Z,{key:0,class:e.normalizeClass(["table-detail-inline",`table-detail-inline-${u.value.detailSide}`]),style:e.normalizeStyle({width:u.value.detailWidth}),title:(se=(ie=u.value.tableConfig)==null?void 0:ie.meta)==null?void 0:se.title,loading:u.value.detailLoading,"row-data":u.value.detailData,columns:u.value.columns,"empty-text":u.value.detailSide==="left"?"请点击右侧表格行查看详情":"请点击左侧表格行查看详情","extra-mode":f.getDetailExtraMode()},e.createSlots({_:2},[e.renderList(f.getDetailSlots(),S=>({name:S,fn:e.withCtx(P=>[e.renderSlot(p.$slots,S,e.normalizeProps(e.guardReactiveProps(P||{})),void 0,!0)])}))]),1032,["class","style","title","loading","row-data","columns","empty-text","extra-mode"])):e.createCommentVNode("",!0)]),u.value.showDetail&&u.value.detailMode==="drawer"?(e.openBlock(),e.createBlock(g,{key:1,"model-value":u.value.detailVisible,direction:u.value.detailDirection,size:u.value.detailWidth,title:((ce=(re=u.value.tableConfig)==null?void 0:re.meta)==null?void 0:ce.title)||"详情",onClose:f.handleDetailClose,onClosed:f.handleDetailClosed},{default:e.withCtx(()=>[e.createVNode(Z,{"show-header":!1,loading:u.value.detailLoading,"row-data":u.value.detailData,columns:u.value.columns,"extra-mode":f.getDetailExtraMode()},e.createSlots({_:2},[e.renderList(f.getDetailSlots(),S=>({name:S,fn:e.withCtx(P=>[e.renderSlot(p.$slots,S,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),u.value.previewMounted?(e.openBlock(),e.createBlock(g,{key:2,"model-value":u.value.previewVisible,direction:u.value.detailDirection,size:u.value.detailWidth,title:"详情",onClose:f.handlePreviewClose,onClosed:f.handlePreviewClosed},{default:e.withCtx(()=>[e.createVNode(Z,{"show-header":!1,"row-data":u.value.previewRow,columns:u.value.columns,"extra-mode":f.getDetailExtraMode()},e.createSlots({_:2},[e.renderList(f.getDetailSlots(),S=>({name:S,fn:e.withCtx(P=>[e.renderSlot(p.$slots,S,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),u.value.hasToolbar?(e.openBlock(),e.createBlock(ve,{key:3,class:"table-toolbar-bottom",items:u.value.toolbar,"current-row":u.value.currentRow,onAction:f.handleToolbarAction},{"toolbar-left":e.withCtx(S=>[e.renderSlot(p.$slots,"toolbar-left",e.normalizeProps(e.guardReactiveProps(S||{})),void 0,!0)]),"toolbar-extra":e.withCtx(S=>[e.renderSlot(p.$slots,"toolbar-extra",e.normalizeProps(e.guardReactiveProps(S||{})),void 0,!0)]),_:3},8,["items","current-row","onAction"])):e.createCommentVNode("",!0),e.createVNode(J,{ref_key:"formRef",ref:l},null,512)],6)}}}),[["__scopeId","data-v-5d8fe268"]]);function le(){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 Vt{constructor(a){w(this,"axiosInstance");w(this,"baseUrl","");this.axiosInstance=ee.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=le()),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 _t{constructor(){w(this,"emitter");this.emitter=de()}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 Et{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 s=a.mqttUrl||"ws://127.0.0.1:5002/ws";if(console.log("connect to mqtt..."),this.mqttClient=me.connect(s,t),!this.mqttClient){console.log("connect mqtt failed");return}this.mqttClient.on("connect",()=>{console.log("=====> mqtt connect success!"),this.mqttClient.subscribe(v,{qos:0},c=>{console.log(c?`mqtt subscribe [${v}] failed`:`mqtt subscribe [${v}] success`)})}),this.mqttClient.on("message",(c,d)=>{const r=d.toString();if(!r){console.error("Received empty message",c);return}let m=null;try{m=JSON.parse(r)}catch(o){console.error("Failed to parse message JSON",c,r,o);return}if(!m||m.Content===void 0||m.Content===null||!m.PType){console.log("parse notice failed!",r);return}m.PType==Dt&&this.eventBus.Emit(m.Route,m.Content)}),this.mqttClient.on(j.OffLine,()=>{console.log("mqtt offline...")}),this.mqttClient.on(j.Reconnect,()=>{console.log("mqtt reconnecting...")}),this.mqttClient.on(j.Close,()=>{console.log("mqtt close")}),this.mqttClient.on(j.Error,c=>{console.log("mqtt error")})}randomStr(a){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let s="";for(let c=0;c<a;c++)s+=t.charAt(Math.floor(Math.random()*t.length));return s}}const v="Notice",Dt="NOTICE",j={OffLine:"offline",Close:"close",Reconnect:"reconnect",Error:"error"};let Y;const Tt=n=>{if(!n)throw new Error("QfOptions is undefined");if(!Y&&n&&(Y=new Pt(n)),!Y)throw new Error("Qf not initialized, please call GetQf(options) first");return Y};class Pt{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 _t,this.WebApi=new Vt(a),this.options.useMqtt&&(this.Mqtt=new Et(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 $t={UInput:N,UInputNumber:Q,UDict:A,UToggle:H,UCascader:G,UDate:z,UMenu:oe,FormRender:J,TableRender:ne,UFieldView:O},Nt={install(n){n.use(B);for(const[a,t]of Object.entries($t))n.component(a,t)}};b.FormRender=J,b.GetQf=Tt,b.TableRender=ne,b.UCascader=G,b.UDate=z,b.UDict=A,b.UFieldView=O,b.UInput=N,b.UInputNumber=Q,b.UMenu=oe,b.UToggle=H,b.apis=D,b.clearDictCache=ye,b.default=Nt,b.flattenDictTree=fe,b.getDict=R,b.mapDictTree=q,b.normalizeDictNode=L,b.notify=E,b.notifyUtil=I,b.preloadDicts=ge,b.resolveBaseUrl=le,b.setDictCache=be,b.toDictOptions=W,b.translateDict=ae,b.translateDictSync=he,Object.defineProperties(b,{__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-195aa0e8]{display:flex;flex-direction:column;height:100%;min-height:0;background:#fff}.table-render .table-body[data-v-195aa0e8]{display:flex;flex:1;min-height:0;overflow:hidden}.table-render .table-container[data-v-195aa0e8]{flex:1;display:flex;flex-direction:column;min-width:0;overflow:hidden}.table-render .table-container[data-v-195aa0e8] .table-grid{flex:1;min-height:0;max-height:var(--table-grid-max-height, none)}.table-render .table-container[data-v-195aa0e8] .table-grid>.el-table{height:100%}.table-render .table-pagination[data-v-195aa0e8]{flex-shrink:0}.table-render .table-detail-inline[data-v-195aa0e8]{flex-shrink:0;height:100%;overflow:hidden;border-left:1px solid #ebeef5}.table-render .table-detail-inline.table-detail-inline-left[data-v-195aa0e8]{order:-1;border-left:none;border-right:1px solid #ebeef5}.table-render .table-toolbar-bottom[data-v-195aa0e8]{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-0281d2ce]{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-0281d2ce]{display:flex;flex-wrap:wrap;gap:12px}.table-search .search-field[data-v-0281d2ce]{display:flex;align-items:center;gap:8px;min-width:200px}.table-search .search-actions[data-v-0281d2ce]{display:flex;gap:8px;flex-shrink:0}.table-toolbar[data-v-0538c013]{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-0538c013]{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-05ef52d9]{display:inline-block}.table-grid[data-v-d3eed11d]{background:#fff}.table-grid .no-data[data-v-d3eed11d]{padding:48px;text-align:center;color:#999}.table-grid[data-v-d3eed11d] .table-grid-active-row td.el-table__cell{background-color:var(--el-color-primary-light-9, #ecf5ff)!important}.table-pagination[data-v-2ca77d18]{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-2ca77d18]{display:flex;align-items:center;gap:12px}.table-pagination .total-text[data-v-2ca77d18]{color:#666;font-size:14px}.table-pagination .load-more[data-v-2ca77d18]{flex:1;text-align:center}.table-detail[data-v-7e47b0ba]{display:flex;flex-direction:column;height:100%;min-height:0;background:#fff}.table-detail .detail-header[data-v-7e47b0ba]{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-7e47b0ba]{font-size:15px;font-weight:500}.table-detail .detail-body[data-v-7e47b0ba]{flex:1;min-height:0;overflow:auto}.table-detail .detail-status[data-v-7e47b0ba]{display:flex;align-items:center;justify-content:center;height:100%;padding:24px;color:#999;font-size:13px}.table-detail .detail-content[data-v-7e47b0ba]{padding:4px 16px 16px}.table-detail .detail-item[data-v-7e47b0ba]{display:flex;padding:12px 0;border-bottom:1px solid #eee}.table-detail .detail-item[data-v-7e47b0ba]:last-child{border-bottom:none}.table-detail .detail-item .detail-label[data-v-7e47b0ba]{width:100px;flex-shrink:0;color:#666;font-size:14px}.table-detail .detail-item .detail-value[data-v-7e47b0ba]{flex:1;min-width:0;color:#333;font-size:14px;word-break:break-all}.table-render[data-v-5d8fe268]{display:flex;flex-direction:column;height:100%;min-height:0;background:#fff}.table-render .table-body[data-v-5d8fe268]{display:flex;flex:1;min-height:0;overflow:hidden}.table-render .table-container[data-v-5d8fe268]{flex:1;display:flex;flex-direction:column;min-width:0;overflow:hidden}.table-render .table-container[data-v-5d8fe268] .table-grid{flex:1;min-height:0;max-height:var(--table-grid-max-height, none)}.table-render .table-container[data-v-5d8fe268] .table-grid>.el-table{height:100%}.table-render .table-pagination[data-v-5d8fe268]{flex-shrink:0}.table-render .table-detail-inline[data-v-5d8fe268]{flex-shrink:0;height:100%;overflow:hidden;border-left:1px solid #ebeef5}.table-render .table-detail-inline.table-detail-inline-left[data-v-5d8fe268]{order:-1;border-left:none;border-right:1px solid #ebeef5}.table-render .table-toolbar-bottom[data-v-5d8fe268]{flex-shrink:0}
|
package/dist/ts/form-render.d.ts
CHANGED
|
@@ -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
|
}
|
package/dist/ts/model.d.ts
CHANGED
|
@@ -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>;
|