urit-qf-ui 0.2.7 → 1.0.0

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.
Files changed (68) hide show
  1. package/README.md +88 -22
  2. package/dist/components/UBaseInfo.vue.d.ts +22 -0
  3. package/dist/components/UCascader.vue.d.ts +22 -37
  4. package/dist/components/UDialog.vue.d.ts +94 -0
  5. package/dist/components/UForm.vue.d.ts +233 -0
  6. package/dist/components/UMenu.vue.d.ts +230 -11
  7. package/dist/components/UResults.vue.d.ts +23 -0
  8. package/dist/components/USearch.vue.d.ts +51 -0
  9. package/dist/components/UTable.vue.d.ts +54 -0
  10. package/dist/components/UTablePage.vue.d.ts +152 -0
  11. package/dist/index.d.ts +33 -18
  12. package/dist/index.js +2962 -3147
  13. package/dist/index.umd.cjs +1 -2
  14. package/dist/layout/UGrid.vue.d.ts +44 -0
  15. package/dist/model/base-info.d.ts +113 -0
  16. package/dist/model/cascader.d.ts +135 -0
  17. package/dist/model/form.d.ts +143 -0
  18. package/dist/model/grid.d.ts +53 -0
  19. package/dist/model/menu.d.ts +140 -0
  20. package/dist/model/results.d.ts +90 -0
  21. package/dist/model/search.d.ts +93 -0
  22. package/dist/model/table-page.d.ts +44 -0
  23. package/dist/model/table.d.ts +163 -0
  24. package/dist/parser/cascader.d.ts +35 -0
  25. package/dist/parser/form.d.ts +7 -0
  26. package/dist/parser/menu.d.ts +5 -0
  27. package/dist/parser/table-page.d.ts +15 -0
  28. package/dist/parser/yaml-parser.d.ts +41 -0
  29. package/dist/qf/interface.d.ts +22 -0
  30. package/dist/qf/qf.d.ts +23 -1
  31. package/dist/style.css +1 -1
  32. package/dist/utils/base-info.d.ts +39 -0
  33. package/dist/utils/cascader.d.ts +45 -0
  34. package/dist/utils/form.d.ts +59 -0
  35. package/dist/utils/menu.d.ts +14 -0
  36. package/dist/utils/results.d.ts +38 -0
  37. package/dist/utils/search.d.ts +8 -0
  38. package/dist/utils/table.d.ts +16 -0
  39. package/package.json +1 -1
  40. package/dist/components/UDate.vue.d.ts +0 -47
  41. package/dist/components/UDict.vue.d.ts +0 -49
  42. package/dist/components/UInput.vue.d.ts +0 -52
  43. package/dist/components/UInputNumber.vue.d.ts +0 -52
  44. package/dist/components/UToggle.vue.d.ts +0 -54
  45. package/dist/show/UCascaderShow.vue.d.ts +0 -11
  46. package/dist/show/UDateShow.vue.d.ts +0 -15
  47. package/dist/show/UDictShow.vue.d.ts +0 -9
  48. package/dist/show/UFieldView.vue.d.ts +0 -24
  49. package/dist/show/UInputShow.vue.d.ts +0 -10
  50. package/dist/show/UToggleShow.vue.d.ts +0 -12
  51. package/dist/ts/constant.d.ts +0 -24
  52. package/dist/ts/dict.d.ts +0 -105
  53. package/dist/ts/form-render.d.ts +0 -30
  54. package/dist/ts/http.d.ts +0 -13
  55. package/dist/ts/model.d.ts +0 -202
  56. package/dist/ts/notify.d.ts +0 -42
  57. package/dist/ts/table-data-service.d.ts +0 -30
  58. package/dist/ts/table-render.d.ts +0 -210
  59. package/dist/uform/FormContainer.vue.d.ts +0 -37
  60. package/dist/uform/FormField.vue.d.ts +0 -16
  61. package/dist/uform/FormGrid.vue.d.ts +0 -24
  62. package/dist/uform/FormRender.vue.d.ts +0 -104
  63. package/dist/uform/TableDetail.vue.d.ts +0 -37
  64. package/dist/uform/TableGrid.vue.d.ts +0 -51
  65. package/dist/uform/TablePagination.vue.d.ts +0 -14
  66. package/dist/uform/TableRender.vue.d.ts +0 -618
  67. package/dist/uform/TableSearch.vue.d.ts +0 -38
  68. package/dist/uform/TableToolbar.vue.d.ts +0 -31
