Files
qhmes/deploy-qhmes/frontend/js/PrintDesigner-He6lh1ge.js
2026-05-15 11:34:12 +08:00

57 lines
61 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/vue-plugin-hiprint-CTOhhtqP.js","js/antd-vue-vendor-BPnV8VqP.js","js/vue-vendor-C7Zq48Yl.js","js/JsBarcode-Cs4ZrpMU.js","js/index-BI6CMai0.js","js/vxe-table-vendor-B88kchpX.js","assets/index-CaK6YpON.css","js/browser-B0xVgIeL.js","js/stackblur-es-AyqGX0Lm.js"])))=>i.map(i=>d[i]);
var fn=Object.defineProperty,cn=Object.defineProperties;var gn=Object.getOwnPropertyDescriptors;var nr=Object.getOwnPropertySymbols;var yn=Object.prototype.hasOwnProperty,hn=Object.prototype.propertyIsEnumerable;var ar=(Y,q,I)=>q in Y?fn(Y,q,{enumerable:!0,configurable:!0,writable:!0,value:I}):Y[q]=I,V=(Y,q)=>{for(var I in q||(q={}))yn.call(q,I)&&ar(Y,I,q[I]);if(nr)for(var I of nr(q))hn.call(q,I)&&ar(Y,I,q[I]);return Y},Xe=(Y,q)=>cn(Y,gn(q));var Q=(Y,q,I)=>new Promise(($,_e)=>{var xe=j=>{try{Ee(I.next(j))}catch(Te){_e(Te)}},Be=j=>{try{Ee(I.throw(j))}catch(Te){_e(Te)}},Ee=j=>j.done?$(j.value):Promise.resolve(j.value).then(xe,Be);Ee((I=I.apply(Y,q)).next())});import{u as pn,_ as bn,d as mn}from"./index-BI6CMai0.js";import{d as vn,aN as wn,aq as Sn,o as An,P as Fn,w as Ze,f as ee,j as _n,ah as te,ar as D,as as z,au as T,k as v,ag as et,av as de,aF as A,G as k,F as pe,aD as Fe,u as xn,aC as sr,e as De,at as En,n as tt}from"./vue-vendor-C7Zq48Yl.js";import{d as Tn,r as $n,a as je,b as ir}from"./qhmesProvider-QOWpSLmN.js";import{q as Ft,s as Nn,e as kn}from"./printTemplate.api-CHChWHTu.js";import"./antd-vue-vendor-BPnV8VqP.js";import"./vxe-table-vendor-B88kchpX.js";const _t="qhmes_quick_print_preview_v1",Hn={class:"print-designer-page"},On={class:"designer-toolbar"},Rn={class:"toolbar-left"},Jn={key:0,class:"toolbar-subtitle"},Bn={key:1,class:"toolbar-subtitle"},In={class:"toolbar-right"},Pn={class:"designer-main"},zn={class:"designer-panel left"},qn={class:"drag-list"},Cn=["tid"],Wn={class:"drag-label"},Ln={class:"drag-tip"},Dn={class:"data-tips"},jn={class:"designer-panel right"},Mn={class:"group-toolbar"},Un={class:"group-bound-tip"},Gn={key:0,class:"group-bound-empty"},Qn={class:"group-preview"},Vn={class:"group-preview-table"},Kn=["rowspan"],Yn={class:"header-editor"},Xn={class:"header-editor-content"},Zn={class:"header-row-top"},le=!1,be="qhmesMergeCenterFields",Je="qhmesColumnGroups",ea=vn({name:"PrintDesigner",__name:"PrintDesigner",setup(Y){const q=wn(),I=Sn(),{createMessage:$}=pn(),_e=ee("template"),xe=ee(!1),Be=ee(!1),Ee=ee(!1),j=ee(""),Te=ee(""),_=ee(""),ae=ee(""),se=ee({}),x=ee([]),re=ee([]),E=ee([]),or=De(()=>{const e=Object.keys(se.value||{});return e.length?e:["docNo","orderNo","mainTable","detailList"]}),xt=De(()=>re.value),rt=De(()=>new Set(x.value)),Et=De(()=>{const e=se.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}),Tt=De(()=>{const e={},r=Et.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 me=null,W=null,nt=!1,at=!1,st={},it="",ot="",fe=[],ce=null,ve=null,we=null,ne=null,$t=0,ut=!1;function Nt(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 Ie(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)||Nt("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 kt(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=>Ie(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=>Ie(s)).filter(s=>!!s.field)}}).filter(t=>t.columns.length>0):[{title:"默认分组",columns:e.map(t=>Ie(t)).filter(t=>!!t.field)}]}function ur(e){if(!Array.isArray(e)||!e.length)return[];if(Array.isArray(e[0]))return Ne(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 dr(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=ur(y);if(p.length){o=p;break}}if(o.length)break}}o.forEach(d=>t(d.field,d.title))}if(Lt(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])?Ne(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))));Rt(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&&Ne(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 Se(e){re.value=dr(e),st=br(e)}function Ht(e){if(!Array.isArray(e)||!e.length)return[];if(Array.isArray(e[0])){const n=e.filter(a=>Array.isArray(a)),s=Ne(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(...Ht(s))}),t.filter(Boolean)}function lr(e){const r=ft(e),t=Ne(r);return t.length?t.map(n=>H((n==null?void 0:n.field)||"")).filter(Boolean):Re(e)}function Re(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=Ht(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 Ot(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&&Ot(s,r)})}}function fr(e){const r={};return[e==null?void 0:e.headerColumns,e==null?void 0:e.columns,e==null?void 0:e.tableColumns].forEach(n=>Ot(n,r)),r}function Rt(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=Re(s||{});if(i.length)return i}return[]}function Jt(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 ie(e){const r=Jt(e);return r==="table"||r==="longtable"}function cr(e){var n,s;if(ie(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!!(!Jt(e)&&(r.includes("表格")||r.includes("table")))}function gr(e,r){var s;const t=r||{},n=(s=e==null?void 0:e[be])!=null?s:t==null?void 0:t[be];return Array.isArray(n)&&n.length?P(n,!1):P(x.value,!1)}function $e(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)ie(i)&&r(i)}}function yr(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(ie(a))continue;const o=a.options||{};t(o),delete o[be],delete o[Je],delete o.gridColumns,a.options=o;const d=a.printElementType;d&&typeof d=="object"&&(t(d),delete d[be],delete d[Je],delete d.gridColumns)}}}function Pe(e,r){try{return JSON.stringify(e)===JSON.stringify(r)}catch(t){return!1}}function hr(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(!ie(s))continue;const i=s.options||{},a=i.columns;if(!Array.isArray(a)||!a.length)continue;i.tableColumns&&Pe(a,i.tableColumns)&&delete i.tableColumns,i.headerColumns&&Pe(a,i.headerColumns)&&delete i.headerColumns;const o=s.printElementType;o&&typeof o=="object"&&(o.columns&&Pe(a,o.columns)?(delete o.columns,delete o.tableColumns,delete o.headerColumns):(o.tableColumns&&Pe(a,o.tableColumns)&&delete o.tableColumns,o.headerColumns&&Pe(a,o.headerColumns)&&delete o.headerColumns)),s.options=i}}}function Ae(e){yr(e),hr(e)}function Me(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 pr(e){let r=!1;return $e(e,t=>{const s=(t.options||{})[be];Array.isArray(s)&&s.length&&(r=!0)}),r}function dt(e){if(!e||typeof e!="object")return;const r=e.ext;if(!r||typeof r!="object"){Me(e);return}const t=r.mergeCenterFields||r.mergeFields;if(Array.isArray(t)&&t.length&&!pr(e)){const i=P(t,!1);$e(e,a=>{const o=a.options||{};o[be]=[...i],a.options=o})}const n=r.customHeaderRows,s=Qe(e);if(Array.isArray(n)&&n.length&&!s.length){const i=oe(R(n));$e(e,a=>{const o=a.options||{};o.columns=oe(i),a.options=o,a.printElementType=a.printElementType||{},a.printElementType.columns=oe(i)})}Me(e)}function br(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(!ie(i))continue;const a=(i==null?void 0:i.options)||{},o=Re(a);o.length&&o.forEach((d,l)=>{r[d]||(r[d]=[]),r[d].push(l+1)})}}return r}function mr(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 vr(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(!ie(a))continue;const o=(a==null?void 0:a.options)||{},d=Re(o);if(d.length&&r.some(l=>d.includes(l))){const l=mr(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 Bt(){const e=P(x.value,!1);if(!e.length)return"";const r=e.flatMap(i=>st[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 It(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 lt(e){return String(e!=null?e:"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function ft(e){if(Array.isArray(fe)&&fe.length)return fe;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 wr(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 Ne(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 oe(e){return(e||[]).map(r=>(r||[]).map(t=>{var n,s,i,a;return Xe(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=oe(e).filter(t=>t.length>0);return r.length?r:[[{title:"新表头",field:"",rowspan:1,colspan:1,halign:"center",align:"center",autoWrap:!1}]]}function Pt(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?Xe(V({},o),{autoWrap:!!u}):o})})}function Ue(e){if(!e||!Array.isArray(e.panels))return!1;const r=R(E.value),t=oe(r);let n=0;return $e(e,s=>{const i=(s==null?void 0:s.options)||{},a=oe(t);i.columns=a,s.options=i,s.printElementType=s.printElementType||{},s.printElementType.columns=oe(t),n+=1}),n>0}function zt(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),ue=(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("二维码")})},ye=(c,w,h="")=>{const N=String(c!=null?c:"");if(!N)return"";if(ue(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="${lt(N)}" style="display:block;margin:0 auto;width:${m}px;height:${m}px;object-fit:contain;" />`}return lt(N)},he=c=>String(c||"").replace(/\s+/g,""),Ye=new Map;i.forEach(c=>{const w=H((c==null?void 0:c.field)||""),h=he(String((c==null?void 0:c.title)||(c==null?void 0:c.text)||(c==null?void 0:c.label)||""));w&&h&&Ye.set(h,w)});const St=new Set(t.map(c=>H(String(c||""))).filter(Boolean)),en=(n||[]).map(c=>{const w=String(c||"").trim(),h=H(w);return St.has(h)?h:Ye.get(he(w))||h}),tn=new Set(en.map(c=>H(String(c||""))).filter(Boolean)),rn=new Set(t.map((c,w)=>({field:c,index:w})).filter(c=>!!c.field&&tn.has(H(c.field))).map(c=>c.index)),At=(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 Oe=t[Z];Oe&&Object.prototype.hasOwnProperty.call(B[0],Oe)&&(K+=1)}K>G&&(G=K,N=B)}if(N.length)return N}return[]})(e),nn=c=>c===""||c===null||c===void 0,an=(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),Zt=(c,w)=>{var N,G;let h=c;for(;h>=0;){const m=(N=At[h])==null?void 0:N[w];if(!nn(m))return m;h-=1}return(G=At[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 Oe,Ce,We,Le;const N=lt((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=!!((Le=(We=(Ce=(Oe=h==null?void 0:h.autoWrap)!=null?Oe:h==null?void 0:h.tableAutoWrap)!=null?Ce:h==null?void 0:h.wrap)!=null?We:h==null?void 0:h.wordWrap)!=null&&Le),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>",At.forEach((c,w)=>{const h=C?` style="height:${C};"`:"";U+=`<tr${h}>`,t.forEach((N,G)=>{var Ce,We,Le,er;const m=V(V({},a[N]||{}),i[G]||{}),B=String((m==null?void 0:m.align)||d||"left"),K=!!((er=(Le=(We=(Ce=m==null?void 0:m.autoWrap)!=null?Ce:m==null?void 0:m.tableAutoWrap)!=null?We:m==null?void 0:m.wrap)!=null?Le:m==null?void 0:m.wordWrap)!=null&&er),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(rn.has(G)){const tr=Zt(w,N),sn=w>0?Zt(w-1,N):null,rr=w>0&&an(tr,sn),on=ye(tr,m,N),un=rr?' class="qhmes-vmerge-continue"':"",dn=rr?"border-left:1px solid #000;border-right:1px solid #000;border-bottom:1px solid #000;border-top:none;":"border:1px solid #000;",ln=Z.replace("border:1px solid #000;",dn);U+=`<td${un} style="${ln};vertical-align:middle;">${on}</td>`;return}const Oe=ye(c==null?void 0:c[N],m,N);U+=`<td style="${Z}">${Oe}</td>`}),U+="</tr>"}),U+="</tbody></table>",U}typeof globalThis!="undefined"&&(globalThis.__QH_BUILD_MERGE_HTML__=zt),typeof window!="undefined"&&(window.__QH_BUILD_MERGE_HTML__=zt);function Sr(e,r,t){const n=ft(e),s=Ne(n),i=s.length?s.map(St=>St.field):Re(e),a=fr(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||{},ue=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(),ye=H(ue.split(/[.[]/)[0]||ue),he={leafFields:[...i],selectedFields:[...r],headerRows:JSON.parse(JSON.stringify(n)),bodyColumns:JSON.parse(JSON.stringify(s)),columnMetaMap:JSON.parse(JSON.stringify(a)),tableRowsFieldRoot:ye,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},Ye=JSON.stringify(he);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(Ye)}));}catch(e){return'<table><tbody><tr><td>表格渲染失败</td></tr></tbody></table>';}`)}function Ar(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(!ie(i))continue;const a=(i==null?void 0:i.options)||{},o=(i==null?void 0:i.printElementType)||{},d=gr(a,o);if(!d.length)continue;const l=lr(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=Sr(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 Fr(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(!ie(i))continue;const a=(i==null?void 0:i.options)||{};if(!Re(a).length)continue;const d=ft(a),l=Math.max(1,d.length||1),u=wr(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 ue=`table thead tr:nth-child(-n+${l}) th,table thead tr:nth-child(-n+${l}) td`,ye=[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(`${ue}{${ye};}`),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 he=[b?`font-size:${b} !important`:"",J?`font-weight:${J} !important`:"",F?`font-family:${F} !important`:"",C?`line-height:${C} !important`:""].filter(Boolean).join(";");he&&r.push(`table tbody td{${he};}`)}}return r.length?`*{print-color-adjust:exact !important;-webkit-print-color-adjust:exact !important;}${r.join("")}`:""}function _r(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 xr(){const r=P(x.value).flatMap(t=>st[t]||[]);return Array.from(new Set(r)).sort((t,n)=>t-n)}function Er(){const e=P(x.value,!1),r=new Map(re.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 Tr(e){var a,o;const r=Er();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=qt(d);r.includes(u)&&i.push(l+1)}),Array.from(new Set(i))}function qt(e){return e?(e.textContent||"").replace(/\u00a0/g,"").replace(/\s+/g,"").trim():""}function Ct(){return Array.from(document.querySelectorAll("iframe"))}function Wt(){return new Set(Ct())}function Ge(e){const r=document.querySelector("#hiwprint_iframe");if(r)return r;const n=Ct().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 $r(e){const r=e||Ge(),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=Tr(i),o=xr(),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=qt(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 ct(e,r=40,t=80){return Q(this,null,function*(){for(let n=0;n<r;n+=1){if($r(e?e():null))return!0;yield new Promise(i=>setTimeout(i,t))}return!1})}function Nr(e,r,t){return Q(this,null,function*(){const n=Wt();try{t?e.preview(r,{},{styleHandler:()=>`<style>${t}</style>`}):e.preview(r)}catch(o){return!1}const s=()=>Ge(n),i=yield ct(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 Lt(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(!ie(s))continue;const i=(s==null?void 0:s.options)||{},a=[i.columns,i.tableColumns,i.headerColumns];for(const o of a){const d=kt(o);if(d.length)return d}if(Array.isArray(i.fields)&&i.fields.length)return[{id:Nt("group"),title:"默认分组",columns:i.fields.map(o=>Ie(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(re.value.map(i=>i.value));return n.filter(i=>s.has(i))}function gt(e){if(!e||typeof e!="object")return[];let r=[];if($e(e,s=>{var d;if(r.length)return;const i=s.options||{},a=s.printElementType||{},o=(d=i[be])!=null?d:a[be];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 kr(e){return!Array.isArray(e)||!e.length?[]:Array.isArray(e[0])?e.map(r=>Array.isArray(r)?r:[]):[e]}function Qe(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(!ie(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=kr(d);if(Array.isArray(l)&&l.length)return R(l)}}}return[]}function ge(e){var n;if(!e||typeof e!="object")return[];const r=Qe(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 Ve(e,r){if(!e||typeof e!="object")return{template:e,rows:[]};const t=e,n=Array.isArray(r)&&r.length?r:Qe(t),s=R(n);return{template:t,rows:s}}function Hr(e){if(!Array.isArray(e)||!e.length)return[];const r=kt(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 ze(e,r){const t=e||{},n=Array.isArray(r)&&r.length?R(r):null;return $e(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?Hr(o):[];d.length?(i[Je]=d,a[Je]=d):(delete i[Je],delete a[Je]),s.options=i,s.printElementType=a}),t}function qe(e,r){const t=e||{},n=P(r,!1);return $e(t,s=>{const i=s.options||{};i[be]=[...n],s.options=i}),Me(t),t}function Or(e,r){var t;return rt.value.has(r)&&(t=Tt.value[`${e}_${r}`])!=null?t:1}function Rr(e,r){return rt.value.has(r)?Tt.value[`${e}_${r}`]!==0:!0}function yt(e){const r=Qe(e);return r.length?JSON.stringify(R(r)):""}function M(e){return JSON.stringify(e,null,2)}function Dt(e){return JSON.stringify(R(e||[]))}function jt(e=!1){if(!e&&Date.now()<$t)return;let r=pt();if(!r&&_.value)try{r=JSON.parse(_.value)}catch(l){r=null}if(!r)return;let t=ge(r);if(!t.length)return;if(_.value)try{const l=JSON.parse(_.value),u=ge(l);u.length&&(t=Pt(t,u))}catch(l){}const n=Dt(t),s=Dt(E.value);if(!e&&n===s)return;const i=Ve(r,t);ut=!0,E.value=i.rows,ut=!1,Se(r),x.value=P(x.value);const a=P(x.value,!1),o=qe(r,a);Ve(o,i.rows),Ue(o),ze(o,R(E.value)),Ae(o);const d=M(o);d!==_.value&&(_.value=d)}function ht(e=!1){ve&&(window.clearTimeout(ve),ve=null),ve=window.setTimeout(()=>{jt(e),ve=null},180)}function Mt(){$t=Date.now()+1500,ne&&(window.clearTimeout(ne),ne=null),ne=window.setTimeout(()=>{He(!1,!1),ne=null},120)}function pt(){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 Jr(e){const r=(e==null?void 0:e.default)||{};return me=(e==null?void 0:e.hiprint)||(r==null?void 0:r.hiprint)||(window==null?void 0:window.hiprint),me}function Br(){return Q(this,null,function*(){var n;const e=yield bn(()=>import("./vue-plugin-hiprint-CTOhhtqP.js").then(s=>s.v),__vite__mapDeps([0,1,2,3,4,5,6,7,8])),r=Jr(e);if(!r)throw new Error("未获取到 hiprint 实例");r.init({providers:$n(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 bt(e){return Q(this,null,function*(){if(!me)return;const r=JSON.parse(JSON.stringify(e||{}));yield tt(),at=!0;const t=document.querySelector("#hiprint-printTemplate");t&&(t.innerHTML=""),we&&(we.disconnect(),we=null),W=new me.PrintTemplate({template:r,settingContainer:"#PrintElementOptionSetting",paginationContainer:".hiprint-printPagination",history:!0,onDataChanged:(n,s)=>{if(at)return;Se(s);const i=P(x.value);x.value=i;let a=ge(s);if(a.length&&_.value)try{const l=JSON.parse(_.value),u=ge(l);u.length&&(a=Pt(a,u))}catch(l){}a.length&&(E.value=R(a));const o=qe(s,i),d=Ve(o,a.length?a:E.value);E.value=d.rows,Ue(o),ze(o,R(E.value)),Ae(o),_.value=M(o),x.value=P(x.value),ht(!1)}}),W.design("#hiprint-printTemplate"),t&&(we=new MutationObserver(()=>{ht(!1)}),we.observe(t,{childList:!0,subtree:!0,attributes:!0,characterData:!0})),at=!1})}function Ir(){return Q(this,null,function*(){if(_e.value!=="setting"||!W)return;yield tt();const e=document.querySelector("#PrintElementOptionSetting");if(e&&!e.children.length){const r=L(_.value,"模板JSON");if(!r.ok)return;yield bt(r.data)}})}function Ke(){return Q(this,null,function*(){const e=L(_.value,"模板JSON");if(!e.ok)return;dt(e.data),Ae(e.data);const r=Ve(e.data);fe=[],Se(r.template),x.value=gt(r.template),E.value=r.rows,_.value=M(r.template),yield bt(r.template),$.success("模板JSON已应用")})}function Ut(){const e=L(_.value,"模板JSON");if(!e.ok)return null;dt(e.data),Ae(e.data),Se(e.data),x.value=P(x.value,!1),fe=oe(R(E.value)),it=le?"":Fr(e.data),ot=_r(e.data);const r=le?0:Ar(e.data);!le&&!r&&vr(e.data);try{return{instance:new me.PrintTemplate({template:e.data}),formatterApplied:r>0}}catch(t){return $.error(`创建打印实例失败:${(t==null?void 0:t.message)||"未知错误"}`),null}}function Gt(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 Pr(){var e;Ee.value=!0;try{const r=pt();let t=r||{};if(!r){const l=L(_.value,"模板JSON");if(!l.ok)return;t=l.data||{}}Se(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=Rt(f);if(g.length)if(cr(f)){g.forEach(he=>n.add(he));const ue=((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),ye=H(ue);ye&&s.add(String(ye).split(".")[0])}else g.forEach(ue=>i.add(ue))})}),!n.size&&!i.size&&(re.value||[]).forEach(l=>n.add(H(l==null?void 0:l.value)));const o={};Array.from(i).forEach((l,u)=>{o[l]=Gt(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]=Gt(b,y)}),p}),u=L(ae.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=se.value)==null?void 0:e.mainTable)?"mainTable":"")||"mainTable";o[g]=l}if(!Object.keys(o).length){$.warning("模板中未识别到可绑定字段无法生成匹配数据");return}ae.value=M(o),ke(!1),$.success("已根据模板生成匹配的打印数据JSON")}finally{Ee.value=!1}}function ke(e=!0){const r=L(ae.value,"打印数据JSON");r.ok&&(se.value=r.data,e&&$.success("打印数据已应用"))}function mt(){const e=L(_.value,"模板JSON");e.ok&&(_.value=M(e.data))}function zr(){const e=L(ae.value,"打印数据JSON");e.ok&&(ae.value=M(e.data))}function Qt(){return Q(this,null,function*(){if(ke(!1),!W){$.warning("设计器尚未初始化");return}const e=Ut();if(!e)return;const r=e.instance,t=le?"":`${ot}${Bt()}${it}`,n=le?se.value||{}:e.formatterApplied?se.value||{}:It(se.value||{}),s=Wt();try{t?r.preview(n,{},{styleHandler:()=>`<style>${t}</style>`}):r.preview(n),!le&&!e.formatterApplied&&ct(()=>Ge(s))}catch(i){try{r.preview(n),!le&&!e.formatterApplied&&ct(()=>Ge(s))}catch(a){$.error(`预览失败:${(a==null?void 0:a.message)||"未知错误"}`)}}})}function qr(){return Q(this,null,function*(){if(ke(!1),!W){$.warning("设计器尚未初始化");return}const e=Ut();if(!e)return;const r=e.instance,t=le?"":`${ot}${Bt()}${it}`,n=le?se.value||{}:e.formatterApplied?se.value||{}:It(se.value||{});if(!(!le&&!e.formatterApplied&&(yield Nr(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 Cr(){_.value=M(je),Ke()}function Wr(){ae.value=M(ir),ke()}function Lr(){const e=L(_.value,"模板JSON");if(e.ok){if(fe=[],Se(e.data),!re.value.length){$.warning("模板中未识别到可绑定字段请确认已配置表格列字段");return}x.value=gt(e.data),E.value=ge(e.data),$.success("已从模板JSON读取合并列配置")}}function Dr(){const e=L(_.value,"模板JSON");if(!e.ok)return;if(fe=[],Se(e.data),!re.value.length){$.warning("模板中未识别到可绑定字段请确认表格列已绑定 field");return}if(!Lt(e.data).length){$.warning("模板JSON中未识别到可解析的表格列结构");return}x.value=P(x.value);const t=ge(e.data);t.length&&(E.value=t),$.success("已按模板表格结构刷新可选字段")}function jr(){const e=L(_.value,"模板JSON");if(!e.ok)return;fe=[];const r=ge(e.data);E.value=R(r),$.success("表头结构已加载")}function Mr(e){const r=R(e),t=Ne(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 Vt(e){const r=oe(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 vt(){const e=Mr(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),He(!1,!0)}function Ur(e){const r=oe(R(E.value));if(e<0||e>=r.length)return;const t=Vt(r),s=(t[e]||[]).filter(i=>i.rowspan>1).map(i=>({start:i.start,cell:Xe(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=(Vt(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){vt();return}He(!1,!0)}function Gr(e){E.value[e].push({title:"新列",field:"",rowspan:1,colspan:1,halign:"center",align:"center",autoWrap:!1}),He(!1,!0)}function Qr(e,r){if(E.value[e].splice(r,1),E.value[e].length||E.value.splice(e,1),!E.value.length){vt();return}He(!1,!0)}function He(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=qe(t.data||{},P(x.value,!1)),s=Ue(n);ze(n,R(E.value)),Ae(n),_.value=M(n),s||$.warning("未在模板中定位到可编辑表格元素画布暂未更新"),r&&me&&(fe=[],yield bt(n)),e&&s&&$.success("表头结构已写入模板JSON")})}function Vr(){const e=L(_.value,"模板JSON");if(!e.ok)return;const r=P(x.value);x.value=r;const t=qe(e.data||{},r);ze(t,R(E.value)),Ae(t),_.value=M(t),$.success("已写入 qhmesColumnGroups列分组 qhmesMergeCenterFields行合并列到模板 JSON")}function Kt(e){if(e==null||e==="")return null;const r=Number(e);return Number.isFinite(r)&&r>0?r:null}function Kr(e,r){var d,l,u,f;const t=Kt((d=r.paperWidthMm)!=null?d:r.paper_width_mm),n=Kt((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 Yr(e){if(!e||typeof e!="object")return JSON.parse(JSON.stringify(je));if(Array.isArray(e.panels)&&e.panels.length>0)return e;const t=JSON.parse(JSON.stringify(je)),n=V(V({},t),e);return n.panels=t.panels,n}function Yt(){return Q(this,null,function*(){var i;j.value=String(q.query.id||"");const e=M(je);if(_.value=e,ae.value=M(ir),ke(),x.value=[],E.value=R([]),!j.value)return;const r=yield Ft(j.value);if(!r)return;Te.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,mt();return}n=JSON.parse(JSON.stringify(a.data))}else n=JSON.parse(JSON.stringify(je));n=Yr(n),Kr(n,r),dt(n),Ae(n),_.value=M(n),mt();const s=L(_.value,"模板JSON");s.ok&&s.data&&(Se(s.data),x.value=gt(s.data),E.value=ge(s.data))})}function Xr(){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 tt();const e=pt();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=qe(r||{},t);Ue(n),ze(n,R(E.value)),Me(n),Ae(n);const s=M(n);_.value=s;const i=yt(n);Be.value=!0;try{yield Nn({id:j.value,templateJson:s});let d=yield Ft(j.value),l=String((d==null?void 0:d.templateJson)||"").trim(),u=L(l||"{}","服务端模板JSON"),f=u.ok?yt(u.data):"";if(i&&f!==i&&(yield kn({id:j.value,templateJson:s}),d=yield Ft(j.value),l=String((d==null?void 0:d.templateJson)||"").trim(),u=L(l||"{}","服务端模板JSON"),f=u.ok?yt(u.data):""),u.ok&&f===i){_.value=M(u.data),E.value=ge(u.data),$.success("模板保存成功");return}$.error("保存请求已发送但服务端回读结果未包含最新表头结构")}finally{Be.value=!1}})}function Zr(){I.push("/print/template")}function wt(e){const r=Array.isArray(e)?e[0]:e;return r==="1"||r===1||String(r!=null?r:"")==="1"}function Xt(){return Q(this,null,function*(){if(wt(q.query.quickPrintPreview)&&!nt){nt=!0;try{const e=sessionStorage.getItem(_t);sessionStorage.removeItem(_t);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}ae.value=M(i.data),ke(!1),yield tt(),yield new Promise(a=>setTimeout(a,150)),yield Qt(),yield t()}finally{nt=!1}}})}return An(()=>Q(null,null,function*(){try{yield Br(),yield Yt(),yield Ke(),wt(q.query.quickPrintPreview)&&(yield Xt())}catch(e){$.error(`打印设计器初始化失败:${(e==null?void 0:e.message)||"未知错误"}`)}})),Fn(()=>Q(null,null,function*(){try{if(!wt(q.query.quickPrintPreview)||!sessionStorage.getItem(_t)||!me)return;yield Yt(),yield Ke(),yield Xt()}catch(e){$.error(`快速打印预览失败:${(e==null?void 0:e.message)||"未知错误"}`)}})),Ze(_e,()=>{Ir()}),Ze(xe,e=>{if(e){ht(!0),ce&&window.clearInterval(ce),ce=window.setInterval(()=>{jt(!1)},600);return}ce&&(window.clearInterval(ce),ce=null),ne&&(window.clearTimeout(ne),ne=null),He(!1,!1)}),Ze(re,()=>{x.value=P(x.value)},{deep:!0}),Ze(E,()=>{ut||xe.value&&Mt()},{deep:!0}),_n(()=>{ne&&(window.clearTimeout(ne),ne=null),ve&&(window.clearTimeout(ve),ve=null),we&&(we.disconnect(),we=null),ce&&(window.clearInterval(ce),ce=null),W=null,me=null}),(e,r)=>{const t=te("a-button"),n=te("a-space"),s=te("a-tag"),i=te("a-textarea"),a=te("a-tab-pane"),o=te("a-select"),d=te("a-tabs"),l=te("a-popconfirm"),u=te("a-input"),f=te("a-input-number"),g=te("a-select-option"),S=te("a-drawer");return z(),D("div",Hn,[T("div",On,[T("div",Rn,[r[6]||(r[6]=T("span",{class:"toolbar-title"},"打印设计器",-1)),j.value?(z(),D("span",Jn,"模板ID: "+de(j.value),1)):et("",!0),Te.value?(z(),D("span",Bn,"模板名称: "+de(Te.value),1)):et("",!0)]),T("div",In,[v(n,null,{default:A(()=>[v(t,{onClick:Zr},{default:A(()=>[...r[7]||(r[7]=[k("返回列表",-1)])]),_:1}),v(t,{onClick:Cr},{default:A(()=>[...r[8]||(r[8]=[k("恢复默认模板",-1)])]),_:1}),v(t,{onClick:mt},{default:A(()=>[...r[9]||(r[9]=[k("格式化模板JSON",-1)])]),_:1}),v(t,{type:"primary",onClick:Ke},{default:A(()=>[...r[10]||(r[10]=[k("应用模板JSON",-1)])]),_:1}),v(t,{onClick:Qt},{default:A(()=>[...r[11]||(r[11]=[k("预览",-1)])]),_:1}),v(t,{onClick:qr},{default:A(()=>[...r[12]||(r[12]=[k("打印",-1)])]),_:1}),v(t,{type:"primary",loading:Be.value,onClick:Xr},{default:A(()=>[...r[13]||(r[13]=[k("保存模板",-1)])]),_:1},8,["loading"])]),_:1})])]),T("div",Pn,[T("div",zn,[r[14]||(r[14]=T("div",{class:"panel-title"},"拖拽元素",-1)),T("div",qn,[(z(!0),D(pe,null,Fe(xn(Tn),y=>(z(),D("div",{key:y.tid,class:"ep-draggable-item drag-item",tid:y.tid},[T("div",Wn,de(y.label),1),T("div",Ln,de(y.tip),1)],8,Cn))),128))]),r[15]||(r[15]=T("div",{class:"panel-title"},"数据字段建议",-1)),T("div",Dn,[(z(!0),D(pe,null,Fe(or.value,y=>(z(),sr(s,{key:y},{default:A(()=>[k(de(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",jn,[v(d,{activeKey:_e.value,"onUpdate:activeKey":r[3]||(r[3]=y=>_e.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:"唯一模板 JSONpanels表头在 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:ae.value,"onUpdate:value":r[1]||(r[1]=y=>ae.value=y),rows:18,placeholder:"请填写合法的打印数据JSON"},null,8,["value"]),v(n,{class:"json-actions"},{default:A(()=>[v(t,{size:"small",onClick:Wr},{default:A(()=>[...r[16]||(r[16]=[k("加载默认数据",-1)])]),_:1}),v(t,{size:"small",loading:Ee.value,onClick:Pr},{default:A(()=>[...r[17]||(r[17]=[k("智能生成匹配数据",-1)])]),_:1},8,["loading"]),v(t,{size:"small",onClick:zr},{default:A(()=>[...r[18]||(r[18]=[k("格式化数据JSON",-1)])]),_:1}),v(t,{size:"small",type:"primary",onClick:ke},{default:A(()=>[...r[19]||(r[19]=[k("应用数据JSON",-1)])]),_:1})]),_:1})]),_:1}),v(a,{key:"group",tab:"列分组"},{default:A(()=>[T("div",Mn,[v(n,null,{default:A(()=>[v(t,{size:"small",onClick:Lr},{default:A(()=>[...r[20]||(r[20]=[k("从模板JSON读取",-1)])]),_:1}),v(t,{size:"small",onClick:Dr},{default:A(()=>[...r[21]||(r[21]=[k("从模板表格解析",-1)])]),_:1}),v(t,{size:"small",type:"primary",onClick:Vr},{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",Un,[r[23]||(r[23]=T("span",null,"可选绑定字段",-1)),(z(!0),D(pe,null,Fe(re.value,y=>(z(),sr(s,{key:y.value},{default:A(()=>[k(de(y.value),1)]),_:2},1024))),128)),re.value.length?et("",!0):(z(),D("span",Gn,"未识别到字段请先点击从模板表格解析"))]),v(o,{value:x.value,"onUpdate:value":r[2]||(r[2]=y=>x.value=y),mode:"multiple",options:re.value,style:{width:"100%"},placeholder:"请选择需要合并居中显示的列可多选","show-search":"","option-filter-prop":"label"},null,8,["value","options"]),T("div",Qn,[r[24]||(r[24]=T("div",{class:"panel-title"},"合并效果预览",-1)),T("table",Vn,[T("thead",null,[T("tr",null,[(z(!0),D(pe,null,Fe(xt.value,y=>(z(),D("th",{key:y.value},de(y.label),1))),128))])]),T("tbody",null,[(z(!0),D(pe,null,Fe(Et.value,(y,p)=>(z(),D("tr",{key:`preview_row_${p}`},[(z(!0),D(pe,null,Fe(xt.value,b=>(z(),D(pe,{key:`${p}_${b.value}`},[Rr(p,b.value)?(z(),D("td",{key:0,rowspan:Or(p,b.value),class:En({"merge-cell":rt.value.has(b.value)})},de(y==null?void 0:y[b.value]),11,Kn)):et("",!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=>xe.value=!0)},{default:A(()=>[...r[28]||(r[28]=[k("表头结构设计",-1)])]),_:1}),v(S,{open:xe.value,"onUpdate:open":r[5]||(r[5]=y=>xe.value=y),title:"表头结构编辑",placement:"bottom",height:360,mask:!1,"get-container":!1,style:{position:"absolute"},class:"header-drawer"},{default:A(()=>[T("div",Yn,[v(n,{class:"header-editor-toolbar"},{default:A(()=>[v(t,{size:"small",onClick:jr},{default:A(()=>[...r[29]||(r[29]=[k("读取表头",-1)])]),_:1}),v(t,{size:"small",onClick:vt},{default:A(()=>[...r[30]||(r[30]=[k("新增表头行",-1)])]),_:1}),v(t,{size:"small",type:"primary",onClick:He},{default:A(()=>[...r[31]||(r[31]=[k("写入模板JSON",-1)])]),_:1})]),_:1}),T("div",Xn,[(z(!0),D(pe,null,Fe(E.value,(y,p)=>(z(),D("div",{key:`header_row_${p}`,class:"header-row-card"},[T("div",Zn,[T("span",null,""+de(p+1)+"",1),v(n,null,{default:A(()=>[v(t,{size:"small",onClick:b=>Gr(p)},{default:A(()=>[...r[32]||(r[32]=[k("新增表头列",-1)])]),_:1},8,["onClick"]),v(l,{title:"确认删除该表头行吗",onConfirm:b=>Ur(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(pe,null,Fe(y,(b,J)=>(z(),D("div",{key:`header_cell_${p}_${J}`,class:"header-cell-line"},[v(n,{wrap:""},{default:A(()=>[T("span",null,de(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:Mt},{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=>Qr(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"])])}}}),da=mn(ea,[["__scopeId","data-v-8c67caad"]]);export{da as default};