vue-quokit 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +9 -9
- package/dist/index.mjs +2313 -1910
- package/package.json +33 -33
package/dist/index.cjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".qukt-toolbar{display:flex;align-items:center;gap:10px;margin-bottom:12px;flex-wrap:wrap}.qukt-tip{color:#909399;font-size:13px;margin-right:auto}.qukt-tip code{background:#f5f7fa;padding:1px 6px;border-radius:3px}.qukt-btn-group-inline{display:flex;gap:6px}.qukt-btn{padding:6px 14px;border:1px solid #dcdfe6;border-radius:4px;background:#fff;cursor:pointer;font-size:13px}.qukt-btn:hover{border-color:#409eff;color:#409eff}.qukt-btn-primary{background:#409eff;border-color:#409eff;color:#fff}.qukt-btn-primary:hover{background:#66b1ff;color:#fff}.qukt-btn-ghost{background:transparent;border:1px dashed #dcdfe6;color:#909399;margin-top:8px}.qukt-mini-btn{background:transparent;border:1px solid #dcdfe6;border-radius:3px;padding:2px 8px;cursor:pointer;font-size:12px;margin-right:3px}.qukt-mini-btn:hover{border-color:#409eff;color:#409eff}.qukt-mini-btn:disabled{opacity:.3;cursor:not-allowed}.qukt-mini-btn.danger:hover{border-color:#f56c6c;color:#f56c6c}.qukt-muted{color:#c0c4cc;font-size:12px}.qukt-cell-input{flex:1;width:100%;border:1px solid #dcdfe6;border-radius:3px;padding:4px 8px;font-size:13px;outline:none;min-width:0;box-sizing:border-box}.qukt-cell-input:focus{border-color:#409eff}.qukt-cell-input.small{flex:0 0 160px;max-width:100%}.qukt-cell-input.tiny{width:56px;height:22px;font-size:11px;padding:0 4px;flex:none}.qukt-color-input{width:24px;height:22px;border:1px solid #dcdfe6;border-radius:3px;padding:0;cursor:pointer;background:#fff}.qukt-chk-label{font-size:12px;color:#606266;display:inline-flex;align-items:center;gap:3px;flex-shrink:0}.qukt-designer{padding:0;display:flex;flex-direction:column;height:100%;min-height:0}.qukt-tabs{display:flex;gap:0;border-bottom:2px solid #ebeef5;margin-bottom:16px;flex-shrink:0}.qukt-tab{padding:10px 20px;cursor:pointer;font-size:14px;color:#909399;border-bottom:2px solid transparent;margin-bottom:-2px;transition:all .2s}.qukt-tab:hover{color:#409eff}.qukt-tab.active{color:#409eff;border-bottom-color:#409eff;font-weight:600}.qukt-tab-content{padding:10px 0;flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.qukt-tab-content>*{flex:1;min-height:0;display:flex;flex-direction:column}.qukt-tab-content-preview{overflow-y:auto}.qukt-tab-content-preview>*{flex:none;min-height:0}.qukt-page{padding:20px;background:#fff;border-radius:8px;height:100%;overflow-y:auto}.qukt-empty-tip{text-align:center;padding:60px 20px;background:#fafbfc;border:2px dashed #dcdfe6;border-radius:8px}.qukt-empty-icon{font-size:48px;margin-bottom:12px}.qukt-empty-text{color:#909399;font-size:14px;margin-bottom:16px}.qukt-data-table{border:1px solid #ebeef5;border-radius:6px;overflow:hidden;margin-bottom:16px}.qukt-main-table{width:100%;border-collapse:collapse;font-size:13px}.qukt-main-table th{background:#f5f7fa;padding:10px 12px;text-align:left;font-weight:600;color:#303133;border:1px solid #ebeef5}.qukt-main-table td{padding:10px 12px;border:1px solid #ebeef5;color:#606266}.qukt-main-table tbody tr{cursor:pointer;transition:background .15s}.qukt-main-table tbody tr:hover{background:#f5f7fa}.qukt-subtotal{color:#67c23a;font-weight:500;text-align:right;display:block}.qukt-op-cell{white-space:nowrap}.qukt-row-btn{background:none;border:none;cursor:pointer;font-size:13px;color:#409eff;margin-right:10px;padding:2px 4px;border-radius:3px}.qukt-row-btn:hover{text-decoration:underline}.qukt-row-btn.danger{color:#f56c6c}.qukt-de-mask,.qukt-gr-mask{position:fixed;top:0;right:0;bottom:0;left:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:1000}.qukt-de-dialog{background:#fff;border-radius:10px;width:420px;max-width:92vw;max-height:86vh;display:flex;flex-direction:column;box-shadow:0 10px 40px #00000040}.qukt-de-header{padding:16px 20px;border-bottom:1px solid #ebeef5;display:flex;justify-content:space-between;align-items:center;font-size:15px;font-weight:600;color:#303133;flex-shrink:0}.qukt-de-close{border:none;background:transparent;cursor:pointer;font-size:16px;color:#909399}.qukt-de-close:hover{color:#f56c6c}.qukt-de-content{padding:16px 20px;flex:1;overflow-y:auto}.qukt-de-footer{padding:12px 20px;border-top:1px solid #ebeef5;text-align:right;flex-shrink:0}.qukt-form-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.qukt-form-cell.full{grid-column:1 / -1}.qukt-form-cell-label{display:block;font-size:13px;color:#606266;margin-bottom:6px}.qukt-gr-dialog{width:380px;background:#fff;border-radius:8px;box-shadow:0 8px 28px #0003}.qukt-gr-header{padding:12px 16px;border-bottom:1px solid #ebeef5;display:flex;justify-content:space-between;align-items:center;font-size:15px;font-weight:600;color:#303133}.qukt-gr-close{border:none;background:transparent;cursor:pointer;font-size:16px;color:#909399}.qukt-gr-close:hover{color:#f56c6c}.qukt-gr-content{padding:14px 16px;max-height:70vh;overflow-y:auto}.qukt-gr-footer{padding:10px 16px;border-top:1px solid #ebeef5;text-align:right}.qukt-gr-tips{background:#ecf5ff;border:1px solid #d9ecff;border-radius:6px;padding:8px 10px;margin-bottom:14px}.qukt-gr-tips p{font-size:12px;color:#606266;margin:4px 0;line-height:1.6}.qukt-gr-tips code{background:#fff;padding:1px 6px;border-radius:3px;font-size:11px}.qukt-gr-form{display:flex;flex-direction:column;gap:10px}.qukt-gr-form-row{display:flex;align-items:center;gap:10px}.qukt-gr-form-label{width:80px;text-align:right;font-size:12px;color:#606266;flex-shrink:0}.qukt-table-wrap{width:100%;overflow:auto;flex:1;min-height:0}.qukt-table-wrap.is-narrow .qukt-design-table{min-width:900px}.qukt-design-table{width:100%;border-collapse:collapse;font-size:13px}.qukt-design-table th,.qukt-design-table td{border:1px solid #ebeef5;padding:6px 8px;text-align:left}.qukt-design-table th{background:#f5f7fa;font-weight:600;color:#303133}.qukt-design-table td.idx{text-align:center;color:#909399;background:#fafbfc;width:50px}.qukt-design-table tbody tr:hover{background:#fafbfc}.qukt-col-merge label{display:flex;align-items:center;gap:4px;font-size:12px;cursor:pointer}.qukt-quote-sheet{background:#fff;padding:32px 40px;border-radius:4px;box-shadow:0 2px 12px #0000000f}.qukt-q-title{margin:0 0 12px;font-size:18px;font-weight:700;color:#303133;text-align:center}.qukt-q-divider{border-top:1px solid #dcdfe6;margin:10px 0}.qukt-q-text{margin:4px 0;font-size:13px;color:#606266}.qukt-q-row{display:flex;margin-bottom:4px}.qukt-q-cell{padding:8px 12px;font-size:13px;background:#fff;box-sizing:border-box}.qukt-q-label{color:#909399}.qukt-q-value{color:#303133;font-weight:500}.qukt-q-table-wrap{margin-top:14px}.qukt-q-table{width:100%;border-collapse:collapse;font-size:13px}.qukt-q-table th{background:#f5f7fa;padding:10px 12px;border:1px solid #dcdfe6;text-align:center;font-weight:600;color:#303133}.qukt-q-table td{padding:9px 12px;border:1px solid #dcdfe6;color:#606266;text-align:center;vertical-align:middle}.qukt-q-table td.merged-cell{background:#fafbfc;font-weight:500}.qukt-q-table tr.subtotal-row td.subtotal-label{background:#f0f9ff;color:#409eff;font-weight:600;text-align:right;padding-right:16px;font-style:italic}.qukt-q-table tr.subtotal-row td.subtotal-value{background:#f0f9ff;color:#409eff;font-weight:600;text-align:right}.qukt-q-empty{text-align:center;padding:30px;color:#c0c4cc;font-size:14px}.qukt-q-summary{margin-top:12px;margin-left:auto;width:320px}.qukt-q-summary-row{display:flex;justify-content:space-between;padding:6px 0;border-bottom:1px dashed #ebeef5;font-size:13px}.qukt-q-summary-label{color:#606266}.qukt-q-summary-value{font-variant-numeric:tabular-nums;white-space:pre}.qukt-help-modal{position:fixed;top:0;left:0;right:0;bottom:0;background:#00000073;z-index:9999;display:flex;align-items:center;justify-content:center}.qukt-help-dialog{background:#fff;border-radius:10px;width:780px;max-width:92vw;max-height:86vh;display:flex;flex-direction:column;box-shadow:0 10px 40px #00000040}.qukt-help-header{padding:16px 24px;border-bottom:1px solid #ebeef5;display:flex;justify-content:space-between;align-items:center}.qukt-help-header h3{margin:0;font-size:17px;color:#303133}.qukt-close-btn{background:transparent;border:none;font-size:20px;cursor:pointer;color:#909399;padding:4px 10px;border-radius:4px}.qukt-close-btn:hover{background:#f5f7fa;color:#303133}.qukt-help-body{padding:20px 28px 28px;overflow-y:auto;font-size:13px;color:#606266;line-height:1.7}.qukt-help-section{margin-bottom:24px}.qukt-help-section h4{font-size:15px;color:#409eff;margin:0 0 10px;padding-bottom:6px;border-bottom:1px dashed #dcdfe6}.qukt-help-section p{margin:6px 0}.qukt-help-section ul,.qukt-help-section ol{margin:6px 0 6px 22px;padding:0}.qukt-help-section li{margin:3px 0}.qukt-help-section code{background:#f0f2f5;color:#d63384;padding:1px 6px;border-radius:3px;font-size:12px;font-family:Consolas,monospace}.qukt-help-section pre.code{background:#f5f7fa;border:1px solid #ebeef5;border-radius:5px;padding:10px 14px;overflow-x:auto;font-size:12px;font-family:Consolas,Monaco,monospace;line-height:1.55;margin:8px 0;color:#495057}.qukt-help-table{width:100%;border-collapse:collapse;margin:10px 0;font-size:12.5px}.qukt-help-table th,.qukt-help-table td{border:1px solid #ebeef5;padding:7px 10px;text-align:left}.qukt-help-table th{background:#f5f7fa;font-weight:600;color:#303133}.qukt-help-table td:first-child{white-space:nowrap;font-weight:500}.qukt-tip-box{background:#ecf5ff;border-left:3px solid #409eff;padding:8px 14px;border-radius:3px;color:#606266;margin:10px 0;font-size:12.5px}.qukt-tip-box.final-tip{background:#f0f9eb;border-left-color:#67c23a;font-size:13px;padding:14px 18px}.qukt-steps{padding-left:22px}.qukt-steps li{margin-bottom:4px}.qukt-two-col{display:flex;gap:16px;flex:1;min-height:0;overflow:hidden}.qukt-col-left{flex:1;min-width:0;overflow-y:auto;padding-right:4px}.qukt-col-right{width:360px;flex-shrink:0;overflow-y:auto;max-height:100%}.qukt-two-col.is-narrow{flex-direction:column;overflow-y:auto}.qukt-two-col.is-narrow .qukt-col-right{width:100%;flex-shrink:0;overflow:visible}.qukt-two-col.is-narrow .qukt-col-left{overflow:visible}.qukt-sec-block{border:1px solid #ebeef5;border-radius:6px;padding:12px;margin-bottom:10px;background:#fafbfc}.qukt-sec-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}.qukt-sec-type{font-size:13px;font-weight:600;color:#409eff;background:#ecf5ff;padding:2px 8px;border-radius:3px}.qukt-sec-actions{display:flex;gap:2px}.qukt-sec-row{display:flex;align-items:center;gap:6px;margin-bottom:6px;flex-wrap:wrap}.qukt-sec-row label,.qukt-sec-row .label{font-size:12px;color:#606266;min-width:54px;flex-shrink:0}.qukt-inline-group{display:inline-flex;align-items:center;gap:6px;flex-shrink:0}.qukt-cells-list{display:flex;flex-direction:column;gap:8px}.qukt-cell-block{border:1px dashed #dcdfe6;border-radius:4px;padding:8px;background:#fff}.qukt-cell-toolbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px;font-size:12px;color:#909399}.qukt-border-config{flex-wrap:wrap}.qukt-border-config>.label{width:100%;margin-bottom:4px}.qukt-border-group{display:flex;flex-wrap:wrap;gap:4px;flex:1}.qukt-border-item{display:flex;align-items:center;gap:2px;padding:2px 4px;background:#f8f9fb;border-radius:3px;font-size:11px;color:#606266}.qukt-border-item>span{min-width:12px;text-align:center}.qukt-border-config .qukt-mini-btn{margin-left:4px}.qukt-preview-box{border:1px solid #dcdfe6;border-radius:6px;overflow:hidden;background:#fff;top:20px}.qukt-preview-label{padding:8px 12px;background:#f5f7fa;font-size:13px;font-weight:600;color:#606266;border-bottom:1px solid #ebeef5}.qukt-preview-inner{padding:14px}.qukt-p-title{margin:6px 0 10px}.qukt-p-divider{height:1px;background:#dcdfe6;margin:8px 0}.qukt-p-text{margin:4px 0;font-size:13px;color:#606266}.qukt-p-row{display:flex;margin-bottom:6px}.qukt-p-cell{padding:6px 10px;font-size:12px;background:#fff}.qukt-p-label{color:#909399}.qukt-p-value{color:#409eff;font-weight:500}.qukt-empty-hint{text-align:center;padding:20px;color:#c0c4cc;font-size:13px}.qukt-preview-title{font-size:13px;font-weight:600;color:#606266;margin:0 0 10px}.qukt-summary-preview{border:1px solid #ebeef5;border-radius:6px;padding:12px;background:#fff}.qukt-sp-row{display:flex;justify-content:space-between;align-items:center;padding:6px 0;font-size:13px}.qukt-sp-label{color:#606266}.qukt-sp-value{font-weight:500;font-size:12px;white-space:pre}.qukt-preview-help{margin-top:12px;padding:10px 12px;background:#f4f4f5;border-radius:6px;font-size:12px;color:#909399;line-height:1.8}.qukt-preview-help b{color:#606266}.qukt-preview-help code{background:#e9e9eb;padding:1px 5px;border-radius:3px;color:#606266;font-family:monospace}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
-
(function(
|
|
3
|
-
`&&(/[\u4e00-\u9fa5\u3000-\u303f\uff00-\uffef\u2e80-\u2fdf\u31c0-\u31ef]/.test(
|
|
4
|
-
`).length,y=te(f),$=f.length===0?1:Math.ceil(y/12);i=Math.max(i,k,$)}return Math.max(28,i*(o+4)+6)}function oe(s,o,i,m,f){for(let k=o;k<=i;k++)for(let y=m;y<=f;y++){const _=s.getCell(k,y);_.border=fe}}function ne(s,o,i,m,f){for(let k=m;k<=f;k++)s.getCell(o,k).border={...s.getCell(o,k).border||{},top:Q},s.getCell(i,k).border={...s.getCell(i,k).border||{},bottom:Q};for(let k=o;k<=i;k++)s.getCell(k,m).border={...s.getCell(k,m).border||{},left:Q},s.getCell(k,f).border={...s.getCell(k,f).border||{},right:Q}}async function ye(s,o,i={}){var G;if(!s||!Array.isArray(s.columns)||s.columns.length===0)throw new Error("模板为空或缺少列定义");o=o||[];const m=i.layout||"auto-wrap",f=m==="auto-wrap",k=new ke.Workbook,y=k.addWorksheet("报价单"),_=s.columns.length,$=F(_-1);let d=1;const t=()=>(s.columns||[]).find(a=>a.editor==="AUTO_CALC"),n=a=>{const u=t(),c=(u==null?void 0:u.formula)||"quantity * unit_price";return I(c,a)};if(s.header_sections){for(const a of s.header_sections)if(a.type==="title"){y.mergeCells(`A${d}:${$}${d}`);const u=y.getCell(`A${d}`);u.value=a.text;const c=a.style||{},V=c.fontSize||18;if(u.font={size:V,bold:c.bold!==!1,italic:c.italic===!0,name:"微软雅黑"},c.color){const E=c.color.replace("#","").toUpperCase();u.font.color={argb:E.length===6?"FF"+E:E}}u.alignment={horizontal:c.align||"center",vertical:"middle"},y.getRow(d).height=V*2+10,d++}else if(a.type==="divider")d++;else if(a.type==="text"){y.mergeCells(`A${d}:${$}${d}`);const u=y.getCell(`A${d}`);u.value=a.text;const c=a.style||{},V=c.fontSize||13;if(u.font={size:V,bold:c.bold===!0,italic:c.italic===!0,name:"微软雅黑"},c.color){const E=c.color.replace("#","").toUpperCase();u.font.color={argb:E.length===6?"FF"+E:E}}u.alignment={horizontal:c.align||a.align||"left",vertical:"middle"},y.getRow(d).height=V*2+10,d++}else if(a.type==="row"&&a.cells){const u=a.cells.map(E=>{var b;return ee((b=E.style)==null?void 0:b.width)||1/a.cells.length});let c=0;const V=u.map(E=>{const b=Math.round(c*_);c+=E;const h=Math.round(c*_)-1;return{start:b,end:Math.max(h,b)}});for(let E=0;E<a.cells.length;E++){const b=a.cells[E],h=V[E],g=`${F(h.start)}${d}`,x=`${F(h.end)}${d}`;g!==x&&y.mergeCells(`${g}:${x}`);const C=y.getCell(g);C.value=b.type==="field"?`${b.label}:${b.value??""}`:b.text;const q=b.style||{},T=q.fontSize||11;if(C.font={size:T,bold:q.bold===!0,italic:q.italic===!0,name:"微软雅黑"},q.color){const M=q.color.replace("#","").toUpperCase();C.font.color={argb:M.length===6?"FF"+M:M}}C.alignment={horizontal:q.align||"left",vertical:"middle"}}y.getRow(d).height=22,d++}}const p=d,l=y.getRow(d);l.values=s.columns.map(a=>a.title),l.font={bold:!0,name:"微软雅黑",size:12},l.fill={type:"pattern",pattern:"solid",fgColor:{argb:"FFE0E0E0"}},l.alignment={horizontal:"center",vertical:"middle",wrapText:f},l.height=f?32:28,d++;const B=s.group_rules,r=B==null?void 0:B.merge_field,S=s.columns;if(r){let a=0,u=0;for(;a<o.length;){const c=[];let V=a;for(;V<o.length&&o[V][r]===o[a][r];)c.push(o[V]),V++;const E=d;for(let g=0;g<c.length;g++){u++;const x=c[g],C=S.map(T=>T.editor==="AUTO_SEQ"?u:T.editor==="AUTO_CALC"?n(x):x[T.field]??""),q=y.getRow(d);q.values=C,q.font={name:"微软雅黑",size:11},q.alignment={horizontal:"center",vertical:"middle",wrapText:f,indent:1},q.height=f?le(C,11):28,d++}const b=d-1;for(let g=0;g<S.length;g++){const x=S[g];if(x.merge_on_group!==!0)continue;let C=E;for(let q=1;q<c.length;q++)c[q][x.field]!==c[q-1][x.field]&&(E+q-1>C&&y.mergeCells(`${F(g)}${C}:${F(g)}${E+q-1}`),C=E+q);b>C&&y.mergeCells(`${F(g)}${C}:${F(g)}${b}`)}if(B.show_detail_subtotal!==!1&&o[a][r]!==void 0&&o[a][r]!==null&&o[a][r]!==""){const g=c.reduce((M,O)=>M+Number(n(O)||0),0),x=F(Math.max(0,_-2));y.mergeCells(`A${d}:${x}${d}`);const C=y.getCell(`A${d}`);C.value=`小计(${o[a][r]})`,C.alignment={horizontal:"right",vertical:"middle"},C.font={bold:!0,italic:!0,color:{argb:"FF409EFF"},name:"微软雅黑",size:11};const q=y.getCell(`${$}${d}`);q.value=g,q.numFmt="#,##0.00",q.alignment={horizontal:"right",vertical:"middle"},q.font={bold:!0,italic:!0,color:{argb:"FF409EFF"},name:"微软雅黑",size:11};const T=y.getRow(d);T.fill={type:"pattern",pattern:"solid",fgColor:{argb:"FFF0F9FF"}},T.alignment={horizontal:"right",vertical:"middle",wrapText:!0},T.height=26,d++}a=V}}else for(let a=0;a<o.length;a++){const u=o[a],c=S.map(E=>E.editor==="AUTO_SEQ"?a+1:E.editor==="AUTO_CALC"?n(u):u[E.field]??""),V=y.getRow(d);V.values=c,V.font={name:"微软雅黑",size:11},V.alignment={horizontal:"center",vertical:"middle",wrapText:f,indent:1},V.height=f?le(c,11):28,d++}const w=d-1;if(s.summary_fields){d+=1;const a=F(Math.max(0,_-2)),u=F(_-1),c=o.reduce((b,h)=>b+Number(n(h)||0),0),V={group_total:c,quantity_sum:o.reduce((b,h)=>b+Number(h.quantity||0),0)};for(const b of s.summary_fields)b.type==="MANUAL_INPUT"&&(V[b.field]=Number(b.default??0));V.grand_total=c+s.summary_fields.filter(b=>b.type==="MANUAL_INPUT").reduce((b,h)=>b+V[h.field],0);for(const b of s.summary_fields)b.type==="AUTO_CALC"&&(V[b.field]=I(b.formula||"group_total",V));for(const b of s.summary_fields){let h;b.type==="AUTO_CALC"?h=I(b.formula||"group_total",V):b.type==="PLAIN_TEXT"?h=b.text||"":h=Number(b.default??0);const g=((G=b.style)==null?void 0:G.fontSize)||be,x=y.getCell(`${a}${d}`),C=y.getCell(`${u}${d}`);x.value=b.label,x.alignment={horizontal:"right",vertical:"middle"};const q=b.style||{},T=()=>{const M={name:"微软雅黑",size:g,bold:!!q.bold,italic:!!q.italic};if(q.color){const O=q.color.replace("#","").toUpperCase();M.color={argb:O.length===6?"FF"+O:O}}return M};x.font=T(),C.value=h,C.alignment={horizontal:"right",vertical:"middle"},C.font=T(),typeof h=="number"&&(C.numFmt="#,##0.00"),y.getRow(d).height=Math.max(22,g*2+6),d++}const E=d-1;oe(y,p,E,1,_),ne(y,p,E,1,_)}else oe(y,p,w,1,_),ne(y,p,w,1,_);if(s.footer_sections){d+=1;for(const a of s.footer_sections)if(a.type==="divider")d++;else if(a.type==="text"){y.mergeCells(`A${d}:${$}${d}`);const u=y.getCell(`A${d}`);u.value=a.text;const c=a.style||{},V=c.fontSize||13;if(u.font={size:V,bold:c.bold===!0,italic:c.italic===!0,name:"微软雅黑"},c.color){const E=c.color.replace("#","").toUpperCase();u.font.color={argb:E.length===6?"FF"+E:E}}u.alignment={horizontal:c.align||a.align||"left",vertical:"middle"},y.getRow(d).height=V*2+10,d++}else if(a.type==="row"&&a.cells){const u=a.cells.map(E=>{var b;return ee((b=E.style)==null?void 0:b.width)||1/a.cells.length});let c=0;const V=u.map(E=>{const b=Math.round(c*_);c+=E;const h=Math.round(c*_)-1;return{start:b,end:Math.max(h,b)}});for(let E=0;E<a.cells.length;E++){const b=a.cells[E],h=V[E],g=`${F(h.start)}${d}`,x=`${F(h.end)}${d}`;g!==x&&y.mergeCells(`${g}:${x}`);const C=y.getCell(g);C.value=b.text;const q=b.style||{};C.alignment={horizontal:q.align||"left",vertical:"middle"};const T={name:"微软雅黑",size:q.fontSize||11,bold:q.bold===!0,italic:q.italic===!0};if(q.color){const M=q.color.replace("#","").toUpperCase();T.color={argb:M.length===6?"FF"+M:M}}C.font=T}y.getRow(d).height=22,d++}}const N=50,U=6;for(let a=0;a<_;a++){const u=s.columns[a],c=a+1;if(m==="auto-wrap")y.getColumn(c).width=u.width?Math.max(u.width/7,8):12;else{let V=0;for(let h=1;h<d;h++)V=Math.max(V,te(y.getCell(h,c).value));const E=u.width?Math.max(u.width/7,10):12,b=Math.min(Math.max(V+2,U),N);y.getColumn(c).width=Math.max(b,E)}}const L=await k.xlsx.writeBuffer();return new Blob([L],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}function Z(){return{columns:[],group_rules:{},header_sections:[],footer_sections:[],summary_fields:[]}}const Ve={class:"qukt-quote-sheet"},he={key:1,class:"qukt-q-divider"},Ee={key:3,class:"qukt-q-row"},Ne={class:"qukt-q-label"},_e={class:"qukt-q-value"},ge={key:0,class:"qukt-q-table-wrap"},qe={class:"qukt-q-table"},we={key:0,class:"subtotal-row"},$e=["colspan"],xe={class:"subtotal-value"},Ce={key:1},Be=["rowspan"],Ue={key:0,class:"empty-row"},Se=["colspan"],Te={key:1,class:"qukt-q-summary"},De={class:"qukt-q-summary-label"},Me={key:0,class:"qukt-q-divider"},Ae={key:2,class:"qukt-q-row"},ie={__name:"QuokitSheet",props:{tpl:{type:Object,default:Z},data:{type:Array,default:()=>[]},placeholder:{type:String,default:"-"}},setup(s,{expose:o}){function i(a){const u=(a&&a.header_sections||[]).flatMap(c=>c.cells||[]).find(c=>c.type==="field"&&c.value);return(u==null?void 0:u.value)||"untitled"}const m=s,f=e.computed(()=>m.data||[]);function k(a){const u=a.style||{},c={width:u.width||"auto"};c.textAlign=u.align||"left",u.color&&(c.color=u.color),u.fontSize&&(c.fontSize=u.fontSize+"px"),u.bold&&(c.fontWeight="bold"),u.italic&&(c.fontStyle="italic");const V=u.border;if(V)for(const E of["top","bottom","left","right"]){const b=V[E];b&&b.style&&b.width>0&&(c["border-"+E]=`${b.width}px ${b.style} ${b.color||"#dcdfe6"}`)}return c}function y(a){return"¥ "+(Number(a)||0).toFixed(2)}const _=e.computed(()=>(m.tpl&&m.tpl.columns||[]).find(a=>a.editor==="AUTO_CALC"));function $(a){var c;const u=((c=_.value)==null?void 0:c.formula)||"quantity * unit_price";return I(u,a)}const d=e.computed(()=>f.value.reduce((a,u)=>a+Number($(u)||0),0)),t=e.computed(()=>f.value.reduce((a,u)=>a+Number(u.quantity||0),0));function n(){var u;let a=d.value;if((u=m.tpl)!=null&&u.summary_fields)for(const c of m.tpl.summary_fields)c.type==="MANUAL_INPUT"&&(a+=B(c));return a}function p(a){const u={},c=a.style||{};return c.color&&(u.color=c.color),c.fontSize&&(u.fontSize=c.fontSize+"px"),c.bold&&(u.fontWeight="bold"),c.italic&&(u.fontStyle="italic"),u}function l(a){const u={},c=a.style||{};return c.color&&(u.color=c.color),c.fontSize&&(u.fontSize=c.fontSize+"px"),c.bold&&(u.fontWeight="bold"),c.italic&&(u.fontStyle="italic"),c.align?u.textAlign=c.align:a.align&&(u.textAlign=a.align),u}function B(a){return Number(a.default??0)}function r(){var c;const a={group_total:d.value,quantity_sum:t.value},u=((c=m.tpl)==null?void 0:c.summary_fields)||[];for(const V of u)V.type==="MANUAL_INPUT"&&(a[V.field]=B(V));for(const V of u)if(V.type==="AUTO_CALC"&&V.formula)try{a[V.field]=I(V.formula,a)}catch{a[V.field]=0}return a.grand_total=n(),a}function S(a){return a.type==="PLAIN_TEXT"?a.text||"":a.type==="AUTO_CALC"?a.formula?r()[a.field]??0:0:B(a)}function w(a){if(a.type==="PLAIN_TEXT")return a.text||"";const u=Number(S(a))||0,c=Number.isInteger(u)?u:u.toFixed(2);return(a.prefix||"")+c+(a.suffix||"")}const N=e.computed(()=>{var b;const a=f.value.map(h=>({...h})),u=(b=m.tpl)==null?void 0:b.group_rules;if(!(u!=null&&u.merge_field))return a;const c=[],V=u.merge_field;let E=0;for(;E<a.length;){const h=[a[E]];let g=E+1;for(;g<a.length&&a[g][V]===a[E][V];)h.push(a[g]),g++;if(c.push(...h),(u.show_detail_subtotal??!0)&&a[E][V]!==void 0&&a[E][V]!==null&&a[E][V]!==""){const C=h.reduce((q,T)=>q+Number($(T)||0),0);c.push({__is_subtotal:!0,__group_key:a[E][V],__group_sum:C})}E=g}return c});function U(a,u){var q,T,M,O;const c=N.value,V=c[a];if(!V||V.__is_subtotal)return 1;const E=(q=m.tpl)==null?void 0:q.group_rules,b=E==null?void 0:E.merge_field,h=(m.tpl&&m.tpl.columns||[]).find(j=>j.field===u),g=b&&u===b,x=(h==null?void 0:h.merge_on_group)===!0;if(!g&&!x)return 1;const C=(()=>{var D,v;if(!b)return c.length;const j=V[b];let R=a+1;for(;R<c.length&&((D=c[R])==null?void 0:D[b])===j&&!((v=c[R])!=null&&v.__is_subtotal);)R++;return R})();if(g)return a>0&&((T=c[a-1])==null?void 0:T[b])===V[b]&&!((M=c[a-1])!=null&&M.__is_subtotal)?0:C-a;if(x){const j=V[u];if(a>0){const D=c[a-1];if((!b||(D==null?void 0:D[b])===V[b]&&!(D!=null&&D.__is_subtotal))&&(D==null?void 0:D[u])===j)return 0}let R=1;for(let D=a+1;D<C&&((O=c[D])==null?void 0:O[u])===j;D++)R++;return R}return 1}async function L(a=!1){if(!m.tpl)return;const u=await ye(m.tpl,m.data||[],a?{layout:"auto-width"}:void 0),c=URL.createObjectURL(u),V=document.createElement("a");V.href=c,V.download=`报价单_${i(m.tpl)}_${new Date().toISOString().slice(0,10)}.xlsx`,V.click(),URL.revokeObjectURL(c)}function G(a=!1){const u=document.querySelector(".qukt-quote-sheet");if(!u)return;const c=a!==!0,V=window.open("","_blank",c?"width=1200,height=900":"width=900,height=1200");if(!V)return;const E=Array.from(document.styleSheets).map(h=>{try{return Array.from(h.cssRules).map(g=>g.cssText).join(`
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".qukt-toolbar{display:flex;align-items:center;gap:10px;margin-bottom:12px;flex-wrap:wrap}.qukt-tip{color:#909399;font-size:13px;margin-right:auto}.qukt-tip code{background:#f5f7fa;padding:1px 6px;border-radius:3px}.qukt-btn-group-inline{display:flex;gap:6px}.qukt-btn{padding:6px 14px;border:1px solid #dcdfe6;border-radius:4px;background:#fff;cursor:pointer;font-size:13px}.qukt-btn:hover{border-color:#409eff;color:#409eff}.qukt-btn-primary{background:#409eff;border-color:#409eff;color:#fff}.qukt-btn-primary:hover{background:#66b1ff;color:#fff}.qukt-btn-ghost{background:transparent;border:1px dashed #dcdfe6;color:#909399;margin-top:8px}.qukt-mini-btn{background:transparent;border:1px solid #dcdfe6;border-radius:3px;padding:2px 8px;cursor:pointer;font-size:12px;margin-right:3px}.qukt-mini-btn:hover{border-color:#409eff;color:#409eff}.qukt-mini-btn:disabled{opacity:.3;cursor:not-allowed}.qukt-mini-btn.danger:hover{border-color:#f56c6c;color:#f56c6c}.qukt-muted{color:#c0c4cc;font-size:12px}.qukt-cell-input{flex:1;width:100%;border:1px solid #dcdfe6;border-radius:3px;padding:4px 8px;font-size:13px;outline:none;min-width:0;box-sizing:border-box}.qukt-cell-input:focus{border-color:#409eff}.qukt-cell-input.small{flex:0 0 160px;max-width:100%}.qukt-cell-input.tiny{width:56px;height:22px;font-size:11px;padding:0 4px;flex:none}.qukt-color-input{width:24px;height:22px;border:1px solid #dcdfe6;border-radius:3px;padding:0;cursor:pointer;background:#fff}.qukt-chk-label{font-size:12px;color:#606266;display:inline-flex;align-items:center;gap:3px;flex-shrink:0}.qukt-designer{padding:0;display:flex;flex-direction:column;height:100%;min-height:0}.qukt-tabs{display:flex;gap:0;border-bottom:2px solid #ebeef5;margin-bottom:16px;flex-shrink:0}.qukt-tab{padding:10px 20px;cursor:pointer;font-size:14px;color:#909399;border-bottom:2px solid transparent;margin-bottom:-2px;transition:all .2s}.qukt-tab:hover{color:#409eff}.qukt-tab.active{color:#409eff;border-bottom-color:#409eff;font-weight:600}.qukt-tab-content{padding:10px 0;flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.qukt-tab-content>*{flex:1;min-height:0;display:flex;flex-direction:column}.qukt-tab-content-preview{overflow-y:auto}.qukt-tab-content-preview>*{flex:none;min-height:0}.qukt-page{padding:20px;background:#fff;border-radius:8px;height:100%;overflow-y:auto}.qukt-empty-tip{text-align:center;padding:60px 20px;background:#fafbfc;border:2px dashed #dcdfe6;border-radius:8px}.qukt-empty-icon{font-size:48px;margin-bottom:12px}.qukt-empty-text{color:#909399;font-size:14px;margin-bottom:16px}.qukt-data-table{border:1px solid #ebeef5;border-radius:6px;overflow:hidden;margin-bottom:16px}.qukt-main-table{width:100%;border-collapse:collapse;font-size:13px}.qukt-main-table th{background:#f5f7fa;padding:10px 12px;text-align:left;font-weight:600;color:#303133;border:1px solid #ebeef5}.qukt-main-table td{padding:10px 12px;border:1px solid #ebeef5;color:#606266}.qukt-main-table tbody tr{cursor:pointer;transition:background .15s}.qukt-main-table tbody tr:hover{background:#f5f7fa}.qukt-subtotal{color:#67c23a;font-weight:500;text-align:right;display:block}.qukt-op-cell{white-space:nowrap}.qukt-row-btn{background:none;border:none;cursor:pointer;font-size:13px;color:#409eff;margin-right:10px;padding:2px 4px;border-radius:3px}.qukt-row-btn:hover{text-decoration:underline}.qukt-row-btn.danger{color:#f56c6c}.qukt-de-mask,.qukt-gr-mask{position:fixed;top:0;right:0;bottom:0;left:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:1000}.qukt-de-dialog{background:#fff;border-radius:10px;width:420px;max-width:92vw;max-height:86vh;display:flex;flex-direction:column;box-shadow:0 10px 40px #00000040}.qukt-de-header{padding:16px 20px;border-bottom:1px solid #ebeef5;display:flex;justify-content:space-between;align-items:center;font-size:15px;font-weight:600;color:#303133;flex-shrink:0}.qukt-de-close{border:none;background:transparent;cursor:pointer;font-size:16px;color:#909399}.qukt-de-close:hover{color:#f56c6c}.qukt-de-content{padding:16px 20px;flex:1;overflow-y:auto}.qukt-de-footer{padding:12px 20px;border-top:1px solid #ebeef5;text-align:right;flex-shrink:0}.qukt-form-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.qukt-form-cell.full{grid-column:1 / -1}.qukt-form-cell-label{display:block;font-size:13px;color:#606266;margin-bottom:6px}.qukt-gr-dialog{width:380px;background:#fff;border-radius:8px;box-shadow:0 8px 28px #0003}.qukt-gr-header{padding:12px 16px;border-bottom:1px solid #ebeef5;display:flex;justify-content:space-between;align-items:center;font-size:15px;font-weight:600;color:#303133}.qukt-gr-close{border:none;background:transparent;cursor:pointer;font-size:16px;color:#909399}.qukt-gr-close:hover{color:#f56c6c}.qukt-gr-content{padding:14px 16px;max-height:70vh;overflow-y:auto}.qukt-gr-footer{padding:10px 16px;border-top:1px solid #ebeef5;text-align:right}.qukt-gr-tips{background:#ecf5ff;border:1px solid #d9ecff;border-radius:6px;padding:8px 10px;margin-bottom:14px}.qukt-gr-tips p{font-size:12px;color:#606266;margin:4px 0;line-height:1.6}.qukt-gr-tips code{background:#fff;padding:1px 6px;border-radius:3px;font-size:11px}.qukt-gr-form{display:flex;flex-direction:column;gap:10px}.qukt-gr-form-row{display:flex;align-items:center;gap:10px}.qukt-gr-form-label{width:80px;text-align:right;font-size:12px;color:#606266;flex-shrink:0}.qukt-table-wrap{width:100%;overflow:auto;flex:1;min-height:0}.qukt-table-wrap.is-narrow .qukt-design-table{min-width:900px}.qukt-design-table{width:100%;border-collapse:collapse;font-size:13px}.qukt-design-table th,.qukt-design-table td{border:1px solid #ebeef5;padding:6px 8px;text-align:center}.qukt-design-table th{background:#f5f7fa;font-weight:600;color:#303133}.qukt-design-table td.idx{color:#909399;background:#fafbfc;width:50px;text-align:center}.qukt-design-table tbody tr:hover{background:#fafbfc}.qukt-col-merge label{display:flex;align-items:center;gap:4px;font-size:12px;cursor:pointer}.qukt-title-group{display:flex;gap:2px;align-items:center}.qukt-title-group .qukt-cell-input{min-width:0}.qukt-title-group .pref-suf{flex:0 0 36px;max-width:48px;background:#fafbfc;font-size:12px;color:#606266}.qukt-title-group .pref-suf::placeholder{color:#c0c4cc;font-size:11px}.qukt-quote-sheet{background:#fff;padding:32px 40px;border-radius:4px;box-shadow:0 2px 12px #0000000f}.qukt-q-title{margin:0 0 12px;font-size:18px;font-weight:700;color:#303133;text-align:center}.qukt-q-divider{border-top:1px solid #dcdfe6;margin:10px 0}.qukt-q-text{margin:4px 0;font-size:13px;color:#606266}.qukt-q-row{display:flex;margin-bottom:4px}.qukt-q-cell{padding:8px 12px;font-size:13px;background:#fff;box-sizing:border-box}.qukt-q-label{color:#909399}.qukt-q-value{color:#303133;font-weight:500}.qukt-q-table-wrap{margin-top:10px}.qukt-q-table{width:100%;border-collapse:collapse;font-size:13px}.qukt-q-table th{background:#f5f7fa;padding:10px 12px;border:1px solid #dcdfe6;text-align:center;font-weight:600;color:#303133;white-space:pre-wrap}.qukt-q-table td{padding:9px 12px;border:1px solid #dcdfe6;color:#606266;text-align:center;vertical-align:middle;white-space:pre-wrap}.qukt-q-table td.merged-cell{background:#fafbfc;font-weight:500}.qukt-q-table tr.subtotal-row td.subtotal-label{background:#f0f9ff;color:#409eff;font-weight:600;text-align:right;padding-right:16px;font-style:italic;white-space:pre}.qukt-q-table tr.subtotal-row td.subtotal-value{background:#f0f9ff;color:#409eff;font-weight:600;text-align:right;white-space:pre}.qukt-q-empty{text-align:center;padding:30px;color:#c0c4cc;font-size:14px}.qukt-q-summary{margin-top:10px;margin-left:auto;width:320px}.qukt-q-summary-row{display:flex;justify-content:space-between;padding:6px 0;border-bottom:1px dashed #ebeef5;font-size:13px}.qukt-q-summary-label{color:#606266}.qukt-q-summary-value{font-variant-numeric:tabular-nums;white-space:pre}.qukt-q-footer{margin-top:10px}.qukt-help-modal{position:fixed;top:0;left:0;right:0;bottom:0;background:#00000073;z-index:9999;display:flex;align-items:center;justify-content:center}.qukt-help-dialog{background:#fff;border-radius:10px;width:780px;max-width:92vw;max-height:86vh;display:flex;flex-direction:column;box-shadow:0 10px 40px #00000040}.qukt-help-header{padding:16px 24px;border-bottom:1px solid #ebeef5;display:flex;justify-content:space-between;align-items:center}.qukt-help-header h3{margin:0;font-size:17px;color:#303133}.qukt-close-btn{background:transparent;border:none;font-size:20px;cursor:pointer;color:#909399;padding:4px 10px;border-radius:4px}.qukt-close-btn:hover{background:#f5f7fa;color:#303133}.qukt-help-body{padding:20px 28px 28px;overflow-y:auto;font-size:13px;color:#606266;line-height:1.7}.qukt-help-section{margin-bottom:24px}.qukt-help-section h4{font-size:15px;color:#409eff;margin:0 0 10px;padding-bottom:6px;border-bottom:1px dashed #dcdfe6}.qukt-help-section p{margin:6px 0}.qukt-help-section ul,.qukt-help-section ol{margin:6px 0 6px 22px;padding:0}.qukt-help-section li{margin:3px 0}.qukt-help-section code{background:#f0f2f5;color:#d63384;padding:1px 6px;border-radius:3px;font-size:12px;font-family:Consolas,monospace}.qukt-help-section pre.code{background:#f5f7fa;border:1px solid #ebeef5;border-radius:5px;padding:10px 14px;overflow-x:auto;font-size:12px;font-family:Consolas,Monaco,monospace;line-height:1.55;margin:8px 0;color:#495057}.qukt-help-table{width:100%;border-collapse:collapse;margin:10px 0;font-size:12.5px}.qukt-help-table th,.qukt-help-table td{border:1px solid #ebeef5;padding:7px 10px;text-align:left}.qukt-help-table th{background:#f5f7fa;font-weight:600;color:#303133}.qukt-help-table td:first-child{white-space:nowrap;font-weight:500}.qukt-tip-box{background:#ecf5ff;border-left:3px solid #409eff;padding:8px 14px;border-radius:3px;color:#606266;margin:10px 0;font-size:12.5px}.qukt-tip-box.final-tip{background:#f0f9eb;border-left-color:#67c23a;font-size:13px;padding:14px 18px}.qukt-steps{padding-left:22px}.qukt-steps li{margin-bottom:4px}.qukt-two-col{display:flex;gap:16px;flex:1;min-height:0;overflow:hidden}.qukt-col-left{flex:1;min-width:0;overflow-y:auto;padding-right:4px}.qukt-col-right{width:360px;flex-shrink:0;overflow-y:auto;max-height:100%}.qukt-two-col.is-narrow{flex-direction:column;overflow-y:auto}.qukt-two-col.is-narrow .qukt-col-right{width:100%;flex-shrink:0;overflow:visible}.qukt-two-col.is-narrow .qukt-col-left{overflow:visible}.qukt-sec-block{border:1px solid #ebeef5;border-radius:6px;padding:12px;margin-bottom:10px;background:#fafbfc}.qukt-sec-block--divider .qukt-sec-header{margin-bottom:0}.qukt-sec-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}.qukt-sec-type{font-size:13px;font-weight:600;color:#409eff;background:#ecf5ff;padding:2px 8px;border-radius:3px}.qukt-sec-actions{display:flex;gap:2px}.qukt-sec-row{display:flex;align-items:center;gap:6px;margin-bottom:6px;flex-wrap:wrap}.qukt-sec-row label,.qukt-sec-row .label{font-size:12px;color:#606266;min-width:54px;flex-shrink:0}.qukt-inline-group{display:inline-flex;align-items:center;gap:6px;flex-shrink:0}.qukt-cells-list{display:flex;flex-direction:column;gap:8px}.qukt-cell-block{border:1px dashed #dcdfe6;border-radius:4px;padding:8px;background:#fff}.qukt-cell-toolbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px;font-size:12px;color:#909399}.qukt-border-config{flex-wrap:wrap}.qukt-border-config>.label{width:100%;margin-bottom:4px}.qukt-border-group{display:flex;flex-wrap:wrap;gap:4px;flex:1}.qukt-border-item{display:flex;align-items:center;gap:2px;padding:2px 4px;background:#f8f9fb;border-radius:3px;font-size:11px;color:#606266}.qukt-border-item>span{min-width:12px;text-align:center}.qukt-border-config .qukt-mini-btn{margin-left:4px}.qukt-preview-box{border:1px solid #dcdfe6;border-radius:6px;overflow:hidden;background:#fff;top:20px}.qukt-preview-label{padding:8px 12px;background:#f5f7fa;font-size:13px;font-weight:600;color:#606266;border-bottom:1px solid #ebeef5}.qukt-preview-inner{padding:14px}.qukt-p-title{margin:6px 0 10px}.qukt-p-divider{height:1px;background:#dcdfe6;margin:8px 0}.qukt-p-text{margin:4px 0}.qukt-p-row{display:flex;margin-bottom:6px}.qukt-p-cell{padding:6px 10px;background:#fff}.qukt-p-label{opacity:.8}.qukt-p-bind-placeholder{opacity:.7}.qukt-empty-hint{text-align:center;padding:20px;color:#c0c4cc;font-size:13px}.qukt-preview-title{font-size:13px;font-weight:600;color:#606266;margin:0 0 10px}.qukt-summary-preview{border:1px solid #ebeef5;border-radius:6px;padding:12px;background:#fff}.qukt-sp-row{display:flex;justify-content:space-between;align-items:center;padding:6px 0;font-size:13px}.qukt-sp-label{color:#606266}.qukt-sp-value{font-weight:500;font-size:12px;white-space:pre}.qukt-preview-help{margin-top:12px;padding:10px 12px;background:#f4f4f5;border-radius:6px;font-size:12px;color:#909399;line-height:1.8}.qukt-preview-help b{color:#606266}.qukt-preview-help code{background:#e9e9eb;padding:1px 5px;border-radius:3px;color:#606266;font-family:monospace}.qukt-bind-section{margin-bottom:16px;background:#f4f9ff;border:1px solid #dbe8fb;border-radius:8px;padding:14px 16px}.qukt-bind-title{font-size:13px;font-weight:600;color:#409eff;margin-bottom:10px}.qukt-bind-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:10px 16px}.qukt-bind-item{display:flex;flex-direction:row;align-items:center;gap:8px}.qukt-bind-label{font-size:12px;color:#606266;font-weight:500;white-space:nowrap;min-width:60px;flex-shrink:0}.qukt-bind-item .qukt-cell-input{flex:1}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
+
(function(j,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("exceljs")):typeof define=="function"&&define.amd?define(["exports","vue","exceljs"],e):(j=typeof globalThis<"u"?globalThis:j||self,e(j.VueQuokit={},j.Vue,j.ExcelJS))})(this,function(j,e,We){"use strict";function H(n,o){if(!n)return 0;const t=String(n).replace(/\s+/g,"");if(!t)return 0;let c=0;function E(){return t[c]}function m(){return t[c++]}function r(s){if(E()!==s)throw new Error("公式解析错误: 期望 "+s+" at "+c);c++}function V(){const s=E();if(s==="("){m();const b=q();return r(")"),b}if(s==="-")return m(),-V();if(s==="+")return m(),V();if(s>="0"&&s<="9"||s==="."){let b="";for(;c<t.length&&(t[c]>="0"&&t[c]<="9"||t[c]===".");)b+=t[c++];return parseFloat(b)}if(s>="a"&&s<="z"||s>="A"&&s<="Z"||s==="_"){let b="";for(;c<t.length&&(t[c]>="a"&&t[c]<="z"||t[c]>="A"&&t[c]<="Z"||t[c]==="_"||t[c]>="0"&&t[c]<="9");)b+=t[c++];return Number(o[b]||0)}throw new Error('公式解析错误: 非法字符 "'+s+'" at '+c)}function N(){let s=V();for(;c<t.length&&(E()==="*"||E()==="/");){const b=m(),y=V();s=b==="*"?s*y:y===0?0:s/y}return s}function q(){let s=N();for(;c<t.length&&(E()==="+"||E()==="-");){const b=m(),y=N();s=b==="+"?s+y:s-y}return s}try{const s=q();return Math.round(s*100)/100}catch{return 0}}const I={AUTO_SEQ:{value:"AUTO_SEQ",label:"自动序号",defaultWidth:60,defaultTitle:"序号",defaultFieldBase:"seq",hasDict:!1,hasFormula:!1,canMerge:!1,editable:!1},AUTO_CALC:{value:"AUTO_CALC",label:"公式计算",defaultWidth:120,defaultTitle:"计算值",defaultFieldBase:"subtotal",hasDict:!1,hasFormula:!0,canMerge:!1,editable:!1},INPUT:{value:"INPUT",label:"文本输入",defaultWidth:130,defaultTitle:"文本",defaultFieldBase:"custom",hasDict:!1,hasFormula:!1,canMerge:!0,editable:!0},NUMBER:{value:"NUMBER",label:"数字输入",defaultWidth:100,defaultTitle:"数值",defaultFieldBase:"custom",hasDict:!1,hasFormula:!1,canMerge:!0,editable:!0},TEXTAREA:{value:"TEXTAREA",label:"多行文本",defaultWidth:200,defaultTitle:"说明",defaultFieldBase:"custom",hasDict:!1,hasFormula:!1,canMerge:!0,editable:!0},SELECT_DICT:{value:"SELECT_DICT",label:"下拉选择",defaultWidth:130,defaultTitle:"选项",defaultFieldBase:"custom",hasDict:!0,defaultDictStr:"选项1,选项2",hasFormula:!1,canMerge:!0,editable:!0}};Object.keys(I).map(n=>I[n].value);function W(n){return I[n]||I.INPUT}const G={MANUAL_INPUT:{value:"MANUAL_INPUT",label:"手动数值",hasDefault:!0,hasFormula:!1,hasText:!1},AUTO_CALC:{value:"AUTO_CALC",label:"自动计算",hasDefault:!1,hasFormula:!0,hasText:!1},PLAIN_TEXT:{value:"PLAIN_TEXT",label:"纯文本",hasDefault:!1,hasFormula:!1,hasText:!0}};Object.keys(G).map(n=>G[n].value);function P(n){return G[n]||G.MANUAL_INPUT}const ue={TEXT:{value:"text",label:"纯文本"},ROW:{value:"row",label:"表格行"},DIVIDER:{value:"divider",label:"分割线"}};Object.keys(ue).map(n=>ue[n].value);const v={FIELD:{value:"field",label:"绑定字段"},TEXT:{value:"text",label:"纯文本"},IMAGE:{value:"image",label:"图片"}};Object.keys(v).map(n=>v[n].value);function X(n){let o="";for(;n>=0;)o=String.fromCharCode(65+n%26)+o,n=Math.floor(n/26)-1;return o}function fe(n){return typeof n=="string"?parseFloat(n)/100:0}const ee={style:"thin",color:{argb:"FFDCDFE6"}},te={style:"medium",color:{argb:"FF606266"}},ke=11;function be(n){if(!n)return null;const o=n.replace("#","").toUpperCase();return o.length===6?"FF"+o:o}function he(n,o){if(!o)return;const t={name:"微软雅黑"};if(o.fontSize&&(t.size=o.fontSize),o.bold&&(t.bold=!0),o.italic&&(t.italic=!0),o.color){const c=be(o.color);c&&(t.color={argb:c})}if(n.font=t,o.align&&(n.alignment={horizontal:o.align,vertical:"middle",wrapText:!0,indent:1}),o.border){const c={};for(const E of["top","bottom","left","right"]){const m=o.border[E];if(m&&m.style&&m.width>0){const r=be(m.color)||"FFDCDFE6";let V=m.style;V==="solid"&&(V="thin"),c[E]={style:V,color:{argb:r}}}}Object.keys(c).length>0&&(n.border=c)}}function ge(n){if(n==null)return 0;if(typeof n=="number")return String(n).length;const o=String(n);let t=0;for(const c of o)c!==`
|
|
3
|
+
`&&(/[\u4e00-\u9fa5\u3000-\u303f\uff00-\uffef\u2e80-\u2fdf\u31c0-\u31ef]/.test(c)?t+=2:t+=1);return t}function Ee(n,o=11){let t=1;for(const m of n){const r=String(m??""),V=r.split(`
|
|
4
|
+
`).length,N=ge(r),s=r.length===0?1:Math.ceil(N/12);t=Math.max(t,V,s)}const c=o+8;return Math.max(50,t*c+16*2)}function ye(n,o,t,c,E){for(let m=o;m<=t;m++)for(let r=c;r<=E;r++){const V=n.getCell(m,r),N=V.border||{};V.border={top:N.top||ee,left:N.left||ee,right:N.right||ee,bottom:N.bottom||ee}}}function Ve(n,o,t,c,E){for(let m=c;m<=E;m++)n.getCell(o,m).border={...n.getCell(o,m).border||{},top:te},n.getCell(t,m).border={...n.getCell(t,m).border||{},bottom:te};for(let m=o;m<=t;m++)n.getCell(m,c).border={...n.getCell(m,c).border||{},left:te},n.getCell(m,E).border={...n.getCell(m,E).border||{},right:te}}function Ne(n,o){return n.bindEnabled&&n.bindField?o[n.bindField]??"":n.text??""}function _e(n,o){const t=n.type===v.FIELD.value&&n.label&&!n.hideLabel;if(n.bindEnabled&&n.bindField){const c=o[n.bindField]??"";return t?n.label+c:c}return n.type===v.FIELD.value?(t?n.label:"")+(n.value??""):n.text??""}async function Pe(n,o,t={}){var h;if(!n||!Array.isArray(n.columns)||n.columns.length===0)throw new Error("模板为空或缺少列定义");const c=(o==null?void 0:o.headerData)||{},E=(o==null?void 0:o.footerData)||{},m=(o==null?void 0:o.rows)||o||[];Array.isArray(m)||(m=[]);const r=t.layout||"auto-wrap",V=r==="auto-wrap",N=new We.Workbook,q=N.addWorksheet("报价单"),s=n.columns.length,b=X(s-1);let y=1;const D=()=>(n.columns||[]).find(a=>W(a.editor).hasFormula),M=a=>{const p=D(),k=(p==null?void 0:p.formula)||"quantity * unit_price";return H(k,a)};if(n.header_sections){for(const a of n.header_sections)if(a.type==="divider")y++;else if(a.type==="text"){q.mergeCells(`A${y}:${b}${y}`);const p=q.getCell(`A${y}`);p.value=Ne(a,c);const k=a.style||{},_=k.fontSize||13;if(p.font={size:_,bold:k.bold===!0,italic:k.italic===!0,name:"微软雅黑"},k.color){const w=k.color.replace("#","").toUpperCase();p.font.color={argb:w.length===6?"FF"+w:w}}p.alignment={horizontal:k.align||"left",vertical:"middle"},q.getRow(y).height=_*2+10,y++}else if(a.type==="row"&&a.cells){const p=a.cells.map(w=>{var B;return fe((B=w.style)==null?void 0:B.width)||1/a.cells.length});let k=0;const _=p.map(w=>{const B=Math.round(k*s);k+=w;const C=Math.round(k*s)-1;return{start:B,end:Math.max(C,B)}});for(let w=0;w<a.cells.length;w++){const B=a.cells[w],C=_[w],$=`${X(C.start)}${y}`,L=`${X(C.end)}${y}`;$!==L&&q.mergeCells(`${$}:${L}`);const U=q.getCell($);U.value=_e(B,c);const x=B.style||{},A=x.fontSize||11;if(U.font={size:A,bold:x.bold===!0,italic:x.italic===!0,name:"微软雅黑"},x.color){const S=x.color.replace("#","").toUpperCase();U.font.color={argb:S.length===6?"FF"+S:S}}U.alignment={horizontal:x.align||"left",vertical:"middle"}}q.getRow(y).height=22,y++}}const z=y,F=q.getRow(y);F.values=n.columns.map(a=>a.title),F.font={bold:!0,name:"微软雅黑",size:12},F.fill={type:"pattern",pattern:"solid",fgColor:{argb:"FFE0E0E0"}},F.alignment={horizontal:"center",vertical:"middle",wrapText:V,indent:1},F.height=V?48:44,y++;const f=n.group_rules,i=f==null?void 0:f.merge_field,l=n.columns;if(i){let a=0,p=0;for(;a<m.length;){const k=[];let _=a;for(;_<m.length&&m[_][i]===m[a][i];)k.push(m[_]),_++;const w=y;for(let $=0;$<k.length;$++){p++;const L=k[$],U=l.map(S=>S.editor===I.AUTO_SEQ.value?p:W(S.editor).hasFormula?M(L):L[S.field]??""),x=U.map((S,T)=>(l[T].prefix||"")+S+(l[T].suffix||"")),A=q.getRow(y);A.values=U,A.height=V?Ee(x,11):36;for(let S=0;S<l.length;S++){const T=l[S],Q=A.getCell(S+1);he(Q,T.cellStyle),(T.prefix||T.suffix)&&(Q.value=x[S])}y++}const B=y-1;for(let $=0;$<l.length;$++){const L=l[$];if(L.merge_on_group!==!0)continue;let U=w;for(let x=1;x<k.length;x++)k[x][L.field]!==k[x-1][L.field]&&(w+x-1>U&&q.mergeCells(`${X($)}${U}:${X($)}${w+x-1}`),U=w+x);B>U&&q.mergeCells(`${X($)}${U}:${X($)}${B}`)}if(f.show_detail_subtotal!==!1&&m[a][i]!==void 0&&m[a][i]!==null&&m[a][i]!==""){const $=k.reduce((Q,Z)=>Q+Number(M(Z)||0),0),L=X(Math.max(0,s-2));q.mergeCells(`A${y}:${L}${y}`);const U=q.getCell(`A${y}`);U.value=`小计(${m[a][i]})`,U.alignment={horizontal:"right",vertical:"middle"},U.font={bold:!0,italic:!0,color:{argb:"FF409EFF"},name:"微软雅黑",size:11};const x=q.getCell(`${b}${y}`),A=f.subtotal_prefix??"",S=f.subtotal_suffix??"";x.value=A+$.toFixed(2)+S,x.alignment={horizontal:"right",vertical:"middle"},x.font={bold:!0,italic:!0,color:{argb:"FF409EFF"},name:"微软雅黑",size:11};const T=q.getRow(y);T.fill={type:"pattern",pattern:"solid",fgColor:{argb:"FFF0F9FF"}},T.alignment={horizontal:"right",vertical:"middle",wrapText:!0},T.height=32,y++}a=_}}else for(let a=0;a<m.length;a++){const p=m[a],k=l.map(B=>B.editor===I.AUTO_SEQ.value?a+1:W(B.editor).hasFormula?M(p):p[B.field]??""),_=k.map((B,C)=>(l[C].prefix||"")+B+(l[C].suffix||"")),w=q.getRow(y);w.values=k,w.height=V?Ee(_,11):36;for(let B=0;B<l.length;B++){const C=l[B],$=w.getCell(B+1);he($,C.cellStyle),(C.prefix||C.suffix)&&($.value=_[B])}y++}const g=y-1;if(n.summary_fields){y+=1;const a=X(Math.max(0,s-2)),p=X(s-1),k=m.reduce((B,C)=>B+Number(M(C)||0),0),_={group_total:k};for(const B of n.summary_fields)P(B.type).hasDefault&&(_[B.field]=Number(B.default??0));_.grand_total=k+n.summary_fields.filter(B=>P(B.type).hasDefault).reduce((B,C)=>B+_[C.field],0);for(const B of n.summary_fields)P(B.type).hasFormula&&(_[B.field]=H(B.formula||"group_total",_));for(const B of n.summary_fields){const C=P(B.type);let $;C.hasFormula?$=H(B.formula||"group_total",_):C.hasText?$=B.text||"":$=Number(B.default??0);const L=((h=B.style)==null?void 0:h.fontSize)||ke,U=q.getCell(`${a}${y}`),x=q.getCell(`${p}${y}`);U.value=B.label,U.alignment={horizontal:"right",vertical:"middle",indent:1},U.font={name:"微软雅黑",size:ke};const A=B.style||{},S=()=>{const Z={name:"微软雅黑",size:L,bold:!!A.bold,italic:!!A.italic};if(A.color){const pe=A.color.replace("#","").toUpperCase();Z.color={argb:pe.length===6?"FF"+pe:pe}}return Z},T=B.prefix||"",Q=B.suffix||"";if(typeof $=="number"){const Z=$.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2});x.value=T+Z+Q,x.alignment={horizontal:"right",vertical:"middle",indent:1}}else x.value=T+($??"")+Q,x.alignment={horizontal:"right",vertical:"middle",indent:1};x.font=S(),q.getRow(y).height=Math.max(28,L*2+12),y++}const w=y-1;ye(q,z,w,1,s),Ve(q,z,w,1,s)}else ye(q,z,g,1,s),Ve(q,z,g,1,s);if(n.footer_sections){y+=1;for(const a of n.footer_sections)if(a.type==="divider")y++;else if(a.type==="text"){q.mergeCells(`A${y}:${b}${y}`);const p=q.getCell(`A${y}`);p.value=Ne(a,E);const k=a.style||{},_=k.fontSize||13;if(p.font={size:_,bold:k.bold===!0,italic:k.italic===!0,name:"微软雅黑"},k.color){const w=k.color.replace("#","").toUpperCase();p.font.color={argb:w.length===6?"FF"+w:w}}p.alignment={horizontal:k.align||"left",vertical:"middle"},q.getRow(y).height=_*2+10,y++}else if(a.type==="row"&&a.cells){const p=a.cells.map(w=>{var B;return fe((B=w.style)==null?void 0:B.width)||1/a.cells.length});let k=0;const _=p.map(w=>{const B=Math.round(k*s);k+=w;const C=Math.round(k*s)-1;return{start:B,end:Math.max(C,B)}});for(let w=0;w<a.cells.length;w++){const B=a.cells[w],C=_[w],$=`${X(C.start)}${y}`,L=`${X(C.end)}${y}`;$!==L&&q.mergeCells(`${$}:${L}`);const U=q.getCell($);U.value=_e(B,E);const x=B.style||{};U.alignment={horizontal:x.align||"left",vertical:"middle"};const A={name:"微软雅黑",size:x.fontSize||11,bold:x.bold===!0,italic:x.italic===!0};if(x.color){const S=x.color.replace("#","").toUpperCase();A.color={argb:S.length===6?"FF"+S:S}}U.font=A}q.getRow(y).height=22,y++}}const d=50,O=6;for(let a=0;a<s;a++){const p=n.columns[a],k=a+1;if(r==="auto-wrap")q.getColumn(k).width=p.width?Math.max(p.width/7,8):12;else{let _=0;for(let C=1;C<y;C++)_=Math.max(_,ge(q.getCell(C,k).value));const w=p.width?Math.max(p.width/7,10):12,B=Math.min(Math.max(_+2,O),d);q.getColumn(k).width=Math.max(B,w)}}const u=await N.xlsx.writeBuffer();return new Blob([u],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}function R(n){return JSON.parse(JSON.stringify(n))}function Y(n,o){try{return JSON.stringify(n)===JSON.stringify(o)}catch{return!1}}function je(n,o){let t=null;const c=function(...E){clearTimeout(t),t=setTimeout(()=>n.apply(this,E),o)};return c.cancel=()=>{clearTimeout(t),t=null},Object.defineProperty(c,"timer",{get(){return t},configurable:!0}),c}const qe={color:"#303133",fontSize:13,bold:!1,italic:!1,align:"center"};function we(n=[]){return Array.isArray(n)?n.map(o=>{const t=W(o.editor),c=Array.isArray(o.dict)?o.dict:[];return{...o,field:o.field||"",title:o.title||t.defaultTitle,editor:o.editor||I.INPUT.value,width:o.width??t.defaultWidth,dictStr:c.length?c.join(","):o.dictStr||"",formula:o.formula||"",merge_on_group:t.canMerge?o.merge_on_group??!1:!1,cellStyle:{...R(qe),...o.cellStyle||{}},prefix:o.prefix||"",suffix:o.suffix||""}}):[]}function Be(n){return n.map(o=>{const t=W(o.editor),c={field:o.field,title:o.title,editor:o.editor,width:o.width};return t.hasDict&&(c.dict=(o.dictStr||"").split(",").map(E=>E.trim()).filter(Boolean)),t.hasFormula&&(c.formula=o.formula||""),t.canMerge&&(c.merge_on_group=!!o.merge_on_group),o.cellStyle&&(c.cellStyle=o.cellStyle),o.prefix&&(c.prefix=o.prefix),o.suffix&&(c.suffix=o.suffix),c})}function le(n={}){const o=n&&typeof n=="object"?n:{},t=o.merge_field||"";return t?{merge_field:t,show_detail_subtotal:o.show_detail_subtotal??!0,subtotal_prefix:o.subtotal_prefix??"",subtotal_suffix:o.subtotal_suffix??""}:{}}function Xe(n,o,t){const c=W(n);return{field:o,title:c.defaultTitle||t||"新列",editor:n,width:c.defaultWidth,dictStr:c.hasDict&&c.defaultDictStr||"",formula:"",merge_on_group:!1,cellStyle:R(qe),prefix:"",suffix:""}}function xe(){return{top:{style:"",width:1,color:"#dcdfe6"},bottom:{style:"",width:1,color:"#dcdfe6"},left:{style:"",width:1,color:"#dcdfe6"},right:{style:"",width:1,color:"#dcdfe6"}}}function K(n="auto"){return{width:n,color:"#303133",fontSize:13,bold:!1,italic:!1,align:"left",border:xe()}}function oe(n){const o=n.style||{},t={width:o.width||"auto"};t.textAlign=o.align||"left",o.color!=null&&o.color!==""&&(t.color=o.color),o.fontSize!=null&&(t.fontSize=Number(o.fontSize)+"px"),o.bold&&(t.fontWeight="bold"),o.italic&&(t.fontStyle="italic");const c=o.border;if(c)for(const E of["top","bottom","left","right"]){const m=c[E];m&&m.style&&m.width>0&&(t["border-"+E]=`${m.width}px ${m.style} ${m.color||"#dcdfe6"}`)}return t}function Qe(n){const o=new Set;for(const t of n||[])if(t.type==="text"&&t.bindField)o.add(t.bindField);else if(t.type==="row"&&t.cells)for(const c of t.cells)c.bindField&&o.add(c.bindField);return o}function $e(n,o){const t=Qe(o);let c=0;const E=new RegExp("^"+n+"(\\d+)$");for(const V of t){const N=E.exec(V);N&&(c=Math.max(c,parseInt(N[1],10)))}let m=c+1,r=n+String(m).padStart(4,"0");for(;t.has(r);)m++,r=n+String(m).padStart(4,"0");return r}function Ce(n){const o={},t=n&&n.style||{};return t.color&&(o.color=t.color),t.fontSize&&(o.fontSize=Number(t.fontSize)+"px"),t.bold&&(o.fontWeight="bold"),t.italic&&(o.fontStyle="italic"),o}function J(n){const o=Ce(n),t=n&&n.style||{};return t.align?o.textAlign=t.align:n&&n.align&&(o.textAlign=n.align),o}function Se(n){return Ce(n)}function De(n,o,t){n.bindEnabled=!n.bindEnabled,n.bindEnabled?(n.text="",n.bindField=n.bindField||$e(o,t)):n.bindField=""}function Fe(n,o,t){n.bindEnabled=!n.bindEnabled,n.bindEnabled?(n.text="",n.value="",n.bindField=n.bindField||$e(o,t)):n.bindField=""}function He(n,o){let t=n,c=2;for(;o.has(t);)t=n+"_"+c++;return t}function Ge(n=[]){for(const o of n)o.type==="title"&&(o.type="text",o.style=o.style||{color:"#303133",fontSize:18,bold:!0,italic:!1,align:"center"},o.align&&!o.style.align&&(o.style.align=o.align,delete o.align)),o.type==="text"&&(o.style=o.style||{},o.align&&!o.style.align&&(o.style.align=o.align,delete o.align),o.style.color===void 0&&(o.style.color="#303133"),o.style.fontSize===void 0&&(o.style.fontSize=14),o.style.bold===void 0&&(o.style.bold=!1),o.style.italic===void 0&&(o.style.italic=!1),o.style.align===void 0&&(o.style.align="left"),o.bindEnabled===void 0&&(o.bindEnabled=!1),o.bindField===void 0&&(o.bindField=""),o.bindEnabled&&(o.text=""))}function Ye(n=[]){for(const o of n)if(o.type==="row"&&o.cells)for(const t of o.cells)t.style||(t.style=K()),t.style.width===void 0&&(t.style.width="auto"),t.style.color===void 0&&(t.style.color="#303133"),t.style.fontSize===void 0&&(t.style.fontSize=13),t.style.bold===void 0&&(t.style.bold=!1),t.style.italic===void 0&&(t.style.italic=!1),t.style.align===void 0&&(t.style.align="left"),t.style.border===void 0&&(t.style.border=xe()),t.bindEnabled===void 0&&(t.bindEnabled=!1),t.bindField===void 0&&(t.bindField=""),t.hideLabel===void 0&&(t.hideLabel=!1),t.bindEnabled&&(t.text="",t.value="")}function Te(n){const o=[];for(const t of n||[])if(t.type==="text"&&t.bindEnabled)o.push({field:t.bindField,label:t.label||""});else if(t.type==="row"&&t.cells)for(const c of t.cells)c.bindEnabled&&o.push({field:c.bindField,label:c.label||""});return o.filter(t=>t.field)}function ne(n){return!n||n.length===0?[]:(Ge(n),Ye(n),n)}const Ue="sum_";let re=0;function Me(){return re++,Ue+String(re).padStart(4,"0")}function Je(n){const o=P(n),t={color:"#606266",fontSize:13,bold:!1,italic:!1},E={field:Me(),label:"标签",prefix:"",suffix:"",style:t};return o.hasFormula?{...E,type:o.value,formula:""}:o.hasText?{...E,type:o.value,text:""}:{...E,type:G.MANUAL_INPUT.value,default:0}}function de(n=[]){let o=0;for(const t of n)if(t.field){const c=new RegExp("^"+Ue+"(\\d+)$").exec(t.field);c&&(o=Math.max(o,parseInt(c[1],10)))}re=o;for(const t of n)t.field==null&&(t.field=Me()),t.prefix===void 0&&(t.prefix=""),t.suffix===void 0&&(t.suffix=""),t.style===void 0&&(t.style={color:"#606266",fontSize:13,bold:!1,italic:!1}),t.style.color===void 0&&(t.style.color="#606266"),t.style.fontSize===void 0&&(t.style.fontSize=13),t.style.bold===void 0&&(t.style.bold=!1),t.style.italic===void 0&&(t.style.italic=!1)}function ce(){return{columns:[],group_rules:{},header_sections:[],footer_sections:[],summary_fields:[]}}function ie(n){const o=n&&typeof n=="object"?n:{},t=Be(we(o.columns||[])),c=le(o.group_rules||{}),E=ne(R(o.header_sections||[])),m=ne(R(o.footer_sections||[])),r=R(o.summary_fields||[]);return de(r),{columns:t,group_rules:c,header_sections:E,footer_sections:m,summary_fields:r}}const Ze={class:"qukt-quote-sheet"},Ke={key:1,class:"qukt-q-divider"},ve={key:3,class:"qukt-q-row"},et={key:0,class:"qukt-q-table-wrap"},tt={class:"qukt-q-table"},lt={key:0,class:"subtotal-row"},ot=["colspan"],nt={class:"subtotal-value"},it={key:1},at=["rowspan"],st={key:0,class:"empty-row"},rt=["colspan"],dt={key:1,class:"qukt-q-summary"},ct={class:"qukt-q-summary-label"},mt={class:"qukt-q-footer"},pt={key:0,class:"qukt-q-divider"},ut={key:2,class:"qukt-q-row"},ze={__name:"QuokitSheet",props:{tpl:{type:Object,default:ce},data:{type:Object,default:()=>({headerData:{},rows:[],footerData:{}})},placeholder:{type:String,default:"-"}},setup(n,{expose:o}){const t=n,c=e.computed(()=>ie(t.tpl)),E=e.computed(()=>{var u;return((u=t.data)==null?void 0:u.headerData)||{}}),m=e.computed(()=>{var u;return((u=t.data)==null?void 0:u.footerData)||{}}),r=e.computed(()=>{var u;return((u=t.data)==null?void 0:u.rows)||[]});function V(u,h){return u.bindEnabled&&u.bindField?(h==="footer"?m.value:E.value)[u.bindField]??"":u.text||""}function N(u,h){const a=u.type==="field"&&u.label&&!u.hideLabel;if(u.bindEnabled&&u.bindField){const k=(h==="footer"?m.value:E.value)[u.bindField]??"";return a?u.label+k:k}return u.type==="field"?(a?u.label:"")+(u.value??""):u.text||""}function q(u){const h={width:(u.width||100)+"px"},a=u.cellStyle||{};a.color!=null&&a.color!==""&&(h.color=a.color),a.fontSize!=null&&(h.fontSize=Number(a.fontSize)+"px"),a.bold&&(h.fontWeight="bold"),a.italic&&(h.fontStyle="italic"),a.align&&(h.textAlign=a.align);const p=a.border;if(p)for(const k of["top","bottom","left","right"]){const _=p[k];_&&_.style&&_.width>0&&(h["border-"+k]=`${_.width}px ${_.style} ${_.color||"#dcdfe6"}`)}return h}function s(u){return(Number(u)||0).toFixed(2)}const b=e.computed(()=>c.value.columns.find(u=>W(u.editor).hasFormula));function y(u){var a;const h=((a=b.value)==null?void 0:a.formula)||"quantity * unit_price";return H(h,u)}const D=e.computed(()=>r.value.reduce((u,h)=>u+Number(y(h)||0),0));function M(){let u=D.value;for(const h of c.value.summary_fields)P(h.type).hasDefault&&(u+=z(h));return u}function z(u){return Number(u.default??0)}function F(){const u={group_total:D.value},h=c.value.summary_fields;for(const a of h)P(a.type).hasDefault&&(u[a.field]=z(a));for(const a of h)if(P(a.type).hasFormula&&a.formula)try{u[a.field]=H(a.formula,u)}catch{u[a.field]=0}return u.grand_total=M(),u}function f(u){const h=P(u.type);return h.hasText?u.text||"":h.hasFormula?u.formula?F()[u.field]??0:0:z(u)}function i(u){if(P(u.type).hasText)return u.text||"";const h=Number(f(u))||0,a=Number.isInteger(h)?h:h.toFixed(2);return(u.prefix||"")+a+(u.suffix||"")}const l=e.computed(()=>{const u=r.value.map(_=>({..._})),h=c.value.group_rules;if(!(h!=null&&h.merge_field))return u;const a=[],p=h.merge_field;let k=0;for(;k<u.length;){const _=[u[k]];let w=k+1;for(;w<u.length&&u[w][p]===u[k][p];)_.push(u[w]),w++;if(a.push(..._),(h.show_detail_subtotal??!0)&&u[k][p]!==void 0&&u[k][p]!==null&&u[k][p]!==""){const C=_.reduce(($,L)=>$+Number(y(L)||0),0);a.push({__is_subtotal:!0,__group_key:u[k][p],__group_sum:C})}k=w}return a});function g(u,h){var L,U,x;const a=l.value,p=a[u];if(!p||p.__is_subtotal)return 1;const k=c.value.group_rules,_=k==null?void 0:k.merge_field,w=c.value.columns.find(A=>A.field===h),B=_&&h===_,C=(w==null?void 0:w.merge_on_group)===!0;if(!B&&!C)return 1;const $=(()=>{var T,Q;if(!_)return a.length;const A=p[_];let S=u+1;for(;S<a.length&&((T=a[S])==null?void 0:T[_])===A&&!((Q=a[S])!=null&&Q.__is_subtotal);)S++;return S})();if(B)return u>0&&((L=a[u-1])==null?void 0:L[_])===p[_]&&!((U=a[u-1])!=null&&U.__is_subtotal)?0:$-u;if(C){const A=p[h];if(u>0){const T=a[u-1];if((!_||(T==null?void 0:T[_])===p[_]&&!(T!=null&&T.__is_subtotal))&&(T==null?void 0:T[h])===A)return 0}let S=1;for(let T=u+1;T<$&&((x=a[T])==null?void 0:x[h])===A;T++)S++;return S}return 1}async function d(u=!1){const h=c.value;if(!h||h.columns.length===0){console.warn("[QuokitSheet] exportExcel skipped: template has no columns");return}const a=await Pe(h,t.data||{},u?{layout:"auto-width"}:void 0),p=URL.createObjectURL(a),k=document.createElement("a");k.href=p,k.download=`${Date.now()}.xlsx`,document.body.appendChild(k),k.click(),document.body.removeChild(k),setTimeout(()=>URL.revokeObjectURL(p),100)}function O(u=!1){const h=document.querySelector(".qukt-quote-sheet");if(!h)return;const a=u!==!0,p=window.open("","_blank",a?"width=1200,height=900":"width=900,height=1200");if(!p)return;const k=Array.from(document.styleSheets).map(w=>{try{return Array.from(w.cssRules).map(B=>B.cssText).join(`
|
|
5
5
|
`)}catch{return""}}).join(`
|
|
6
|
-
`),
|
|
6
|
+
`),_=h.outerHTML;p.document.write(`<!doctype html>
|
|
7
7
|
<html><head><meta charset="utf-8"><title>报价单打印</title>
|
|
8
|
-
<style>${
|
|
9
|
-
@page { size: ${
|
|
8
|
+
<style>${k}
|
|
9
|
+
@page { size: ${a?"landscape":"portrait"}; margin: 15mm; }
|
|
10
10
|
body { margin: 0; padding: 20px; background: #fff; }
|
|
11
11
|
@media print { body { padding: 0; } }
|
|
12
|
-
</style></head><body>${b}</body></html>`),V.document.close(),V.onload=()=>{V.print()}}return o({print:G,exportExcel:L}),(a,u)=>{var c,V,E,b;return e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",Ve,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(((c=s.tpl)==null?void 0:c.header_sections)||[],(h,g)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"h"+g},[h.type==="title"?(e.openBlock(),e.createElementBlock("h1",{key:0,class:"qukt-q-title",style:e.normalizeStyle(l(h))},e.toDisplayString(h.text),5)):h.type==="divider"?(e.openBlock(),e.createElementBlock("div",he)):h.type==="text"?(e.openBlock(),e.createElementBlock("div",{key:2,class:"qukt-q-text",style:e.normalizeStyle(l(h))},e.toDisplayString(h.text),5)):h.type==="row"?(e.openBlock(),e.createElementBlock("div",Ee,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.cells,(x,C)=>(e.openBlock(),e.createElementBlock("div",{key:C,class:"qukt-q-cell",style:e.normalizeStyle(k(x))},[x.type==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("span",Ne,e.toDisplayString(x.label)+":",1),e.createElementVNode("span",_e,e.toDisplayString(x.value??s.placeholder),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(x.text),1)],64))],4))),128))])):e.createCommentVNode("",!0)],64))),128)),(((V=s.tpl)==null?void 0:V.columns)||[]).length>0?(e.openBlock(),e.createElementBlock("div",ge,[e.createElementVNode("table",qe,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.tpl.columns,h=>(e.openBlock(),e.createElementBlock("th",{key:h.field,style:e.normalizeStyle({width:h.width+"px"})},e.toDisplayString(h.title),5))),128))])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.value,(h,g)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:g},[h.__is_subtotal?(e.openBlock(),e.createElementBlock("tr",we,[e.createElementVNode("td",{colspan:s.tpl.columns.length-1,class:"subtotal-label"},"小计("+e.toDisplayString(h.__group_key)+")",9,$e),e.createElementVNode("td",xe,e.toDisplayString(y(h.__group_sum)),1)])):(e.openBlock(),e.createElementBlock("tr",Ce,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.tpl.columns,(x,C)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:x.field},[U(N.value.indexOf(h),x.field)>0?(e.openBlock(),e.createElementBlock("td",{key:0,rowspan:U(N.value.indexOf(h),x.field),class:e.normalizeClass({"merged-cell":U(N.value.indexOf(h),x.field)>1})},[x.editor==="AUTO_SEQ"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(g+1),1)],64)):x.editor==="AUTO_CALC"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(y($(h))),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(h[x.field]??""),1)],64))],10,Be)):e.createCommentVNode("",!0)],64))),128))]))],64))),128)),N.value.length===0?(e.openBlock(),e.createElementBlock("tr",Ue,[e.createElementVNode("td",{colspan:s.tpl.columns.length,class:"qukt-q-empty"},"(暂无数据)",8,Se)])):e.createCommentVNode("",!0)])])])):e.createCommentVNode("",!0),(((E=s.tpl)==null?void 0:E.summary_fields)||[]).length>0?(e.openBlock(),e.createElementBlock("div",Te,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.tpl.summary_fields,h=>(e.openBlock(),e.createElementBlock("div",{key:h.field,class:"qukt-q-summary-row"},[e.createElementVNode("span",De,e.toDisplayString(h.label),1),e.createElementVNode("span",{class:"qukt-q-summary-value",style:e.normalizeStyle(p(h))},e.toDisplayString(w(h)),5)]))),128))])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(((b=s.tpl)==null?void 0:b.footer_sections)||[],(h,g)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"f"+g},[h.type==="divider"?(e.openBlock(),e.createElementBlock("div",Me)):h.type==="text"?(e.openBlock(),e.createElementBlock("div",{key:1,class:"qukt-q-text",style:e.normalizeStyle(l(h))},e.toDisplayString(h.text),5)):h.type==="row"?(e.openBlock(),e.createElementBlock("div",Ae,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.cells,(x,C)=>(e.openBlock(),e.createElementBlock("div",{key:C,class:"qukt-q-cell",style:e.normalizeStyle(k(x))},e.toDisplayString(x.text),5))),128))])):e.createCommentVNode("",!0)],64))),128))])])}}};function z(s){return JSON.parse(JSON.stringify(s))}function Fe(s,o){let i=null;const m=function(...f){clearTimeout(i),i=setTimeout(()=>s.apply(this,f),o)};return m.cancel=()=>{clearTimeout(i),i=null},Object.defineProperty(m,"timer",{get(){return i},configurable:!0}),m}function se(s=[]){return Array.isArray(s)?s.map(o=>{const i=Array.isArray(o.dict)?o.dict:[];return{...o,field:o.field||"",title:o.title||"",editor:o.editor||"INPUT",width:o.width??130,dictStr:i.length?i.join(","):o.dictStr||"",formula:o.formula||"",merge_on_group:o.merge_on_group??!1}}):[]}function Le(s){return s.map(o=>{const i={field:o.field,title:o.title,editor:o.editor,width:o.width};return o.editor==="SELECT_DICT"&&(i.dict=(o.dictStr||"").split(",").map(m=>m.trim()).filter(Boolean)),o.editor==="AUTO_CALC"&&(i.formula=o.formula||""),o.editor!=="AUTO_SEQ"&&o.editor!=="AUTO_CALC"&&(i.merge_on_group=!!o.merge_on_group),i})}function ze(s,o,i){const m={INPUT:"文本",NUMBER:"数值",SELECT_DICT:"选项",TEXTAREA:"说明",AUTO_CALC:"计算值",AUTO_SEQ:"序号"},f={INPUT:130,NUMBER:100,SELECT_DICT:130,TEXTAREA:200,AUTO_CALC:120,AUTO_SEQ:60};return{field:o,title:m[s]||i||"新列",editor:s,width:f[s]||120,dictStr:"",formula:"",merge_on_group:!1}}function re(s=[],o={}){const i=e.ref(se(z(s))),m=e.ref({merge_field:o.merge_field||"",show_detail_subtotal:o.show_detail_subtotal??!0}),f=e.computed(()=>({columns:Le(i.value),group_rules:(()=>{const _=m.value.merge_field;return _?{merge_field:_,show_detail_subtotal:m.value.show_detail_subtotal??!0}:null})()}));function k(_){i.value=se(z(_||[]))}function y(_){m.value={merge_field:_.merge_field||"",show_detail_subtotal:_.show_detail_subtotal??!0}}return e.reactive({columns:i,groupRules:m,tpl:f,setColumns:k,setGroupRules:y})}function de(){return{top:{style:"",width:1,color:"#dcdfe6"},bottom:{style:"",width:1,color:"#dcdfe6"},left:{style:"",width:1,color:"#dcdfe6"},right:{style:"",width:1,color:"#dcdfe6"}}}function P(s="auto"){return{width:s,color:"#303133",fontSize:13,bold:!1,italic:!1,align:"left",border:de()}}function X(s,o){s.style||(s.style=P());const i=o==="none"?{style:"",width:0,color:"#dcdfe6"}:{style:"solid",width:1,color:"#dcdfe6"};s.style.border={top:{...i},bottom:{...i},left:{...i},right:{...i}}}function ae(s){const o=s.style||{},i={width:o.width||"auto"};i.textAlign=o.align||"left",o.color&&(i.color=o.color),o.fontSize&&(i.fontSize=o.fontSize+"px"),o.bold&&(i.fontWeight="bold"),o.italic&&(i.fontStyle="italic");const m=o.border;if(m)for(const f of["top","bottom","left","right"]){const k=m[f];k&&k.style&&k.width>0&&(i["border-"+f]=`${k.width}px ${k.style} ${k.color||"#dcdfe6"}`)}return i}function Oe(s=[]){for(const o of s)o.type==="title"&&(o.type="text",o.style=o.style||{color:"#303133",fontSize:18,bold:!0,italic:!1,align:"center"},o.align&&!o.style.align&&(o.style.align=o.align,delete o.align)),o.type==="text"&&(o.style=o.style||{},o.align&&!o.style.align&&(o.style.align=o.align,delete o.align),o.style.color===void 0&&(o.style.color="#303133"),o.style.fontSize===void 0&&(o.style.fontSize=14),o.style.bold===void 0&&(o.style.bold=!1),o.style.italic===void 0&&(o.style.italic=!1),o.style.align===void 0&&(o.style.align="left"))}function Re(s=[]){for(const o of s)if(o.type==="row"&&o.cells)for(const i of o.cells)i.style||(i.style=P()),i.style.width===void 0&&(i.style.width="auto"),i.style.color===void 0&&(i.style.color="#303133"),i.style.fontSize===void 0&&(i.style.fontSize=13),i.style.bold===void 0&&(i.style.bold=!1),i.style.italic===void 0&&(i.style.italic=!1),i.style.align===void 0&&(i.style.align="left"),i.style.border===void 0&&(i.style.border=de())}function ce(s){return!s||s.length===0?[]:(Oe(s),Re(s),s)}function J(s=[]){const o=e.ref(z(ce(s)));function i(f){o.value=z(ce(f||[]))}function m(){return z(o.value)}return e.reactive({sections:o,setSections:i,toTpl:m})}let Y=0;function me(){return Y++,"field_"+String(Y).padStart(4,"0")}function Ie(s){const o={color:"#606266",fontSize:13,bold:!1,italic:!1};return{...{field:me(),label:"",prefix:"",suffix:"",style:o},type:"AUTO_CALC",formula:""}}function K(s=[]){let o=0;for(const i of s)if(i.field){const m=/^field_(\d+)$/.exec(i.field);m&&(o=Math.max(o,parseInt(m[1],10)))}Y=o;for(const i of s)i.field==null&&(i.field=me()),i.prefix===void 0&&(i.prefix=""),i.suffix===void 0&&(i.suffix=""),i.style===void 0&&(i.style={color:"#606266",fontSize:13,bold:!1,italic:!1}),i.style.color===void 0&&(i.style.color="#606266"),i.style.fontSize===void 0&&(i.style.fontSize=13),i.style.bold===void 0&&(i.style.bold=!1),i.style.italic===void 0&&(i.style.italic=!1)}function pe(s=[]){const o=e.ref(z(s||[]));K(o.value);const i=e.computed(()=>z(o.value));function m(k){o.value=z(k||[]),K(o.value)}function f(){return K(o.value),z(o.value)}return e.reactive({fields:o,tpl:i,setFields:m,toTpl:f})}const Pe=["XXXX","YYYY","ZZZZ","WWWW"];function ue(s,o=3){const i=[],m=Pe;for(let f=0;f<o;f++){const k={};for(const y of s)if(!(y.editor==="AUTO_SEQ"||y.editor==="AUTO_CALC"))if(y.editor==="NUMBER")k[y.field]=Math.floor(Math.random()*900+100);else if(y.editor==="SELECT_DICT"){const _=(y.dictStr||(y.dict?y.dict.join(","):"")).split(",").map($=>$.trim()).filter(Boolean);k[y.field]=_[f%Math.max(_.length,1)]||m[f%m.length]}else k[y.field]=m[f%m.length];i.push(k)}return i}function H(s=1100){const o=e.ref(!1);function i(){o.value=window.innerWidth<=s}return e.onMounted(()=>{i(),window.addEventListener("resize",i)}),e.onUnmounted(()=>{window.removeEventListener("resize",i)}),{isNarrow:o}}const je={class:"qukt-toolbar"},We={class:"qukt-btn-group-inline"},Qe={class:"qukt-design-table"},Xe={class:"idx"},He=["onUpdate:modelValue"],Ge=["onUpdate:modelValue"],Ze=["onUpdate:modelValue"],Je=["onUpdate:modelValue"],Ye=["onUpdate:modelValue"],Ke=["onUpdate:modelValue"],ve={key:2,class:"qukt-muted"},et={key:3,class:"qukt-muted"},tt={class:"qukt-col-merge"},lt={key:0},ot=["onUpdate:modelValue"],nt={key:1,class:"qukt-muted"},it=["disabled","onClick"],st=["disabled","onClick"],rt=["onClick"],dt={__name:"DesignCols",props:{columns:{type:Array,required:!0},groupRules:{type:Object,default:()=>({})},breakpoint:{type:Number,default:1100}},emits:["help","open-group"],setup(s){const o=s,{isNarrow:i}=H(o.breakpoint),m=e.computed(()=>!!o.groupRules.merge_field);function f(d,t){let n=d,p=2;for(;t.has(n);)n=d+"_"+p++;return n}function k(){let d=0;for(const t of o.columns){const n=/^custom_(\d+)$/.exec(t.field);n&&(d=Math.max(d,parseInt(n[1],10)))}return d+1}function y(d){const t=new Set([...o.columns.map(l=>l.field)]),n="custom_"+String(k()).padStart(4,"0"),p=ze(d,f(n,t));o.columns.push(p)}function _(d){o.columns.splice(d,1)}function $(d,t){const n=d+t;n<0||n>=o.columns.length||([o.columns[d],o.columns[n]]=[o.columns[n],o.columns[d]])}return(d,t)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",je,[t[3]||(t[3]=e.createElementVNode("span",{class:"qukt-tip"},[e.createTextVNode("拖动或点 ↑↓ 调整顺序;支持自动序号和公式计算列,公式里可直接引用其他字段名,如 "),e.createElementVNode("code",null,"quantity * unit_price * 0.9")],-1)),e.createElementVNode("div",We,[e.createElementVNode("button",{class:e.normalizeClass(["qukt-btn",{"qukt-btn-primary":m.value}]),onClick:t[0]||(t[0]=n=>d.$emit("open-group"))},"分组 & 小计"+e.toDisplayString(m.value?" ✓":""),3),e.createElementVNode("button",{class:"qukt-btn qukt-btn-primary",onClick:t[1]||(t[1]=n=>y("INPUT"))},"+ 添加字段"),e.createElementVNode("button",{class:"qukt-btn",onClick:t[2]||(t[2]=n=>d.$emit("help"))},"帮助")])]),e.createElementVNode("div",{class:e.normalizeClass(["qukt-table-wrap",{"is-narrow":e.unref(i)}])},[e.createElementVNode("table",Qe,[t[6]||(t[6]=e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[e.createElementVNode("th",{width:"50"},"#"),e.createElementVNode("th",{width:"150"},"字段名"),e.createElementVNode("th",{width:"150"},"列标题"),e.createElementVNode("th",{width:"160"},"类型"),e.createElementVNode("th",{width:"100"},"宽度"),e.createElementVNode("th",null,"专属配置"),e.createElementVNode("th",{width:"130"},"分组时合并"),e.createElementVNode("th",{width:"140"},"操作")])],-1)),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.columns,(n,p)=>(e.openBlock(),e.createElementBlock("tr",{key:p},[e.createElementVNode("td",Xe,e.toDisplayString(p+1),1),e.createElementVNode("td",null,[e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input","onUpdate:modelValue":l=>n.field=l},null,8,He),[[e.vModelText,n.field]])]),e.createElementVNode("td",null,[e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input","onUpdate:modelValue":l=>n.title=l},null,8,Ge),[[e.vModelText,n.title]])]),e.createElementVNode("td",null,[e.withDirectives(e.createElementVNode("select",{class:"qukt-cell-input","onUpdate:modelValue":l=>n.editor=l},[...t[4]||(t[4]=[e.createStaticVNode('<option value="AUTO_SEQ">自动序号</option><option value="AUTO_CALC">自动计算(公式)</option><option value="INPUT">文本输入</option><option value="NUMBER">数字输入</option><option value="TEXTAREA">多行文本</option><option value="SELECT_DICT">下拉选择</option>',6)])],8,Ze),[[e.vModelSelect,n.editor]])]),e.createElementVNode("td",null,[e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input",type:"number",min:"50",max:"500","onUpdate:modelValue":l=>n.width=l},null,8,Je),[[e.vModelText,n.width,void 0,{number:!0}]])]),e.createElementVNode("td",null,[n.editor==="SELECT_DICT"?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,class:"qukt-cell-input","onUpdate:modelValue":l=>n.dictStr=l,placeholder:"下拉选项,逗号分隔 如:设备,材料,安装"},null,8,Ye)),[[e.vModelText,n.dictStr]]):n.editor==="AUTO_CALC"?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:1,class:"qukt-cell-input","onUpdate:modelValue":l=>n.formula=l,placeholder:"公式,如 quantity * unit_price + tax"},null,8,Ke)),[[e.vModelText,n.formula]]):n.editor==="AUTO_SEQ"?(e.openBlock(),e.createElementBlock("span",ve,"自动生成序号,无需配置")):(e.openBlock(),e.createElementBlock("span",et,"-"))]),e.createElementVNode("td",tt,[n.editor!=="AUTO_SEQ"&&n.editor!=="AUTO_CALC"?(e.openBlock(),e.createElementBlock("label",lt,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":l=>n.merge_on_group=l},null,8,ot),[[e.vModelCheckbox,n.merge_on_group]]),t[5]||(t[5]=e.createElementVNode("span",null,"相同值合并",-1))])):(e.openBlock(),e.createElementBlock("span",nt,"—"))]),e.createElementVNode("td",null,[e.createElementVNode("button",{class:"qukt-mini-btn",disabled:p===0,onClick:l=>$(p,-1)},"↑",8,it),e.createElementVNode("button",{class:"qukt-mini-btn",disabled:p>=s.columns.length-1,onClick:l=>$(p,1)},"↓",8,st),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:l=>_(p)},"删",8,rt)])]))),128))])])],2)]))}},at={class:"qukt-gr-dialog"},ct={class:"qukt-gr-header"},mt={class:"qukt-gr-content"},pt={class:"qukt-gr-form"},ut={class:"qukt-gr-form-row"},kt=["value","disabled"],ft={class:"qukt-gr-form-row"},bt={class:"qukt-gr-checkbox",style:{flex:"1"}},yt={class:"qukt-gr-footer"},Vt={__name:"GroupDialog",props:{visible:{type:Boolean,default:!1},columns:{type:Array,default:()=>[]},groupRules:{type:Object,required:!0}},setup(s){const o=s,i=e.reactive({merge_field:o.groupRules.merge_field||"",show_detail_subtotal:o.groupRules.show_detail_subtotal??!0});return e.watch(()=>o.groupRules,m=>{Object.assign(i,{merge_field:m.merge_field||"",show_detail_subtotal:m.show_detail_subtotal??!0})},{deep:!0}),e.watch(i,()=>{Object.assign(o.groupRules,{merge_field:i.merge_field,show_detail_subtotal:i.show_detail_subtotal})},{deep:!0}),(m,f)=>s.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qukt-gr-mask",onClick:f[4]||(f[4]=e.withModifiers(k=>m.$emit("close"),["self"]))},[e.createElementVNode("div",at,[e.createElementVNode("div",ct,[f[5]||(f[5]=e.createElementVNode("span",null,"分组规则 & 小计配置",-1)),e.createElementVNode("button",{class:"qukt-gr-close",onClick:f[0]||(f[0]=k=>m.$emit("close"))},"✕")]),e.createElementVNode("div",mt,[f[10]||(f[10]=e.createElementVNode("div",{class:"qukt-gr-tips"},[e.createElementVNode("p",null,[e.createElementVNode("b",null,"分组是什么?"),e.createTextVNode(" 选择某一列后,相同值的行会自动合并单元格(比如按「系统名称」分组,同系统的多条明细会合并成一个单元格)。每组末尾自动显示一行小计。")])],-1)),e.createElementVNode("div",pt,[e.createElementVNode("div",ut,[f[7]||(f[7]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"按哪一列分组",-1)),e.withDirectives(e.createElementVNode("select",{class:"qukt-cell-input","onUpdate:modelValue":f[1]||(f[1]=k=>s.groupRules.merge_field=k),style:{flex:"1"}},[f[6]||(f[6]=e.createElementVNode("option",{value:""},"— 不分组 —",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.columns,k=>(e.openBlock(),e.createElementBlock("option",{key:k.field,value:k.field,disabled:k.editor==="AUTO_SEQ"||k.editor==="AUTO_CALC"},e.toDisplayString(k.title)+"("+e.toDisplayString(k.field)+")",9,kt))),128))],512),[[e.vModelSelect,s.groupRules.merge_field]])]),e.createElementVNode("div",ft,[f[9]||(f[9]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"明细小计",-1)),e.createElementVNode("label",bt,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":f[2]||(f[2]=k=>s.groupRules.show_detail_subtotal=k)},null,512),[[e.vModelCheckbox,s.groupRules.show_detail_subtotal]]),f[8]||(f[8]=e.createElementVNode("span",null,"分组末尾显示小计行",-1))])])])]),e.createElementVNode("div",yt,[e.createElementVNode("button",{class:"qukt-btn",onClick:f[3]||(f[3]=k=>m.$emit("close"))},"关闭")])])])):e.createCommentVNode("",!0)}},ht={class:"qukt-toolbar"},Et={class:"qukt-col-left"},Nt={class:"qukt-sec-header"},_t={class:"qukt-sec-type"},gt={class:"qukt-sec-actions"},qt=["disabled","onClick"],wt=["disabled","onClick"],$t=["onClick"],xt={class:"qukt-sec-row"},Ct=["onUpdate:modelValue"],Bt={class:"qukt-sec-row"},Ut=["onUpdate:modelValue"],St=["onUpdate:modelValue"],Tt={class:"qukt-chk-label"},Dt=["onUpdate:modelValue"],Mt={class:"qukt-chk-label"},At=["onUpdate:modelValue"],Ft={class:"qukt-sec-row"},Lt=["onUpdate:modelValue"],zt={class:"qukt-cells-list"},Ot={class:"qukt-cell-toolbar"},Rt=["onClick"],It={class:"qukt-sec-row"},Pt=["onUpdate:modelValue"],jt={key:0,class:"qukt-sec-row"},Wt=["onUpdate:modelValue"],Qt={key:1,class:"qukt-sec-row"},Xt=["onUpdate:modelValue"],Ht={key:2,class:"qukt-sec-row"},Gt=["onUpdate:modelValue"],Zt={class:"qukt-sec-row"},Jt=["onUpdate:modelValue"],Yt={class:"qukt-inline-group"},Kt=["onUpdate:modelValue"],vt={class:"qukt-sec-row"},el=["onUpdate:modelValue"],tl=["onUpdate:modelValue"],ll={class:"qukt-chk-label"},ol=["onUpdate:modelValue"],nl={class:"qukt-chk-label"},il=["onUpdate:modelValue"],sl={class:"qukt-sec-row qukt-border-config"},rl={class:"qukt-border-group"},dl={class:"qukt-border-item"},al=["onUpdate:modelValue"],cl=["onUpdate:modelValue"],ml=["onUpdate:modelValue"],pl={class:"qukt-border-item"},ul=["onUpdate:modelValue"],kl=["onUpdate:modelValue"],fl=["onUpdate:modelValue"],bl={class:"qukt-border-item"},yl=["onUpdate:modelValue"],Vl=["onUpdate:modelValue"],hl=["onUpdate:modelValue"],El={class:"qukt-border-item"},Nl=["onUpdate:modelValue"],_l=["onUpdate:modelValue"],gl=["onUpdate:modelValue"],ql=["onClick"],wl=["onClick"],$l=["onClick"],xl={class:"qukt-col-right"},Cl={class:"qukt-preview-box"},Bl={class:"qukt-preview-inner"},Ul={key:1,class:"qukt-p-divider"},Sl={key:3,class:"qukt-p-row"},Tl={class:"qukt-p-label"},Dl={class:"qukt-p-value"},Ml={__name:"DesignHeader",props:{sections:{type:Array,required:!0},breakpoint:{type:Number,default:1100}},setup(s){const o=s,{isNarrow:i}=H(o.breakpoint);function m(d){d==="divider"?o.sections.push({type:d}):d==="text"?o.sections.push({type:d,text:"纯文本内容",style:{color:"#303133",fontSize:14,bold:!1,italic:!1,align:"left"}}):d==="row"&&o.sections.push({type:d,cells:[{type:"field",label:"字段",bind:"field1",style:P("50%")}]})}function f(d){o.sections.splice(d,1)}function k(d,t){const n=d+t;n<0||n>=o.sections.length||([o.sections[d],o.sections[n]]=[o.sections[n],o.sections[d]])}function y(d){d.cells||(d.cells=[]),d.cells.push({type:"field",label:"新字段",bind:"newField",style:P("33%")})}function _(d,t){d.cells.splice(t,1)}function $(d){const t={},n=d.style||{};return n.color&&(t.color=n.color),n.fontSize&&(t.fontSize=n.fontSize+"px"),n.bold&&(t.fontWeight="bold"),n.italic&&(t.fontStyle="italic"),n.align&&(t.textAlign=n.align),t}return(d,t)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",ht,[t[3]||(t[3]=e.createElementVNode("span",{class:"qukt-tip"},"这里定义报价单的大标题、项目信息行等,左侧是设计器,右侧实时预览",-1)),e.createElementVNode("button",{class:"qukt-btn",onClick:t[0]||(t[0]=n=>m("row"))},"+ 字段行"),e.createElementVNode("button",{class:"qukt-btn",onClick:t[1]||(t[1]=n=>m("divider"))},"+ 分隔线"),e.createElementVNode("button",{class:"qukt-btn",onClick:t[2]||(t[2]=n=>m("text"))},"+ 纯文本")]),e.createElementVNode("div",{class:e.normalizeClass(["qukt-two-col",{"is-narrow":e.unref(i)}])},[e.createElementVNode("div",Et,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.sections,(n,p)=>(e.openBlock(),e.createElementBlock("div",{key:p,class:"qukt-sec-block"},[e.createElementVNode("div",Nt,[e.createElementVNode("span",_t,e.toDisplayString(n.type==="row"?"字段行":n.type==="divider"?"分隔线":"纯文本"),1),e.createElementVNode("div",gt,[e.createElementVNode("button",{class:"qukt-mini-btn",disabled:p===0,onClick:l=>k(p,-1)},"↑",8,qt),e.createElementVNode("button",{class:"qukt-mini-btn",disabled:p>=s.sections.length-1,onClick:l=>k(p,1)},"↓",8,wt),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:l=>f(p)},"删",8,$t)])]),n.type==="text"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",xt,[t[4]||(t[4]=e.createElementVNode("label",null,"文字",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":l=>n.text=l,class:"qukt-cell-input"},null,8,Ct),[[e.vModelText,n.text]])]),e.createElementVNode("div",Bt,[t[7]||(t[7]=e.createElementVNode("label",null,"颜色",-1)),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":l=>n.style.color=l,class:"qukt-color-input"},null,8,Ut),[[e.vModelText,n.style.color]]),t[8]||(t[8]=e.createElementVNode("label",null,"字号",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":l=>n.style.fontSize=l,type:"number",class:"qukt-cell-input tiny",min:"10",max:"48"},null,8,St),[[e.vModelText,n.style.fontSize,void 0,{number:!0}]]),e.createElementVNode("label",Tt,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":l=>n.style.bold=l},null,8,Dt),[[e.vModelCheckbox,n.style.bold]]),t[5]||(t[5]=e.createTextVNode(" 加粗 ",-1))]),e.createElementVNode("label",Mt,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":l=>n.style.italic=l},null,8,At),[[e.vModelCheckbox,n.style.italic]]),t[6]||(t[6]=e.createTextVNode(" 斜体 ",-1))])]),e.createElementVNode("div",Ft,[t[10]||(t[10]=e.createElementVNode("label",null,"对齐",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":l=>n.style.align=l,class:"qukt-cell-input small"},[...t[9]||(t[9]=[e.createElementVNode("option",{value:"left"},"左",-1),e.createElementVNode("option",{value:"center"},"中",-1),e.createElementVNode("option",{value:"right"},"右",-1)])],8,Lt),[[e.vModelSelect,n.style.align]])])],64)):n.type==="row"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",zt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.cells,(l,B)=>(e.openBlock(),e.createElementBlock("div",{key:B,class:"qukt-cell-block"},[e.createElementVNode("div",Ot,[e.createElementVNode("strong",null,e.toDisplayString(B+1),1),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:r=>_(n,B)},"×",8,Rt)]),e.createElementVNode("div",It,[t[12]||(t[12]=e.createElementVNode("label",null,"类型",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":r=>l.type=r,class:"qukt-cell-input small"},[...t[11]||(t[11]=[e.createElementVNode("option",{value:"field"},"字段(可编辑)",-1),e.createElementVNode("option",{value:"text"},"纯文本",-1)])],8,Pt),[[e.vModelSelect,l.type]])]),l.type==="field"?(e.openBlock(),e.createElementBlock("div",jt,[t[13]||(t[13]=e.createElementVNode("label",null,"标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r=>l.label=r,class:"qukt-cell-input"},null,8,Wt),[[e.vModelText,l.label]])])):e.createCommentVNode("",!0),l.type==="field"?(e.openBlock(),e.createElementBlock("div",Qt,[t[14]||(t[14]=e.createElementVNode("label",null,"值",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r=>l.value=r,class:"qukt-cell-input",placeholder:"字段的值"},null,8,Xt),[[e.vModelText,l.value]])])):e.createCommentVNode("",!0),l.type==="text"?(e.openBlock(),e.createElementBlock("div",Ht,[t[15]||(t[15]=e.createElementVNode("label",null,"文字",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r=>l.text=r,class:"qukt-cell-input"},null,8,Gt),[[e.vModelText,l.text]])])):e.createCommentVNode("",!0),e.createElementVNode("div",Zt,[t[18]||(t[18]=e.createElementVNode("label",null,"宽度",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r=>l.style.width=r,class:"qukt-cell-input small",placeholder:"如 33%"},null,8,Jt),[[e.vModelText,l.style.width]]),e.createElementVNode("div",Yt,[t[17]||(t[17]=e.createElementVNode("label",{class:"qukt-muted"},"对齐",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":r=>l.style.align=r,class:"qukt-cell-input small"},[...t[16]||(t[16]=[e.createElementVNode("option",{value:"left"},"左",-1),e.createElementVNode("option",{value:"center"},"中",-1),e.createElementVNode("option",{value:"right"},"右",-1)])],8,Kt),[[e.vModelSelect,l.style.align]])])]),e.createElementVNode("div",vt,[t[21]||(t[21]=e.createElementVNode("label",null,"颜色",-1)),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":r=>l.style.color=r,class:"qukt-color-input"},null,8,el),[[e.vModelText,l.style.color]]),t[22]||(t[22]=e.createElementVNode("label",null,"字号",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r=>l.style.fontSize=r,type:"number",class:"qukt-cell-input tiny",min:"10",max:"48"},null,8,tl),[[e.vModelText,l.style.fontSize,void 0,{number:!0}]]),e.createElementVNode("label",ll,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":r=>l.style.bold=r},null,8,ol),[[e.vModelCheckbox,l.style.bold]]),t[19]||(t[19]=e.createTextVNode(" 加粗 ",-1))]),e.createElementVNode("label",nl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":r=>l.style.italic=r},null,8,il),[[e.vModelCheckbox,l.style.italic]]),t[20]||(t[20]=e.createTextVNode(" 斜体 ",-1))])]),e.createElementVNode("div",sl,[t[31]||(t[31]=e.createElementVNode("label",null,"边框",-1)),e.createElementVNode("div",rl,[e.createElementVNode("div",dl,[t[24]||(t[24]=e.createElementVNode("span",null,"上",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":r=>l.style.border.top.style=r,class:"qukt-cell-input tiny"},[...t[23]||(t[23]=[e.createElementVNode("option",{value:""},"无",-1),e.createElementVNode("option",{value:"solid"},"实线",-1),e.createElementVNode("option",{value:"dashed"},"虚线",-1),e.createElementVNode("option",{value:"dotted"},"点线",-1)])],8,al),[[e.vModelSelect,l.style.border.top.style]]),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":r=>l.style.border.top.width=r,class:"qukt-cell-input tiny",min:"0",max:"20",step:"1"},null,8,cl),[[e.vModelText,l.style.border.top.width,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":r=>l.style.border.top.color=r,class:"qukt-color-input"},null,8,ml),[[e.vModelText,l.style.border.top.color]])]),e.createElementVNode("div",pl,[t[26]||(t[26]=e.createElementVNode("span",null,"下",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":r=>l.style.border.bottom.style=r,class:"qukt-cell-input tiny"},[...t[25]||(t[25]=[e.createElementVNode("option",{value:""},"无",-1),e.createElementVNode("option",{value:"solid"},"实线",-1),e.createElementVNode("option",{value:"dashed"},"虚线",-1),e.createElementVNode("option",{value:"dotted"},"点线",-1)])],8,ul),[[e.vModelSelect,l.style.border.bottom.style]]),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":r=>l.style.border.bottom.width=r,class:"qukt-cell-input tiny",min:"0",max:"20",step:"1"},null,8,kl),[[e.vModelText,l.style.border.bottom.width,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":r=>l.style.border.bottom.color=r,class:"qukt-color-input"},null,8,fl),[[e.vModelText,l.style.border.bottom.color]])]),e.createElementVNode("div",bl,[t[28]||(t[28]=e.createElementVNode("span",null,"左",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":r=>l.style.border.left.style=r,class:"qukt-cell-input tiny"},[...t[27]||(t[27]=[e.createElementVNode("option",{value:""},"无",-1),e.createElementVNode("option",{value:"solid"},"实线",-1),e.createElementVNode("option",{value:"dashed"},"虚线",-1),e.createElementVNode("option",{value:"dotted"},"点线",-1)])],8,yl),[[e.vModelSelect,l.style.border.left.style]]),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":r=>l.style.border.left.width=r,class:"qukt-cell-input tiny",min:"0",max:"20",step:"1"},null,8,Vl),[[e.vModelText,l.style.border.left.width,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":r=>l.style.border.left.color=r,class:"qukt-color-input"},null,8,hl),[[e.vModelText,l.style.border.left.color]])]),e.createElementVNode("div",El,[t[30]||(t[30]=e.createElementVNode("span",null,"右",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":r=>l.style.border.right.style=r,class:"qukt-cell-input tiny"},[...t[29]||(t[29]=[e.createElementVNode("option",{value:""},"无",-1),e.createElementVNode("option",{value:"solid"},"实线",-1),e.createElementVNode("option",{value:"dashed"},"虚线",-1),e.createElementVNode("option",{value:"dotted"},"点线",-1)])],8,Nl),[[e.vModelSelect,l.style.border.right.style]]),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":r=>l.style.border.right.width=r,class:"qukt-cell-input tiny",min:"0",max:"20",step:"1"},null,8,_l),[[e.vModelText,l.style.border.right.width,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":r=>l.style.border.right.color=r,class:"qukt-color-input"},null,8,gl),[[e.vModelText,l.style.border.right.color]])])]),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:r=>e.unref(X)(l,"all")},"全",8,ql),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:r=>e.unref(X)(l,"none")},"无",8,wl)])]))),128))]),e.createElementVNode("button",{class:"qukt-btn qukt-btn-ghost",onClick:l=>y(n)},"+ 添加一个单元格",8,$l)],64)):e.createCommentVNode("",!0)]))),128))]),e.createElementVNode("div",xl,[e.createElementVNode("div",Cl,[t[32]||(t[32]=e.createElementVNode("div",{class:"qukt-preview-label"},"实时预览",-1)),e.createElementVNode("div",Bl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.sections,(n,p)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:p},[n.type==="title"?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qukt-p-title",style:e.normalizeStyle($(n))},e.toDisplayString(n.text||"大标题"),5)):n.type==="divider"?(e.openBlock(),e.createElementBlock("div",Ul)):n.type==="text"?(e.openBlock(),e.createElementBlock("div",{key:2,class:"qukt-p-text",style:e.normalizeStyle($(n))},e.toDisplayString(n.text||"纯文本"),5)):n.type==="row"?(e.openBlock(),e.createElementBlock("div",Sl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.cells,(l,B)=>(e.openBlock(),e.createElementBlock("div",{key:B,class:"qukt-p-cell",style:e.normalizeStyle(e.unref(ae)(l))},[l.type==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("span",Tl,e.toDisplayString(l.label)+":",1),e.createElementVNode("span",Dl,e.toDisplayString(l.value||"字段值"),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(l.text||"纯文本"),1)],64))],4))),128))])):e.createCommentVNode("",!0)],64))),128))])])])],2)]))}},Al={class:"qukt-toolbar"},Fl={class:"qukt-col-left"},Ll={class:"qukt-sec-header"},zl={class:"qukt-sec-type"},Ol={class:"qukt-sec-actions"},Rl=["disabled","onClick"],Il=["disabled","onClick"],Pl=["onClick"],jl={class:"qukt-cells-list"},Wl={class:"qukt-cell-toolbar"},Ql=["onClick"],Xl={class:"qukt-sec-row"},Hl=["onUpdate:modelValue"],Gl={class:"qukt-sec-row"},Zl=["onUpdate:modelValue"],Jl={class:"qukt-sec-row"},Yl=["onUpdate:modelValue"],Kl={class:"qukt-inline-group"},vl=["onUpdate:modelValue"],eo={class:"qukt-sec-row"},to=["onUpdate:modelValue"],lo=["onUpdate:modelValue"],oo={class:"qukt-chk-label"},no=["onUpdate:modelValue"],io={class:"qukt-chk-label"},so=["onUpdate:modelValue"],ro={class:"qukt-sec-row qukt-border-config"},ao={class:"qukt-border-group"},co={class:"qukt-border-item"},mo=["onUpdate:modelValue"],po=["onUpdate:modelValue"],uo=["onUpdate:modelValue"],ko={class:"qukt-border-item"},fo=["onUpdate:modelValue"],bo=["onUpdate:modelValue"],yo=["onUpdate:modelValue"],Vo={class:"qukt-border-item"},ho=["onUpdate:modelValue"],Eo=["onUpdate:modelValue"],No=["onUpdate:modelValue"],_o={class:"qukt-border-item"},go=["onUpdate:modelValue"],qo=["onUpdate:modelValue"],wo=["onUpdate:modelValue"],$o=["onClick"],xo=["onClick"],Co=["onClick"],Bo={class:"qukt-sec-row"},Uo=["onUpdate:modelValue"],So={class:"qukt-sec-row"},To=["onUpdate:modelValue"],Do=["onUpdate:modelValue"],Mo={class:"qukt-chk-label"},Ao=["onUpdate:modelValue"],Fo={class:"qukt-chk-label"},Lo=["onUpdate:modelValue"],zo={class:"qukt-sec-row"},Oo=["onUpdate:modelValue"],Ro={class:"qukt-col-right"},Io={class:"qukt-preview-box"},Po={class:"qukt-preview-inner"},jo={key:0,class:"qukt-p-divider"},Wo={key:2,class:"qukt-p-row"},Qo={__name:"DesignFooter",props:{sections:{type:Array,required:!0},breakpoint:{type:Number,default:1100}},setup(s){const o=s,{isNarrow:i}=H(o.breakpoint);function m(d){d==="divider"?o.sections.push({type:d}):d==="text"?o.sections.push({type:d,text:"纯文本",style:{color:"#303133",fontSize:14,bold:!1,italic:!1,align:"left"}}):d==="row"&&o.sections.push({type:d,cells:[{type:"text",text:"客户签字:",style:P("50%")}]})}function f(d){o.sections.splice(d,1)}function k(d,t){const n=d+t;n<0||n>=o.sections.length||([o.sections[d],o.sections[n]]=[o.sections[n],o.sections[d]])}function y(d){d.cells||(d.cells=[]),d.cells.push({type:"text",text:"签字:",style:P("50%")})}function _(d,t){d.cells.splice(t,1)}function $(d){const t={},n=d.style||{};return n.color&&(t.color=n.color),n.fontSize&&(t.fontSize=n.fontSize+"px"),n.bold&&(t.fontWeight="bold"),n.italic&&(t.fontStyle="italic"),n.align&&(t.textAlign=n.align),t}return(d,t)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",Al,[t[3]||(t[3]=e.createElementVNode("span",{class:"qukt-tip"},"💡 页面底部显示签字栏、盖章区等,结构和页面头部一样",-1)),e.createElementVNode("button",{class:"qukt-btn",onClick:t[0]||(t[0]=n=>m("divider"))},"+ 分隔线"),e.createElementVNode("button",{class:"qukt-btn",onClick:t[1]||(t[1]=n=>m("row"))},"+ 字段行"),e.createElementVNode("button",{class:"qukt-btn",onClick:t[2]||(t[2]=n=>m("text"))},"+ 纯文本")]),e.createElementVNode("div",{class:e.normalizeClass(["qukt-two-col",{"is-narrow":e.unref(i)}])},[e.createElementVNode("div",Fl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.sections,(n,p)=>(e.openBlock(),e.createElementBlock("div",{key:p,class:"qukt-sec-block"},[e.createElementVNode("div",Ll,[e.createElementVNode("span",zl,e.toDisplayString(n.type==="row"?"字段行":n.type==="divider"?"分隔线":"纯文本"),1),e.createElementVNode("div",Ol,[e.createElementVNode("button",{class:"qukt-mini-btn",disabled:p===0,onClick:l=>k(p,-1)},"↑",8,Rl),e.createElementVNode("button",{class:"qukt-mini-btn",disabled:p>=s.sections.length-1,onClick:l=>k(p,1)},"↓",8,Il),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:l=>f(p)},"删",8,Pl)])]),n.type==="row"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",jl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.cells,(l,B)=>(e.openBlock(),e.createElementBlock("div",{key:B,class:"qukt-cell-block"},[e.createElementVNode("div",Wl,[e.createElementVNode("strong",null,e.toDisplayString(B+1),1),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:r=>_(n,B)},"×",8,Ql)]),e.createElementVNode("div",Xl,[t[5]||(t[5]=e.createElementVNode("label",null,"类型",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":r=>l.type=r,class:"qukt-cell-input small"},[...t[4]||(t[4]=[e.createElementVNode("option",{value:"text"},"纯文本",-1)])],8,Hl),[[e.vModelSelect,l.type]])]),e.createElementVNode("div",Gl,[t[6]||(t[6]=e.createElementVNode("label",null,"文字",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r=>l.text=r,class:"qukt-cell-input"},null,8,Zl),[[e.vModelText,l.text]])]),e.createElementVNode("div",Jl,[t[9]||(t[9]=e.createElementVNode("label",null,"宽度",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r=>l.style.width=r,class:"qukt-cell-input small",placeholder:"如 50%"},null,8,Yl),[[e.vModelText,l.style.width]]),e.createElementVNode("div",Kl,[t[8]||(t[8]=e.createElementVNode("label",{class:"qukt-muted"},"对齐",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":r=>l.style.align=r,class:"qukt-cell-input small"},[...t[7]||(t[7]=[e.createElementVNode("option",{value:"left"},"左",-1),e.createElementVNode("option",{value:"center"},"中",-1),e.createElementVNode("option",{value:"right"},"右",-1)])],8,vl),[[e.vModelSelect,l.style.align]])])]),e.createElementVNode("div",eo,[t[12]||(t[12]=e.createElementVNode("label",null,"颜色",-1)),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":r=>l.style.color=r,class:"qukt-color-input"},null,8,to),[[e.vModelText,l.style.color]]),t[13]||(t[13]=e.createElementVNode("label",null,"字号",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r=>l.style.fontSize=r,type:"number",class:"qukt-cell-input tiny",min:"10",max:"48"},null,8,lo),[[e.vModelText,l.style.fontSize,void 0,{number:!0}]]),e.createElementVNode("label",oo,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":r=>l.style.bold=r},null,8,no),[[e.vModelCheckbox,l.style.bold]]),t[10]||(t[10]=e.createTextVNode(" 加粗 ",-1))]),e.createElementVNode("label",io,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":r=>l.style.italic=r},null,8,so),[[e.vModelCheckbox,l.style.italic]]),t[11]||(t[11]=e.createTextVNode(" 斜体 ",-1))])]),e.createElementVNode("div",ro,[t[22]||(t[22]=e.createElementVNode("label",null,"边框",-1)),e.createElementVNode("div",ao,[e.createElementVNode("div",co,[t[15]||(t[15]=e.createElementVNode("span",null,"上",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":r=>l.style.border.top.style=r,class:"qukt-cell-input tiny"},[...t[14]||(t[14]=[e.createElementVNode("option",{value:""},"无",-1),e.createElementVNode("option",{value:"solid"},"实线",-1),e.createElementVNode("option",{value:"dashed"},"虚线",-1),e.createElementVNode("option",{value:"dotted"},"点线",-1)])],8,mo),[[e.vModelSelect,l.style.border.top.style]]),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":r=>l.style.border.top.width=r,class:"qukt-cell-input tiny",min:"0",max:"20",step:"1"},null,8,po),[[e.vModelText,l.style.border.top.width,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":r=>l.style.border.top.color=r,class:"qukt-color-input"},null,8,uo),[[e.vModelText,l.style.border.top.color]])]),e.createElementVNode("div",ko,[t[17]||(t[17]=e.createElementVNode("span",null,"下",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":r=>l.style.border.bottom.style=r,class:"qukt-cell-input tiny"},[...t[16]||(t[16]=[e.createElementVNode("option",{value:""},"无",-1),e.createElementVNode("option",{value:"solid"},"实线",-1),e.createElementVNode("option",{value:"dashed"},"虚线",-1),e.createElementVNode("option",{value:"dotted"},"点线",-1)])],8,fo),[[e.vModelSelect,l.style.border.bottom.style]]),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":r=>l.style.border.bottom.width=r,class:"qukt-cell-input tiny",min:"0",max:"20",step:"1"},null,8,bo),[[e.vModelText,l.style.border.bottom.width,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":r=>l.style.border.bottom.color=r,class:"qukt-color-input"},null,8,yo),[[e.vModelText,l.style.border.bottom.color]])]),e.createElementVNode("div",Vo,[t[19]||(t[19]=e.createElementVNode("span",null,"左",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":r=>l.style.border.left.style=r,class:"qukt-cell-input tiny"},[...t[18]||(t[18]=[e.createElementVNode("option",{value:""},"无",-1),e.createElementVNode("option",{value:"solid"},"实线",-1),e.createElementVNode("option",{value:"dashed"},"虚线",-1),e.createElementVNode("option",{value:"dotted"},"点线",-1)])],8,ho),[[e.vModelSelect,l.style.border.left.style]]),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":r=>l.style.border.left.width=r,class:"qukt-cell-input tiny",min:"0",max:"20",step:"1"},null,8,Eo),[[e.vModelText,l.style.border.left.width,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":r=>l.style.border.left.color=r,class:"qukt-color-input"},null,8,No),[[e.vModelText,l.style.border.left.color]])]),e.createElementVNode("div",_o,[t[21]||(t[21]=e.createElementVNode("span",null,"右",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":r=>l.style.border.right.style=r,class:"qukt-cell-input tiny"},[...t[20]||(t[20]=[e.createElementVNode("option",{value:""},"无",-1),e.createElementVNode("option",{value:"solid"},"实线",-1),e.createElementVNode("option",{value:"dashed"},"虚线",-1),e.createElementVNode("option",{value:"dotted"},"点线",-1)])],8,go),[[e.vModelSelect,l.style.border.right.style]]),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":r=>l.style.border.right.width=r,class:"qukt-cell-input tiny",min:"0",max:"20",step:"1"},null,8,qo),[[e.vModelText,l.style.border.right.width,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":r=>l.style.border.right.color=r,class:"qukt-color-input"},null,8,wo),[[e.vModelText,l.style.border.right.color]])])]),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:r=>e.unref(X)(l,"all")},"全",8,$o),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:r=>e.unref(X)(l,"none")},"无",8,xo)])]))),128))]),e.createElementVNode("button",{class:"qukt-btn qukt-btn-ghost",onClick:l=>y(n)},"+ 添加一个单元格",8,Co)],64)):n.type==="text"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",Bo,[t[23]||(t[23]=e.createElementVNode("label",null,"文字",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":l=>n.text=l,class:"qukt-cell-input"},null,8,Uo),[[e.vModelText,n.text]])]),e.createElementVNode("div",So,[t[26]||(t[26]=e.createElementVNode("label",null,"颜色",-1)),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":l=>n.style.color=l,class:"qukt-color-input"},null,8,To),[[e.vModelText,n.style.color]]),t[27]||(t[27]=e.createElementVNode("label",null,"字号",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":l=>n.style.fontSize=l,type:"number",class:"qukt-cell-input tiny",min:"10",max:"48"},null,8,Do),[[e.vModelText,n.style.fontSize,void 0,{number:!0}]]),e.createElementVNode("label",Mo,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":l=>n.style.bold=l},null,8,Ao),[[e.vModelCheckbox,n.style.bold]]),t[24]||(t[24]=e.createTextVNode(" 加粗 ",-1))]),e.createElementVNode("label",Fo,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":l=>n.style.italic=l},null,8,Lo),[[e.vModelCheckbox,n.style.italic]]),t[25]||(t[25]=e.createTextVNode(" 斜体 ",-1))])]),e.createElementVNode("div",zo,[t[29]||(t[29]=e.createElementVNode("label",null,"对齐",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":l=>n.style.align=l,class:"qukt-cell-input small"},[...t[28]||(t[28]=[e.createElementVNode("option",{value:"left"},"左",-1),e.createElementVNode("option",{value:"center"},"中",-1),e.createElementVNode("option",{value:"right"},"右",-1)])],8,Oo),[[e.vModelSelect,n.style.align]])])],64)):e.createCommentVNode("",!0)]))),128))]),e.createElementVNode("div",Ro,[e.createElementVNode("div",Io,[t[30]||(t[30]=e.createElementVNode("div",{class:"qukt-preview-label"},"底部预览",-1)),e.createElementVNode("div",Po,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.sections,(n,p)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:p},[n.type==="divider"?(e.openBlock(),e.createElementBlock("div",jo)):n.type==="text"?(e.openBlock(),e.createElementBlock("div",{key:1,class:"qukt-p-text",style:e.normalizeStyle($(n))},e.toDisplayString(n.text||"纯文本"),5)):n.type==="row"?(e.openBlock(),e.createElementBlock("div",Wo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.cells,(l,B)=>(e.openBlock(),e.createElementBlock("div",{key:B,class:"qukt-p-cell",style:e.normalizeStyle(e.unref(ae)(l))},e.toDisplayString(l.text),5))),128))])):e.createCommentVNode("",!0)],64))),128))])])])],2)]))}},Xo={class:"qukt-col-left"},Ho={class:"qukt-sec-header"},Go={class:"qukt-sec-type"},Zo={class:"qukt-sec-actions"},Jo=["disabled","onClick"],Yo=["disabled","onClick"],Ko=["onClick"],vo={class:"qukt-sec-row"},en=["onUpdate:modelValue"],tn={class:"qukt-sec-row"},ln=["onUpdate:modelValue"],on={class:"qukt-sec-row"},nn=["onUpdate:modelValue"],sn={class:"qukt-sec-row"},rn=["onUpdate:modelValue"],dn={class:"qukt-sec-row"},an=["onUpdate:modelValue"],cn={key:0,class:"qukt-sec-row"},mn=["onUpdate:modelValue"],pn={key:1,class:"qukt-sec-row"},un=["onUpdate:modelValue"],kn={key:2,class:"qukt-sec-row"},fn=["onUpdate:modelValue"],bn={class:"qukt-sec-row"},yn=["onUpdate:modelValue"],Vn=["onUpdate:modelValue"],hn={class:"qukt-chk-label"},En=["onUpdate:modelValue"],Nn={class:"qukt-chk-label"},_n=["onUpdate:modelValue"],gn={key:0,class:"qukt-q-empty"},qn={class:"qukt-col-right"},wn={class:"qukt-preview-box"},$n={class:"qukt-preview-inner"},xn={key:0,class:"qukt-empty-hint"},Cn={key:1,class:"qukt-summary-preview"},Bn={class:"qukt-sp-label"},Un={key:2,class:"qukt-preview-help"},Sn={__name:"DesignSummary",props:{fields:{type:Array,required:!0},breakpoint:{type:Number,default:1100}},setup(s){const o=s,{isNarrow:i}=H(o.breakpoint),m={group_total:1e4,quantity_sum:50},f=e.computed(()=>{const n={...m};for(const p of o.fields)p.type==="MANUAL_INPUT"&&(n[p.field]=Number(p.default??0));for(const p of o.fields)if(p.type==="AUTO_CALC"&&p.formula)try{n[p.field]=I(p.formula,n)}catch{n[p.field]=0}return n});function k(n){return{AUTO_CALC:"自动计算",MANUAL_INPUT:"手动数值",PLAIN_TEXT:"纯文本"}[n]||"汇总字段"}function y(n){const p={},l=n.style||{};return l.color&&(p.color=l.color),l.fontSize&&(p.fontSize=l.fontSize+"px"),l.bold&&(p.fontWeight="bold"),l.italic&&(p.fontStyle="italic"),p}function _(n){if(n.type==="PLAIN_TEXT")return n.text||"";let p;n.type==="AUTO_CALC"?p=Number(f.value[n.field])||0:p=Number(n.default)||0;const l=Number.isInteger(p)?p:p.toFixed(2);return(n.prefix||"")+l+(n.suffix||"")}function $(){o.fields.push(Ie())}function d(n){o.fields.splice(n,1)}function t(n,p){const l=n+p;l<0||l>=o.fields.length||([o.fields[n],o.fields[l]]=[o.fields[l],o.fields[n]])}return(n,p)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",{class:"qukt-toolbar"},[p[0]||(p[0]=e.createElementVNode("span",{class:"qukt-tip"},[e.createTextVNode("汇总区域每行显示一项,公式里可引用 "),e.createElementVNode("code",null,"group_total"),e.createTextVNode("、"),e.createElementVNode("code",null,"quantity_sum"),e.createTextVNode(" 以及其他汇总字段")],-1)),e.createElementVNode("button",{class:"qukt-btn",onClick:$},"+ 添加字段")]),e.createElementVNode("div",{class:e.normalizeClass(["qukt-two-col",{"is-narrow":e.unref(i)}])},[e.createElementVNode("div",Xo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.fields,(l,B)=>(e.openBlock(),e.createElementBlock("div",{key:l.field,class:"qukt-sec-block"},[e.createElementVNode("div",Ho,[e.createElementVNode("span",Go,e.toDisplayString(k(l.type)),1),e.createElementVNode("div",Zo,[e.createElementVNode("button",{class:"qukt-mini-btn",disabled:B===0,onClick:r=>t(B,-1)},"↑",8,Jo),e.createElementVNode("button",{class:"qukt-mini-btn",disabled:B>=s.fields.length-1,onClick:r=>t(B,1)},"↓",8,Yo),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:r=>d(B)},"删",8,Ko)])]),e.createElementVNode("div",vo,[p[2]||(p[2]=e.createElementVNode("label",null,"类型",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":r=>l.type=r,class:"qukt-cell-input"},[...p[1]||(p[1]=[e.createElementVNode("option",{value:"AUTO_CALC"},"自动计算",-1),e.createElementVNode("option",{value:"MANUAL_INPUT"},"手动数值",-1),e.createElementVNode("option",{value:"PLAIN_TEXT"},"纯文本",-1)])],8,en),[[e.vModelSelect,l.type]])]),e.createElementVNode("div",tn,[p[3]||(p[3]=e.createElementVNode("label",null,"标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r=>l.label=r,class:"qukt-cell-input",placeholder:"如 合计、税后、业务员抽成"},null,8,ln),[[e.vModelText,l.label]])]),e.createElementVNode("div",on,[p[4]||(p[4]=e.createElementVNode("label",null,"字段名",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r=>l.field=r,class:"qukt-cell-input",placeholder:"如 subtotal、tax (其他行公式可引用)"},null,8,nn),[[e.vModelText,l.field]])]),e.createElementVNode("div",sn,[p[5]||(p[5]=e.createElementVNode("label",null,"前缀",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r=>l.prefix=r,class:"qukt-cell-input",placeholder:"如 ¥、¥"},null,8,rn),[[e.vModelText,l.prefix]])]),e.createElementVNode("div",dn,[p[6]||(p[6]=e.createElementVNode("label",null,"后缀",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r=>l.suffix=r,class:"qukt-cell-input",placeholder:"如 %"},null,8,an),[[e.vModelText,l.suffix]])]),l.type==="AUTO_CALC"?(e.openBlock(),e.createElementBlock("div",cn,[p[7]||(p[7]=e.createElementVNode("label",null,"公式",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r=>l.formula=r,class:"qukt-cell-input",placeholder:"如 group_total * 0.01 + group_total"},null,8,mn),[[e.vModelText,l.formula]])])):l.type==="MANUAL_INPUT"?(e.openBlock(),e.createElementBlock("div",pn,[p[8]||(p[8]=e.createElementVNode("label",null,"默认值",-1)),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":r=>l.default=r,class:"qukt-cell-input",placeholder:"默认值"},null,8,un),[[e.vModelText,l.default,void 0,{number:!0}]])])):l.type==="PLAIN_TEXT"?(e.openBlock(),e.createElementBlock("div",kn,[p[9]||(p[9]=e.createElementVNode("label",null,"显示文本",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r=>l.text=r,class:"qukt-cell-input",placeholder:"显示文本"},null,8,fn),[[e.vModelText,l.text]])])):e.createCommentVNode("",!0),e.createElementVNode("div",bn,[p[12]||(p[12]=e.createElementVNode("label",null,"颜色",-1)),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":r=>l.style.color=r,class:"qukt-color-input"},null,8,yn),[[e.vModelText,l.style.color]]),p[13]||(p[13]=e.createElementVNode("label",null,"字号",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r=>l.style.fontSize=r,type:"number",class:"qukt-cell-input tiny",min:"10",max:"48"},null,8,Vn),[[e.vModelText,l.style.fontSize,void 0,{number:!0}]]),e.createElementVNode("label",hn,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":r=>l.style.bold=r},null,8,En),[[e.vModelCheckbox,l.style.bold]]),p[10]||(p[10]=e.createTextVNode(" 加粗 ",-1))]),e.createElementVNode("label",Nn,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":r=>l.style.italic=r},null,8,_n),[[e.vModelCheckbox,l.style.italic]]),p[11]||(p[11]=e.createTextVNode(" 斜体 ",-1))])])]))),128)),s.fields.length===0?(e.openBlock(),e.createElementBlock("div",gn,"还没有汇总行,点上方按钮添加")):e.createCommentVNode("",!0)]),e.createElementVNode("div",qn,[e.createElementVNode("div",wn,[p[15]||(p[15]=e.createElementVNode("div",{class:"qukt-preview-label"},"汇总预览",-1)),e.createElementVNode("div",$n,[s.fields.length===0?(e.openBlock(),e.createElementBlock("div",xn,"暂无汇总字段")):(e.openBlock(),e.createElementBlock("div",Cn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.fields,l=>(e.openBlock(),e.createElementBlock("div",{key:l.field,class:"qukt-sp-row"},[e.createElementVNode("span",Bn,e.toDisplayString(l.label||"标签"),1),e.createElementVNode("span",{class:"qukt-sp-value",style:e.normalizeStyle(y(l))},e.toDisplayString(_(l)),5)]))),128))])),s.fields.length>0?(e.openBlock(),e.createElementBlock("div",Un,[...p[14]||(p[14]=[e.createElementVNode("b",null,"提示:",-1),e.createTextVNode("预览使用模拟数据 ",-1),e.createElementVNode("code",null,"group_total = 10000",-1),e.createTextVNode("、",-1),e.createElementVNode("code",null,"quantity_sum = 50",-1)])])):e.createCommentVNode("",!0)])])])],2)]))}},Tn={class:"qukt-help-dialog"},Dn={class:"qukt-help-header"},Mn={__name:"HelpModal",props:{visible:{type:Boolean,default:!1}},emits:["close"],setup(s){return(o,i)=>s.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qukt-help-modal",onClick:i[1]||(i[1]=e.withModifiers(m=>o.$emit("close"),["self"]))},[e.createElementVNode("div",Tn,[e.createElementVNode("div",Dn,[i[2]||(i[2]=e.createElementVNode("h3",null,"📖 报价单生成器 — 使用教程",-1)),e.createElementVNode("button",{class:"qukt-close-btn",onClick:i[0]||(i[0]=m=>o.$emit("close"))},"✕")]),i[3]||(i[3]=e.createStaticVNode(`<div class="qukt-help-body"><section class="qukt-help-section"><h4>🔁 整体三步流程</h4><p>顶部导航栏有三个步骤,按顺序操作即可生成一份完整报价单:</p><ol class="qukt-steps"><li><b>① 设计模板</b> — 定义表头列、页面头部信息、汇总区域、底部签字栏等</li><li><b>② 填写数据</b> — 根据模板录入每条明细,自动分组、自动算小计</li><li><b>③ 预览导出</b> — 查看最终效果,一键导出 Excel 或打印</li></ol><p class="qukt-tip-box">💡 也可以从第 ② 步开始,系统已内置 3 个示例模板可直接使用</p></section><section class="qukt-help-section"><h4>① 表头列 — 定义表格里有哪些列</h4><p>点击顶部工具栏的 <b>+ 添加字段</b> 按钮可以新增一列,然后在表格中把「类型」改成你想要的:</p><table class="qukt-help-table"><thead><tr><th>按钮</th><th>字段类型</th><th>说明</th></tr></thead><tbody><tr><td>文本列</td><td>INPUT</td><td>普通文字输入,用于名称、描述等</td></tr><tr><td>数字列</td><td>NUMBER</td><td>只能填数字,用于数量、单价等</td></tr><tr><td>下拉列</td><td>SELECT_DICT</td><td>固定选项,点击列中的"下拉选项"输入选项,用逗号分隔,如 <code>设备,材料,安装</code></td></tr><tr><td>多行文本列</td><td>TEXTAREA</td><td>可输入较长文字,用于备注、说明等</td></tr></tbody></table><p><b>特殊类型列:</b></p><ul><li><b>自动序号</b> — 自动从 1 开始递增,字段名随便改(建议叫 <code>seq</code>)</li><li><b>自动计算(公式)</b> — 用任意公式算值,公式里可引用<b>同一行其他列的字段名</b>,如 <code>quantity * unit_price</code>。字段名必须和你在表头里设置的一致,比如数量列叫 <code>qty</code> 就要写 <code>qty * unit_price</code></li></ul><p><b>列顺序:</b>点行末的 ↑ ↓ 按钮上下移动,或拖动行来调整</p><p><b>列宽度:</b>单位是像素(px),在"宽度"列填数字</p><p class="qukt-tip-box">💡 下拉列的选项是写在逗号分隔的输入框里,保存后切换到「填写数据」页面时会变成下拉选择框</p></section><section class="qukt-help-section"><h4>② 页面头部 — 报价单的标题和项目信息</h4><p>头部由多个"段落"顺序组成,每个段落可以是以下 4 种类型:</p><table class="qukt-help-table"><thead><tr><th>类型</th><th>说明</th><th>配置项</th></tr></thead><tbody><tr><td><b>大标题</b></td><td>最顶部的报价单标题</td><td>文字、字号、粗体、对齐方式</td></tr><tr><td><b>字段行</b></td><td>一行可以放多个单元格,每个单元格要么是可编辑字段,要么是固定文字</td><td>每个单元格单独配置</td></tr><tr><td><b>分隔线</b></td><td>画一条灰色横线</td><td>无配置</td></tr><tr><td><b>纯文本</b></td><td>一段固定文字,如"此报价单有效期30天"</td><td>文字内容、对齐方式</td></tr></tbody></table><p><b>字段行详解:</b></p><ul><li>点"➕ 添加一个单元格"来增加这一行里的格子数量</li><li>每个格子选"类型":<b>字段(可编辑)</b> 或 <b>纯文本</b></li><li>字段类型要填 <b>标签</b>(如"项目名称")和 <b>绑定字段</b>(如 <code>projectName</code>)</li><li>绑定字段是关键!同一个绑定字段名在整个模板中要保持一致,后续数据填写和导出都靠它</li><li>宽度用百分比,如 <code>50%</code>、<code>33%</code>,一行所有格子宽度加起来建议 = 100%</li></ul><p class="qukt-tip-box">💡 右侧"实时预览"区域会随着你的编辑即时变化,所见即所得</p></section><section class="qukt-help-section"><h4>③ 汇总区域 — 表格底部的费用合计</h4><p>汇总项显示在明细表格的下方(导出 Excel 时会自动排在表格右侧底部)。</p><table class="qukt-help-table"><thead><tr><th>类型</th><th>说明</th></tr></thead><tbody><tr><td><b>手动输入(自定义金额)</b></td><td>任意需要手工填写的金额项:人工费、服务费、运费、税费、折扣、其他费用等。可以在"默认值"里预设一个初始值</td></tr><tr><td><b>自动计算(公式)</b></td><td>系统自动算好的值,需要写公式。<code>grand_total</code> 会自动把所有手动输入项加进去</td></tr></tbody></table><p><b>自动计算公式里的可用变量(固定):</b></p><table class="qukt-help-table"><thead><tr><th>变量名</th><th>含义</th><th>说明</th></tr></thead><tbody><tr><td><code>group_total</code></td><td>明细小计合计</td><td>所有行的自动计算列(小计列)求和</td></tr><tr><td><code>grand_total</code></td><td>报价总额</td><td>group_total + 所有手动输入项之和</td></tr><tr><td><code>quantity_sum</code></td><td>数量总和</td><td>所有行 <b>字段名为 quantity</b> 的列求和。如果表头数量列不叫 quantity,这个值就是 0</td></tr></tbody></table><p><b>动态可用变量(随你的模板定义):</b></p><p>你在汇总区域里定义的<b>每一个手动输入项的字段名</b>,都会自动成为可用变量,它们之间也能互相引用。</p><p>举个例子:如果你定义了 <code>labor_cost</code>、<code>service_fee</code>、<code>discount</code> 三个手动项,那么自动计算公式里可以写:</p><pre class="code">group_total + labor_cost + service_fee - discount</pre><p><b>字段名命名建议:</b></p><ul><li><code>grand_total</code> — 报价总额(特殊字段,系统会把所有手动项加进去)</li><li><code>group_total</code> — 明细小计(建议不要手动改成别的,公式里会用到)</li><li><code>quantity</code> — 表头里的数量列字段名(如果想用 <code>quantity_sum</code> 变量,必须叫这个)</li><li>其他手动项随意,如 <code>service_fee</code>、<code>freight</code>、<code>tax_amount</code>、<code>discount</code> 等</li></ul></section><section class="qukt-help-section"><h4>④ 页面底部 — 签字栏、盖章区</h4><p>结构和"页面头部"完全一样,支持:分隔线、字段行、纯文本。</p><p>常见用法:</p><ul><li>分隔线 → 分隔表格和签字区</li><li>字段行 → 左边"客户签字:________",右边"业务员签字:________"</li><li>纯文本 → 居中写"公司盖章:"</li></ul></section><section class="qukt-help-section"><h4>💾 保存与模板管理</h4><ul><li><b>💾 保存修改</b> — 直接更新当前选中的模板</li><li><b>➕ 另存为新模板</b> — 输入一个新名字,基于当前模板复制出一个全新的模板</li><li>顶部的下拉框可以在已有的模板之间切换,切换后下方所有配置会自动加载</li></ul><p class="qukt-tip-box">⚠️ 目前模板数据保存在浏览器内存中(刷新后会恢复默认),如果要持久化存储,需要把模板同步到后端接口</p></section><section class="qukt-help-section"><h4>🔢 分组与计算规则(高级)</h4><p>在「表头列」tab 的列表下方,有一个<b>分组规则</b>配置框:</p><ul><li><b>按哪一列分组</b> — 选择一列后,相同值的行会自动合并单元格,每组末尾自动生成小计行。选「不分组」则不分组、不显示小计,但列上勾选了「相同值合并」的列仍然会对相邻相同值做合并</li></ul><p>对应模板数据结构:</p><pre class="code">{
|
|
12
|
+
</style></head><body>${_}</body></html>`),p.document.close(),p.onload=()=>{p.print()}}return o({print:O,exportExcel:d}),(u,h)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",Ze,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value.header_sections,(a,p)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"h"+p},[a.type==="title"?(e.openBlock(),e.createElementBlock("h1",{key:0,class:"qukt-q-title",style:e.normalizeStyle(e.unref(J)(a))},e.toDisplayString(V(a,"header")),5)):a.type==="divider"?(e.openBlock(),e.createElementBlock("div",Ke)):a.type==="text"?(e.openBlock(),e.createElementBlock("div",{key:2,class:"qukt-q-text",style:e.normalizeStyle(e.unref(J)(a))},e.toDisplayString(V(a,"header")),5)):a.type==="row"?(e.openBlock(),e.createElementBlock("div",ve,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.cells,(k,_)=>(e.openBlock(),e.createElementBlock("div",{key:_,class:"qukt-q-cell",style:e.normalizeStyle(e.unref(oe)(k))},e.toDisplayString(N(k,"header")),5))),128))])):e.createCommentVNode("",!0)],64))),128)),c.value.columns.length>0?(e.openBlock(),e.createElementBlock("div",et,[e.createElementVNode("table",tt,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value.columns,a=>(e.openBlock(),e.createElementBlock("th",{key:a.field,style:e.normalizeStyle({width:(a.width||100)+"px"})},e.toDisplayString(a.title),5))),128))])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(a,p)=>{var k,_;return e.openBlock(),e.createElementBlock(e.Fragment,{key:p},[a.__is_subtotal?(e.openBlock(),e.createElementBlock("tr",lt,[e.createElementVNode("td",{colspan:c.value.columns.length-1,class:"subtotal-label"},"小计("+e.toDisplayString(a.__group_key)+")",9,ot),e.createElementVNode("td",nt,e.toDisplayString(((k=c.value.group_rules)==null?void 0:k.subtotal_prefix)||"")+e.toDisplayString(s(a.__group_sum))+e.toDisplayString(((_=c.value.group_rules)==null?void 0:_.subtotal_suffix)||""),1)])):(e.openBlock(),e.createElementBlock("tr",it,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value.columns,(w,B)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:w.field},[g(l.value.indexOf(a),w.field)>0?(e.openBlock(),e.createElementBlock("td",{key:0,rowspan:g(l.value.indexOf(a),w.field),class:e.normalizeClass({"merged-cell":g(l.value.indexOf(a),w.field)>1}),style:e.normalizeStyle(q(w))},[w.editor===e.unref(I).AUTO_SEQ.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(w.prefix||"")+e.toDisplayString(p+1)+e.toDisplayString(w.suffix||""),1)],64)):e.unref(W)(w.editor).hasFormula?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(w.prefix||"")+e.toDisplayString(s(y(a)))+e.toDisplayString(w.suffix||""),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(w.prefix||"")+e.toDisplayString(a[w.field]??"")+e.toDisplayString(w.suffix||""),1)],64))],14,at)):e.createCommentVNode("",!0)],64))),128))]))],64)}),128)),l.value.length===0?(e.openBlock(),e.createElementBlock("tr",st,[e.createElementVNode("td",{colspan:c.value.columns.length,class:"qukt-q-empty"},"(暂无数据)",8,rt)])):e.createCommentVNode("",!0)])])])):e.createCommentVNode("",!0),c.value.summary_fields.length>0?(e.openBlock(),e.createElementBlock("div",dt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value.summary_fields,a=>(e.openBlock(),e.createElementBlock("div",{key:a.field,class:"qukt-q-summary-row"},[e.createElementVNode("span",ct,e.toDisplayString(a.label),1),e.createElementVNode("span",{class:"qukt-q-summary-value",style:e.normalizeStyle(e.unref(Se)(a))},e.toDisplayString(i(a)),5)]))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",mt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value.footer_sections,(a,p)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"f"+p},[a.type==="divider"?(e.openBlock(),e.createElementBlock("div",pt)):a.type==="text"?(e.openBlock(),e.createElementBlock("div",{key:1,class:"qukt-q-text",style:e.normalizeStyle(e.unref(J)(a))},e.toDisplayString(V(a,"footer")),5)):a.type==="row"?(e.openBlock(),e.createElementBlock("div",ut,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.cells,(k,_)=>(e.openBlock(),e.createElementBlock("div",{key:_,class:"qukt-q-cell",style:e.normalizeStyle(e.unref(oe)(k))},e.toDisplayString(N(k,"footer")),5))),128))])):e.createCommentVNode("",!0)],64))),128))])])]))}};function Le(n=[],o={}){const t=e.ref(n||[]),c=e.ref(o||{}),E=e.computed(()=>({columns:t.value,group_rules:c.value}));function m(V){t.value=V||[]}function r(V){c.value=V||{}}return e.reactive({columns:t,groupRules:c,tpl:E,setColumns:m,setGroupRules:r})}function me(n=[]){const o=e.ref(n||[]);function t(E){o.value=E||[]}function c(){return o.value||[]}return e.reactive({sections:o,setSections:t,toTpl:c})}function Ae(n=[]){const o=e.ref(n||[]);function t(E){o.value=E||[]}function c(){return o.value||[]}return e.reactive({fields:o,setFields:t,toTpl:c})}const ft=["XXXX","YYYY","ZZZZ","WWWW"];function Re(n,o=3){const t=[],c=ft;for(let E=0;E<o;E++){const m={};for(const r of n){const V=W(r.editor);if(V.editable)if(r.editor===I.NUMBER.value)m[r.field]=Math.floor(Math.random()*900+100);else if(V.hasDict){const N=(r.dictStr||(r.dict?r.dict.join(","):"")).split(",").map(q=>q.trim()).filter(Boolean);m[r.field]=N[E%Math.max(N.length,1)]||c[E%c.length]}else m[r.field]=c[E%c.length]}t.push(m)}return t}function ae(n=1100){const o=e.ref(!1);function t(){o.value=window.innerWidth<=n}return e.onMounted(()=>{t(),window.addEventListener("resize",t)}),e.onUnmounted(()=>{window.removeEventListener("resize",t)}),{isNarrow:o}}const kt={class:"qukt-gr-dialog"},bt={class:"qukt-gr-header"},ht={class:"qukt-gr-content"},gt={class:"qukt-gr-form"},Et={class:"qukt-gr-form-row"},yt={class:"qukt-gr-form-row"},Vt={class:"qukt-gr-form-row"},Nt={key:0,class:"qukt-gr-form-row"},_t={key:1,class:"qukt-gr-form-row"},qt={class:"qukt-gr-form-row"},wt={class:"qukt-border-group",style:{flex:"1"}},Bt={class:"qukt-border-item"},xt={class:"qukt-border-item"},$t={class:"qukt-border-item"},Ct={class:"qukt-border-item"},St={class:"qukt-gr-form-row"},Dt={class:"qukt-gr-footer"},se={__name:"StyleDialog",props:{visible:{type:Boolean,default:!1},modelValue:{type:Object,default:()=>({})},showBorder:{type:Boolean,default:!0},showAlign:{type:Boolean,default:!0},showWidth:{type:Boolean,default:!1},title:{type:String,default:"样式配置"}},emits:["close","update:modelValue"],setup(n,{emit:o}){const t=n,c=o,E=()=>({top:{style:"",width:1,color:"#dcdfe6"},bottom:{style:"",width:1,color:"#dcdfe6"},left:{style:"",width:1,color:"#dcdfe6"},right:{style:"",width:1,color:"#dcdfe6"}}),m=()=>({width:"auto",color:"#303133",fontSize:13,bold:!1,italic:!1,align:"left",border:E()}),r=e.reactive(m());function V(q){const s=m(),b=R(q||{});if(b.color!==void 0&&(s.color=b.color),b.fontSize!==void 0&&(s.fontSize=b.fontSize),b.bold!==void 0&&(s.bold=b.bold),b.italic!==void 0&&(s.italic=b.italic),b.align!==void 0&&(s.align=b.align),b.width!==void 0&&(s.width=b.width),b.border!==void 0){s.border=R(E());for(const y of["top","bottom","left","right"])b.border[y]&&(s.border[y]={...s.border[y],...b.border[y]})}Object.assign(r,s)}e.watch(()=>t.visible,q=>{q&&V(t.modelValue)},{immediate:!0}),e.watch(r,()=>{c("update:modelValue",R({...r}))},{deep:!0});function N(q){const s=q==="none"?{style:"",width:0,color:"#dcdfe6"}:{style:"solid",width:1,color:"#dcdfe6"};r.border={top:{...s},bottom:{...s},left:{...s},right:{...s}}}return(q,s)=>n.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qukt-gr-mask",onClick:s[22]||(s[22]=e.withModifiers(b=>q.$emit("close"),["self"]))},[e.createElementVNode("div",kt,[e.createElementVNode("div",bt,[e.createElementVNode("span",null,e.toDisplayString(n.title),1),e.createElementVNode("button",{class:"qukt-gr-close",onClick:s[0]||(s[0]=b=>q.$emit("close"))},"✕")]),e.createElementVNode("div",ht,[e.createElementVNode("div",gt,[e.createElementVNode("div",Et,[s[23]||(s[23]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"颜色",-1)),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":s[1]||(s[1]=b=>r.color=b),class:"qukt-color-input"},null,512),[[e.vModelText,r.color]])]),e.createElementVNode("div",yt,[s[24]||(s[24]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"字号",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":s[2]||(s[2]=b=>r.fontSize=b),type:"number",class:"qukt-cell-input tiny",min:"10",max:"48",style:{flex:"1"}},null,512),[[e.vModelText,r.fontSize,void 0,{number:!0}]])]),e.createElementVNode("div",Vt,[s[25]||(s[25]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"加粗",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":s[3]||(s[3]=b=>r.bold=b)},null,512),[[e.vModelCheckbox,r.bold]]),s[26]||(s[26]=e.createElementVNode("label",{class:"qukt-gr-form-label",style:{"margin-left":"20px"}},"斜体",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":s[4]||(s[4]=b=>r.italic=b)},null,512),[[e.vModelCheckbox,r.italic]])]),n.showWidth?(e.openBlock(),e.createElementBlock("div",Nt,[s[27]||(s[27]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"宽度",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":s[5]||(s[5]=b=>r.width=b),class:"qukt-cell-input",placeholder:"如 33%、auto",style:{flex:"1"}},null,512),[[e.vModelText,r.width]])])):e.createCommentVNode("",!0),n.showAlign?(e.openBlock(),e.createElementBlock("div",_t,[s[29]||(s[29]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"对齐",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":s[6]||(s[6]=b=>r.align=b),class:"qukt-cell-input",style:{flex:"1"}},[...s[28]||(s[28]=[e.createElementVNode("option",{value:"left"},"左",-1),e.createElementVNode("option",{value:"center"},"中",-1),e.createElementVNode("option",{value:"right"},"右",-1)])],512),[[e.vModelSelect,r.align]])])):e.createCommentVNode("",!0),n.showBorder?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("div",qt,[s[38]||(s[38]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"边框",-1)),e.createElementVNode("div",wt,[e.createElementVNode("div",Bt,[s[31]||(s[31]=e.createElementVNode("span",null,"上",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":s[7]||(s[7]=b=>r.border.top.style=b),class:"qukt-cell-input tiny"},[...s[30]||(s[30]=[e.createElementVNode("option",{value:""},"无",-1),e.createElementVNode("option",{value:"solid"},"实线",-1),e.createElementVNode("option",{value:"dashed"},"虚线",-1),e.createElementVNode("option",{value:"dotted"},"点线",-1)])],512),[[e.vModelSelect,r.border.top.style]]),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":s[8]||(s[8]=b=>r.border.top.width=b),class:"qukt-cell-input tiny",min:"0",max:"20",step:"1"},null,512),[[e.vModelText,r.border.top.width,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":s[9]||(s[9]=b=>r.border.top.color=b),class:"qukt-color-input"},null,512),[[e.vModelText,r.border.top.color]])]),e.createElementVNode("div",xt,[s[33]||(s[33]=e.createElementVNode("span",null,"下",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":s[10]||(s[10]=b=>r.border.bottom.style=b),class:"qukt-cell-input tiny"},[...s[32]||(s[32]=[e.createElementVNode("option",{value:""},"无",-1),e.createElementVNode("option",{value:"solid"},"实线",-1),e.createElementVNode("option",{value:"dashed"},"虚线",-1),e.createElementVNode("option",{value:"dotted"},"点线",-1)])],512),[[e.vModelSelect,r.border.bottom.style]]),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":s[11]||(s[11]=b=>r.border.bottom.width=b),class:"qukt-cell-input tiny",min:"0",max:"20",step:"1"},null,512),[[e.vModelText,r.border.bottom.width,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":s[12]||(s[12]=b=>r.border.bottom.color=b),class:"qukt-color-input"},null,512),[[e.vModelText,r.border.bottom.color]])]),e.createElementVNode("div",$t,[s[35]||(s[35]=e.createElementVNode("span",null,"左",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":s[13]||(s[13]=b=>r.border.left.style=b),class:"qukt-cell-input tiny"},[...s[34]||(s[34]=[e.createElementVNode("option",{value:""},"无",-1),e.createElementVNode("option",{value:"solid"},"实线",-1),e.createElementVNode("option",{value:"dashed"},"虚线",-1),e.createElementVNode("option",{value:"dotted"},"点线",-1)])],512),[[e.vModelSelect,r.border.left.style]]),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":s[14]||(s[14]=b=>r.border.left.width=b),class:"qukt-cell-input tiny",min:"0",max:"20",step:"1"},null,512),[[e.vModelText,r.border.left.width,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":s[15]||(s[15]=b=>r.border.left.color=b),class:"qukt-color-input"},null,512),[[e.vModelText,r.border.left.color]])]),e.createElementVNode("div",Ct,[s[37]||(s[37]=e.createElementVNode("span",null,"右",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":s[16]||(s[16]=b=>r.border.right.style=b),class:"qukt-cell-input tiny"},[...s[36]||(s[36]=[e.createElementVNode("option",{value:""},"无",-1),e.createElementVNode("option",{value:"solid"},"实线",-1),e.createElementVNode("option",{value:"dashed"},"虚线",-1),e.createElementVNode("option",{value:"dotted"},"点线",-1)])],512),[[e.vModelSelect,r.border.right.style]]),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":s[17]||(s[17]=b=>r.border.right.width=b),class:"qukt-cell-input tiny",min:"0",max:"20",step:"1"},null,512),[[e.vModelText,r.border.right.width,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":s[18]||(s[18]=b=>r.border.right.color=b),class:"qukt-color-input"},null,512),[[e.vModelText,r.border.right.color]])])])]),e.createElementVNode("div",St,[s[39]||(s[39]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"预设",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:s[19]||(s[19]=b=>N("all"))},"四边"),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:s[20]||(s[20]=b=>N("none"))},"无边框")])],64)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Dt,[e.createElementVNode("button",{class:"qukt-btn",onClick:s[21]||(s[21]=b=>q.$emit("close"))},"关闭")])])])):e.createCommentVNode("",!0)}},Ft={class:"qukt-toolbar"},Tt={class:"qukt-btn-group-inline"},Ut={class:"qukt-design-table"},Mt={class:"idx"},zt=["onUpdate:modelValue"],Lt={class:"qukt-title-group"},At=["onUpdate:modelValue"],Rt=["onUpdate:modelValue"],Ot=["onUpdate:modelValue"],It=["onUpdate:modelValue"],Wt=["value"],Pt=["onUpdate:modelValue"],jt=["onUpdate:modelValue"],Xt=["onUpdate:modelValue"],Qt={key:2,class:"qukt-muted"},Ht={key:3,class:"qukt-muted"},Gt={class:"qukt-col-merge"},Yt={key:0},Jt=["onUpdate:modelValue"],Zt={key:1,class:"qukt-muted"},Kt=["onClick"],vt=["disabled","onClick"],el=["disabled","onClick"],tl=["onClick"],ll={__name:"DesignCols",props:{columns:{type:Array,default:()=>[]},groupRules:{type:Object,default:()=>({})},breakpoint:{type:Number,default:1100}},emits:["update:columns","update:groupRules","help","open-group"],setup(n,{emit:o}){const t=Object.values(I),c=n,E=o,{isNarrow:m}=ae(c.breakpoint),r=e.ref([]),V=e.ref({});e.watch(()=>c.columns,f=>{const i=we(R(f||[]));Y(i,r.value)||(r.value=i)},{immediate:!0,deep:!0}),e.watch(()=>c.groupRules,f=>{const i=le(R(f||{}));Y(i,V.value)||(V.value=i)},{immediate:!0,deep:!0}),e.watch(r,f=>{E("update:columns",Be(f))},{deep:!0}),e.watch(V,f=>{E("update:groupRules",R(f))},{deep:!0});const N=e.computed(()=>!!V.value.merge_field);function q(){let f=0;for(const i of r.value){const l=/^custom_(\d+)$/.exec(i.field);l&&(f=Math.max(f,parseInt(l[1],10)))}return f+1}function s(f){const i=new Set([...r.value.map(O=>O.field)]),l=W(f);let g;l.defaultFieldBase==="custom"?g="custom_"+String(q()).padStart(4,"0"):g=l.defaultFieldBase;const d=Xe(f,He(g,i));r.value.push(d)}function b(f){r.value.splice(f,1)}function y(f,i){const l=f+i;l<0||l>=r.value.length||([r.value[f],r.value[l]]=[r.value[l],r.value[f]])}const D=e.ref(!1),M=e.ref({}),z=e.ref("");function F(f){f.cellStyle||(f.cellStyle={}),M.value=f.cellStyle,z.value=f.title||"单元格样式",D.value=!0}return(f,i)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",Ft,[i[5]||(i[5]=e.createElementVNode("span",{class:"qukt-tip"},[e.createTextVNode("拖动或点 ↑↓ 调整顺序;支持自动序号和公式计算列,公式里可直接引用其他字段名,如 "),e.createElementVNode("code",null,"quantity * unit_price * 0.9")],-1)),e.createElementVNode("div",Tt,[e.createElementVNode("button",{class:e.normalizeClass(["qukt-btn",{"qukt-btn-primary":N.value}]),onClick:i[0]||(i[0]=l=>f.$emit("open-group"))},"分组 & 小计"+e.toDisplayString(N.value?" ✓":""),3),e.createElementVNode("button",{class:"qukt-btn qukt-btn-primary",onClick:i[1]||(i[1]=l=>s("INPUT"))},"+ 添加字段"),e.createElementVNode("button",{class:"qukt-btn",onClick:i[2]||(i[2]=l=>f.$emit("help"))},"帮助")])]),e.createElementVNode("div",{class:e.normalizeClass(["qukt-table-wrap",{"is-narrow":e.unref(m)}])},[e.createElementVNode("table",Ut,[i[7]||(i[7]=e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[e.createElementVNode("th",{width:"50"},"#"),e.createElementVNode("th",{width:"150"},"字段名"),e.createElementVNode("th",{width:"200"},"列标题"),e.createElementVNode("th",{width:"140"},"类型"),e.createElementVNode("th",{width:"80"},"宽度"),e.createElementVNode("th",null,"专属配置"),e.createElementVNode("th",{width:"120"},"分组时合并"),e.createElementVNode("th",{width:"80"},"设置"),e.createElementVNode("th",{width:"140"},"操作")])],-1)),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(l,g)=>(e.openBlock(),e.createElementBlock("tr",{key:g},[e.createElementVNode("td",Mt,e.toDisplayString(g+1),1),e.createElementVNode("td",null,[e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input","onUpdate:modelValue":d=>l.field=d},null,8,zt),[[e.vModelText,l.field]])]),e.createElementVNode("td",null,[e.createElementVNode("div",Lt,[e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input pref-suf","onUpdate:modelValue":d=>l.prefix=d,placeholder:"前"},null,8,At),[[e.vModelText,l.prefix]]),e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input","onUpdate:modelValue":d=>l.title=d,placeholder:"列标题"},null,8,Rt),[[e.vModelText,l.title]]),e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input pref-suf","onUpdate:modelValue":d=>l.suffix=d,placeholder:"后"},null,8,Ot),[[e.vModelText,l.suffix]])])]),e.createElementVNode("td",null,[e.withDirectives(e.createElementVNode("select",{class:"qukt-cell-input","onUpdate:modelValue":d=>l.editor=d},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(t),d=>(e.openBlock(),e.createElementBlock("option",{key:d.value,value:d.value},e.toDisplayString(d.label),9,Wt))),128))],8,It),[[e.vModelSelect,l.editor]])]),e.createElementVNode("td",null,[e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input",type:"number",min:"50",max:"500","onUpdate:modelValue":d=>l.width=d},null,8,Pt),[[e.vModelText,l.width,void 0,{number:!0}]])]),e.createElementVNode("td",null,[e.unref(W)(l.editor).hasDict?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,class:"qukt-cell-input","onUpdate:modelValue":d=>l.dictStr=d,placeholder:"下拉选项,逗号分隔 如:设备,材料,安装"},null,8,jt)),[[e.vModelText,l.dictStr]]):e.unref(W)(l.editor).hasFormula?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:1,class:"qukt-cell-input","onUpdate:modelValue":d=>l.formula=d,placeholder:"公式,如 quantity * unit_price + tax"},null,8,Xt)),[[e.vModelText,l.formula]]):l.editor===e.unref(I).AUTO_SEQ.value?(e.openBlock(),e.createElementBlock("span",Qt,"自动生成序号,无需配置")):(e.openBlock(),e.createElementBlock("span",Ht,"-"))]),e.createElementVNode("td",Gt,[e.unref(W)(l.editor).canMerge?(e.openBlock(),e.createElementBlock("label",Yt,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":d=>l.merge_on_group=d},null,8,Jt),[[e.vModelCheckbox,l.merge_on_group]]),i[6]||(i[6]=e.createElementVNode("span",null,"相同值合并",-1))])):(e.openBlock(),e.createElementBlock("span",Zt,"—"))]),e.createElementVNode("td",null,[e.createElementVNode("button",{class:"qukt-mini-btn",onClick:d=>F(l)},"样式",8,Kt)]),e.createElementVNode("td",null,[e.createElementVNode("button",{class:"qukt-mini-btn",disabled:g===0,onClick:d=>y(g,-1)},"↑",8,vt),e.createElementVNode("button",{class:"qukt-mini-btn",disabled:g>=r.value.length-1,onClick:d=>y(g,1)},"↓",8,el),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:d=>b(g)},"删",8,tl)])]))),128))])])],2),e.createVNode(se,{visible:D.value,modelValue:M.value,showBorder:"",showAlign:!0,showWidth:!1,title:z.value,"onUpdate:modelValue":i[3]||(i[3]=l=>Object.assign(M.value,l)),onClose:i[4]||(i[4]=l=>D.value=!1)},null,8,["visible","modelValue","title"])]))}},ol={class:"qukt-gr-dialog"},nl={class:"qukt-gr-header"},il={class:"qukt-gr-content"},al={class:"qukt-gr-form"},sl={class:"qukt-gr-form-row"},rl=["value","disabled"],dl={class:"qukt-gr-form-row"},cl={class:"qukt-gr-form-row"},ml={class:"qukt-gr-form-row"},pl={class:"qukt-gr-footer"},ul={__name:"GroupDialog",props:{visible:{type:Boolean,default:!1},columns:{type:Array,default:()=>[]},groupRules:{type:Object,default:()=>({})}},emits:["close","update:groupRules"],setup(n,{emit:o}){const t=n,c=o,E=e.reactive({merge_field:"",show_detail_subtotal:!0,subtotal_prefix:"",subtotal_suffix:""});return e.watch(()=>t.groupRules,m=>{const r=le(R(m||{}));E.merge_field=r.merge_field||"",E.show_detail_subtotal=r.show_detail_subtotal??!0,E.subtotal_prefix=r.subtotal_prefix??"",E.subtotal_suffix=r.subtotal_suffix??""},{immediate:!0,deep:!0}),e.watch(E,()=>{c("update:groupRules",R(le({merge_field:E.merge_field,show_detail_subtotal:E.show_detail_subtotal,subtotal_prefix:E.subtotal_prefix,subtotal_suffix:E.subtotal_suffix})))},{deep:!0}),(m,r)=>n.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qukt-gr-mask",onClick:r[6]||(r[6]=e.withModifiers(V=>m.$emit("close"),["self"]))},[e.createElementVNode("div",ol,[e.createElementVNode("div",nl,[r[7]||(r[7]=e.createElementVNode("span",null,"分组规则 & 小计配置",-1)),e.createElementVNode("button",{class:"qukt-gr-close",onClick:r[0]||(r[0]=V=>m.$emit("close"))},"✕")]),e.createElementVNode("div",il,[r[13]||(r[13]=e.createElementVNode("div",{class:"qukt-gr-tips"},[e.createElementVNode("p",null,[e.createElementVNode("b",null,"分组是什么?"),e.createTextVNode(" 选择某一列后,相同值的行会自动合并单元格(比如按「系统名称」分组,同系统的多条明细会合并成一个单元格)。每组末尾自动显示一行小计。")])],-1)),e.createElementVNode("div",al,[e.createElementVNode("div",sl,[r[9]||(r[9]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"按哪一列分组",-1)),e.withDirectives(e.createElementVNode("select",{class:"qukt-cell-input","onUpdate:modelValue":r[1]||(r[1]=V=>E.merge_field=V),style:{flex:"1"}},[r[8]||(r[8]=e.createElementVNode("option",{value:""},"— 不分组 —",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,V=>(e.openBlock(),e.createElementBlock("option",{key:V.field,value:V.field,disabled:!e.unref(W)(V.editor).editable},e.toDisplayString(V.title)+"("+e.toDisplayString(V.field)+")",9,rl))),128))],512),[[e.vModelSelect,E.merge_field]])]),e.createElementVNode("div",dl,[r[10]||(r[10]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"显示小计",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":r[2]||(r[2]=V=>E.show_detail_subtotal=V)},null,512),[[e.vModelCheckbox,E.show_detail_subtotal]])]),e.createElementVNode("div",cl,[r[11]||(r[11]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"小计前缀",-1)),e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input","onUpdate:modelValue":r[3]||(r[3]=V=>E.subtotal_prefix=V),placeholder:"如 ¥、¥",style:{flex:"1"}},null,512),[[e.vModelText,E.subtotal_prefix]])]),e.createElementVNode("div",ml,[r[12]||(r[12]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"小计后缀",-1)),e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input","onUpdate:modelValue":r[4]||(r[4]=V=>E.subtotal_suffix=V),placeholder:"如 元、RMB",style:{flex:"1"}},null,512),[[e.vModelText,E.subtotal_suffix]])])])]),e.createElementVNode("div",pl,[e.createElementVNode("button",{class:"qukt-btn",onClick:r[5]||(r[5]=V=>m.$emit("close"))},"关闭")])])])):e.createCommentVNode("",!0)}},fl={class:"qukt-toolbar"},kl={class:"qukt-col-left"},bl={class:"qukt-sec-header"},hl={class:"qukt-sec-type"},gl={class:"qukt-sec-actions"},El=["disabled","onClick"],yl=["disabled","onClick"],Vl=["onClick"],Nl={class:"qukt-sec-row"},_l=["onUpdate:modelValue"],ql={class:"qukt-sec-row"},wl=["checked","onChange"],Bl={key:0,class:"qukt-sec-row"},xl=["onUpdate:modelValue"],$l={key:1,class:"qukt-sec-row"},Cl=["onUpdate:modelValue"],Sl={class:"qukt-sec-row"},Dl=["onClick"],Fl={class:"qukt-cells-list"},Tl={class:"qukt-cell-toolbar"},Ul=["onClick"],Ml={class:"qukt-sec-row"},zl=["onUpdate:modelValue"],Ll={key:0,class:"qukt-sec-row"},Al=["onUpdate:modelValue"],Rl={class:"qukt-chk-label"},Ol=["onUpdate:modelValue"],Il={class:"qukt-sec-row"},Wl=["checked","onChange"],Pl={key:1,class:"qukt-sec-row"},jl=["onUpdate:modelValue"],Xl={key:0,class:"qukt-sec-row"},Ql=["onUpdate:modelValue"],Hl={key:1,class:"qukt-sec-row"},Gl=["onUpdate:modelValue"],Yl={class:"qukt-sec-row"},Jl=["onClick"],Zl=["onClick"],Kl={class:"qukt-col-right"},vl={class:"qukt-preview-box"},eo={class:"qukt-preview-inner"},to={key:1,class:"qukt-p-divider"},lo={key:3,class:"qukt-p-row"},oo={key:0,class:"qukt-p-label"},no={class:"qukt-p-value qukt-p-bind-placeholder"},io={key:1,class:"qukt-p-value qukt-p-bind-placeholder"},ao={key:0,class:"qukt-p-label"},so={class:"qukt-p-value"},Oe="hdr_",ro={__name:"DesignHeader",props:{sections:{type:Array,default:()=>[]},breakpoint:{type:Number,default:1100}},emits:["update:sections"],setup(n,{emit:o}){const t=n,c=o,{isNarrow:E}=ae(t.breakpoint),m=e.ref([]);e.watch(()=>t.sections,f=>{const i=ne(R(f||[]));Y(i,m.value)||(m.value=i)},{immediate:!0}),e.watch(m,f=>{c("update:sections",R(f))},{deep:!0});const r=e.ref(!1),V=e.ref({}),N=e.reactive({title:"样式配置",showBorder:!1,showAlign:!0,showWidth:!1});function q(f,i){V.value=f,i==="cell"?(N.title="单元格样式",N.showBorder=!0,N.showAlign=!0,N.showWidth=!0):(N.title="文本样式",N.showBorder=!1,N.showAlign=!0,N.showWidth=!1),r.value=!0}function s(f){f==="divider"?m.value.push({type:f}):f==="text"?m.value.push({type:f,label:"标签:",text:"纯文本内容",style:{color:"#303133",fontSize:14,bold:!1,italic:!1,align:"left"},bindEnabled:!1,bindField:""}):f==="row"&&m.value.push({type:f,cells:[{type:"field",label:"标签:",bindEnabled:!1,bindField:"",hideLabel:!1,style:K("50%")}]})}function b(f){m.value.splice(f,1)}function y(f,i){const l=f+i;l<0||l>=m.value.length||([m.value[f],m.value[l]]=[m.value[l],m.value[f]])}function D(f){f.cells||(f.cells=[]),f.cells.push({type:"field",label:"标签:",bindEnabled:!1,bindField:"",hideLabel:!1,style:K("33%")})}function M(f,i){f.cells.splice(i,1)}const z=f=>De(f,Oe,m.value),F=f=>Fe(f,Oe,m.value);return(f,i)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",fl,[i[5]||(i[5]=e.createElementVNode("span",{class:"qukt-tip"},"这里定义报价单的大标题、项目信息行等,左侧是设计器,右侧实时预览",-1)),e.createElementVNode("button",{class:"qukt-btn",onClick:i[0]||(i[0]=l=>s("row"))},"+ 字段行"),e.createElementVNode("button",{class:"qukt-btn",onClick:i[1]||(i[1]=l=>s("divider"))},"+ 分隔线"),e.createElementVNode("button",{class:"qukt-btn",onClick:i[2]||(i[2]=l=>s("text"))},"+ 纯文本")]),e.createElementVNode("div",{class:e.normalizeClass(["qukt-two-col",{"is-narrow":e.unref(E)}])},[e.createElementVNode("div",kl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,(l,g)=>(e.openBlock(),e.createElementBlock("div",{key:g,class:e.normalizeClass(["qukt-sec-block",{"qukt-sec-block--divider":l.type==="divider"}])},[e.createElementVNode("div",bl,[e.createElementVNode("span",hl,e.toDisplayString(l.type==="row"?"字段行":l.type==="divider"?"分隔线":"纯文本"),1),e.createElementVNode("div",gl,[e.createElementVNode("button",{class:"qukt-mini-btn",disabled:g===0,onClick:d=>y(g,-1)},"↑",8,El),e.createElementVNode("button",{class:"qukt-mini-btn",disabled:g>=m.value.length-1,onClick:d=>y(g,1)},"↓",8,yl),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:d=>b(g)},"删",8,Vl)])]),l.type==="text"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",Nl,[i[6]||(i[6]=e.createElementVNode("label",null,"标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d=>l.label=d,class:"qukt-cell-input",placeholder:"填写数据时用的提示"},null,8,_l),[[e.vModelText,l.label]])]),e.createElementVNode("div",ql,[i[7]||(i[7]=e.createElementVNode("label",null,"暴露",-1)),e.createElementVNode("input",{type:"checkbox",checked:l.bindEnabled,onChange:d=>z(l)},null,40,wl)]),l.bindEnabled?(e.openBlock(),e.createElementBlock("div",Bl,[i[8]||(i[8]=e.createElementVNode("label",null,"字段名",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d=>l.bindField=d,class:"qukt-cell-input",placeholder:"如 salesman"},null,8,xl),[[e.vModelText,l.bindField]])])):e.createCommentVNode("",!0),l.bindEnabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",$l,[i[9]||(i[9]=e.createElementVNode("label",null,"文字",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d=>l.text=d,class:"qukt-cell-input"},null,8,Cl),[[e.vModelText,l.text]])])),e.createElementVNode("div",Sl,[i[10]||(i[10]=e.createElementVNode("label",null,"样式",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:d=>q(l.style,"text")},"设置",8,Dl)])],64)):l.type==="row"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",Fl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.cells,(d,O)=>(e.openBlock(),e.createElementBlock("div",{key:O,class:"qukt-cell-block"},[e.createElementVNode("div",Tl,[e.createElementVNode("strong",null,e.toDisplayString(O+1),1),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:u=>M(l,O)},"×",8,Ul)]),e.createElementVNode("div",Ml,[i[12]||(i[12]=e.createElementVNode("label",null,"类型",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":u=>d.type=u,class:"qukt-cell-input small"},[...i[11]||(i[11]=[e.createElementVNode("option",{value:"field"},"字段(可编辑)",-1),e.createElementVNode("option",{value:"text"},"纯文本",-1)])],8,zl),[[e.vModelSelect,d.type]])]),d.type==="field"?(e.openBlock(),e.createElementBlock("div",Ll,[i[14]||(i[14]=e.createElementVNode("label",null,"标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":u=>d.label=u,class:"qukt-cell-input",placeholder:"标签"},null,8,Al),[[e.vModelText,d.label]]),e.createElementVNode("label",Rl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":u=>d.hideLabel=u},null,8,Ol),[[e.vModelCheckbox,d.hideLabel]]),i[13]||(i[13]=e.createTextVNode(" 隐藏 ",-1))])])):e.createCommentVNode("",!0),e.createElementVNode("div",Il,[i[15]||(i[15]=e.createElementVNode("label",null,"暴露",-1)),e.createElementVNode("input",{type:"checkbox",checked:d.bindEnabled,onChange:u=>F(d)},null,40,Wl)]),d.bindEnabled?(e.openBlock(),e.createElementBlock("div",Pl,[i[16]||(i[16]=e.createElementVNode("label",null,"字段名",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":u=>d.bindField=u,class:"qukt-cell-input",placeholder:"如 salesman"},null,8,jl),[[e.vModelText,d.bindField]])])):e.createCommentVNode("",!0),d.bindEnabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[d.type==="field"?(e.openBlock(),e.createElementBlock("div",Xl,[i[17]||(i[17]=e.createElementVNode("label",null,"值",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":u=>d.value=u,class:"qukt-cell-input",placeholder:"字段的值"},null,8,Ql),[[e.vModelText,d.value]])])):e.createCommentVNode("",!0),d.type==="text"?(e.openBlock(),e.createElementBlock("div",Hl,[i[18]||(i[18]=e.createElementVNode("label",null,"文字",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":u=>d.text=u,class:"qukt-cell-input"},null,8,Gl),[[e.vModelText,d.text]])])):e.createCommentVNode("",!0)],64)),e.createElementVNode("div",Yl,[i[19]||(i[19]=e.createElementVNode("label",null,"样式",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:u=>q(d.style,"cell")},"设置",8,Jl)])]))),128))]),e.createElementVNode("button",{class:"qukt-btn qukt-btn-ghost",onClick:d=>D(l)},"+ 添加一个单元格",8,Zl)],64)):e.createCommentVNode("",!0)],2))),128))]),e.createElementVNode("div",Kl,[e.createElementVNode("div",vl,[i[20]||(i[20]=e.createElementVNode("div",{class:"qukt-preview-label"},"实时预览",-1)),e.createElementVNode("div",eo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,(l,g)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:g},[l.type==="title"?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qukt-p-title",style:e.normalizeStyle(e.unref(J)(l))},e.toDisplayString(l.bindEnabled?l.bindField||"待绑定":l.text||"大标题"),5)):l.type==="divider"?(e.openBlock(),e.createElementBlock("div",to)):l.type==="text"?(e.openBlock(),e.createElementBlock("div",{key:2,class:"qukt-p-text",style:e.normalizeStyle(e.unref(J)(l))},e.toDisplayString(l.bindEnabled?l.bindField||"待绑定":l.text||"纯文本"),5)):l.type==="row"?(e.openBlock(),e.createElementBlock("div",lo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.cells,(d,O)=>(e.openBlock(),e.createElementBlock("div",{key:O,class:"qukt-p-cell",style:e.normalizeStyle(e.unref(oe)(d))},[d.bindEnabled?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[d.type==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[d.label&&!d.hideLabel?(e.openBlock(),e.createElementBlock("span",oo,e.toDisplayString(d.label),1)):e.createCommentVNode("",!0),e.createElementVNode("span",no,e.toDisplayString(d.bindField||"待绑定"),1)],64)):(e.openBlock(),e.createElementBlock("span",io,e.toDisplayString(d.bindField||"待绑定"),1))],64)):d.type==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[d.label&&!d.hideLabel?(e.openBlock(),e.createElementBlock("span",ao,e.toDisplayString(d.label),1)):e.createCommentVNode("",!0),e.createElementVNode("span",so,e.toDisplayString(d.value||"字段值"),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(d.text||"纯文本"),1)],64))],4))),128))])):e.createCommentVNode("",!0)],64))),128))])])])],2),e.createVNode(se,{visible:r.value,modelValue:V.value,showBorder:N.showBorder,showAlign:N.showAlign,showWidth:N.showWidth,title:N.title,"onUpdate:modelValue":i[3]||(i[3]=l=>Object.assign(V.value,l)),onClose:i[4]||(i[4]=l=>r.value=!1)},null,8,["visible","modelValue","showBorder","showAlign","showWidth","title"])]))}},co={class:"qukt-toolbar"},mo={class:"qukt-col-left"},po={class:"qukt-sec-header"},uo={class:"qukt-sec-type"},fo={class:"qukt-sec-actions"},ko=["disabled","onClick"],bo=["disabled","onClick"],ho=["onClick"],go={class:"qukt-cells-list"},Eo={class:"qukt-cell-toolbar"},yo=["onClick"],Vo={class:"qukt-sec-row"},No=["onUpdate:modelValue"],_o={key:0,class:"qukt-sec-row"},qo=["onUpdate:modelValue"],wo={class:"qukt-chk-label"},Bo=["onUpdate:modelValue"],xo={class:"qukt-sec-row"},$o=["checked","onChange"],Co={key:1,class:"qukt-sec-row"},So=["onUpdate:modelValue"],Do={key:0,class:"qukt-sec-row"},Fo=["onUpdate:modelValue"],To={key:1,class:"qukt-sec-row"},Uo=["onUpdate:modelValue"],Mo={class:"qukt-sec-row"},zo=["onClick"],Lo=["onClick"],Ao={class:"qukt-sec-row"},Ro=["onUpdate:modelValue"],Oo={class:"qukt-sec-row"},Io=["checked","onChange"],Wo={key:0,class:"qukt-sec-row"},Po=["onUpdate:modelValue"],jo={key:1,class:"qukt-sec-row"},Xo=["onUpdate:modelValue"],Qo={class:"qukt-sec-row"},Ho=["onClick"],Go={class:"qukt-col-right"},Yo={class:"qukt-preview-box"},Jo={class:"qukt-preview-inner"},Zo={key:0,class:"qukt-p-divider"},Ko={key:2,class:"qukt-p-row"},vo={key:0,class:"qukt-p-label"},en={class:"qukt-p-value qukt-p-bind-placeholder"},tn={key:1,class:"qukt-p-value qukt-p-bind-placeholder"},ln={key:0,class:"qukt-p-label"},on={class:"qukt-p-value"},Ie="ftr_",nn={__name:"DesignFooter",props:{sections:{type:Array,default:()=>[]},breakpoint:{type:Number,default:1100}},emits:["update:sections"],setup(n,{emit:o}){const t=n,c=o,{isNarrow:E}=ae(t.breakpoint),m=e.ref([]);e.watch(()=>t.sections,f=>{const i=ne(R(f||[]));Y(i,m.value)||(m.value=i)},{immediate:!0}),e.watch(m,f=>{c("update:sections",R(f))},{deep:!0});const r=e.ref(!1),V=e.ref({}),N=e.reactive({title:"样式配置",showBorder:!1,showAlign:!0,showWidth:!1});function q(f,i){V.value=f,i==="cell"?(N.title="单元格样式",N.showBorder=!0,N.showAlign=!0,N.showWidth=!0):(N.title="文本样式",N.showBorder=!1,N.showAlign=!0,N.showWidth=!1),r.value=!0}function s(f){f==="divider"?m.value.push({type:f}):f==="text"?m.value.push({type:f,label:"标签:",text:"纯文本",style:{color:"#303133",fontSize:14,bold:!1,italic:!1,align:"left"},bindEnabled:!1,bindField:""}):f==="row"&&m.value.push({type:f,cells:[{type:"field",label:"标签:",bindEnabled:!1,bindField:"",hideLabel:!1,style:K("50%")}]})}function b(f){m.value.splice(f,1)}function y(f,i){const l=f+i;l<0||l>=m.value.length||([m.value[f],m.value[l]]=[m.value[l],m.value[f]])}function D(f){f.cells||(f.cells=[]),f.cells.push({type:"field",label:"标签:",bindEnabled:!1,bindField:"",hideLabel:!1,style:K("50%")})}function M(f,i){f.cells.splice(i,1)}const z=f=>De(f,Ie,m.value),F=f=>Fe(f,Ie,m.value);return(f,i)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",co,[i[5]||(i[5]=e.createElementVNode("span",{class:"qukt-tip"},"页面底部显示签字栏、盖章区等,结构和页面头部一样",-1)),e.createElementVNode("button",{class:"qukt-btn",onClick:i[0]||(i[0]=l=>s("divider"))},"+ 分隔线"),e.createElementVNode("button",{class:"qukt-btn",onClick:i[1]||(i[1]=l=>s("row"))},"+ 字段行"),e.createElementVNode("button",{class:"qukt-btn",onClick:i[2]||(i[2]=l=>s("text"))},"+ 纯文本")]),e.createElementVNode("div",{class:e.normalizeClass(["qukt-two-col",{"is-narrow":e.unref(E)}])},[e.createElementVNode("div",mo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,(l,g)=>(e.openBlock(),e.createElementBlock("div",{key:g,class:e.normalizeClass(["qukt-sec-block",{"qukt-sec-block--divider":l.type==="divider"}])},[e.createElementVNode("div",po,[e.createElementVNode("span",uo,e.toDisplayString(l.type==="row"?"字段行":l.type==="divider"?"分隔线":"纯文本"),1),e.createElementVNode("div",fo,[e.createElementVNode("button",{class:"qukt-mini-btn",disabled:g===0,onClick:d=>y(g,-1)},"↑",8,ko),e.createElementVNode("button",{class:"qukt-mini-btn",disabled:g>=m.value.length-1,onClick:d=>y(g,1)},"↓",8,bo),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:d=>b(g)},"删",8,ho)])]),l.type==="row"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",go,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.cells,(d,O)=>(e.openBlock(),e.createElementBlock("div",{key:O,class:"qukt-cell-block"},[e.createElementVNode("div",Eo,[e.createElementVNode("strong",null,e.toDisplayString(O+1),1),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:u=>M(l,O)},"×",8,yo)]),e.createElementVNode("div",Vo,[i[7]||(i[7]=e.createElementVNode("label",null,"类型",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":u=>d.type=u,class:"qukt-cell-input small"},[...i[6]||(i[6]=[e.createElementVNode("option",{value:"field"},"字段(可编辑)",-1),e.createElementVNode("option",{value:"text"},"纯文本",-1)])],8,No),[[e.vModelSelect,d.type]])]),d.type==="field"?(e.openBlock(),e.createElementBlock("div",_o,[i[9]||(i[9]=e.createElementVNode("label",null,"标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":u=>d.label=u,class:"qukt-cell-input",placeholder:"标签"},null,8,qo),[[e.vModelText,d.label]]),e.createElementVNode("label",wo,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":u=>d.hideLabel=u},null,8,Bo),[[e.vModelCheckbox,d.hideLabel]]),i[8]||(i[8]=e.createTextVNode(" 隐藏 ",-1))])])):e.createCommentVNode("",!0),e.createElementVNode("div",xo,[i[10]||(i[10]=e.createElementVNode("label",null,"对外暴露",-1)),e.createElementVNode("input",{type:"checkbox",checked:d.bindEnabled,onChange:u=>F(d)},null,40,$o)]),d.bindEnabled?(e.openBlock(),e.createElementBlock("div",Co,[i[11]||(i[11]=e.createElementVNode("label",null,"字段名",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":u=>d.bindField=u,class:"qukt-cell-input",placeholder:"如 company_name"},null,8,So),[[e.vModelText,d.bindField]])])):e.createCommentVNode("",!0),d.bindEnabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[d.type==="field"?(e.openBlock(),e.createElementBlock("div",Do,[i[12]||(i[12]=e.createElementVNode("label",null,"值",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":u=>d.value=u,class:"qukt-cell-input",placeholder:"字段的值"},null,8,Fo),[[e.vModelText,d.value]])])):e.createCommentVNode("",!0),d.type==="text"?(e.openBlock(),e.createElementBlock("div",To,[i[13]||(i[13]=e.createElementVNode("label",null,"文字",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":u=>d.text=u,class:"qukt-cell-input"},null,8,Uo),[[e.vModelText,d.text]])])):e.createCommentVNode("",!0)],64)),e.createElementVNode("div",Mo,[i[14]||(i[14]=e.createElementVNode("label",null,"样式",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:u=>q(d.style,"cell")},"设置",8,zo)])]))),128))]),e.createElementVNode("button",{class:"qukt-btn qukt-btn-ghost",onClick:d=>D(l)},"+ 添加一个单元格",8,Lo)],64)):l.type==="text"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",Ao,[i[15]||(i[15]=e.createElementVNode("label",null,"标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d=>l.label=d,class:"qukt-cell-input",placeholder:"填写数据时用的提示"},null,8,Ro),[[e.vModelText,l.label]])]),e.createElementVNode("div",Oo,[i[16]||(i[16]=e.createElementVNode("label",null,"暴露",-1)),e.createElementVNode("input",{type:"checkbox",checked:l.bindEnabled,onChange:d=>z(l)},null,40,Io)]),l.bindEnabled?(e.openBlock(),e.createElementBlock("div",Wo,[i[17]||(i[17]=e.createElementVNode("label",null,"字段名",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d=>l.bindField=d,class:"qukt-cell-input",placeholder:"如 company_name"},null,8,Po),[[e.vModelText,l.bindField]])])):e.createCommentVNode("",!0),l.bindEnabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",jo,[i[18]||(i[18]=e.createElementVNode("label",null,"文字",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d=>l.text=d,class:"qukt-cell-input"},null,8,Xo),[[e.vModelText,l.text]])])),e.createElementVNode("div",Qo,[i[19]||(i[19]=e.createElementVNode("label",null,"样式",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:d=>q(l.style,"text")},"设置",8,Ho)])],64)):e.createCommentVNode("",!0)],2))),128))]),e.createElementVNode("div",Go,[e.createElementVNode("div",Yo,[i[20]||(i[20]=e.createElementVNode("div",{class:"qukt-preview-label"},"底部预览",-1)),e.createElementVNode("div",Jo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,(l,g)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:g},[l.type==="divider"?(e.openBlock(),e.createElementBlock("div",Zo)):l.type==="text"?(e.openBlock(),e.createElementBlock("div",{key:1,class:"qukt-p-text",style:e.normalizeStyle(e.unref(J)(l))},e.toDisplayString(l.bindEnabled?l.bindField||"待绑定":l.text||"纯文本"),5)):l.type==="row"?(e.openBlock(),e.createElementBlock("div",Ko,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.cells,(d,O)=>(e.openBlock(),e.createElementBlock("div",{key:O,class:"qukt-p-cell",style:e.normalizeStyle(e.unref(oe)(d))},[d.bindEnabled?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[d.type==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[d.label&&!d.hideLabel?(e.openBlock(),e.createElementBlock("span",vo,e.toDisplayString(d.label),1)):e.createCommentVNode("",!0),e.createElementVNode("span",en,e.toDisplayString(d.bindField||"待绑定"),1)],64)):(e.openBlock(),e.createElementBlock("span",tn,e.toDisplayString(d.bindField||"待绑定"),1))],64)):d.type==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[d.label&&!d.hideLabel?(e.openBlock(),e.createElementBlock("span",ln,e.toDisplayString(d.label),1)):e.createCommentVNode("",!0),e.createElementVNode("span",on,e.toDisplayString(d.value||"字段值"),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(d.text||"纯文本"),1)],64))],4))),128))])):e.createCommentVNode("",!0)],64))),128))])])])],2),e.createVNode(se,{visible:r.value,modelValue:V.value,showBorder:N.showBorder,showAlign:N.showAlign,showWidth:N.showWidth,title:N.title,"onUpdate:modelValue":i[3]||(i[3]=l=>Object.assign(V.value,l)),onClose:i[4]||(i[4]=l=>r.value=!1)},null,8,["visible","modelValue","showBorder","showAlign","showWidth","title"])]))}},an={class:"qukt-col-left"},sn={class:"qukt-sec-header"},rn={class:"qukt-sec-type"},dn={class:"qukt-sec-actions"},cn=["disabled","onClick"],mn=["disabled","onClick"],pn=["onClick"],un={class:"qukt-sec-row"},fn=["onUpdate:modelValue"],kn=["value"],bn={class:"qukt-sec-row"},hn=["onUpdate:modelValue"],gn={class:"qukt-sec-row"},En=["onUpdate:modelValue"],yn={class:"qukt-sec-row"},Vn=["onUpdate:modelValue"],Nn={class:"qukt-sec-row"},_n=["onUpdate:modelValue"],qn={key:0,class:"qukt-sec-row"},wn=["onUpdate:modelValue"],Bn={key:1,class:"qukt-sec-row"},xn=["onUpdate:modelValue"],$n={key:2,class:"qukt-sec-row"},Cn=["onUpdate:modelValue"],Sn={class:"qukt-sec-row"},Dn=["onClick"],Fn={key:0,class:"qukt-q-empty"},Tn={class:"qukt-col-right"},Un={class:"qukt-preview-box"},Mn={class:"qukt-preview-inner"},zn={key:0,class:"qukt-empty-hint"},Ln={key:1,class:"qukt-summary-preview"},An={class:"qukt-sp-label"},Rn={key:2,class:"qukt-preview-help"},On={__name:"DesignSummary",props:{fields:{type:Array,default:()=>[]},breakpoint:{type:Number,default:1100}},emits:["update:fields"],setup(n,{emit:o}){const t=Object.values(G),c=n,E=o,{isNarrow:m}=ae(c.breakpoint),r=e.ref([]);e.watch(()=>c.fields,i=>{const l=R(i||[]);de(l),!Y(l,r.value)&&(r.value=l)},{immediate:!0}),e.watch(r,i=>{const l=R(i);de(l),E("update:fields",l)},{deep:!0});function V(i){return r.value.indexOf(i)}const N=e.ref(!1),q=e.ref({});function s(i){q.value=i,N.value=!0}const b={group_total:1e4},y=e.computed(()=>{const i={...b};for(const l of r.value)P(l.type).hasDefault&&(i[l.field]=Number(l.default??0));for(const l of r.value)if(P(l.type).hasFormula&&l.formula)try{i[l.field]=H(l.formula,i)}catch{i[l.field]=0}return i});function D(i){return P(i).label}function M(i){const l=P(i.type);if(l.hasText)return i.text||"";let g;l.hasFormula?g=Number(y.value[i.field])||0:g=Number(i.default)||0;const d=Number.isInteger(g)?g:g.toFixed(2);return(i.prefix||"")+d+(i.suffix||"")}function z(){r.value.push(Je(G.AUTO_CALC.value))}function F(i){r.value.splice(i,1)}function f(i,l){const g=i+l;g<0||g>=r.value.length||([r.value[i],r.value[g]]=[r.value[g],r.value[i]])}return(i,l)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",{class:"qukt-toolbar"},[l[2]||(l[2]=e.createElementVNode("span",{class:"qukt-tip"},[e.createTextVNode("汇总区域每行显示一项,公式里可引用 "),e.createElementVNode("code",null,"group_total"),e.createTextVNode("、"),e.createElementVNode("code",null,"grand_total"),e.createTextVNode(" 以及其他汇总字段")],-1)),e.createElementVNode("button",{class:"qukt-btn",onClick:z},"+ 添加字段")]),e.createElementVNode("div",{class:e.normalizeClass(["qukt-two-col",{"is-narrow":e.unref(m)}])},[e.createElementVNode("div",an,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,g=>(e.openBlock(),e.createElementBlock("div",{key:g.field,class:"qukt-sec-block"},[e.createElementVNode("div",sn,[e.createElementVNode("span",rn,e.toDisplayString(D(g.type)),1),e.createElementVNode("div",dn,[e.createElementVNode("button",{class:"qukt-mini-btn",disabled:V(g)===0,onClick:d=>f(V(g),-1)},"↑",8,cn),e.createElementVNode("button",{class:"qukt-mini-btn",disabled:V(g)>=r.value.length-1,onClick:d=>f(V(g),1)},"↓",8,mn),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:d=>F(V(g))},"删",8,pn)])]),e.createElementVNode("div",un,[l[3]||(l[3]=e.createElementVNode("label",null,"类型",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":d=>g.type=d,class:"qukt-cell-input"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(t),d=>(e.openBlock(),e.createElementBlock("option",{key:d.value,value:d.value},e.toDisplayString(d.label),9,kn))),128))],8,fn),[[e.vModelSelect,g.type]])]),e.createElementVNode("div",bn,[l[4]||(l[4]=e.createElementVNode("label",null,"标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d=>g.label=d,class:"qukt-cell-input",placeholder:"如 合计、税后、业务员抽成"},null,8,hn),[[e.vModelText,g.label]])]),e.createElementVNode("div",gn,[l[5]||(l[5]=e.createElementVNode("label",null,"字段名",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d=>g.field=d,class:"qukt-cell-input",placeholder:"如 subtotal、tax (其他行公式可引用)"},null,8,En),[[e.vModelText,g.field]])]),e.createElementVNode("div",yn,[l[6]||(l[6]=e.createElementVNode("label",null,"前缀",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d=>g.prefix=d,class:"qukt-cell-input",placeholder:"如 ¥、¥"},null,8,Vn),[[e.vModelText,g.prefix]])]),e.createElementVNode("div",Nn,[l[7]||(l[7]=e.createElementVNode("label",null,"后缀",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d=>g.suffix=d,class:"qukt-cell-input",placeholder:"如 %"},null,8,_n),[[e.vModelText,g.suffix]])]),e.unref(P)(g.type).hasFormula?(e.openBlock(),e.createElementBlock("div",qn,[l[8]||(l[8]=e.createElementVNode("label",null,"公式",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d=>g.formula=d,class:"qukt-cell-input",placeholder:"如 group_total * 0.01 + group_total"},null,8,wn),[[e.vModelText,g.formula]])])):e.unref(P)(g.type).hasDefault?(e.openBlock(),e.createElementBlock("div",Bn,[l[9]||(l[9]=e.createElementVNode("label",null,"默认值",-1)),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":d=>g.default=d,class:"qukt-cell-input",placeholder:"默认值"},null,8,xn),[[e.vModelText,g.default,void 0,{number:!0}]])])):e.unref(P)(g.type).hasText?(e.openBlock(),e.createElementBlock("div",$n,[l[10]||(l[10]=e.createElementVNode("label",null,"显示文本",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d=>g.text=d,class:"qukt-cell-input",placeholder:"显示文本"},null,8,Cn),[[e.vModelText,g.text]])])):e.createCommentVNode("",!0),e.createElementVNode("div",Sn,[l[11]||(l[11]=e.createElementVNode("label",null,"样式",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:d=>s(g.style)},"设置",8,Dn)])]))),128)),r.value.length===0?(e.openBlock(),e.createElementBlock("div",Fn,"还没有汇总行,点上方按钮添加")):e.createCommentVNode("",!0)]),e.createElementVNode("div",Tn,[e.createElementVNode("div",Un,[l[13]||(l[13]=e.createElementVNode("div",{class:"qukt-preview-label"},"汇总预览",-1)),e.createElementVNode("div",Mn,[r.value.length===0?(e.openBlock(),e.createElementBlock("div",zn,"暂无汇总字段")):(e.openBlock(),e.createElementBlock("div",Ln,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,g=>(e.openBlock(),e.createElementBlock("div",{key:g.field,class:"qukt-sp-row"},[e.createElementVNode("span",An,e.toDisplayString(g.label||"标签"),1),e.createElementVNode("span",{class:"qukt-sp-value",style:e.normalizeStyle(e.unref(Se)(g))},e.toDisplayString(M(g)),5)]))),128))])),r.value.length>0?(e.openBlock(),e.createElementBlock("div",Rn,[...l[12]||(l[12]=[e.createElementVNode("b",null,"系统变量:",-1),e.createElementVNode("code",null,"group_total",-1),e.createTextVNode("(明细小计合计)、 ",-1),e.createElementVNode("code",null,"grand_total",-1),e.createTextVNode("(报价总额) ",-1)])])):e.createCommentVNode("",!0)])])])],2),e.createVNode(se,{visible:N.value,modelValue:q.value,showBorder:!1,showAlign:!1,showWidth:!1,title:"汇总值样式","onUpdate:modelValue":l[0]||(l[0]=g=>Object.assign(q.value,g)),onClose:l[1]||(l[1]=g=>N.value=!1)},null,8,["visible","modelValue"])]))}},In={class:"qukt-help-dialog"},Wn={class:"qukt-help-header"},Pn={__name:"HelpModal",props:{visible:{type:Boolean,default:!1}},emits:["close"],setup(n){return(o,t)=>n.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qukt-help-modal",onClick:t[1]||(t[1]=e.withModifiers(c=>o.$emit("close"),["self"]))},[e.createElementVNode("div",In,[e.createElementVNode("div",Wn,[t[2]||(t[2]=e.createElementVNode("h3",null,"📖 报价单生成器 — 使用教程",-1)),e.createElementVNode("button",{class:"qukt-close-btn",onClick:t[0]||(t[0]=c=>o.$emit("close"))},"✕")]),t[3]||(t[3]=e.createStaticVNode(`<div class="qukt-help-body"><section class="qukt-help-section"><h4>🔁 整体三步流程</h4><p>顶部导航栏有三个步骤,按顺序操作即可生成一份完整报价单:</p><ol class="qukt-steps"><li><b>① 设计模板</b> — 定义表头列、页面头部信息、汇总区域、底部签字栏等</li><li><b>② 填写数据</b> — 根据模板录入每条明细,自动分组、自动算小计</li><li><b>③ 预览导出</b> — 查看最终效果,一键导出 Excel 或打印</li></ol><p class="qukt-tip-box">💡 也可以从第 ② 步开始,系统已内置 3 个示例模板可直接使用</p></section><section class="qukt-help-section"><h4>① 表头列 — 定义表格里有哪些列</h4><p>点击顶部工具栏的 <b>+ 添加字段</b> 按钮可以新增一列,然后在表格中把「类型」改成你想要的:</p><table class="qukt-help-table"><thead><tr><th>按钮</th><th>字段类型</th><th>说明</th></tr></thead><tbody><tr><td>文本列</td><td>INPUT</td><td>普通文字输入,用于名称、描述等</td></tr><tr><td>数字列</td><td>NUMBER</td><td>只能填数字,用于数量、单价等</td></tr><tr><td>下拉列</td><td>SELECT_DICT</td><td>固定选项,点击列中的"下拉选项"输入选项,用逗号分隔,如 <code>设备,材料,安装</code></td></tr><tr><td>多行文本列</td><td>TEXTAREA</td><td>可输入较长文字,用于备注、说明等</td></tr></tbody></table><p><b>特殊类型列:</b></p><ul><li><b>自动序号</b> — 自动从 1 开始递增,字段名随便改(建议叫 <code>seq</code>)</li><li><b>自动计算(公式)</b> — 用任意公式算值,公式里可引用<b>同一行其他列的字段名</b>,如 <code>quantity * unit_price</code>。字段名必须和你在表头里设置的一致,比如数量列叫 <code>qty</code> 就要写 <code>qty * unit_price</code></li></ul><p><b>列顺序:</b>点行末的 ↑ ↓ 按钮上下移动,或拖动行来调整</p><p><b>列宽度:</b>单位是像素(px),在"宽度"列填数字</p><p class="qukt-tip-box">💡 下拉列的选项是写在逗号分隔的输入框里,保存后切换到「填写数据」页面时会变成下拉选择框</p></section><section class="qukt-help-section"><h4>② 页面头部 — 报价单的标题和项目信息</h4><p>头部由多个"段落"顺序组成,每个段落可以是以下 4 种类型:</p><table class="qukt-help-table"><thead><tr><th>类型</th><th>说明</th><th>配置项</th></tr></thead><tbody><tr><td><b>大标题</b></td><td>最顶部的报价单标题</td><td>文字、字号、粗体、对齐方式</td></tr><tr><td><b>字段行</b></td><td>一行可以放多个单元格,每个单元格要么是可编辑字段,要么是固定文字</td><td>每个单元格单独配置</td></tr><tr><td><b>分隔线</b></td><td>画一条灰色横线</td><td>无配置</td></tr><tr><td><b>纯文本</b></td><td>一段固定文字,如"此报价单有效期30天"</td><td>文字内容、对齐方式</td></tr></tbody></table><p><b>字段行详解:</b></p><ul><li>点"➕ 添加一个单元格"来增加这一行里的格子数量</li><li>每个格子选"类型":<b>字段(可编辑)</b> 或 <b>纯文本</b></li><li>字段类型要填 <b>标签</b>(如"项目名称")和 <b>绑定字段</b>(如 <code>projectName</code>)</li><li>绑定字段是关键!同一个绑定字段名在整个模板中要保持一致,后续数据填写和导出都靠它</li><li>宽度用百分比,如 <code>50%</code>、<code>33%</code>,一行所有格子宽度加起来建议 = 100%</li></ul><p class="qukt-tip-box">💡 右侧"实时预览"区域会随着你的编辑即时变化,所见即所得</p></section><section class="qukt-help-section"><h4>③ 汇总区域 — 表格底部的费用合计</h4><p>汇总项显示在明细表格的下方(导出 Excel 时会自动排在表格右侧底部)。</p><table class="qukt-help-table"><thead><tr><th>类型</th><th>说明</th></tr></thead><tbody><tr><td><b>手动输入(自定义金额)</b></td><td>任意需要手工填写的金额项:人工费、服务费、运费、税费、折扣、其他费用等。可以在"默认值"里预设一个初始值</td></tr><tr><td><b>自动计算(公式)</b></td><td>系统自动算好的值,需要写公式。<code>grand_total</code> 会自动把所有手动输入项加进去</td></tr></tbody></table><p><b>自动计算公式里的可用变量(固定):</b></p><table class="qukt-help-table"><thead><tr><th>变量名</th><th>含义</th><th>说明</th></tr></thead><tbody><tr><td><code>group_total</code></td><td>明细小计合计</td><td>所有行的自动计算列(小计列)求和</td></tr><tr><td><code>grand_total</code></td><td>报价总额</td><td>group_total + 所有手动输入项之和</td></tr></tbody></table><p><b>动态可用变量(随你的模板定义):</b></p><p>你在汇总区域里定义的<b>每一个手动输入项的字段名</b>,都会自动成为可用变量,它们之间也能互相引用。</p><p>举个例子:如果你定义了 <code>labor_cost</code>、<code>service_fee</code>、<code>discount</code> 三个手动项,那么自动计算公式里可以写:</p><pre class="code">group_total + labor_cost + service_fee - discount</pre><p><b>字段名命名建议:</b></p><ul><li><code>grand_total</code> — 报价总额(特殊字段,系统会把所有手动项加进去)</li><li><code>group_total</code> — 明细小计(建议不要手动改成别的,公式里会用到)</li><li>其他手动项随意,如 <code>service_fee</code>、<code>freight</code>、<code>tax_amount</code>、<code>discount</code> 等</li></ul></section><section class="qukt-help-section"><h4>④ 页面底部 — 签字栏、盖章区</h4><p>结构和"页面头部"完全一样,支持:分隔线、字段行、纯文本。</p><p>常见用法:</p><ul><li>分隔线 → 分隔表格和签字区</li><li>字段行 → 左边"客户签字:________",右边"业务员签字:________"</li><li>纯文本 → 居中写"公司盖章:"</li></ul></section><section class="qukt-help-section"><h4>💾 保存与模板管理</h4><ul><li><b>💾 保存修改</b> — 直接更新当前选中的模板</li><li><b>➕ 另存为新模板</b> — 输入一个新名字,基于当前模板复制出一个全新的模板</li><li>顶部的下拉框可以在已有的模板之间切换,切换后下方所有配置会自动加载</li></ul><p class="qukt-tip-box">⚠️ 目前模板数据保存在浏览器内存中(刷新后会恢复默认),如果要持久化存储,需要把模板同步到后端接口</p></section><section class="qukt-help-section"><h4>🔢 分组与计算规则(高级)</h4><p>在「表头列」tab 的列表下方,有一个<b>分组规则</b>配置框:</p><ul><li><b>按哪一列分组</b> — 选择一列后,相同值的行会自动合并单元格,每组末尾自动生成小计行。选「不分组」则不分组、不显示小计,但列上勾选了「相同值合并」的列仍然会对相邻相同值做合并</li></ul><p>对应模板数据结构:</p><pre class="code">{
|
|
13
13
|
group_rules: { merge_field: 'system_name' },
|
|
14
14
|
// 不分组时 group_rules 为 null 或 { merge_field: '' }
|
|
15
|
-
}</pre><p>例如模板 TPL-001 按 <code>system_name</code>(系统名称)分组,相同系统名称的多条明细会自动合并成一个单元格,每组末尾自动生成小计行。</p></section><section class="qukt-help-section"><h4>📝 切换到「填写数据」</h4><p>模板设计好后,点顶部的"下一步"进入填写数据页面,注意:</p><ul><li>点 ➕ 添加新条目,会弹出表单,表单字段完全根据你的模板表头列生成</li><li>分组字段(如 <code>system_name</code>)会自动继承上一行的值,让同组合并不间断</li><li>右侧"实时汇总"卡片会根据汇总区域配置动态显示</li></ul></section><section class="qukt-help-section qukt-tip-box final-tip"> 🎯 <b>推荐操作顺序:</b>选一个最接近的示例模板 → 点"另存为新模板"复制一份 → 按需要改表头列 / 头部信息 / 汇总项 → 保存 → 下一步填写数据 → 导出 Excel </section></div>`,1))])])):e.createCommentVNode("",!0)}},An={class:"qukt-designer"},Fn={class:"qukt-tabs"},Ln={key:0,class:"qukt-tab-content"},zn={key:1,class:"qukt-tab-content"},On={key:2,class:"qukt-tab-content"},Rn={key:3,class:"qukt-tab-content"},In={key:4,class:"qukt-tab-content qukt-tab-content-preview"},Pn={__name:"QuokitTemplate",props:{tpl:{type:Object,default:Z},breakpoint:{type:Number,default:1100}},emits:["update:tpl"],setup(s,{expose:o,emit:i}){const m=s,f=i,k=e.ref("cols"),y=e.ref(!1),_=e.ref(!1),$=re([],{}),d=J([]),t=J([]),n=pe([]);let p=!1;e.watch(()=>m.tpl,()=>{if(p)return;p=!0;const w=m.tpl||{};$.setColumns(w.columns||[]),$.setGroupRules(w.group_rules||{}),d.setSections(w.header_sections||[]),t.setSections(w.footer_sections||[]),n.setFields(w.summary_fields||[])},{immediate:!0});const l=Fe(w=>{f("update:tpl",w)},200),B=e.computed(()=>({...$.tpl,header_sections:d.toTpl(),footer_sections:t.toTpl(),summary_fields:n.toTpl()}));e.watch(B,()=>{if(p){p=!1;return}l(B.value)},{deep:!0}),e.onBeforeUnmount(()=>{l.cancel()});const r=e.computed(()=>B.value),S=e.computed(()=>ue($.tpl.columns,3));return o({getTemplateJSON(){return B.value},showHelp(){y.value=!0}}),(w,N)=>(e.openBlock(),e.createElementBlock("div",An,[e.createElementVNode("div",Fn,[e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:k.value==="cols"}]),onClick:N[0]||(N[0]=U=>k.value="cols")},"① 表头列",2),e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:k.value==="header"}]),onClick:N[1]||(N[1]=U=>k.value="header")},"② 页面头部",2),e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:k.value==="summary"}]),onClick:N[2]||(N[2]=U=>k.value="summary")},"③ 汇总区域",2),e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:k.value==="footer"}]),onClick:N[3]||(N[3]=U=>k.value="footer")},"④ 页面底部",2),e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:k.value==="preview"}]),onClick:N[4]||(N[4]=U=>k.value="preview")},"⑤ 总体预览",2)]),k.value==="cols"?(e.openBlock(),e.createElementBlock("div",Ln,[e.createVNode(dt,{columns:e.unref($).columns,"group-rules":e.unref($).groupRules,breakpoint:s.breakpoint,onHelp:N[5]||(N[5]=U=>y.value=!0),onOpenGroup:N[6]||(N[6]=U=>_.value=!0)},null,8,["columns","group-rules","breakpoint"])])):e.createCommentVNode("",!0),k.value==="header"?(e.openBlock(),e.createElementBlock("div",zn,[e.createVNode(Ml,{sections:e.unref(d).sections,breakpoint:s.breakpoint},null,8,["sections","breakpoint"])])):e.createCommentVNode("",!0),k.value==="summary"?(e.openBlock(),e.createElementBlock("div",On,[e.createVNode(Sn,{fields:e.unref(n).fields,breakpoint:s.breakpoint},null,8,["fields","breakpoint"])])):e.createCommentVNode("",!0),k.value==="footer"?(e.openBlock(),e.createElementBlock("div",Rn,[e.createVNode(Qo,{sections:e.unref(t).sections,breakpoint:s.breakpoint},null,8,["sections","breakpoint"])])):e.createCommentVNode("",!0),k.value==="preview"?(e.openBlock(),e.createElementBlock("div",In,[e.createVNode(ie,{tpl:r.value,data:S.value},null,8,["tpl","data"])])):e.createCommentVNode("",!0),e.createVNode(Mn,{visible:y.value,onClose:N[7]||(N[7]=U=>y.value=!1)},null,8,["visible"]),e.createVNode(Vt,{visible:_.value,columns:e.unref($).columns,"group-rules":e.unref($).groupRules,onClose:N[8]||(N[8]=U=>_.value=!1)},null,8,["visible","columns","group-rules"])]))}},jn={class:"qukt-page"},Wn={key:0,class:"qukt-empty-tip"},Qn={key:1,class:"qukt-data-table"},Xn={class:"qukt-main-table"},Hn=["onClick"],Gn={key:1,class:"qukt-subtotal"},Zn=["onClick"],Jn=["onClick"],Yn={class:"qukt-de-dialog"},Kn={class:"qukt-de-header"},vn={class:"qukt-de-content"},ei={class:"qukt-form-grid"},ti={class:"qukt-form-cell-label"},li=["onUpdate:modelValue","placeholder"],oi=["step","min","max","onUpdate:modelValue"],ni=["onUpdate:modelValue","placeholder"],ii=["onUpdate:modelValue"],si=["value"],ri={class:"qukt-de-footer"},di={__name:"QuokitData",props:{tpl:{type:Object,default:Z},data:{type:Array,default:()=>[]}},emits:["update:data"],setup(s,{emit:o}){const i=s,m=o,f=e.computed(()=>i.data||[]),k=e.computed(()=>{var S;return((S=i.tpl)==null?void 0:S.columns)||[]}),y=e.computed(()=>k.value.filter(S=>S.editor!=="AUTO_SEQ"&&S.editor!=="AUTO_CALC")),_=e.ref(!1),$=e.ref("add"),d=e.ref(-1),t=e.ref({});function n(){const S={};for(const w of y.value)w.editor==="NUMBER"?S[w.field]=w.default??w.min??0:S[w.field]=w.default??"";return S}function p(){$.value="add",d.value=-1,t.value=n(),_.value=!0}function l(S){$.value="edit",d.value=S,t.value={...f.value[S]},_.value=!0}function B(S){if(!confirm("确定删除这条明细?"))return;const w=[...f.value];w.splice(S,1),m("update:data",w)}function r(){if($.value==="edit"){const S=[...f.value];S[d.value]={...t.value},m("update:data",S)}else m("update:data",[...f.value,{...t.value}]);_.value=!1}return(S,w)=>(e.openBlock(),e.createElementBlock("div",jn,[e.createElementVNode("div",{class:"qukt-toolbar"},[w[4]||(w[4]=e.createElementVNode("span",{class:"qukt-tip"},"点击行可快速编辑,预估总价会自动计算",-1)),e.createElementVNode("div",{class:"qukt-btn-group-inline"},[e.createElementVNode("button",{class:"qukt-btn",onClick:p},"+ 添加新条目")])]),f.value.length===0?(e.openBlock(),e.createElementBlock("div",Wn,[...w[5]||(w[5]=[e.createElementVNode("div",{class:"qukt-empty-icon"},"📋",-1),e.createElementVNode("div",{class:"qukt-empty-text"},"暂无数据,点击下方按钮添加第一条明细",-1)])])):e.createCommentVNode("",!0),f.value.length>0?(e.openBlock(),e.createElementBlock("div",Qn,[e.createElementVNode("table",Xn,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.value,N=>(e.openBlock(),e.createElementBlock("th",{key:N.field,style:e.normalizeStyle({width:N.width+"px"})},e.toDisplayString(N.title),5))),128)),w[6]||(w[6]=e.createElementVNode("th",{width:"140"},"操作",-1))])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,(N,U)=>(e.openBlock(),e.createElementBlock("tr",{key:U,onClick:L=>l(U)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.value,L=>(e.openBlock(),e.createElementBlock("td",{key:L.field},[L.editor==="AUTO_SEQ"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(U+1),1)],64)):L.editor==="AUTO_CALC"?(e.openBlock(),e.createElementBlock("span",Gn,"¥ "+e.toDisplayString(e.unref(I)(L.formula||"0",N).toFixed(2)),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(N[L.field]),1)],64))]))),128)),e.createElementVNode("td",{class:"qukt-op-cell",onClick:w[0]||(w[0]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("button",{class:"qukt-row-btn",onClick:L=>l(U)},"编辑",8,Zn),e.createElementVNode("button",{class:"qukt-row-btn danger",onClick:L=>B(U)},"删除",8,Jn)])],8,Hn))),128))])])])):e.createCommentVNode("",!0),_.value?(e.openBlock(),e.createElementBlock("div",{key:2,class:"qukt-de-mask",onClick:w[3]||(w[3]=e.withModifiers(N=>_.value=!1,["self"]))},[e.createElementVNode("div",Yn,[e.createElementVNode("div",Kn,[e.createElementVNode("span",null,e.toDisplayString($.value==="edit"?"编辑明细":"添加明细"),1),e.createElementVNode("button",{class:"qukt-de-close",onClick:w[1]||(w[1]=N=>_.value=!1)},"✕")]),e.createElementVNode("div",vn,[e.createElementVNode("div",ei,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,N=>(e.openBlock(),e.createElementBlock("div",{key:N.field,class:e.normalizeClass(["qukt-form-cell",{full:N.editor==="TEXTAREA"}])},[e.createElementVNode("label",ti,e.toDisplayString(N.title),1),N.editor==="INPUT"||N.editor===void 0?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,class:"qukt-cell-input","onUpdate:modelValue":U=>t.value[N.field]=U,placeholder:N.title},null,8,li)),[[e.vModelText,t.value[N.field]]]):N.editor==="NUMBER"?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:1,class:"qukt-cell-input",type:"number",step:N.step??(N.min??0)<1?"0.01":"1",min:N.min,max:N.max,"onUpdate:modelValue":U=>t.value[N.field]=U},null,8,oi)),[[e.vModelText,t.value[N.field],void 0,{number:!0}]]):N.editor==="TEXTAREA"?e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{key:2,class:"qukt-cell-input",rows:"3","onUpdate:modelValue":U=>t.value[N.field]=U,placeholder:N.title},null,8,ni)),[[e.vModelText,t.value[N.field]]]):N.editor==="SELECT_DICT"?e.withDirectives((e.openBlock(),e.createElementBlock("select",{key:3,class:"qukt-cell-input","onUpdate:modelValue":U=>t.value[N.field]=U},[w[7]||(w[7]=e.createElementVNode("option",{value:""},"-- 请选择 --",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.dict||[],U=>(e.openBlock(),e.createElementBlock("option",{key:U,value:U},e.toDisplayString(U),9,si))),128))],8,ii)),[[e.vModelSelect,t.value[N.field]]]):e.createCommentVNode("",!0)],2))),128))])]),e.createElementVNode("div",ri,[e.createElementVNode("button",{class:"qukt-btn",onClick:w[2]||(w[2]=N=>_.value=!1)},"取消"),e.createElementVNode("button",{class:"qukt-btn qukt-btn-primary",onClick:r},"确定")])])])):e.createCommentVNode("",!0)]))}};A.QuokitData=di,A.QuokitSheet=ie,A.QuokitTemplate=Pn,A.generateMockRows=ue,A.useColumns=re,A.useSections=J,A.useSummary=pe,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
|
|
15
|
+
}</pre><p>例如模板 TPL-001 按 <code>system_name</code>(系统名称)分组,相同系统名称的多条明细会自动合并成一个单元格,每组末尾自动生成小计行。</p></section><section class="qukt-help-section"><h4>📝 切换到「填写数据」</h4><p>模板设计好后,点顶部的"下一步"进入填写数据页面,注意:</p><ul><li>点 ➕ 添加新条目,会弹出表单,表单字段完全根据你的模板表头列生成</li><li>分组字段(如 <code>system_name</code>)会自动继承上一行的值,让同组合并不间断</li><li>右侧"实时汇总"卡片会根据汇总区域配置动态显示</li></ul></section><section class="qukt-help-section qukt-tip-box final-tip"> 🎯 <b>推荐操作顺序:</b>选一个最接近的示例模板 → 点"另存为新模板"复制一份 → 按需要改表头列 / 头部信息 / 汇总项 → 保存 → 下一步填写数据 → 导出 Excel </section></div>`,1))])])):e.createCommentVNode("",!0)}},jn={class:"qukt-designer"},Xn={class:"qukt-tabs"},Qn={key:0,class:"qukt-tab-content"},Hn={key:1,class:"qukt-tab-content"},Gn={key:2,class:"qukt-tab-content"},Yn={key:3,class:"qukt-tab-content"},Jn={key:4,class:"qukt-tab-content qukt-tab-content-preview"},Zn={__name:"QuokitTemplate",props:{tpl:{type:Object,default:ce},breakpoint:{type:Number,default:1100}},emits:["update:tpl"],setup(n,{expose:o,emit:t}){const c=n,E=t,m=e.ref("cols"),r=e.ref(!1),V=e.ref(!1),N=Le([],{}),q=me([]),s=me([]),b=Ae([]);let y="";const D=e.computed(()=>ie({columns:N.tpl.columns,group_rules:N.tpl.group_rules,header_sections:q.toTpl(),footer_sections:s.toTpl(),summary_fields:b.toTpl()}));e.watch(()=>c.tpl,()=>{const f=ie(c.tpl);Y(f,D.value)||(N.setColumns(c.tpl.columns),N.setGroupRules(c.tpl.group_rules),q.setSections(c.tpl.header_sections),s.setSections(c.tpl.footer_sections),b.setFields(c.tpl.summary_fields))},{immediate:!0});const M=je(f=>{E("update:tpl",f)},200);e.watch(D,()=>{const f=JSON.stringify(D.value);f!==y&&(y=f,M(D.value))},{deep:!0}),e.onMounted(()=>{E("update:tpl",D.value)}),e.onBeforeUnmount(()=>{M.cancel()});const z=e.computed(()=>D.value),F=e.computed(()=>Re(N.tpl.columns,3));return o({getTemplateJSON(){return D.value},showHelp(){r.value=!0}}),(f,i)=>(e.openBlock(),e.createElementBlock("div",jn,[e.createElementVNode("div",Xn,[e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:m.value==="cols"}]),onClick:i[0]||(i[0]=l=>m.value="cols")},"① 表头列",2),e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:m.value==="header"}]),onClick:i[1]||(i[1]=l=>m.value="header")},"② 页面头部",2),e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:m.value==="summary"}]),onClick:i[2]||(i[2]=l=>m.value="summary")},"③ 汇总区域",2),e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:m.value==="footer"}]),onClick:i[3]||(i[3]=l=>m.value="footer")},"④ 页面底部",2),e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:m.value==="preview"}]),onClick:i[4]||(i[4]=l=>m.value="preview")},"⑤ 总体预览",2)]),m.value==="cols"?(e.openBlock(),e.createElementBlock("div",Qn,[e.createVNode(ll,{columns:e.unref(N).columns,"onUpdate:columns":i[5]||(i[5]=l=>e.unref(N).columns=l),"group-rules":e.unref(N).groupRules,"onUpdate:groupRules":i[6]||(i[6]=l=>e.unref(N).groupRules=l),breakpoint:n.breakpoint,onHelp:i[7]||(i[7]=l=>r.value=!0),onOpenGroup:i[8]||(i[8]=l=>V.value=!0)},null,8,["columns","group-rules","breakpoint"])])):e.createCommentVNode("",!0),m.value==="header"?(e.openBlock(),e.createElementBlock("div",Hn,[e.createVNode(ro,{sections:e.unref(q).sections,"onUpdate:sections":i[9]||(i[9]=l=>e.unref(q).sections=l),breakpoint:n.breakpoint},null,8,["sections","breakpoint"])])):e.createCommentVNode("",!0),m.value==="summary"?(e.openBlock(),e.createElementBlock("div",Gn,[e.createVNode(On,{fields:e.unref(b).fields,"onUpdate:fields":i[10]||(i[10]=l=>e.unref(b).fields=l),breakpoint:n.breakpoint},null,8,["fields","breakpoint"])])):e.createCommentVNode("",!0),m.value==="footer"?(e.openBlock(),e.createElementBlock("div",Yn,[e.createVNode(nn,{sections:e.unref(s).sections,"onUpdate:sections":i[11]||(i[11]=l=>e.unref(s).sections=l),breakpoint:n.breakpoint},null,8,["sections","breakpoint"])])):e.createCommentVNode("",!0),m.value==="preview"?(e.openBlock(),e.createElementBlock("div",Jn,[e.createVNode(ze,{tpl:z.value,data:F.value},null,8,["tpl","data"])])):e.createCommentVNode("",!0),e.createVNode(Pn,{visible:r.value,onClose:i[12]||(i[12]=l=>r.value=!1)},null,8,["visible"]),e.createVNode(ul,{visible:V.value,columns:e.unref(N).columns,"group-rules":e.unref(N).groupRules,"onUpdate:groupRules":i[13]||(i[13]=l=>e.unref(N).groupRules=l),onClose:i[14]||(i[14]=l=>V.value=!1)},null,8,["visible","columns","group-rules"])]))}},Kn={class:"qukt-page"},vn={key:0,class:"qukt-bind-section"},ei={class:"qukt-bind-grid"},ti={class:"qukt-bind-label"},li=["value","onInput","placeholder"],oi={key:1,class:"qukt-bind-section"},ni={class:"qukt-bind-grid"},ii={class:"qukt-bind-label"},ai=["value","onInput","placeholder"],si={key:2,class:"qukt-empty-tip"},ri={key:3,class:"qukt-data-table"},di={class:"qukt-main-table"},ci=["onClick"],mi={key:1,class:"qukt-subtotal"},pi=["onClick"],ui=["onClick"],fi={class:"qukt-de-dialog"},ki={class:"qukt-de-header"},bi={class:"qukt-de-content"},hi={class:"qukt-form-grid"},gi={class:"qukt-form-cell-label"},Ei=["onUpdate:modelValue","placeholder"],yi=["step","min","max","onUpdate:modelValue"],Vi=["onUpdate:modelValue","placeholder"],Ni=["onUpdate:modelValue"],_i=["value"],qi={class:"qukt-de-footer"},wi={__name:"QuokitData",props:{tpl:{type:Object,default:ce},data:{type:Object,default:()=>({headerData:{},rows:[],footerData:{}})}},emits:["update:data"],setup(n,{emit:o}){const t=n,c=o;function E(h){const a=h||{},p=!("headerData"in a)||!("rows"in a)||!("footerData"in a);return{next:{headerData:a.headerData||{},rows:a.rows||[],footerData:a.footerData||{}},changed:p}}e.watch(()=>t.data,h=>{const{next:a,changed:p}=E(h);p&&c("update:data",a)},{immediate:!0}),e.onMounted(()=>{c("update:data",E(t.data).next)});const m=e.computed(()=>ie(t.tpl)),r=e.computed(()=>Te(m.value.header_sections)),V=e.computed(()=>Te(m.value.footer_sections)),N=e.computed({get:()=>{var h;return((h=t.data)==null?void 0:h.headerData)||{}},set:h=>c("update:data",{...t.data,headerData:h})}),q=e.computed({get:()=>{var h;return((h=t.data)==null?void 0:h.footerData)||{}},set:h=>c("update:data",{...t.data,footerData:h})}),s=e.computed(()=>{var h;return((h=t.data)==null?void 0:h.rows)||[]}),b=e.computed(()=>m.value.columns),y=e.computed(()=>b.value.filter(h=>W(h.editor).editable)),D=e.ref(!1),M=e.ref("add"),z=e.ref(-1),F=e.ref({});function f(){const h={};for(const a of y.value)a.editor===I.NUMBER.value?h[a.field]=a.default??a.min??0:h[a.field]=a.default??"";return h}function i(h,a){var p;c("update:data",{...t.data,headerData:{...((p=t.data)==null?void 0:p.headerData)||{},[h]:a}})}function l(h,a){var p;c("update:data",{...t.data,footerData:{...((p=t.data)==null?void 0:p.footerData)||{},[h]:a}})}function g(){M.value="add",z.value=-1,F.value=f(),D.value=!0}function d(h){M.value="edit",z.value=h,F.value={...s.value[h]},D.value=!0}function O(h){if(!confirm("确定删除这条明细?"))return;const a=[...s.value];a.splice(h,1),c("update:data",{...t.data,rows:a})}function u(){if(M.value==="edit"){const h=[...s.value];h[z.value]={...F.value},c("update:data",{...t.data,rows:h})}else c("update:data",{...t.data,rows:[...s.value,{...F.value}]});D.value=!1}return(h,a)=>(e.openBlock(),e.createElementBlock("div",Kn,[e.createElementVNode("div",{class:"qukt-toolbar"},[a[4]||(a[4]=e.createElementVNode("span",{class:"qukt-tip"},"点击行可快速编辑,预估总价会自动计算",-1)),e.createElementVNode("div",{class:"qukt-btn-group-inline"},[e.createElementVNode("button",{class:"qukt-btn",onClick:g},"+ 添加新条目")])]),r.value.length>0?(e.openBlock(),e.createElementBlock("div",vn,[a[5]||(a[5]=e.createElementVNode("div",{class:"qukt-bind-title"},"📌 头部信息",-1)),e.createElementVNode("div",ei,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,p=>(e.openBlock(),e.createElementBlock("div",{key:"h-"+p.field,class:"qukt-bind-item"},[e.createElementVNode("label",ti,e.toDisplayString(p.label||p.field),1),e.createElementVNode("input",{class:"qukt-cell-input",value:N.value[p.field]??"",onInput:k=>i(p.field,k.target.value),placeholder:"请输入"+(p.label||p.field)},null,40,li)]))),128))])])):e.createCommentVNode("",!0),V.value.length>0?(e.openBlock(),e.createElementBlock("div",oi,[a[6]||(a[6]=e.createElementVNode("div",{class:"qukt-bind-title"},"📌 底部信息",-1)),e.createElementVNode("div",ni,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V.value,p=>(e.openBlock(),e.createElementBlock("div",{key:"f-"+p.field,class:"qukt-bind-item"},[e.createElementVNode("label",ii,e.toDisplayString(p.label||p.field),1),e.createElementVNode("input",{class:"qukt-cell-input",value:q.value[p.field]??"",onInput:k=>l(p.field,k.target.value),placeholder:"请输入"+(p.label||p.field)},null,40,ai)]))),128))])])):e.createCommentVNode("",!0),s.value.length===0?(e.openBlock(),e.createElementBlock("div",si,[...a[7]||(a[7]=[e.createElementVNode("div",{class:"qukt-empty-icon"},"📋",-1),e.createElementVNode("div",{class:"qukt-empty-text"},"暂无数据,点击下方按钮添加第一条明细",-1)])])):e.createCommentVNode("",!0),s.value.length>0?(e.openBlock(),e.createElementBlock("div",ri,[e.createElementVNode("table",di,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.value,p=>(e.openBlock(),e.createElementBlock("th",{key:p.field,style:e.normalizeStyle({width:p.width+"px"})},e.toDisplayString(p.title),5))),128)),a[8]||(a[8]=e.createElementVNode("th",{width:"140"},"操作",-1))])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(p,k)=>(e.openBlock(),e.createElementBlock("tr",{key:k,onClick:_=>d(k)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.value,_=>(e.openBlock(),e.createElementBlock("td",{key:_.field},[_.editor===e.unref(I).AUTO_SEQ.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(k+1),1)],64)):e.unref(W)(_.editor).hasFormula?(e.openBlock(),e.createElementBlock("span",mi,e.toDisplayString(e.unref(H)(_.formula||"0",p).toFixed(2)),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(p[_.field]),1)],64))]))),128)),e.createElementVNode("td",{class:"qukt-op-cell",onClick:a[0]||(a[0]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("button",{class:"qukt-row-btn",onClick:_=>d(k)},"编辑",8,pi),e.createElementVNode("button",{class:"qukt-row-btn danger",onClick:_=>O(k)},"删除",8,ui)])],8,ci))),128))])])])):e.createCommentVNode("",!0),D.value?(e.openBlock(),e.createElementBlock("div",{key:4,class:"qukt-de-mask",onClick:a[3]||(a[3]=e.withModifiers(p=>D.value=!1,["self"]))},[e.createElementVNode("div",fi,[e.createElementVNode("div",ki,[e.createElementVNode("span",null,e.toDisplayString(M.value==="edit"?"编辑明细":"添加明细"),1),e.createElementVNode("button",{class:"qukt-de-close",onClick:a[1]||(a[1]=p=>D.value=!1)},"✕")]),e.createElementVNode("div",bi,[e.createElementVNode("div",hi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,p=>(e.openBlock(),e.createElementBlock("div",{key:p.field,class:e.normalizeClass(["qukt-form-cell",{full:p.editor===e.unref(I).TEXTAREA.value}])},[e.createElementVNode("label",gi,e.toDisplayString(p.title),1),p.editor===e.unref(I).INPUT.value||p.editor===void 0?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,class:"qukt-cell-input","onUpdate:modelValue":k=>F.value[p.field]=k,placeholder:p.title},null,8,Ei)),[[e.vModelText,F.value[p.field]]]):p.editor===e.unref(I).NUMBER.value?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:1,class:"qukt-cell-input",type:"number",step:p.step??(p.min??0)<1?"0.01":"1",min:p.min,max:p.max,"onUpdate:modelValue":k=>F.value[p.field]=k},null,8,yi)),[[e.vModelText,F.value[p.field],void 0,{number:!0}]]):p.editor===e.unref(I).TEXTAREA.value?e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{key:2,class:"qukt-cell-input",rows:"3","onUpdate:modelValue":k=>F.value[p.field]=k,placeholder:p.title},null,8,Vi)),[[e.vModelText,F.value[p.field]]]):e.unref(W)(p.editor).hasDict?e.withDirectives((e.openBlock(),e.createElementBlock("select",{key:3,class:"qukt-cell-input","onUpdate:modelValue":k=>F.value[p.field]=k},[a[9]||(a[9]=e.createElementVNode("option",{value:""},"-- 请选择 --",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.dict||[],k=>(e.openBlock(),e.createElementBlock("option",{key:k,value:k},e.toDisplayString(k),9,_i))),128))],8,Ni)),[[e.vModelSelect,F.value[p.field]]]):e.createCommentVNode("",!0)],2))),128))])]),e.createElementVNode("div",qi,[e.createElementVNode("button",{class:"qukt-btn",onClick:a[2]||(a[2]=p=>D.value=!1)},"取消"),e.createElementVNode("button",{class:"qukt-btn qukt-btn-primary",onClick:u},"确定")])])])):e.createCommentVNode("",!0)]))}};j.QuokitData=wi,j.QuokitSheet=ze,j.QuokitTemplate=Zn,j.generateMockRows=Re,j.useColumns=Le,j.useSections=me,j.useSummary=Ae,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"})});
|