@@ -1,2 +1 @@
1
- (function(b,V){typeof exports=="object"&&typeof module<"u"?V(exports,require("element-plus"),require("element-plus/dist/index.css"),require("element-plus/es"),require("element-plus/es/components/base/style/css"),require("element-plus/es/components/input/style/css"),require("vue"),require("element-plus/es/components/input-number/style/css"),require("element-plus/es/components/select/style/css"),require("element-plus/es/components/option/style/css"),require("axios"),require("mitt"),require("mqtt"),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/icons-vue"),require("element-plus/es/components/form/style/css"),require("element-plus/es/components/dialog/style/css"),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")):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","mitt","mqtt","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/icons-vue","element-plus/es/components/form/style/css","element-plus/es/components/dialog/style/css","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"],V):(b=typeof globalThis<"u"?globalThis:b||self,V(b.UritQfUI={},b.ElementPlus,b.ElementPlus,b.ElementPlus,b.ElementPlus,b.ElementPlus,b.Vue,b.ElementPlus,b.ElementPlus,b.ElementPlus,b.axios,b.mitt,b.mqtt,b.ElementPlus,b.ElementPlus,b.ElementPlus,b.ElementPlus,b.ElementPlus,b.ElementPlus,b.ElementPlus,b.ElementPlusIconsVue))})(this,function(b,V,U,C,Ft,Lt,e,qt,Wt,Ot,me,ue,pe,jt,Yt,Qt,Gt,Kt,Ht,Jt,Y){"use strict";var Ut=Object.defineProperty;var zt=(b,V,U)=>V in b?Ut(b,V,{enumerable:!0,configurable:!0,writable:!0,value:U}):b[V]=U;var w=(b,V,U)=>zt(b,typeof V!="symbol"?V+"":V,U);function fe(l){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(a,t,s.get?s:{enumerable:!0,get:()=>l[t]})}}return a.default=l,Object.freeze(a)}const te=fe(Y),he=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(l,{emit:a}){const t=l,s=a,r=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}),c=e.computed(()=>({"u-input-label-left":t.labelPosition==="left","u-input-label-top":t.labelPosition==="top"})),d={onInput(m){s("update:modelValue",m)}};return(m,o)=>{const n=C.ElInput;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-input",c.value])},[l.fieldLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-input-label",style:e.normalizeStyle(r.value)},[e.createTextVNode(e.toDisplayString(l.fieldLabel)+" ",1),e.createElementVNode("span",{class:e.normalizeClass(["required-star",{"required-star--visible":l.required}])},"*",2)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["u-input-field",{"u-input-field--top":l.labelPosition==="top"}])},[e.createVNode(n,{"model-value":l.modelValue,placeholder:l.placeholder,type:l.type,disabled:l.disable,readonly:l.readonly,maxlength:l.maxlength,"onUpdate:modelValue":d.onInput},null,8,["model-value","placeholder","type","disabled","readonly","maxlength","onUpdate:modelValue"])],2)],2)}}}),k=(l,a)=>{const t=l.__vccOpts||l;for(const[s,r]of a)t[s]=r;return t},R=k(he,[["__scopeId","data-v-ecf5177c"]]),ge={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(l,{emit:a}){const t=l,s=a,r=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}),c=e.computed(()=>({"u-input-number-label-left":t.labelPosition==="left","u-input-number-label-top":t.labelPosition==="top"})),d={onUpdate(m){s("update:modelValue",m===void 0?0:m)}};return(m,o)=>{const n=C.ElInputNumber;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-input-number",c.value])},[l.fieldLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-input-number-label",style:e.normalizeStyle(r.value)},[e.createTextVNode(e.toDisplayString(l.fieldLabel)+" ",1),e.createElementVNode("span",{class:e.normalizeClass(["required-star",{"required-star--visible":l.required}])},"*",2)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",ge,[e.createVNode(n,{"model-value":l.modelValue,placeholder:l.placeholder||"请输入数值",disabled:l.disable,min:l.min,max:l.max,step:l.step,precision:l.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"]]);function ae(){var l,a;try{if(typeof document<"u"&&document.baseURI){const t=new URL(document.baseURI);if(t.origin&&t.origin!=="null"){let s=t.pathname;return s.slice(s.lastIndexOf("/")+1).includes(".")&&(s=s.slice(0,s.lastIndexOf("/")+1)),s=s.replace(/\/+$/,""),t.origin+s}}}catch{}try{const t=(a=(l=window==null?void 0:window.$wujie)==null?void 0:l.location)==null?void 0:a.origin;if(typeof t=="string"&&t)return t}catch{}return typeof window<"u"?window.location.origin:""}function ye(l,a){const t=(l??"").trim();return t!==""&&t!=="."&&t!=="./"?t:(a.value===void 0&&(a.value=ae()),a.value)}class be{constructor(a){w(this,"axiosInstance");w(this,"baseCache",{});this.axiosInstance=me.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"),t.baseURL=ye(a.baseUrl,this.baseCache),t),t=>Promise.reject(t)),this.axiosInstance.interceptors.response.use(t=>{if(t.config.responseType==="blob")return t;const s=t.data;if(s&&typeof s=="object"&&!Array.isArray(s)&&s.status===void 0&&s.code!==void 0){const r=s.code,c=r===0||r===200||Number(r)===0||Number(r)===200;s.status=c?200:Number(r)}return s},t=>Promise.reject(t))}Get(a,t){return this.axiosInstance.get(a,{params:t})}Post(a,t){return this.axiosInstance.post(a,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"})}PostDownload(a,t){return this.axiosInstance.post(a,t,{responseType:"blob"})}}class we{constructor(){w(this,"emitter");this.emitter=ue()}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 Ce{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... url=${s}`),this.mqttClient=pe.connect(s,t),!this.mqttClient){console.log("connect mqtt failed");return}this.mqttClient.on("connect",()=>{console.log("=====> mqtt connect success!"),this.mqttClient.subscribe(G,{qos:0},r=>{console.log(r?`mqtt subscribe [${G}] failed`:`mqtt subscribe [${G}] success`)})}),this.mqttClient.on("message",(r,c)=>{const d=c.toString();if(!d){console.error("Received empty message",r);return}let m=null;try{m=JSON.parse(d)}catch(o){console.error("Failed to parse message JSON",r,d,o);return}if(!m||m.Content===void 0||m.Content===null||!m.PType){console.log("parse notice failed!",d);return}m.PType==ke&&this.eventBus.Emit(m.Route,m.Content)}),this.mqttClient.on(F.OffLine,()=>{console.log("mqtt offline...")}),this.mqttClient.on(F.Reconnect,()=>{console.log("mqtt reconnecting...")}),this.mqttClient.on(F.Close,()=>{console.log("mqtt close")}),this.mqttClient.on(F.Error,r=>{console.log("mqtt error")})}randomStr(a){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let s="";for(let r=0;r<a;r++)s+=t.charAt(Math.floor(Math.random()*t.length));return s}}const G="Notice",ke="NOTICE",F={OffLine:"offline",Close:"close",Reconnect:"reconnect",Error:"error"};let $,K=!1;const xe=l=>{if(!l)throw new Error("QfOptions is undefined");if((!$||K)&&($=new oe(l),K=!1),!$)throw new Error("Qf not initialized, please call GetQf(options) first");return $},B=()=>($||($=new oe({module:"",useMqtt:!1,baseUrl:"",mqttUrl:"",userName:"",password:""}),K=!0),$);class oe{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 we,this.WebApi=new be(a),this.options.useMqtt&&(this.Mqtt=new Ce(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)}PostDownload(a,t){return this.WebApi.PostDownload(a,t)}RegNotice(a,t){this.EventBus.On(a,t)}}const E={formCfgApi(l,a="forms"){return`/api/form?type=${a}&id=${l}`},dictApi(l){return`/api/dict/full-list?dict_type=${l}`},cascaderApi(l,a=!0){return`/api/dict/tree-list?dict_type=${l}&children=${a}`}},T={},L={};function q(l){const{children:a,...t}=l;return{label:l.label??l.dict_value??String(l.value??""),value:l.value??l.dict_code,...t}}function W(l){return Array.isArray(l)?l.map(a=>{if(!a||typeof a!="object")return a;const t=q(a),s=a.children;return Array.isArray(s)&&s.length>0&&(t.children=W(s)),t}):[]}function O(l){return Array.isArray(l)?l.filter(a=>a&&typeof a=="object").map(a=>q(a)):[]}function Se(l){if(!Array.isArray(l))return[];const a=[],t=s=>{for(const r of s){if(!r||typeof r!="object")continue;const c=r.children;a.push(q(r)),Array.isArray(c)&&c.length>0&&t(c)}};return t(l),a}async function A(l){if(!l)return[];if(T[l])return T[l];if(l in L)return await L[l];const a=(async()=>{try{const t=await B().Get(E.dictApi(l));if(t.status===200){const s=O(t.data);return T[l]=s,s}return[]}catch(t){return console.error(`[dict] 加载字典 ${l} 失败:`,t),[]}finally{delete L[l]}})();return L[l]=a,a}async function le(l,a,t=""){if(a==null||a==="")return t;const s=T[l];if(s&&s.length>0)return H(s,a);const r=await A(l);return r&&r.length>0?H(r,a):t||String(a)}function H(l,a){const t=l.find(s=>s.value===a||String(s.value)===String(a));return t?t.label:String(a)}function Be(l,a,t=""){if(a==null||a==="")return t;const s=T[l];return s&&s.length>0?H(s,a):t||String(a)}async function Ve(l){await Promise.all(l.map(a=>A(a)))}function _e(l){l?delete T[l]:Object.keys(T).forEach(a=>{delete T[a]})}function De(l,a){T[l]=a}const Ee={class:"u-dict-field"},I=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(l,{emit:a}){const t=l,s=a,r=e.reactive({excluded:["fieldLabel","labelPosition","labelWidth","labelAlign","required","modelValue","dictType"],options:[],loading:!1}),c=async()=>{if(t.dictType){r.loading=!0;try{const n=await B().Get(E.dictApi(t.dictType));n.status===200?r.options=O(n.data):(console.error("[UDict] 请求失败:",n.message),r.options=[])}catch(n){console.error("[UDict] 加载字典失败:",n),r.options=[]}finally{r.loading=!1}}};e.watch(()=>t.dictType,()=>{c()},{immediate:!0});const d=e.computed(()=>{const n={};return t.labelPosition==="left"&&t.labelWidth&&(n.width=typeof t.labelWidth=="number"?`${t.labelWidth}px`:t.labelWidth),t.labelAlign&&(n.textAlign=t.labelAlign),n}),m=e.computed(()=>({"u-dict-label-left":t.labelPosition==="left","u-dict-label-top":t.labelPosition==="top"})),o={onUpdate(n){s("update:modelValue",n)}};return(n,i)=>{const u=C.ElOption,f=C.ElSelect;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-dict",m.value])},[l.fieldLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-dict-label",style:e.normalizeStyle(d.value)},[e.createTextVNode(e.toDisplayString(l.fieldLabel)+" ",1),e.createElementVNode("span",{class:e.normalizeClass(["required-star",{"required-star--visible":l.required}])},"*",2)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",Ee,[e.createVNode(f,{"model-value":l.modelValue,placeholder:l.placeholder||"请选择",loading:r.loading,disabled:l.disable,style:{width:"100%"},onChange:o.onUpdate},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.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-d0ae00fe"]]),Te={class:"u-toggle-field"},J=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(l,{emit:a}){const t=l,s=a,r=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=>{s("update:modelValue",o?t.trueValue:t.falseValue)}}),m=e.computed(()=>{const o={};for(const n in t)!r.excluded.includes(n)&&n!=="modelValue"&&(o[n]=t[n]);return o});return(o,n)=>{const i=C.ElSwitch;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-toggle",{"u-toggle-label-left":l.labelPosition==="left"}])},[l.fieldLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-toggle-label",style:e.normalizeStyle(c())},[e.createTextVNode(e.toDisplayString(l.fieldLabel)+" ",1),e.createElementVNode("span",{class:e.normalizeClass(["required-star",{"required-star--visible":l.required}])},"*",2)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",Te,[e.createVNode(i,e.mergeProps({modelValue:d.value,"onUpdate:modelValue":n[0]||(n[0]=u=>d.value=u)},m.value,{"active-text":l.activeText,"inactive-text":l.inactiveText,"active-color":l.activeColor,"inactive-color":l.inactiveColor}),null,16,["modelValue","active-text","inactive-text","active-color","inactive-color"])])],2)}}}),[["__scopeId","data-v-94c1fd38"]]),Pe={class:"u-cascader-levels"},X=k(e.defineComponent({__name:"UCascader",props:{fieldLabel:{},labelPosition:{default:"top"},labelWidth:{},labelAlign:{},required:{type:Boolean},modelValue:{},options:{},depth:{default:1}},emits:["update:modelValue"],setup(l,{emit:a}){const t=l,s=a,r=()=>{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 n=t.options||[];for(let i=0;i<t.depth;i++)if(o.push(n),c.value[i]!==void 0){const u=n.find(f=>f.value===c.value[i]);u&&u.children?n=u.children:n=[]}else n=[];return o});e.watch(()=>t.modelValue,o=>{o!=null?c.value=Array.isArray(o)?o:[o]:c.value=[]},{immediate:!0});const m=(o,n)=>{c.value[o]=n;for(let u=o+1;u<t.depth;u++)c.value[u]=void 0;const i=c.value.filter(u=>u!==void 0);s("update:modelValue",i)};return(o,n)=>{const i=C.ElOption,u=C.ElSelect;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-cascader",{"u-cascader-label-left":l.labelPosition==="left"}])},[l.fieldLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-cascader-label",style:e.normalizeStyle(r())},[e.createTextVNode(e.toDisplayString(l.fieldLabel)+" ",1),e.createElementVNode("span",{class:e.normalizeClass(["required-star",{"required-star--visible":l.required}])},"*",2)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",Pe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.depth,f=>(e.openBlock(),e.createElementBlock("div",{key:f-1,class:"u-cascader-level"},[e.createVNode(u,{"model-value":c.value[f-1],options:d.value[f-1]||[],disabled:f>1&&c.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(d.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"]]),$e={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(l,{emit:a}){const t=l,s=a,r=()=>{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"?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,n)=>{const i=C.ElDatePicker;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-date",{"u-date-label-left":l.labelPosition==="left"}])},[l.fieldLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-date-label",style:e.normalizeStyle(r())},[e.createTextVNode(e.toDisplayString(l.fieldLabel)+" ",1),e.createElementVNode("span",{class:e.normalizeClass(["required-star",{"required-star--visible":l.required}])},"*",2)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",$e,[e.createVNode(i,{modelValue:c.value,"onUpdate:modelValue":n[0]||(n[0]=u=>c.value=u),type:m.value,placeholder:l.locale==="en-US"?"Select date":"选择日期","range-separator":l.locale==="en-US"?"to":"至","start-placeholder":l.locale==="en-US"?"Start date":"开始日期","end-placeholder":l.locale==="en-US"?"End date":"结束日期",format:l.mask.replace("YYYY","YYYY").replace("MM","MM").replace("DD","DD"),"value-format":l.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 M(l,a="info"){V.ElMessage({message:l,type:a,duration:1e3,showClose:!1})}function _(l){V.ElMessage({message:l,type:"error",duration:2e3,showClose:!1})}function Ne(l){M(l,"success")}function Re(l){M(l,"error")}function Ae(l){M(l,"warning")}function Ie(l){M(l,"info")}const D={notify:M,success:Ne,error:Re,warning:Ae,info:Ie,alertError:_},Me={key:0,class:"u-menu-brand"},Ue=["src"],ze={class:"u-menu-brand-text"},Fe={key:1,class:"u-menu-logout"},ne=k(e.defineComponent({__name:"UMenu",props:{menuId:{default:"menu"},config:{},mode:{},projectName:{},activePath:{},width:{}},emits:["menu-click","logout"],setup(l,{expose:a,emit:t}){const s=l,r=t,c=e.reactive({config:null,menus:[],activePath:"",iconMap:{},iconsLoaded:!1}),d=e.computed(()=>{var o,n,i,u,f,p,h,g;return{projectName:s.projectName??((o=c.config)==null?void 0:o.projectName)??"",logo:((n=c.config)==null?void 0:n.logo)||"",mode:s.mode??((i=c.config)==null?void 0:i.mode)??"sidebar",isHorizontal:(s.mode??((u=c.config)==null?void 0:u.mode)??"sidebar")==="horizontal",elMode:(s.mode??((f=c.config)==null?void 0:f.mode)??"sidebar")==="horizontal"?"horizontal":"vertical",width:s.width??((p=c.config)==null?void 0:p.width)??220,menus:c.menus,activeIndex:m.getIndexByPath(c.activePath),showLogout:((h=c.config)==null?void 0:h.showLogout)!==!1,logoutText:((g=c.config)==null?void 0:g.logoutText)||"退出登录",iconMap:c.iconMap}}),m={async init(){await m.ensureIcons(),s.config?(c.config=s.config,c.menus=m.normalizeMenus(s.config.menus)):await m.loadConfig(s.menuId),c.activePath=s.activePath||c.activePath},async loadConfig(o){if(o)try{const n=await B().Get(E.formCfgApi(o,"menus"));if(n.status!==200){_(n.message||"获取菜单配置失败");return}const i=n.data||{};c.config=i,i.dictType?await m.loadDictMenus(i.dictType):c.menus=m.normalizeMenus(i.menus)}catch(n){_((n==null?void 0:n.message)||"获取菜单配置失败"),c.menus=[]}},async loadDictMenus(o){try{const n=await B().Get(E.cascaderApi(o));if(n.status!==200){_(n.message||"获取菜单字典失败");return}c.menus=m.normalizeMenus(W(n.data))}catch(n){_((n==null?void 0:n.message)||"获取菜单字典失败"),c.menus=[]}},normalizeMenus(o){return Array.isArray(o)?o.map(n=>m.normalizeMenuNode(n)).filter(Boolean):[]},normalizeMenuNode(o){if(!o||typeof o!="object")return null;const n=m.parseInfo(o.info),i=o.label??o.dict_value??o.name;if(!i)return null;const u=n.path??o.path??o.dict_code??o.value??"",f=n.type??o.type??"route",p={...o,label:String(i),type:f,path:String(u??""),icon:n.icon??o.icon??""},h=n.id??o.id;h!=null&&h!==""&&(p.id=String(h));const g=n.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 n=JSON.parse(o);return n&&typeof n=="object"?n:{}}catch{return{path:o}}return{}},itemIndex(o,n){return o.path||`menu-${n}`},childIndex(o,n,i,u){return i.path?i.path:`${m.itemIndex(o,n)}-${u}`},hasChildren(o){return Array.isArray(o.children)&&o.children.length>0},getIndexByPath(o){if(!o)return"";for(let n=0;n<c.menus.length;n++){const i=c.menus[n];if(i.path===o)return m.itemIndex(i,n);const u=i.children||[];for(let f=0;f<u.length;f++)if(u[f].path===o)return m.childIndex(i,n,u[f],f)}return""},findItemByIndex(o,n){for(let i=0;i<c.menus.length;i++){const u=c.menus[i],f=m.itemIndex(u,i);if(f===o)return{item:u,level:1,indexPath:n||[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:n||[f,y],index:o}}}return null},resolveTarget(o){const n=o.type||"route",i=o.path||"";return n==="url"?{type:n,path:i,url:i,open:o.open||"new"}:n==="form"||n==="table"||n==="menu"?{type:n,path:i,id:o.id||i}:{type:"route",path:i,route:i}},handleSelect(o,n){const i=m.findItemByIndex(o,n);if(!i||m.hasChildren(i.item))return;const u=m.resolveTarget(i.item);c.activePath=i.item.path||o;const f={...u,item:i.item,level:i.level,indexPath:i.indexPath,index:o};r("menu-click",f)},handleLogout(){r("logout")},setActivePath(o){c.activePath=o},async ensureIcons(){if(!c.iconsLoaded){c.iconsLoaded=!0;try{const o=te,n=o!=null&&o.default?{...o.default,...o}:{...o},i={};for(const[u,f]of Object.entries(n))i[u]=e.markRaw(f);c.iconMap=i}catch(o){console.warn("[UMenu] @element-plus/icons-vue 不可用,菜单图标将被忽略",o)}}},getIcon(o){return o&&c.iconMap[o]||null}};return e.watch(()=>s.menuId,o=>{s.config||m.loadConfig(o)}),e.watch(()=>s.activePath,o=>{c.activePath=o||""}),e.watch(()=>s.config,o=>{o&&(c.config=o,c.menus=m.normalizeMenus(o.menus))}),e.onMounted(()=>{m.init()}),a({loadConfig:m.loadConfig,setActivePath:m.setActivePath}),(o,n)=>{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--${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",Me,[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,Ue)):e.createCommentVNode("",!0),e.createElementVNode("span",ze,e.toDisplayString(d.value.projectName),1)],!0)])):e.createCommentVNode("",!0),e.createVNode(p,{class:"u-menu-list",mode:d.value.elMode,"default-active":d.value.activeIndex,"unique-opened":!d.value.isHorizontal,onSelect:m.handleSelect},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.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,N)=>(e.openBlock(),e.createBlock(u,{key:m.childIndex(g,y,x,N),index:m.childIndex(g,y,x,N)},{default:e.withCtx(()=>[e.renderSlot(o.$slots,"menu-item",{item:x,level:2,index:N,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"]),d.value.showLogout?(e.openBlock(),e.createElementBlock("div",Fe,[e.renderSlot(o.$slots,"logout",{mode:d.value.mode},()=>[e.createVNode(h,{class:"u-menu-logout-btn",text:"",onClick:m.handleLogout},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.value.logoutText),1)]),_:1},8,["onClick"])],!0)])):e.createCommentVNode("",!0)],6)}}}),[["__scopeId","data-v-41cadcd8"]]),Le={class:"form-content"},qe={key:1,class:"form-layout"},We={key:0,class:"form-header"},Oe={class:"title"},je={class:"form-body"},Ye={key:1,class:"form-footer"},Qe=k(e.defineComponent({__name:"FormContainer",props:{visible:{type:Boolean},layout:{},title:{},loading:{type:Boolean,default:!1}},emits:["update:visible","close","closed"],setup(l,{emit:a}){const t=l,s=a,{visible:r}=e.toRefs(t),c=e.computed(()=>t.layout.open==="normal"),d=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,n)=>{const i=C.ElIcon,u=C.ElDialog;return c.value?e.unref(r)?(e.openBlock(),e.createElementBlock("div",qe,[l.title?(e.openBlock(),e.createElementBlock("div",We,[e.createElementVNode("div",Oe,e.toDisplayString(l.title),1)])):e.createCommentVNode("",!0),e.createElementVNode("div",je,[l.loading?(e.openBlock(),e.createBlock(i,{key:0,class:"is-loading",size:40},{default:e.withCtx(()=>[e.createVNode(e.unref(Y.Loading))]),_:1})):e.renderSlot(o.$slots,"default",{},void 0,!0,1)]),o.$slots.actions?(e.openBlock(),e.createElementBlock("div",Ye,[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(r),title:l.title,width:d.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",Le,[l.loading?(e.openBlock(),e.createBlock(i,{key:0,class:"is-loading",size:40},{default:e.withCtx(()=>[e.createVNode(e.unref(Y.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"]]),Ge=k(e.defineComponent({__name:"FormGrid",props:{fields:{},layout:{}},setup(l){const a=l,t=e.reactive({columns:e.computed(()=>a.layout.columns||1)}),s={getColSpan(r){const c=r.colSpan||1;return Math.min(c,t.columns)}};return(r,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(l.fields,d=>(e.openBlock(),e.createElementBlock("div",{key:d.field,class:"form-grid-item",style:e.normalizeStyle({gridColumn:`span ${s.getColSpan(d)}`})},[e.renderSlot(r.$slots,"default",{field:d},void 0,!0)],4))),128))],4))}}),[["__scopeId","data-v-90ed35a4"]]),Ke={class:"form-field"},He=k(e.defineComponent({__name:"FormField",props:{field:{},modelValue:{},layout:{},disabled:{type:Boolean,default:!1},error:{}},emits:["update:modelValue"],setup(l,{emit:a}){const t=l,s=a,r=e.reactive({componentMap:e.markRaw({input:R,"input-number":Q,dict:I,switch:J,cascader:X,date:z}),cascaderOptions:[]}),c=()=>{t.field.cascaderKey&&B().Get(E.cascaderApi(t.field.cascaderKey)).then(i=>{i.status===200&&(r.cascaderOptions=W(i.data))})};e.watch(()=>t.field.cascaderKey,c,{immediate:!0});const d=e.computed(()=>r.componentMap[t.field.type]||R),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=r.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}),n={handleUpdate(i){s("update:modelValue",i)}};return(i,u)=>(e.openBlock(),e.createElementBlock("div",Ke,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d.value),e.mergeProps(o.value,{"onUpdate:modelValue":n.handleUpdate}),null,16,["onUpdate:modelValue"])),e.createElementVNode("div",{class:e.normalizeClass(["field-error",{"field-error--visible":l.error}]),style:e.normalizeStyle(m.value)},e.toDisplayString(l.error||""),7)]))}}),[["__scopeId","data-v-96994a9a"]]);class Je{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 Xe=class{constructor(){w(this,"data",e.reactive(new Je))}parseQuery(a){if(!a)return{};const t={},s=a.split("&");for(const r of s){const[c,d]=r.split("=");c&&(t[c]=d||"")}return t}async fetchFormConfig(a){const t=await B().Get(E.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,r=await B().Get(s);if(r.status!==200)throw new Error(r.message||"获取表单数据失败");return r.data}async submitForm(a,t){return await B().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 r=this.data.formData[s.field];if(s.required&&(r==null||r==="")){this.data.errors.push({field:s.field,message:`${s.label}为必填项`});continue}if(s.rules&&s.rules.length>0&&r){for(const c of s.rules)if(c.pattern&&!new RegExp(c.pattern).test(r)){this.data.errors.push({field:s.field,message:c.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 r=await this.fetchFormData(s.api.get,t),c=this.nestedToFlat(r);this.data.formData={...this.data.formData,...c}}}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 r=await this.submitForm(t,s);if(r.status===200)return r.data;throw new Error(r.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 r=a[s];if(s.includes(".")){const c=s.split(".");let d=t;for(let m=0;m<c.length-1;m++){const o=c[m];d[o]||(d[o]={}),d=d[o]}d[c[c.length-1]]=r}else t[s]=r}return t}nestedToFlat(a,t=""){const s={};for(const r in a){const c=a[r],d=t?`${t}.${r}`:r;c&&typeof c=="object"&&!Array.isArray(c)?Object.keys(c).length===2&&"from"in c&&"to"in c?s[d]=c:Object.assign(s,this.nestedToFlat(c,d)):s[d]=c}return s}};const Z=k(e.defineComponent({__name:"FormRender",setup(l,{expose:a}){const t=new Xe,s=e.ref(null),r=e.reactive({currentQuery:{},submitResolve:null}),c=e.computed(()=>{var p;const f={};if(!t.data.isEditMode||!r.currentQuery)return f;for(const h of((p=t.data.formConfig)==null?void 0:p.fields)||[])r.currentQuery[h.field]!==void 0&&(f[h.field]=!0);return f}),d=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)||"表单"}),n=e.computed(()=>d.value.buttonAlign||"right"),i=e.computed(()=>d.value.open==="normal"),u={async showForm(f,p){r.currentQuery=t.parseQuery(p||"");try{await t.openForm(f,p)}catch(h){return _((h==null?void 0:h.message)||"打开表单失败"),null}return new Promise(h=>{r.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 D.success(g),r.submitResolve&&(r.submitResolve(h),r.submitResolve=null),i.value||t.closeForm(),h}catch(h){return r.submitResolve&&(r.submitResolve(null),r.submitResolve=null),h!=null&&h.message&&h.message!=="请完善表单信息"&&_(h.message),null}},resolvePending(){r.submitResolve&&(r.submitResolve(null),r.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(Qe,{visible:e.unref(t).data.visible,"onUpdate:visible":p[0]||(p[0]=y=>e.unref(t).data.visible=y),layout:d.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",n.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(Ge,{fields:m.value,layout:d.value},{default:e.withCtx(({field:y})=>[e.createVNode(He,{modelValue:e.unref(t).data.formData[y.field],"onUpdate:modelValue":x=>e.unref(t).data.formData[y.field]=x,field:y,layout:d.value,disabled:c.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 Ze{constructor(a){this.config=a}async fetchList(a,t){const s={page:t.page,pageSize:t.pageSize,...a},r={};for(const o in s){const n=s[o];n!==""&&n!==null&&n!==void 0&&(r[o]=n)}const c=new URLSearchParams;for(const o in r)c.append(o,String(r[o]));const d=`${this.config.api.list}${c.toString()?"?"+c.toString():""}`,m=await B().Get(d);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],r=`${this.config.api.delete}?${encodeURIComponent(t)}=${encodeURIComponent(String(s??""))}`,c=await B().Post(r);if(c.status!==200)throw new Error(c.message||"删除失败")}async batchDelete(a){if(!this.config.api.delete)throw new Error("未配置删除API");const t=await B().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 B().PostDownload(this.config.api.export,a)).data,r=window.URL.createObjectURL(s),c=document.createElement("a");c.href=r,c.download=`export_${Date.now()}.xlsx`,c.click(),window.URL.revokeObjectURL(r)}async downloadTemplate(){if(!this.config.api.import)throw new Error("未配置导入API");const t=(await B().Download(`${this.config.api.import}/template`)).data,s=window.URL.createObjectURL(t),r=document.createElement("a");r.href=s,r.download=`template_${Date.now()}.xlsx`,r.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 B().Post(this.config.api.import,t);if(s.status!==200)throw new Error(s.message||"导入失败");return s.data}}class ve{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 et=class{constructor(){w(this,"data",e.reactive(new ve));w(this,"dataService",null)}async loadConfig(a){var r;const t=E.formCfgApi(a,"tables");console.log("load config url =",t);const s=await B().Get(t);if(console.log("---"),s.status!==200)throw new Error(s.message||"获取表格配置失败");this.data.tableConfig=s.data,this.dataService=new Ze(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:(r=this.data.tableConfig)==null?void 0:r.detail}),this.initSearchParams()}initSearchParams(){var s;const a={},t=((s=this.data.tableConfig)==null?void 0:s.search)||[];for(const r of t)a[r.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(),r=c=>c&&this.data.rows.find(d=>d[s]===c[s])||null;this.data.currentRow=r(a),this.data.detailData&&(this.data.detailData=r(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 tt={class:"table-search"},at={class:"search-fields"},ot={class:"search-actions"},lt=k(e.defineComponent({__name:"TableSearch",props:{fields:{},modelValue:{}},emits:["update:modelValue","search","reset"],setup(l,{emit:a}){const t=l,s=a,r={input:R,dict:I,dept:I,role:I,date:z,daterange:z},c={getComponent(d){return r[d]||R},updateValue(d,m){const o={...t.modelValue,[d]:m};s("update:modelValue",o)},handleSearch(){const d={};for(const m in t.modelValue){const o=t.modelValue[m];d[m]=typeof o=="string"?o.trim():o}s("update:modelValue",d),s("search")},handleReset(){s("reset")}};return(d,m)=>{const o=C.ElButton;return e.openBlock(),e.createElementBlock("div",tt,[e.createElementVNode("div",at,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.fields,n=>(e.openBlock(),e.createElementBlock("div",{key:n.field,class:"search-field"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(c.getComponent(n.type)),{"model-value":t.modelValue[n.field],"field-label":n.label,"dict-type":n.dictType,mode:n.type==="daterange"?"range":void 0,"label-position":"left","onUpdate:modelValue":i=>c.updateValue(n.field,i)},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",ot,[e.createVNode(o,{type:"primary",onClick:c.handleSearch},{default:e.withCtx(()=>[...m[0]||(m[0]=[e.createTextVNode("查询",-1)])]),_:1},8,["onClick"]),e.createVNode(o,{onClick:c.handleReset},{default:e.withCtx(()=>[...m[1]||(m[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-0281d2ce"]]),nt={class:"table-toolbar"},it={class:"toolbar-items"},st={key:1},rt=k(e.defineComponent({__name:"TableToolbar",props:{items:{},currentRow:{}},emits:["action"],setup(l,{emit:a}){const t=l,s=a,r=e.reactive({iconMap:{}}),c=e.computed(()=>({hasCurrentRow:!!t.currentRow})),d={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:d.needRow(m.action)&&!c.value.hasCurrentRow},getIcon(m){return m.icon?r.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=te,n={...r.iconMap};for(const i of m)o[i]&&(n[i]=e.markRaw(o[i]));r.iconMap=e.markRaw(n)}};return e.onMounted(()=>{d.ensureIcons()}),e.watch(()=>t.items,()=>{d.ensureIcons()}),(m,o)=>{const n=C.ElIcon,i=C.ElButton;return e.openBlock(),e.createElementBlock("div",nt,[e.renderSlot(m.$slots,"toolbar-left",{currentRow:t.currentRow},void 0,!0),e.createElementVNode("div",it,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,(u,f)=>(e.openBlock(),e.createBlock(i,{key:f,type:d.getButtonType(u),disabled:d.isDisabled(u),onClick:p=>d.handleClick(u)},{default:e.withCtx(()=>[d.getIcon(u)?(e.openBlock(),e.createBlock(n,{key:0},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d.getIcon(u))))]),_:2},1024)):e.createCommentVNode("",!0),d.getText(u)?(e.openBlock(),e.createElementBlock("span",st,e.toDisplayString(d.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-2a87e101"]]),ct=k(e.defineComponent({__name:"UInputShow",props:{modelValue:{},multiline:{type:Boolean,default:!1},maxLines:{default:0}},setup(l){const a=l,t=e.computed(()=>a.modelValue===null||a.modelValue===void 0?"":String(a.modelValue)),s=e.computed(()=>a.multiline||t.value.includes(`
2
- `)),r=e.computed(()=>a.maxLines>0&&s.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":s.value}]),style:e.normalizeStyle(r.value)},e.toDisplayString(t.value),7))}}),[["__scopeId","data-v-c78b151e"]]),dt=k(e.defineComponent({__name:"UDictShow",props:{modelValue:{},dictType:{},defaultText:{default:""}},setup(l){const a=l,t=e.ref(""),s=e.ref(!1),r=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 c=await le(a.dictType,a.modelValue,a.defaultText);t.value=c}catch(c){console.error("[UDictShow] 翻译失败:",c),t.value=String(a.modelValue)}finally{s.value=!1}};return e.watch(()=>a.modelValue,r,{immediate:!0}),e.watch(()=>a.dictType,()=>{a.dictType&&A(a.dictType).then(()=>r())}),e.onMounted(()=>{a.dictType?A(a.dictType).then(()=>r()):r()}),(c,d)=>(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"]]),mt=k(e.defineComponent({__name:"UToggleShow",props:{modelValue:{},trueText:{default:"开启"},falseText:{default:"关闭"},useYesNo:{type:Boolean,default:!1}},setup(l){const a=l,t=e.computed(()=>a.useYesNo?"是":a.trueText),s=e.computed(()=>a.useYesNo?"否":a.falseText),r=e.computed(()=>a.modelValue===!0||a.modelValue==="true"?t.value:a.modelValue===!1||a.modelValue==="false"?s.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,m)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-toggle-show",c.value])},e.toDisplayString(r.value),3))}}),[["__scopeId","data-v-bac05efc"]]),ut=k(e.defineComponent({__name:"UCascaderShow",props:{modelValue:{},cascaderKey:{},separator:{default:" / "},showRawValue:{type:Boolean,default:!0}},setup(l){const a=l,t=e.ref(""),s=e.ref(!1),r=async()=>{if(!a.modelValue||!Array.isArray(a.modelValue)){t.value="";return}const c=a.modelValue;if(a.cascaderKey){s.value=!0;try{const d=await A(a.cascaderKey),o=c.map(n=>{const i=d.find(u=>u.value===n||String(u.value)===String(n));return i?i.label:a.showRawValue?String(n):""}).filter(n=>n!=="");t.value=o.join(a.separator)}catch(d){console.error("[UCascaderShow] 翻译失败:",d),t.value=a.showRawValue?c.join(a.separator):""}finally{s.value=!1}}else t.value=c.join(a.separator)};return e.watch(()=>a.modelValue,r,{immediate:!0}),e.onMounted(()=>{r()}),(c,d)=>(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"]]),pt=k(e.defineComponent({__name:"UDateShow",props:{modelValue:{},mode:{default:"single"},locale:{default:"zh-CN"},format:{},separator:{default:", "},rangeSeparator:{default:" ~ "}},setup(l){const a=l,t=e.computed(()=>a.locale==="en-US"?a.mode==="range"?" - ":", ":a.mode==="range"?a.rangeSeparator:a.separator),s=e.computed(()=>{const d=a.modelValue;return a.mode==="single"?d?r(d,a.format):"":a.mode==="multiple"?d?Array.isArray(d)?d.map(m=>r(m,a.format)).join(t.value):String(d):"":a.mode==="range"?d?typeof d=="object"&&d.from&&d.to?`${r(d.from,a.format)}${t.value}${r(d.to,a.format)}`:Array.isArray(d)&&d.length>=2?`${r(d[0],a.format)}${t.value}${r(d[1],a.format)}`:String(d):"":String(d??"")});function r(d,m){return d||""}const c=e.computed(()=>!s.value);return(d,m)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-date-show",{"u-date-empty":c.value}])},e.toDisplayString(s.value||(l.locale==="en-US"?"Empty":"暂无")),3))}}),[["__scopeId","data-v-930657df"]]),j=k(e.defineComponent({__name:"UFieldView",props:{type:{default:"text"},modelValue:{},dictType:{},mode:{},locale:{default:"zh-CN"},format:{},text:{},trueText:{default:"开启"},falseText:{default:"关闭"},useYesNo:{type:Boolean,default:!1},cascaderKey:{},multiline:{type:Boolean},defaultText:{default:""}},setup(l){const a=l,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}),s=e.computed(()=>{var d;return a.trueText||((d=t.value)==null?void 0:d.trueText)||"开启"}),r=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,m)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(c.value==="UDictShow"?dt:c.value==="UToggleShow"?mt:c.value==="UCascaderShow"?ut:c.value==="UDateShow"?pt:ct),{"model-value":l.modelValue,"dict-type":l.type==="dict"?l.dictType:void 0,"cascader-key":l.type==="cascader"?l.cascaderKey:void 0,mode:l.type==="date"?l.mode:void 0,locale:l.type==="date"?l.locale:void 0,format:l.type==="date"?l.format:void 0,"true-text":l.type==="switch"?s.value:void 0,"false-text":l.type==="switch"?r.value:void 0,"use-yes-no":l.type==="switch"?l.useYesNo:void 0,multiline:l.type==="input"||l.type==="text"?l.multiline:void 0,"default-text":l.type==="dict"?l.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"]]),ft={class:"table-grid"},v="col-",ht=160,gt=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(l,{emit:a}){const t=l,s=e.useSlots(),r=a;function c(n){return n==="actions"||n==="actions-extra"||n.startsWith(v)}const d=e.computed(()=>{var n,i;return{actionList:t.actions||[],actionColumnWidth:t.actionsWidth??((n=t.actions)!=null&&n.length?o.getActionColumnWidth():ht),hasUserEmpty:!!s.empty,forwardSlots:Object.keys(s).filter(u=>u!=="default"&&!c(u)),colSlots:Object.keys(s).filter(u=>u.startsWith(v)),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 n=t.columns.map(i=>{const u={prop:i.field,label:i.label};return typeof i.width=="number"&&(u.width=i.width),u});return d.value.showActionColumn&&n.push({prop:"actions",label:"操作",width:d.value.actionColumnWidth,fixed:"right"}),n}),o={colSlotName(n){return v+n},hasColSlot(n){return d.value.colSlots.includes(o.colSlotName(n))},actionText(n){return n.text?n.text:{add:"新增",edit:"编辑",delete:"删除",preview:"预览",back:"返回"}[n.action]||""},actionType(n){return n.style?n.style==="default"?"":n.style:{add:"primary",edit:"primary",delete:"danger",preview:"primary",back:"primary"}[n.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(n){return!n||n.length<7?n:n.replace(/(\d{3})\d{4}(\d{4})/,"$1****$2")},maskIdCard(n){return!n||n.length<8?n:n.replace(/(\d{3})\d{11}(\d{4})/,"$1***********$2")},formatMoney(n){const i=Number(n);return isNaN(i)?String(n):i.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})},formatByType(n,i){if(!n)return"";switch(i){case"phone":return o.maskPhone(n);case"idcard":return o.maskIdCard(n);case"money":return o.formatMoney(n);case"percent":return String(n*100)+"%";default:return i&&i.includes("{}")?i.replace("{}",String(n)):String(n)}},getNestedValue(n,i){if(!i.includes("."))return n[i];const u=i.split(".");let f=n;for(const p of u)if(f&&typeof f=="object"&&p in f)f=f[p];else return;return f},useFieldView(n){return n.type?["dict","switch","cascader","date","input","text"].includes(n.type):!1},rowClassName({row:n}){if(!n||t.activeKey===void 0||t.activeKey===null)return"";const i=t.keyField||"id";return n[i]===t.activeKey?"table-grid-active-row":""},onSelectionChange(n){r("selectionChange",n)},onRowClick(n){r("rowClick",n)},onRowAction(n,i){r("rowAction",{action:n.action,item:n,row:i})}};return(n,i)=>{const u=C.ElTableColumn,f=C.ElButton,p=C.ElTable;return e.openBlock(),e.createElementBlock("div",ft,[e.createVNode(p,e.mergeProps({stripe:!0,border:!0,...n.$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},[d.value.hasActionsSlot?e.renderSlot(n.$slots,"actions",{row:g,actions:d.value.actionList},void 0,!0,1):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(d.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(N=>o.onRowAction(y,g),["stop"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.actionText(y)),1)]),_:2},1032,["type","disabled","onClick"]))),128)),e.renderSlot(n.$slots,"actions-extra",{row:g},void 0,!0)],64)):o.hasColSlot(h.prop)?e.renderSlot(n.$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(j,{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(n.$slots,"default",{},void 0,!0)]),_:2},[e.renderList(d.value.forwardSlots,h=>({name:h,fn:e.withCtx(g=>[e.renderSlot(n.$slots,h,e.normalizeProps(e.guardReactiveProps(g||{})),void 0,!0)])})),d.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"]]),yt={class:"table-pagination"},bt={class:"page-size-select"},wt={class:"total-text"},Ct={key:1,class:"load-more"},kt={key:2,class:"total-text"},xt=k(e.defineComponent({__name:"TablePagination",props:{page:{},pageSize:{},total:{},type:{}},emits:["update:page","update:pageSize"],setup(l,{emit:a}){const t=l,s=a,r=e.computed(()=>({totalPages:Math.ceil(t.total/t.pageSize),showPagination:t.type==="page"&&t.total>0})),c={onPageChange:d=>{s("update:page",d)},onPageSizeChange:d=>{s("update:pageSize",d)}};return(d,m)=>{const o=C.ElPagination,n=C.ElOption,i=C.ElSelect,u=C.ElButton;return e.openBlock(),e.createElementBlock("div",yt,[r.value.showPagination?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(o,{"current-page":t.page,"page-count":r.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",bt,[e.createVNode(i,{"model-value":t.pageSize,style:{width:"100px"},onChange:c.onPageSizeChange},{default:e.withCtx(()=>[e.createVNode(n,{value:10,label:"10条/页"}),e.createVNode(n,{value:20,label:"20条/页"}),e.createVNode(n,{value:50,label:"50条/页"}),e.createVNode(n,{value:100,label:"100条/页"})]),_:1},8,["model-value","onChange"]),e.createElementVNode("span",wt,"共 "+e.toDisplayString(t.total)+" 条",1)])],64)):t.type==="auto"?(e.openBlock(),e.createElementBlock("div",Ct,[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",kt,"共 "+e.toDisplayString(t.total)+" 条",1)):e.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-2ca77d18"]]),St={class:"table-detail"},Bt={key:0,class:"detail-header"},Vt={class:"detail-title"},_t={class:"detail-body"},Dt={key:0,class:"detail-status"},Et={key:1,class:"detail-content"},Tt={class:"detail-label"},Pt={class:"detail-value"},$t={key:2,class:"detail-status"},ee=k(e.defineComponent({__name:"TableDetail",props:{showHeader:{type:Boolean},title:{},loading:{type:Boolean},rowData:{},columns:{},emptyText:{},extraMode:{}},setup(l){const a=l,t=e.useSlots(),s=e.computed(()=>!!t["detail-extra"]),r=e.computed(()=>s.value),c=e.computed(()=>!s.value||a.extraMode==="append"),d=e.computed(()=>({showHeader:a.showHeader!==!1,title:a.title||"详情",emptyText:a.emptyText||"暂无数据",hasRow:!!a.rowData})),m={getNestedValue(o,n){if(!o||!n)return"";if(!n.includes("."))return o[n];const i=n.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,n)=>(e.openBlock(),e.createElementBlock("div",St,[d.value.showHeader?(e.openBlock(),e.createElementBlock("div",Bt,[e.createElementVNode("div",Vt,e.toDisplayString(d.value.title),1)])):e.createCommentVNode("",!0),e.createElementVNode("div",_t,[c.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[a.loading?(e.openBlock(),e.createElementBlock("div",Dt,"加载中...")):d.value.hasRow?(e.openBlock(),e.createElementBlock("div",Et,[(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",Tt,e.toDisplayString(i.label),1),e.createElementVNode("div",Pt,[e.createVNode(j,{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",$t,e.toDisplayString(d.value.emptyText),1))],64)):e.createCommentVNode("",!0),r.value?e.renderSlot(o.$slots,"detail-extra",{rowData:a.rowData,columns:a.columns},void 0,!0,1):e.createCommentVNode("",!0)])]))}}),[["__scopeId","data-v-7e47b0ba"]]),Nt={class:"table-body"},Rt={class:"table-container"},ie=k(e.defineComponent({inheritAttrs:!1,__name:"TableRender",props:{formId:{},detailExtraMode:{}},emits:["back","toolbar-action","row-action"],setup(l,{expose:a,emit:t}){const s=["search-extra","search-actions","toolbar-left","toolbar-extra","detail-extra"],r=l,c=e.useAttrs(),d=e.useSlots(),m=t,o=new et,n=e.ref(null),i=e.reactive({searchParams:{},loaded:!1,dictData:{}});e.onMounted(async()=>{r.formId&&await f.loadConfig(r.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}=c;return g},getTableSlots(){const p={};for(const h of Object.keys(d))s.includes(h)||(p[h]=!0);return p},getDetailSlots(){return d["detail-extra"]?["detail-extra"]:[]},getDetailExtraMode(){return r.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 B().Get(E.dictApi(g));y.status===200&&(i.dictData[g]=O(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){D.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){D.warning("未配置表单,无法新增");return}if(!n.value)return;await n.value.showForm(h)!=null&&await f.handleLoadData()},async handleEdit(p,h){if(!p){D.warning("请先点击表格中的一行数据");return}const g=h?o.getButtonFormId(h):o.getFormId();if(!g){D.warning("未配置表单,无法编辑");return}if(!n.value)return;const y=o.getKeyField();await n.value.showForm(g,`${y}=${p[y]}`)!=null&&await f.handleLoadData()},async handleDelete(p,h){if(!p){D.warning("请先点击表格中的一行数据");return}try{await V.ElMessageBox.confirm((h==null?void 0:h.confirm)||"确定要删除这条数据吗?","确认删除",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"})}catch{return}try{await o.deleteRow(p),D.success("删除成功")}catch(g){_((g==null?void 0:g.message)||"删除失败")}},async handleExport(){try{await o.exportData(),D.success("导出成功")}catch(p){_((p==null?void 0:p.message)||"导出失败")}},async handleCustomAction(p){const{item:h,row:g}=p;if(!(h!=null&&h.url)){D.warning(`未识别的按钮动作:${p.action}`);return}try{await V.ElMessageBox.confirm(h.confirm||"确定执行该操作吗?","确认",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"})}catch{return}try{const y=await B().Post(h.url,g||{});if(y.status!==200)throw new Error(y.message||"操作失败");D.success(y.message||"操作成功"),await f.handleLoadData()}catch(y){_((y==null?void 0:y.message)||"操作失败")}}};return a({loadConfig:f.loadConfig}),(p,h)=>{var y,x,N,se,re,ce,de;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(lt,{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",Nt,[e.createElementVNode("div",Rt,[e.createVNode(gt,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(Mt=>[e.renderSlot(p.$slots,P,e.normalizeProps(e.guardReactiveProps(Mt||{})),void 0,!0)])}))]),1040,["rows","columns","loading","actions","actions-width","key-field","dict-data","active-key","onRowAction","onRowClick"]),e.createVNode(xt,{class:"table-pagination",page:u.value.pagination.page,"page-size":u.value.pagination.pageSize,total:u.value.total,type:(N=u.value.tableConfig)==null?void 0:N.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(ee,{key:0,class:e.normalizeClass(["table-detail-inline",`table-detail-inline-${u.value.detailSide}`]),style:e.normalizeStyle({width:u.value.detailWidth}),title:(re=(se=u.value.tableConfig)==null?void 0:se.meta)==null?void 0:re.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:((de=(ce=u.value.tableConfig)==null?void 0:ce.meta)==null?void 0:de.title)||"详情",onClose:f.handleDetailClose,onClosed:f.handleDetailClosed},{default:e.withCtx(()=>[e.createVNode(ee,{"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(ee,{"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(rt,{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(Z,{ref_key:"formRef",ref:n},null,512)],6)}}}),[["__scopeId","data-v-1d0ae5e9"]]),At={UInput:R,UInputNumber:Q,UDict:I,UToggle:J,UCascader:X,UDate:z,UMenu:ne,FormRender:Z,TableRender:ie,UFieldView:j},It={install(l){l.use(V);for(const[a,t]of Object.entries(At))l.component(a,t)}};b.FormRender=Z,b.GetQf=xe,b.TableRender=ie,b.UCascader=X,b.UDate=z,b.UDict=I,b.UFieldView=j,b.UInput=R,b.UInputNumber=Q,b.UMenu=ne,b.UToggle=J,b.apis=E,b.clearDictCache=_e,b.default=It,b.flattenDictTree=Se,b.getDict=A,b.getQf=B,b.mapDictTree=W,b.normalizeDictNode=q,b.notify=D,b.notifyUtil=M,b.preloadDicts=Ve,b.resolveAppBase=ae,b.setDictCache=De,b.toDictOptions=O,b.translateDict=le,b.translateDictSync=Be,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(g,b){typeof exports=="object"&&typeof module<"u"?b(exports,require("element-plus"),require("element-plus/dist/index.css"),require("vue"),require("element-plus/es"),require("element-plus/es/components/base/style/css"),require("element-plus/es/components/option/style/css"),require("element-plus/es/components/select/style/css"),require("axios"),require("mitt"),require("mqtt"),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/icons-vue")):typeof define=="function"&&define.amd?define(["exports","element-plus","element-plus/dist/index.css","vue","element-plus/es","element-plus/es/components/base/style/css","element-plus/es/components/option/style/css","element-plus/es/components/select/style/css","axios","mitt","mqtt","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/icons-vue"],b):(g=typeof globalThis<"u"?globalThis:g||self,b(g.UritQfUI={},g.ElementPlus,g.ElementPlus,g.Vue,g.ElementPlus,g.ElementPlus,g.ElementPlus,g.ElementPlus,g.axios,g.mitt,g.mqtt,g.ElementPlus,g.ElementPlus,g.ElementPlus,g.ElementPlus,g.ElementPlus,g.ElementPlusIconsVue))})(this,function(g,b,O,e,P,Ft,zt,qt,Ge,He,Ye,Ut,Wt,jt,Gt,Ht,ve){"use strict";var Rt=Object.defineProperty;var Dt=(g,b,O)=>b in g?Rt(g,b,{enumerable:!0,configurable:!0,writable:!0,value:O}):g[b]=O;var x=(g,b,O)=>Dt(g,typeof b!="symbol"?b+"":b,O);function Qe(i){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const n in i)if(n!=="default"){const c=Object.getOwnPropertyDescriptor(i,n);Object.defineProperty(a,n,c.get?c:{enumerable:!0,get:()=>i[n]})}}return a.default=i,Object.freeze(a)}const Ke=Qe(ve),Je=["el-select","el-radio-group","el-checkbox-group","el-cascader","el-tree-select","el-date-picker","el-time-picker","el-time-select","el-switch","el-slider","el-rate","el-color-picker","el-segmented"];function ee(i="el-input"){return Je.includes(i)?"change":"blur"}function _(i,a){if(!i||!a)return;const n=String(a).split(".");let c=i;for(const u of n){if(c==null)return;c=c[u]}return c}function T(i,a,n){const c=String(a).split(".");let u=i;for(let m=0;m<c.length-1;m++){const f=c[m],d=u[f];d==null||typeof d!="object"?u[f]={}:u[f]=Array.isArray(d)?d.slice():{...d},u=u[f]}u[c[c.length-1]]=n}function L(i){return i==null||i===""?!0:Array.isArray(i)?i.length===0||i.every(L):!1}function S(i){if(i==null||i==="")return;if(typeof i=="number")return`${i}px`;const a=String(i).trim();return/^-?\d+(\.\d+)?$/.test(a)?`${a}px`:a}function E(i,a="-"){return i==null||i===""?a:Array.isArray(i)?i.length?i.join("、"):a:typeof i=="boolean"?i?"是":"否":String(i)}function te(i){return Array.isArray(i)?i.map(te):i!==null&&typeof i=="object"?{...i}:i}function oe(i){const a={};for(const n of(i==null?void 0:i.fields)||[])n.default!==void 0&&T(a,n.field,te(n.default));return a}function Ze(i){return i.required?!0:(i.rules||[]).some(a=>a==null?void 0:a.required)}function le(i={},a=[]){const n={...i||{}};for(const c of a)!c||!c.includes(".")||(n[c]=_(i,c));return n}function ne(i={}){const a={},n=[];for(const[c,u]of Object.entries(i||{}))c.includes(".")?n.push([c,u]):a[c]=u;for(const[c,u]of n)T(a,c,u);return a}const Xe={key:2,class:"u-form-tip"},et=e.defineComponent({inheritAttrs:!1,__name:"UForm",props:{modelValue:{default:()=>({})},options:{}},emits:["update:modelValue","submit"],setup(i,{expose:a,emit:n}){const c=i,u=n,m=e.useSlots(),f=e.ref(null),d=e.reactive({controls:e.markRaw({"el-input":b.ElInput,"el-input-number":b.ElInputNumber,"el-select":b.ElSelect,"el-radio-group":b.ElRadioGroup,"el-checkbox-group":b.ElCheckboxGroup,"el-switch":b.ElSwitch,"el-slider":b.ElSlider,"el-rate":b.ElRate,"el-color-picker":b.ElColorPicker,"el-date-picker":b.ElDatePicker,"el-time-picker":b.ElTimePicker,"el-cascader":b.ElCascader,"el-tree-select":b.ElTreeSelect,"el-autocomplete":b.ElAutocomplete,"el-segmented":b.ElSegmented}),optionChildren:e.markRaw({"el-select":b.ElOption,"el-radio-group":b.ElRadio,"el-checkbox-group":b.ElCheckbox}),options:null});e.watch(()=>c.options,t=>{t&&(d.options=t)},{immediate:!0});const s=e.computed(()=>{const t=d.options||{fields:[]},o=(t.fields||[]).filter(h=>!h.hidden),r=Number(t.columns),p=Number.isFinite(r)&&r>0?Math.floor(24/r):24;return{fields:o,baseSpan:p,gutter:Number(t.gutter)||0,formProps:l.buildFormProps(t)}}),l={init(){},setOptions(t){d.options=t},getOptions(){return d.options},buildFormProps(t){const o={};return t.labelWidth!==void 0&&(o.labelWidth=t.labelWidth),t.labelPosition&&(o.labelPosition=t.labelPosition),t.labelSuffix!==void 0&&(o.labelSuffix=t.labelSuffix),t.hideRequiredAsterisk!==void 0&&(o.hideRequiredAsterisk=t.hideRequiredAsterisk),t.size&&(o.size=t.size),t.disabled!==void 0&&(o.disabled=t.disabled),o},resolveSpan(t){const o=Number(t.colSpan);return Number.isFinite(o)&&o>0?Math.min(24,Math.floor(o)):s.value.baseSpan},resolveControl(t){return d.controls[t.type||"el-input"]||b.ElInput},resolveOptionChild(t){return!Array.isArray(t.options)||t.options.length===0?null:d.optionChildren[t.type||"el-input"]||null},controlProps(t){var p;const o=t.type||"el-input",r={...t.props||{}};return r.placeholder===void 0&&(r.placeholder=l.defaultPlaceholder(t,o)),r.disabled=!!(r.disabled||t.disabled||(p=d.options)!=null&&p.disabled),(o==="el-cascader"||o==="el-tree-select")&&r.options===void 0&&(r.options=t.options||[]),r},defaultPlaceholder(t,o){const r=t.label||t.field;return l.isChooseControl(o)?`请选择${r}`:`请输入${r}`},isChooseControl(t){return["el-select","el-radio-group","el-checkbox-group","el-cascader","el-tree-select","el-date-picker","el-time-picker","el-time-select","el-segmented"].includes(t)},optionProps(t){return{label:t.label,value:t.value,disabled:t.disabled}},resolveRules(t){const o=[...t.rules||[]];if(t.required){const r=t.type||"el-input";o.push({required:!0,message:`${l.isChooseControl(r)?"请选择":"请输入"}${t.label||t.field}`,trigger:ee(r)})}return o},getValue(t){return _(c.modelValue,t)},setValue(t,o){const r={...c.modelValue||{}};T(r,t,o),u("update:modelValue",r)},fieldSlotName(t){return m[t.field]?t.field:m[`field-${t.field}`]?`field-${t.field}`:null},slotProps(t){return{field:t,value:l.getValue(t.field),model:c.modelValue||{},setValue:o=>l.setValue(t.field,o)}},async submit(){let t=!1;try{t=await l.validate()!==!1}catch{t=!1}return t?(u("submit",c.modelValue||{}),!0):!1},validate(t){var o,r;return t?(o=f.value)==null?void 0:o.validate(t):(r=f.value)==null?void 0:r.validate()},validateField(...t){var o;return(o=f.value)==null?void 0:o.validateField(...t)},resetFields(...t){var o;return(o=f.value)==null?void 0:o.resetFields(...t)},clearValidate(...t){var o;return(o=f.value)==null?void 0:o.clearValidate(...t)},scrollToField(...t){var o;return(o=f.value)==null?void 0:o.scrollToField(...t)},getFieldItem(t){var o,r,p;return(p=(r=(o=f.value)==null?void 0:o.fields)==null?void 0:r.find)==null?void 0:p.call(r,h=>h.prop===t)}};return a({setOptions:l.setOptions,getOptions:l.getOptions,validate:l.validate,validateField:l.validateField,resetFields:l.resetFields,clearValidate:l.clearValidate,scrollToField:l.scrollToField,submit:l.submit,getFieldItem:l.getFieldItem,formRef:f}),(t,o)=>(e.openBlock(),e.createBlock(e.unref(b.ElForm),e.mergeProps({ref_key:"formRef",ref:f},{...s.value.formProps,...t.$attrs},{model:i.modelValue,class:"u-form"}),{default:e.withCtx(()=>[e.createVNode(e.unref(b.ElRow),{gutter:s.value.gutter},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value.fields,r=>(e.openBlock(),e.createBlock(e.unref(b.ElCol),{key:r.field,span:l.resolveSpan(r)},{default:e.withCtx(()=>[e.createVNode(e.unref(b.ElFormItem),e.mergeProps({prop:r.field,label:r.label,rules:l.resolveRules(r)},{ref_for:!0},r.itemProps),e.createSlots({default:e.withCtx(()=>[l.fieldSlotName(r)?e.renderSlot(t.$slots,l.fieldSlotName(r),e.mergeProps({ref_for:!0},l.slotProps(r)),void 0,!0,0):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.resolveControl(r)),e.mergeProps({key:1,ref_for:!0},l.controlProps(r),{"model-value":l.getValue(r.field),"onUpdate:modelValue":p=>l.setValue(r.field,p)}),{default:e.withCtx(()=>[l.resolveOptionChild(r)?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(r.options,p=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.resolveOptionChild(r)),e.mergeProps({key:String(p.value)},{ref_for:!0},l.optionProps(p)),null,16))),128)):e.createCommentVNode("",!0)]),_:2},1040,["model-value","onUpdate:modelValue"])),r.tip?(e.openBlock(),e.createElementBlock("div",Xe,e.toDisplayString(r.tip),1)):e.createCommentVNode("",!0)]),_:2},[e.unref(m)[`${r.field}--label`]?{name:"label",fn:e.withCtx(()=>[e.renderSlot(t.$slots,`${r.field}--label`,e.mergeProps({ref_for:!0},l.slotProps(r)),void 0,!0)]),key:"0"}:void 0]),1040,["prop","label","rules"])]),_:2},1032,["span"]))),128))]),_:3},8,["gutter"])]),_:3},16,["model"]))}}),V=(i,a)=>{const n=i.__vccOpts||i;for(const[c,u]of a)n[c]=u;return n},W=V(et,[["__scopeId","data-v-4d3a2327"]]),tt=_;function I(i,a){return Array.isArray(a)&&a.find(n=>n.value===i)||null}function re(i){var a;return i.width!==void 0?i.width:(a=i.props)==null?void 0:a.width}function ae(i){var a;return i.minWidth!==void 0?i.minWidth:(a=i.props)==null?void 0:a.minWidth}function ot(i){if(i.slot)return typeof i.slot=="string"?i.slot:i.field}function lt(i){return i.type==="index"||i.type==="selection"||i.type==="expand"}const nt={class:"u-table"},rt={key:5},at={class:"u-table-actions"},j=V(e.defineComponent({inheritAttrs:!1,__name:"UTable",props:{data:{},options:{}},emits:["row-click","selection-change","sort","expand-change","cell-click","action-click"],setup(i,{expose:a,emit:n}){const c=i,u=n,m=e.useSlots(),f=e.ref(null),d=e.markRaw(["primary","success","info","warning","danger"]),s=e.reactive({rowKeyCandidates:["id","ID","key","uuid"],options:null});e.watch(()=>c.options,o=>{o&&(s.options=o)},{immediate:!0});const l=e.computed(()=>{const o=s.options||{columns:[]},r=(o.columns||[]).filter(h=>!h.hidden),p=c.data!==void 0?c.data:o.data||[];return{columns:r,rows:p,opt:o,tableProps:t.buildTableProps(o),rowKey:t.resolveRowKey(o,p),hasActionColumn:(o.actions||[]).length>0||!!m.actions}}),t={init(){},setOptions(o){s.options=o},getOptions(){return s.options},buildTableProps(o){const r={};return r.border=o.border!==!1,o.stripe!==void 0&&(r.stripe=o.stripe),o.showHeader!==void 0&&(r.showHeader=o.showHeader),o.size&&(r.size=o.size),o.defaultExpandAll!==void 0&&(r.defaultExpandAll=o.defaultExpandAll),o.rowClassName!==void 0&&(r.rowClassName=o.rowClassName),o.headerRowClassName!==void 0&&(r.headerRowClassName=o.headerRowClassName),o.highlightCurrentRow!==void 0&&(r.highlightCurrentRow=o.highlightCurrentRow),o.height!==void 0&&(r.height=o.height),o.maxHeight!==void 0&&(r.maxHeight=o.maxHeight),o.defaultSort!==void 0&&(r.defaultSort=o.defaultSort),r},resolveRowKey(o,r){if(o.rowKey)return o.rowKey;const p=r==null?void 0:r[0];if(!(!p||typeof p!="object"))return s.rowKeyCandidates.find(h=>p[h]!==void 0)},columnProps(o){const r={...o.props||{}},p=re(o);p!==void 0&&(r.width=p);const h=ae(o);return h!==void 0&&(r.minWidth=h),o.fixed!==void 0&&(r.fixed=o.fixed),o.align!==void 0&&(r.align=o.align),o.sortable!==void 0&&(r.sortable=o.sortable),o.showOverflowTooltip!==void 0&&(r.showOverflowTooltip=o.showOverflowTooltip),r},useSlot(o){return o.type==="slot"||o.slot===!0||typeof o.slot=="string"},columnSlotName(o){return o?typeof o.slot=="string"?o.slot:o.field||null:null},hasColumnSlot(o){const r=t.columnSlotName(o);return!!r&&!!m[r]},cellSlotProps(o,r,p,h){return{row:r,column:h,$index:p,value:t.cellValue(o,r)}},cellValue(o,r){return _(r,o.field)},cellText(o,r){const p=t.cellValue(o,r);return typeof o.formatter=="function"?E(o.formatter(r,p,0),o.emptyText):E(p,o.emptyText)},tagLabel(o,r){const p=t.cellValue(o,r),h=I(p,o.options);return h?h.label:E(p,o.emptyText)},tagType(o,r){const p=I(t.cellValue(o,r),o.options),h=p==null?void 0:p.type;return d.includes(h)?h:"primary"},tagColor(o,r){const p=I(t.cellValue(o,r),o.options);return p==null?void 0:p.color},linkHref(o,r){const p=o.props||{};return p.hrefField?String(_(r,p.hrefField)??""):String(t.cellValue(o,r)??"")},progressValue(o,r){const p=Number(t.cellValue(o,r));return Number.isFinite(p)?p:0},switchValue(o,r){const p=o.props||{},h=t.cellValue(o,r);return p.trueValue!==void 0?h===p.trueValue:!!h},actionSlotProps(o,r){return{row:o,$index:r}},hasActions(){return l.value.hasActionColumn},onActionClick(o,r,p){u("action-click",o,r,p)},isBareColumn(o){return o.type==="index"||o.type==="selection"},onSelectionChange(o){u("selection-change",o||[])},onSortChange(o){u("sort",{prop:(o==null?void 0:o.prop)??"",order:(o==null?void 0:o.order)??null})},onExpandChange(o,r){u("expand-change",o,r||[])},clearSelection(...o){var r;return(r=f.value)==null?void 0:r.clearSelection(...o)},getSelectionRows(){var o;return(o=f.value)==null?void 0:o.getSelectionRows()},toggleRowSelection(...o){var r;return(r=f.value)==null?void 0:r.toggleRowSelection(...o)},toggleAllSelection(){var o;return(o=f.value)==null?void 0:o.toggleAllSelection()},toggleRowExpansion(...o){var r;return(r=f.value)==null?void 0:r.toggleRowExpansion(...o)},setCurrentRow(...o){var r;return(r=f.value)==null?void 0:r.setCurrentRow(...o)},clearSort(){var o;return(o=f.value)==null?void 0:o.clearSort()},clearFilter(...o){var r;return(r=f.value)==null?void 0:r.clearFilter(...o)},doLayout(){var o;return(o=f.value)==null?void 0:o.doLayout()},sort(...o){var r;return(r=f.value)==null?void 0:r.sort(...o)},scrollTo(...o){var r;return(r=f.value)==null?void 0:r.scrollTo(...o)},getColumns(){return l.value.columns}};return a({setOptions:t.setOptions,getOptions:t.getOptions,clearSelection:t.clearSelection,getSelectionRows:t.getSelectionRows,toggleRowSelection:t.toggleRowSelection,toggleAllSelection:t.toggleAllSelection,toggleRowExpansion:t.toggleRowExpansion,setCurrentRow:t.setCurrentRow,clearSort:t.clearSort,clearFilter:t.clearFilter,doLayout:t.doLayout,sort:t.sort,scrollTo:t.scrollTo,getColumns:t.getColumns,tableRef:f}),(o,r)=>(e.openBlock(),e.createElementBlock("div",nt,[e.createVNode(e.unref(b.ElTable),e.mergeProps({ref_key:"tableRef",ref:f},{...l.value.tableProps,...o.$attrs},{data:l.value.rows,"row-key":l.value.rowKey,onRowClick:r[0]||(r[0]=(p,h,y)=>u("row-click",p,h,y)),onSelectionChange:r[1]||(r[1]=p=>t.onSelectionChange(p)),onSortChange:r[2]||(r[2]=p=>t.onSortChange(p)),onExpandChange:r[3]||(r[3]=(p,h)=>t.onExpandChange(p,h)),onCellClick:r[4]||(r[4]=(p,h,y,C)=>u("cell-click",p,h,y,C))}),{empty:e.withCtx(()=>[e.renderSlot(o.$slots,"empty",{},()=>[e.createVNode(e.unref(b.ElEmpty),{description:l.value.opt.emptyText||"暂无数据","image-size":80},null,8,["description"])],!0)]),default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value.columns,(p,h)=>(e.openBlock(),e.createBlock(e.unref(b.ElTableColumn),e.mergeProps({key:p.field||`${p.type}-${h}`,prop:p.field,label:p.label,type:["index","selection","expand"].includes(p.type||"")?p.type:void 0},{ref_for:!0},t.columnProps(p)),e.createSlots({_:2},[p.type==="expand"?{name:"default",fn:e.withCtx(y=>[e.renderSlot(o.$slots,"expand",e.mergeProps({ref_for:!0},t.cellSlotProps(p,y.row,y.$index,y.column)),()=>[e.createVNode(e.unref(b.ElEmpty),{description:"未配置展开内容(用 #expand 插槽)","image-size":60})],!0)]),key:"0"}:t.hasColumnSlot(p)?{name:"default",fn:e.withCtx(y=>[e.renderSlot(o.$slots,t.columnSlotName(p),e.mergeProps({ref_for:!0},t.cellSlotProps(p,y.row,y.$index,y.column)),void 0,!0)]),key:"1"}:t.isBareColumn(p)?void 0:{name:"default",fn:e.withCtx(y=>[p.type==="tag"?(e.openBlock(),e.createBlock(e.unref(b.ElTag),{key:0,type:t.tagType(p,y.row),color:t.tagColor(p,y.row),"disable-transitions":""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.tagLabel(p,y.row)),1)]),_:2},1032,["type","color"])):p.type==="image"?(e.openBlock(),e.createBlock(e.unref(b.ElImage),{key:1,src:String(t.cellValue(p,y.row)??""),"preview-src-list":[String(t.cellValue(p,y.row)??"")],"preview-teleported":!0,fit:"cover",class:"u-table-image"},null,8,["src","preview-src-list"])):p.type==="link"?(e.openBlock(),e.createBlock(e.unref(b.ElLink),{key:2,type:"primary",href:t.linkHref(p,y.row),target:(p.props||{}).target||"_blank"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.cellText(p,y.row)),1)]),_:2},1032,["href","target"])):p.type==="switch"?(e.openBlock(),e.createBlock(e.unref(b.ElSwitch),{key:3,"model-value":t.switchValue(p,y.row),disabled:""},null,8,["model-value"])):p.type==="progress"?(e.openBlock(),e.createBlock(e.unref(b.ElProgress),{key:4,percentage:t.progressValue(p,y.row)},null,8,["percentage"])):(e.openBlock(),e.createElementBlock("span",rt,e.toDisplayString(t.cellText(p,y.row)),1))]),key:"2"}]),1040,["prop","label","type"]))),128)),l.value.hasActionColumn?(e.openBlock(),e.createBlock(e.unref(b.ElTableColumn),{key:0,label:"操作",fixed:l.value.opt.actionFixed??"right",width:l.value.opt.actionWidth??160,align:l.value.opt.actionAlign??"center"},{default:e.withCtx(p=>[e.createElementVNode("div",at,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value.opt.actions,(h,y)=>(e.openBlock(),e.createBlock(e.unref(b.ElButton),e.mergeProps({key:`action-${y}`},{ref_for:!0},h.props,{type:h.style,link:"",onClick:e.withModifiers(C=>t.onActionClick(h,p.row,p.$index),["stop"])}),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(h.text||h.action),1)]),_:2},1040,["type","onClick"]))),128)),e.renderSlot(o.$slots,"actions",e.normalizeProps(e.guardReactiveProps(t.actionSlotProps(p.row,p.$index))),void 0,!0)])]),_:3},8,["fixed","width","align"])):e.createCommentVNode("",!0)]),_:3},16,["data","row-key"])]))}}),[["__scopeId","data-v-4abfaa00"]]);function se(i){const a=n=>n.some(c=>{var u;return!!((u=c.children)!=null&&u.length)||a(c.children||[])});return a(i.options||[])}function ie(i){const a=(n,c)=>n.reduce((u,m)=>{var f;return(f=m.children)!=null&&f.length?Math.max(u,a(m.children,c+1)):u},c);return Math.max(1,a(i.options||[],1))}function R(i){const a=[],n=u=>{u&&!a.includes(u)&&a.push(u)};n(i.field);const c=(u=[])=>{var m;for(const f of u)n(f.field),(m=f.children)!=null&&m.length&&c(f.children)};return c(i.options),a}function ce(i){const a=[];let n=i.options||[],c=i.field,u=i.fieldLabel||i.label||i.field;for(let m=0;m<ie(i);m++){a.push({field:c,label:u});const f=n.find(d=>{var s;return(s=d.children)==null?void 0:s.length});c=(f==null?void 0:f.field)||c,u=(f==null?void 0:f.fieldLabel)||(f==null?void 0:f.field)||u,n=(f==null?void 0:f.children)||[]}return a}function D(i,a){const n=ce(i),c=[];let u=i.options||[];for(const m of n){const f=_(a,m.field);c.push({field:m.field,label:m.label,options:u,value:f});const d=u.find(s=>s.value===f);u=(d==null?void 0:d.children)||[]}return c}function F(i){return Array.isArray(i)?i.filter(a=>a&&typeof a=="object").map(a=>{const n=typeof a.info=="object"&&a.info?a.info:{},c=a.label??a.text??a.name??a.dict_value,u=a.value??a.id??a.dict_code??n.code,m={...a,label:c==null?String(u??""):String(c),value:u};return Array.isArray(a.children)&&a.children.length>0?m.children=F(a.children):delete m.children,m}):[]}const G=V(e.defineComponent({inheritAttrs:!1,__name:"UCascader",props:{modelValue:{default:()=>({})},options:{}},emits:["update:modelValue","change"],setup(i,{expose:a,emit:n}){const c=i,u=n,m=e.reactive({options:null});e.watch(()=>c.options,s=>{s&&(m.options=s)},{immediate:!0});const f=e.computed(()=>{const s=m.options||{field:""},l=c.modelValue||{};return{opt:s,levels:D(s,l),labelPosition:s.labelPosition??"left",labelWidth:s.labelWidth??80,labelAlign:s.labelAlign??"right",showLabel:s.showLabel!==!1,gutter:Number(s.gutter)||8,disabled:!!s.disabled,selectProps:s.props||{}}}),d={init(){},setOptions(s){m.options=s},getOptions(){return m.options},levelValue(s){return L(s.value)?void 0:s.value},levelPlaceholder(s){const l=f.value.opt;return s===0?l.placeholder||"请选择":l.subPlaceholder||"请选择"},getLevels(){return D(f.value.opt,c.modelValue||{})},getValue(){return{...c.modelValue||{}}},clearField(s,l){if(!l.includes(".")){delete s[l];return}T(s,l,void 0)},setModel(s){u("update:modelValue",s||{})},setValue(s,l){const t={...c.modelValue||{}};T(t,s,l),d.setModel(t)},onLevelChange(s,l){const t=f.value.opt,o=d.getLevels(),r=o[s];if(!r)return;const p={...c.modelValue||{}};T(p,r.field,l);const h=new Set(o.slice(0,s+1).map(y=>y.field));for(const y of R(t))h.has(y)||d.clearField(p,y);d.setModel(p),u("change",{level:s,field:r.field,value:l,model:p,levels:D(t,p)})},reset(){const s=f.value.opt,l={...c.modelValue||{}};for(const t of R(s))d.clearField(l,t);d.setModel(l)},labelStyle(){const s=f.value;return s.labelPosition==="left"?{width:S(s.labelWidth),textAlign:s.labelAlign}:{width:"100%",textAlign:"left"}}};return a({setOptions:d.setOptions,getOptions:d.getOptions,getValue:d.getValue,getLevels:d.getLevels,setValue:d.setValue,setModel:d.setModel,reset:d.reset}),(s,l)=>{const t=P.ElOption,o=P.ElSelect;return e.openBlock(),e.createElementBlock("div",e.mergeProps({class:["u-cascader",[`u-cascader--label-${f.value.labelPosition}`,{"u-cascader--disabled":f.value.disabled}]],style:{gap:f.value.gutter+"px"}},s.$attrs),[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value.levels,(r,p)=>(e.openBlock(),e.createElementBlock("div",{key:`${r.field}-${p}`,class:"u-cascader-level"},[f.value.showLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-cascader-label",style:e.normalizeStyle(d.labelStyle())},e.toDisplayString(r.label),5)):e.createCommentVNode("",!0),e.createVNode(o,e.mergeProps({class:"u-cascader-control","model-value":d.levelValue(r)},{ref_for:!0},f.value.selectProps,{placeholder:d.levelPlaceholder(p),disabled:f.value.disabled,"onUpdate:modelValue":h=>d.onLevelChange(p,h)}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.options,h=>(e.openBlock(),e.createBlock(t,{key:String(h.value),label:h.label,value:h.value,disabled:h.disabled},null,8,["label","value","disabled"]))),128))]),_:2},1040,["model-value","placeholder","disabled","onUpdate:modelValue"])]))),128))],16)}}}),[["__scopeId","data-v-8fb1ac06"]]),st=["select","date","daterange","datetime"];function z(i){const a=i.label||i.fieldLabel||i.field;return st.includes(String(i.type))?`请选择${a}`:`请输入${a}`}function M(i={}){const a={};for(const[n,c]of Object.entries(i))L(c)||(a[n]=typeof c=="string"?c.trim():c);return a}const it={class:"u-search-control"},H=V(e.defineComponent({inheritAttrs:!1,__name:"USearch",props:{modelValue:{default:()=>({})},options:{}},emits:["update:modelValue","search","reset"],setup(i,{expose:a,emit:n}){const c=i,u=n,m=e.useSlots(),f=e.reactive({options:null,typeMap:{input:"el-input",number:"el-input-number",select:"el-select",date:"el-date-picker",daterange:"el-date-picker",datetime:"el-date-picker"},controls:e.markRaw({"el-input":b.ElInput,"el-input-number":b.ElInputNumber,"el-select":b.ElSelect,"el-date-picker":b.ElDatePicker})});e.watch(()=>c.options,l=>{l&&(f.options=l)},{immediate:!0});const d=e.computed(()=>{const l=f.options||{items:[]},t=(l.items||[]).filter(r=>!r.hidden),o=l.labelPosition??"left";return{opt:l,items:t,disabled:!!l.disabled,labelPosition:o,labelWidth:l.labelWidth??80,labelAlign:l.labelAlign??"right",gutter:Number(l.gutter)||12,itemWidth:S(l.itemWidth)||"240px",showSearch:l.showSearch!==!1,showReset:l.showReset!==!1,searchText:l.searchText||"查询",resetText:l.resetText||"重置"}}),s={init(){},setOptions(l){f.options=l},getOptions(){return f.options},resolveControlName(l){const t=String(l.type||"input");return t.startsWith("el-")?t:f.typeMap[t]||"el-input"},resolveControl(l){return f.controls[s.resolveControlName(l)]||b.ElInput},isCascadeSelect(l){return se(l)},isPlainSelect(l){return s.resolveControlName(l)==="el-select"&&!s.isCascadeSelect(l)},withDefault(l,t,o){const r=t.replace(/[A-Z]/g,p=>`-${p.toLowerCase()}`);l[t]===void 0&&l[r]===void 0&&(l[t]=o)},controlProps(l){const t={...l.props||{}},o=s.resolveControlName(l);if(s.withDefault(t,"clearable",!0),o==="el-input"&&s.withDefault(t,"placeholder",z(l)),o==="el-select"&&(s.withDefault(t,"filterable",!0),s.withDefault(t,"placeholder",z(l))),o==="el-date-picker"){const r=l.type==="daterange"?"daterange":l.type==="datetime"?"datetime":"date";s.withDefault(t,"type",r),s.withDefault(t,"valueFormat",r==="daterange"?"YYYY-MM-DD":r==="datetime"?"YYYY-MM-DD HH:mm:ss":"YYYY-MM-DD"),r==="daterange"&&(s.withDefault(t,"startPlaceholder","开始日期"),s.withDefault(t,"endPlaceholder","结束日期"),s.withDefault(t,"rangeSeparator","至"),s.withDefault(t,"unlinkPanels",!0))}return t.disabled=!!(t.disabled||d.value.disabled),t},selectBaseProps(l){const t={...l.props||{}};return delete t.placeholder,delete t.subPlaceholder,s.withDefault(t,"filterable",!0),s.withDefault(t,"clearable",!0),t},cascaderConfig(l){var o,r,p;const t=d.value;return{field:l.field,fieldLabel:l.fieldLabel||l.label||l.field,options:l.options||[],props:s.selectBaseProps(l),placeholder:((o=l.props)==null?void 0:o.placeholder)||z(l),subPlaceholder:((r=l.props)==null?void 0:r.subPlaceholder)||"请选择",labelPosition:t.labelPosition,labelWidth:t.labelWidth,labelAlign:t.labelAlign,gutter:t.gutter,disabled:t.disabled||!!((p=l.props)!=null&&p.disabled)}},getItemValue(l){const t=_(c.modelValue,l.field);return L(t)?void 0:t},setModel(l){u("update:modelValue",l||{})},clearField(l,t){if(!t.includes(".")){delete l[t];return}T(l,t,void 0)},setItemValue(l,t){const o={...c.modelValue||{}};T(o,l.field,t),s.setModel(o)},setValue(l,t){const o={...c.modelValue||{}};T(o,l,t),s.setModel(o)},getQuery(){return M(c.modelValue||{})},search(){u("search",s.getQuery())},reset(){const l={...c.modelValue||{}};for(const t of d.value.opt.items||[])for(const o of R(t))s.clearField(l,o);s.setModel(l),u("reset",M(l))},itemSlotName(l){return m[l.field]?l.field:null},slotProps(l){return{item:l,value:s.getItemValue(l),model:c.modelValue||{},setModel:t=>s.setModel(t)}},itemStyle(l){return s.isCascadeSelect(l)?{flex:"1 1 460px",minWidth:"300px",gap:`${d.value.gutter}px`}:{width:l.width?S(l.width):d.value.itemWidth}},labelStyle(){const l=d.value;return l.labelPosition==="left"?{width:S(l.labelWidth),textAlign:l.labelAlign}:{width:"100%",textAlign:"left"}}};return a({setOptions:s.setOptions,getOptions:s.getOptions,setModel:s.setModel,setValue:s.setValue,getQuery:s.getQuery,search:s.search,reset:s.reset}),(l,t)=>{const o=P.ElOption;return e.openBlock(),e.createElementBlock("div",e.mergeProps({class:["u-search",[`u-search--label-${d.value.labelPosition}`,{"u-search--disabled":d.value.disabled}]]},l.$attrs),[e.createElementVNode("div",{class:"u-search-fields",style:e.normalizeStyle({gap:d.value.gutter+"px"})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value.items,r=>(e.openBlock(),e.createElementBlock("div",{key:r.field,class:"u-search-item",style:e.normalizeStyle(s.itemStyle(r))},[s.isCascadeSelect(r)&&!s.itemSlotName(r)?(e.openBlock(),e.createBlock(G,{key:0,class:"u-search-cascade","model-value":c.modelValue,options:s.cascaderConfig(r),"onUpdate:modelValue":s.setModel},null,8,["model-value","options","onUpdate:modelValue"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",{class:"u-search-label",style:e.normalizeStyle(s.labelStyle())},e.toDisplayString(r.label||r.fieldLabel||r.field),5),e.createElementVNode("div",it,[s.itemSlotName(r)?e.renderSlot(l.$slots,s.itemSlotName(r),e.mergeProps({ref_for:!0},s.slotProps(r)),void 0,!0,0):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.resolveControl(r)),e.mergeProps({key:1,ref_for:!0},s.controlProps(r),{"model-value":s.getItemValue(r),"onUpdate:modelValue":p=>s.setItemValue(r,p)}),{default:e.withCtx(()=>[s.isPlainSelect(r)?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(r.options||[],p=>(e.openBlock(),e.createBlock(o,{key:String(p.value),label:p.label,value:p.value,disabled:p.disabled},null,8,["label","value","disabled"]))),128)):e.createCommentVNode("",!0)]),_:2},1040,["model-value","onUpdate:modelValue"]))])],64))],4))),128))],4),e.createElementVNode("div",{class:"u-search-actions",style:e.normalizeStyle({gap:d.value.gutter+"px"})},[d.value.showSearch?(e.openBlock(),e.createBlock(e.unref(b.ElButton),{key:0,type:"primary",disabled:d.value.disabled,onClick:s.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.value.searchText),1)]),_:1},8,["disabled","onClick"])):e.createCommentVNode("",!0),d.value.showReset?(e.openBlock(),e.createBlock(e.unref(b.ElButton),{key:1,disabled:d.value.disabled,onClick:s.reset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.value.resetText),1)]),_:1},8,["disabled","onClick"])):e.createCommentVNode("",!0),e.renderSlot(l.$slots,"actions",{params:c.modelValue,search:s.search,reset:s.reset},void 0,!0)],4)],16)}}}),[["__scopeId","data-v-bf97f714"]]),ct={class:"u-dialog-body"},dt={key:0,class:"u-dialog-loading"},Y=V(e.defineComponent({name:"UDialog",inheritAttrs:!1,__name:"UDialog",props:{modelValue:{type:Boolean},title:{},width:{},showHeader:{type:Boolean,default:!0},loading:{type:Boolean},loadingText:{default:"加载中…"},showFooter:{type:Boolean,default:!0},confirmText:{default:"确定"},cancelText:{default:"取消"},confirmLoading:{type:Boolean},confirmType:{default:"primary"},showClose:{type:Boolean,default:!0},closeOnClickModal:{type:Boolean,default:!1},closeOnPressEscape:{type:Boolean,default:!0},destroyOnClose:{type:Boolean,default:!0},appendToBody:{type:Boolean,default:!0},beforeClose:{},dialogProps:{}},emits:["update:modelValue","open","opened","close","closed","confirm","cancel"],setup(i,{expose:a,emit:n}){const c=i,u=n,m=e.useSlots(),f=e.reactive({visible:!1}),d=e.computed(()=>({dialogProps:{class:c.showHeader===!1?"u-dialog--no-header":void 0,modelValue:f.visible,title:c.title,width:S(c.width)||"520px",showClose:c.showClose!==!1,closeOnClickModal:c.closeOnClickModal===!0,closeOnPressEscape:c.closeOnPressEscape!==!1,destroyOnClose:c.destroyOnClose!==!1,appendToBody:c.appendToBody!==!1,beforeClose:c.beforeClose,...c.dialogProps||{}},hasFooter:c.showFooter!==!1}));e.watch(()=>c.modelValue,l=>{f.visible=!!l},{immediate:!0});const s={init(){},onVisibleChange(l){f.visible=l,u("update:modelValue",l),l||u("cancel")},open(){s.onVisibleChange(!0)},close(){s.onVisibleChange(!1)},onConfirm(){u("confirm")}};return a({open:s.open,close:s.close}),(l,t)=>(e.openBlock(),e.createBlock(e.unref(b.ElDialog),e.mergeProps({...d.value.dialogProps,...l.$attrs},{class:"u-dialog","onUpdate:modelValue":s.onVisibleChange,onOpen:t[2]||(t[2]=o=>u("open")),onOpened:t[3]||(t[3]=o=>u("opened")),onClose:t[4]||(t[4]=o=>u("close")),onClosed:t[5]||(t[5]=o=>u("closed"))}),e.createSlots({default:e.withCtx(()=>[e.createElementVNode("div",ct,[i.loading?(e.openBlock(),e.createElementBlock("div",dt,e.toDisplayString(i.loadingText),1)):e.renderSlot(l.$slots,"default",{},void 0,!0,1)])]),_:2},[e.unref(m).header?{name:"header",fn:e.withCtx(()=>[e.renderSlot(l.$slots,"header",{},void 0,!0)]),key:"0"}:void 0,d.value.hasFooter?{name:"footer",fn:e.withCtx(()=>[e.renderSlot(l.$slots,"footer",{},()=>[e.createVNode(e.unref(b.ElButton),{onClick:t[0]||(t[0]=o=>s.close())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.cancelText),1)]),_:1}),e.createVNode(e.unref(b.ElButton),{type:i.confirmType,loading:i.confirmLoading,onClick:t[1]||(t[1]=o=>s.onConfirm())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.confirmText),1)]),_:1},8,["type","loading"])],!0)]),key:"1"}:void 0]),1040,["onUpdate:modelValue"]))}}),[["__scopeId","data-v-1343d239"]]);function de(){var i,a;try{if(typeof document<"u"&&document.baseURI){const n=new URL(document.baseURI);if(n.origin&&n.origin!=="null"){let c=n.pathname;return c.slice(c.lastIndexOf("/")+1).includes(".")&&(c=c.slice(0,c.lastIndexOf("/")+1)),c=c.replace(/\/+$/,""),n.origin+c}}}catch{}try{const n=(a=(i=window==null?void 0:window.$wujie)==null?void 0:i.location)==null?void 0:a.origin;if(typeof n=="string"&&n)return n}catch{}return typeof window<"u"?window.location.origin:""}function ut(i,a){const n=(i??"").trim();return n!==""&&n!=="."&&n!=="./"?n:(a.value===void 0&&(a.value=de()),a.value)}class pt{constructor(a){x(this,"axiosInstance");x(this,"baseCache",{});this.axiosInstance=Ge.create({timeout:1e4,baseURL:""}),this.axiosInstance.defaults.headers["Content-Type"]="application/json;charset=utf-8",this.axiosInstance.interceptors.request.use(n=>(n.headers.token=localStorage.getItem("token"),n.baseURL=ut(a.baseUrl,this.baseCache),n),n=>Promise.reject(n)),this.axiosInstance.interceptors.response.use(n=>{if(n.config.responseType==="blob")return n;const c=n.data;if(c&&typeof c=="object"&&!Array.isArray(c)&&c.status===void 0&&c.code!==void 0){const u=c.code,m=u===0||u===200||Number(u)===0||Number(u)===200;c.status=m?200:Number(u)}return c},n=>Promise.reject(n))}Get(a,n){return this.axiosInstance.get(a,{params:n})}Post(a,n){return this.axiosInstance.post(a,n)}Delete(a,n){return this.axiosInstance.delete(a,{params:n})}Put(a,n){return this.axiosInstance.put(a,n)}Download(a,n){return this.axiosInstance.get(a,{params:n,responseType:"blob"})}PostDownload(a,n){return this.axiosInstance.post(a,n,{responseType:"blob"})}}class ft{constructor(){x(this,"emitter");this.emitter=He()}On(a,n){this.emitter.on(a,n)}Emit(a,n){this.emitter.emit(a,n)}Off(a,n){this.emitter.off(a,n)}}class mt{constructor(a,n){x(this,"mqttClient",null);x(this,"eventBus");this.eventBus=a,this.connect(n).then()}async connect(a){const n={username:a.userName,password:a.password,clientId:`${a.module}_${this.randomStr(10)}`,clean:!0,keepalive:50,connectTimeout:5e3,reconnectPeriod:5e3};let c=a.mqttUrl||"ws://127.0.0.1:5002/ws";if(console.log(`connect to mqtt... url=${c}`),this.mqttClient=Ye.connect(c,n),!this.mqttClient){console.log("connect mqtt failed");return}this.mqttClient.on("connect",()=>{console.log("=====> mqtt connect success!"),this.mqttClient.subscribe(v,{qos:0},u=>{console.log(u?`mqtt subscribe [${v}] failed`:`mqtt subscribe [${v}] success`)})}),this.mqttClient.on("message",(u,m)=>{const f=m.toString();if(!f){console.error("Received empty message",u);return}let d=null;try{d=JSON.parse(f)}catch(s){console.error("Failed to parse message JSON",u,f,s);return}if(!d||d.Content===void 0||d.Content===null||!d.PType){console.log("parse notice failed!",f);return}d.PType==gt&&this.eventBus.Emit(d.Route,d.Content)}),this.mqttClient.on(q.OffLine,()=>{console.log("mqtt offline...")}),this.mqttClient.on(q.Reconnect,()=>{console.log("mqtt reconnecting...")}),this.mqttClient.on(q.Close,()=>{console.log("mqtt close")}),this.mqttClient.on(q.Error,u=>{console.log("mqtt error")})}randomStr(a){const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let c="";for(let u=0;u<a;u++)c+=n.charAt(Math.floor(Math.random()*n.length));return c}}const v="Notice",gt="NOTICE",q={OffLine:"offline",Close:"close",Reconnect:"reconnect",Error:"error"},ht={input:"el-input",textarea:"el-input",number:"el-input-number","input-number":"el-input-number",switch:"el-switch",select:"el-select",dict:"el-select",radio:"el-radio-group",checkbox:"el-checkbox-group",date:"el-date-picker",time:"el-time-picker",cascader:"el-cascader"},yt=new Set(["field","type","label","required","default","maxlength","placeholder","lineCount","inputType","trueValue","falseValue","activeText","inactiveText"]);class ue{parseField(a){const n={field:a.field,label:a.label,required:a.required,default:a.default,props:{}},c=String(a.type||"input");c.startsWith("el-")?n.type=c:n.type=ht[c]||"el-input",n.type==="el-input"&&a.inputType==="number"&&(n.type="el-input-number"),n.type==="el-input"&&a.lineCount&&(n.props.type="textarea",n.props.rows=a.lineCount),a.maxlength!==void 0&&(n.props.maxlength=a.maxlength),a.placeholder!==void 0&&(n.props.placeholder=a.placeholder),n.type==="el-switch"&&(a.trueValue!==void 0&&(n.props.activeValue=a.trueValue),a.falseValue!==void 0&&(n.props.inactiveValue=a.falseValue),a.activeText!==void 0&&(n.props.activeText=a.activeText),a.inactiveText!==void 0&&(n.props.inactiveText=a.inactiveText));for(const[u,m]of Object.entries(a))!yt.has(u)&&n.props[u]===void 0&&(n.props[u]=m);return n}parse(a){var m,f;const n=a||{},c={fields:(n.fields||[]).map(d=>this.parseField(d))};(m=n.layout)!=null&&m.columns&&(c.columns=n.layout.columns),(f=n.layout)!=null&&f.labelPosition&&(c.labelPosition=n.layout.labelPosition);const u={formOptions:c};return n.api&&typeof n.api=="object"&&(u.api={...n.api}),n.layout&&typeof n.layout=="object"&&(u.layout={...n.layout}),n.meta&&typeof n.meta=="object"&&(u.meta={...n.meta}),u}}function pe(i){if(i)return Array.isArray(i)?i[0]:i}class fe{parseLevels(a){const n=[];let c=pe(a);const u=new Set;for(;c&&!u.has(c);){u.add(c);const m=c.field;if(!m)break;n.push({field:m,label:c.fieldLabel||c.label||m,dictType:c.dictType,props:c.props}),c=pe(c.children)}return n}isCascade(a){if(!a||typeof a!="object")return!1;if(Array.isArray(a.options)&&a.options.length>0){const n=c=>c.some(u=>{var m;return!!((m=u==null?void 0:u.children)!=null&&m.length)||!!(u!=null&&u.field)||n((u==null?void 0:u.children)||[])});return n(a.options)}return this.parseLevels(a).length>1}parse(a){const n=a||{},u=this.parseLevels(n)[0],m=u?{field:u.field,fieldLabel:u.label,options:Array.isArray(n.options)?F(n.options):[]}:{field:"",options:[]};return n.dictType!==void 0&&(m.dictType=n.dictType),n.props&&(m.props={...n.props}),m}stampLevels(a,n){const c=F(a),u=(m,f)=>{const d=n[f+1];return m.map(s=>{const l=Array.isArray(s.children)?u(s.children,f+1):void 0,t={...s};return d?(t.field=s.field||d.field,t.fieldLabel=s.fieldLabel||d.label,d.props&&(t.props={...d.props,...s.props||{}})):(delete t.field,delete t.fieldLabel),l!=null&&l.length?t.children=l:delete t.children,t})};return u(c,0)}build(a,n){const c=this.parse(a);return(!Array.isArray(a==null?void 0:a.options)||a.options.length===0)&&(c.options=this.stampLevels(n,this.parseLevels(a))),c}}const me={tag:"tag",image:"image",link:"link",switch:"switch",progress:"progress",index:"index",selection:"selection",expand:"expand",slot:"slot"},bt={input:"input",text:"input",number:"number","input-number":"number",select:"select",dict:"select",dept:"select",role:"select",date:"date",daterange:"daterange",datetime:"datetime"};class ge{constructor(){x(this,"cascader",new fe)}parseColumn(a){const n={...a},c=String(n.type||"text");return c==="dict"||c==="text"?delete n.type:me[c]?n.type=me[c]:delete n.type,!n.label&&n.field&&(n.label=n.field),n}parseSearchItem(a){const n={...a},c=String(a.type||"input");if(n.type=c.startsWith("el-")?c:bt[c]||"input",!n.label&&n.field&&(n.label=n.field),n.options||delete n.options,this.cascader.isCascade(a)){const u=this.cascader.parse(a),m=this.cascader.parseLevels(a);n.type="select",n.fieldLabel=u.fieldLabel||n.fieldLabel||n.label,n.options=u.options,u.dictType!==void 0&&(n.dictType=u.dictType),m.length>1&&(n.cascaderLevels=m)}return n}parseSearch(a){return{items:(Array.isArray(a)?a:(a==null?void 0:a.search)||[]).map(c=>this.parseSearchItem(c))}}parse(a){var m;const n=a||{},c={columns:(n.columns||[]).map(f=>this.parseColumn(f))};n.key&&(c.rowKey=n.key),(m=n.actions)!=null&&m.length&&(c.actions=n.actions.map(f=>({...f}))),n.actionsWidth!==void 0&&(c.actionWidth=n.actionsWidth);const u={tableOptions:c,searchOptions:this.parseSearch(n)};return n.key!==void 0&&(u.key=n.key),n.form!==void 0&&(u.form=n.form),n.api&&typeof n.api=="object"&&(u.api={...n.api}),n.pagination!==void 0&&(u.pagination=n.pagination),n.meta&&typeof n.meta=="object"&&(u.meta={...n.meta}),u}}function U(i){return Array.isArray(i)?i.map(a=>he(a)).filter(Boolean):[]}function he(i){if(!i||typeof i!="object")return null;const a=i.label??i.name;if(!a)return null;const n={...i,label:String(a),type:i.type||"route",path:String(i.path??i.route??""),icon:i.icon??""};delete n.children;const c=i.id;return c!=null&&c!==""&&(n.id=String(c)),(i.open==="new"||i.open==="self")&&(n.open=i.open),Array.isArray(i.children)&&i.children.length>0&&(n.children=U(i.children)),n}class ye{parse(a){const n=a||{},c={menus:U(n.menus)};n.projectName!==void 0&&(c.projectName=n.projectName),n.logo!==void 0&&(c.logo=n.logo),n.mode!==void 0&&(c.mode=n.mode),n.width!==void 0&&(c.width=n.width),n.expandAll!==void 0&&(c.expandAll=n.expandAll),n.uniqueOpened!==void 0&&(c.uniqueOpened=n.uniqueOpened),n.showLogout!==void 0&&(c.showLogout=n.showLogout),n.logoutText!==void 0&&(c.logoutText=n.logoutText),n.dictType!==void 0&&(c.dictType=n.dictType);const u={menuOptions:c};return n.meta&&typeof n.meta=="object"&&(u.meta={...n.meta},n.meta.menuId!==void 0&&(u.menuId=n.meta.menuId)),u}}function be(i,a="forms"){return`/api/form?type=${a}&id=${i}`}class ke{constructor(a){x(this,"WebApi");x(this,"formParser",new ue);x(this,"tablePageParser",new ge);x(this,"menuParser",new ye);this.WebApi=a}async parseForm(a){return this.formParser.parse(await this.getYaml("forms",a))}async parseTablePage(a){return this.tablePageParser.parse(await this.getYaml("tables",a))}async parseMenu(a){return this.menuParser.parse(await this.getYaml("menus",a))}async getYaml(a,n){const c=await this.WebApi.Get(be(n,a));if(c.code!==0&&c.status!==200)throw new Error(`获取配置失败:${a}/${n} ${c.message||`code=${c.code}`}`);return c.data??{}}}let A,Q=!1;const kt=i=>{if(!i)throw new Error("QfOptions is undefined");if((!A||Q)&&(A=new Ce(i),Q=!1),!A)throw new Error("Qf not initialized, please call GetQf(options) first");return A},N=()=>(A||(A=new Ce({module:"",useMqtt:!1,baseUrl:"",mqttUrl:"",userName:"",password:""}),Q=!0),A);class Ce{constructor(a){x(this,"EventBus");x(this,"WebApi");x(this,"Mqtt");x(this,"options");x(this,"yamlParser");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 ft,this.WebApi=new pt(a),this.yamlParser=new ke(this.WebApi),this.options.useMqtt&&(this.Mqtt=new mt(this.EventBus,a))}On(a,n){this.EventBus.On(a,n)}Emit(a,n){this.EventBus.Emit(a,n)}Off(a,n){this.EventBus.Off(a,n)}Post(a,n){return this.WebApi.Post(a,n)}Get(a,n){return this.WebApi.Get(a,n)}Delete(a,n){return this.WebApi.Delete(a,n)}Put(a,n){return this.WebApi.Put(a,n)}Download(a,n){return this.WebApi.Download(a,n)}PostDownload(a,n){return this.WebApi.PostDownload(a,n)}RegNotice(a,n){this.EventBus.On(a,n)}GetFormConfig(a){return this.yamlParser.parseForm(a)}GetTablePageConfig(a){return this.yamlParser.parseTablePage(a)}GetMenuConfig(a){return this.yamlParser.parseMenu(a)}}const Ct={class:"u-table-page-table"},wt={key:1,class:"u-table-page-form-tip"},we=V(e.defineComponent({name:"UTablePage",inheritAttrs:!1,__name:"UTablePage",props:{options:{},tableId:{},data:{},modelValue:{},autoLoad:{type:Boolean,default:!0},pageSize:{default:20},height:{},fill:{type:Boolean,default:!1},showPagination:{type:Boolean,default:!0},pageSizes:{default:()=>[10,20,50,100]},paginationLayout:{default:"total, sizes, prev, pager, next, jumper"},paginationBackground:{type:Boolean,default:!0},paginationProps:{},footerAlign:{default:"right"},footerHeight:{default:50},footerBg:{}},emits:["update:modelValue","search","reset","action-click","load","page-change","delete","delete-success","form-submit","form-success","error","row-click","cell-click","selection-change","sort","expand-change"],setup(i,{expose:a,emit:n}){const c=i,u=n,m=e.useSlots(),f=e.ref(null),d=e.reactive({options:null,rows:[],loading:!1,total:0,page:1,pageSize:c.pageSize||20,model:{},paginationQueued:!1,formConfig:null,formLoading:!1,dialog:{visible:!1,mode:"edit",title:"",formId:"",row:null,model:{},submitting:!1}}),s=e.computed(()=>{var B,w,$;const t=d.options,o=(t==null?void 0:t.tableOptions)||{columns:[]},r=(t==null?void 0:t.searchOptions)||{items:[]},p=c.data!==void 0?c.data:d.rows,h=c.height!==void 0||c.fill===!0,y=h?{...o,height:"100%"}:o,C=c.showPagination!==!1&&(c.data!==void 0||!!(t!=null&&t.pagination)),k={left:"flex-start",center:"center",right:"flex-end"};return{opt:t,fill:h,tableOptions:o,tableOptionsForTable:y,searchOptions:r,rows:p,searchModel:c.modelValue!==void 0?c.modelValue:d.model,hasSearch:(r.items||[]).length>0,hasListApi:!!((B=t==null?void 0:t.api)!=null&&B.list),hasPagination:C,paginationTotal:c.data!==void 0?p.length:d.total,loading:d.loading,dialogWidth:S(($=(w=d.formConfig)==null?void 0:w.layout)==null?void 0:$.width)||"520px",tableSlots:Object.keys(m).filter(je=>je!=="actions"&&je!=="footer"),rootStyle:c.height!==void 0?{height:S(c.height)}:void 0,footerStyle:{height:S(c.footerHeight)||"50px",justifyContent:k[c.footerAlign]||"flex-end",background:c.footerBg||void 0}}}),l={init(){},async loadConfig(t){if(!t)return null;try{return d.options=await N().GetTablePageConfig(t),d.options}catch(o){return u("error",o),b.ElMessage.error(l.errorText(o,`列表配置加载失败:${t}`)),null}},setOptions(t){d.options=t},getOptions(){return d.options},getRows(){return s.value.rows},getColumns(){return s.value.tableOptions.columns||[]},getSearchModel(){return M(s.value.searchModel||{})},keyField(){var o;const t=d.options;return(t==null?void 0:t.key)||((o=t==null?void 0:t.tableOptions)==null?void 0:o.rowKey)||"id"},isOk(t){return t?Number(t.code)===0||Number(t.status)===200:!1},errorText(t,o="请求失败"){var r,p;return((p=(r=t==null?void 0:t.response)==null?void 0:r.data)==null?void 0:p.message)||(t==null?void 0:t.message)||o},async load(t){var h;const o=d.options,r=(h=o==null?void 0:o.api)==null?void 0:h.list;if(!r||c.data!==void 0)return s.value.rows;const p={...M(t!==void 0?t:s.value.searchModel||{})};o!=null&&o.pagination&&(p.page=d.page,p.pageSize=d.pageSize),d.loading=!0;try{const y=await N().Get(r,p);if(!l.isOk(y))throw new Error((y==null?void 0:y.message)||`code=${y==null?void 0:y.code}`);const C=y.data;return Array.isArray(C)?(d.rows=C,d.total=C.length):C&&typeof C=="object"?(d.rows=C.rows||C.list||C.data||[],d.total=Number(C.total??d.rows.length)):(d.rows=[],d.total=0),u("load",{rows:d.rows,total:d.total}),d.rows}catch(y){return u("error",y),b.ElMessage.error(l.errorText(y,"列表加载失败")),s.value.rows}finally{d.loading=!1}},reload(){return l.load()},async setPage(t){return d.page=Math.max(1,Number(t)||1),l.queuePaginationLoad()},async setPageSize(t){return d.pageSize=Math.max(1,Number(t)||20),d.page=1,l.queuePaginationLoad()},async onPageChange(t){return d.page=Math.max(1,Number(t)||1),l.queuePaginationLoad()},async onPageSizeChange(t){return d.pageSize=Math.max(1,Number(t)||20),d.page=1,l.queuePaginationLoad()},async queuePaginationLoad(){d.paginationQueued||(d.paginationQueued=!0,await Promise.resolve(),d.paginationQueued=!1,u("page-change",{page:d.page,pageSize:d.pageSize}),s.value.hasListApi&&c.data===void 0&&await l.load())},setModel(t){c.modelValue===void 0&&(d.model=t||{}),u("update:modelValue",t)},onSearch(t){u("search",t),s.value.hasListApi&&c.data===void 0&&(d.page=1,l.load(t))},onReset(t){u("reset",t),s.value.hasListApi&&c.data===void 0&&(d.page=1,l.load(t))},async deleteRow(t){var y,C;const o=(C=(y=d.options)==null?void 0:y.api)==null?void 0:C.delete;if(!o){u("delete",t);return}try{await b.ElMessageBox.confirm("确定要删除该条数据吗?删除后不可恢复。","删除确认",{type:"warning",confirmButtonText:"确定删除",cancelButtonText:"取消"})}catch{return}const r=l.keyField(),p=_(t,r),h=o.includes("?")?"&":"?";d.loading=!0;try{const k=await N().Post(`${o}${h}${r}=${encodeURIComponent(p??"")}`,{[r]:p});if(!l.isOk(k))throw new Error((k==null?void 0:k.message)||`code=${k==null?void 0:k.code}`);b.ElMessage.success("删除成功"),u("delete-success",t),await l.load()}catch(k){u("error",k),b.ElMessage.error(l.errorText(k,"删除失败"))}finally{d.loading=!1}},async openForm(t="edit",o=null,r){var h;const p=r||((h=d.options)==null?void 0:h.form);if(!p){u("form-submit",{mode:t,model:{},row:o});return}d.dialog.mode=t,d.dialog.row=o,d.dialog.formId=p,d.dialog.title=t==="add"?"新增":"编辑",d.dialog.model={},d.formConfig=null,d.formLoading=!0,d.dialog.visible=!0;try{const y=await N().GetFormConfig(p);d.formConfig=y,d.dialog.model=t==="edit"&&o?await l.fetchFormModel(y,o):oe(y.formOptions)}catch(y){u("error",y),b.ElMessage.error(l.errorText(y,`表单配置加载失败:${p}`)),d.dialog.visible=!1}finally{d.formLoading=!1}},async fetchFormModel(t,o){var y,C;const r=l.keyField();let p=null;if((y=t==null?void 0:t.api)!=null&&y.get){const k=await N().Get(t.api.get,{[r]:_(o,r)});if(!l.isOk(k))throw new Error((k==null?void 0:k.message)||`code=${k==null?void 0:k.code}`);p=k.data}(!p||typeof p!="object")&&(p={...o||{}});const h=(((C=t==null?void 0:t.formOptions)==null?void 0:C.fields)||[]).map(k=>k.field);return le(p,h)},closeForm(){d.dialog.visible=!1},async submitForm(){var y,C,k,B;const t=d.formConfig;if(!t)return;let o=!0;try{o=await((C=(y=f.value)==null?void 0:y.validate)==null?void 0:C.call(y))!==!1}catch{o=!1}if(!o)return;const r=d.dialog.mode,p=r==="add"?(k=t.api)==null?void 0:k.add:(B=t.api)==null?void 0:B.edit,h=ne(d.dialog.model);if(!p){u("form-submit",{mode:r,model:h,row:d.dialog.row}),d.dialog.visible=!1;return}d.dialog.submitting=!0;try{const w=await N().Post(p,h);if(!l.isOk(w))throw new Error((w==null?void 0:w.message)||`code=${w==null?void 0:w.code}`);b.ElMessage.success(r==="add"?"新增成功":"保存成功"),d.dialog.visible=!1,u("form-success",{mode:r,model:h,data:w.data}),await l.load()}catch(w){u("error",w),b.ElMessage.error(l.errorText(w,r==="add"?"新增失败":"保存失败"))}finally{d.dialog.submitting=!1}},onActionClick(t,o,r){u("action-click",t,o,r);const p=String((t==null?void 0:t.action)||"").toLowerCase();p==="delete"?l.deleteRow(o):(p==="edit"||p==="add")&&l.openForm(p==="add"?"add":"edit",p==="add"?null:o,t==null?void 0:t.form)},onRowClick(t,o,r){u("row-click",t,o,r)},onCellClick(t,o,r,p){u("cell-click",t,o,r,p)},onSelectionChange(t){u("selection-change",t)},onSortChange(t){u("sort",t)},onExpandChange(t,o){u("expand-change",t,o)}};return e.watch(()=>c.tableId,async t=>{if(!t)return;await l.loadConfig(t)&&c.autoLoad&&c.data===void 0&&await l.load()},{immediate:!0}),e.watch(()=>c.options,t=>{if(!t)return;const o=d.options===null;d.options=t,o&&!c.tableId&&c.autoLoad&&c.data===void 0&&l.load()},{immediate:!0}),a({setOptions:l.setOptions,getOptions:l.getOptions,getRows:l.getRows,getColumns:l.getColumns,getSearchModel:l.getSearchModel,load:l.load,reload:l.reload,setPage:l.setPage,setPageSize:l.setPageSize,deleteRow:l.deleteRow,openForm:l.openForm,closeForm:l.closeForm,submitForm:l.submitForm,formRef:f}),(t,o)=>(e.openBlock(),e.createElementBlock("div",e.mergeProps({class:["u-table-page",{"u-table-page--fill":s.value.fill}]},t.$attrs,{style:s.value.rootStyle}),[s.value.hasSearch?(e.openBlock(),e.createBlock(H,{key:0,class:"u-table-page-search","model-value":s.value.searchModel,options:s.value.searchOptions,"onUpdate:modelValue":l.setModel,onSearch:l.onSearch,onReset:l.onReset},{actions:e.withCtx(r=>[e.renderSlot(t.$slots,"search-actions",e.normalizeProps(e.guardReactiveProps(r)),void 0,!0)]),_:3},8,["model-value","options","onUpdate:modelValue","onSearch","onReset"])):e.createCommentVNode("",!0),e.createElementVNode("div",Ct,[e.createVNode(j,{options:s.value.tableOptionsForTable,data:s.value.rows,onActionClick:l.onActionClick,onRowClick:l.onRowClick,onCellClick:l.onCellClick,onSelectionChange:l.onSelectionChange,onSort:l.onSortChange,onExpandChange:l.onExpandChange},e.createSlots({actions:e.withCtx(r=>[e.renderSlot(t.$slots,"actions",e.normalizeProps(e.guardReactiveProps(r)),void 0,!0)]),_:2},[e.renderList(s.value.tableSlots,r=>({name:r,fn:e.withCtx(p=>[e.renderSlot(t.$slots,r,e.normalizeProps(e.guardReactiveProps(p)),void 0,!0)])}))]),1032,["options","data","onActionClick","onRowClick","onCellClick","onSelectionChange","onSort","onExpandChange"])]),s.value.hasPagination?(e.openBlock(),e.createBlock(e.unref(b.ElPagination),e.mergeProps({key:1,class:"u-table-page-pagination","current-page":d.page,"page-size":d.pageSize,total:s.value.paginationTotal,"page-sizes":c.pageSizes,layout:c.paginationLayout,background:c.paginationBackground},c.paginationProps,{onCurrentChange:l.onPageChange,onSizeChange:l.onPageSizeChange}),null,16,["current-page","page-size","total","page-sizes","layout","background","onCurrentChange","onSizeChange"])):e.createCommentVNode("",!0),e.unref(m).footer?(e.openBlock(),e.createElementBlock("div",{key:2,class:"u-table-page-footer",style:e.normalizeStyle(s.value.footerStyle)},[e.renderSlot(t.$slots,"footer",{},void 0,!0)],4)):e.createCommentVNode("",!0),e.createVNode(Y,{modelValue:d.dialog.visible,"onUpdate:modelValue":o[1]||(o[1]=r=>d.dialog.visible=r),title:d.dialog.title,width:s.value.dialogWidth,loading:d.formLoading,"loading-text":"表单加载中…","confirm-loading":d.dialog.submitting,onConfirm:o[2]||(o[2]=r=>l.submitForm())},{default:e.withCtx(()=>[d.formConfig?(e.openBlock(),e.createBlock(W,{key:0,ref_key:"formRef",ref:f,modelValue:d.dialog.model,"onUpdate:modelValue":o[0]||(o[0]=r=>d.dialog.model=r),options:d.formConfig.formOptions},null,8,["modelValue","options"])):(e.openBlock(),e.createElementBlock("div",wt,"表单配置为空"))]),_:1},8,["modelValue","title","width","loading","confirm-loading"])],16))}}),[["__scopeId","data-v-ab43e7b3"]]),St={key:0,class:"u-menu-brand"},Bt=["src"],xt={class:"u-menu-brand-text"},_t={key:1,class:"u-menu-logout"},Se=V(e.defineComponent({inheritAttrs:!1,__name:"UMenu",props:{options:{},mode:{},projectName:{},activePath:{},width:{}},emits:["menu-click","logout"],setup(i,{expose:a,emit:n}){const c=i,u=n,m=e.reactive({options:null,menus:[],activePath:"",iconMap:{},iconsLoaded:!1}),f=e.ref(null),d=t=>{const o=[];return t.forEach((r,p)=>{Array.isArray(r.children)&&r.children.length>0&&o.push(r.path||`menu-${p}`)}),o},s=e.computed(()=>{const t=m.options||{},o=c.mode??t.mode??"sidebar";return{projectName:c.projectName??t.projectName??"",logo:t.logo||"",mode:o,isHorizontal:o==="horizontal",elMode:o==="horizontal"?"horizontal":"vertical",width:c.width??t.width??220,menus:m.menus,activeIndex:l.getIndexByPath(m.activePath),showLogout:t.showLogout!==!1,logoutText:t.logoutText||"退出登录",iconMap:m.iconMap,parentIndexes:d(m.menus),expandAll:t.expandAll!==!1,uniqueOpened:t.expandAll===!1&&!!t.uniqueOpened}}),l={async init(){await l.ensureIcons(),c.options&&l.setOptions(c.options),m.activePath=c.activePath||"",await l.expandAllMenus()},setOptions(t){m.options=t,m.menus=U(t==null?void 0:t.menus)},getOptions(){return m.options},async expandAllMenus(){if(!s.value.expandAll)return;await e.nextTick();const t=f.value;if(t!=null&&t.open)for(const o of s.value.parentIndexes)try{t.open(o)}catch{}},itemIndex(t,o){return t.path||`menu-${o}`},childIndex(t,o,r,p){return r.path?r.path:`${l.itemIndex(t,o)}-${p}`},hasChildren(t){return Array.isArray(t.children)&&t.children.length>0},getIndexByPath(t){if(!t)return"";for(let o=0;o<m.menus.length;o++){const r=m.menus[o];if(r.path===t)return l.itemIndex(r,o);const p=r.children||[];for(let h=0;h<p.length;h++)if(p[h].path===t)return l.childIndex(r,o,p[h],h)}return""},findItemByIndex(t,o){for(let r=0;r<m.menus.length;r++){const p=m.menus[r],h=l.itemIndex(p,r);if(h===t)return{item:p,level:1,indexPath:o||[h],index:t};const y=p.children||[];for(let C=0;C<y.length;C++){const k=y[C],B=l.childIndex(p,r,k,C);if(B===t)return{item:k,level:2,indexPath:o||[h,B],index:t}}}return null},resolveTarget(t){const o=t.type||"route",r=t.path||"";return o==="url"?{type:o,path:r,url:r,open:t.open||"new"}:o==="form"||o==="table"||o==="menu"?{type:o,path:r,id:t.id||r}:{type:"route",path:r,route:r}},handleSelect(t,o){const r=l.findItemByIndex(t,o);if(!r||l.hasChildren(r.item))return;const p=l.resolveTarget(r.item);m.activePath=r.item.path||t;const h={...p,item:r.item,level:r.level,indexPath:r.indexPath,index:t};u("menu-click",h)},handleLogout(){u("logout")},setActivePath(t){m.activePath=t},async ensureIcons(){if(!m.iconsLoaded){m.iconsLoaded=!0;try{const t=Ke,o=t!=null&&t.default?{...t.default,...t}:{...t},r={};for(const[p,h]of Object.entries(o))r[p]=e.markRaw(h);m.iconMap=r}catch(t){console.warn("[UMenu] @element-plus/icons-vue 不可用,菜单图标将被忽略",t)}}},getIcon(t){return t&&m.iconMap[t]||null}};return e.watch(()=>c.options,t=>{t&&l.setOptions(t)},{immediate:!0}),e.watch(()=>c.activePath,t=>{m.activePath=t||""}),e.watch(()=>m.menus,()=>{l.expandAllMenus()}),e.onMounted(()=>{l.init()}),a({setOptions:l.setOptions,getOptions:l.getOptions,setActivePath:l.setActivePath,expandAllMenus:l.expandAllMenus}),(t,o)=>{const r=P.ElIcon,p=P.ElMenuItem,h=P.ElSubMenu,y=P.ElMenu,C=P.ElButton;return e.openBlock(),e.createElementBlock("div",e.mergeProps({class:["u-menu",[`u-menu--${s.value.mode}`,{"u-menu--no-brand":!s.value.projectName}]],style:s.value.isHorizontal?{}:{width:s.value.width+"px"}},t.$attrs),[s.value.projectName?(e.openBlock(),e.createElementBlock("div",St,[e.renderSlot(t.$slots,"brand",{projectName:s.value.projectName,mode:s.value.mode},()=>[s.value.logo?(e.openBlock(),e.createElementBlock("img",{key:0,class:"u-menu-logo",src:s.value.logo,alt:"logo"},null,8,Bt)):e.createCommentVNode("",!0),e.createElementVNode("span",xt,e.toDisplayString(s.value.projectName),1)],!0)])):e.createCommentVNode("",!0),e.createVNode(y,{ref_key:"menuRef",ref:f,class:"u-menu-list",mode:s.value.elMode,"default-active":s.value.activeIndex,"unique-opened":s.value.uniqueOpened,"default-openeds":s.value.parentIndexes,onSelect:l.handleSelect},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value.menus,(k,B)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:l.itemIndex(k,B)},[l.hasChildren(k)?(e.openBlock(),e.createBlock(h,{key:0,index:l.itemIndex(k,B)},{title:e.withCtx(()=>[e.renderSlot(t.$slots,"menu-title",{item:k,level:1,index:B,parent:null},()=>[l.getIcon(k.icon)?(e.openBlock(),e.createBlock(r,{key:0,class:"u-menu-icon"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.getIcon(k.icon))))]),_:2},1024)):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(k.label),1)],!0)]),default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.children,(w,$)=>(e.openBlock(),e.createBlock(p,{key:l.childIndex(k,B,w,$),index:l.childIndex(k,B,w,$)},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"menu-item",{item:w,level:2,index:$,parent:k},()=>[l.getIcon(w.icon)?(e.openBlock(),e.createBlock(r,{key:0,class:"u-menu-icon"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.getIcon(w.icon))))]),_:2},1024)):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(w.label),1)],!0)]),_:2},1032,["index"]))),128))]),_:2},1032,["index"])):(e.openBlock(),e.createBlock(p,{key:1,index:l.itemIndex(k,B)},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"menu-item",{item:k,level:1,index:B,parent:null},()=>[l.getIcon(k.icon)?(e.openBlock(),e.createBlock(r,{key:0,class:"u-menu-icon"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.getIcon(k.icon))))]),_:2},1024)):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(k.label),1)],!0)]),_:2},1032,["index"]))],64))),128))]),_:3},8,["mode","default-active","unique-opened","default-openeds","onSelect"]),s.value.showLogout?(e.openBlock(),e.createElementBlock("div",_t,[e.renderSlot(t.$slots,"logout",{mode:s.value.mode},()=>[e.createVNode(C,{class:"u-menu-logout-btn",text:"",onClick:l.handleLogout},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.value.logoutText),1)]),_:1},8,["onClick"])],!0)])):e.createCommentVNode("",!0)],16)}}}),[["__scopeId","data-v-fd5c101a"]]),Be="5em",xe="8px 24px";function _e(i){const a=Number(i);return Number.isFinite(a)&&a>=1?Math.floor(a):3}function K(i){return i==="top"?"top":"left"}function Te(i,a){return a==="top"?"left":i==="left"||i==="justify"?i:"right"}function Ve(i){return S(i)||Be}function Pe(i,a,n){return a==="top"||i===!1?"":n??":"}function J(i,a){if(i)return i.value!==void 0?i.value:_(a,i.field)}function Ee(i){if(i!=null&&i.slot)return typeof i.slot=="string"?i.slot:i.field}function Ae(i,a){const n=Number(i);return!Number.isFinite(n)||n<=1?1:Math.min(Math.floor(n),a)}function Ne(i,a){return{gridTemplateColumns:`repeat(${a}, minmax(0, 1fr))`,gap:S(i==null?void 0:i.gap)||xe}}const Tt={class:"u-base-info-label-text"},Vt={key:0,class:"u-base-info-colon"},Pt={class:"u-base-info-value"},Et={key:1,class:"u-base-info-empty"},$e=V(e.defineComponent({name:"UBaseInfo",inheritAttrs:!1,__name:"UBaseInfo",props:{options:{},data:{}},setup(i,{expose:a}){const n=i,c=e.useSlots(),u=e.reactive({options:null}),m=e.computed(()=>{const d=u.options,s=Array.isArray(d==null?void 0:d.items)?d.items:[],l=_e(d==null?void 0:d.columns),t=K(d==null?void 0:d.layout),o=n.data??(d==null?void 0:d.data)??{};return{opt:d,items:s,columns:l,layout:t,isTop:t==="top",isEmpty:s.length===0,gridStyle:Ne(d,l),cells:f.buildCells(s,d,t,l,o)}});e.watch(()=>n.options,d=>{d&&(u.options=d)},{immediate:!0});const f={init(){},buildCells(d,s,l,t,o){return d.map((r,p)=>{const h=K(r.layout??l),y=h==="top",C=Te(r.labelAlign??(s==null?void 0:s.labelAlign),h),k=J(r,o);return{item:r,index:p,label:r.label||"",value:k,text:E(k,(s==null?void 0:s.emptyText)??"-"),slotName:Ee(r)||"",isTop:y,labelAlign:C,colonText:Pe(r.colon??(s==null?void 0:s.colon),h,s==null?void 0:s.colonText),labelStyle:f.labelStyle(r,s,h,C),cellStyle:f.cellStyle(Ae(r.span,t))}})},labelStyle(d,s,l,t){return l==="top"?{width:"100%",textAlign:"left"}:{width:Ve(d.labelWidth??(s==null?void 0:s.labelWidth)),textAlign:t}},cellStyle(d){return d>1?{gridColumn:`span ${d}`}:{}},setOptions(d){u.options=d},getOptions(){return u.options},getItems(){return m.value.items},getValue(d){var l;if(!d)return;const s=n.data??((l=u.options)==null?void 0:l.data)??{};return J({field:d},s)}};return a({setOptions:f.setOptions,getOptions:f.getOptions,getItems:f.getItems,getValue:f.getValue}),(d,s)=>(e.openBlock(),e.createElementBlock("div",e.mergeProps({class:"u-base-info"},d.$attrs),[e.unref(c).default?e.renderSlot(d.$slots,"default",{},void 0,!0,0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[m.value.isEmpty?(e.openBlock(),e.createElementBlock("div",Et,[e.renderSlot(d.$slots,"empty",{},()=>[s[0]||(s[0]=e.createTextVNode("暂无数据",-1))],!0)])):(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-base-info-grid",style:e.normalizeStyle(m.value.gridStyle)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value.cells,l=>(e.openBlock(),e.createElementBlock("div",{key:l.index,class:e.normalizeClass(["u-base-info-item",{"is-top":l.isTop}]),style:e.normalizeStyle(l.cellStyle)},[e.unref(c).label?e.renderSlot(d.$slots,"label",{item:l.item,index:l.index,label:l.label,value:l.value},void 0,!0,0):(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(["u-base-info-label",{"is-justify":l.labelAlign==="justify"}]),style:e.normalizeStyle(l.labelStyle)},[e.createElementVNode("span",Tt,e.toDisplayString(l.label),1),l.colonText?(e.openBlock(),e.createElementBlock("span",Vt,e.toDisplayString(l.colonText),1)):e.createCommentVNode("",!0)],6)),e.createElementVNode("span",Pt,[l.slotName&&e.unref(c)[l.slotName]?e.renderSlot(d.$slots,l.slotName,{item:l.item,index:l.index,label:l.label,value:l.value},void 0,!0,0):e.unref(c).value?e.renderSlot(d.$slots,"value",{item:l.item,index:l.index,label:l.label,value:l.value},void 0,!0,1):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(l.text),1)],64))])],6))),128))],4))],64))],16))}}),[["__scopeId","data-v-ad75dd63"]]),Oe="#f5f7fa",Le="#303133",Me="#fff",Ie="#fafafa",Re="#ebeef5";function Z(i){return i==="center"||i==="right"?i:"left"}function De(i){if(i!=null&&i.slot)return typeof i.slot=="string"?i.slot:i.prop}function X(i,a){return _(i,a==null?void 0:a.prop)}function Fe(i=[]){return i.length?i.map(a=>{const n=S(a.width);if(n)return n;const c=S(a.minWidth);return c?`minmax(${c}, 1fr)`:"minmax(0, 1fr)"}).join(" "):"minmax(0, 1fr)"}function ze(i){return{width:S(i==null?void 0:i.width)||"100%",height:S(i==null?void 0:i.height)}}function qe(i){return{"--u-results-header-bg":(i==null?void 0:i.headerBg)||Oe,"--u-results-header-color":(i==null?void 0:i.headerColor)||Le,"--u-results-item-bg":(i==null?void 0:i.itemBg)||Me,"--u-results-stripe-bg":(i==null?void 0:i.stripeBg)||Ie,"--u-results-line":Re}}const At={key:1,class:"u-results-body"},Nt={class:"u-results-rows"},$t={key:0,class:"u-results-empty"},Ue=V(e.defineComponent({name:"UResults",inheritAttrs:!1,__name:"UResults",props:{options:{},data:{}},setup(i,{expose:a}){const n=i,c=e.useSlots(),u=e.reactive({options:null});function m(){var s;return Array.isArray(n.data)?n.data:Array.isArray((s=u.options)==null?void 0:s.data)?u.options.data:[]}const f=e.computed(()=>{const s=u.options,l=Array.isArray(s==null?void 0:s.columns)?s.columns:[],t=m(),o=S(s==null?void 0:s.headerHeight);return{opt:s,border:(s==null?void 0:s.border)!==!1,striped:(s==null?void 0:s.striped)===!0,isEmpty:t.length===0,emptyDataText:(s==null?void 0:s.emptyDataText)||"暂无数据",gridStyle:{gridTemplateColumns:Fe(l)},rootStyle:{...ze(s),...qe(s)},headers:l.map((r,p)=>({index:p,label:r.label||"",style:d.cellStyle(Z(r.headerAlign??r.align),o)})),rows:d.buildRows(t,l,s)}});e.watch(()=>n.options,s=>{s&&(u.options=s)},{immediate:!0});const d={init(){},cellStyle(s,l){const t={textAlign:s};return l&&(t.minHeight=l),t},buildRows(s,l,t){const o=(t==null?void 0:t.emptyText)??"-",r=S(t==null?void 0:t.rowHeight);return s.map((p,h)=>({index:h,raw:p,cells:l.map((y,C)=>{const k=X(p,y);return{index:C,column:y,value:k,text:E(k,o),slotName:De(y)||"",style:d.cellStyle(Z(y.align),r)}})}))},setOptions(s){u.options=s},getOptions(){return u.options},getRows(){return m()},getColumns(){var s;return Array.isArray((s=u.options)==null?void 0:s.columns)?u.options.columns:[]},getText(s,l){var o;const t=((o=u.options)==null?void 0:o.emptyText)??"-";return E(X(s,{prop:l}),t)}};return a({setOptions:d.setOptions,getOptions:d.getOptions,getRows:d.getRows,getColumns:d.getColumns,getText:d.getText}),(s,l)=>(e.openBlock(),e.createElementBlock("div",e.mergeProps({class:["u-results",{"is-border":f.value.border}],style:f.value.rootStyle},s.$attrs),[e.unref(c).default?e.renderSlot(s.$slots,"default",{},void 0,!0,0):(e.openBlock(),e.createElementBlock("div",At,[e.createElementVNode("div",{class:"u-results-head",style:e.normalizeStyle(f.value.gridStyle)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value.headers,t=>(e.openBlock(),e.createElementBlock("div",{key:t.index,class:"u-results-cell is-head",style:e.normalizeStyle(t.style)},e.toDisplayString(t.label),5))),128))],4),e.createElementVNode("div",Nt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value.rows,t=>(e.openBlock(),e.createElementBlock("div",{key:t.index,class:e.normalizeClass(["u-results-row",{"is-striped":f.value.striped}]),style:e.normalizeStyle(f.value.gridStyle)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.cells,o=>(e.openBlock(),e.createElementBlock("div",{key:o.index,class:"u-results-cell",style:e.normalizeStyle(o.style)},[o.slotName&&e.unref(c)[o.slotName]?e.renderSlot(s.$slots,o.slotName,{row:t.raw,column:o.column,rowIndex:t.index,columnIndex:o.index,value:o.value,text:o.text},void 0,!0,0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(o.text),1)],64))],4))),128))],6))),128))]),f.value.isEmpty?(e.openBlock(),e.createElementBlock("div",$t,[e.renderSlot(s.$slots,"empty",{},()=>[e.createTextVNode(e.toDisplayString(f.value.emptyDataText),1)],!0)])):e.createCommentVNode("",!0)]))],16))}}),[["__scopeId","data-v-a44e2489"]]),Ot={key:2,class:"u-grid-card-default"},Lt={key:1,class:"u-grid-empty full-width"},We=V(e.defineComponent({__name:"UGrid",props:{gridOptions:{default:()=>({})},cardOptions:{default:()=>({})}},setup(i){const a=i,n=e.useSlots(),c=e.reactive({sizes:["none","xs","sm","md","lg","xl"]}),u=e.computed(()=>{const f=a.gridOptions||{},d=a.cardOptions||{},s=f.direction==="column"?"column":"row",l=m.resolveSpan(Number(f.columns));return{containerStyle:m.toSizeStyle(f.width,f.height),directionClass:s==="row"?"row":"column",gutterClass:m.sizeClass("q-col-gutter",f.gutter,"md"),paddingClass:m.sizeClass("q-pa",f.padding,"md"),cardColClass:m.hasFixedWidth(d.width)?"":l>0?`col-${l}`:"col",cardColStyle:m.toColStyle(d.width),cardStyle:m.toCardStyle(d.height),cardDirectionClass:d.direction==="row"?"row":"column",cardPaddingClass:m.sizeClass("q-pa",d.padding,"sm"),cardBordered:d.bordered!==!1,cardCount:m.resolveCount(f),items:Array.isArray(f.items)?f.items:[]}}),m={init(){},resolveSpan(f){if(!Number.isFinite(f)||f<=0)return 0;const d=12/f;return Number.isInteger(d)?d:0},resolveCount(f){if(Array.isArray(f.items))return f.items.length;const d=Number(f.count);return Number.isFinite(d)&&d>0?Math.floor(d):0},hasFixedWidth(f){return f!=null&&f!==""},sizeClass(f,d,s){const l=m.normalizeSize(d)||s;return l==="none"?"":`${f}-${l}`},normalizeSize(f){return f&&c.sizes.includes(f)?f:""},toColStyle(f){return m.hasFixedWidth(f)?{width:m.toCssSize(f)}:{}},toCardStyle(f){const d={};return f!=null&&f!==""&&(d.height=m.toCssSize(f)),d},toSizeStyle(f,d){return{width:m.toCssSize(f,"100%"),height:m.toCssSize(d,"100%")}},toCssSize(f,d=""){return f==null||f===""?d:typeof f=="number"?`${f}px`:String(f)},slotProps(f,d){return{index:f,item:d,options:a.cardOptions||{}}}};return(f,d)=>(e.openBlock(),e.createElementBlock("div",{class:"u-grid",style:e.normalizeStyle(u.value.containerStyle)},[e.createElementVNode("div",{class:e.normalizeClass(["u-grid-cards",[u.value.directionClass,u.value.paddingClass,u.value.gutterClass]])},[u.value.cardCount>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(u.value.cardCount,s=>(e.openBlock(),e.createElementBlock("div",{key:s-1,class:e.normalizeClass(["u-grid-card-col",u.value.cardColClass]),style:e.normalizeStyle(u.value.cardColStyle)},[e.createElementVNode("div",{class:e.normalizeClass(["u-grid-card",[u.value.cardDirectionClass,u.value.cardPaddingClass,{"rounded-borders":u.value.cardBordered}]]),style:e.normalizeStyle(u.value.cardStyle)},[n.card?e.renderSlot(f.$slots,"card",e.mergeProps({ref_for:!0},m.slotProps(s-1,u.value.items[s-1])),void 0,!0,0):n.default?e.renderSlot(f.$slots,"default",e.mergeProps({ref_for:!0},m.slotProps(s-1,u.value.items[s-1])),void 0,!0,1):(e.openBlock(),e.createElementBlock("span",Ot,"索引 "+e.toDisplayString(s-1),1))],6)],6))),128)):(e.openBlock(),e.createElementBlock("div",Lt,[e.renderSlot(f.$slots,"empty",{},()=>[d[0]||(d[0]=e.createTextVNode(" 暂无数据 ",-1))],!0)]))],2)],4))}}),[["__scopeId","data-v-8011a025"]]),Mt={UForm:W,UTable:j,UTablePage:we,USearch:H,UCascader:G,UMenu:Se,UBaseInfo:$e,UResults:Ue,UDialog:Y,UGrid:We},It={install(i){i.use(b);for(const[a,n]of Object.entries(Mt))i.component(a,n)}};g.CascaderParser=fe,g.DEFAULT_GAP=xe,g.DEFAULT_HEADER_BG=Oe,g.DEFAULT_HEADER_COLOR=Le,g.DEFAULT_ITEM_BG=Me,g.DEFAULT_LABEL_WIDTH=Be,g.DEFAULT_STRIPE_BG=Ie,g.FormParser=ue,g.GetQf=kt,g.MenuParser=ye,g.RESULTS_LINE_COLOR=Re,g.TablePageParser=ge,g.UBaseInfo=$e,g.UCascader=G,g.UDialog=Y,g.UForm=W,g.UGrid=We,g.UMenu=Se,g.UResults=Ue,g.USearch=H,g.UTable=j,g.UTablePage=we,g.YamlParser=ke,g.buildGridTemplate=Fe,g.buildLevelSkeleton=ce,g.buildSelectLevels=D,g.cleanParams=M,g.collectLevelFields=R,g.default=It,g.defaultPlaceholder=z,g.flattenToNested=ne,g.formCfgApi=be,g.getByPath=_,g.getCellValue=X,g.getDefaultModel=oe,g.getQf=N,g.getTableValue=tt,g.getValidateTrigger=ee,g.gridStyle=Ne,g.isBareColumn=lt,g.isCascadedSelect=se,g.isEmptyValue=L,g.isRequiredField=Ze,g.nestedToFlat=le,g.normalizeCascaderTree=F,g.normalizeMenuList=U,g.normalizeMenuNode=he,g.resolveAlign=Z,g.resolveAppBase=de,g.resolveColon=Pe,g.resolveColorVars=qe,g.resolveColumnMinWidth=ae,g.resolveColumnSlotName=ot,g.resolveColumnWidth=re,g.resolveColumns=_e,g.resolveItemSlotName=Ee,g.resolveItemValue=J,g.resolveLabelAlign=Te,g.resolveLabelWidth=Ve,g.resolveLayout=K,g.resolveResultsSlotName=De,g.resolveSize=ze,g.resolveSpan=Ae,g.resolveTagOption=I,g.selectDepth=ie,g.setByPath=T,g.toCssSize=S,g.toDisplayText=E,Object.defineProperties(g,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -0,0 +1,44 @@
1
+ import { CardOptions, GridCardSlotProps, GridOptions } from '../model/grid.ts';
2
+ /**
3
+ * UGrid —— 卡片容器。
4
+ *
5
+ * 布局全部复用 `qfui/css/quasar.css` 的类:
6
+ * .row / .column 卡片排列方向
7
+ * .col / .col-<n> 卡片宽度(按列数等分整行)
8
+ * .q-gutter-<size> 卡片之间的间距
9
+ * .q-pa-<size> 内边距
10
+ * .rounded-borders 卡片圆角边框
11
+ *
12
+ * ⚠️ 使用方需要保证 `qfui/css/quasar.css` 已被引入(引 npm 包时它会随产物样式一起;
13
+ * 引源码调试时由工程的全局样式引入)。否则布局类不生效 —— 表现为卡片挤在一起、没有间距。
14
+ */
15
+ interface Props {
16
+ gridOptions?: GridOptions;
17
+ cardOptions?: CardOptions;
18
+ }
19
+ declare function __VLS_template(): {
20
+ attrs: Partial<{}>;
21
+ slots: Readonly<{
22
+ card?: (props: GridCardSlotProps) => any;
23
+ default?: (props: GridCardSlotProps) => any;
24
+ empty?: () => any;
25
+ }> & {
26
+ card?: (props: GridCardSlotProps) => any;
27
+ default?: (props: GridCardSlotProps) => any;
28
+ empty?: () => any;
29
+ };
30
+ refs: {};
31
+ rootEl: HTMLDivElement;
32
+ };
33
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
34
+ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
35
+ gridOptions: GridOptions;
36
+ cardOptions: CardOptions;
37
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
38
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
39
+ export default _default;
40
+ type __VLS_WithTemplateSlots<T, S> = T & {
41
+ new (): {
42
+ $slots: S;
43
+ };
44
+ };
@@ -0,0 +1,113 @@
1
+ /**
2
+ * label 的对齐方式。
3
+ * left —— 左对齐(label 文字贴着左边)
4
+ * right —— 右对齐(label 文字贴着右边,报告单最常见,冒号竖向对齐成一列)
5
+ * justify —— 两端对齐(label 文字撑满 labelWidth 宽度,如「姓  名:」)
6
+ *
7
+ * ⚠️ 只有「label 在 value 左边」时这个配置才有意义;label 在上时**强制左对齐**。
8
+ */
9
+ export type BaseInfoLabelAlign = 'left' | 'right' | 'justify';
10
+ /**
11
+ * label 与 value 的布局方式。
12
+ * left —— label 在 value 左边(同一行),中间用冒号分隔(默认)
13
+ * top —— label 在 value 上面(两行),**不带冒号**,且 label 统一左对齐
14
+ */
15
+ export type BaseInfoLayout = 'left' | 'top';
16
+ /**
17
+ * 单条信息项(`options.items` 的成员)。
18
+ *
19
+ * 值从哪来,优先级:
20
+ * ① `item.value`(写死的常量,如固定文案)
21
+ * ② 数据对象里按 `item.field` 取(数据对象 = 组件 `data` prop,其次 `options.data`)
22
+ */
23
+ export interface BaseInfoItem {
24
+ /** 标签文字,如「姓名」「身份证号」 */
25
+ label?: string;
26
+ /**
27
+ * 取值字段。支持点路径(`'patient.name'` → `data.patient.name`)。
28
+ * 同时兼作插槽名(当 `slot: true` 时)。
29
+ */
30
+ field?: string;
31
+ /** 写死的值。给了它就不再从数据对象里取(`value: null` 也算给了,会显示空值占位) */
32
+ value?: any;
33
+ /**
34
+ * 跨几栏。默认 1(占一栏);超过总栏数时按总栏数算。
35
+ * 用于「诊断结论」这类需要横向铺开的长字段。
36
+ */
37
+ span?: number;
38
+ /**
39
+ * 本条 label 的宽度(数字按 px,字符串原样)。覆盖 `options.labelWidth`。
40
+ * 只有「label 在左边」时生效。
41
+ */
42
+ labelWidth?: number | string;
43
+ /** 本条 label 的布局方式。覆盖 `options.layout`(允许同一条信息栏里混用) */
44
+ layout?: BaseInfoLayout;
45
+ /** 本条 label 的对齐方式。覆盖 `options.labelAlign` */
46
+ labelAlign?: BaseInfoLabelAlign;
47
+ /** 本条是否显示冒号。覆盖 `options.colon`(仅「label 在左边」时有效) */
48
+ colon?: boolean;
49
+ /**
50
+ * 本条 value 用插槽渲染(报告里要给某个值加标签/标红/加链接时用):
51
+ * 字符串 —— 插槽名,如 `slot: 'status'` → 使用方写 `<template #status="{value}">`
52
+ * true —— 用 `field` 当插槽名
53
+ * 插槽名在使用方没提供时,自动退回普通文本渲染(不会渲染成空白)。
54
+ */
55
+ slot?: string | boolean;
56
+ }
57
+ /**
58
+ * 信息栏配置(UBaseInfo 的 `options`)。
59
+ * 直接喂给组件即可显示 —— 解析层(后端 yaml)负责把它拼出来。
60
+ */
61
+ export interface BaseInfoOptions {
62
+ /** 要显示的信息项,按数组顺序从左到右、从上到下铺 */
63
+ items?: BaseInfoItem[];
64
+ /**
65
+ * 分几栏显示。默认 3,至少 1。
66
+ * 实现是 CSS Grid 的 `repeat(columns, minmax(0, 1fr))`,所以每栏等宽、自动换行。
67
+ */
68
+ columns?: number;
69
+ /**
70
+ * label 的对齐方式,默认 `right`。
71
+ * ⚠️ `layout: 'top'` 时被强制为 `left`(顶部 label 独占一行,右对齐/两端对齐没有意义)。
72
+ */
73
+ labelAlign?: BaseInfoLabelAlign;
74
+ /** label 与 value 的布局方式,默认 `left`(label 在左、带冒号) */
75
+ layout?: BaseInfoLayout;
76
+ /**
77
+ * label 的宽度(数字按 px,字符串原样)。只有「label 在左边」时生效,默认 `'5em'`
78
+ * —— 5em 正好是「4 个汉字 + 1 个全角冒号」,能放下「身份证号:」,且跟着字号缩放。
79
+ * 两端对齐必须有个确定宽度,所以不给也会用这个默认值,不会退化成「没宽度」。
80
+ */
81
+ labelWidth?: number | string;
82
+ /**
83
+ * 是否显示 label 后面的冒号,默认 true。
84
+ * 只在「label 在左边」时有效;`layout: 'top'` 时无论如何都不显示冒号。
85
+ * 默认符号是全角冒号 `:`,要改用 `colonText`。
86
+ */
87
+ colon?: boolean;
88
+ /** 冒号符号,默认全角 `':'`。传空串等价于不显示冒号 */
89
+ colonText?: string;
90
+ /**
91
+ * 项与项之间的间距(CSS `gap` 写法)。数字按 px,字符串原样。
92
+ * 默认 `'8px 24px'`(行间距 8px、栏间距 24px)。
93
+ */
94
+ gap?: number | string;
95
+ /** 值为空时显示的占位(默认 `'-'`)。传空串表示什么都不显示 */
96
+ emptyText?: string;
97
+ /**
98
+ * 数据对象(组件 `data` prop 的兜底)。
99
+ * 两者都给时以 `data` prop 为准。异步场景可 `setOptions({...options, data})`。
100
+ */
101
+ data?: Record<string, any>;
102
+ }
103
+ /** 插槽作用域:#label / #value / 按 `item.slot` 取名的插槽都能拿到这些 */
104
+ export interface BaseInfoSlotProps {
105
+ /** 当前这条配置 */
106
+ item: BaseInfoItem;
107
+ /** 第几条,从 0 开始 */
108
+ index: number;
109
+ /** 本条 label 文字 */
110
+ label: string;
111
+ /** 本条原始值(未经空值占位处理) */
112
+ value: any;
113
+ }