urit-qf-ui 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,10 +1,108 @@
1
1
  # urit-qf-ui
2
2
 
3
- 基于 ElementPlus 的业务组件库
3
+ 基于 ElementPlus 的业务组件库(UMenu / TableRender / FormRender / UInput 等)
4
4
 
5
+ > **读者**:接手这个前端底座的使用方开发者 / AI 编码助手。
6
+ > 本文只讲**「怎么把它装进你的工程、样式从哪来、踩了什么坑怎么修」**。
7
+ > 各组件的字段级用法见:`doc/菜单渲染器使用手册.md`、`doc/表格渲染器使用手册.md`、`doc/表单渲染器使用手册.md`。
5
8
 
9
+ ---
6
10
 
7
- ## 开发调试
11
+ ## 0. 四条铁律
12
+
13
+ 1. **引 npm 包时,样式必须显式引入**:`import 'urit-qf-ui/style.css'`。不写这行 → **组件功能正常、样式全丢**(最容易踩、且控制台无任何报错)。
14
+ 2. **peerDependencies 要自己装**,包管理器不会自动装。至少:`vue`、`element-plus`、`@element-plus/icons-vue`、`axios`、`mitt`、`mqtt`、`dayjs`。
15
+ 3. **引源码(alias 到 `qfui/src`)时不需要引 `style.css`**,样式随 SFC 自带;但**必须配 `resolve.dedupe`**,否则会出现两份 Vue / element-plus 实例。
16
+ 4. **从「引源码的工程」往「引 npm 包的工程」拷页面时,样式不会跟着过去**,一定要回目标工程的 `main.ts` 补第 1 条那行 import。
17
+
18
+ ---
19
+
20
+ ## 1. 安装
21
+
22
+ ```bash
23
+ npm i urit-qf-ui
24
+
25
+ # peerDependencies(不会自动安装)
26
+ npm i vue element-plus @element-plus/icons-vue axios mitt mqtt dayjs
27
+ ```
28
+
29
+ ## 2. 引入(两种方式,二选一)
30
+
31
+ ### 方式 A · 引 npm 包(正式工程用这个)
32
+
33
+ ```ts
34
+ // main.ts
35
+ import 'element-plus/dist/index.css'
36
+ import 'urit-qf-ui/style.css' // ← 必须!少这行 = 只有 DOM 没有样式
37
+ ```
38
+
39
+ ```vue
40
+ <!-- 页面里 -->
41
+ <script setup lang="ts">
42
+ import {UMenu, TableRender, FormRender} from 'urit-qf-ui'
43
+ import type {MenuClickPayload} from 'urit-qf-ui'
44
+ </script>
45
+ ```
46
+
47
+ > 若打包器不认 `exports` 字段,退回写完整路径 `import 'urit-qf-ui/dist/style.css'`。
48
+
49
+ ### 方式 B · 引源码(改库时要热更新调试时用)
50
+
51
+ ```ts
52
+ // vite.config.ts
53
+ resolve: {
54
+ dedupe: ['vue', 'vue-router', 'element-plus', '@element-plus/icons-vue', 'mitt', 'axios', 'dayjs'],
55
+ alias: {
56
+ 'urit-qf-ui': fileURLToPath(new URL('../../sw_cp_qfui/qfui/src', import.meta.url)),
57
+ // 或简写成 'qfui',手册里的示例代码用的是这个短名
58
+ }
59
+ }
60
+ ```
61
+
62
+ 此方式**不需要**引 `style.css`(每个 SFC 自带 `<style scoped lang="scss">`),改组件后热更新即时生效。
63
+
64
+ ---
65
+
66
+ ## 3. 为什么 npm 包必须手写那行 import(事实,不是玄学)
67
+
68
+ 库用 Vite lib 模式打包,产物是:
69
+
70
+ | 文件 | 内容 |
71
+ |------|------|
72
+ | `dist/index.js` | **纯 JS**。各 SFC 的 `<style scoped>` 已被抽取走,文件里没有任何 CSS 注入代码(`style.css` / `appendChild` / `document.head` 出现次数均为 **0**),只保留了对外部依赖 `element-plus/dist/index.css` 的 import |
73
+ | `dist/style.css` | 全部组件样式(约 11.8 KB,23 个 `data-v-*` scopeId) |
74
+ | `package.json` | 未配 `style` 字段、未声明 CSS 副作用 → 没有任何工具会自动帮你引 |
75
+
76
+ 所以 `import {UMenu} from 'urit-qf-ui'` 拿到的是"无壳组件"。这与 Element Plus 需要 `import 'element-plus/dist/index.css'` 是完全同一回事。
77
+
78
+ **引源码为什么没事**:组件源码里 `<style scoped>` 和 template 在同一文件,Vite 编译 SFC 时样式自动注入。
79
+
80
+ ---
81
+
82
+ ## 4. 排错表(现象 → 原因 → 修法)
83
+
84
+ | 现象 | 原因 | 修法 |
85
+ |------|------|------|
86
+ | **功能正常、样式全丢**:左侧菜单没宽度/背景、菜单项挤在左上角、搜索表单 label 与输入框重叠、表格无边框、按钮错位,**控制台零报错** | 引了 npm 包但没引它的样式 | 目标工程 `main.ts` 加 `import 'urit-qf-ui/style.css'` |
87
+ | 引了 `style.css` 但样式仍不对 | 工程里存在**两份** `urit-qf-ui`(或 dist 与 src 混用),`data-v-*` scopeId 对不上 | 统一只留一种引入方式;用下面的命令核对 scopeId |
88
+ | `Failed to resolve import "mqtt"` | `mqtt` 是 peerDependency,未自动安装,但产物里有 `import mqtt` | `npm i mqtt@^5.15.2` → 删 `node_modules/.vite` → 重启 dev server |
89
+ | `<el-select>` 下拉选项一个都不显示,**且无任何报错** | 出现两个 Vue / element-plus 实例(alias 引源码时,`qfui/src` 里的 `import 'vue'` 解析到了 `qfui/node_modules` 的另一份) | `resolve.dedupe` 加上 `vue`、`vue-router`、`element-plus`、`@element-plus/icons-vue`、`mitt`、`axios`、`dayjs` |
90
+ | 弹层(下拉 / 日期 / 消息框)被挡住不显示 | 页面引了 Quasar 的 `quasar.css`,`.fullscreen` 带 `position:fixed; z-index:6000` | 自己项目的 css 里覆盖 `.fullscreen{z-index:auto !important}`;根容器别加 `.fullscreen` 类 |
91
+ | 改完库源码,页面没变化 | 工程引的是 **npm 包**(`node_modules` 里的旧 dist),不是源码 | 要么改成 alias 引源码(方式 B),要么重新 `npm run build` + 覆盖 dist + 删 `node_modules/.vite` |
92
+ | **每页条数一多(≥20)表格就一路撑长,分页条被顶出容器、点不到**;机构详情里的子表也把面板撑长 | 0.2.3 的 `.table-grid`(`TableGrid.vue` 根节点)没参与 `.table-container` 的 flex 分配,而 EP 的 `.el-table` 默认 `height: fit-content` | 升级到 **0.2.4+**(该规则已内置到 `TableRender.vue`)。仍在旧版就在项目全局样式里补:`.table-render .table-container .table-grid{flex:1;min-height:0;max-height:var(--table-grid-max-height,none)}` + `.table-render .table-container .table-grid>.el-table{height:100%}`;详见《表格渲染器使用手册》第 8 节 |
93
+
94
+ ### 验证样式真的进来了(10 秒)
95
+
96
+ ```bash
97
+ # 1) 确认产物里 JS 与 CSS 是配套的:输出应为 "23 []" —— 23 个 scopeId 全部能在 index.js 里找到
98
+ node -e "const fs=require('fs');const c=fs.readFileSync('node_modules/urit-qf-ui/dist/style.css','utf8'),j=fs.readFileSync('node_modules/urit-qf-ui/dist/index.js','utf8');const h=[...new Set([...c.matchAll(/data-v-([0-9a-f]{8})/g)].map(m=>m[1]))];console.log(h.length, h.filter(x=>!j.includes('data-v-'+x)))"
99
+
100
+ # 2) 跑起页面后,F12 → Elements 里搜 data-v- ,能看到 .u-menu[data-v-xxxx] 这类规则就说明样式进来了
101
+ ```
102
+
103
+ ---
104
+
105
+ ## 5. 开发调试(改本库源码)
8
106
 
9
107
  ### 预览组件效果
10
108
 
@@ -39,7 +137,9 @@ npm publish
39
137
 
40
138
  ### 发布前检查清单
41
139
 
42
- 1. 更新版本号(修改 `package.json` 中的 `version`)
140
+ 1. 跑 `release.bat`(= `release.py`:先 `npm run build`,再让你选 patch / minor / major 并发布);手动发布才需要自己改 `package.json` 的 `version` 再 `npm publish`
43
141
  2. 确保 `src/index.ts` 导出了所有组件
44
142
  3. 运行 `npm run build` 构建
45
- 4. 运行 `npm publish` 发布
143
+ 4. **确认 `dist/style.css` 已生成且非空**(本库样式全靠它,缺失 = 使用方全部无样式)
144
+ 5. 运行 `npm publish` 发布
145
+ 6. 发布后提醒使用方:升级版本 → 删各自 `node_modules/.vite` → 重启 dev server(vite 会把依赖 CSS 内联进预构建产物,不清缓存会继续用旧样式)
package/dist/index.js CHANGED
@@ -3101,7 +3101,7 @@ const Wt = { class: "table-search" }, qt = { class: "search-fields" }, Ot = { cl
3101
3101
  ], 6);
3102
3102
  };
3103
3103
  }
