57 lines
61 KiB
Java
57 lines
61 KiB
Java
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/vue-plugin-hiprint-f7b0vEHA.js","js/emoji-mart-vue-fast-R0uJEDq-.js","js/JsBarcode-9Xoda2fA.js","js/index-X7Y8jykP.js","js/vue-vendor-DNhG1Cve.js","assets/index-GuhSw_Yp.css","js/browser-CC9DCAWJ.js","js/stackblur-es-DK4L4ctA.js"])))=>i.map(i=>d[i]);
|
||
var ln=Object.defineProperty,fn=Object.defineProperties;var cn=Object.getOwnPropertyDescriptors;var tr=Object.getOwnPropertySymbols;var gn=Object.prototype.hasOwnProperty,yn=Object.prototype.propertyIsEnumerable;var rr=(Y,q,I)=>q in Y?ln(Y,q,{enumerable:!0,configurable:!0,writable:!0,value:I}):Y[q]=I,V=(Y,q)=>{for(var I in q||(q={}))gn.call(q,I)&&rr(Y,I,q[I]);if(tr)for(var I of tr(q))yn.call(q,I)&&rr(Y,I,q[I]);return Y},Ke=(Y,q)=>fn(Y,cn(q));var Q=(Y,q,I)=>new Promise(($,Ae)=>{var Fe=j=>{try{_e(I.next(j))}catch(xe){Ae(xe)}},Re=j=>{try{_e(I.throw(j))}catch(xe){Ae(xe)}},_e=j=>j.done?$(j.value):Promise.resolve(j.value).then(Fe,Re);_e((I=I.apply(Y,q)).next())});import{s as hn,aE as pn,aU as bn,_ as mn,aX as vn,bR as wn,av as Sn,aF as An,aG as Fn,aw as _n,au as xn}from"./index-X7Y8jykP.js";import{r as En,d as We,a as nr,b as Tn}from"./qhmesProvider-MWkGjy8y.js";import{e as $n,o as Nn,W as kn,a as Hn,h as Ye,x as On,C as D,z,Q as T,f as v,H as Xe,r as ee,G as oe,A,F as ge,D as Se,u as Rn,c as Le,K as Jn,p as Bn,n as Ze,E as k,y as ar,J as In}from"./vue-vendor-DNhG1Cve.js";import{f as St,s as Pn,e as zn}from"./printTemplate.api-Dfuyi-ab.js";import{T as qn}from"./index-J2mOtM3w.js";import{D as Cn}from"./index-DZJwICFr.js";import Wn from"./index-DklMb9Qc.js";import"./emoji-mart-vue-fast-R0uJEDq-.js";import"./isNumeric-DjvBa-1E.js";import"./UpOutlined-B1UMbtrP.js";const At="qhmes_quick_print_preview_v1",Ln={class:"print-designer-page"},Dn={class:"designer-toolbar"},jn={class:"toolbar-left"},Mn={key:0,class:"toolbar-subtitle"},Un={key:1,class:"toolbar-subtitle"},Gn={class:"toolbar-right"},Qn={class:"designer-main"},Vn={class:"designer-panel left"},Kn={class:"drag-list"},Yn=["tid"],Xn={class:"drag-label"},Zn={class:"drag-tip"},ea={class:"data-tips"},ta={class:"designer-panel right"},ra={class:"group-toolbar"},na={class:"group-bound-tip"},aa={key:0,class:"group-bound-empty"},sa={class:"group-preview"},ia={class:"group-preview-table"},oa=["rowspan"],ua={class:"header-editor"},da={class:"header-editor-content"},la={class:"header-row-top"},sr=!1,ye="qhmesMergeCenterFields",Oe="qhmesColumnGroups",fa=$n({name:"PrintDesigner",__name:"PrintDesigner",setup(Y){const q=kn(),I=Bn(),{createMessage:$}=hn(),Ae=ee("template"),Fe=ee(!1),Re=ee(!1),_e=ee(!1),j=ee(""),xe=ee(""),_=ee(""),ne=ee(""),he=ee({}),x=ee([]),te=ee([]),E=ee([]),ir=Le(()=>{const e=Object.keys(he.value||{});return e.length?e:["docNo","orderNo","mainTable","detailList"]}),Ft=Le(()=>te.value),et=Le(()=>new Set(x.value)),_t=Le(()=>{const e=he.value||{},r=x.value||[];let t=[],n=-1;return Object.keys(e).forEach(s=>{const i=e[s];if(!Array.isArray(i)||!i.length||typeof i[0]!="object")return;const a=Object.keys(i[0]||{}),o=r.filter(d=>a.includes(d)).length;o>n&&(n=o,t=i)}),t}),xt=Le(()=>{const e={},r=_t.value||[],t=x.value||[];return!r.length||!t.length||t.forEach(n=>{var i,a;let s=0;for(;s<r.length;){const o=(i=r[s])==null?void 0:i[n];let d=s+1;for(;d<r.length&&((a=r[d])==null?void 0:a[n])===o;)d+=1;const l=d-s;e[`${s}_${n}`]=l;for(let u=s+1;u<d;u+=1)e[`${u}_${n}`]=0;s=d}}),e});let pe=null,W=null,tt=!1,rt=!1,nt={},at="",st="",ue=[],de=null,be=null,me=null,re=null,Et=0,it=!1;function Tt(e){return`${e}_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}function H(e){let r=String(e!=null?e:"").trim();if(!r)return"";const t=r.match(/^\{\{\s*([^}]+)\s*\}\}$/);return t!=null&&t[1]&&(r=t[1].trim()),r=r.replace(/^item\./i,"").trim(),r}function Je(e){const r=(e==null?void 0:e.field)||(e==null?void 0:e.dataIndex)||(e==null?void 0:e.key)||(e==null?void 0:e.name)||(e==null?void 0:e.titleField)||"";return{id:(e==null?void 0:e.id)||Tt("col"),title:(e==null?void 0:e.title)||(e==null?void 0:e.label)||(e==null?void 0:e.text)||r||"未命名列",field:r,width:Number((e==null?void 0:e.width)||(e==null?void 0:e.minWidth))||90,align:(e==null?void 0:e.align)||"center"}}function $t(e){if(!Array.isArray(e)||!e.length)return[];if(Array.isArray(e[0])){const t=e.filter(o=>Array.isArray(o));if(!t.length)return[];const n=t[0]||[],s=t[t.length-1]||[];if(!n.length||!s.length)return[];const i=[];let a=0;if(n.forEach(o=>{const d=Number((o==null?void 0:o.colspan)||(o==null?void 0:o.colSpan)||1)||1,u=s.slice(a,a+d).map(f=>Je(f)).filter(f=>!!f.field);u.length&&i.push({title:(o==null?void 0:o.title)||(o==null?void 0:o.label)||"未命名分组",columns:u}),a+=d}),i.length)return i}return e.some(t=>Array.isArray(t==null?void 0:t.columns)||Array.isArray(t==null?void 0:t.children))?e.map(t=>{const n=Array.isArray(t==null?void 0:t.columns)?t.columns:Array.isArray(t==null?void 0:t.children)?t.children:[];return{title:(t==null?void 0:t.title)||(t==null?void 0:t.label)||"未命名分组",columns:n.map(s=>Je(s)).filter(s=>!!s.field)}}).filter(t=>t.columns.length>0):[{title:"默认分组",columns:e.map(t=>Je(t)).filter(t=>!!t.field)}]}function or(e){if(!Array.isArray(e)||!e.length)return[];if(Array.isArray(e[0]))return Te(e).map(s=>({field:H((s==null?void 0:s.field)||""),title:String((s==null?void 0:s.title)||(s==null?void 0:s.field)||"").trim()})).filter(s=>!!s.field);const r=[],t=n=>{(n||[]).forEach(s=>{const i=Array.isArray(s==null?void 0:s.columns)?s.columns:Array.isArray(s==null?void 0:s.children)?s.children:[];if(i.length){t(i);return}const a=H((s==null?void 0:s.field)||(s==null?void 0:s.dataIndex)||(s==null?void 0:s.key)||(s==null?void 0:s.name)||"");a&&r.push({field:a,title:String((s==null?void 0:s.title)||(s==null?void 0:s.text)||a).trim()||a})})};return t(e),r}function ur(e){var i;const r=new Map,t=(a,o)=>{const d=H(a);if(!d)return;const l=String(o||d).trim()||d;r.has(d)||r.set(d,l)};if(e&&Array.isArray(e.panels)){const a=e.panels||[];let o=[];for(const d of a){if(o.length)break;const l=Array.isArray(d==null?void 0:d.printElements)?d.printElements:[];for(const u of l){const f=(u==null?void 0:u.options)||{},g=(u==null?void 0:u.printElementType)||{},S=[f==null?void 0:f.headerColumns,f==null?void 0:f.columns,f==null?void 0:f.tableColumns,g==null?void 0:g.headerColumns,g==null?void 0:g.columns,g==null?void 0:g.tableColumns];for(const y of S){const p=or(y);if(p.length){o=p;break}}if(o.length)break}}o.forEach(d=>t(d.field,d.title))}if(Ct(e).forEach(a=>{((a==null?void 0:a.columns)||[]).forEach(o=>{t(o==null?void 0:o.field,o==null?void 0:o.title)})}),e&&Array.isArray(e.panels)){const a=e.panels||[];for(const o of a){const d=Array.isArray(o==null?void 0:o.printElements)?o.printElements:[];for(const l of d){const u=(l==null?void 0:l.options)||{},f=(l==null?void 0:l.printElementType)||{},g=[u==null?void 0:u.headerColumns,u==null?void 0:u.columns,u==null?void 0:u.tableColumns,f==null?void 0:f.headerColumns,f==null?void 0:f.columns,f==null?void 0:f.tableColumns];for(const y of g)!Array.isArray(y)||!y.length||(Array.isArray(y[0])?Te(y).forEach(b=>t(b==null?void 0:b.field,(b==null?void 0:b.title)||(b==null?void 0:b.field))):y.forEach(p=>t((p==null?void 0:p.field)||(p==null?void 0:p.dataIndex)||(p==null?void 0:p.key)||(p==null?void 0:p.name),(p==null?void 0:p.title)||(p==null?void 0:p.text))));Ht(l).forEach(y=>t(y,y))}}}const s=(i=e==null?void 0:e.ext)==null?void 0:i.customHeaderRows;return Array.isArray(s)&&s.length&&Te(s).forEach(o=>t(o==null?void 0:o.field,(o==null?void 0:o.title)||(o==null?void 0:o.field))),Array.from(r.entries()).map(([a,o])=>({value:a,label:o}))}function ve(e){te.value=ur(e),nt=pr(e)}function Nt(e){if(!Array.isArray(e)||!e.length)return[];if(Array.isArray(e[0])){const n=e.filter(a=>Array.isArray(a)),s=Te(n);return s.length?s.map(a=>H((a==null?void 0:a.field)||"")).filter(Boolean):(n[n.length-1]||[]).map(a=>H((a==null?void 0:a.field)||(a==null?void 0:a.dataIndex)||(a==null?void 0:a.key)||(a==null?void 0:a.name)||"")).filter(Boolean)}if(!e.some(n=>Array.isArray(n==null?void 0:n.columns)||Array.isArray(n==null?void 0:n.children)))return e.map(n=>H((n==null?void 0:n.field)||(n==null?void 0:n.dataIndex)||(n==null?void 0:n.key)||(n==null?void 0:n.name)||"")).filter(Boolean);const t=[];return e.forEach(n=>{const s=Array.isArray(n==null?void 0:n.columns)?n.columns:Array.isArray(n==null?void 0:n.children)?n.children:[];t.push(...Nt(s))}),t.filter(Boolean)}function dr(e){const r=dt(e),t=Te(r);return t.length?t.map(n=>H((n==null?void 0:n.field)||"")).filter(Boolean):He(e)}function He(e){const r=[e==null?void 0:e.columns,e==null?void 0:e.tableColumns,e==null?void 0:e.headerColumns];for(const n of r){const s=Nt(n);if(s.length)return s}if(Array.isArray(e==null?void 0:e.fields)&&e.fields.length)return e.fields.map(n=>H(typeof n=="string"?n:(n==null?void 0:n.field)||(n==null?void 0:n.dataIndex)||(n==null?void 0:n.key)||(n==null?void 0:n.name)||"")).filter(Boolean);const t=[e==null?void 0:e.field,e==null?void 0:e.dataIndex,e==null?void 0:e.bindField,e==null?void 0:e.fieldName,e==null?void 0:e.apiField,e==null?void 0:e.testField].map(n=>H(n)).filter(Boolean);return t.length?Array.from(new Set(t)):[]}function kt(e,r){if(!(!Array.isArray(e)||!e.length)){if(Array.isArray(e[0])){e.forEach(t=>{(Array.isArray(t)?t:[]).forEach(n=>{const s=H((n==null?void 0:n.field)||(n==null?void 0:n.dataIndex)||(n==null?void 0:n.key)||(n==null?void 0:n.name)||"");s&&(r[s]=V(V({},r[s]||{}),n||{}))})});return}e.forEach(t=>{const n=H((t==null?void 0:t.field)||(t==null?void 0:t.dataIndex)||(t==null?void 0:t.key)||(t==null?void 0:t.name)||"");n&&(r[n]=V(V({},r[n]||{}),t||{}));const s=Array.isArray(t==null?void 0:t.columns)?t.columns:Array.isArray(t==null?void 0:t.children)?t.children:[];s.length&&kt(s,r)})}}function lr(e){const r={};return[e==null?void 0:e.headerColumns,e==null?void 0:e.columns,e==null?void 0:e.tableColumns].forEach(n=>kt(n,r)),r}function Ht(e){const r=(e==null?void 0:e.options)||{},t=(e==null?void 0:e.printElementType)||{},n=[r,t];for(const s of n){const i=He(s||{});if(i.length)return i}return[]}function Ot(e){var n;const r=(e==null?void 0:e.printElementType)||{},t=String(r.type||"").trim().toLowerCase();return t||String(((n=e==null?void 0:e.options)==null?void 0:n.type)||"").trim().toLowerCase()}function ae(e){const r=Ot(e);return r==="table"||r==="longtable"}function fr(e){var n,s;if(ae(e))return!0;const r=String(((n=e==null?void 0:e.printElementType)==null?void 0:n.title)||((s=e==null?void 0:e.options)==null?void 0:s.title)||"").toLowerCase();return!!(!Ot(e)&&(r.includes("表格")||r.includes("table")))}function cr(e,r){var s;const t=r||{},n=(s=e==null?void 0:e[ye])!=null?s:t==null?void 0:t[ye];return Array.isArray(n)&&n.length?P(n,!1):P(x.value,!1)}function Ee(e,r){if(!e||!Array.isArray(e.panels))return;const t=e.panels||[];for(const n of t){const s=Array.isArray(n==null?void 0:n.printElements)?n.printElements:[];for(const i of s)ae(i)&&r(i)}}function gr(e){if(!e||!Array.isArray(e.panels))return;const r=["columns","tableColumns","headerColumns"],t=s=>{!s||typeof s!="object"||r.forEach(i=>{const a=s[i];Array.isArray(a)&&a.length&&Array.isArray(a[0])&&delete s[i]})},n=e.panels||[];for(const s of n){const i=Array.isArray(s==null?void 0:s.printElements)?s.printElements:[];for(const a of i){if(ae(a))continue;const o=a.options||{};t(o),delete o[ye],delete o[Oe],delete o.gridColumns,a.options=o;const d=a.printElementType;d&&typeof d=="object"&&(t(d),delete d[ye],delete d[Oe],delete d.gridColumns)}}}function Be(e,r){try{return JSON.stringify(e)===JSON.stringify(r)}catch(t){return!1}}function yr(e){if(!e||!Array.isArray(e.panels))return;const r=e.panels||[];for(const t of r){const n=Array.isArray(t==null?void 0:t.printElements)?t.printElements:[];for(const s of n){if(!ae(s))continue;const i=s.options||{},a=i.columns;if(!Array.isArray(a)||!a.length)continue;i.tableColumns&&Be(a,i.tableColumns)&&delete i.tableColumns,i.headerColumns&&Be(a,i.headerColumns)&&delete i.headerColumns;const o=s.printElementType;o&&typeof o=="object"&&(o.columns&&Be(a,o.columns)?(delete o.columns,delete o.tableColumns,delete o.headerColumns):(o.tableColumns&&Be(a,o.tableColumns)&&delete o.tableColumns,o.headerColumns&&Be(a,o.headerColumns)&&delete o.headerColumns)),s.options=i}}}function we(e){gr(e),yr(e)}function De(e){const r=e.ext;!r||typeof r!="object"||(delete r.mergeCenterFields,delete r.mergeFields,delete r.customHeaderRows,Object.keys(r).length||delete e.ext)}function hr(e){let r=!1;return Ee(e,t=>{const s=(t.options||{})[ye];Array.isArray(s)&&s.length&&(r=!0)}),r}function ot(e){if(!e||typeof e!="object")return;const r=e.ext;if(!r||typeof r!="object"){De(e);return}const t=r.mergeCenterFields||r.mergeFields;if(Array.isArray(t)&&t.length&&!hr(e)){const i=P(t,!1);Ee(e,a=>{const o=a.options||{};o[ye]=[...i],a.options=o})}const n=r.customHeaderRows,s=Ue(e);if(Array.isArray(n)&&n.length&&!s.length){const i=se(R(n));Ee(e,a=>{const o=a.options||{};o.columns=se(i),a.options=o,a.printElementType=a.printElementType||{},a.printElementType.columns=se(i)})}De(e)}function pr(e){const r={};if(!e||!Array.isArray(e.panels))return r;const t=e.panels||[];for(const n of t){const s=Array.isArray(n==null?void 0:n.printElements)?n.printElements:[];for(const i of s){if(!ae(i))continue;const a=(i==null?void 0:i.options)||{},o=He(a);o.length&&o.forEach((d,l)=>{r[d]||(r[d]=[]),r[d].push(l+1)})}}return r}function br(e,r){const t=JSON.stringify(e||[]),n=JSON.stringify(r||[]);return new Function("data","row","colIndex","rowIndex",`
|
||
const leafFields = ${t};
|
||
const selectedFields = ${n};
|
||
const rows = Array.isArray(data) ? data : [];
|
||
let cIndex = -1;
|
||
let rIndex = -1;
|
||
const a2 = arguments[2];
|
||
const a3 = arguments[3];
|
||
const a4 = arguments[4];
|
||
const isNum = (v) => typeof v === 'number' && !isNaN(v);
|
||
|
||
// 常见签名1: (data, row, colIndex, rowIndex)
|
||
if (isNum(a2) && isNum(a3)) {
|
||
cIndex = a2;
|
||
rIndex = a3;
|
||
}
|
||
// 常见签名2: (data, row, col, rowIndex, colIndex)
|
||
if (typeof a2 === 'object' && isNum(a3) && isNum(a4)) {
|
||
rIndex = a3;
|
||
cIndex = a4;
|
||
}
|
||
|
||
// 兜底:扫描全部数字参数推断
|
||
if (cIndex < 0 || rIndex < 0) {
|
||
const nums = [];
|
||
for (let i = 2; i < arguments.length; i += 1) {
|
||
if (isNum(arguments[i])) nums.push(arguments[i]);
|
||
}
|
||
for (let i = 0; i < nums.length; i += 1) {
|
||
const n = nums[i];
|
||
if (cIndex < 0 && n >= 0 && n < leafFields.length) cIndex = n;
|
||
if (rIndex < 0 && n >= 0 && n < rows.length) rIndex = n;
|
||
}
|
||
}
|
||
|
||
// 兼容 1-based 索引
|
||
if (cIndex >= leafFields.length && cIndex - 1 >= 0 && cIndex - 1 < leafFields.length) cIndex = cIndex - 1;
|
||
if (rIndex >= rows.length && rIndex - 1 >= 0 && rIndex - 1 < rows.length) rIndex = rIndex - 1;
|
||
|
||
const field = leafFields[cIndex];
|
||
if (!field || selectedFields.indexOf(field) === -1) return [1, 1];
|
||
if (!rows.length || rIndex < 0 || rIndex >= rows.length) return [1, 1];
|
||
const currentValue = rows[rIndex] ? rows[rIndex][field] : undefined;
|
||
if (rIndex > 0) {
|
||
const prev = rows[rIndex - 1] ? rows[rIndex - 1][field] : undefined;
|
||
if (prev === currentValue) return [0, 1];
|
||
}
|
||
let span = 1;
|
||
for (let i = rIndex + 1; i < rows.length; i += 1) {
|
||
const nextValue = rows[i] ? rows[i][field] : undefined;
|
||
if (nextValue === currentValue) span += 1;
|
||
else break;
|
||
}
|
||
return [span, 1];
|
||
`)}function mr(e){if(!e||!Array.isArray(e.panels))return 0;const r=P(x.value,!1);if(!r.length)return 0;let t=0;const n=e.panels||[];for(const s of n){const i=Array.isArray(s==null?void 0:s.printElements)?s.printElements:[];for(const a of i){if(!ae(a))continue;const o=(a==null?void 0:a.options)||{},d=He(o);if(d.length&&r.some(l=>d.includes(l))){const l=br(d,r);o.rowsColumnsMerge=l,o.rowColumnsMerge=l,o.rowsColumnsMergeFn=l,o.tableOptions=o.tableOptions||{},o.tableOptions.rowsColumnsMerge=l,o.tableOptions.rowColumnsMerge=l,a.options=o,a.rowsColumnsMerge=l,t+=1}}}return t}function Rt(){const e=P(x.value,!1);if(!e.length)return"";const r=e.flatMap(i=>nt[i]||[]),t=Array.from(new Set(r)).sort((i,a)=>i-a);return t.length?`${t.map(i=>{const a=`.hiprint-printElement table tbody tr td:nth-child(${i})`,o=`${a}:empty,${a}:has(> div:empty),${a}:has(> span:empty),${a}:has(> p:empty),${a}:has(> *:only-child:empty)`,d=`.hiprint-printElement table tbody tr:has(+ tr ${a}:empty) ${a},.hiprint-printElement table tbody tr:has(+ tr ${a}:has(> div:empty)) ${a},.hiprint-printElement table tbody tr:has(+ tr ${a}:has(> span:empty)) ${a},.hiprint-printElement table tbody tr:has(+ tr ${a}:has(> p:empty)) ${a},.hiprint-printElement table tbody tr:has(+ tr ${a}:has(> *:only-child:empty)) ${a}`;return`${a}{text-align:center !important;vertical-align:middle !important;}${o}{border-top:none !important;}${d}{border-bottom:none !important;}`}).join("")}table.qhmes-merge-table{page-break-inside:auto;}table.qhmes-merge-table thead{display:table-header-group;}table.qhmes-merge-table tbody tr{page-break-inside:avoid;break-inside:avoid;}table.qhmes-merge-table tbody td.qhmes-vmerge-continue{border-top:none !important;}table.qhmes-merge-table tbody td,table.qhmes-merge-table tbody th{vertical-align:middle;}`:""}function Jt(e){const r=P(x.value,!1);if(!r.length)return e;const t=V({},e);return Object.keys(t).forEach(n=>{const s=t[n];if(!Array.isArray(s)||!s.length||typeof s[0]!="object"||!r.some(d=>d in s[0]))return;const a=s.map(d=>V({},d)),o=s.map(d=>V({},d));r.forEach(d=>{var l,u;for(let f=1;f<o.length;f+=1)((l=a[f])==null?void 0:l[d])===((u=a[f-1])==null?void 0:u[d])&&(o[f][d]="")}),t[n]=o}),t}function ut(e){return String(e!=null?e:"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function dt(e){if(Array.isArray(ue)&&ue.length)return ue;const r=[e==null?void 0:e.headerColumns,e==null?void 0:e.columns,e==null?void 0:e.tableColumns];for(const t of r)if(!(!Array.isArray(t)||!t.length))return Array.isArray(t[0])?t.map(n=>Array.isArray(n)?n:[]):[t];return Array.isArray(e==null?void 0:e.fields)&&e.fields.length?[e.fields.map(t=>typeof t=="string"?{title:t,field:H(t)}:{title:(t==null?void 0:t.text)||(t==null?void 0:t.title)||(t==null?void 0:t.field),field:H((t==null?void 0:t.field)||(t==null?void 0:t.dataIndex)||(t==null?void 0:t.key))})]:[]}function vr(e){var n,s;const t=[e==null?void 0:e.tableHeaderBackground,e==null?void 0:e.tableHeaderBackgroundColor,e==null?void 0:e.tableHeaderBgColor,e==null?void 0:e.tableHeaderBackGround,e==null?void 0:e.headerBackground,e==null?void 0:e.headerBackgroundColor,e==null?void 0:e.headBackground,e==null?void 0:e.headBackgroundColor,(n=e==null?void 0:e.tableHeaderStyle)==null?void 0:n.background,(s=e==null?void 0:e.tableHeaderStyle)==null?void 0:s.backgroundColor].find(i=>String(i||"").trim());return t?String(t).trim():""}function X(e,r="pt"){const t=String(e!=null?e:"").trim();return t?/^-?\d+(\.\d+)?$/.test(t)?`${t}${r}`:t:""}function Te(e){var i,a,o,d;if(!Array.isArray(e)||!e.length)return[];const r=e.length;let t=0;if(e.forEach(l=>{const u=(Array.isArray(l)?l:[]).reduce((f,g)=>f+(Number((g==null?void 0:g.colspan)||(g==null?void 0:g.colSpan)||1)||1),0);t=Math.max(t,u)}),!t)return[];const n=Array.from({length:r},()=>Array.from({length:t},()=>null));for(let l=0;l<r;l+=1){const u=Array.isArray(e[l])?e[l]:[];let f=0;u.forEach(g=>{for(;f<t&&n[l][f];)f+=1;const S=Number((g==null?void 0:g.rowspan)||(g==null?void 0:g.rowSpan)||1)||1,y=Number((g==null?void 0:g.colspan)||(g==null?void 0:g.colSpan)||1)||1;for(let p=l;p<Math.min(r,l+S);p+=1)for(let b=f;b<Math.min(t,f+y);b+=1)n[p][b]=g;f+=y})}const s=[];for(let l=0;l<t;l+=1){let u=null;for(let J=r-1;J>=0;J-=1){const F=n[J][l];if((F==null?void 0:F.field)||(F==null?void 0:F.dataIndex)||(F==null?void 0:F.key)||(F==null?void 0:F.name)||""){u=F;break}}if(!u){s.push({field:"",title:"",align:"",halign:"",width:"",autoWrap:!1});continue}const f=H((u==null?void 0:u.field)||(u==null?void 0:u.dataIndex)||(u==null?void 0:u.key)||(u==null?void 0:u.name)||""),g=String((u==null?void 0:u.title)||(u==null?void 0:u.text)||(u==null?void 0:u.label)||f),S=String((u==null?void 0:u.align)||""),y=String((u==null?void 0:u.halign)||(u==null?void 0:u.align)||""),p=(u==null?void 0:u.width)||(u==null?void 0:u.minWidth)||"",b=!!((d=(o=(a=(i=u==null?void 0:u.autoWrap)!=null?i:u==null?void 0:u.tableAutoWrap)!=null?a:u==null?void 0:u.wrap)!=null?o:u==null?void 0:u.wordWrap)!=null&&d);s.push({field:f,title:g,align:S,halign:y,width:p,autoWrap:b})}return s}function se(e){return(e||[]).map(r=>(r||[]).map(t=>{var n,s,i,a;return Ke(V({},t||{}),{title:(t==null?void 0:t.title)||(t==null?void 0:t.text)||"",field:H((t==null?void 0:t.field)||(t==null?void 0:t.dataIndex)||""),rowspan:Number((t==null?void 0:t.rowspan)||(t==null?void 0:t.rowSpan)||1)||1,colspan:Number((t==null?void 0:t.colspan)||(t==null?void 0:t.colSpan)||1)||1,halign:(t==null?void 0:t.halign)||(t==null?void 0:t.align)||"center",align:(t==null?void 0:t.align)||(t==null?void 0:t.halign)||"center",autoWrap:!!((a=(i=(s=(n=t==null?void 0:t.autoWrap)!=null?n:t==null?void 0:t.tableAutoWrap)!=null?s:t==null?void 0:t.wrap)!=null?i:t==null?void 0:t.wordWrap)!=null&&a)})}))}function R(e){const r=se(e).filter(t=>t.length>0);return r.length?r:[[{title:"新表头",field:"",rowspan:1,colspan:1,halign:"center",align:"center",autoWrap:!1}]]}function Bt(e,r){const t=R(e),n=R(r);return!n.length||t.length!==n.length?t:t.map((s,i)=>{const a=n[i];return!Array.isArray(a)||a.length!==s.length?s:s.map((o,d)=>{var g,S,y;const l=a[d]||{},u=(y=(S=(g=l.autoWrap)!=null?g:l.tableAutoWrap)!=null?S:l.wrap)!=null?y:l.wordWrap;return u!=null?Ke(V({},o),{autoWrap:!!u}):o})})}function je(e){if(!e||!Array.isArray(e.panels))return!1;const r=R(E.value),t=se(r);let n=0;return Ee(e,s=>{const i=(s==null?void 0:s.options)||{},a=se(t);i.columns=a,s.options=i,s.printElementType=s.printElementType||{},s.printElementType.columns=se(t),n+=1}),n>0}function It(e,r){const t=r.leafFields||[],n=r.selectedFields||[],s=r.headerRows||[],i=r.bodyColumns||[],a=r.columnMetaMap||{},o=String(r.tableRowsFieldRoot||"").trim(),d=String(r.defaultBodyAlign||"left"),l=String(r.headerBg||"").trim(),u=String(r.headerFontSize||"").trim(),f=String(r.headerFontWeight||"").trim(),g=String(r.headerFontFamily||"").trim(),S=String(r.headerLineHeight||"").trim(),y=String(r.headerRowHeight||"").trim(),p=String(r.bodyFontSize||"").trim(),b=String(r.bodyFontWeight||"").trim(),J=String(r.bodyFontFamily||"").trim(),F=String(r.bodyLineHeight||"").trim(),C=String(r.bodyRowHeight||"").trim(),O=Number(r.tableWidthPx||0),ie=(c,w="")=>{const h=String(w||"").trim().toLowerCase();if(["tp","qrcode","qrcodevalue","qrcodecontent","qrcodefield","qrcode_data","qr","qrcodeid"].includes(h))return!0;const N=String((c==null?void 0:c.title)||(c==null?void 0:c.text)||"").toLowerCase();return N.includes("二维码")||N.includes("qrcode")||N==="qr"?!0:[c==null?void 0:c.fieldType,c==null?void 0:c.type,c==null?void 0:c.columnType,c==null?void 0:c.formatterType,c==null?void 0:c.qrCodeType,c==null?void 0:c.qrcodeType,c==null?void 0:c.dataType].some(m=>{const B=String(m||"").toLowerCase();return B.includes("qrcode")||B.includes("qr")||B.includes("二维码")})},fe=(c,w,h="")=>{const N=String(c!=null?c:"");if(!N)return"";if(ie(w,h)){const G=Number((w==null?void 0:w.qrCodeSize)||(w==null?void 0:w.qrcodeSize)||(w==null?void 0:w.qrcodeWidth)||56)||56,m=Math.max(24,Math.min(120,G));return`<img src="${`https://api.qrserver.com/v1/create-qr-code/?size=${m}x${m}&data=${encodeURIComponent(N)}`}" alt="${ut(N)}" style="display:block;margin:0 auto;width:${m}px;height:${m}px;object-fit:contain;" />`}return ut(N)},ce=c=>String(c||"").replace(/\s+/g,""),Ve=new Map;i.forEach(c=>{const w=H((c==null?void 0:c.field)||""),h=ce(String((c==null?void 0:c.title)||(c==null?void 0:c.text)||(c==null?void 0:c.label)||""));w&&h&&Ve.set(h,w)});const vt=new Set(t.map(c=>H(String(c||""))).filter(Boolean)),Zr=(n||[]).map(c=>{const w=String(c||"").trim(),h=H(w);return vt.has(h)?h:Ve.get(ce(w))||h}),en=new Set(Zr.map(c=>H(String(c||""))).filter(Boolean)),tn=new Set(t.map((c,w)=>({field:c,index:w})).filter(c=>!!c.field&&en.has(H(c.field))).map(c=>c.index)),wt=(c=>{if(Array.isArray(c))return c;if(c&&typeof c=="object"){const w=c;if(o&&Array.isArray(w[o]))return w[o];const h=Object.keys(w);let N=[],G=-1;for(let m=0;m<h.length;m+=1){const B=w[h[m]];if(!Array.isArray(B)||!B.length||B[0]===null||typeof B[0]!="object"||Array.isArray(B[0]))continue;let K=0;for(let Z=0;Z<t.length;Z+=1){const ke=t[Z];ke&&Object.prototype.hasOwnProperty.call(B[0],ke)&&(K+=1)}K>G&&(G=K,N=B)}if(N.length)return N}return[]})(e),rn=c=>c===""||c===null||c===void 0,nn=(c,w)=>Object.is(c,w)?!0:c==null||w===null||w===void 0?!1:typeof c=="number"&&typeof w=="number"&&Number.isFinite(c)&&Number.isFinite(w)?c===w:String(c)===String(w),Yt=(c,w)=>{var N,G;let h=c;for(;h>=0;){const m=(N=wt[h])==null?void 0:N[w];if(!rn(m))return m;h-=1}return(G=wt[c])==null?void 0:G[w]};let U='<table class="qhmes-merge-table" style="width:100%;border-collapse:collapse;table-layout:fixed;">';if(i.length){const c=i.map(m=>Number((m==null?void 0:m.width)||0)).map(m=>Number.isFinite(m)&&m>0?m:0),w=c.filter(m=>m>0),h=w.length?w.reduce((m,B)=>m+B,0)/w.length:O>0?O/Math.max(1,i.length):100,N=c.map(m=>m>0?m:h),G=N.reduce((m,B)=>m+B,0);U+="<colgroup>",i.forEach((m,B)=>{const K=N[B],Z=G>0?`${K/G*100}%`:"";U+=Z?`<col style="width:${Z};" />`:"<col />"}),U+="</colgroup>"}return s.length&&(U+="<thead>",s.forEach(c=>{const w=y?` style="height:${y};"`:"";U+=`<tr${w}>`,c.forEach(h=>{var ke,ze,qe,Ce;const N=ut((h==null?void 0:h.title)||(h==null?void 0:h.text)||(h==null?void 0:h.label)||""),G=Number((h==null?void 0:h.rowspan)||(h==null?void 0:h.rowSpan)||1)||1,m=Number((h==null?void 0:h.colspan)||(h==null?void 0:h.colSpan)||1)||1,B=String((h==null?void 0:h.halign)||(h==null?void 0:h.align)||d||"left"),K=!!((Ce=(qe=(ze=(ke=h==null?void 0:h.autoWrap)!=null?ke:h==null?void 0:h.tableAutoWrap)!=null?ze:h==null?void 0:h.wrap)!=null?qe:h==null?void 0:h.wordWrap)!=null&&Ce),Z=["border:1px solid #000","padding:2px 4px",`text-align:${B}`,K?"white-space:normal":"white-space:nowrap",K?"word-break:break-all":"",K?"overflow-wrap:anywhere":"","box-sizing:border-box",`font-weight:${f||"600"}`,g?`font-family:${g}`:"",l?`background:${l}`:"",u?`font-size:${u}`:"",S?`line-height:${S}`:"",y?`height:${y}`:"",y?`min-height:${y}`:"",!S&&y?`line-height:${y}`:"","print-color-adjust:exact","-webkit-print-color-adjust:exact"].filter(Boolean).join(";");U+=`<th rowspan="${G}" colspan="${m}" style="${Z}">${N}</th>`}),U+="</tr>"}),U+="</thead>"),U+="<tbody>",wt.forEach((c,w)=>{const h=C?` style="height:${C};"`:"";U+=`<tr${h}>`,t.forEach((N,G)=>{var ze,qe,Ce,Xt;const m=V(V({},a[N]||{}),i[G]||{}),B=String((m==null?void 0:m.align)||d||"left"),K=!!((Xt=(Ce=(qe=(ze=m==null?void 0:m.autoWrap)!=null?ze:m==null?void 0:m.tableAutoWrap)!=null?qe:m==null?void 0:m.wrap)!=null?Ce:m==null?void 0:m.wordWrap)!=null&&Xt),Z=["border:1px solid #000","padding:2px 4px",`text-align:${B}`,K?"white-space:normal":"white-space:nowrap",K?"word-break:break-all":"",K?"overflow-wrap:anywhere":"","box-sizing:border-box",J?`font-family:${J}`:"",p?`font-size:${p}`:"",b?`font-weight:${b}`:"",C?`height:${C}`:"",C?`min-height:${C}`:"",F?`line-height:${F}`:"",!F&&C?`line-height:${C}`:""].filter(Boolean).join(";");if(!N){U+=`<td style="${Z}"></td>`;return}if(tn.has(G)){const Zt=Yt(w,N),an=w>0?Yt(w-1,N):null,er=w>0&&nn(Zt,an),sn=fe(Zt,m,N),on=er?' class="qhmes-vmerge-continue"':"",un=er?"border-left:1px solid #000;border-right:1px solid #000;border-bottom:1px solid #000;border-top:none;":"border:1px solid #000;",dn=Z.replace("border:1px solid #000;",un);U+=`<td${on} style="${dn};vertical-align:middle;">${sn}</td>`;return}const ke=fe(c==null?void 0:c[N],m,N);U+=`<td style="${Z}">${ke}</td>`}),U+="</tr>"}),U+="</tbody></table>",U}typeof globalThis!="undefined"&&(globalThis.__QH_BUILD_MERGE_HTML__=It),typeof window!="undefined"&&(window.__QH_BUILD_MERGE_HTML__=It);function wr(e,r,t){const n=dt(e),s=Te(n),i=s.length?s.map(vt=>vt.field):He(e),a=lr(e),o=String((e==null?void 0:e.textAlign)||"left"),d=String((e==null?void 0:e.tableHeaderBackground)||"").trim(),l=X((e==null?void 0:e.tableHeaderFontSize)||(e==null?void 0:e.fontSize)),u=String((e==null?void 0:e.tableHeaderFontWeight)||"").trim(),f=String((e==null?void 0:e.tableHeaderFontFamily)||(e==null?void 0:e.fontFamily)||"").trim(),g=X((e==null?void 0:e.tableHeaderLineHeight)||(e==null?void 0:e.lineHeight)),S=X(e==null?void 0:e.tableHeaderRowHeight),y=X((e==null?void 0:e.tableBodyFontSize)||(e==null?void 0:e.fontSize)),p=String((e==null?void 0:e.tableBodyFontWeight)||(e==null?void 0:e.fontWeight)||"").trim(),b=String((e==null?void 0:e.tableBodyFontFamily)||(e==null?void 0:e.fontFamily)||"").trim(),J=X((e==null?void 0:e.tableBodyLineHeight)||(e==null?void 0:e.lineHeight)),F=X(e==null?void 0:e.tableBodyRowHeight),C=Number((e==null?void 0:e.width)||0),O=t||{},ie=String((e==null?void 0:e.field)||(e==null?void 0:e.dataIndex)||(e==null?void 0:e.bindField)||(e==null?void 0:e.fieldName)||(O==null?void 0:O.field)||(O==null?void 0:O.dataIndex)||(O==null?void 0:O.bindField)||(O==null?void 0:O.fieldName)||"").trim(),fe=H(ie.split(/[.[]/)[0]||ie),ce={leafFields:[...i],selectedFields:[...r],headerRows:JSON.parse(JSON.stringify(n)),bodyColumns:JSON.parse(JSON.stringify(s)),columnMetaMap:JSON.parse(JSON.stringify(a)),tableRowsFieldRoot:fe,defaultBodyAlign:o,headerBg:d,headerFontSize:l,headerFontWeight:u,headerFontFamily:f,headerLineHeight:g,headerRowHeight:S,bodyFontSize:y,bodyFontWeight:p,bodyFontFamily:b,bodyLineHeight:J,bodyRowHeight:F,tableWidthPx:C},Ve=JSON.stringify(ce);return new Function("data",`try{var b=null;try{if(typeof globalThis!=='undefined'&&globalThis.__QH_BUILD_MERGE_HTML__)b=globalThis.__QH_BUILD_MERGE_HTML__;}catch(e0){}if(!b)try{if(typeof window!=='undefined'&&window.__QH_BUILD_MERGE_HTML__)b=window.__QH_BUILD_MERGE_HTML__;}catch(e1){}if(!b)try{if(typeof window!=='undefined'&&window.top&&window.top!==window&&window.top.__QH_BUILD_MERGE_HTML__)b=window.top.__QH_BUILD_MERGE_HTML__;}catch(e2){}if(!b){return'<table></table>';}return b(data,JSON.parse(${JSON.stringify(Ve)}));}catch(e){return'<table><tbody><tr><td>表格渲染失败</td></tr></tbody></table>';}`)}function Sr(e){if(!e||!Array.isArray(e.panels))return 0;let r=0;const t=e.panels||[];for(const n of t){const s=Array.isArray(n==null?void 0:n.printElements)?n.printElements:[];for(const i of s){if(!ae(i))continue;const a=(i==null?void 0:i.options)||{},o=(i==null?void 0:i.printElementType)||{},d=cr(a,o);if(!d.length)continue;const l=dr(a),u=new Set(l.map(S=>H(String(S||""))).filter(Boolean)),f=d.some(S=>u.has(H(S)));if(!l.length||!f)continue;const g=wr(a,d,o);a.formatter=g,a.gridColumns=1,i.options=a,i.printElementType=i.printElementType||{},i.printElementType.formatter=g,i.printElementType.gridColumns=1,r+=1}}return r}function Ar(e){if(!e||!Array.isArray(e.panels))return"";const r=[],t=e.panels||[];for(const n of t){const s=Array.isArray(n==null?void 0:n.printElements)?n.printElements:[];for(const i of s){if(!ae(i))continue;const a=(i==null?void 0:i.options)||{};if(!He(a).length)continue;const d=dt(a),l=Math.max(1,d.length||1),u=vr(a),f=X(a==null?void 0:a.tableHeaderRowHeight),g=X((a==null?void 0:a.tableHeaderFontSize)||(a==null?void 0:a.fontSize)),S=String((a==null?void 0:a.tableHeaderFontWeight)||"").trim(),y=String((a==null?void 0:a.tableHeaderFontFamily)||(a==null?void 0:a.fontFamily)||"").trim(),p=X((a==null?void 0:a.tableHeaderLineHeight)||(a==null?void 0:a.lineHeight)),b=X((a==null?void 0:a.tableBodyFontSize)||(a==null?void 0:a.fontSize)),J=String((a==null?void 0:a.tableBodyFontWeight)||(a==null?void 0:a.fontWeight)||"").trim(),F=String((a==null?void 0:a.tableBodyFontFamily)||(a==null?void 0:a.fontFamily)||"").trim(),C=X((a==null?void 0:a.tableBodyLineHeight)||(a==null?void 0:a.lineHeight)),O=X(a==null?void 0:a.tableBodyRowHeight);if(!u&&!f&&!O)continue;const ie=`table thead tr:nth-child(-n+${l}) th,table thead tr:nth-child(-n+${l}) td`,fe=[u?`background:${u} !important`:"",f?`height:${f} !important`:"",f?`min-height:${f} !important`:"",p?`line-height:${p} !important`:"",!p&&f?`line-height:${f} !important`:"",g?`font-size:${g} !important`:"",S?`font-weight:${S} !important`:"",y?`font-family:${y} !important`:"","print-color-adjust:exact !important","-webkit-print-color-adjust:exact !important"].filter(Boolean).join(";");r.push(`${ie}{${fe};}`),f&&r.push(`table thead tr:nth-child(-n+${l}){height:${f} !important;}`),O&&r.push(`table tbody tr{height:${O} !important;}table tbody tr td{height:${O} !important;min-height:${O} !important;line-height:${O} !important;}`);const ce=[b?`font-size:${b} !important`:"",J?`font-weight:${J} !important`:"",F?`font-family:${F} !important`:"",C?`line-height:${C} !important`:""].filter(Boolean).join(";");ce&&r.push(`table tbody td{${ce};}`)}}return r.length?`*{print-color-adjust:exact !important;-webkit-print-color-adjust:exact !important;}${r.join("")}`:""}function Fr(e){const r=Array.isArray(e==null?void 0:e.panels)&&e.panels.length?e.panels[0]:null;if(!r||typeof r!="object")return"";const t=Number((r==null?void 0:r.width)||0),n=Number((r==null?void 0:r.height)||0);if(!Number.isFinite(t)||!Number.isFinite(n)||t<=0||n<=0)return"";const s=t>n?"landscape":"portrait";return`@page{size:${t}mm ${n}mm ${s};margin:0;}html,body{width:${t}mm !important;height:${n}mm !important;}`}function _r(){const r=P(x.value).flatMap(t=>nt[t]||[]);return Array.from(new Set(r)).sort((t,n)=>t-n)}function xr(){const e=P(x.value,!1),r=new Map(te.value.map(t=>[t.value,t.label]));return e.map(t=>[t,r.get(t)||t]).flat().map(t=>String(t||"").replace(/\s+/g,"").trim()).filter(Boolean)}function Er(e){var a,o;const r=xr();if(!r.length)return[];const t=(o=(a=e.tHead)==null?void 0:a.rows)!=null&&o.length?Array.from(e.tHead.rows):Array.from(e.querySelectorAll("tr")).slice(0,2);if(!t.length)return[];const n=t[t.length-1],s=Array.from(n.cells),i=[];return s.forEach((d,l)=>{const u=Pt(d);r.includes(u)&&i.push(l+1)}),Array.from(new Set(i))}function Pt(e){return e?(e.textContent||"").replace(/\u00a0/g,"").replace(/\s+/g,"").trim():""}function zt(){return Array.from(document.querySelectorAll("iframe"))}function qt(){return new Set(zt())}function Me(e){const r=document.querySelector("#hiwprint_iframe");if(r)return r;const n=zt().filter(a=>!!a.contentDocument);if(e){const a=n.filter(o=>!e.has(o));if(a.length)return a.find(d=>{var l;return(l=d.contentDocument)==null?void 0:l.querySelector("table")})||a[a.length-1]}const s=n.find(a=>/print/i.test(a.id||"")||/print/i.test(a.className||""));return s||n.find(a=>{var o;return(o=a.contentDocument)==null?void 0:o.querySelector("table")})||n[n.length-1]||null}function Tr(e){const r=e||Me(),t=r==null?void 0:r.contentDocument;if(!r||!t)return!1;const n=Array.from(t.querySelectorAll("table"));if(!n.length)return!1;let s=!1;return n.forEach(i=>{var u;const a=Er(i),o=_r(),d=(a.length?a:o).sort((f,g)=>g-f);if(!d.length)return;const l=(u=i.tBodies)!=null&&u.length?Array.from(i.tBodies[0].rows):Array.from(i.rows).slice(1);l.length&&d.forEach(f=>{const g=f-1;let S=null,y="";l.forEach(p=>{const b=p.cells[g];if(!b)return;const J=Pt(b);if(!!S&&(J===""||J===y)){const C=Math.max(S.rowSpan||1,1)+1;S.rowSpan=C,S.setAttribute("rowspan",String(C)),S.style.textAlign="center",S.style.verticalAlign="middle",b.remove(),s=!0;return}S=b,y=J,S.style.textAlign="center",S.style.verticalAlign="middle"})})}),s}function lt(e,r=40,t=80){return Q(this,null,function*(){for(let n=0;n<r;n+=1){if(Tr(e?e():null))return!0;yield new Promise(i=>setTimeout(i,t))}return!1})}function $r(e,r,t){return Q(this,null,function*(){const n=qt();try{t?e.preview(r,{},{styleHandler:()=>`<style>${t}</style>`}):e.preview(r)}catch(o){return!1}const s=()=>Me(n),i=yield lt(s),a=s();if(i&&(a!=null&&a.contentWindow))try{return a.contentWindow.focus(),a.contentWindow.print(),!0}catch(o){return!1}return!1})}function Ct(e){if(!e||!Array.isArray(e.panels))return[];const r=e.panels||[];for(const t of r){const n=Array.isArray(t==null?void 0:t.printElements)?t.printElements:[];for(const s of n){if(!ae(s))continue;const i=(s==null?void 0:s.options)||{},a=[i.columns,i.tableColumns,i.headerColumns];for(const o of a){const d=$t(o);if(d.length)return d}if(Array.isArray(i.fields)&&i.fields.length)return[{id:Tt("group"),title:"默认分组",columns:i.fields.map(o=>Je(typeof o=="string"?{field:o,title:o}:o))}]}}return[]}function P(e,r=!0){const n=(Array.isArray(e)?e:[]).map(i=>String(i||"").trim()).filter(Boolean).filter((i,a,o)=>o.indexOf(i)===a);if(!r)return n;const s=new Set(te.value.map(i=>i.value));return n.filter(i=>s.has(i))}function ft(e){if(!e||typeof e!="object")return[];let r=[];if(Ee(e,s=>{var d;if(r.length)return;const i=s.options||{},a=s.printElementType||{},o=(d=i[ye])!=null?d:a[ye];Array.isArray(o)&&o.length&&(r=o.map(l=>String(l||"").trim()).filter(Boolean))}),r.length)return P(r);const t=e.ext,n=(t==null?void 0:t.mergeCenterFields)||(t==null?void 0:t.mergeFields)||[];return P(n)}function Nr(e){return!Array.isArray(e)||!e.length?[]:Array.isArray(e[0])?e.map(r=>Array.isArray(r)?r:[]):[e]}function Ue(e){if(!e||typeof e!="object")return[];const r=e.panels||[];for(const t of r){const n=Array.isArray(t==null?void 0:t.printElements)?t.printElements:[];for(const s of n){if(!ae(s))continue;const i=(s==null?void 0:s.options)||{},a=(s==null?void 0:s.printElementType)||{},o=[i==null?void 0:i.columns,i==null?void 0:i.tableColumns,i==null?void 0:i.headerColumns,a==null?void 0:a.columns,a==null?void 0:a.tableColumns,a==null?void 0:a.headerColumns];for(const d of o){if(!Array.isArray(d)||!d.length)continue;const l=Nr(d);if(Array.isArray(l)&&l.length)return R(l)}}}return[]}function le(e){var n;if(!e||typeof e!="object")return[];const r=Ue(e);if(r.length)return R(r);const t=(n=e==null?void 0:e.ext)==null?void 0:n.customHeaderRows;return Array.isArray(t)&&t.length?R(t):[]}function Ge(e,r){if(!e||typeof e!="object")return{template:e,rows:[]};const t=e,n=Array.isArray(r)&&r.length?r:Ue(t),s=R(n);return{template:t,rows:s}}function kr(e){if(!Array.isArray(e)||!e.length)return[];const r=$t(e);return r.length?r.map(t=>({title:String((t==null?void 0:t.title)||"").trim()||"未命名分组",fields:((t==null?void 0:t.columns)||[]).map(n=>H((n==null?void 0:n.field)||(n==null?void 0:n.dataIndex)||(n==null?void 0:n.key)||(n==null?void 0:n.name)||"")).filter(Boolean)})).filter(t=>t.fields.length>0):[]}function Ie(e,r){const t=e||{},n=Array.isArray(r)&&r.length?R(r):null;return Ee(t,s=>{const i=s.options||{},a=s.printElementType||{};let o=null;if(n&&n.length)o=n;else{const l=i.columns||a.columns;Array.isArray(l)&&l.length&&(o=l)}const d=o?kr(o):[];d.length?(i[Oe]=d,a[Oe]=d):(delete i[Oe],delete a[Oe]),s.options=i,s.printElementType=a}),t}function Pe(e,r){const t=e||{},n=P(r,!1);return Ee(t,s=>{const i=s.options||{};i[ye]=[...n],s.options=i}),De(t),t}function Hr(e,r){var t;return et.value.has(r)&&(t=xt.value[`${e}_${r}`])!=null?t:1}function Or(e,r){return et.value.has(r)?xt.value[`${e}_${r}`]!==0:!0}function ct(e){const r=Ue(e);return r.length?JSON.stringify(R(r)):""}function M(e){return JSON.stringify(e,null,2)}function Wt(e){return JSON.stringify(R(e||[]))}function Lt(e=!1){if(!e&&Date.now()<Et)return;let r=yt();if(!r&&_.value)try{r=JSON.parse(_.value)}catch(l){r=null}if(!r)return;let t=le(r);if(!t.length)return;if(_.value)try{const l=JSON.parse(_.value),u=le(l);u.length&&(t=Bt(t,u))}catch(l){}const n=Wt(t),s=Wt(E.value);if(!e&&n===s)return;const i=Ge(r,t);it=!0,E.value=i.rows,it=!1,ve(r),x.value=P(x.value);const a=P(x.value,!1),o=Pe(r,a);Ge(o,i.rows),je(o),Ie(o,R(E.value)),we(o);const d=M(o);d!==_.value&&(_.value=d)}function gt(e=!1){be&&(window.clearTimeout(be),be=null),be=window.setTimeout(()=>{Lt(e),be=null},180)}function Dt(){Et=Date.now()+1500,re&&(window.clearTimeout(re),re=null),re=window.setTimeout(()=>{Ne(!1,!1),re=null},120)}function yt(){if(!W)return null;const e=[()=>typeof W.getJson=="function"?W.getJson():null,()=>typeof W.toJson=="function"?W.toJson():null,()=>typeof W.getTemplate=="function"?W.getTemplate():null,()=>typeof W.getData=="function"?W.getData():null,()=>W.template,()=>W.data,()=>W._template,()=>W.printTemplate];for(const r of e)try{const t=r();if(t&&typeof t=="object")return JSON.parse(JSON.stringify(t))}catch(t){}return null}function L(e,r){try{return{ok:!0,data:JSON.parse(e||"{}")}}catch(t){return $.error(`${r} 不是合法JSON:${(t==null?void 0:t.message)||"未知错误"}`),{ok:!1,data:null}}}function Rr(e){const r=(e==null?void 0:e.default)||{};return pe=(e==null?void 0:e.hiprint)||(r==null?void 0:r.hiprint)||(window==null?void 0:window.hiprint),pe}function Jr(){return Q(this,null,function*(){var n;const e=yield mn(()=>import("./vue-plugin-hiprint-f7b0vEHA.js").then(s=>s.v),__vite__mapDeps([0,1,2,3,4,5,6,7])),r=Rr(e);if(!r)throw new Error("未获取到 hiprint 实例");r.init({providers:En(e)});const t=(window==null?void 0:window.$)||(window==null?void 0:window.jQuery);t&&((n=r==null?void 0:r.PrintElementTypeManager)!=null&&n.buildByHtml)&&r.PrintElementTypeManager.buildByHtml(t(".ep-draggable-item"))})}function ht(e){return Q(this,null,function*(){if(!pe)return;const r=JSON.parse(JSON.stringify(e||{}));yield Ze(),rt=!0;const t=document.querySelector("#hiprint-printTemplate");t&&(t.innerHTML=""),me&&(me.disconnect(),me=null),W=new pe.PrintTemplate({template:r,settingContainer:"#PrintElementOptionSetting",paginationContainer:".hiprint-printPagination",history:!0,onDataChanged:(n,s)=>{if(rt)return;ve(s);const i=P(x.value);x.value=i;let a=le(s);if(a.length&&_.value)try{const l=JSON.parse(_.value),u=le(l);u.length&&(a=Bt(a,u))}catch(l){}a.length&&(E.value=R(a));const o=Pe(s,i),d=Ge(o,a.length?a:E.value);E.value=d.rows,je(o),Ie(o,R(E.value)),we(o),_.value=M(o),x.value=P(x.value),gt(!1)}}),W.design("#hiprint-printTemplate"),t&&(me=new MutationObserver(()=>{gt(!1)}),me.observe(t,{childList:!0,subtree:!0,attributes:!0,characterData:!0})),rt=!1})}function Br(){return Q(this,null,function*(){if(Ae.value!=="setting"||!W)return;yield Ze();const e=document.querySelector("#PrintElementOptionSetting");if(e&&!e.children.length){const r=L(_.value,"模板JSON");if(!r.ok)return;yield ht(r.data)}})}function Qe(){return Q(this,null,function*(){const e=L(_.value,"模板JSON");if(!e.ok)return;ot(e.data),we(e.data);const r=Ge(e.data);ue=[],ve(r.template),x.value=ft(r.template),E.value=r.rows,_.value=M(r.template),yield ht(r.template),$.success("模板JSON已应用")})}function jt(){const e=L(_.value,"模板JSON");if(!e.ok)return null;ot(e.data),we(e.data),ve(e.data),x.value=P(x.value,!1),ue=se(R(E.value)),at=Ar(e.data),st=Fr(e.data);const r=Sr(e.data);r||mr(e.data);try{return{instance:new pe.PrintTemplate({template:e.data}),formatterApplied:r>0}}catch(t){return $.error(`创建打印实例失败:${(t==null?void 0:t.message)||"未知错误"}`),null}}function Mt(e,r=0){const t=String(e||"").toLowerCase();return t.includes("date")||t.includes("time")?`2026-04-${String(r%9+1).padStart(2,"0")} 08:30:00`:t.includes("no")||t.endsWith("code")||t.includes("id")?`NO-${String(r+1).padStart(3,"0")}`:t.includes("qty")||t.includes("num")||t.includes("count")||t.includes("amount")||t.includes("price")?(r+1)*10:t.includes("rate")||t.includes("percent")?`${90+r}%`:t.includes("phone")||t.includes("mobile")||t.includes("tel")?`1380000${String(1e3+r).slice(-4)}`:t.includes("name")?`样例${r+1}`:t.includes("remark")||t.includes("desc")?`备注${r+1}`:`${e}_${r+1}`}function Ir(){var e;_e.value=!0;try{const r=yt();let t=r||{};if(!r){const l=L(_.value,"模板JSON");if(!l.ok)return;t=l.data||{}}ve(t);const n=new Set,s=new Set,i=new Set;(Array.isArray(t==null?void 0:t.panels)?t.panels:[]).forEach(l=>{(Array.isArray(l==null?void 0:l.printElements)?l.printElements:[]).forEach(f=>{var S,y,p,b,J,F,C,O;const g=Ht(f);if(g.length)if(fr(f)){g.forEach(ce=>n.add(ce));const ie=((S=f==null?void 0:f.options)==null?void 0:S.field)||((y=f==null?void 0:f.options)==null?void 0:y.dataIndex)||((p=f==null?void 0:f.options)==null?void 0:p.bindField)||((b=f==null?void 0:f.options)==null?void 0:b.fieldName)||((J=f==null?void 0:f.printElementType)==null?void 0:J.field)||((F=f==null?void 0:f.printElementType)==null?void 0:F.dataIndex)||((C=f==null?void 0:f.printElementType)==null?void 0:C.bindField)||((O=f==null?void 0:f.printElementType)==null?void 0:O.fieldName),fe=H(ie);fe&&s.add(String(fe).split(".")[0])}else g.forEach(ie=>i.add(ie))})}),!n.size&&!i.size&&(te.value||[]).forEach(l=>n.add(H(l==null?void 0:l.value)));const o={};Array.from(i).forEach((l,u)=>{o[l]=Mt(l,u)});const d=Array.from(n).filter(Boolean);if(d.length){const l=Array.from({length:5},(S,y)=>{const p={};return d.forEach(b=>{p[b]=Mt(b,y)}),p}),u=L(ne.value||"{}","打印数据JSON"),f=u.ok&&u.data&&typeof u.data=="object"?u.data:{},g=Array.from(s)[0]||Object.keys(f).find(S=>Array.isArray(f[S]))||(Array.isArray((e=he.value)==null?void 0:e.mainTable)?"mainTable":"")||"mainTable";o[g]=l}if(!Object.keys(o).length){$.warning("模板中未识别到可绑定字段,无法生成匹配数据");return}ne.value=M(o),$e(!1),$.success("已根据模板生成匹配的打印数据JSON")}finally{_e.value=!1}}function $e(e=!0){const r=L(ne.value,"打印数据JSON");r.ok&&(he.value=r.data,e&&$.success("打印数据已应用"))}function pt(){const e=L(_.value,"模板JSON");e.ok&&(_.value=M(e.data))}function Pr(){const e=L(ne.value,"打印数据JSON");e.ok&&(ne.value=M(e.data))}function Ut(){return Q(this,null,function*(){if($e(!1),!W){$.warning("设计器尚未初始化");return}const e=jt();if(!e)return;const r=e.instance,t=`${st}${Rt()}${at}`,n=e.formatterApplied?he.value||{}:Jt(he.value||{}),s=qt();try{t?r.preview(n,{},{styleHandler:()=>`<style>${t}</style>`}):r.preview(n),!sr&&!e.formatterApplied&<(()=>Me(s))}catch(i){try{r.preview(n),!sr&&!e.formatterApplied&<(()=>Me(s))}catch(a){$.error(`预览失败:${(a==null?void 0:a.message)||"未知错误"}`)}}})}function zr(){return Q(this,null,function*(){if($e(!1),!W){$.warning("设计器尚未初始化");return}const e=jt();if(!e)return;const r=e.instance,t=`${st}${Rt()}${at}`,n=e.formatterApplied?he.value||{}:Jt(he.value||{});if(!(!e.formatterApplied&&(yield $r(r,n,t))))try{if(t){r.print(n,{},{styleHandler:()=>`<style>${t}</style>`});return}r.print(n)}catch(s){try{r.print(n)}catch(i){$.error(`打印失败:${(i==null?void 0:i.message)||"未知错误"}`)}}})}function qr(){_.value=M(We),Qe()}function Cr(){ne.value=M(nr),$e()}function Wr(){const e=L(_.value,"模板JSON");if(e.ok){if(ue=[],ve(e.data),!te.value.length){$.warning("模板中未识别到可绑定字段,请确认已配置表格列字段");return}x.value=ft(e.data),E.value=le(e.data),$.success("已从模板JSON读取合并列配置")}}function Lr(){const e=L(_.value,"模板JSON");if(!e.ok)return;if(ue=[],ve(e.data),!te.value.length){$.warning("模板中未识别到可绑定字段,请确认表格列已绑定 field");return}if(!Ct(e.data).length){$.warning("模板JSON中未识别到可解析的表格列结构");return}x.value=P(x.value);const t=le(e.data);t.length&&(E.value=t),$.success("已按模板表格结构刷新可选字段")}function Dr(){const e=L(_.value,"模板JSON");if(!e.ok)return;ue=[];const r=le(e.data);E.value=R(r),$.success("表头结构已加载")}function jr(e){const r=R(e),t=Te(r);if(t.length)return t.length;const n=r.reduce((s,i)=>{const a=(i||[]).reduce((o,d)=>{const l=Number((d==null?void 0:d.colspan)||(d==null?void 0:d.colSpan)||1)||1;return o+Math.max(1,l)},0);return Math.max(s,a)},0);return Math.max(1,n)}function Gt(e){const r=se(R(e)),t=[],n=[];for(let s=0;s<r.length;s+=1){const i=r[s]||[];let a=0;const o=[];i.forEach(d=>{var f;for(;(f=t[s])!=null&&f[a];)a+=1;const l=Number((d==null?void 0:d.colspan)||(d==null?void 0:d.colSpan)||1)||1,u=Number((d==null?void 0:d.rowspan)||(d==null?void 0:d.rowSpan)||1)||1;o.push({cell:d,start:a,colspan:Math.max(1,l),rowspan:Math.max(1,u)});for(let g=s;g<Math.min(r.length,s+u);g+=1){t[g]=t[g]||[];for(let S=a;S<a+l;S+=1)t[g][S]=!0}a+=l}),n.push(o)}return n}function bt(){const e=jr(E.value),r=Array.from({length:e},(t,n)=>({title:`新表头${e>1?n+1:""}`,field:"",rowspan:1,colspan:1,halign:"center",align:"center",autoWrap:!1}));E.value.unshift(r),Ne(!1,!0)}function Mr(e){const r=se(R(E.value));if(e<0||e>=r.length)return;const t=Gt(r),s=(t[e]||[]).filter(i=>i.rowspan>1).map(i=>({start:i.start,cell:Ke(V({},i.cell),{rowspan:Math.max(1,i.rowspan-1),colspan:Math.max(1,i.colspan)})}));for(let i=0;i<e;i+=1)(t[i]||[]).forEach(a=>{a.rowspan>1&&i+a.rowspan-1>=e&&(a.cell.rowspan=Math.max(1,a.rowspan-1))});if(r.splice(e,1),s.length&&r.length){const i=Math.min(e,r.length-1),o=(Gt(r)[i]||[]).map(u=>({start:u.start,order:1,cell:u.cell})),l=[...s.map(u=>({start:u.start,order:0,cell:u.cell})),...o].sort((u,f)=>u.start!==f.start?u.start-f.start:u.order-f.order);r[i]=l.map(u=>u.cell)}if(E.value=r,!E.value.length){bt();return}Ne(!1,!0)}function Ur(e){E.value[e].push({title:"新列",field:"",rowspan:1,colspan:1,halign:"center",align:"center",autoWrap:!1}),Ne(!1,!0)}function Gr(e,r){if(E.value[e].splice(r,1),E.value[e].length||E.value.splice(e,1),!E.value.length){bt();return}Ne(!1,!0)}function Ne(e=!0,r=!1){return Q(this,null,function*(){const t=L(_.value,"模板JSON");if(!t.ok)return;E.value=R(E.value);const n=Pe(t.data||{},P(x.value,!1)),s=je(n);Ie(n,R(E.value)),we(n),_.value=M(n),s||$.warning("未在模板中定位到可编辑表格元素,画布暂未更新"),r&&pe&&(ue=[],yield ht(n)),e&&s&&$.success("表头结构已写入模板JSON")})}function Qr(){const e=L(_.value,"模板JSON");if(!e.ok)return;const r=P(x.value);x.value=r;const t=Pe(e.data||{},r);Ie(t,R(E.value)),we(t),_.value=M(t),$.success("已写入 qhmesColumnGroups(列分组)与 qhmesMergeCenterFields(行合并列)到模板 JSON")}function Qt(e){if(e==null||e==="")return null;const r=Number(e);return Number.isFinite(r)&&r>0?r:null}function Vr(e,r){var d,l,u,f;const t=Qt((d=r.paperWidthMm)!=null?d:r.paper_width_mm),n=Qt((l=r.paperHeightMm)!=null?l:r.paper_height_mm);if(t==null||n==null)return;const s=String((f=(u=r.paperOrientation)!=null?u:r.paper_orientation)!=null?f:"portrait").toLowerCase(),i=s==="landscape"?n:t,a=s==="landscape"?t:n;(Array.isArray(e==null?void 0:e.panels)?e.panels:[]).forEach(g=>{!g||typeof g!="object"||(g.width=i,g.height=a,g.paperType="")})}function Kr(e){if(!e||typeof e!="object")return JSON.parse(JSON.stringify(We));if(Array.isArray(e.panels)&&e.panels.length>0)return e;const t=JSON.parse(JSON.stringify(We)),n=V(V({},t),e);return n.panels=t.panels,n}function Vt(){return Q(this,null,function*(){var i;j.value=String(q.query.id||"");const e=M(We);if(_.value=e,ne.value=M(nr),$e(),x.value=[],E.value=R([]),!j.value)return;const r=yield St(j.value);if(!r)return;xe.value=String((i=r.templateName)!=null?i:"");const t=r.templateJson!=null?String(r.templateJson).trim():"";let n=null;if(t){const a=L(t,"模板JSON");if(!a.ok||!a.data){_.value=t,pt();return}n=JSON.parse(JSON.stringify(a.data))}else n=JSON.parse(JSON.stringify(We));n=Kr(n),Vr(n,r),ot(n),we(n),_.value=M(n),pt();const s=L(_.value,"模板JSON");s.ok&&s.data&&(ve(s.data),x.value=ft(s.data),E.value=le(s.data))})}function Yr(){return Q(this,null,function*(){var a,o;if(!j.value){$.warning("当前为新建状态,暂无模板ID,无法保存到后端");return}try{(o=(a=document==null?void 0:document.activeElement)==null?void 0:a.blur)==null||o.call(a)}catch(d){}yield Ze();const e=yt();let r=null;if(e)r=e;else{const d=L(_.value,"模板JSON");if(!d.ok)return;r=d.data||{}}const t=P(x.value);x.value=t;const n=Pe(r||{},t);je(n),Ie(n,R(E.value)),De(n),we(n);const s=M(n);_.value=s;const i=ct(n);Re.value=!0;try{yield Pn({id:j.value,templateJson:s});let d=yield St(j.value),l=String((d==null?void 0:d.templateJson)||"").trim(),u=L(l||"{}","服务端模板JSON"),f=u.ok?ct(u.data):"";if(i&&f!==i&&(yield zn({id:j.value,templateJson:s}),d=yield St(j.value),l=String((d==null?void 0:d.templateJson)||"").trim(),u=L(l||"{}","服务端模板JSON"),f=u.ok?ct(u.data):""),u.ok&&f===i){_.value=M(u.data),E.value=le(u.data),$.success("模板保存成功");return}$.error("保存请求已发送,但服务端回读结果未包含最新表头结构")}finally{Re.value=!1}})}function Xr(){I.push("/print/template")}function mt(e){const r=Array.isArray(e)?e[0]:e;return r==="1"||r===1||String(r!=null?r:"")==="1"}function Kt(){return Q(this,null,function*(){if(mt(q.query.quickPrintPreview)&&!tt){tt=!0;try{const e=sessionStorage.getItem(At);sessionStorage.removeItem(At);const r=String(q.query.id||"").trim(),t=()=>Q(null,null,function*(){try{r?yield I.replace({name:"print-designer",query:{id:r}}):yield I.replace({name:"print-designer",query:{}})}catch(a){r?yield I.replace({path:"/print/designer",query:{id:r}}):yield I.replace({path:"/print/designer",query:{}})}});if(!(e!=null&&e.trim())){yield t(),$.warning("未读取到快速打印预览数据");return}let n;try{n=JSON.parse(e)}catch(a){$.error("快速打印预览数据格式错误"),yield t();return}const s=String((n==null?void 0:n.dataJsonText)||"").trim();if(!s){$.warning("快速打印预览数据为空"),yield t();return}const i=L(s,"快速打印数据JSON");if(!i.ok||i.data==null){yield t();return}ne.value=M(i.data),$e(!1),yield Ze(),yield new Promise(a=>setTimeout(a,150)),yield Ut(),yield t()}finally{tt=!1}}})}return Nn(()=>Q(null,null,function*(){try{yield Jr(),yield Vt(),yield Qe(),mt(q.query.quickPrintPreview)&&(yield Kt())}catch(e){$.error(`打印设计器初始化失败:${(e==null?void 0:e.message)||"未知错误"}`)}})),Hn(()=>Q(null,null,function*(){try{if(!mt(q.query.quickPrintPreview)||!sessionStorage.getItem(At)||!pe)return;yield Vt(),yield Qe(),yield Kt()}catch(e){$.error(`快速打印预览失败:${(e==null?void 0:e.message)||"未知错误"}`)}})),Ye(Ae,()=>{Br()}),Ye(Fe,e=>{if(e){gt(!0),de&&window.clearInterval(de),de=window.setInterval(()=>{Lt(!1)},600);return}de&&(window.clearInterval(de),de=null),re&&(window.clearTimeout(re),re=null),Ne(!1,!1)}),Ye(te,()=>{x.value=P(x.value)},{deep:!0}),Ye(E,()=>{it||Fe.value&&Dt()},{deep:!0}),On(()=>{re&&(window.clearTimeout(re),re=null),be&&(window.clearTimeout(be),be=null),me&&(me.disconnect(),me=null),de&&(window.clearInterval(de),de=null),W=null,pe=null}),(e,r)=>{const t=Jn("a-button"),n=pn,s=qn,i=wn,a=vn,o=Sn,d=bn,l=An,u=Fn,f=Wn,g=_n,S=Cn;return z(),D("div",Ln,[T("div",Dn,[T("div",jn,[r[6]||(r[6]=T("span",{class:"toolbar-title"},"打印设计器",-1)),j.value?(z(),D("span",Mn,"模板ID: "+oe(j.value),1)):Xe("",!0),xe.value?(z(),D("span",Un,"模板名称: "+oe(xe.value),1)):Xe("",!0)]),T("div",Gn,[v(n,null,{default:A(()=>[v(t,{onClick:Xr},{default:A(()=>[...r[7]||(r[7]=[k("返回列表",-1)])]),_:1}),v(t,{onClick:qr},{default:A(()=>[...r[8]||(r[8]=[k("恢复默认模板",-1)])]),_:1}),v(t,{onClick:pt},{default:A(()=>[...r[9]||(r[9]=[k("格式化模板JSON",-1)])]),_:1}),v(t,{type:"primary",onClick:Qe},{default:A(()=>[...r[10]||(r[10]=[k("应用模板JSON",-1)])]),_:1}),v(t,{onClick:Ut},{default:A(()=>[...r[11]||(r[11]=[k("预览",-1)])]),_:1}),v(t,{onClick:zr},{default:A(()=>[...r[12]||(r[12]=[k("打印",-1)])]),_:1}),v(t,{type:"primary",loading:Re.value,onClick:Yr},{default:A(()=>[...r[13]||(r[13]=[k("保存模板",-1)])]),_:1},8,["loading"])]),_:1})])]),T("div",Qn,[T("div",Vn,[r[14]||(r[14]=T("div",{class:"panel-title"},"拖拽元素",-1)),T("div",Kn,[(z(!0),D(ge,null,Se(Rn(Tn),y=>(z(),D("div",{key:y.tid,class:"ep-draggable-item drag-item",tid:y.tid},[T("div",Xn,oe(y.label),1),T("div",Zn,oe(y.tip),1)],8,Yn))),128))]),r[15]||(r[15]=T("div",{class:"panel-title"},"数据字段建议",-1)),T("div",ea,[(z(!0),D(ge,null,Se(ir.value,y=>(z(),ar(s,{key:y},{default:A(()=>[k(oe(y),1)]),_:2},1024))),128))])]),r[27]||(r[27]=T("div",{class:"designer-panel center"},[T("div",{id:"hiprint-printTemplate",class:"hiprint-template-container"}),T("div",{class:"hiprint-printPagination"})],-1)),T("div",ta,[v(d,{activeKey:Ae.value,"onUpdate:activeKey":r[3]||(r[3]=y=>Ae.value=y),size:"small"},{default:A(()=>[v(a,{key:"template",tab:"模板JSON"},{default:A(()=>[v(i,{value:_.value,"onUpdate:value":r[0]||(r[0]=y=>_.value=y),rows:18,placeholder:"唯一模板 JSON:panels;表头在 type=table 的 options.columns;列分组结构 options.qhmesColumnGroups({title,fields[]});行合并列 options.qhmesMergeCenterFields;保存/应用时会去掉非表格上的误写列并压缩与 columns 相同的重复键"},null,8,["value"])]),_:1}),v(a,{key:"data",tab:"打印数据JSON"},{default:A(()=>[v(i,{value:ne.value,"onUpdate:value":r[1]||(r[1]=y=>ne.value=y),rows:18,placeholder:"请填写合法的打印数据JSON"},null,8,["value"]),v(n,{class:"json-actions"},{default:A(()=>[v(t,{size:"small",onClick:Cr},{default:A(()=>[...r[16]||(r[16]=[k("加载默认数据",-1)])]),_:1}),v(t,{size:"small",loading:_e.value,onClick:Ir},{default:A(()=>[...r[17]||(r[17]=[k("智能生成匹配数据",-1)])]),_:1},8,["loading"]),v(t,{size:"small",onClick:Pr},{default:A(()=>[...r[18]||(r[18]=[k("格式化数据JSON",-1)])]),_:1}),v(t,{size:"small",type:"primary",onClick:$e},{default:A(()=>[...r[19]||(r[19]=[k("应用数据JSON",-1)])]),_:1})]),_:1})]),_:1}),v(a,{key:"group",tab:"列分组"},{default:A(()=>[T("div",ra,[v(n,null,{default:A(()=>[v(t,{size:"small",onClick:Wr},{default:A(()=>[...r[20]||(r[20]=[k("从模板JSON读取",-1)])]),_:1}),v(t,{size:"small",onClick:Lr},{default:A(()=>[...r[21]||(r[21]=[k("从模板表格解析",-1)])]),_:1}),v(t,{size:"small",type:"primary",onClick:Qr},{default:A(()=>[...r[22]||(r[22]=[k("写入右侧模板JSON",-1)])]),_:1})]),_:1})]),r[25]||(r[25]=T("div",{class:"group-bound-tip",style:{"margin-top":"8px"}}," 点击「写入右侧模板JSON」会同步:qhmesColumnGroups(分组标题 + 末级字段列表)、qhmesMergeCenterFields(行合并列),与画布共用同一份 JSON。 ",-1)),T("div",na,[r[23]||(r[23]=T("span",null,"可选绑定字段:",-1)),(z(!0),D(ge,null,Se(te.value,y=>(z(),ar(s,{key:y.value},{default:A(()=>[k(oe(y.value),1)]),_:2},1024))),128)),te.value.length?Xe("",!0):(z(),D("span",aa,"未识别到字段,请先点击“从模板表格解析”"))]),v(o,{value:x.value,"onUpdate:value":r[2]||(r[2]=y=>x.value=y),mode:"multiple",options:te.value,style:{width:"100%"},placeholder:"请选择需要合并居中显示的列(可多选)","show-search":"","option-filter-prop":"label"},null,8,["value","options"]),T("div",sa,[r[24]||(r[24]=T("div",{class:"panel-title"},"合并效果预览",-1)),T("table",ia,[T("thead",null,[T("tr",null,[(z(!0),D(ge,null,Se(Ft.value,y=>(z(),D("th",{key:y.value},oe(y.label),1))),128))])]),T("tbody",null,[(z(!0),D(ge,null,Se(_t.value,(y,p)=>(z(),D("tr",{key:`preview_row_${p}`},[(z(!0),D(ge,null,Se(Ft.value,b=>(z(),D(ge,{key:`${p}_${b.value}`},[Or(p,b.value)?(z(),D("td",{key:0,rowspan:Hr(p,b.value),class:In({"merge-cell":et.value.has(b.value)})},oe(y==null?void 0:y[b.value]),11,oa)):Xe("",!0)],64))),128))]))),128))])])])]),_:1}),v(a,{key:"setting",tab:"元素属性","force-render":!0},{default:A(()=>[...r[26]||(r[26]=[T("div",{id:"PrintElementOptionSetting",class:"hiprint-setting-container"},null,-1),T("div",{class:"setting-tip"},"在设计区域选中元素后,可在此处修改属性。",-1)])]),_:1})]),_:1},8,["activeKey"])])]),v(t,{class:"header-drawer-trigger",type:"primary",onClick:r[4]||(r[4]=y=>Fe.value=!0)},{default:A(()=>[...r[28]||(r[28]=[k("表头结构设计",-1)])]),_:1}),v(S,{open:Fe.value,"onUpdate:open":r[5]||(r[5]=y=>Fe.value=y),title:"表头结构编辑",placement:"bottom",height:360,mask:!1,"get-container":!1,style:{position:"absolute"},class:"header-drawer"},{default:A(()=>[T("div",ua,[v(n,{class:"header-editor-toolbar"},{default:A(()=>[v(t,{size:"small",onClick:Dr},{default:A(()=>[...r[29]||(r[29]=[k("读取表头",-1)])]),_:1}),v(t,{size:"small",onClick:bt},{default:A(()=>[...r[30]||(r[30]=[k("新增表头行",-1)])]),_:1}),v(t,{size:"small",type:"primary",onClick:Ne},{default:A(()=>[...r[31]||(r[31]=[k("写入模板JSON",-1)])]),_:1})]),_:1}),T("div",da,[(z(!0),D(ge,null,Se(E.value,(y,p)=>(z(),D("div",{key:`header_row_${p}`,class:"header-row-card"},[T("div",la,[T("span",null,"第"+oe(p+1)+"行",1),v(n,null,{default:A(()=>[v(t,{size:"small",onClick:b=>Ur(p)},{default:A(()=>[...r[32]||(r[32]=[k("新增表头列",-1)])]),_:1},8,["onClick"]),v(l,{title:"确认删除该表头行吗?",onConfirm:b=>Mr(p)},{default:A(()=>[v(t,{danger:"",size:"small"},{default:A(()=>[...r[33]||(r[33]=[k("删除行",-1)])]),_:1})]),_:1},8,["onConfirm"])]),_:2},1024)]),(z(!0),D(ge,null,Se(y,(b,J)=>(z(),D("div",{key:`header_cell_${p}_${J}`,class:"header-cell-line"},[v(n,{wrap:""},{default:A(()=>[T("span",null,oe(J+1),1),v(u,{value:b.title,"onUpdate:value":F=>b.title=F,size:"small",placeholder:"标题",style:{width:"140px"}},null,8,["value","onUpdate:value"]),v(u,{value:b.field,"onUpdate:value":F=>b.field=F,size:"small",placeholder:"字段(末级列填)",style:{width:"150px"}},null,8,["value","onUpdate:value"]),v(f,{value:b.colspan,"onUpdate:value":F=>b.colspan=F,size:"small",min:1,precision:0,style:{width:"80px"}},null,8,["value","onUpdate:value"]),v(f,{value:b.rowspan,"onUpdate:value":F=>b.rowspan=F,size:"small",min:1,precision:0,style:{width:"80px"}},null,8,["value","onUpdate:value"]),v(o,{value:b.halign,"onUpdate:value":F=>b.halign=F,size:"small",style:{width:"100px"}},{default:A(()=>[v(g,{value:"left"},{default:A(()=>[...r[34]||(r[34]=[k("left",-1)])]),_:1}),v(g,{value:"center"},{default:A(()=>[...r[35]||(r[35]=[k("center",-1)])]),_:1}),v(g,{value:"right"},{default:A(()=>[...r[36]||(r[36]=[k("right",-1)])]),_:1})]),_:1},8,["value","onUpdate:value"]),v(o,{value:b.autoWrap,"onUpdate:value":F=>b.autoWrap=F,size:"small",style:{width:"110px"},onChange:Dt},{default:A(()=>[v(g,{value:!1},{default:A(()=>[...r[37]||(r[37]=[k("不换行",-1)])]),_:1}),v(g,{value:!0},{default:A(()=>[...r[38]||(r[38]=[k("自动换行",-1)])]),_:1})]),_:1},8,["value","onUpdate:value"]),v(l,{title:"确认删除该表头列吗?",onConfirm:F=>Gr(p,J)},{default:A(()=>[v(t,{danger:"",size:"small"},{default:A(()=>[...r[39]||(r[39]=[k("删列",-1)])]),_:1})]),_:1},8,["onConfirm"])]),_:2},1024)]))),128))]))),128))])])]),_:1},8,["open"])])}}}),_a=xn(fa,[["__scopeId","data-v-8c67caad"]]);export{_a as default};
|