Files
qhmes/deploy-qhmes/frontend/js/BindingDetailFieldsEditor-BawG8cM1.js

2 lines
14 KiB
Java
Raw Normal View History

2026-05-15 11:34:12 +08:00
var Ce=Object.defineProperty,Se=Object.defineProperties;var Fe=Object.getOwnPropertyDescriptors;var H=Object.getOwnPropertySymbols;var Me=Object.prototype.hasOwnProperty,Ue=Object.prototype.propertyIsEnumerable;var Y=(v,y,o)=>y in v?Ce(v,y,{enumerable:!0,configurable:!0,writable:!0,value:o}):v[y]=o,x=(v,y)=>{for(var o in y||(y={}))Me.call(y,o)&&Y(v,o,y[o]);if(H)for(var o of H(y))Ue.call(y,o)&&Y(v,o,y[o]);return v},T=(v,y)=>Se(v,Fe(y));import{d as ze,o as $e,b as Ie,w as Be,f as C,ah as z,ar as B,as as K,au as p,k as u,aF as c,G as g,e as V,av as j,aC as L,ag as A,F as J,aD as Q}from"./vue-vendor-C7Zq48Yl.js";import{u as Re,d as _e}from"./index-BI6CMai0.js";import"./antd-vue-vendor-BPnV8VqP.js";import"./vxe-table-vendor-B88kchpX.js";const Le={class:"binding-detail-fields-editor"},Ee={class:"binding-actions-row"},qe={key:2,class:"field-count"},Ne={class:"nested-fields"},De={class:"nested-fields-head"},Oe={class:"modal-section"},Pe={class:"modal-section"},Ve={class:"modal-section"},Ge={class:"modal-section"},He=ze({__name:"BindingDetailFieldsEditor",props:{detailTables:{}},emits:["update:detailTables"],setup(v,{emit:y}){const o=v,S=y,{createMessage:U}=Re(),O=C(typeof window!="undefined"?window.innerHeight:800);function G(){O.value=window.innerHeight}$e(()=>window.addEventListener("resize",G)),Ie(()=>window.removeEventListener("resize",G));const W=V(()=>{const a=O.value;return Math.round(Math.min(500,Math.max(220,a-380)))}),X=V(()=>{const a=O.value;return Math.round(Math.min(300,Math.max(140,a-520)))}),$=C([]),k=C([]),E=C(!1),q=C(1),F=C([{tableKey:"",label:""}]),R=C(!1),I=C(void 0),N=C(1),h=C([{parentKey:"",fieldKey:"",label:""}]),Z=V(()=>(o.detailTables||[]).map(a=>({value:a.tableKey,label:a.label?`${a.tableKey}${a.label}`:a.tableKey}))),ee=[{title:"数据源",dataIndex:"tableKey",ellipsis:!0,width:96},{title:"显示名",dataIndex:"label",ellipsis:!0},{title:"字段数",dataIndex:"fieldCount",width:72,align:"right"}],le=[{title:"字段键",dataIndex:"key",ellipsis:!0},{title:"显示名",dataIndex:"label",ellipsis:!0},{title:"操作",dataIndex:"actions",width:56,align:"center"}];Be(()=>o.detailTables.map(a=>a.tableKey).join(","),()=>{const a=new Set(o.detailTables.map(e=>e.tableKey));k.value=k.value.filter(e=>a.has(e)),$.value=$.value.filter(e=>a.has(e))});function ae(a){k.value=a}function te(){const a=new Set(o.detailTables.map(e=>e.tableKey.trim()).filter(Boolean));return F.value.forEach(e=>{const t=e.tableKey.trim();t&&a.add(t)}),a}function ne(a){let e=0;for(const t of a){const l=String(t).match(/^List(\d+)$/i);l&&(e=Math.max(e,Number(l[1])))}return e}function ie(a){const e=new Set,t=o.detailTables.find(n=>n.tableKey===a);((t==null?void 0:t.fields)||[]).forEach(n=>e.add(n.key)),h.value.forEach(n=>{var i;String((i=n.parentKey)!=null?i:"").trim()===a&&n.fieldKey.trim()&&e.add(n.fieldKey.trim())});let l=0;for(const n of e){const i=String(n).match(/^Field(\d+)$/i);i&&(l=Math.max(l,Number(i[1])))}return l}function se(a,e){return typeof e=="number"&&e>=0?e:o.detailTables.findIndex(t=>t.tableKey===a.tableKey)}function oe(a,e,t){var w,f;const l=se(a,t),n=(f=(w=o.detailTables[l])==null?void 0:w.tableKey)!=null?f:a.tableKey,i=String(e||"").trim();if(!i){U.warning("数据源键不能为空");return}if(i!==n&&o.detailTables.some(M=>M.tableKey===i)){U.warning("该数据源键已存在");return}const s=[...o.detailTables];l<0||l>=s.length||(s[l]=T(x({},s[l]),{tableKey:i}),S("update:detailTables",s),k.value=k.value.map(M=>M===n?i:M),$.value=$.value.map(M=>M===n?i:M))}function de(a,e){const t=o.detailTables.map(l=>l.tableKey===a?T(x({},l),{label:e.trim()||void 0}):l);S("update:detailTables",t)}function ue(a,e,t){const l=String(t||"").trim();if(!l){U.warning("字段键不能为空");return}const n=o.detailTables.find(f=>f.tableKey===a);if(!n)return;const i=[...n.fields||[]];if(l!==e&&i.some(f=>f.key===l)){U.warning("该字段键已存在");return}const s=i.map(f=>f.key===e?T(x({},f),{key:l}):f),w=o.detailTables.map(f=>f.tableKey===a?T(x({},f),{fields:s}):f);S("update:detailTables",w)}function re(a,e,t){const l=o.detailTables.map(n=