3104
- }), Ra = /* @__PURE__ */ $(Aa, [["__scopeId", "data-v-124fd940"]]);
3104
+ }), Ra = /* @__PURE__ */ $(Aa, [["__scopeId", "data-v-195aa0e8"]]);
3105
3105
  class Ia {
3106
3106
  constructor(t) {
3107
3107
  x(this, "axiosInstance");
@@ -1,2 +1,2 @@
1
1
  (function(y,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("element-plus"),require("element-plus/dist/index.css"),require("element-plus/es"),require("element-plus/es/components/base/style/css"),require("element-plus/es/components/input/style/css"),require("vue"),require("element-plus/es/components/input-number/style/css"),require("element-plus/es/components/select/style/css"),require("element-plus/es/components/option/style/css"),require("axios"),require("element-plus/es/components/switch/style/css"),require("element-plus/es/components/date-picker/style/css"),require("element-plus/es/components/button/style/css"),require("element-plus/es/components/menu/style/css"),require("element-plus/es/components/sub-menu/style/css"),require("element-plus/es/components/menu-item/style/css"),require("element-plus/es/components/icon/style/css"),require("element-plus/es/components/form/style/css"),require("element-plus/es/components/dialog/style/css"),require("@element-plus/icons-vue"),require("element-plus/es/components/drawer/style/css"),require("element-plus/es/components/table/style/css"),require("element-plus/es/components/table-column/style/css"),require("element-plus/es/components/pagination/style/css"),require("mitt"),require("mqtt")):typeof define=="function"&&define.amd?define(["exports","element-plus","element-plus/dist/index.css","element-plus/es","element-plus/es/components/base/style/css","element-plus/es/components/input/style/css","vue","element-plus/es/components/input-number/style/css","element-plus/es/components/select/style/css","element-plus/es/components/option/style/css","axios","element-plus/es/components/switch/style/css","element-plus/es/components/date-picker/style/css","element-plus/es/components/button/style/css","element-plus/es/components/menu/style/css","element-plus/es/components/sub-menu/style/css","element-plus/es/components/menu-item/style/css","element-plus/es/components/icon/style/css","element-plus/es/components/form/style/css","element-plus/es/components/dialog/style/css","@element-plus/icons-vue","element-plus/es/components/drawer/style/css","element-plus/es/components/table/style/css","element-plus/es/components/table-column/style/css","element-plus/es/components/pagination/style/css","mitt","mqtt"],x):(y=typeof globalThis<"u"?globalThis:y||self,x(y.UritQfUI={},y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.Vue,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.axios,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlusIconsVue,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.ElementPlus,y.mitt,y.mqtt))})(this,function(y,x,I,k,Nt,Rt,e,At,It,zt,Z,Ut,Mt,Ft,Lt,qt,Wt,Ot,jt,Yt,v,Qt,Kt,Gt,Ht,se,re){"use strict";var Pt=Object.defineProperty;var $t=(y,x,I)=>x in y?Pt(y,x,{enumerable:!0,configurable:!0,writable:!0,value:I}):y[x]=I;var w=(y,x,I)=>$t(y,typeof x!="symbol"?x+"":x,I);const ce=e.defineComponent({__name:"UInput",props:{fieldLabel:{},labelPosition:{default:"top"},labelWidth:{},labelAlign:{},required:{type:Boolean},modelValue:{},outlined:{type:Boolean},dense:{type:Boolean},filled:{type:Boolean},borderless:{type:Boolean},label:{},hint:{},error:{type:Boolean},errorMessage:{},type:{},placeholder:{},disable:{type:Boolean},readonly:{type:Boolean},prefix:{},suffix:{},mask:{},maxlength:{}},emits:["update:modelValue"],setup(n,{emit:a}){const t=n,l=a,m=e.computed(()=>{const r={};return t.labelPosition==="left"&&t.labelWidth&&(r.width=typeof t.labelWidth=="number"?`${t.labelWidth}px`:t.labelWidth),t.labelAlign&&(r.textAlign=t.labelAlign),r}),c=e.computed(()=>({"u-input-label-left":t.labelPosition==="left","u-input-label-top":t.labelPosition==="top"})),d={onInput(r){l("update:modelValue",r)}};return(r,o)=>{const i=k.ElInput;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-input",c.value])},[n.fieldLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-input-label",style:e.normalizeStyle(m.value)},[e.createTextVNode(e.toDisplayString(n.fieldLabel)+" ",1),e.createElementVNode("span",{class:e.normalizeClass(["required-star",{"required-star--visible":n.required}])},"*",2)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["u-input-field",{"u-input-field--top":n.labelPosition==="top"}])},[e.createVNode(i,{"model-value":n.modelValue,placeholder:n.placeholder,type:n.type,disabled:n.disable,readonly:n.readonly,maxlength:n.maxlength,"onUpdate:modelValue":d.onInput},null,8,["model-value","placeholder","type","disabled","readonly","maxlength","onUpdate:modelValue"])],2)],2)}}}),C=(n,a)=>{const t=n.__vccOpts||n;for(const[l,m]of a)t[l]=m;return t},P=C(ce,[["__scopeId","data-v-ecf5177c"]]),de={class:"u-input-number-field"},Y=C(e.defineComponent({__name:"UInputNumber",props:{fieldLabel:{},labelPosition:{default:"top"},labelWidth:{},labelAlign:{},required:{type:Boolean},modelValue:{},outlined:{type:Boolean},dense:{type:Boolean},filled:{type:Boolean},borderless:{type:Boolean},label:{},hint:{},error:{type:Boolean},errorMessage:{},type:{},placeholder:{},disable:{type:Boolean},readonly:{type:Boolean},min:{},max:{},step:{},precision:{}},emits:["update:modelValue"],setup(n,{emit:a}){const t=n,l=a,m=e.computed(()=>{const r={};return t.labelPosition==="left"&&t.labelWidth&&(r.width=typeof t.labelWidth=="number"?`${t.labelWidth}px`:t.labelWidth),t.labelAlign&&(r.textAlign=t.labelAlign),r}),c=e.computed(()=>({"u-input-number-label-left":t.labelPosition==="left","u-input-number-label-top":t.labelPosition==="top"})),d={onUpdate(r){l("update:modelValue",r===void 0?0:r)}};return(r,o)=>{const i=k.ElInputNumber;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-input-number",c.value])},[n.fieldLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-input-number-label",style:e.normalizeStyle(m.value)},[e.createTextVNode(e.toDisplayString(n.fieldLabel)+" ",1),e.createElementVNode("span",{class:e.normalizeClass(["required-star",{"required-star--visible":n.required}])},"*",2)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",de,[e.createVNode(i,{"model-value":n.modelValue,placeholder:n.placeholder||"请输入数值",disabled:n.disable,min:n.min,max:n.max,step:n.step,precision:n.precision,controls:!0,"controls-position":"right",style:{width:"100%"},onChange:d.onUpdate},null,8,["model-value","placeholder","disabled","min","max","step","precision","onChange"])])],2)}}}),[["__scopeId","data-v-cb70bd5b"]]),z=Z.create({timeout:3e4,headers:{"Content-Type":"application/json"}});z.interceptors.request.use(n=>{const a=localStorage.getItem("token");return a&&(n.headers.Authorization=`Bearer ${a}`),n},n=>Promise.reject(n)),z.interceptors.response.use(n=>{const a=n.data;if(a&&typeof a=="object"&&!Array.isArray(a)){if(a.status===void 0&&a.code!==void 0){const t=a.code,l=t===0||t===200||Number(t)===0||Number(t)===200;a.status=l?200:Number(t)}if(a.status!==void 0&&a.status!==200){const t=a.message||"请求失败";return console.error("[HTTP Error]",t),Promise.reject(new Error(t))}}return n},n=>{var t,l;const a=((l=(t=n.response)==null?void 0:t.data)==null?void 0:l.message)||n.message||"请求失败";return console.error("[HTTP Error]",a),Promise.reject(n)});const V={get(n,a){return z.get(n,a).then(t=>t.data)},post(n,a,t){return z.post(n,a,t).then(l=>l.data)},instance:z},D={formCfgApi(n,a="forms"){return`/api/form?type=${a}&id=${n}`},dictApi(n){return`/api/dict/full-list?dict_type=${n}`},cascaderApi(n,a=!0){return`/api/dict/tree-list?dict_type=${n}&children=${a}`}},T={},M={};function F(n){const{children:a,...t}=n;return{label:n.label??n.dict_value??String(n.value??""),value:n.value??n.dict_code,...t}}function L(n){return Array.isArray(n)?n.map(a=>{if(!a||typeof a!="object")return a;const t=F(a),l=a.children;return Array.isArray(l)&&l.length>0&&(t.children=L(l)),t}):[]}function q(n){return Array.isArray(n)?n.filter(a=>a&&typeof a=="object").map(a=>F(a)):[]}function me(n){if(!Array.isArray(n))return[];const a=[],t=l=>{for(const m of l){if(!m||typeof m!="object")continue;const c=m.children;a.push(F(m)),Array.isArray(c)&&c.length>0&&t(c)}};return t(n),a}async function $(n){if(!n)return[];if(T[n])return T[n];if(n in M)return await M[n];const a=(async()=>{try{const t=await V.get(D.dictApi(n));if(t.status===200){const l=q(t.data);return T[n]=l,l}return[]}catch(t){return console.error(`[dict] 加载字典 ${n} 失败:`,t),[]}finally{delete M[n]}})();return M[n]=a,a}async function ee(n,a,t=""){if(a==null||a==="")return t;const l=T[n];if(l&&l.length>0)return Q(l,a);const m=await $(n);return m&&m.length>0?Q(m,a):t||String(a)}function Q(n,a){const t=n.find(l=>l.value===a||String(l.value)===String(a));return t?t.label:String(a)}function ue(n,a,t=""){if(a==null||a==="")return t;const l=T[n];return l&&l.length>0?Q(l,a):t||String(a)}async function pe(n){await Promise.all(n.map(a=>$(a)))}function fe(n){n?delete T[n]:Object.keys(T).forEach(a=>{delete T[a]})}function he(n,a){T[n]=a}const ge={class:"u-dict-field"},N=C(e.defineComponent({__name:"UDict",props:{fieldLabel:{},labelPosition:{default:"top"},labelWidth:{},labelAlign:{},required:{type:Boolean},modelValue:{},outlined:{type:Boolean},dense:{type:Boolean},filled:{type:Boolean},borderless:{type:Boolean},label:{},hint:{},error:{type:Boolean},errorMessage:{},type:{},placeholder:{},disable:{type:Boolean},readonly:{type:Boolean},dictType:{}},emits:["update:modelValue"],setup(n,{emit:a}){const t=n,l=a,m=e.reactive({excluded:["fieldLabel","labelPosition","labelWidth","labelAlign","required","modelValue","dictType"],options:[],loading:!1}),c=async()=>{if(t.dictType){m.loading=!0;try{const i=await V.get(D.dictApi(t.dictType));i.status===200?m.options=q(i.data):(console.error("[UDict] 请求失败:",i.message),m.options=[])}catch(i){console.error("[UDict] 加载字典失败:",i),m.options=[]}finally{m.loading=!1}}};e.watch(()=>t.dictType,()=>{c()},{immediate:!0});const d=e.computed(()=>{const i={};return t.labelPosition==="left"&&t.labelWidth&&(i.width=typeof t.labelWidth=="number"?`${t.labelWidth}px`:t.labelWidth),t.labelAlign&&(i.textAlign=t.labelAlign),i}),r=e.computed(()=>({"u-dict-label-left":t.labelPosition==="left","u-dict-label-top":t.labelPosition==="top"})),o={onUpdate(i){l("update:modelValue",i)}};return(i,s)=>{const p=k.ElOption,h=k.ElSelect;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-dict",r.value])},[n.fieldLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-dict-label",style:e.normalizeStyle(d.value)},[e.createTextVNode(e.toDisplayString(n.fieldLabel)+" ",1),e.createElementVNode("span",{class:e.normalizeClass(["required-star",{"required-star--visible":n.required}])},"*",2)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",ge,[e.createVNode(h,{"model-value":n.modelValue,placeholder:n.placeholder||"请选择",loading:m.loading,disabled:n.disable,style:{width:"100%"},onChange:o.onUpdate},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.options,u=>(e.openBlock(),e.createBlock(p,{key:u.value,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:1},8,["model-value","placeholder","loading","disabled","onChange"])])],2)}}}),[["__scopeId","data-v-8bfd4dcf"]]),ye={class:"u-toggle-field"},K=C(e.defineComponent({__name:"UToggle",props:{fieldLabel:{},labelPosition:{default:"left"},labelWidth:{},labelAlign:{},required:{type:Boolean},modelValue:{},dense:{type:Boolean,default:!0},color:{},trueValue:{default:!0},falseValue:{default:!1},label:{},hint:{},disable:{type:Boolean},readonly:{type:Boolean},activeText:{},inactiveText:{},activeColor:{},inactiveColor:{}},emits:["update:modelValue"],setup(n,{emit:a}){const t=n,l=a,m=e.reactive({excluded:["fieldLabel","labelPosition","labelWidth","labelAlign","required","modelValue","trueValue","falseValue","activeText","inactiveText","activeColor","inactiveColor"]}),c=()=>{const o={};return t.labelPosition==="left"&&t.labelWidth&&(o.width=typeof t.labelWidth=="number"?`${t.labelWidth}px`:t.labelWidth),t.labelAlign&&(o.textAlign=t.labelAlign),o},d=e.computed({get:()=>t.modelValue===t.trueValue,set:o=>{l("update:modelValue",o?t.trueValue:t.falseValue)}}),r=e.computed(()=>{const o={};for(const i in t)!m.excluded.includes(i)&&i!=="modelValue"&&(o[i]=t[i]);return o});return(o,i)=>{const s=k.ElSwitch;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-toggle",{"u-toggle-label-left":n.labelPosition==="left"}])},[n.fieldLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-toggle-label",style:e.normalizeStyle(c())},[e.createTextVNode(e.toDisplayString(n.fieldLabel)+" ",1),e.createElementVNode("span",{class:e.normalizeClass(["required-star",{"required-star--visible":n.required}])},"*",2)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",ye,[e.createVNode(s,e.mergeProps({modelValue:d.value,"onUpdate:modelValue":i[0]||(i[0]=p=>d.value=p)},r.value,{"active-text":n.activeText,"inactive-text":n.inactiveText,"active-color":n.activeColor,"inactive-color":n.inactiveColor}),null,16,["modelValue","active-text","inactive-text","active-color","inactive-color"])])],2)}}}),[["__scopeId","data-v-94c1fd38"]]),be={class:"u-cascader-levels"},G=C(e.defineComponent({__name:"UCascader",props:{fieldLabel:{},labelPosition:{default:"top"},labelWidth:{},labelAlign:{},required:{type:Boolean},modelValue:{},options:{},depth:{default:1}},emits:["update:modelValue"],setup(n,{emit:a}){const t=n,l=a,m=()=>{const o={};return t.labelPosition==="left"&&t.labelWidth&&(o.width=typeof t.labelWidth=="number"?`${t.labelWidth}px`:t.labelWidth),t.labelAlign&&(o.textAlign=t.labelAlign),o},c=e.ref([]),d=e.computed(()=>{const o=[];let i=t.options||[];for(let s=0;s<t.depth;s++)if(o.push(i),c.value[s]!==void 0){const p=i.find(h=>h.value===c.value[s]);p&&p.children?i=p.children:i=[]}else i=[];return o});e.watch(()=>t.modelValue,o=>{o!=null?c.value=Array.isArray(o)?o:[o]:c.value=[]},{immediate:!0});const r=(o,i)=>{c.value[o]=i;for(let p=o+1;p<t.depth;p++)c.value[p]=void 0;const s=c.value.filter(p=>p!==void 0);l("update:modelValue",s)};return(o,i)=>{const s=k.ElOption,p=k.ElSelect;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-cascader",{"u-cascader-label-left":n.labelPosition==="left"}])},[n.fieldLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-cascader-label",style:e.normalizeStyle(m())},[e.createTextVNode(e.toDisplayString(n.fieldLabel)+" ",1),e.createElementVNode("span",{class:e.normalizeClass(["required-star",{"required-star--visible":n.required}])},"*",2)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",be,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.depth,h=>(e.openBlock(),e.createElementBlock("div",{key:h-1,class:"u-cascader-level"},[e.createVNode(p,{"model-value":c.value[h-1],options:d.value[h-1]||[],disabled:h>1&&c.value[h-2]===void 0,placeholder:`请选择${h}级`,style:{width:"100%"},onChange:u=>r(h-1,u)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value[h-1]||[],u=>(e.openBlock(),e.createBlock(s,{key:u.value,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:2},1032,["model-value","options","disabled","placeholder","onChange"])]))),128))])],2)}}}),[["__scopeId","data-v-d66c339c"]]),we={class:"u-date-field"},U=C(e.defineComponent({__name:"UDate",props:{fieldLabel:{},labelPosition:{default:"top"},labelWidth:{},labelAlign:{},required:{type:Boolean},modelValue:{},mode:{default:"single"},locale:{default:"zh-CN"},mask:{default:"YYYY-MM-DD"},min:{},max:{}},emits:["update:modelValue"],setup(n,{emit:a}){const t=n,l=a,m=()=>{const o={};return t.labelPosition==="left"&&t.labelWidth&&(o.width=typeof t.labelWidth=="number"?`${t.labelWidth}px`:t.labelWidth),t.labelAlign&&(o.textAlign=t.labelAlign),o},c=e.ref("");e.watch(()=>t.modelValue,o=>{t.mode==="single"?c.value=o||"":t.mode==="multiple"?c.value=Array.isArray(o)?o:o?[o]:[]:t.mode==="range"&&(o&&typeof o=="object"&&o.from&&o.to?c.value=[o.from,o.to]:c.value=[])},{immediate:!0});const d=o=>{o&&(t.mode==="single"||t.mode==="multiple"?l("update:modelValue",o):t.mode==="range"&&o&&o.length===2&&l("update:modelValue",{from:o[0],to:o[1]}))},r=e.computed(()=>t.mode==="range"?"daterange":t.mode==="multiple"?"dates":"date");return(o,i)=>{const s=k.ElDatePicker;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-date",{"u-date-label-left":n.labelPosition==="left"}])},[n.fieldLabel?(e.openBlock(),e.createElementBlock("div",{key:0,class:"u-date-label",style:e.normalizeStyle(m())},[e.createTextVNode(e.toDisplayString(n.fieldLabel)+" ",1),e.createElementVNode("span",{class:e.normalizeClass(["required-star",{"required-star--visible":n.required}])},"*",2)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",we,[e.createVNode(s,{modelValue:c.value,"onUpdate:modelValue":i[0]||(i[0]=p=>c.value=p),type:r.value,placeholder:n.locale==="en-US"?"Select date":"选择日期","range-separator":n.locale==="en-US"?"to":"至","start-placeholder":n.locale==="en-US"?"Start date":"开始日期","end-placeholder":n.locale==="en-US"?"End date":"结束日期",format:n.mask.replace("YYYY","YYYY").replace("MM","MM").replace("DD","DD"),"value-format":n.mask.replace("YYYY","YYYY").replace("MM","MM").replace("DD","DD"),onChange:d},null,8,["modelValue","type","placeholder","range-separator","start-placeholder","end-placeholder","format","value-format"])])],2)}}}),[["__scopeId","data-v-9cd05064"]]);function R(n,a="info"){x.ElMessage({message:n,type:a,duration:1e3,showClose:!1})}function _(n){x.ElMessage({message:n,type:"error",duration:2e3,showClose:!1})}function ke(n){R(n,"success")}function Ce(n){R(n,"error")}function Be(n){R(n,"warning")}function xe(n){R(n,"info")}const E={notify:R,success:ke,error:Ce,warning:Be,info:xe,alertError:_},Ve={key:0,class:"u-menu-brand"},_e=["src"],Se={class:"u-menu-brand-text"},Ee={key:1,class:"u-menu-logout"},te=C(e.defineComponent({__name:"UMenu",props:{menuId:{default:"menu"},config:{},mode:{},projectName:{},activePath:{},width:{}},emits:["menu-click","logout"],setup(n,{expose:a,emit:t}){const l=n,m=t,c=e.reactive({config:null,menus:[],activePath:"",iconMap:{},iconsLoaded:!1}),d=e.computed(()=>{var o,i,s,p,h,u,g,f;return{projectName:l.projectName??((o=c.config)==null?void 0:o.projectName)??"",logo:((i=c.config)==null?void 0:i.logo)||"",mode:l.mode??((s=c.config)==null?void 0:s.mode)??"sidebar",isHorizontal:(l.mode??((p=c.config)==null?void 0:p.mode)??"sidebar")==="horizontal",elMode:(l.mode??((h=c.config)==null?void 0:h.mode)??"sidebar")==="horizontal"?"horizontal":"vertical",width:l.width??((u=c.config)==null?void 0:u.width)??220,menus:c.menus,activeIndex:r.getIndexByPath(c.activePath),showLogout:((g=c.config)==null?void 0:g.showLogout)!==!1,logoutText:((f=c.config)==null?void 0:f.logoutText)||"退出登录",iconMap:c.iconMap}}),r={async init(){await r.ensureIcons(),l.config?(c.config=l.config,c.menus=r.normalizeMenus(l.config.menus)):await r.loadConfig(l.menuId),c.activePath=l.activePath||c.activePath},async loadConfig(o){if(o)try{const i=await V.get(D.formCfgApi(o,"menus"));if(i.status!==200){_(i.message||"获取菜单配置失败");return}const s=i.data||{};c.config=s,s.dictType?await r.loadDictMenus(s.dictType):c.menus=r.normalizeMenus(s.menus)}catch(i){_((i==null?void 0:i.message)||"获取菜单配置失败"),c.menus=[]}},async loadDictMenus(o){try{const i=await V.get(D.cascaderApi(o));if(i.status!==200){_(i.message||"获取菜单字典失败");return}c.menus=r.normalizeMenus(L(i.data))}catch(i){_((i==null?void 0:i.message)||"获取菜单字典失败"),c.menus=[]}},normalizeMenus(o){return Array.isArray(o)?o.map(i=>r.normalizeMenuNode(i)).filter(Boolean):[]},normalizeMenuNode(o){if(!o||typeof o!="object")return null;const i=r.parseInfo(o.info),s=o.label??o.dict_value??o.name;if(!s)return null;const p=i.path??o.path??o.dict_code??o.value??"",h=i.type??o.type??"route",u={...o,label:String(s),type:h,path:String(p??""),icon:i.icon??o.icon??""},g=i.id??o.id;g!=null&&g!==""&&(u.id=String(g));const f=i.open??o.open;(f==="new"||f==="self")&&(u.open=f),delete u.children;const b=o.children;return Array.isArray(b)&&b.length>0&&(u.children=b.map(B=>r.normalizeMenuNode(B)).filter(Boolean)),u},parseInfo(o){if(!o)return{};if(typeof o=="object")return o;if(typeof o=="string")try{const i=JSON.parse(o);return i&&typeof i=="object"?i:{}}catch{return{path:o}}return{}},itemIndex(o,i){return o.path||`menu-${i}`},childIndex(o,i,s,p){return s.path?s.path:`${r.itemIndex(o,i)}-${p}`},hasChildren(o){return Array.isArray(o.children)&&o.children.length>0},getIndexByPath(o){if(!o)return"";for(let i=0;i<c.menus.length;i++){const s=c.menus[i];if(s.path===o)return r.itemIndex(s,i);const p=s.children||[];for(let h=0;h<p.length;h++)if(p[h].path===o)return r.childIndex(s,i,p[h],h)}return""},findItemByIndex(o,i){for(let s=0;s<c.menus.length;s++){const p=c.menus[s],h=r.itemIndex(p,s);if(h===o)return{item:p,level:1,indexPath:i||[h],index:o};const u=p.children||[];for(let g=0;g<u.length;g++){const f=u[g],b=r.childIndex(p,s,f,g);if(b===o)return{item:f,level:2,indexPath:i||[h,b],index:o}}}return null},resolveTarget(o){const i=o.type||"route",s=o.path||"";return i==="url"?{type:i,path:s,url:s,open:o.open||"new"}:i==="form"||i==="table"||i==="menu"?{type:i,path:s,id:o.id||s}:{type:"route",path:s,route:s}},handleSelect(o,i){const s=r.findItemByIndex(o,i);if(!s||r.hasChildren(s.item))return;const p=r.resolveTarget(s.item);c.activePath=s.item.path||o;const h={...p,item:s.item,level:s.level,indexPath:s.indexPath,index:o};m("menu-click",h)},handleLogout(){m("logout")},setActivePath(o){c.activePath=o},async ensureIcons(){if(!c.iconsLoaded){c.iconsLoaded=!0;try{const o=await import("@element-plus/icons-vue"),i=o!=null&&o.default?{...o.default,...o}:{...o},s={};for(const[p,h]of Object.entries(i))s[p]=e.markRaw(h);c.iconMap=s}catch(o){console.warn("[UMenu] @element-plus/icons-vue 不可用,菜单图标将被忽略",o)}}},getIcon(o){return o&&c.iconMap[o]||null}};return e.watch(()=>l.menuId,o=>{l.config||r.loadConfig(o)}),e.watch(()=>l.activePath,o=>{c.activePath=o||""}),e.watch(()=>l.config,o=>{o&&(c.config=o,c.menus=r.normalizeMenus(o.menus))}),e.onMounted(()=>{r.init()}),a({loadConfig:r.loadConfig,setActivePath:r.setActivePath}),(o,i)=>{const s=k.ElIcon,p=k.ElMenuItem,h=k.ElSubMenu,u=k.ElMenu,g=k.ElButton;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-menu",[`u-menu--${d.value.mode}`,{"u-menu--no-brand":!d.value.projectName}]]),style:e.normalizeStyle(d.value.isHorizontal?{}:{width:d.value.width+"px"})},[d.value.projectName?(e.openBlock(),e.createElementBlock("div",Ve,[e.renderSlot(o.$slots,"brand",{projectName:d.value.projectName,mode:d.value.mode},()=>[d.value.logo?(e.openBlock(),e.createElementBlock("img",{key:0,class:"u-menu-logo",src:d.value.logo,alt:"logo"},null,8,_e)):e.createCommentVNode("",!0),e.createElementVNode("span",Se,e.toDisplayString(d.value.projectName),1)],!0)])):e.createCommentVNode("",!0),e.createVNode(u,{class:"u-menu-list",mode:d.value.elMode,"default-active":d.value.activeIndex,"unique-opened":!d.value.isHorizontal,onSelect:r.handleSelect},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value.menus,(f,b)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:r.itemIndex(f,b)},[r.hasChildren(f)?(e.openBlock(),e.createBlock(h,{key:0,index:r.itemIndex(f,b)},{title:e.withCtx(()=>[e.renderSlot(o.$slots,"menu-title",{item:f,level:1,index:b},()=>[r.getIcon(f.icon)?(e.openBlock(),e.createBlock(s,{key:0,class:"u-menu-icon"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.getIcon(f.icon))))]),_:2},1024)):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(f.label),1)],!0)]),default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.children,(B,A)=>(e.openBlock(),e.createBlock(p,{key:r.childIndex(f,b,B,A),index:r.childIndex(f,b,B,A)},{default:e.withCtx(()=>[e.renderSlot(o.$slots,"menu-item",{item:B,level:2,index:A,parent:f},()=>[r.getIcon(B.icon)?(e.openBlock(),e.createBlock(s,{key:0,class:"u-menu-icon"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.getIcon(B.icon))))]),_:2},1024)):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(B.label),1)],!0)]),_:2},1032,["index"]))),128))]),_:2},1032,["index"])):(e.openBlock(),e.createBlock(p,{key:1,index:r.itemIndex(f,b)},{default:e.withCtx(()=>[e.renderSlot(o.$slots,"menu-item",{item:f,level:1,index:b,parent:null},()=>[r.getIcon(f.icon)?(e.openBlock(),e.createBlock(s,{key:0,class:"u-menu-icon"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.getIcon(f.icon))))]),_:2},1024)):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(f.label),1)],!0)]),_:2},1032,["index"]))],64))),128))]),_:3},8,["mode","default-active","unique-opened","onSelect"]),d.value.showLogout?(e.openBlock(),e.createElementBlock("div",Ee,[e.renderSlot(o.$slots,"logout",{mode:d.value.mode},()=>[e.createVNode(g,{class:"u-menu-logout-btn",text:"",onClick:r.handleLogout},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.value.logoutText),1)]),_:1},8,["onClick"])],!0)])):e.createCommentVNode("",!0)],6)}}}),[["__scopeId","data-v-fe63251c"]]),De={key:0,class:"form-content"},Te={key:1,class:"form-layout"},Pe={key:0,class:"form-header"},$e={class:"title"},Ne={class:"form-body"},Re={key:1,class:"form-footer"},Ae=C(e.defineComponent({__name:"FormContainer",props:{visible:{type:Boolean},layout:{},title:{},loading:{type:Boolean,default:!1}},emits:["update:visible","close"],setup(n,{emit:a}){const t=n,l=a,{visible:m}=e.toRefs(t),c=e.computed(()=>t.layout.open==="normal"),d=e.computed(()=>t.layout.width||400),r={handleClose(){l("update:visible",!1),l("close")},updateVisible(o){l("update:visible",o)}};return(o,i)=>{const s=k.ElIcon,p=k.ElDialog;return c.value?e.unref(m)?(e.openBlock(),e.createElementBlock("div",Te,[n.title?(e.openBlock(),e.createElementBlock("div",Pe,[e.createElementVNode("div",$e,e.toDisplayString(n.title),1)])):e.createCommentVNode("",!0),e.createElementVNode("div",Ne,[n.loading?(e.openBlock(),e.createBlock(s,{key:0,class:"is-loading",size:40},{default:e.withCtx(()=>[e.createVNode(e.unref(v.Loading))]),_:1})):e.renderSlot(o.$slots,"default",{},void 0,!0,1)]),o.$slots.actions?(e.openBlock(),e.createElementBlock("div",Re,[e.renderSlot(o.$slots,"actions",{},void 0,!0)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(p,{key:0,"model-value":e.unref(m),title:n.title,width:d.value,"close-on-click-modal":!1,"onUpdate:modelValue":r.updateVisible,onClose:r.handleClose},{footer:e.withCtx(()=>[e.renderSlot(o.$slots,"actions",{},void 0,!0)]),default:e.withCtx(()=>[e.unref(m)?(e.openBlock(),e.createElementBlock("div",De,[n.loading?(e.openBlock(),e.createBlock(s,{key:0,class:"is-loading",size:40},{default:e.withCtx(()=>[e.createVNode(e.unref(v.Loading))]),_:1})):e.renderSlot(o.$slots,"default",{},void 0,!0,1)])):e.createCommentVNode("",!0)]),_:3},8,["model-value","title","width","onUpdate:modelValue","onClose"]))}}}),[["__scopeId","data-v-7e522999"]]),Ie=C(e.defineComponent({__name:"FormGrid",props:{fields:{},layout:{}},setup(n){const a=n,t=e.reactive({columns:e.computed(()=>a.layout.columns||1)}),l={getColSpan(m){const c=m.colSpan||1;return Math.min(c,t.columns)}};return(m,c)=>(e.openBlock(),e.createElementBlock("div",{class:"form-grid",style:e.normalizeStyle({"--grid-columns":t.columns})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.fields,d=>(e.openBlock(),e.createElementBlock("div",{key:d.field,class:"form-grid-item",style:e.normalizeStyle({gridColumn:`span ${l.getColSpan(d)}`})},[e.renderSlot(m.$slots,"default",{field:d},void 0,!0)],4))),128))],4))}}),[["__scopeId","data-v-90ed35a4"]]),ze={class:"form-field"},Ue=C(e.defineComponent({__name:"FormField",props:{field:{},modelValue:{},layout:{},disabled:{type:Boolean,default:!1},error:{}},emits:["update:modelValue"],setup(n,{emit:a}){const t=n,l=a,m=e.reactive({componentMap:e.markRaw({input:P,"input-number":Y,dict:N,switch:K,cascader:G,date:U}),cascaderOptions:[]}),c=()=>{t.field.cascaderKey&&V.get(D.cascaderApi(t.field.cascaderKey)).then(s=>{s.status===200&&(m.cascaderOptions=L(s.data))})};e.watch(()=>t.field.cascaderKey,c,{immediate:!0});const d=e.computed(()=>m.componentMap[t.field.type]||P),r=e.computed(()=>{if((t.layout.labelPosition||"top")==="left"){const p=t.layout.labelWidth||0,h=typeof p=="number"?p+4:p;return{marginLeft:typeof h=="number"?`${h}px`:h}}return{}}),o=e.computed(()=>{const{field:s,modelValue:p,layout:h,disabled:u}=t;let g=p;s.type==="switch"&&p==null&&(g=!1);const f={fieldLabel:s.label,modelValue:g,labelPosition:h.labelPosition||"top",disable:u,name:s.field,required:s.required};if(h.labelWidth&&(f.labelWidth=h.labelWidth),h.labelAlign&&(f.labelAlign=h.labelAlign),s.maxlength&&(f.maxlength=s.maxlength),s.placeholder&&(f.placeholder=s.placeholder),s.readonly&&(f.readonly=s.readonly),s.lineCount&&s.lineCount>=2?(f.type="textarea",f.rows=s.lineCount):s.inputType&&(f.type=s.inputType),s.type==="switch"&&(s.activeText&&(f.activeText=s.activeText),s.inactiveText&&(f.inactiveText=s.inactiveText),s.activeColor&&(f.activeColor=s.activeColor),s.inactiveColor&&(f.inactiveColor=s.inactiveColor),s.trueValue!==void 0&&(f.trueValue=s.trueValue),s.falseValue!==void 0&&(f.falseValue=s.falseValue)),s.dictType&&(f.dictType=s.dictType),s.cascaderKey&&(f.options=m.cascaderOptions,f.depth=s.cascaderDepth||2),s.type==="date"){s.mode&&(f.mode=s.mode),s.locale&&(f.locale=s.locale),s.format?f.mask=s.format:s.mask&&(f.mask=s.mask);const b=s.dateMin??s.min,B=s.dateMax??s.max;b!=null&&(f.min=b),B!=null&&(f.max=B)}return s.type==="input-number"&&(s.min!==void 0&&(f.min=s.min),s.max!==void 0&&(f.max=s.max),s.step&&(f.step=s.step),s.precision!==void 0&&(f.precision=s.precision)),f}),i={handleUpdate(s){l("update:modelValue",s)}};return(s,p)=>(e.openBlock(),e.createElementBlock("div",ze,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d.value),e.mergeProps(o.value,{"onUpdate:modelValue":i.handleUpdate}),null,16,["onUpdate:modelValue"])),e.createElementVNode("div",{class:e.normalizeClass(["field-error",{"field-error--visible":n.error}]),style:e.normalizeStyle(r.value)},e.toDisplayString(n.error||""),7)]))}}),[["__scopeId","data-v-10299c8d"]]);class Me{constructor(){w(this,"formConfig",null);w(this,"formData",{});w(this,"loading",!1);w(this,"submitting",!1);w(this,"visible",!1);w(this,"isEditMode",!1);w(this,"errors",[]);w(this,"currentQuery",{})}}let Fe=class{constructor(){w(this,"data",e.reactive(new Me))}parseQuery(a){if(!a)return{};const t={},l=a.split("&");for(const m of l){const[c,d]=m.split("=");c&&(t[c]=d||"")}return t}async fetchFormConfig(a){const t=await V.get(D.formCfgApi(a,"forms"));if(t.status!==200)throw new Error(t.message||"获取表单配置失败");return t.data}async fetchFormData(a,t){const l=t?`${a}?${t}`:a,m=await V.get(l);if(m.status!==200)throw new Error(m.message||"获取表单数据失败");return m.data}async submitForm(a,t){return await V.post(a,t)}buildInitialData(a){const t={};for(const l of a)l.default!==void 0?t[l.field]=l.default:t[l.field]=null;return t}checkIsEditMode(a){return!!a&&a.trim().length>0}validate(){var t;this.data.errors=[];const a=((t=this.data.formConfig)==null?void 0:t.fields)||[];for(const l of a){const m=this.data.formData[l.field];if(l.required&&(m==null||m==="")){this.data.errors.push({field:l.field,message:`${l.label}为必填项`});continue}if(l.rules&&l.rules.length>0&&m){for(const c of l.rules)if(c.pattern&&!new RegExp(c.pattern).test(m)){this.data.errors.push({field:l.field,message:c.message||`${l.label}格式不正确`});break}}}return this.data.errors.length===0}getFieldError(a){const t=this.data.errors.find(l=>l.field===a);return t?t.message:null}clearErrors(){this.data&&(this.data.errors=[])}async openForm(a,t){this.data.loading=!0,this.data.visible=!0,this.clearErrors(),this.data.currentQuery=this.parseQuery(t||"");try{const l=await this.fetchFormConfig(a);if(this.data.formConfig=l,this.data.isEditMode=this.checkIsEditMode(t||""),this.data.formData=this.buildInitialData(l.fields),this.data.isEditMode&&l.api.get&&t){const m=await this.fetchFormData(l.api.get,t),c=this.nestedToFlat(m);this.data.formData={...this.data.formData,...c}}}catch(l){throw console.error("[FormRender] 打开表单失败:",l),this.data.visible=!1,l}finally{this.data.loading=!1}}async doSubmit(){if(!this.data.formConfig)return;if(!this.validate())throw new Error("请完善表单信息");const{api:a}=this.data.formConfig;let t=this.data.isEditMode?a.edit:a.add;if(!t)throw new Error("提交地址未配置");let l={...this.data.formData};l=this.flattenToNested(l),this.data.isEditMode&&this.data.currentQuery.id&&(l.id=Number(this.data.currentQuery.id)),this.data.submitting=!0;try{const m=await this.submitForm(t,l);if(m.status===200)return m.data;throw new Error(m.message||"提交失败")}finally{this.data.submitting=!1}}closeForm(){this&&(this.data.visible=!1,this.data.formConfig=null,this.data.formData={},this.data.isEditMode=!1,this.data.currentQuery={},this.clearErrors())}flattenToNested(a){const t={};for(const l in a){const m=a[l];if(l.includes(".")){const c=l.split(".");let d=t;for(let r=0;r<c.length-1;r++){const o=c[r];d[o]||(d[o]={}),d=d[o]}d[c[c.length-1]]=m}else t[l]=m}return t}nestedToFlat(a,t=""){const l={};for(const m in a){const c=a[m],d=t?`${t}.${m}`:m;c&&typeof c=="object"&&!Array.isArray(c)?Object.keys(c).length===2&&"from"in c&&"to"in c?l[d]=c:Object.assign(l,this.nestedToFlat(c,d)):l[d]=c}return l}};const H=C(e.defineComponent({__name:"FormRender",setup(n,{expose:a}){const t=new Fe,l=e.ref(null),m=e.reactive({currentQuery:{},submitResolve:null}),c=e.computed(()=>{var u;const h={};if(!t.data.isEditMode||!m.currentQuery)return h;for(const g of((u=t.data.formConfig)==null?void 0:u.fields)||[])m.currentQuery[g.field]!==void 0&&(h[g.field]=!0);return h}),d=e.computed(()=>{var h;return((h=t.data.formConfig)==null?void 0:h.layout)||{open:"dialog",columns:1,labelPosition:"top",buttonAlign:"right"}}),r=e.computed(()=>{var h;return((h=t.data.formConfig)==null?void 0:h.fields)||[]}),o=e.computed(()=>{var h,u;return((u=(h=t.data.formConfig)==null?void 0:h.meta)==null?void 0:u.title)||"表单"}),i=e.computed(()=>d.value.buttonAlign||"right"),s=e.computed(()=>d.value.open==="normal"),p={async showForm(h,u){m.currentQuery=t.parseQuery(u||"");try{await t.openForm(h,u)}catch(g){return _((g==null?void 0:g.message)||"打开表单失败"),null}return new Promise(g=>{m.submitResolve=g})},async handleSubmit(){var h,u;try{const g=await t.doSubmit(),f=((u=(h=t.data.formConfig)==null?void 0:h.meta)==null?void 0:u.title)+"保存成功";return E.success(f),m.submitResolve&&(m.submitResolve(g),m.submitResolve=null),s.value||t.closeForm(),g}catch(g){return m.submitResolve&&(m.submitResolve(null),m.submitResolve=null),g!=null&&g.message&&g.message!=="请完善表单信息"&&_(g.message),null}},resolvePending(){m.submitResolve&&(m.submitResolve(null),m.submitResolve=null)},handleCancel(){s.value||(p.resolvePending(),t.closeForm())},getFieldError(h){return t.getFieldError(h)},handleClose(){p.resolvePending(),t.closeForm()}};return a({showForm:p.showForm}),(h,u)=>{const g=k.ElForm,f=k.ElButton;return e.openBlock(),e.createBlock(Ae,{visible:e.unref(t).data.visible,"onUpdate:visible":u[0]||(u[0]=b=>e.unref(t).data.visible=b),layout:d.value,title:o.value,loading:e.unref(t).data.loading,onClose:p.handleClose},{actions:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["form-actions",i.value==="right"?"justify-end":"justify-start"])},[e.createVNode(f,{onClick:p.handleCancel},{default:e.withCtx(()=>[...u[1]||(u[1]=[e.createTextVNode("取消",-1)])]),_:1},8,["onClick"]),e.createVNode(f,{type:"primary",loading:e.unref(t).data.submitting,onClick:p.handleSubmit},{default:e.withCtx(()=>[...u[2]||(u[2]=[e.createTextVNode("提交",-1)])]),_:1},8,["loading","onClick"])],2)]),default:e.withCtx(()=>[e.createVNode(g,{ref_key:"formRef",ref:l,class:"form-render","label-position":"top"},{default:e.withCtx(()=>[e.createVNode(Ie,{fields:r.value,layout:d.value},{default:e.withCtx(({field:b})=>[e.createVNode(Ue,{modelValue:e.unref(t).data.formData[b.field],"onUpdate:modelValue":B=>e.unref(t).data.formData[b.field]=B,field:b,layout:d.value,disabled:c.value[b.field],error:p.getFieldError(b.field)},null,8,["modelValue","onUpdate:modelValue","field","layout","disabled","error"])]),_:1},8,["fields","layout"])]),_:1},512)]),_:1},8,["visible","layout","title","loading","onClose"])}}}),[["__scopeId","data-v-c8356aa3"]]);class Le{constructor(a){this.config=a}async fetchList(a,t){const l={page:t.page,pageSize:t.pageSize,...a},m={};for(const o in l){const i=l[o];i!==""&&i!==null&&i!==void 0&&(m[o]=i)}const c=new URLSearchParams;for(const o in m)c.append(o,String(m[o]));const d=`${this.config.api.list}${c.toString()?"?"+c.toString():""}`,r=await V.get(d);if(r.status===200){const o=r.data;return Array.isArray(o)?{rows:o,total:o.length}:o||{rows:[],total:0}}throw new Error(r.message||"获取列表数据失败")}async deleteRow(a){if(!this.config.api.delete)throw new Error("未配置删除API");const t=this.config.key||"id",l=a[t],m=`${this.config.api.delete}?${encodeURIComponent(t)}=${encodeURIComponent(String(l??""))}`,c=await V.post(m);if(c.status!==200)throw new Error(c.message||"删除失败")}async batchDelete(a){if(!this.config.api.delete)throw new Error("未配置删除API");const t=await V.post(this.config.api.delete,a);if(t.status!==200)throw new Error(t.message||"批量删除失败")}async exportData(a){if(!this.config.api.export)throw new Error("未配置导出API");const l=(await V.post(this.config.api.export,a,{responseType:"blob"})).data,m=window.URL.createObjectURL(l),c=document.createElement("a");c.href=m,c.download=`export_${Date.now()}.xlsx`,c.click(),window.URL.revokeObjectURL(m)}async downloadTemplate(){if(!this.config.api.import)throw new Error("未配置导入API");const t=(await V.get(`${this.config.api.import}/template`,{responseType:"blob"})).data,l=window.URL.createObjectURL(t),m=document.createElement("a");m.href=l,m.download=`template_${Date.now()}.xlsx`,m.click(),window.URL.revokeObjectURL(l)}async importData(a){if(!this.config.api.import)throw new Error("未配置导入API");const t=new FormData;t.append("file",a);const l=await V.post(this.config.api.import,t,{headers:{"Content-Type":"multipart/form-data"}});if(l.status!==200)throw new Error(l.message||"导入失败");return l.data}}class qe{constructor(){w(this,"tableConfig",null);w(this,"rows",[]);w(this,"total",0);w(this,"loading",!1);w(this,"searchParams",{});w(this,"pagination",{page:1,pageSize:20});w(this,"currentRow",null);w(this,"detailVisible",!1);w(this,"detailData",null);w(this,"detailLoading",!1);w(this,"previewVisible",!1);w(this,"previewRow",null)}}let We=class{constructor(){w(this,"data",e.reactive(new qe));w(this,"dataService",null)}async loadConfig(a){var m;const t=D.formCfgApi(a,"tables");console.log("load config url =",t);const l=await V.get(t);if(console.log("---"),l.status!==200)throw new Error(l.message||"获取表格配置失败");this.data.tableConfig=l.data,this.dataService=new Le(l.data),this.data.currentRow=null,this.data.detailVisible=!1,this.data.detailData=null,this.data.previewVisible=!1,this.data.previewRow=null,typeof console<"u"&&console.log("[TableRender] loadConfig:",{tableId:a,hasDetail:this.hasDetail(),detail:(m=this.data.tableConfig)==null?void 0:m.detail}),this.initSearchParams()}initSearchParams(){var l;const a={},t=((l=this.data.tableConfig)==null?void 0:l.search)||[];for(const m of t)a[m.field]="";this.data.searchParams=a}async loadData(){if(!this.dataService)throw new Error("表格配置未加载");this.data.loading=!0;try{const a=await this.dataService.fetchList(this.data.searchParams,this.data.pagination);this.data.rows=a.rows||[],this.data.total=a.total||0,this.syncRowRefs()}finally{this.data.loading=!1}}syncRowRefs(){const{currentRow:a,detailData:t}=this.data;if(!a&&!t)return;const l=this.getKeyField(),m=c=>c&&this.data.rows.find(d=>d[l]===c[l])||null;this.data.currentRow=m(a),this.data.detailData&&(this.data.detailData=m(this.data.detailData),this.data.detailData||(this.data.detailVisible=!1))}async search(){this.data.pagination.page=1,await this.loadData()}async reset(){this.initSearchParams(),this.data.pagination.page=1,await this.loadData()}updateSearchParam(a,t){this.data.searchParams[a]=t}async deleteRow(a){if(!this.dataService)throw new Error("表格配置未加载");await this.dataService.deleteRow(a),await this.loadData(),this.isSameRow(a,this.data.currentRow)&&(this.data.currentRow=null),this.isSameRow(a,this.data.detailData)&&(this.data.detailData=null,this.data.detailVisible=!1),this.isSameRow(a,this.data.previewRow)&&(this.data.previewRow=null,this.data.previewVisible=!1)}isSameRow(a,t){return!a||!t?!1:a[this.getKeyField()]===t[this.getKeyField()]}async changePage(a){this.data.pagination.page=a,await this.loadData()}async changePageSize(a){this.data.pagination.pageSize=a,this.data.pagination.page=1,await this.loadData()}setCurrentRow(a){this.data.currentRow=a,this.hasDetail()&&this.openDetail(a)}getCurrentRow(){return this.data.currentRow}getCurrentKey(){var a;return(a=this.data.currentRow)==null?void 0:a[this.getKeyField()]}async exportData(){if(!this.dataService)throw new Error("表格配置未加载");await this.dataService.exportData(this.data.searchParams)}async downloadTemplate(){if(!this.dataService)throw new Error("表格配置未加载");await this.dataService.downloadTemplate()}async importData(a){if(!this.dataService)throw new Error("表格配置未加载");const t=await this.dataService.importData(a);return await this.loadData(),t}getKeyField(){var a;return((a=this.data.tableConfig)==null?void 0:a.key)||"id"}getFormId(){var a;return(a=this.data.tableConfig)==null?void 0:a.form}getDetailFormId(){var a,t;return(t=(a=this.data.tableConfig)==null?void 0:a.detail)==null?void 0:t.formId}hasDetail(){var t;const a=(t=this.data.tableConfig)==null?void 0:t.detail;return!a||typeof a!="object"||a.enable===!1?!1:a.enable===!0||a.enable!==void 0&&a.enable!==null&&a.enable!==""?!0:!!(a.formId||a.position)}isDetailInline(){var a,t;return((t=(a=this.data.tableConfig)==null?void 0:a.detail)==null?void 0:t.enable)===!0}getDetailMode(){return this.isDetailInline()?"inline":"drawer"}getDetailPosition(){var a,t;return((t=(a=this.data.tableConfig)==null?void 0:a.detail)==null?void 0:t.position)||"right"}getDetailWidth(){var t,l;const a=(l=(t=this.data.tableConfig)==null?void 0:t.detail)==null?void 0:l.width;return typeof a=="number"&&a>0?`${a}px`:typeof a=="string"&&a?a:"400px"}getDetailDirection(){return{left:"ltr",right:"rtl",top:"ttb"}[this.getDetailPosition()]||"rtl"}isDetailOpen(){return this.isDetailInline()||this.data.detailVisible}openDetail(a){this.data.detailData=a,this.data.detailVisible=!0}closeDetail(){this.data.detailVisible=!1,this.isDetailInline()&&(this.data.detailData=null)}openPreview(a){this.data.previewRow=a,this.data.previewVisible=!0}closePreview(){this.data.previewVisible=!1,this.data.previewRow=null}getSearchFields(){var a;return((a=this.data.tableConfig)==null?void 0:a.search)||[]}getColumns(){var a;return((a=this.data.tableConfig)==null?void 0:a.columns)||[]}hasSearch(){return this.getSearchFields().length>0}getToolbar(){var t;const a=(t=this.data.tableConfig)==null?void 0:t.toolbar;return Array.isArray(a)?a:[]}hasToolbar(){return this.getToolbar().length>0}getActions(){var t;const a=(t=this.data.tableConfig)==null?void 0:t.actions;return Array.isArray(a)?a:[]}hasActions(){return this.getActions().length>0}getButtonFormId(a){var t;return(a==null?void 0:a.form)||((t=this.data.tableConfig)==null?void 0:t.form)}getPaginationType(){var a;return((a=this.data.tableConfig)==null?void 0:a.pagination)||"page"}};const Oe={class:"table-search"},je={class:"search-fields"},Ye={class:"search-actions"},Qe=C(e.defineComponent({__name:"TableSearch",props:{fields:{},modelValue:{}},emits:["update:modelValue","search","reset"],setup(n,{emit:a}){const t=n,l=a,m={input:P,dict:N,dept:N,role:N,date:U,daterange:U},c={getComponent(d){return m[d]||P},updateValue(d,r){const o={...t.modelValue,[d]:r};l("update:modelValue",o)},handleSearch(){const d={};for(const r in t.modelValue){const o=t.modelValue[r];d[r]=typeof o=="string"?o.trim():o}l("update:modelValue",d),l("search")},handleReset(){l("reset")}};return(d,r)=>{const o=k.ElButton;return e.openBlock(),e.createElementBlock("div",Oe,[e.createElementVNode("div",je,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.fields,i=>(e.openBlock(),e.createElementBlock("div",{key:i.field,class:"search-field"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(c.getComponent(i.type)),{"model-value":t.modelValue[i.field],"field-label":i.label,"dict-type":i.dictType,mode:i.type==="daterange"?"range":void 0,"label-position":"left","onUpdate:modelValue":s=>c.updateValue(i.field,s)},null,8,["model-value","field-label","dict-type","mode","onUpdate:modelValue"]))]))),128)),e.renderSlot(d.$slots,"search-extra",{params:t.modelValue,update:c.updateValue},void 0,!0)]),e.createElementVNode("div",Ye,[e.createVNode(o,{type:"primary",onClick:c.handleSearch},{default:e.withCtx(()=>[...r[0]||(r[0]=[e.createTextVNode("查询",-1)])]),_:1},8,["onClick"]),e.createVNode(o,{onClick:c.handleReset},{default:e.withCtx(()=>[...r[1]||(r[1]=[e.createTextVNode("重置",-1)])]),_:1},8,["onClick"]),e.renderSlot(d.$slots,"search-actions",{params:t.modelValue,search:c.handleSearch,reset:c.handleReset},void 0,!0)])])}}}),[["__scopeId","data-v-09e61a77"]]),Ke={class:"table-toolbar"},Ge={class:"toolbar-items"},He={key:1},Je=C(e.defineComponent({__name:"TableToolbar",props:{items:{},currentRow:{}},emits:["action"],setup(n,{emit:a}){const t=n,l=a,m=e.reactive({iconMap:{}}),c=e.computed(()=>({hasCurrentRow:!!t.currentRow})),d={needRow(r){return r==="edit"||r==="delete"||r==="preview"},getText(r){return r.text?r.text:{add:"新增",edit:"编辑",delete:"删除",preview:"预览",back:"返回"}[r.action]||""},getButtonType(r){return r.style?r.style==="default"?"":r.style:{add:"primary",edit:"primary",delete:"danger",preview:"primary",back:"primary"}[r.action]||""},isDisabled(r){return r.disabled?!0:d.needRow(r.action)&&!c.value.hasCurrentRow},getIcon(r){return r.icon?m.iconMap[r.icon]:null},handleClick(r){l("action",{action:r.action,item:r,row:t.currentRow})},async ensureIcons(){const r=[...new Set(t.items.map(s=>s.icon).filter(Boolean))];if(r.length===0)return;const o=await import("@element-plus/icons-vue"),i={...m.iconMap};for(const s of r)o[s]&&(i[s]=e.markRaw(o[s]));m.iconMap=e.markRaw(i)}};return e.onMounted(()=>{d.ensureIcons()}),e.watch(()=>t.items,()=>{d.ensureIcons()}),(r,o)=>{const i=k.ElIcon,s=k.ElButton;return e.openBlock(),e.createElementBlock("div",Ke,[e.renderSlot(r.$slots,"toolbar-left",{currentRow:t.currentRow},void 0,!0),e.createElementVNode("div",Ge,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,(p,h)=>(e.openBlock(),e.createBlock(s,{key:h,type:d.getButtonType(p),disabled:d.isDisabled(p),onClick:u=>d.handleClick(p)},{default:e.withCtx(()=>[d.getIcon(p)?(e.openBlock(),e.createBlock(i,{key:0},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d.getIcon(p))))]),_:2},1024)):e.createCommentVNode("",!0),d.getText(p)?(e.openBlock(),e.createElementBlock("span",He,e.toDisplayString(d.getText(p)),1)):e.createCommentVNode("",!0)]),_:2},1032,["type","disabled","onClick"]))),128))]),e.renderSlot(r.$slots,"toolbar-extra",{currentRow:t.currentRow},void 0,!0)])}}}),[["__scopeId","data-v-8f722515"]]),Xe=C(e.defineComponent({__name:"UInputShow",props:{modelValue:{},multiline:{type:Boolean,default:!1},maxLines:{default:0}},setup(n){const a=n,t=e.computed(()=>a.modelValue===null||a.modelValue===void 0?"":String(a.modelValue)),l=e.computed(()=>a.multiline||t.value.includes(`
2
- `)),m=e.computed(()=>a.maxLines>0&&l.value?{display:"-webkit-box",WebkitLineClamp:a.maxLines,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis"}:{});return(c,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-input-show",{"u-input-multiline":l.value}]),style:e.normalizeStyle(m.value)},e.toDisplayString(t.value),7))}}),[["__scopeId","data-v-c78b151e"]]),Ze=C(e.defineComponent({__name:"UDictShow",props:{modelValue:{},dictType:{},defaultText:{default:""}},setup(n){const a=n,t=e.ref(""),l=e.ref(!1),m=async()=>{if(a.modelValue===null||a.modelValue===void 0||a.modelValue===""){t.value=a.defaultText;return}if(!a.dictType){t.value=String(a.modelValue);return}l.value=!0;try{const c=await ee(a.dictType,a.modelValue,a.defaultText);t.value=c}catch(c){console.error("[UDictShow] 翻译失败:",c),t.value=String(a.modelValue)}finally{l.value=!1}};return e.watch(()=>a.modelValue,m,{immediate:!0}),e.watch(()=>a.dictType,()=>{a.dictType&&$(a.dictType).then(()=>m())}),e.onMounted(()=>{a.dictType?$(a.dictType).then(()=>m()):m()}),(c,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-dict-show",{"u-dict-loading":l.value}])},e.toDisplayString(t.value),3))}}),[["__scopeId","data-v-908045c4"]]),ve=C(e.defineComponent({__name:"UToggleShow",props:{modelValue:{},trueText:{default:"开启"},falseText:{default:"关闭"},useYesNo:{type:Boolean,default:!1}},setup(n){const a=n,t=e.computed(()=>a.useYesNo?"是":a.trueText),l=e.computed(()=>a.useYesNo?"否":a.falseText),m=e.computed(()=>a.modelValue===!0||a.modelValue==="true"?t.value:a.modelValue===!1||a.modelValue==="false"?l.value:String(a.modelValue??"")),c=e.computed(()=>a.modelValue===!0||a.modelValue==="true"?"toggle-true":a.modelValue===!1||a.modelValue==="false"?"toggle-false":"toggle-default");return(d,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-toggle-show",c.value])},e.toDisplayString(m.value),3))}}),[["__scopeId","data-v-bac05efc"]]),et=C(e.defineComponent({__name:"UCascaderShow",props:{modelValue:{},cascaderKey:{},separator:{default:" / "},showRawValue:{type:Boolean,default:!0}},setup(n){const a=n,t=e.ref(""),l=e.ref(!1),m=async()=>{if(!a.modelValue||!Array.isArray(a.modelValue)){t.value="";return}const c=a.modelValue;if(a.cascaderKey){l.value=!0;try{const d=await $(a.cascaderKey),o=c.map(i=>{const s=d.find(p=>p.value===i||String(p.value)===String(i));return s?s.label:a.showRawValue?String(i):""}).filter(i=>i!=="");t.value=o.join(a.separator)}catch(d){console.error("[UCascaderShow] 翻译失败:",d),t.value=a.showRawValue?c.join(a.separator):""}finally{l.value=!1}}else t.value=c.join(a.separator)};return e.watch(()=>a.modelValue,m,{immediate:!0}),e.onMounted(()=>{m()}),(c,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-cascader-show",{"u-cascader-loading":l.value}])},e.toDisplayString(t.value),3))}}),[["__scopeId","data-v-5d84df67"]]),tt=C(e.defineComponent({__name:"UDateShow",props:{modelValue:{},mode:{default:"single"},locale:{default:"zh-CN"},format:{},separator:{default:", "},rangeSeparator:{default:" ~ "}},setup(n){const a=n,t=e.computed(()=>a.locale==="en-US"?a.mode==="range"?" - ":", ":a.mode==="range"?a.rangeSeparator:a.separator),l=e.computed(()=>{const d=a.modelValue;return a.mode==="single"?d?m(d,a.format):"":a.mode==="multiple"?d?Array.isArray(d)?d.map(r=>m(r,a.format)).join(t.value):String(d):"":a.mode==="range"?d?typeof d=="object"&&d.from&&d.to?`${m(d.from,a.format)}${t.value}${m(d.to,a.format)}`:Array.isArray(d)&&d.length>=2?`${m(d[0],a.format)}${t.value}${m(d[1],a.format)}`:String(d):"":String(d??"")});function m(d,r){return d||""}const c=e.computed(()=>!l.value);return(d,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-date-show",{"u-date-empty":c.value}])},e.toDisplayString(l.value||(n.locale==="en-US"?"Empty":"暂无")),3))}}),[["__scopeId","data-v-930657df"]]),W=C(e.defineComponent({__name:"UFieldView",props:{type:{default:"text"},modelValue:{},dictType:{},mode:{},locale:{default:"zh-CN"},format:{},text:{},trueText:{default:"开启"},falseText:{default:"关闭"},useYesNo:{type:Boolean,default:!1},cascaderKey:{},multiline:{type:Boolean},defaultText:{default:""}},setup(n){const a=n,t=e.computed(()=>{if(!a.text)return null;const d=a.text.split("/");return d.length>=2?{trueText:d[0].trim(),falseText:d[1].trim()}:null}),l=e.computed(()=>{var d;return a.trueText||((d=t.value)==null?void 0:d.trueText)||"开启"}),m=e.computed(()=>{var d;return a.falseText||((d=t.value)==null?void 0:d.falseText)||"关闭"}),c=e.computed(()=>{switch(a.type){case"dict":return"UDictShow";case"switch":return"UToggleShow";case"cascader":return"UCascaderShow";case"date":return"UDateShow";case"input":case"text":default:return"UInputShow"}});return(d,r)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(c.value==="UDictShow"?Ze:c.value==="UToggleShow"?ve:c.value==="UCascaderShow"?et:c.value==="UDateShow"?tt:Xe),{"model-value":n.modelValue,"dict-type":n.type==="dict"?n.dictType:void 0,"cascader-key":n.type==="cascader"?n.cascaderKey:void 0,mode:n.type==="date"?n.mode:void 0,locale:n.type==="date"?n.locale:void 0,format:n.type==="date"?n.format:void 0,"true-text":n.type==="switch"?l.value:void 0,"false-text":n.type==="switch"?m.value:void 0,"use-yes-no":n.type==="switch"?n.useYesNo:void 0,multiline:n.type==="input"||n.type==="text"?n.multiline:void 0,"default-text":n.type==="dict"?n.defaultText:void 0},null,8,["model-value","dict-type","cascader-key","mode","locale","format","true-text","false-text","use-yes-no","multiline","default-text"]))}}),[["__scopeId","data-v-fedb54d7"]]),at={class:"table-grid"},ot=C(e.defineComponent({inheritAttrs:!1,__name:"TableGrid",props:{rows:{},columns:{},loading:{type:Boolean},actions:{},keyField:{},selection:{type:[String,Boolean]},dictData:{},activeKey:{}},emits:["rowAction","rowClick","selectionChange"],setup(n,{emit:a}){const t=n,l=e.useSlots(),m=a,c=e.computed(()=>({actionList:t.actions||[],actionColumnWidth:r.getActionColumnWidth(),hasUserEmpty:!!l.empty,forwardSlots:Object.keys(l).filter(o=>o!=="default")})),d=e.computed(()=>{const o=t.columns.map(i=>{const s={prop:i.field,label:i.label};return typeof i.width=="number"&&(s.width=i.width),s});return c.value.actionList.length>0&&o.push({prop:"actions",label:"操作",width:c.value.actionColumnWidth,fixed:"right"}),o}),r={actionText(o){return o.text?o.text:{add:"新增",edit:"编辑",delete:"删除",preview:"预览",back:"返回"}[o.action]||""},actionType(o){return o.style?o.style==="default"?"":o.style:{add:"primary",edit:"primary",delete:"danger",preview:"primary",back:"primary"}[o.action]||"primary"},getActionColumnWidth(){const i=(t.actions||[]).reduce((s,p)=>s+Math.max(52,r.actionText(p).length*16+12),0);return Math.max(80,Math.ceil(i)+16)},maskPhone(o){return!o||o.length<7?o:o.replace(/(\d{3})\d{4}(\d{4})/,"$1****$2")},maskIdCard(o){return!o||o.length<8?o:o.replace(/(\d{3})\d{11}(\d{4})/,"$1***********$2")},formatMoney(o){const i=Number(o);return isNaN(i)?String(o):i.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})},formatByType(o,i){if(!o)return"";switch(i){case"phone":return r.maskPhone(o);case"idcard":return r.maskIdCard(o);case"money":return r.formatMoney(o);case"percent":return String(o*100)+"%";default:return i&&i.includes("{}")?i.replace("{}",String(o)):String(o)}},getNestedValue(o,i){if(!i.includes("."))return o[i];const s=i.split(".");let p=o;for(const h of s)if(p&&typeof p=="object"&&h in p)p=p[h];else return;return p},useFieldView(o){return o.type?["dict","switch","cascader","date","input","text"].includes(o.type):!1},rowClassName({row:o}){if(!o||t.activeKey===void 0||t.activeKey===null)return"";const i=t.keyField||"id";return o[i]===t.activeKey?"table-grid-active-row":""},onSelectionChange(o){m("selectionChange",o)},onRowClick(o){m("rowClick",o)},onRowAction(o,i){m("rowAction",{action:o.action,item:o,row:i})}};return(o,i)=>{const s=k.ElTableColumn,p=k.ElButton,h=k.ElTable;return e.openBlock(),e.createElementBlock("div",at,[e.createVNode(h,e.mergeProps({stripe:!0,border:!0,...o.$attrs},{data:t.rows.length?t.rows:[{}],loading:t.loading,"row-key":t.keyField||"id","row-class-name":r.rowClassName,onSelectionChange:r.onSelectionChange,onRowClick:i[0]||(i[0]=u=>r.onRowClick(u))}),e.createSlots({default:e.withCtx(()=>[t.selection?(e.openBlock(),e.createBlock(s,{key:0,type:"selection",width:"55"})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,u=>(e.openBlock(),e.createBlock(s,{key:u.prop,prop:u.prop,label:u.label,width:u.width,fixed:u.fixed},{default:e.withCtx(({row:g})=>[u.prop==="actions"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[Object.keys(g).length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(c.value.actionList,(f,b)=>(e.openBlock(),e.createBlock(p,{key:b,link:"",type:r.actionType(f),disabled:f.disabled===!0,size:"small",onClick:e.withModifiers(B=>r.onRowAction(f,g),["stop"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.actionText(f)),1)]),_:2},1032,["type","disabled","onClick"]))),128)):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[Object.keys(g).length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.columns,f=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:f.field},[f.field===u.prop&&r.useFieldView(f)?(e.openBlock(),e.createBlock(W,{key:0,type:f.type,"model-value":r.getNestedValue(g,f.field),"dict-type":f.dictType,mode:f.mode,locale:f.locale,format:f.format,text:f.text,"true-text":f.trueText,"false-text":f.falseText,"use-yes-no":f.useYesNo,"cascader-key":f.cascaderKey,multiline:f.multiline,"default-text":f.defaultText},null,8,["type","model-value","dict-type","mode","locale","format","text","true-text","false-text","use-yes-no","cascader-key","multiline","default-text"])):f.field===u.prop?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass({"table-grid-format":f.format})},e.toDisplayString(r.formatByType(r.getNestedValue(g,f.field),f.format||"")),3)):e.createCommentVNode("",!0)],64))),128)):e.createCommentVNode("",!0)],64))]),_:2},1032,["prop","label","width","fixed"]))),128)),e.renderSlot(o.$slots,"default",{},void 0,!0)]),_:2},[e.renderList(c.value.forwardSlots,u=>({name:u,fn:e.withCtx(g=>[e.renderSlot(o.$slots,u,e.normalizeProps(e.guardReactiveProps(g||{})),void 0,!0)])})),c.value.hasUserEmpty?void 0:{name:"empty",fn:e.withCtx(()=>[i[1]||(i[1]=e.createElementVNode("div",{class:"no-data"},"暂无数据",-1))]),key:"0"}]),1040,["data","loading","row-key","row-class-name","onSelectionChange"])])}}}),[["__scopeId","data-v-ca606e7b"]]),nt={class:"table-pagination"},lt={class:"page-size-select"},it={class:"total-text"},st={key:1,class:"load-more"},rt={key:2,class:"total-text"},ct=C(e.defineComponent({__name:"TablePagination",props:{page:{},pageSize:{},total:{},type:{}},emits:["update:page","update:pageSize"],setup(n,{emit:a}){const t=n,l=a,m=e.computed(()=>({totalPages:Math.ceil(t.total/t.pageSize),showPagination:t.type==="page"&&t.total>0})),c={onPageChange:d=>{l("update:page",d)},onPageSizeChange:d=>{l("update:pageSize",d)}};return(d,r)=>{const o=k.ElPagination,i=k.ElOption,s=k.ElSelect,p=k.ElButton;return e.openBlock(),e.createElementBlock("div",nt,[m.value.showPagination?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(o,{"current-page":t.page,"page-count":m.value.totalPages,"page-sizes":[10,20,50,100],"page-size":t.pageSize,layout:"total, prev, pager, next, jumper",onCurrentChange:c.onPageChange,onSizeChange:c.onPageSizeChange},null,8,["current-page","page-count","page-size","onCurrentChange","onSizeChange"]),e.createElementVNode("div",lt,[e.createVNode(s,{"model-value":t.pageSize,style:{width:"100px"},onChange:c.onPageSizeChange},{default:e.withCtx(()=>[e.createVNode(i,{value:10,label:"10条/页"}),e.createVNode(i,{value:20,label:"20条/页"}),e.createVNode(i,{value:50,label:"50条/页"}),e.createVNode(i,{value:100,label:"100条/页"})]),_:1},8,["model-value","onChange"]),e.createElementVNode("span",it,"共 "+e.toDisplayString(t.total)+" 条",1)])],64)):t.type==="auto"?(e.openBlock(),e.createElementBlock("div",st,[e.createVNode(p,{disabled:t.page*t.pageSize>=t.total},{default:e.withCtx(()=>[...r[0]||(r[0]=[e.createTextVNode("加载更多",-1)])]),_:1},8,["disabled"])])):t.type==="all"?(e.openBlock(),e.createElementBlock("div",rt,"共 "+e.toDisplayString(t.total)+" 条",1)):e.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-53e593aa"]]),dt={class:"table-detail"},mt={key:0,class:"detail-header"},ut={class:"detail-title"},pt={class:"detail-body"},ft={key:0,class:"detail-status"},ht={key:1,class:"detail-content"},gt={class:"detail-label"},yt={class:"detail-value"},bt={key:2,class:"detail-status"},J=C(e.defineComponent({__name:"TableDetail",props:{showHeader:{type:Boolean},title:{},loading:{type:Boolean},rowData:{},columns:{},emptyText:{}},setup(n){const a=n,t=e.computed(()=>({showHeader:a.showHeader!==!1,title:a.title||"详情",emptyText:a.emptyText||"暂无数据",hasRow:!!a.rowData})),l={getNestedValue(m,c){if(!m||!c)return"";if(!c.includes("."))return m[c];const d=c.split(".");let r=m;for(const o of d)if(r&&typeof r=="object"&&o in r)r=r[o];else return"";return r}};return(m,c)=>(e.openBlock(),e.createElementBlock("div",dt,[t.value.showHeader?(e.openBlock(),e.createElementBlock("div",mt,[e.createElementVNode("div",ut,e.toDisplayString(t.value.title),1)])):e.createCommentVNode("",!0),e.createElementVNode("div",pt,[a.loading?(e.openBlock(),e.createElementBlock("div",ft,"加载中...")):t.value.hasRow?(e.openBlock(),e.createElementBlock("div",ht,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.columns,d=>(e.openBlock(),e.createElementBlock("div",{key:d.field,class:"detail-item"},[e.createElementVNode("div",gt,e.toDisplayString(d.label),1),e.createElementVNode("div",yt,[e.createVNode(W,{type:d.type,"model-value":l.getNestedValue(a.rowData,d.field),"dict-type":d.dictType,mode:d.mode,locale:d.locale,format:d.format,text:d.text,"true-text":d.trueText,"false-text":d.falseText,"use-yes-no":d.useYesNo,"cascader-key":d.cascaderKey,multiline:d.multiline,"default-text":d.defaultText},null,8,["type","model-value","dict-type","mode","locale","format","text","true-text","false-text","use-yes-no","cascader-key","multiline","default-text"])])]))),128))])):(e.openBlock(),e.createElementBlock("div",bt,e.toDisplayString(t.value.emptyText),1)),e.renderSlot(m.$slots,"detail-extra",{rowData:a.rowData,columns:a.columns},void 0,!0)])]))}}),[["__scopeId","data-v-191846c8"]]),wt={class:"table-body"},kt={class:"table-container"},ae=C(e.defineComponent({inheritAttrs:!1,__name:"TableRender",props:{formId:{}},emits:["back","toolbar-action","row-action"],setup(n,{expose:a,emit:t}){const l=["search-extra","search-actions","toolbar-left","toolbar-extra","detail-extra"],m=n,c=e.useAttrs(),d=e.useSlots(),r=t,o=new We,i=e.ref(null),s=e.reactive({searchParams:{},loaded:!1,dictData:{}});e.onMounted(async()=>{m.formId&&await h.loadConfig(m.formId)});const p=e.computed(()=>({tableConfig:o.data.tableConfig,rows:o.data.rows,total:o.data.total,loading:o.data.loading,pagination:o.data.pagination,searchFields:o.getSearchFields(),hasSearch:o.hasSearch(),columns:o.getColumns(),toolbar:o.getToolbar(),hasToolbar:o.hasToolbar(),actions:o.getActions(),currentRow:o.data.currentRow,currentKey:o.getCurrentKey(),showDetail:o.hasDetail(),detailMode:o.getDetailMode(),detailSide:o.getDetailPosition()==="left"?"left":"right",detailWidth:o.getDetailWidth(),detailDirection:o.getDetailDirection(),detailVisible:o.data.detailVisible,detailData:o.data.detailData,detailLoading:o.data.detailLoading,previewVisible:o.data.previewVisible,previewRow:o.data.previewRow,dictData:s.dictData})),h={getTableAttrs(){const{class:u,style:g,...f}=c;return f},getTableSlots(){const u={};for(const g of Object.keys(d))l.includes(g)||(u[g]=!0);return u},async loadConfig(u){try{await o.loadConfig(u)}catch(g){_((g==null?void 0:g.message)||"获取表格配置失败");return}s.searchParams={...o.data.searchParams},s.loaded=!0,await h.loadDictData(),await h.handleLoadData()},async handleLoadData(){try{await o.loadData()}catch(u){_((u==null?void 0:u.message)||"加载数据失败")}},async loadDictData(){const u=o.getColumns(),g=new Set;for(const f of u)f.type==="dict"&&f.dictType&&g.add(f.dictType);for(const f of g)try{const b=await V.get(D.dictApi(f));b.status===200&&(s.dictData[f]=q(b.data))}catch(b){console.error(`[TableRender] 加载字典 ${f} 失败:`,b)}},async handleSearch(){o.data.searchParams={...s.searchParams};try{await o.search()}catch(u){_((u==null?void 0:u.message)||"查询失败")}},async handleReset(){s.searchParams={};try{await o.reset()}catch(u){_((u==null?void 0:u.message)||"重置失败")}},updateSearchParam(u,g){s.searchParams[u]=g},async handlePageChange(u){try{await o.changePage(u)}catch(g){_((g==null?void 0:g.message)||"加载数据失败")}},async handlePageSizeChange(u){try{await o.changePageSize(u)}catch(g){_((g==null?void 0:g.message)||"加载数据失败")}},handleRowClick(u){o.setCurrentRow(u)},handleDetailClose(){o.closeDetail()},handlePreviewClose(){o.closePreview()},handlePreview(u){if(!u){E.warning("请先点击表格中的一行数据");return}o.openPreview(u)},handleToolbarAction(u){r("toolbar-action",u),h.dispatchAction(u)},handleRowAction(u){r("row-action",u),h.dispatchAction(u)},async dispatchAction(u){switch(u.action){case"add":await h.handleAdd(u.item);break;case"edit":await h.handleEdit(u.row,u.item);break;case"delete":await h.handleDelete(u.row,u.item);break;case"preview":h.handlePreview(u.row);break;case"back":r("back",u);break;case"export":await h.handleExport();break;default:await h.handleCustomAction(u)}},async handleAdd(u){const g=u?o.getButtonFormId(u):o.getFormId();if(!g){E.warning("未配置表单,无法新增");return}if(!i.value)return;await i.value.showForm(g)!=null&&await h.handleLoadData()},async handleEdit(u,g){if(!u){E.warning("请先点击表格中的一行数据");return}const f=g?o.getButtonFormId(g):o.getFormId();if(!f){E.warning("未配置表单,无法编辑");return}if(!i.value)return;const b=o.getKeyField();await i.value.showForm(f,`${b}=${u[b]}`)!=null&&await h.handleLoadData()},async handleDelete(u,g){if(!u){E.warning("请先点击表格中的一行数据");return}try{await x.ElMessageBox.confirm((g==null?void 0:g.confirm)||"确定要删除这条数据吗?","确认删除",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"})}catch{return}try{await o.deleteRow(u),E.success("删除成功")}catch(f){_((f==null?void 0:f.message)||"删除失败")}},async handleExport(){try{await o.exportData(),E.success("导出成功")}catch(u){_((u==null?void 0:u.message)||"导出失败")}},async handleCustomAction(u){const{item:g,row:f}=u;if(!(g!=null&&g.url)){E.warning(`未识别的按钮动作:${u.action}`);return}try{await x.ElMessageBox.confirm(g.confirm||"确定执行该操作吗?","确认",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"})}catch{return}try{const b=await V.post(g.url,f||{});if(b.status!==200)throw new Error(b.message||"操作失败");E.success(b.message||"操作成功"),await h.handleLoadData()}catch(b){_((b==null?void 0:b.message)||"操作失败")}}};return a({loadConfig:h.loadConfig}),(u,g)=>{var b,B,A,oe,ne,le;const f=k.ElDrawer;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["table-render",u.$attrs.class]),style:e.normalizeStyle(u.$attrs.style)},[p.value.hasSearch?(e.openBlock(),e.createBlock(Qe,{key:0,fields:p.value.searchFields,modelValue:s.searchParams,"onUpdate:modelValue":g[0]||(g[0]=S=>s.searchParams=S),onSearch:h.handleSearch,onReset:h.handleReset},{"search-extra":e.withCtx(S=>[e.renderSlot(u.$slots,"search-extra",e.normalizeProps(e.guardReactiveProps(S||{})),void 0,!0)]),"search-actions":e.withCtx(S=>[e.renderSlot(u.$slots,"search-actions",e.normalizeProps(e.guardReactiveProps(S||{})),void 0,!0)]),_:3},8,["fields","modelValue","onSearch","onReset"])):e.createCommentVNode("",!0),e.createElementVNode("div",wt,[e.createElementVNode("div",kt,[e.createVNode(ot,e.mergeProps(h.getTableAttrs(),{rows:p.value.rows,columns:p.value.columns,loading:p.value.loading,actions:p.value.actions,"key-field":(b=p.value.tableConfig)==null?void 0:b.key,"dict-data":p.value.dictData,"active-key":p.value.currentKey,onRowAction:h.handleRowAction,onRowClick:h.handleRowClick}),e.createSlots({_:2},[e.renderList(h.getTableSlots(),(S,ie)=>({name:ie,fn:e.withCtx(Tt=>[e.renderSlot(u.$slots,ie,e.normalizeProps(e.guardReactiveProps(Tt||{})),void 0,!0)])}))]),1040,["rows","columns","loading","actions","key-field","dict-data","active-key","onRowAction","onRowClick"]),e.createVNode(ct,{class:"table-pagination",page:p.value.pagination.page,"page-size":p.value.pagination.pageSize,total:p.value.total,type:(B=p.value.tableConfig)==null?void 0:B.pagination,"onUpdate:page":h.handlePageChange,"onUpdate:pageSize":h.handlePageSizeChange},null,8,["page","page-size","total","type","onUpdate:page","onUpdate:pageSize"])]),p.value.showDetail&&p.value.detailMode==="inline"?(e.openBlock(),e.createBlock(J,{key:0,class:e.normalizeClass(["table-detail-inline",`table-detail-inline-${p.value.detailSide}`]),style:e.normalizeStyle({width:p.value.detailWidth}),title:(oe=(A=p.value.tableConfig)==null?void 0:A.meta)==null?void 0:oe.title,loading:p.value.detailLoading,"row-data":p.value.detailData,columns:p.value.columns,"empty-text":p.value.detailSide==="left"?"请点击右侧表格行查看详情":"请点击左侧表格行查看详情"},{"detail-extra":e.withCtx(S=>[e.renderSlot(u.$slots,"detail-extra",e.normalizeProps(e.guardReactiveProps(S||{})),void 0,!0)]),_:3},8,["class","style","title","loading","row-data","columns","empty-text"])):e.createCommentVNode("",!0)]),p.value.showDetail&&p.value.detailMode==="drawer"?(e.openBlock(),e.createBlock(f,{key:1,"model-value":p.value.detailVisible,direction:p.value.detailDirection,size:p.value.detailWidth,title:((le=(ne=p.value.tableConfig)==null?void 0:ne.meta)==null?void 0:le.title)||"详情",onClose:h.handleDetailClose},{default:e.withCtx(()=>[e.createVNode(J,{"show-header":!1,loading:p.value.detailLoading,"row-data":p.value.detailData,columns:p.value.columns},{"detail-extra":e.withCtx(S=>[e.renderSlot(u.$slots,"detail-extra",e.normalizeProps(e.guardReactiveProps(S||{})),void 0,!0)]),_:3},8,["loading","row-data","columns"])]),_:3},8,["model-value","direction","size","title","onClose"])):e.createCommentVNode("",!0),p.value.previewVisible?(e.openBlock(),e.createBlock(f,{key:2,"model-value":!0,direction:p.value.detailDirection,size:p.value.detailWidth,title:"详情",onClose:h.handlePreviewClose},{default:e.withCtx(()=>[e.createVNode(J,{"show-header":!1,"row-data":p.value.previewRow,columns:p.value.columns},{"detail-extra":e.withCtx(S=>[e.renderSlot(u.$slots,"detail-extra",e.normalizeProps(e.guardReactiveProps(S||{})),void 0,!0)]),_:3},8,["row-data","columns"])]),_:3},8,["direction","size","onClose"])):e.createCommentVNode("",!0),p.value.hasToolbar?(e.openBlock(),e.createBlock(Je,{key:3,class:"table-toolbar-bottom",items:p.value.toolbar,"current-row":p.value.currentRow,onAction:h.handleToolbarAction},{"toolbar-left":e.withCtx(S=>[e.renderSlot(u.$slots,"toolbar-left",e.normalizeProps(e.guardReactiveProps(S||{})),void 0,!0)]),"toolbar-extra":e.withCtx(S=>[e.renderSlot(u.$slots,"toolbar-extra",e.normalizeProps(e.guardReactiveProps(S||{})),void 0,!0)]),_:3},8,["items","current-row","onAction"])):e.createCommentVNode("",!0),e.createVNode(H,{ref_key:"formRef",ref:i},null,512)],6)}}}),[["__scopeId","data-v-124fd940"]]);class Ct{constructor(a){w(this,"axiosInstance");w(this,"baseUrl","");this.axiosInstance=Z.create({timeout:1e4,baseURL:""}),this.axiosInstance.defaults.headers["Content-Type"]="application/json;charset=utf-8",this.axiosInstance.interceptors.request.use(t=>(t.headers.token=localStorage.getItem("token"),a.baseUrl?t.baseURL=a.baseUrl:t.baseURL=this.baseUrl||window.location.origin,t),t=>Promise.reject(t)),this.axiosInstance.interceptors.response.use(t=>t.config.responseType==="blob"?t:t.data,t=>Promise.reject(t))}Post(a,t){return this.axiosInstance.post(a,t)}Get(a,t){return this.axiosInstance.get(a,{params:t})}Delete(a,t){return this.axiosInstance.delete(a,{params:t})}Put(a,t){return this.axiosInstance.put(a,t)}Download(a,t){return this.axiosInstance.get(a,{params:t,responseType:"blob"})}}class Bt{constructor(){w(this,"emitter");this.emitter=se()}On(a,t){this.emitter.on(a,t)}Emit(a,t){this.emitter.emit(a,t)}Off(a,t){this.emitter.off(a,t)}}class xt{constructor(a,t){w(this,"mqttClient",null);w(this,"eventBus");this.eventBus=a,this.connect(t).then()}async connect(a){const t={username:a.userName,password:a.password,clientId:`${a.module}_${this.randomStr(10)}`,clean:!0,keepalive:50,connectTimeout:5e3,reconnectPeriod:5e3};let l=a.mqttUrl||"ws://127.0.0.1:5002/ws";if(console.log("connect to mqtt..."),this.mqttClient=re.connect(l,t),!this.mqttClient){console.log("connect mqtt failed");return}this.mqttClient.on("connect",()=>{console.log("=====> mqtt connect success!"),this.mqttClient.subscribe(X,{qos:0},m=>{console.log(m?`mqtt subscribe [${X}] failed`:`mqtt subscribe [${X}] success`)})}),this.mqttClient.on("message",(m,c)=>{const d=c.toString();if(!d){console.error("Received empty message",m);return}let r=null;try{r=JSON.parse(d)}catch(o){console.error("Failed to parse message JSON",m,d,o);return}if(!r||r.Content===void 0||r.Content===null||!r.PType){console.log("parse notice failed!",d);return}r.PType==Vt&&this.eventBus.Emit(r.Route,r.Content)}),this.mqttClient.on(O.OffLine,()=>{console.log("mqtt offline...")}),this.mqttClient.on(O.Reconnect,()=>{console.log("mqtt reconnecting...")}),this.mqttClient.on(O.Close,()=>{console.log("mqtt close")}),this.mqttClient.on(O.Error,m=>{console.log("mqtt error")})}randomStr(a){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let l="";for(let m=0;m<a;m++)l+=t.charAt(Math.floor(Math.random()*t.length));return l}}const X="Notice",Vt="NOTICE",O={OffLine:"offline",Close:"close",Reconnect:"reconnect",Error:"error"};let j;const _t=n=>{if(!n)throw new Error("QfOptions is undefined");if(!j&&n&&(j=new St(n)),!j)throw new Error("Qf not initialized, please call GetQf(options) first");return j};class St{constructor(a){w(this,"EventBus");w(this,"WebApi");w(this,"Mqtt");w(this,"options");this.initQf(a)}initQf(a){if(!a)throw new Error(`StartQf failed! options is ${a}`);this.options=a,console.log("StartQf(), qfOptions=",a),this.EventBus=new Bt,this.WebApi=new Ct(a),this.options.useMqtt&&(this.Mqtt=new xt(this.EventBus,a))}On(a,t){this.EventBus.On(a,t)}Emit(a,t){this.EventBus.Emit(a,t)}Off(a,t){this.EventBus.Off(a,t)}Post(a,t){return this.WebApi.Post(a,t)}Get(a,t){return this.WebApi.Get(a,t)}Delete(a,t){return this.WebApi.Delete(a,t)}Put(a,t){return this.WebApi.Put(a,t)}Download(a,t){return this.WebApi.Download(a,t)}RegNotice(a,t){this.EventBus.On(a,t)}}const Et={UInput:P,UInputNumber:Y,UDict:N,UToggle:K,UCascader:G,UDate:U,UMenu:te,FormRender:H,TableRender:ae,UFieldView:W},Dt={install(n){n.use(x);for(const[a,t]of Object.entries(Et))n.component(a,t)}};y.FormRender=H,y.GetQf=_t,y.TableRender=ae,y.UCascader=G,y.UDate=U,y.UDict=N,y.UFieldView=W,y.UInput=P,y.UInputNumber=Y,y.UMenu=te,y.UToggle=K,y.apis=D,y.clearDictCache=fe,y.default=Dt,y.flattenDictTree=me,y.getDict=$,y.mapDictTree=L,y.normalizeDictNode=F,y.notify=E,y.notifyUtil=R,y.preloadDicts=pe,y.setDictCache=he,y.toDictOptions=q,y.translateDict=ee,y.translateDictSync=ue,Object.defineProperties(y,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
2
+ `)),m=e.computed(()=>a.maxLines>0&&l.value?{display:"-webkit-box",WebkitLineClamp:a.maxLines,WebkitBoxOrient:"vertical",overflow:"hidden",textOverflow:"ellipsis"}:{});return(c,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-input-show",{"u-input-multiline":l.value}]),style:e.normalizeStyle(m.value)},e.toDisplayString(t.value),7))}}),[["__scopeId","data-v-c78b151e"]]),Ze=C(e.defineComponent({__name:"UDictShow",props:{modelValue:{},dictType:{},defaultText:{default:""}},setup(n){const a=n,t=e.ref(""),l=e.ref(!1),m=async()=>{if(a.modelValue===null||a.modelValue===void 0||a.modelValue===""){t.value=a.defaultText;return}if(!a.dictType){t.value=String(a.modelValue);return}l.value=!0;try{const c=await ee(a.dictType,a.modelValue,a.defaultText);t.value=c}catch(c){console.error("[UDictShow] 翻译失败:",c),t.value=String(a.modelValue)}finally{l.value=!1}};return e.watch(()=>a.modelValue,m,{immediate:!0}),e.watch(()=>a.dictType,()=>{a.dictType&&$(a.dictType).then(()=>m())}),e.onMounted(()=>{a.dictType?$(a.dictType).then(()=>m()):m()}),(c,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-dict-show",{"u-dict-loading":l.value}])},e.toDisplayString(t.value),3))}}),[["__scopeId","data-v-908045c4"]]),ve=C(e.defineComponent({__name:"UToggleShow",props:{modelValue:{},trueText:{default:"开启"},falseText:{default:"关闭"},useYesNo:{type:Boolean,default:!1}},setup(n){const a=n,t=e.computed(()=>a.useYesNo?"是":a.trueText),l=e.computed(()=>a.useYesNo?"否":a.falseText),m=e.computed(()=>a.modelValue===!0||a.modelValue==="true"?t.value:a.modelValue===!1||a.modelValue==="false"?l.value:String(a.modelValue??"")),c=e.computed(()=>a.modelValue===!0||a.modelValue==="true"?"toggle-true":a.modelValue===!1||a.modelValue==="false"?"toggle-false":"toggle-default");return(d,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-toggle-show",c.value])},e.toDisplayString(m.value),3))}}),[["__scopeId","data-v-bac05efc"]]),et=C(e.defineComponent({__name:"UCascaderShow",props:{modelValue:{},cascaderKey:{},separator:{default:" / "},showRawValue:{type:Boolean,default:!0}},setup(n){const a=n,t=e.ref(""),l=e.ref(!1),m=async()=>{if(!a.modelValue||!Array.isArray(a.modelValue)){t.value="";return}const c=a.modelValue;if(a.cascaderKey){l.value=!0;try{const d=await $(a.cascaderKey),o=c.map(i=>{const s=d.find(p=>p.value===i||String(p.value)===String(i));return s?s.label:a.showRawValue?String(i):""}).filter(i=>i!=="");t.value=o.join(a.separator)}catch(d){console.error("[UCascaderShow] 翻译失败:",d),t.value=a.showRawValue?c.join(a.separator):""}finally{l.value=!1}}else t.value=c.join(a.separator)};return e.watch(()=>a.modelValue,m,{immediate:!0}),e.onMounted(()=>{m()}),(c,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-cascader-show",{"u-cascader-loading":l.value}])},e.toDisplayString(t.value),3))}}),[["__scopeId","data-v-5d84df67"]]),tt=C(e.defineComponent({__name:"UDateShow",props:{modelValue:{},mode:{default:"single"},locale:{default:"zh-CN"},format:{},separator:{default:", "},rangeSeparator:{default:" ~ "}},setup(n){const a=n,t=e.computed(()=>a.locale==="en-US"?a.mode==="range"?" - ":", ":a.mode==="range"?a.rangeSeparator:a.separator),l=e.computed(()=>{const d=a.modelValue;return a.mode==="single"?d?m(d,a.format):"":a.mode==="multiple"?d?Array.isArray(d)?d.map(r=>m(r,a.format)).join(t.value):String(d):"":a.mode==="range"?d?typeof d=="object"&&d.from&&d.to?`${m(d.from,a.format)}${t.value}${m(d.to,a.format)}`:Array.isArray(d)&&d.length>=2?`${m(d[0],a.format)}${t.value}${m(d[1],a.format)}`:String(d):"":String(d??"")});function m(d,r){return d||""}const c=e.computed(()=>!l.value);return(d,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["u-date-show",{"u-date-empty":c.value}])},e.toDisplayString(l.value||(n.locale==="en-US"?"Empty":"暂无")),3))}}),[["__scopeId","data-v-930657df"]]),W=C(e.defineComponent({__name:"UFieldView",props:{type:{default:"text"},modelValue:{},dictType:{},mode:{},locale:{default:"zh-CN"},format:{},text:{},trueText:{default:"开启"},falseText:{default:"关闭"},useYesNo:{type:Boolean,default:!1},cascaderKey:{},multiline:{type:Boolean},defaultText:{default:""}},setup(n){const a=n,t=e.computed(()=>{if(!a.text)return null;const d=a.text.split("/");return d.length>=2?{trueText:d[0].trim(),falseText:d[1].trim()}:null}),l=e.computed(()=>{var d;return a.trueText||((d=t.value)==null?void 0:d.trueText)||"开启"}),m=e.computed(()=>{var d;return a.falseText||((d=t.value)==null?void 0:d.falseText)||"关闭"}),c=e.computed(()=>{switch(a.type){case"dict":return"UDictShow";case"switch":return"UToggleShow";case"cascader":return"UCascaderShow";case"date":return"UDateShow";case"input":case"text":default:return"UInputShow"}});return(d,r)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(c.value==="UDictShow"?Ze:c.value==="UToggleShow"?ve:c.value==="UCascaderShow"?et:c.value==="UDateShow"?tt:Xe),{"model-value":n.modelValue,"dict-type":n.type==="dict"?n.dictType:void 0,"cascader-key":n.type==="cascader"?n.cascaderKey:void 0,mode:n.type==="date"?n.mode:void 0,locale:n.type==="date"?n.locale:void 0,format:n.type==="date"?n.format:void 0,"true-text":n.type==="switch"?l.value:void 0,"false-text":n.type==="switch"?m.value:void 0,"use-yes-no":n.type==="switch"?n.useYesNo:void 0,multiline:n.type==="input"||n.type==="text"?n.multiline:void 0,"default-text":n.type==="dict"?n.defaultText:void 0},null,8,["model-value","dict-type","cascader-key","mode","locale","format","true-text","false-text","use-yes-no","multiline","default-text"]))}}),[["__scopeId","data-v-fedb54d7"]]),at={class:"table-grid"},ot=C(e.defineComponent({inheritAttrs:!1,__name:"TableGrid",props:{rows:{},columns:{},loading:{type:Boolean},actions:{},keyField:{},selection:{type:[String,Boolean]},dictData:{},activeKey:{}},emits:["rowAction","rowClick","selectionChange"],setup(n,{emit:a}){const t=n,l=e.useSlots(),m=a,c=e.computed(()=>({actionList:t.actions||[],actionColumnWidth:r.getActionColumnWidth(),hasUserEmpty:!!l.empty,forwardSlots:Object.keys(l).filter(o=>o!=="default")})),d=e.computed(()=>{const o=t.columns.map(i=>{const s={prop:i.field,label:i.label};return typeof i.width=="number"&&(s.width=i.width),s});return c.value.actionList.length>0&&o.push({prop:"actions",label:"操作",width:c.value.actionColumnWidth,fixed:"right"}),o}),r={actionText(o){return o.text?o.text:{add:"新增",edit:"编辑",delete:"删除",preview:"预览",back:"返回"}[o.action]||""},actionType(o){return o.style?o.style==="default"?"":o.style:{add:"primary",edit:"primary",delete:"danger",preview:"primary",back:"primary"}[o.action]||"primary"},getActionColumnWidth(){const i=(t.actions||[]).reduce((s,p)=>s+Math.max(52,r.actionText(p).length*16+12),0);return Math.max(80,Math.ceil(i)+16)},maskPhone(o){return!o||o.length<7?o:o.replace(/(\d{3})\d{4}(\d{4})/,"$1****$2")},maskIdCard(o){return!o||o.length<8?o:o.replace(/(\d{3})\d{11}(\d{4})/,"$1***********$2")},formatMoney(o){const i=Number(o);return isNaN(i)?String(o):i.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2})},formatByType(o,i){if(!o)return"";switch(i){case"phone":return r.maskPhone(o);case"idcard":return r.maskIdCard(o);case"money":return r.formatMoney(o);case"percent":return String(o*100)+"%";default:return i&&i.includes("{}")?i.replace("{}",String(o)):String(o)}},getNestedValue(o,i){if(!i.includes("."))return o[i];const s=i.split(".");let p=o;for(const h of s)if(p&&typeof p=="object"&&h in p)p=p[h];else return;return p},useFieldView(o){return o.type?["dict","switch","cascader","date","input","text"].includes(o.type):!1},rowClassName({row:o}){if(!o||t.activeKey===void 0||t.activeKey===null)return"";const i=t.keyField||"id";return o[i]===t.activeKey?"table-grid-active-row":""},onSelectionChange(o){m("selectionChange",o)},onRowClick(o){m("rowClick",o)},onRowAction(o,i){m("rowAction",{action:o.action,item:o,row:i})}};return(o,i)=>{const s=k.ElTableColumn,p=k.ElButton,h=k.ElTable;return e.openBlock(),e.createElementBlock("div",at,[e.createVNode(h,e.mergeProps({stripe:!0,border:!0,...o.$attrs},{data:t.rows.length?t.rows:[{}],loading:t.loading,"row-key":t.keyField||"id","row-class-name":r.rowClassName,onSelectionChange:r.onSelectionChange,onRowClick:i[0]||(i[0]=u=>r.onRowClick(u))}),e.createSlots({default:e.withCtx(()=>[t.selection?(e.openBlock(),e.createBlock(s,{key:0,type:"selection",width:"55"})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,u=>(e.openBlock(),e.createBlock(s,{key:u.prop,prop:u.prop,label:u.label,width:u.width,fixed:u.fixed},{default:e.withCtx(({row:g})=>[u.prop==="actions"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[Object.keys(g).length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(c.value.actionList,(f,b)=>(e.openBlock(),e.createBlock(p,{key:b,link:"",type:r.actionType(f),disabled:f.disabled===!0,size:"small",onClick:e.withModifiers(B=>r.onRowAction(f,g),["stop"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.actionText(f)),1)]),_:2},1032,["type","disabled","onClick"]))),128)):e.createCommentVNode("",!0)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[Object.keys(g).length>0?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.columns,f=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:f.field},[f.field===u.prop&&r.useFieldView(f)?(e.openBlock(),e.createBlock(W,{key:0,type:f.type,"model-value":r.getNestedValue(g,f.field),"dict-type":f.dictType,mode:f.mode,locale:f.locale,format:f.format,text:f.text,"true-text":f.trueText,"false-text":f.falseText,"use-yes-no":f.useYesNo,"cascader-key":f.cascaderKey,multiline:f.multiline,"default-text":f.defaultText},null,8,["type","model-value","dict-type","mode","locale","format","text","true-text","false-text","use-yes-no","cascader-key","multiline","default-text"])):f.field===u.prop?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass({"table-grid-format":f.format})},e.toDisplayString(r.formatByType(r.getNestedValue(g,f.field),f.format||"")),3)):e.createCommentVNode("",!0)],64))),128)):e.createCommentVNode("",!0)],64))]),_:2},1032,["prop","label","width","fixed"]))),128)),e.renderSlot(o.$slots,"default",{},void 0,!0)]),_:2},[e.renderList(c.value.forwardSlots,u=>({name:u,fn:e.withCtx(g=>[e.renderSlot(o.$slots,u,e.normalizeProps(e.guardReactiveProps(g||{})),void 0,!0)])})),c.value.hasUserEmpty?void 0:{name:"empty",fn:e.withCtx(()=>[i[1]||(i[1]=e.createElementVNode("div",{class:"no-data"},"暂无数据",-1))]),key:"0"}]),1040,["data","loading","row-key","row-class-name","onSelectionChange"])])}}}),[["__scopeId","data-v-ca606e7b"]]),nt={class:"table-pagination"},lt={class:"page-size-select"},it={class:"total-text"},st={key:1,class:"load-more"},rt={key:2,class:"total-text"},ct=C(e.defineComponent({__name:"TablePagination",props:{page:{},pageSize:{},total:{},type:{}},emits:["update:page","update:pageSize"],setup(n,{emit:a}){const t=n,l=a,m=e.computed(()=>({totalPages:Math.ceil(t.total/t.pageSize),showPagination:t.type==="page"&&t.total>0})),c={onPageChange:d=>{l("update:page",d)},onPageSizeChange:d=>{l("update:pageSize",d)}};return(d,r)=>{const o=k.ElPagination,i=k.ElOption,s=k.ElSelect,p=k.ElButton;return e.openBlock(),e.createElementBlock("div",nt,[m.value.showPagination?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(o,{"current-page":t.page,"page-count":m.value.totalPages,"page-sizes":[10,20,50,100],"page-size":t.pageSize,layout:"total, prev, pager, next, jumper",onCurrentChange:c.onPageChange,onSizeChange:c.onPageSizeChange},null,8,["current-page","page-count","page-size","onCurrentChange","onSizeChange"]),e.createElementVNode("div",lt,[e.createVNode(s,{"model-value":t.pageSize,style:{width:"100px"},onChange:c.onPageSizeChange},{default:e.withCtx(()=>[e.createVNode(i,{value:10,label:"10条/页"}),e.createVNode(i,{value:20,label:"20条/页"}),e.createVNode(i,{value:50,label:"50条/页"}),e.createVNode(i,{value:100,label:"100条/页"})]),_:1},8,["model-value","onChange"]),e.createElementVNode("span",it,"共 "+e.toDisplayString(t.total)+" 条",1)])],64)):t.type==="auto"?(e.openBlock(),e.createElementBlock("div",st,[e.createVNode(p,{disabled:t.page*t.pageSize>=t.total},{default:e.withCtx(()=>[...r[0]||(r[0]=[e.createTextVNode("加载更多",-1)])]),_:1},8,["disabled"])])):t.type==="all"?(e.openBlock(),e.createElementBlock("div",rt,"共 "+e.toDisplayString(t.total)+" 条",1)):e.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-53e593aa"]]),dt={class:"table-detail"},mt={key:0,class:"detail-header"},ut={class:"detail-title"},pt={class:"detail-body"},ft={key:0,class:"detail-status"},ht={key:1,class:"detail-content"},gt={class:"detail-label"},yt={class:"detail-value"},bt={key:2,class:"detail-status"},J=C(e.defineComponent({__name:"TableDetail",props:{showHeader:{type:Boolean},title:{},loading:{type:Boolean},rowData:{},columns:{},emptyText:{}},setup(n){const a=n,t=e.computed(()=>({showHeader:a.showHeader!==!1,title:a.title||"详情",emptyText:a.emptyText||"暂无数据",hasRow:!!a.rowData})),l={getNestedValue(m,c){if(!m||!c)return"";if(!c.includes("."))return m[c];const d=c.split(".");let r=m;for(const o of d)if(r&&typeof r=="object"&&o in r)r=r[o];else return"";return r}};return(m,c)=>(e.openBlock(),e.createElementBlock("div",dt,[t.value.showHeader?(e.openBlock(),e.createElementBlock("div",mt,[e.createElementVNode("div",ut,e.toDisplayString(t.value.title),1)])):e.createCommentVNode("",!0),e.createElementVNode("div",pt,[a.loading?(e.openBlock(),e.createElementBlock("div",ft,"加载中...")):t.value.hasRow?(e.openBlock(),e.createElementBlock("div",ht,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.columns,d=>(e.openBlock(),e.createElementBlock("div",{key:d.field,class:"detail-item"},[e.createElementVNode("div",gt,e.toDisplayString(d.label),1),e.createElementVNode("div",yt,[e.createVNode(W,{type:d.type,"model-value":l.getNestedValue(a.rowData,d.field),"dict-type":d.dictType,mode:d.mode,locale:d.locale,format:d.format,text:d.text,"true-text":d.trueText,"false-text":d.falseText,"use-yes-no":d.useYesNo,"cascader-key":d.cascaderKey,multiline:d.multiline,"default-text":d.defaultText},null,8,["type","model-value","dict-type","mode","locale","format","text","true-text","false-text","use-yes-no","cascader-key","multiline","default-text"])])]))),128))])):(e.openBlock(),e.createElementBlock("div",bt,e.toDisplayString(t.value.emptyText),1)),e.renderSlot(m.$slots,"detail-extra",{rowData:a.rowData,columns:a.columns},void 0,!0)])]))}}),[["__scopeId","data-v-191846c8"]]),wt={class:"table-body"},kt={class:"table-container"},ae=C(e.defineComponent({inheritAttrs:!1,__name:"TableRender",props:{formId:{}},emits:["back","toolbar-action","row-action"],setup(n,{expose:a,emit:t}){const l=["search-extra","search-actions","toolbar-left","toolbar-extra","detail-extra"],m=n,c=e.useAttrs(),d=e.useSlots(),r=t,o=new We,i=e.ref(null),s=e.reactive({searchParams:{},loaded:!1,dictData:{}});e.onMounted(async()=>{m.formId&&await h.loadConfig(m.formId)});const p=e.computed(()=>({tableConfig:o.data.tableConfig,rows:o.data.rows,total:o.data.total,loading:o.data.loading,pagination:o.data.pagination,searchFields:o.getSearchFields(),hasSearch:o.hasSearch(),columns:o.getColumns(),toolbar:o.getToolbar(),hasToolbar:o.hasToolbar(),actions:o.getActions(),currentRow:o.data.currentRow,currentKey:o.getCurrentKey(),showDetail:o.hasDetail(),detailMode:o.getDetailMode(),detailSide:o.getDetailPosition()==="left"?"left":"right",detailWidth:o.getDetailWidth(),detailDirection:o.getDetailDirection(),detailVisible:o.data.detailVisible,detailData:o.data.detailData,detailLoading:o.data.detailLoading,previewVisible:o.data.previewVisible,previewRow:o.data.previewRow,dictData:s.dictData})),h={getTableAttrs(){const{class:u,style:g,...f}=c;return f},getTableSlots(){const u={};for(const g of Object.keys(d))l.includes(g)||(u[g]=!0);return u},async loadConfig(u){try{await o.loadConfig(u)}catch(g){_((g==null?void 0:g.message)||"获取表格配置失败");return}s.searchParams={...o.data.searchParams},s.loaded=!0,await h.loadDictData(),await h.handleLoadData()},async handleLoadData(){try{await o.loadData()}catch(u){_((u==null?void 0:u.message)||"加载数据失败")}},async loadDictData(){const u=o.getColumns(),g=new Set;for(const f of u)f.type==="dict"&&f.dictType&&g.add(f.dictType);for(const f of g)try{const b=await V.get(D.dictApi(f));b.status===200&&(s.dictData[f]=q(b.data))}catch(b){console.error(`[TableRender] 加载字典 ${f} 失败:`,b)}},async handleSearch(){o.data.searchParams={...s.searchParams};try{await o.search()}catch(u){_((u==null?void 0:u.message)||"查询失败")}},async handleReset(){s.searchParams={};try{await o.reset()}catch(u){_((u==null?void 0:u.message)||"重置失败")}},updateSearchParam(u,g){s.searchParams[u]=g},async handlePageChange(u){try{await o.changePage(u)}catch(g){_((g==null?void 0:g.message)||"加载数据失败")}},async handlePageSizeChange(u){try{await o.changePageSize(u)}catch(g){_((g==null?void 0:g.message)||"加载数据失败")}},handleRowClick(u){o.setCurrentRow(u)},handleDetailClose(){o.closeDetail()},handlePreviewClose(){o.closePreview()},handlePreview(u){if(!u){E.warning("请先点击表格中的一行数据");return}o.openPreview(u)},handleToolbarAction(u){r("toolbar-action",u),h.dispatchAction(u)},handleRowAction(u){r("row-action",u),h.dispatchAction(u)},async dispatchAction(u){switch(u.action){case"add":await h.handleAdd(u.item);break;case"edit":await h.handleEdit(u.row,u.item);break;case"delete":await h.handleDelete(u.row,u.item);break;case"preview":h.handlePreview(u.row);break;case"back":r("back",u);break;case"export":await h.handleExport();break;default:await h.handleCustomAction(u)}},async handleAdd(u){const g=u?o.getButtonFormId(u):o.getFormId();if(!g){E.warning("未配置表单,无法新增");return}if(!i.value)return;await i.value.showForm(g)!=null&&await h.handleLoadData()},async handleEdit(u,g){if(!u){E.warning("请先点击表格中的一行数据");return}const f=g?o.getButtonFormId(g):o.getFormId();if(!f){E.warning("未配置表单,无法编辑");return}if(!i.value)return;const b=o.getKeyField();await i.value.showForm(f,`${b}=${u[b]}`)!=null&&await h.handleLoadData()},async handleDelete(u,g){if(!u){E.warning("请先点击表格中的一行数据");return}try{await x.ElMessageBox.confirm((g==null?void 0:g.confirm)||"确定要删除这条数据吗?","确认删除",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"})}catch{return}try{await o.deleteRow(u),E.success("删除成功")}catch(f){_((f==null?void 0:f.message)||"删除失败")}},async handleExport(){try{await o.exportData(),E.success("导出成功")}catch(u){_((u==null?void 0:u.message)||"导出失败")}},async handleCustomAction(u){const{item:g,row:f}=u;if(!(g!=null&&g.url)){E.warning(`未识别的按钮动作:${u.action}`);return}try{await x.ElMessageBox.confirm(g.confirm||"确定执行该操作吗?","确认",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"})}catch{return}try{const b=await V.post(g.url,f||{});if(b.status!==200)throw new Error(b.message||"操作失败");E.success(b.message||"操作成功"),await h.handleLoadData()}catch(b){_((b==null?void 0:b.message)||"操作失败")}}};return a({loadConfig:h.loadConfig}),(u,g)=>{var b,B,A,oe,ne,le;const f=k.ElDrawer;return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["table-render",u.$attrs.class]),style:e.normalizeStyle(u.$attrs.style)},[p.value.hasSearch?(e.openBlock(),e.createBlock(Qe,{key:0,fields:p.value.searchFields,modelValue:s.searchParams,"onUpdate:modelValue":g[0]||(g[0]=S=>s.searchParams=S),onSearch:h.handleSearch,onReset:h.handleReset},{"search-extra":e.withCtx(S=>[e.renderSlot(u.$slots,"search-extra",e.normalizeProps(e.guardReactiveProps(S||{})),void 0,!0)]),"search-actions":e.withCtx(S=>[e.renderSlot(u.$slots,"search-actions",e.normalizeProps(e.guardReactiveProps(S||{})),void 0,!0)]),_:3},8,["fields","modelValue","onSearch","onReset"])):e.createCommentVNode("",!0),e.createElementVNode("div",wt,[e.createElementVNode("div",kt,[e.createVNode(ot,e.mergeProps(h.getTableAttrs(),{rows:p.value.rows,columns:p.value.columns,loading:p.value.loading,actions:p.value.actions,"key-field":(b=p.value.tableConfig)==null?void 0:b.key,"dict-data":p.value.dictData,"active-key":p.value.currentKey,onRowAction:h.handleRowAction,onRowClick:h.handleRowClick}),e.createSlots({_:2},[e.renderList(h.getTableSlots(),(S,ie)=>({name:ie,fn:e.withCtx(Tt=>[e.renderSlot(u.$slots,ie,e.normalizeProps(e.guardReactiveProps(Tt||{})),void 0,!0)])}))]),1040,["rows","columns","loading","actions","key-field","dict-data","active-key","onRowAction","onRowClick"]),e.createVNode(ct,{class:"table-pagination",page:p.value.pagination.page,"page-size":p.value.pagination.pageSize,total:p.value.total,type:(B=p.value.tableConfig)==null?void 0:B.pagination,"onUpdate:page":h.handlePageChange,"onUpdate:pageSize":h.handlePageSizeChange},null,8,["page","page-size","total","type","onUpdate:page","onUpdate:pageSize"])]),p.value.showDetail&&p.value.detailMode==="inline"?(e.openBlock(),e.createBlock(J,{key:0,class:e.normalizeClass(["table-detail-inline",`table-detail-inline-${p.value.detailSide}`]),style:e.normalizeStyle({width:p.value.detailWidth}),title:(oe=(A=p.value.tableConfig)==null?void 0:A.meta)==null?void 0:oe.title,loading:p.value.detailLoading,"row-data":p.value.detailData,columns:p.value.columns,"empty-text":p.value.detailSide==="left"?"请点击右侧表格行查看详情":"请点击左侧表格行查看详情"},{"detail-extra":e.withCtx(S=>[e.renderSlot(u.$slots,"detail-extra",e.normalizeProps(e.guardReactiveProps(S||{})),void 0,!0)]),_:3},8,["class","style","title","loading","row-data","columns","empty-text"])):e.createCommentVNode("",!0)]),p.value.showDetail&&p.value.detailMode==="drawer"?(e.openBlock(),e.createBlock(f,{key:1,"model-value":p.value.detailVisible,direction:p.value.detailDirection,size:p.value.detailWidth,title:((le=(ne=p.value.tableConfig)==null?void 0:ne.meta)==null?void 0:le.title)||"详情",onClose:h.handleDetailClose},{default:e.withCtx(()=>[e.createVNode(J,{"show-header":!1,loading:p.value.detailLoading,"row-data":p.value.detailData,columns:p.value.columns},{"detail-extra":e.withCtx(S=>[e.renderSlot(u.$slots,"detail-extra",e.normalizeProps(e.guardReactiveProps(S||{})),void 0,!0)]),_:3},8,["loading","row-data","columns"])]),_:3},8,["model-value","direction","size","title","onClose"])):e.createCommentVNode("",!0),p.value.previewVisible?(e.openBlock(),e.createBlock(f,{key:2,"model-value":!0,direction:p.value.detailDirection,size:p.value.detailWidth,title:"详情",onClose:h.handlePreviewClose},{default:e.withCtx(()=>[e.createVNode(J,{"show-header":!1,"row-data":p.value.previewRow,columns:p.value.columns},{"detail-extra":e.withCtx(S=>[e.renderSlot(u.$slots,"detail-extra",e.normalizeProps(e.guardReactiveProps(S||{})),void 0,!0)]),_:3},8,["row-data","columns"])]),_:3},8,["direction","size","onClose"])):e.createCommentVNode("",!0),p.value.hasToolbar?(e.openBlock(),e.createBlock(Je,{key:3,class:"table-toolbar-bottom",items:p.value.toolbar,"current-row":p.value.currentRow,onAction:h.handleToolbarAction},{"toolbar-left":e.withCtx(S=>[e.renderSlot(u.$slots,"toolbar-left",e.normalizeProps(e.guardReactiveProps(S||{})),void 0,!0)]),"toolbar-extra":e.withCtx(S=>[e.renderSlot(u.$slots,"toolbar-extra",e.normalizeProps(e.guardReactiveProps(S||{})),void 0,!0)]),_:3},8,["items","current-row","onAction"])):e.createCommentVNode("",!0),e.createVNode(H,{ref_key:"formRef",ref:i},null,512)],6)}}}),[["__scopeId","data-v-195aa0e8"]]);class Ct{constructor(a){w(this,"axiosInstance");w(this,"baseUrl","");this.axiosInstance=Z.create({timeout:1e4,baseURL:""}),this.axiosInstance.defaults.headers["Content-Type"]="application/json;charset=utf-8",this.axiosInstance.interceptors.request.use(t=>(t.headers.token=localStorage.getItem("token"),a.baseUrl?t.baseURL=a.baseUrl:t.baseURL=this.baseUrl||window.location.origin,t),t=>Promise.reject(t)),this.axiosInstance.interceptors.response.use(t=>t.config.responseType==="blob"?t:t.data,t=>Promise.reject(t))}Post(a,t){return this.axiosInstance.post(a,t)}Get(a,t){return this.axiosInstance.get(a,{params:t})}Delete(a,t){return this.axiosInstance.delete(a,{params:t})}Put(a,t){return this.axiosInstance.put(a,t)}Download(a,t){return this.axiosInstance.get(a,{params:t,responseType:"blob"})}}class Bt{constructor(){w(this,"emitter");this.emitter=se()}On(a,t){this.emitter.on(a,t)}Emit(a,t){this.emitter.emit(a,t)}Off(a,t){this.emitter.off(a,t)}}class xt{constructor(a,t){w(this,"mqttClient",null);w(this,"eventBus");this.eventBus=a,this.connect(t).then()}async connect(a){const t={username:a.userName,password:a.password,clientId:`${a.module}_${this.randomStr(10)}`,clean:!0,keepalive:50,connectTimeout:5e3,reconnectPeriod:5e3};let l=a.mqttUrl||"ws://127.0.0.1:5002/ws";if(console.log("connect to mqtt..."),this.mqttClient=re.connect(l,t),!this.mqttClient){console.log("connect mqtt failed");return}this.mqttClient.on("connect",()=>{console.log("=====> mqtt connect success!"),this.mqttClient.subscribe(X,{qos:0},m=>{console.log(m?`mqtt subscribe [${X}] failed`:`mqtt subscribe [${X}] success`)})}),this.mqttClient.on("message",(m,c)=>{const d=c.toString();if(!d){console.error("Received empty message",m);return}let r=null;try{r=JSON.parse(d)}catch(o){console.error("Failed to parse message JSON",m,d,o);return}if(!r||r.Content===void 0||r.Content===null||!r.PType){console.log("parse notice failed!",d);return}r.PType==Vt&&this.eventBus.Emit(r.Route,r.Content)}),this.mqttClient.on(O.OffLine,()=>{console.log("mqtt offline...")}),this.mqttClient.on(O.Reconnect,()=>{console.log("mqtt reconnecting...")}),this.mqttClient.on(O.Close,()=>{console.log("mqtt close")}),this.mqttClient.on(O.Error,m=>{console.log("mqtt error")})}randomStr(a){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let l="";for(let m=0;m<a;m++)l+=t.charAt(Math.floor(Math.random()*t.length));return l}}const X="Notice",Vt="NOTICE",O={OffLine:"offline",Close:"close",Reconnect:"reconnect",Error:"error"};let j;const _t=n=>{if(!n)throw new Error("QfOptions is undefined");if(!j&&n&&(j=new St(n)),!j)throw new Error("Qf not initialized, please call GetQf(options) first");return j};class St{constructor(a){w(this,"EventBus");w(this,"WebApi");w(this,"Mqtt");w(this,"options");this.initQf(a)}initQf(a){if(!a)throw new Error(`StartQf failed! options is ${a}`);this.options=a,console.log("StartQf(), qfOptions=",a),this.EventBus=new Bt,this.WebApi=new Ct(a),this.options.useMqtt&&(this.Mqtt=new xt(this.EventBus,a))}On(a,t){this.EventBus.On(a,t)}Emit(a,t){this.EventBus.Emit(a,t)}Off(a,t){this.EventBus.Off(a,t)}Post(a,t){return this.WebApi.Post(a,t)}Get(a,t){return this.WebApi.Get(a,t)}Delete(a,t){return this.WebApi.Delete(a,t)}Put(a,t){return this.WebApi.Put(a,t)}Download(a,t){return this.WebApi.Download(a,t)}RegNotice(a,t){this.EventBus.On(a,t)}}const Et={UInput:P,UInputNumber:Y,UDict:N,UToggle:K,UCascader:G,UDate:U,UMenu:te,FormRender:H,TableRender:ae,UFieldView:W},Dt={install(n){n.use(x);for(const[a,t]of Object.entries(Et))n.component(a,t)}};y.FormRender=H,y.GetQf=_t,y.TableRender=ae,y.UCascader=G,y.UDate=U,y.UDict=N,y.UFieldView=W,y.UInput=P,y.UInputNumber=Y,y.UMenu=te,y.UToggle=K,y.apis=D,y.clearDictCache=fe,y.default=Dt,y.flattenDictTree=me,y.getDict=$,y.mapDictTree=L,y.normalizeDictNode=F,y.notify=E,y.notifyUtil=R,y.preloadDicts=pe,y.setDictCache=he,y.toDictOptions=q,y.translateDict=ee,y.translateDictSync=ue,Object.defineProperties(y,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- @charset "UTF-8";.u-input[data-v-ecf5177c]{display:flex;width:100%}.u-input.u-input-label-left .u-input-label[data-v-ecf5177c]{padding-top:10px;flex-shrink:0;text-align:right;padding-right:12px;font-size:14px;color:#606266;white-space:nowrap}.u-input.u-input-label-left .u-input-field[data-v-ecf5177c]{flex:1}.u-input.u-input-label-top[data-v-ecf5177c]{flex-direction:column}.u-input.u-input-label-top .u-input-label[data-v-ecf5177c]{width:100%;font-size:14px;color:#606266;margin-bottom:8px;white-space:nowrap}.u-input .required-star[data-v-ecf5177c]{color:#f56c6c;display:inline-block;width:10px}.u-input .required-star[data-v-ecf5177c]:not(.required-star--visible){color:transparent}.u-input .u-input-field--top[data-v-ecf5177c]{width:100%}.u-input-number[data-v-cb70bd5b]{display:flex;width:100%}.u-input-number.u-input-number-label-left .u-input-number-label[data-v-cb70bd5b]{padding-top:10px;flex-shrink:0;text-align:right;padding-right:12px;font-size:14px;color:#606266;white-space:nowrap}.u-input-number.u-input-number-label-left .u-input-number-field[data-v-cb70bd5b]{flex:1}.u-input-number.u-input-number-label-top[data-v-cb70bd5b]{flex-direction:column}.u-input-number.u-input-number-label-top .u-input-number-label[data-v-cb70bd5b]{width:100%;font-size:14px;color:#606266;margin-bottom:8px;white-space:nowrap}.u-input-number .required-star[data-v-cb70bd5b]{color:#f56c6c;display:inline-block;width:10px}.u-input-number .required-star[data-v-cb70bd5b]:not(.required-star--visible){color:transparent}.u-dict[data-v-8bfd4dcf]{display:flex;width:100%}.u-dict.u-dict-label-left .u-dict-label[data-v-8bfd4dcf]{padding-top:10px;flex-shrink:0;text-align:right;padding-right:12px;font-size:14px;color:#606266;white-space:nowrap}.u-dict.u-dict-label-left .u-dict-field[data-v-8bfd4dcf]{flex:1}.u-dict.u-dict-label-top[data-v-8bfd4dcf]{flex-direction:column}.u-dict.u-dict-label-top .u-dict-label[data-v-8bfd4dcf]{width:100%;font-size:14px;color:#606266;margin-bottom:8px;white-space:nowrap}.u-dict .required-star[data-v-8bfd4dcf]{color:#f56c6c;display:inline-block;width:10px}.u-dict .required-star[data-v-8bfd4dcf]:not(.required-star--visible){color:transparent}.u-toggle[data-v-94c1fd38]{display:flex;width:100%}.u-toggle.u-toggle-label-left[data-v-94c1fd38]{flex-direction:row;align-items:flex-start}.u-toggle.u-toggle-label-left .u-toggle-label[data-v-94c1fd38]{padding-top:10px;flex-shrink:0;text-align:right;padding-right:12px;margin-bottom:0;white-space:nowrap}.u-toggle.u-toggle-label-left .u-toggle-field[data-v-94c1fd38]{flex:1}.u-toggle[data-v-94c1fd38]:not(.u-toggle-label-left){flex-direction:column}.u-toggle:not(.u-toggle-label-left) .u-toggle-label[data-v-94c1fd38]{width:100%;margin-bottom:4px;white-space:nowrap}.u-toggle .u-toggle-label[data-v-94c1fd38]{font-size:14px;color:#606266}.u-toggle .u-toggle-label .required-star[data-v-94c1fd38]{color:#f56c6c;display:inline-block;width:10px}.u-toggle .u-toggle-label .required-star[data-v-94c1fd38]:not(.required-star--visible){color:transparent}.u-toggle .u-toggle-field[data-v-94c1fd38]{display:flex;align-items:center}.u-cascader[data-v-d66c339c]{display:flex;width:100%}.u-cascader.u-cascader-label-left[data-v-d66c339c]{flex-direction:row;align-items:flex-start}.u-cascader.u-cascader-label-left .u-cascader-label[data-v-d66c339c]{padding-top:10px;flex-shrink:0;text-align:right;padding-right:12px;margin-bottom:0;white-space:nowrap}.u-cascader.u-cascader-label-left .u-cascader-levels[data-v-d66c339c]{flex:1}.u-cascader[data-v-d66c339c]:not(.u-cascader-label-left){flex-direction:column}.u-cascader:not(.u-cascader-label-left) .u-cascader-label[data-v-d66c339c]{width:100%;margin-bottom:8px;white-space:nowrap}.u-cascader .u-cascader-label[data-v-d66c339c]{font-size:14px;color:#606266}.u-cascader .u-cascader-label .required-star[data-v-d66c339c]{color:#f56c6c;display:inline-block;width:10px}.u-cascader .u-cascader-label .required-star[data-v-d66c339c]:not(.required-star--visible){color:transparent}.u-cascader .u-cascader-levels[data-v-d66c339c]{display:flex;gap:8px;flex-wrap:wrap}.u-cascader .u-cascader-level[data-v-d66c339c]{flex:1;min-width:120px}.u-date[data-v-9cd05064]{display:flex;width:100%}.u-date.u-date-label-left[data-v-9cd05064]{flex-direction:row;align-items:flex-start}.u-date.u-date-label-left .u-date-label[data-v-9cd05064]{padding-top:10px;flex-shrink:0;text-align:right;padding-right:12px;margin-bottom:0;white-space:nowrap}.u-date.u-date-label-left .u-date-field[data-v-9cd05064]{flex:1}.u-date[data-v-9cd05064]:not(.u-date-label-left){flex-direction:column}.u-date:not(.u-date-label-left) .u-date-label[data-v-9cd05064]{width:100%;margin-bottom:8px;white-space:nowrap}.u-date .u-date-label[data-v-9cd05064]{font-size:14px;color:#606266}.u-date .u-date-label .required-star[data-v-9cd05064]{color:#f56c6c;display:inline-block;width:10px}.u-date .u-date-label .required-star[data-v-9cd05064]:not(.required-star--visible){color:transparent}.u-menu[data-v-fe63251c]{display:flex;height:100%;min-height:0;background:#fff}.u-menu .u-menu-icon[data-v-fe63251c]{margin-right:6px}.u-menu.u-menu--sidebar[data-v-fe63251c]{flex-direction:column;border-right:1px solid #e4e7ed}.u-menu.u-menu--sidebar .u-menu-brand[data-v-fe63251c]{flex-shrink:0;display:flex;align-items:center;justify-content:center;padding:16px 12px;border-bottom:1px solid #e4e7ed}.u-menu.u-menu--sidebar .u-menu-list[data-v-fe63251c]{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;border-right:none}.u-menu.u-menu--sidebar .u-menu-logout[data-v-fe63251c]{flex-shrink:0;width:100%;border-top:1px solid #e4e7ed}.u-menu.u-menu--sidebar .u-menu-logout-btn[data-v-fe63251c]{display:block;width:100%}.u-menu.u-menu--horizontal[data-v-fe63251c]{flex-direction:row;align-items:center;width:100%;border-bottom:1px solid #e4e7ed}.u-menu.u-menu--horizontal .u-menu-brand[data-v-fe63251c]{flex-shrink:0;display:flex;align-items:center;padding:0 16px;white-space:nowrap}.u-menu.u-menu--horizontal .u-menu-list[data-v-fe63251c]{flex:1;min-width:0;border-bottom:none}.u-menu.u-menu--horizontal .u-menu-logout[data-v-fe63251c]{flex-shrink:0;display:flex;align-items:center;padding:0 12px;margin-left:auto}.u-menu .u-menu-logo[data-v-fe63251c]{height:28px;margin-right:8px}.u-menu .u-menu-brand-text[data-v-fe63251c]{font-size:18px;font-weight:600;color:#303133;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.form-content[data-v-7e522999]{min-height:100px}.form-layout[data-v-7e522999]{width:100%;background:#fff}.form-header[data-v-7e522999]{display:flex;align-items:center;padding:16px;border-bottom:1px solid #eee}.form-header .title[data-v-7e522999]{font-size:18px;font-weight:500}.form-body[data-v-7e522999]{padding:16px;min-height:100px}.form-footer[data-v-7e522999]{display:flex;justify-content:flex-end;gap:8px;padding:16px;border-top:1px solid #eee}.is-loading[data-v-7e522999]{display:flex;justify-content:center;align-items:center;min-height:100px;color:#409eff}.form-grid[data-v-90ed35a4]{display:grid;grid-template-columns:repeat(var(--grid-columns, 1),minmax(0,1fr));gap:8px;width:100%}.form-grid-item[data-v-90ed35a4]{min-width:0}.form-field[data-v-10299c8d]{width:100%}.field-error[data-v-10299c8d]{color:#f56c6c;font-size:12px;min-height:12px;line-height:1.5;transition:opacity .2s}.field-error[data-v-10299c8d]:not(.field-error--visible){opacity:0}.form-render[data-v-c8356aa3]{width:100%}.form-actions[data-v-c8356aa3]{display:flex;gap:8px}.justify-end[data-v-c8356aa3]{justify-content:flex-end}.justify-start[data-v-c8356aa3]{justify-content:flex-start}.table-search[data-v-09e61a77]{display:flex;align-items:center;flex-wrap:wrap;gap:12px;padding:16px;background:#fff;border-bottom:1px solid #eee}.table-search .search-fields[data-v-09e61a77]{display:flex;flex-wrap:wrap;gap:12px}.table-search .search-field[data-v-09e61a77]{display:flex;align-items:center;gap:8px;min-width:200px}.table-search .search-actions[data-v-09e61a77]{display:flex;gap:8px;flex-shrink:0}.table-toolbar[data-v-8f722515]{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:8px;padding:12px 16px;border-top:1px solid darkgrey}.table-toolbar .toolbar-items[data-v-8f722515]{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.u-input-show[data-v-c78b151e]{font-size:14px;line-height:1.5;color:#333;word-break:break-all}.u-input-show.u-input-multiline[data-v-c78b151e]{white-space:pre-wrap}.u-dict-show[data-v-908045c4]{font-size:14px;line-height:1.5;color:#333}.u-dict-show.u-dict-loading[data-v-908045c4]{color:#999}.u-toggle-show[data-v-bac05efc]{display:inline-block;padding:2px 8px;border-radius:4px;font-size:14px;line-height:1.5}.u-toggle-show.toggle-true[data-v-bac05efc]{background-color:#e6f7ed;color:#52c41a}.u-toggle-show.toggle-false[data-v-bac05efc]{background-color:#fff1f0;color:#ff4d4f}.u-toggle-show.toggle-default[data-v-bac05efc]{color:#999}.u-cascader-show[data-v-5d84df67]{font-size:14px;line-height:1.5;color:#333}.u-cascader-show.u-cascader-loading[data-v-5d84df67]{color:#999}.u-date-show[data-v-930657df]{font-size:14px;line-height:1.5;color:#333}.u-date-show.u-date-empty[data-v-930657df]{color:#999}.u-field-view[data-v-fedb54d7]{display:inline-block}.table-grid[data-v-ca606e7b]{background:#fff}.table-grid .no-data[data-v-ca606e7b]{padding:48px;text-align:center;color:#999}.table-grid[data-v-ca606e7b] .table-grid-active-row td.el-table__cell{background-color:var(--el-color-primary-light-9, #ecf5ff)!important}.table-pagination[data-v-53e593aa]{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;background:#fff;border-top:1px solid #eee}.table-pagination .page-size-select[data-v-53e593aa]{display:flex;align-items:center;gap:12px}.table-pagination .total-text[data-v-53e593aa]{color:#666;font-size:14px}.table-pagination .load-more[data-v-53e593aa]{flex:1;text-align:center}.table-detail[data-v-191846c8]{display:flex;flex-direction:column;height:100%;min-height:0;background:#fff}.table-detail .detail-header[data-v-191846c8]{display:flex;flex-shrink:0;align-items:center;justify-content:space-between;padding:14px 16px;border-bottom:1px solid #ebeef5}.table-detail .detail-header .detail-title[data-v-191846c8]{font-size:15px;font-weight:500}.table-detail .detail-body[data-v-191846c8]{flex:1;min-height:0;overflow:auto}.table-detail .detail-status[data-v-191846c8]{display:flex;align-items:center;justify-content:center;height:100%;padding:24px;color:#999;font-size:13px}.table-detail .detail-content[data-v-191846c8]{padding:4px 16px 16px}.table-detail .detail-item[data-v-191846c8]{display:flex;padding:12px 0;border-bottom:1px solid #eee}.table-detail .detail-item[data-v-191846c8]:last-child{border-bottom:none}.table-detail .detail-item .detail-label[data-v-191846c8]{width:100px;flex-shrink:0;color:#666;font-size:14px}.table-detail .detail-item .detail-value[data-v-191846c8]{flex:1;min-width:0;color:#333;font-size:14px;word-break:break-all}.table-render[data-v-124fd940]{display:flex;flex-direction:column;height:100%;min-height:0;background:#fff}.table-render .table-body[data-v-124fd940]{display:flex;flex:1;min-height:0;overflow:hidden}.table-render .table-container[data-v-124fd940]{flex:1;display:flex;flex-direction:column;min-width:0;overflow:hidden}.table-render .table-pagination[data-v-124fd940]{flex-shrink:0}.table-render .table-detail-inline[data-v-124fd940]{flex-shrink:0;height:100%;overflow:hidden;border-left:1px solid #ebeef5}.table-render .table-detail-inline.table-detail-inline-left[data-v-124fd940]{order:-1;border-left:none;border-right:1px solid #ebeef5}.table-render .table-toolbar-bottom[data-v-124fd940]{flex-shrink:0}
1
+ @charset "UTF-8";.u-input[data-v-ecf5177c]{display:flex;width:100%}.u-input.u-input-label-left .u-input-label[data-v-ecf5177c]{padding-top:10px;flex-shrink:0;text-align:right;padding-right:12px;font-size:14px;color:#606266;white-space:nowrap}.u-input.u-input-label-left .u-input-field[data-v-ecf5177c]{flex:1}.u-input.u-input-label-top[data-v-ecf5177c]{flex-direction:column}.u-input.u-input-label-top .u-input-label[data-v-ecf5177c]{width:100%;font-size:14px;color:#606266;margin-bottom:8px;white-space:nowrap}.u-input .required-star[data-v-ecf5177c]{color:#f56c6c;display:inline-block;width:10px}.u-input .required-star[data-v-ecf5177c]:not(.required-star--visible){color:transparent}.u-input .u-input-field--top[data-v-ecf5177c]{width:100%}.u-input-number[data-v-cb70bd5b]{display:flex;width:100%}.u-input-number.u-input-number-label-left .u-input-number-label[data-v-cb70bd5b]{padding-top:10px;flex-shrink:0;text-align:right;padding-right:12px;font-size:14px;color:#606266;white-space:nowrap}.u-input-number.u-input-number-label-left .u-input-number-field[data-v-cb70bd5b]{flex:1}.u-input-number.u-input-number-label-top[data-v-cb70bd5b]{flex-direction:column}.u-input-number.u-input-number-label-top .u-input-number-label[data-v-cb70bd5b]{width:100%;font-size:14px;color:#606266;margin-bottom:8px;white-space:nowrap}.u-input-number .required-star[data-v-cb70bd5b]{color:#f56c6c;display:inline-block;width:10px}.u-input-number .required-star[data-v-cb70bd5b]:not(.required-star--visible){color:transparent}.u-dict[data-v-8bfd4dcf]{display:flex;width:100%}.u-dict.u-dict-label-left .u-dict-label[data-v-8bfd4dcf]{padding-top:10px;flex-shrink:0;text-align:right;padding-right:12px;font-size:14px;color:#606266;white-space:nowrap}.u-dict.u-dict-label-left .u-dict-field[data-v-8bfd4dcf]{flex:1}.u-dict.u-dict-label-top[data-v-8bfd4dcf]{flex-direction:column}.u-dict.u-dict-label-top .u-dict-label[data-v-8bfd4dcf]{width:100%;font-size:14px;color:#606266;margin-bottom:8px;white-space:nowrap}.u-dict .required-star[data-v-8bfd4dcf]{color:#f56c6c;display:inline-block;width:10px}.u-dict .required-star[data-v-8bfd4dcf]:not(.required-star--visible){color:transparent}.u-toggle[data-v-94c1fd38]{display:flex;width:100%}.u-toggle.u-toggle-label-left[data-v-94c1fd38]{flex-direction:row;align-items:flex-start}.u-toggle.u-toggle-label-left .u-toggle-label[data-v-94c1fd38]{padding-top:10px;flex-shrink:0;text-align:right;padding-right:12px;margin-bottom:0;white-space:nowrap}.u-toggle.u-toggle-label-left .u-toggle-field[data-v-94c1fd38]{flex:1}.u-toggle[data-v-94c1fd38]:not(.u-toggle-label-left){flex-direction:column}.u-toggle:not(.u-toggle-label-left) .u-toggle-label[data-v-94c1fd38]{width:100%;margin-bottom:4px;white-space:nowrap}.u-toggle .u-toggle-label[data-v-94c1fd38]{font-size:14px;color:#606266}.u-toggle .u-toggle-label .required-star[data-v-94c1fd38]{color:#f56c6c;display:inline-block;width:10px}.u-toggle .u-toggle-label .required-star[data-v-94c1fd38]:not(.required-star--visible){color:transparent}.u-toggle .u-toggle-field[data-v-94c1fd38]{display:flex;align-items:center}.u-cascader[data-v-d66c339c]{display:flex;width:100%}.u-cascader.u-cascader-label-left[data-v-d66c339c]{flex-direction:row;align-items:flex-start}.u-cascader.u-cascader-label-left .u-cascader-label[data-v-d66c339c]{padding-top:10px;flex-shrink:0;text-align:right;padding-right:12px;margin-bottom:0;white-space:nowrap}.u-cascader.u-cascader-label-left .u-cascader-levels[data-v-d66c339c]{flex:1}.u-cascader[data-v-d66c339c]:not(.u-cascader-label-left){flex-direction:column}.u-cascader:not(.u-cascader-label-left) .u-cascader-label[data-v-d66c339c]{width:100%;margin-bottom:8px;white-space:nowrap}.u-cascader .u-cascader-label[data-v-d66c339c]{font-size:14px;color:#606266}.u-cascader .u-cascader-label .required-star[data-v-d66c339c]{color:#f56c6c;display:inline-block;width:10px}.u-cascader .u-cascader-label .required-star[data-v-d66c339c]:not(.required-star--visible){color:transparent}.u-cascader .u-cascader-levels[data-v-d66c339c]{display:flex;gap:8px;flex-wrap:wrap}.u-cascader .u-cascader-level[data-v-d66c339c]{flex:1;min-width:120px}.u-date[data-v-9cd05064]{display:flex;width:100%}.u-date.u-date-label-left[data-v-9cd05064]{flex-direction:row;align-items:flex-start}.u-date.u-date-label-left .u-date-label[data-v-9cd05064]{padding-top:10px;flex-shrink:0;text-align:right;padding-right:12px;margin-bottom:0;white-space:nowrap}.u-date.u-date-label-left .u-date-field[data-v-9cd05064]{flex:1}.u-date[data-v-9cd05064]:not(.u-date-label-left){flex-direction:column}.u-date:not(.u-date-label-left) .u-date-label[data-v-9cd05064]{width:100%;margin-bottom:8px;white-space:nowrap}.u-date .u-date-label[data-v-9cd05064]{font-size:14px;color:#606266}.u-date .u-date-label .required-star[data-v-9cd05064]{color:#f56c6c;display:inline-block;width:10px}.u-date .u-date-label .required-star[data-v-9cd05064]:not(.required-star--visible){color:transparent}.u-menu[data-v-fe63251c]{display:flex;height:100%;min-height:0;background:#fff}.u-menu .u-menu-icon[data-v-fe63251c]{margin-right:6px}.u-menu.u-menu--sidebar[data-v-fe63251c]{flex-direction:column;border-right:1px solid #e4e7ed}.u-menu.u-menu--sidebar .u-menu-brand[data-v-fe63251c]{flex-shrink:0;display:flex;align-items:center;justify-content:center;padding:16px 12px;border-bottom:1px solid #e4e7ed}.u-menu.u-menu--sidebar .u-menu-list[data-v-fe63251c]{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;border-right:none}.u-menu.u-menu--sidebar .u-menu-logout[data-v-fe63251c]{flex-shrink:0;width:100%;border-top:1px solid #e4e7ed}.u-menu.u-menu--sidebar .u-menu-logout-btn[data-v-fe63251c]{display:block;width:100%}.u-menu.u-menu--horizontal[data-v-fe63251c]{flex-direction:row;align-items:center;width:100%;border-bottom:1px solid #e4e7ed}.u-menu.u-menu--horizontal .u-menu-brand[data-v-fe63251c]{flex-shrink:0;display:flex;align-items:center;padding:0 16px;white-space:nowrap}.u-menu.u-menu--horizontal .u-menu-list[data-v-fe63251c]{flex:1;min-width:0;border-bottom:none}.u-menu.u-menu--horizontal .u-menu-logout[data-v-fe63251c]{flex-shrink:0;display:flex;align-items:center;padding:0 12px;margin-left:auto}.u-menu .u-menu-logo[data-v-fe63251c]{height:28px;margin-right:8px}.u-menu .u-menu-brand-text[data-v-fe63251c]{font-size:18px;font-weight:600;color:#303133;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.form-content[data-v-7e522999]{min-height:100px}.form-layout[data-v-7e522999]{width:100%;background:#fff}.form-header[data-v-7e522999]{display:flex;align-items:center;padding:16px;border-bottom:1px solid #eee}.form-header .title[data-v-7e522999]{font-size:18px;font-weight:500}.form-body[data-v-7e522999]{padding:16px;min-height:100px}.form-footer[data-v-7e522999]{display:flex;justify-content:flex-end;gap:8px;padding:16px;border-top:1px solid #eee}.is-loading[data-v-7e522999]{display:flex;justify-content:center;align-items:center;min-height:100px;color:#409eff}.form-grid[data-v-90ed35a4]{display:grid;grid-template-columns:repeat(var(--grid-columns, 1),minmax(0,1fr));gap:8px;width:100%}.form-grid-item[data-v-90ed35a4]{min-width:0}.form-field[data-v-10299c8d]{width:100%}.field-error[data-v-10299c8d]{color:#f56c6c;font-size:12px;min-height:12px;line-height:1.5;transition:opacity .2s}.field-error[data-v-10299c8d]:not(.field-error--visible){opacity:0}.form-render[data-v-c8356aa3]{width:100%}.form-actions[data-v-c8356aa3]{display:flex;gap:8px}.justify-end[data-v-c8356aa3]{justify-content:flex-end}.justify-start[data-v-c8356aa3]{justify-content:flex-start}.table-search[data-v-09e61a77]{display:flex;align-items:center;flex-wrap:wrap;gap:12px;padding:16px;background:#fff;border-bottom:1px solid #eee}.table-search .search-fields[data-v-09e61a77]{display:flex;flex-wrap:wrap;gap:12px}.table-search .search-field[data-v-09e61a77]{display:flex;align-items:center;gap:8px;min-width:200px}.table-search .search-actions[data-v-09e61a77]{display:flex;gap:8px;flex-shrink:0}.table-toolbar[data-v-8f722515]{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:8px;padding:12px 16px;border-top:1px solid darkgrey}.table-toolbar .toolbar-items[data-v-8f722515]{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.u-input-show[data-v-c78b151e]{font-size:14px;line-height:1.5;color:#333;word-break:break-all}.u-input-show.u-input-multiline[data-v-c78b151e]{white-space:pre-wrap}.u-dict-show[data-v-908045c4]{font-size:14px;line-height:1.5;color:#333}.u-dict-show.u-dict-loading[data-v-908045c4]{color:#999}.u-toggle-show[data-v-bac05efc]{display:inline-block;padding:2px 8px;border-radius:4px;font-size:14px;line-height:1.5}.u-toggle-show.toggle-true[data-v-bac05efc]{background-color:#e6f7ed;color:#52c41a}.u-toggle-show.toggle-false[data-v-bac05efc]{background-color:#fff1f0;color:#ff4d4f}.u-toggle-show.toggle-default[data-v-bac05efc]{color:#999}.u-cascader-show[data-v-5d84df67]{font-size:14px;line-height:1.5;color:#333}.u-cascader-show.u-cascader-loading[data-v-5d84df67]{color:#999}.u-date-show[data-v-930657df]{font-size:14px;line-height:1.5;color:#333}.u-date-show.u-date-empty[data-v-930657df]{color:#999}.u-field-view[data-v-fedb54d7]{display:inline-block}.table-grid[data-v-ca606e7b]{background:#fff}.table-grid .no-data[data-v-ca606e7b]{padding:48px;text-align:center;color:#999}.table-grid[data-v-ca606e7b] .table-grid-active-row td.el-table__cell{background-color:var(--el-color-primary-light-9, #ecf5ff)!important}.table-pagination[data-v-53e593aa]{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;background:#fff;border-top:1px solid #eee}.table-pagination .page-size-select[data-v-53e593aa]{display:flex;align-items:center;gap:12px}.table-pagination .total-text[data-v-53e593aa]{color:#666;font-size:14px}.table-pagination .load-more[data-v-53e593aa]{flex:1;text-align:center}.table-detail[data-v-191846c8]{display:flex;flex-direction:column;height:100%;min-height:0;background:#fff}.table-detail .detail-header[data-v-191846c8]{display:flex;flex-shrink:0;align-items:center;justify-content:space-between;padding:14px 16px;border-bottom:1px solid #ebeef5}.table-detail .detail-header .detail-title[data-v-191846c8]{font-size:15px;font-weight:500}.table-detail .detail-body[data-v-191846c8]{flex:1;min-height:0;overflow:auto}.table-detail .detail-status[data-v-191846c8]{display:flex;align-items:center;justify-content:center;height:100%;padding:24px;color:#999;font-size:13px}.table-detail .detail-content[data-v-191846c8]{padding:4px 16px 16px}.table-detail .detail-item[data-v-191846c8]{display:flex;padding:12px 0;border-bottom:1px solid #eee}.table-detail .detail-item[data-v-191846c8]:last-child{border-bottom:none}.table-detail .detail-item .detail-label[data-v-191846c8]{width:100px;flex-shrink:0;color:#666;font-size:14px}.table-detail .detail-item .detail-value[data-v-191846c8]{flex:1;min-width:0;color:#333;font-size:14px;word-break:break-all}.table-render[data-v-195aa0e8]{display:flex;flex-direction:column;height:100%;min-height:0;background:#fff}.table-render .table-body[data-v-195aa0e8]{display:flex;flex:1;min-height:0;overflow:hidden}.table-render .table-container[data-v-195aa0e8]{flex:1;display:flex;flex-direction:column;min-width:0;overflow:hidden}.table-render .table-container[data-v-195aa0e8] .table-grid{flex:1;min-height:0;max-height:var(--table-grid-max-height, none)}.table-render .table-container[data-v-195aa0e8] .table-grid>.el-table{height:100%}.table-render .table-pagination[data-v-195aa0e8]{flex-shrink:0}.table-render .table-detail-inline[data-v-195aa0e8]{flex-shrink:0;height:100%;overflow:hidden;border-left:1px solid #ebeef5}.table-render .table-detail-inline.table-detail-inline-left[data-v-195aa0e8]{order:-1;border-left:none;border-right:1px solid #ebeef5}.table-render .table-toolbar-bottom[data-v-195aa0e8]{flex-shrink:0}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "urit-qf-ui",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "type": "module",
5
5
  "main": "./dist/index.umd.cjs",
6
6
  "module": "./dist/index.js",