vue-quokit 0.1.6 → 0.1.7
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 +8 -8
- package/dist/index.mjs +1989 -1788
- package/package.json +1 -1
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: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}.qukt-preview-mask[data-v-8a922e81]{position:fixed;top:0;right:0;bottom:0;left:0;background:#00000073;display:flex;align-items:flex-start;justify-content:center;padding:40px 24px;overflow-y:auto;z-index:9999}.qukt-preview-box[data-v-8a922e81]{width:min(1100px,96vw);background:#fff;border-radius:8px;display:flex;flex-direction:column;box-shadow:0 10px 40px #0000002e}.qukt-preview-header[data-v-8a922e81]{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;border-bottom:1px solid #ebeef5;flex-shrink:0}.qukt-preview-title[data-v-8a922e81]{font-size:15px;font-weight:600;color:#303133}.qukt-preview-close[data-v-8a922e81]{cursor:pointer;color:#909399;font-size:16px;padding:2px 6px;border-radius:3px}.qukt-preview-close[data-v-8a922e81]:hover{background:#f5f7fa;color:#f56c6c}.qukt-preview-body[data-v-8a922e81]{padding:20px;background:#f5f7fa;max-height:75vh;overflow:auto}.qukt-preview-footer[data-v-8a922e81]{display:flex;justify-content:flex-end;gap:8px;flex-wrap:wrap;padding:10px 16px;border-top:1px solid #ebeef5;flex-shrink:0}.tool-btn[data-v-8a922e81]{padding:7px 14px;border:1px solid #dcdfe6;border-radius:4px;background:#fff;cursor:pointer;font-size:13px;color:#606266;transition:all .15s}.tool-btn[data-v-8a922e81]:hover{border-color:#409eff;color:#409eff}.qukt-preview-json-mask[data-v-8a922e81]{position:fixed;top:0;right:0;bottom:0;left:0;background:#00000073;display:flex;align-items:center;justify-content:center;z-index:10000}.qukt-preview-json-box[data-v-8a922e81]{width:min(720px,92vw);max-height:80vh;background:#fff;border-radius:8px;display:flex;flex-direction:column;box-shadow:0 10px 40px #0000002e}.qukt-preview-json-body[data-v-8a922e81]{flex:1;overflow:auto;margin:0;padding:14px 16px;background:#1e1e1e;color:#d4d4d4;font-family:Consolas,Monaco,Courier New,monospace;font-size:12.5px;line-height:1.6;white-space:pre}")),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,N=ye(r),s=r.length===0?1:Math.ceil(N/12);t=Math.max(t,V,s)}const d=l+8;return Math.max(50,t*d+16*2)}function Ne(o,l,t,d,b){for(let m=l;m<=t;m++)for(let r=d;r<=b;r++){const V=o.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 _e(o,l,t,d,b){for(let m=d;m<=b;m++)o.getCell(l,m).border={...o.getCell(l,m).border||{},top:te},o.getCell(t,m).border={...o.getCell(t,m).border||{},bottom:te};for(let m=l;m<=t;m++)o.getCell(m,d).border={...o.getCell(m,d).border||{},left:te},o.getCell(m,b).border={...o.getCell(m,b).border||{},right:te}}function qe(o,l){return o.bindEnabled&&o.bindField?l[o.bindField]??"":o.text??""}function we(o,l){const t=o.type===v.FIELD.value&&o.label&&!o.hideLabel;if(o.bindEnabled&&o.bindField){const d=l[o.bindField]??"";return t?o.label+d:d}return o.type===v.FIELD.value?(t?o.label:"")+(o.value??""):o.text??""}async function Qe(o,l,t={}){var E;if(!o||!Array.isArray(o.columns)||o.columns.length===0)throw new Error("模板为空或缺少列定义");const d=(l==null?void 0:l.headerData)||{},b=(l==null?void 0:l.footerData)||{};let m=(l==null?void 0:l.rows)||l||[];Array.isArray(m)||(m=[]);const r=t.layout||"auto-wrap",V=r==="auto-wrap",N=new je.Workbook,q=N.addWorksheet("报价单"),s=o.columns.length,f=Q(s-1);let g=1;const D=()=>(o.columns||[]).find(a=>P(a.editor).hasFormula),M=a=>{const p=D(),h=(p==null?void 0:p.formula)||"quantity * unit_price";return J(h,a)};if(o.header_sections){for(const a of o.header_sections)if(a.type==="divider")g++;else if(a.type==="text"){q.mergeCells(`A${g}:${f}${g}`);const p=q.getCell(`A${g}`);p.value=qe(a,d);const h=a.style||{},_=h.fontSize||13;if(p.font={size:_,bold:h.bold===!0,italic:h.italic===!0,name:"微软雅黑"},h.color){const w=h.color.replace("#","").toUpperCase();p.font.color={argb:w.length===6?"FF"+w:w}}p.alignment={horizontal:h.align||"left",vertical:"middle"},q.getRow(g).height=_*2+10,g++}else if(a.type==="row"&&a.cells){const p=a.cells.map(w=>{var B;return be((B=w.style)==null?void 0:B.width)||1/a.cells.length});let h=0;const _=p.map(w=>{const B=Math.round(h*s);h+=w;const C=Math.round(h*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],$=`${Q(C.start)}${g}`,L=`${Q(C.end)}${g}`;$!==L&&q.mergeCells(`${$}:${L}`);const U=q.getCell($);U.value=we(B,d);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(g).height=22,g++}}const z=g,F=q.getRow(g);F.values=o.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,g++;const k=o.group_rules,i=k==null?void 0:k.merge_field,n=o.columns;if(i){let a=0,p=0;for(;a<m.length;){const h=[];let _=a;for(;_<m.length&&m[_][i]===m[a][i];)h.push(m[_]),_++;const w=g;for(let $=0;$<h.length;$++){p++;const L=h[$],U=n.map(S=>S.editor===W.AUTO_SEQ.value?p:P(S.editor).hasFormula?M(L):L[S.field]??""),x=U.map((S,T)=>(n[T].prefix||"")+S+(n[T].suffix||"")),A=q.getRow(g);A.values=U,A.height=V?Ve(x,11):36;for(let S=0;S<n.length;S++){const T=n[S],X=A.getCell(S+1);ge(X,T.cellStyle),(T.prefix||T.suffix)&&(X.value=x[S])}g++}const B=g-1;for(let $=0;$<n.length;$++){const L=n[$];if(L.merge_on_group!==!0)continue;let U=w;for(let x=1;x<h.length;x++)h[x][L.field]!==h[x-1][L.field]&&(w+x-1>U&&q.mergeCells(`${Q($)}${U}:${Q($)}${w+x-1}`),U=w+x);B>U&&q.mergeCells(`${Q($)}${U}:${Q($)}${B}`)}if(k.show_detail_subtotal!==!1&&m[a][i]!==void 0&&m[a][i]!==null&&m[a][i]!==""){const $=h.reduce((X,Z)=>X+Number(M(Z)||0),0),L=Q(Math.max(0,s-2));q.mergeCells(`A${g}:${L}${g}`);const U=q.getCell(`A${g}`);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(`${f}${g}`),A=k.subtotal_prefix??"",S=k.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(g);T.fill={type:"pattern",pattern:"solid",fgColor:{argb:"FFF0F9FF"}},T.alignment={horizontal:"right",vertical:"middle",wrapText:!0},T.height=32,g++}a=_}}else for(let a=0;a<m.length;a++){const p=m[a],h=n.map(B=>B.editor===W.AUTO_SEQ.value?a+1:P(B.editor).hasFormula?M(p):p[B.field]??""),_=h.map((B,C)=>(n[C].prefix||"")+B+(n[C].suffix||"")),w=q.getRow(g);w.values=h,w.height=V?Ve(_,11):36;for(let B=0;B<n.length;B++){const C=n[B],$=w.getCell(B+1);ge($,C.cellStyle),(C.prefix||C.suffix)&&($.value=_[B])}g++}const y=g-1;if(o.summary_fields){g+=1;const a=Q(Math.max(0,s-2)),p=Q(s-1),h=m.reduce((B,C)=>B+Number(M(C)||0),0),_={group_total:h};for(const B of o.summary_fields)j(B.type).hasDefault&&(_[B.field]=Number(B.default??0));_.grand_total=h+o.summary_fields.filter(B=>j(B.type).hasDefault).reduce((B,C)=>B+_[C.field],0);for(const B of o.summary_fields)j(B.type).hasFormula&&(_[B.field]=J(B.formula||"group_total",_));for(const B of o.summary_fields){const C=j(B.type);let $;C.hasFormula?$=J(B.formula||"group_total",_):C.hasText?$=B.text||"":$=Number(B.default??0);const L=((E=B.style)==null?void 0:E.fontSize)||he,U=q.getCell(`${a}${g}`),x=q.getCell(`${p}${g}`);U.value=B.label,U.alignment={horizontal:"right",vertical:"middle",indent:1},U.font={name:"微软雅黑",size:he};const A=B.style||{},S=()=>{const Z={name:"微软雅黑",size:L,bold:!!A.bold,italic:!!A.italic};if(A.color){const fe=A.color.replace("#","").toUpperCase();Z.color={argb:fe.length===6?"FF"+fe:fe}}return Z},T=B.prefix||"",X=B.suffix||"";if(typeof $=="number"){const Z=$.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2});x.value=T+Z+X,x.alignment={horizontal:"right",vertical:"middle",indent:1}}else x.value=T+($??"")+X,x.alignment={horizontal:"right",vertical:"middle",indent:1};x.font=S(),q.getRow(g).height=Math.max(28,L*2+12),g++}const w=g-1;Ne(q,z,w,1,s),_e(q,z,w,1,s)}else Ne(q,z,y,1,s),_e(q,z,y,1,s);if(o.footer_sections){g+=1;for(const a of o.footer_sections)if(a.type==="divider")g++;else if(a.type==="text"){q.mergeCells(`A${g}:${f}${g}`);const p=q.getCell(`A${g}`);p.value=qe(a,b);const h=a.style||{},_=h.fontSize||13;if(p.font={size:_,bold:h.bold===!0,italic:h.italic===!0,name:"微软雅黑"},h.color){const w=h.color.replace("#","").toUpperCase();p.font.color={argb:w.length===6?"FF"+w:w}}p.alignment={horizontal:h.align||"left",vertical:"middle"},q.getRow(g).height=_*2+10,g++}else if(a.type==="row"&&a.cells){const p=a.cells.map(w=>{var B;return be((B=w.style)==null?void 0:B.width)||1/a.cells.length});let h=0;const _=p.map(w=>{const B=Math.round(h*s);h+=w;const C=Math.round(h*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],$=`${Q(C.start)}${g}`,L=`${Q(C.end)}${g}`;$!==L&&q.mergeCells(`${$}:${L}`);const U=q.getCell($);U.value=we(B,b);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(g).height=22,g++}}const c=50,O=6;for(let a=0;a<s;a++){const p=o.columns[a],h=a+1;if(r==="auto-wrap")q.getColumn(h).width=p.width?Math.max(p.width/7,8):12;else{let _=0;for(let C=1;C<g;C++)_=Math.max(_,ye(q.getCell(C,h).value));const w=p.width?Math.max(p.width/7,10):12,B=Math.min(Math.max(_+2,O),c);q.getColumn(h).width=Math.max(B,w)}}const u=await N.xlsx.writeBuffer();return new Blob([u],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}function R(o){return JSON.parse(JSON.stringify(o))}function H(o,l){try{return JSON.stringify(o)===JSON.stringify(l)}catch{return!1}}function Xe(o,l){let t=null;const d=function(...b){clearTimeout(t),t=setTimeout(()=>o.apply(this,b),l)};return d.cancel=()=>{clearTimeout(t),t=null},Object.defineProperty(d,"timer",{get(){return t},configurable:!0}),d}const Be={color:"#303133",fontSize:13,bold:!1,italic:!1,align:"center"};function xe(o=[]){return Array.isArray(o)?o.map(l=>{const t=P(l.editor),d=Array.isArray(l.dict)?l.dict:[];return{...l,field:l.field||"",title:l.title||t.defaultTitle,editor:l.editor||W.INPUT.value,width:l.width??t.defaultWidth,dictStr:d.length?d.join(","):l.dictStr||"",formula:l.formula||"",merge_on_group:t.canMerge?l.merge_on_group??!1:!1,cellStyle:{...R(Be),...l.cellStyle||{}},prefix:l.prefix||"",suffix:l.suffix||""}}):[]}function $e(o){return o.map(l=>{const t=P(l.editor),d={field:l.field,title:l.title,editor:l.editor,width:l.width};return t.hasDict&&(d.dict=(l.dictStr||"").split(",").map(b=>b.trim()).filter(Boolean)),t.hasFormula&&(d.formula=l.formula||""),t.canMerge&&(d.merge_on_group=!!l.merge_on_group),l.cellStyle&&(d.cellStyle=l.cellStyle),l.prefix&&(d.prefix=l.prefix),l.suffix&&(d.suffix=l.suffix),d})}function le(o={}){const l=o&&typeof o=="object"?o:{},t=l.merge_field||"";return t?{merge_field:t,show_detail_subtotal:l.show_detail_subtotal??!0,subtotal_prefix:l.subtotal_prefix??"",subtotal_suffix:l.subtotal_suffix??""}:{}}function Je(o,l,t){const d=P(o);return{field:l,title:d.defaultTitle||t||"新列",editor:o,width:d.defaultWidth,dictStr:d.hasDict&&d.defaultDictStr||"",formula:"",merge_on_group:!1,cellStyle:R(Be),prefix:"",suffix:""}}function Ce(){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(o="auto"){return{width:o,color:"#303133",fontSize:13,bold:!1,italic:!1,align:"left",border:Ce()}}function oe(o){const l=o.style||{},t={width:l.width||"auto"};t.textAlign=l.align||"left",l.color!=null&&l.color!==""&&(t.color=l.color),l.fontSize!=null&&(t.fontSize=Number(l.fontSize)+"px"),l.bold&&(t.fontWeight="bold"),l.italic&&(t.fontStyle="italic");const d=l.border;if(d)for(const b of["top","bottom","left","right"]){const m=d[b];m&&m.style&&m.width>0&&(t["border-"+b]=`${m.width}px ${m.style} ${m.color||"#dcdfe6"}`)}return t}function Ge(o){const l=new Set;for(const t of o||[])if(t.type==="text"&&t.bindField)l.add(t.bindField);else if(t.type==="row"&&t.cells)for(const d of t.cells)d.bindField&&l.add(d.bindField);return l}function Se(o,l){const t=Ge(l);let d=0;const b=new RegExp("^"+o+"(\\d+)$");for(const V of t){const N=b.exec(V);N&&(d=Math.max(d,parseInt(N[1],10)))}let m=d+1,r=o+String(m).padStart(4,"0");for(;t.has(r);)m++,r=o+String(m).padStart(4,"0");return r}function De(o){const l={},t=o&&o.style||{};return t.color&&(l.color=t.color),t.fontSize&&(l.fontSize=Number(t.fontSize)+"px"),t.bold&&(l.fontWeight="bold"),t.italic&&(l.fontStyle="italic"),l}function Y(o){const l=De(o),t=o&&o.style||{};return t.align?l.textAlign=t.align:o&&o.align&&(l.textAlign=o.align),l}function Fe(o){return De(o)}function Te(o,l,t){o.bindEnabled=!o.bindEnabled,o.bindEnabled?(o.text="",o.bindField=o.bindField||Se(l,t)):o.bindField=""}function Ue(o,l,t){o.bindEnabled=!o.bindEnabled,o.bindEnabled?(o.text="",o.value="",o.bindField=o.bindField||Se(l,t)):o.bindField=""}function He(o,l){let t=o,d=2;for(;l.has(t);)t=o+"_"+d++;return t}function Ye(o=[]){for(const l of o)l.type==="title"&&(l.type="text",l.style=l.style||{color:"#303133",fontSize:18,bold:!0,italic:!1,align:"center"},l.align&&!l.style.align&&(l.style.align=l.align,delete l.align)),l.type==="text"&&(l.style=l.style||{},l.align&&!l.style.align&&(l.style.align=l.align,delete l.align),l.style.color===void 0&&(l.style.color="#303133"),l.style.fontSize===void 0&&(l.style.fontSize=14),l.style.bold===void 0&&(l.style.bold=!1),l.style.italic===void 0&&(l.style.italic=!1),l.style.align===void 0&&(l.style.align="left"),l.bindEnabled===void 0&&(l.bindEnabled=!1),l.bindField===void 0&&(l.bindField=""),l.bindEnabled&&(l.text=""))}function Ze(o=[]){for(const l of o)if(l.type==="row"&&l.cells)for(const t of l.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=Ce()),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 Me(o){const l=[];for(const t of o||[])if(t.type==="text"&&t.bindEnabled)l.push({field:t.bindField,label:t.label||""});else if(t.type==="row"&&t.cells)for(const d of t.cells)d.bindEnabled&&l.push({field:d.bindField,label:d.label||""});return l.filter(t=>t.field)}function ne(o){return!o||o.length===0?[]:(Ye(o),Ze(o),o)}const ze="sum_";let re=0;function Le(){return re++,ze+String(re).padStart(4,"0")}function Ke(o){const l=j(o),t={color:"#606266",fontSize:13,bold:!1,italic:!1},b={field:Le(),label:"标签",prefix:"",suffix:"",style:t};return l.hasFormula?{...b,type:l.value,formula:""}:l.hasText?{...b,type:l.value,text:""}:{...b,type:G.MANUAL_INPUT.value,default:0}}function de(o=[]){let l=0;for(const t of o)if(t.field){const d=new RegExp("^"+ze+"(\\d+)$").exec(t.field);d&&(l=Math.max(l,parseInt(d[1],10)))}re=l;for(const t of o)t.field==null&&(t.field=Le()),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(o){const l=o&&typeof o=="object"?o:{},t=$e(xe(l.columns||[])),d=le(l.group_rules||{}),b=ne(R(l.header_sections||[])),m=ne(R(l.footer_sections||[])),r=R(l.summary_fields||[]);return de(r),{columns:t,group_rules:d,header_sections:b,footer_sections:m,summary_fields:r}}const ve={class:"qukt-quote-sheet"},et={key:1,class:"qukt-q-divider"},tt={key:3,class:"qukt-q-row"},lt={key:0,class:"qukt-q-table-wrap"},ot={class:"qukt-q-table"},nt={key:0,class:"subtotal-row"},it=["colspan"],at={class:"subtotal-value"},st={key:1},rt=["rowspan"],dt={key:0,class:"empty-row"},ct=["colspan"],mt={key:1,class:"qukt-q-summary"},pt={class:"qukt-q-summary-label"},ut={class:"qukt-q-footer"},ft={key:0,class:"qukt-q-divider"},kt={key:2,class:"qukt-q-row"},me={__name:"QuokitSheet",props:{tpl:{type:Object,default:ce},data:{type:Object,default:()=>({headerData:{},rows:[],footerData:{}})},placeholder:{type:String,default:"-"}},setup(o,{expose:l}){const t=o,d=e.computed(()=>ie(t.tpl)),b=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,E){return u.bindEnabled&&u.bindField?(E==="footer"?m.value:b.value)[u.bindField]??"":u.text||""}function N(u,E){const a=u.type==="field"&&u.label&&!u.hideLabel;if(u.bindEnabled&&u.bindField){const h=(E==="footer"?m.value:b.value)[u.bindField]??"";return a?u.label+h:h}return u.type==="field"?(a?u.label:"")+(u.value??""):u.text||""}function q(u){const E={width:(u.width||100)+"px"},a=u.cellStyle||{};a.color!=null&&a.color!==""&&(E.color=a.color),a.fontSize!=null&&(E.fontSize=Number(a.fontSize)+"px"),a.bold&&(E.fontWeight="bold"),a.italic&&(E.fontStyle="italic"),a.align&&(E.textAlign=a.align);const p=a.border;if(p)for(const h of["top","bottom","left","right"]){const _=p[h];_&&_.style&&_.width>0&&(E["border-"+h]=`${_.width}px ${_.style} ${_.color||"#dcdfe6"}`)}return E}function s(u){return(Number(u)||0).toFixed(2)}const f=e.computed(()=>d.value.columns.find(u=>P(u.editor).hasFormula));function g(u){var a;const E=((a=f.value)==null?void 0:a.formula)||"quantity * unit_price";return J(E,u)}const D=e.computed(()=>r.value.reduce((u,E)=>u+Number(g(E)||0),0));function M(){let u=D.value;for(const E of d.value.summary_fields)j(E.type).hasDefault&&(u+=z(E));return u}function z(u){return Number(u.default??0)}function F(){const u={group_total:D.value},E=d.value.summary_fields;for(const a of E)j(a.type).hasDefault&&(u[a.field]=z(a));for(const a of E)if(j(a.type).hasFormula&&a.formula)try{u[a.field]=J(a.formula,u)}catch{u[a.field]=0}return u.grand_total=M(),u}function k(u){const E=j(u.type);return E.hasText?u.text||"":E.hasFormula?u.formula?F()[u.field]??0:0:z(u)}function i(u){if(j(u.type).hasText)return u.text||"";const E=Number(k(u))||0,a=Number.isInteger(E)?E:E.toFixed(2);return(u.prefix||"")+a+(u.suffix||"")}const n=e.computed(()=>{const u=r.value.map(_=>({..._})),E=d.value.group_rules;if(!(E!=null&&E.merge_field))return u;const a=[],p=E.merge_field;let h=0;for(;h<u.length;){const _=[u[h]];let w=h+1;for(;w<u.length&&u[w][p]===u[h][p];)_.push(u[w]),w++;if(a.push(..._),(E.show_detail_subtotal??!0)&&u[h][p]!==void 0&&u[h][p]!==null&&u[h][p]!==""){const C=_.reduce(($,L)=>$+Number(g(L)||0),0);a.push({__is_subtotal:!0,__group_key:u[h][p],__group_sum:C})}h=w}return a});function y(u,E){var L,U,x;const a=n.value,p=a[u];if(!p||p.__is_subtotal)return 1;const h=d.value.group_rules,_=h==null?void 0:h.merge_field,w=d.value.columns.find(A=>A.field===E),B=_&&E===_,C=(w==null?void 0:w.merge_on_group)===!0;if(!B&&!C)return 1;const $=(()=>{var T,X;if(!_)return a.length;const A=p[_];let S=u+1;for(;S<a.length&&((T=a[S])==null?void 0:T[_])===A&&!((X=a[S])!=null&&X.__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[E];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[E])===A)return 0}let S=1;for(let T=u+1;T<$&&((x=a[T])==null?void 0:x[E])===A;T++)S++;return S}return 1}async function c(u=!1){const E=d.value;if(!E||E.columns.length===0){console.warn("[QuokitSheet] exportExcel skipped: template has no columns");return}const a=await Qe(E,t.data||{},u?{layout:"auto-width"}:void 0),p=URL.createObjectURL(a),h=document.createElement("a");h.href=p,h.download=`${Date.now()}.xlsx`,document.body.appendChild(h),h.click(),document.body.removeChild(h),setTimeout(()=>URL.revokeObjectURL(p),100)}function O(u=!1){const E=document.querySelector(".qukt-quote-sheet");if(!E)return;const a=u!==!0,p=window.open("","_blank",a?"width=1200,height=900":"width=900,height=1200");if(!p)return;const h=Array.from(document.styleSheets).map(w=>{try{return Array.from(w.cssRules).map(B=>B.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-design-table{width:100%;min-width:var(--qukt-cols-min-width, 960px);border-collapse:collapse;font-size:13px}.qukt-design-table--fixed{table-layout:fixed;width:auto;border-collapse:collapse;font-size:13px}.qukt-design-table th,.qukt-design-table td,.qukt-design-table--fixed th,.qukt-design-table--fixed td{border:1px solid #ebeef5;padding:6px 8px;text-align:center}.qukt-design-table th,.qukt-design-table--fixed th{background:#f5f7fa;font-weight:600;color:#303133}.qukt-design-table td.idx,.qukt-design-table--fixed td.idx{color:#909399;background:#fafbfc;width:50px;text-align:center}.qukt-design-table tbody tr:hover,.qukt-design-table--fixed 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}.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}.qukt-preview-mask[data-v-8a922e81]{position:fixed;top:0;right:0;bottom:0;left:0;background:#00000073;display:flex;align-items:flex-start;justify-content:center;padding:40px 24px;overflow-y:auto;z-index:9999}.qukt-preview-box[data-v-8a922e81]{width:min(1100px,96vw);background:#fff;border-radius:8px;display:flex;flex-direction:column;box-shadow:0 10px 40px #0000002e}.qukt-preview-header[data-v-8a922e81]{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;border-bottom:1px solid #ebeef5;flex-shrink:0}.qukt-preview-title[data-v-8a922e81]{font-size:15px;font-weight:600;color:#303133}.qukt-preview-close[data-v-8a922e81]{cursor:pointer;color:#909399;font-size:16px;padding:2px 6px;border-radius:3px}.qukt-preview-close[data-v-8a922e81]:hover{background:#f5f7fa;color:#f56c6c}.qukt-preview-body[data-v-8a922e81]{padding:20px;background:#f5f7fa;max-height:75vh;overflow:auto}.qukt-preview-footer[data-v-8a922e81]{display:flex;justify-content:flex-end;gap:8px;flex-wrap:wrap;padding:10px 16px;border-top:1px solid #ebeef5;flex-shrink:0}.tool-btn[data-v-8a922e81]{padding:7px 14px;border:1px solid #dcdfe6;border-radius:4px;background:#fff;cursor:pointer;font-size:13px;color:#606266;transition:all .15s}.tool-btn[data-v-8a922e81]:hover{border-color:#409eff;color:#409eff}.qukt-preview-json-mask[data-v-8a922e81]{position:fixed;top:0;right:0;bottom:0;left:0;background:#00000073;display:flex;align-items:center;justify-content:center;z-index:10000}.qukt-preview-json-box[data-v-8a922e81]{width:min(720px,92vw);max-height:80vh;background:#fff;border-radius:8px;display:flex;flex-direction:column;box-shadow:0 10px 40px #0000002e}.qukt-preview-json-body[data-v-8a922e81]{flex:1;overflow:auto;margin:0;padding:14px 16px;background:#1e1e1e;color:#d4d4d4;font-family:Consolas,Monaco,Courier New,monospace;font-size:12.5px;line-height:1.6;white-space:pre}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
+
(function(O,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("exceljs")):typeof define=="function"&&define.amd?define(["exports","vue","exceljs"],e):(O=typeof globalThis<"u"?globalThis:O||self,e(O.VueQuokit={},O.Vue,O.ExcelJS))})(this,function(O,e,He){"use strict";function G(t,o){if(!t)return 0;const l=String(t).replace(/\s+/g,"");if(!l)return 0;let a=0;function k(){return l[a]}function p(){return l[a++]}function m(d){if(k()!==d)throw new Error("公式解析错误: 期望 "+d+" at "+a);a++}function N(){const d=k();if(d==="("){p();const f=_();return m(")"),f}if(d==="-")return p(),-N();if(d==="+")return p(),N();if(d>="0"&&d<="9"||d==="."){let f="";for(;a<l.length&&(l[a]>="0"&&l[a]<="9"||l[a]===".");)f+=l[a++];return parseFloat(f)}if(d>="a"&&d<="z"||d>="A"&&d<="Z"||d==="_"){let f="";for(;a<l.length&&(l[a]>="a"&&l[a]<="z"||l[a]>="A"&&l[a]<="Z"||l[a]==="_"||l[a]>="0"&&l[a]<="9");)f+=l[a++];return Number(o[f]||0)}throw new Error('公式解析错误: 非法字符 "'+d+'" at '+a)}function y(){let d=N();for(;a<l.length&&(k()==="*"||k()==="/");){const f=p(),g=N();d=f==="*"?d*g:g===0?0:d/g}return d}function _(){let d=y();for(;a<l.length&&(k()==="+"||k()==="-");){const f=p(),g=y();d=f==="+"?d+g:d-g}return d}try{const d=_();return Math.round(d*100)/100}catch{return 0}}const P={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(P).map(t=>P[t].value);function I(t){return P[t]||P.INPUT}const H={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(H).map(t=>H[t].value);function j(t){return H[t]||H.MANUAL_INPUT}const ye={TEXT:{value:"text",label:"纯文本"},ROW:{value:"row",label:"表格行"},DIVIDER:{value:"divider",label:"分割线"}};Object.keys(ye).map(t=>ye[t].value);const te={FIELD:{value:"field",label:"绑定字段"},TEXT:{value:"text",label:"纯文本"},IMAGE:{value:"image",label:"图片"}};Object.keys(te).map(t=>te[t].value);function J(t){let o="";for(;t>=0;)o=String.fromCharCode(65+t%26)+o,t=Math.floor(t/26)-1;return o}function Ee(t){return typeof t=="string"?parseFloat(t)/100:0}const le={style:"thin",color:{argb:"FFDCDFE6"}},oe={style:"medium",color:{argb:"FF606266"}},ge=11;function Ve(t){if(!t)return null;const o=t.replace("#","").toUpperCase();return o.length===6?"FF"+o:o}function Ne(t,o){if(!o)return;const l={name:"微软雅黑"};if(o.fontSize&&(l.size=o.fontSize),o.bold&&(l.bold=!0),o.italic&&(l.italic=!0),o.color){const a=Ve(o.color);a&&(l.color={argb:a})}if(t.font=l,o.align&&(t.alignment={horizontal:o.align,vertical:"middle",wrapText:!0,indent:1}),o.border){const a={};for(const k of["top","bottom","left","right"]){const p=o.border[k];if(p&&p.style&&p.width>0){const m=Ve(p.color)||"FFDCDFE6";let N=p.style;N==="solid"&&(N="thin"),a[k]={style:N,color:{argb:m}}}}Object.keys(a).length>0&&(t.border=a)}}function _e(t){if(t==null)return 0;if(typeof t=="number")return String(t).length;const o=String(t);let l=0;for(const a of o)a!==`
|
|
3
|
+
`&&(/[\u4e00-\u9fa5\u3000-\u303f\uff00-\uffef\u2e80-\u2fdf\u31c0-\u31ef]/.test(a)?l+=2:l+=1);return l}function qe(t,o=11){let l=1;for(const p of t){const m=String(p??""),N=m.split(`
|
|
4
|
+
`).length,y=_e(m),d=m.length===0?1:Math.ceil(y/12);l=Math.max(l,N,d)}const a=o+8;return Math.max(50,l*a+16*2)}function we(t,o,l,a,k){for(let p=o;p<=l;p++)for(let m=a;m<=k;m++){const N=t.getCell(p,m),y=N.border||{};N.border={top:y.top||le,left:y.left||le,right:y.right||le,bottom:y.bottom||le}}}function Be(t,o,l,a,k){for(let p=a;p<=k;p++)t.getCell(o,p).border={...t.getCell(o,p).border||{},top:oe},t.getCell(l,p).border={...t.getCell(l,p).border||{},bottom:oe};for(let p=o;p<=l;p++)t.getCell(p,a).border={...t.getCell(p,a).border||{},left:oe},t.getCell(p,k).border={...t.getCell(p,k).border||{},right:oe}}function xe(t,o){return t.bindEnabled&&t.bindField?o[t.bindField]??"":t.text??""}function $e(t,o){const l=t.type===te.FIELD.value&&t.label&&!t.hideLabel;if(t.bindEnabled&&t.bindField){const a=o[t.bindField]??"";return l?t.label+a:a}return t.type===te.FIELD.value?(l?t.label:"")+(t.value??""):t.text??""}async function Ye(t,o,l={}){var E;if(!t||!Array.isArray(t.columns)||t.columns.length===0)throw new Error("模板为空或缺少列定义");const a=(o==null?void 0:o.headerData)||{},k=(o==null?void 0:o.footerData)||{};let p=(o==null?void 0:o.rows)||o||[];Array.isArray(p)||(p=[]);const m=l.layout||"auto-wrap",N=m==="auto-wrap",y=new He.Workbook,_=y.addWorksheet("报价单"),d=t.columns.length,f=J(d-1);let g=1;const U=()=>(t.columns||[]).find(r=>I(r.editor).hasFormula),A=r=>{const u=U(),h=(u==null?void 0:u.formula)||"quantity * unit_price";return G(h,r)};if(t.header_sections){for(const r of t.header_sections)if(r.type==="divider")g++;else if(r.type==="text"){_.mergeCells(`A${g}:${f}${g}`);const u=_.getCell(`A${g}`);u.value=xe(r,a);const h=r.style||{},q=h.fontSize||13;if(u.font={size:q,bold:h.bold===!0,italic:h.italic===!0,name:"微软雅黑"},h.color){const w=h.color.replace("#","").toUpperCase();u.font.color={argb:w.length===6?"FF"+w:w}}u.alignment={horizontal:h.align||"left",vertical:"middle"},_.getRow(g).height=q*2+10,g++}else if(r.type==="row"&&r.cells){const u=r.cells.map(w=>{var B;return Ee((B=w.style)==null?void 0:B.width)||1/r.cells.length});let h=0;const q=u.map(w=>{const B=Math.round(h*d);h+=w;const S=Math.round(h*d)-1;return{start:B,end:Math.max(S,B)}});for(let w=0;w<r.cells.length;w++){const B=r.cells[w],S=q[w],C=`${J(S.start)}${g}`,z=`${J(S.end)}${g}`;C!==z&&_.mergeCells(`${C}:${z}`);const M=_.getCell(C);M.value=$e(B,a);const $=B.style||{},R=$.fontSize||11;if(M.font={size:R,bold:$.bold===!0,italic:$.italic===!0,name:"微软雅黑"},$.color){const F=$.color.replace("#","").toUpperCase();M.font.color={argb:F.length===6?"FF"+F:F}}M.alignment={horizontal:$.align||"left",vertical:"middle"}}_.getRow(g).height=22,g++}}const L=g,D=_.getRow(g);D.values=t.columns.map(r=>r.title),D.font={bold:!0,name:"微软雅黑",size:12},D.fill={type:"pattern",pattern:"solid",fgColor:{argb:"FFE0E0E0"}},D.alignment={horizontal:"center",vertical:"middle",wrapText:N,indent:1},D.height=N?48:44,g++;const V=t.group_rules,s=V==null?void 0:V.merge_field,n=t.columns;if(s){let r=0,u=0;for(;r<p.length;){const h=[];let q=r;for(;q<p.length&&p[q][s]===p[r][s];)h.push(p[q]),q++;const w=g;for(let C=0;C<h.length;C++){u++;const z=h[C],M=n.map(F=>F.editor===P.AUTO_SEQ.value?u:I(F.editor).hasFormula?A(z):z[F.field]??""),$=M.map((F,T)=>(n[T].prefix||"")+F+(n[T].suffix||"")),R=_.getRow(g);R.values=M,R.height=N?qe($,11):36;for(let F=0;F<n.length;F++){const T=n[F],Q=R.getCell(F+1);Ne(Q,T.cellStyle),(T.prefix||T.suffix)&&(Q.value=$[F])}g++}const B=g-1;for(let C=0;C<n.length;C++){const z=n[C];if(z.merge_on_group!==!0)continue;let M=w;for(let $=1;$<h.length;$++)h[$][z.field]!==h[$-1][z.field]&&(w+$-1>M&&_.mergeCells(`${J(C)}${M}:${J(C)}${w+$-1}`),M=w+$);B>M&&_.mergeCells(`${J(C)}${M}:${J(C)}${B}`)}if(V.show_detail_subtotal!==!1&&p[r][s]!==void 0&&p[r][s]!==null&&p[r][s]!==""){const C=h.reduce((Q,K)=>Q+Number(A(K)||0),0),z=J(Math.max(0,d-2));_.mergeCells(`A${g}:${z}${g}`);const M=_.getCell(`A${g}`);M.value=`小计(${p[r][s]})`,M.alignment={horizontal:"right",vertical:"middle"},M.font={bold:!0,italic:!0,color:{argb:"FF409EFF"},name:"微软雅黑",size:11};const $=_.getCell(`${f}${g}`),R=V.subtotal_prefix??"",F=V.subtotal_suffix??"";$.value=R+C.toFixed(2)+F,$.alignment={horizontal:"right",vertical:"middle"},$.font={bold:!0,italic:!0,color:{argb:"FF409EFF"},name:"微软雅黑",size:11};const T=_.getRow(g);T.fill={type:"pattern",pattern:"solid",fgColor:{argb:"FFF0F9FF"}},T.alignment={horizontal:"right",vertical:"middle",wrapText:!0},T.height=32,g++}r=q}}else for(let r=0;r<p.length;r++){const u=p[r],h=n.map(B=>B.editor===P.AUTO_SEQ.value?r+1:I(B.editor).hasFormula?A(u):u[B.field]??""),q=h.map((B,S)=>(n[S].prefix||"")+B+(n[S].suffix||"")),w=_.getRow(g);w.values=h,w.height=N?qe(q,11):36;for(let B=0;B<n.length;B++){const S=n[B],C=w.getCell(B+1);Ne(C,S.cellStyle),(S.prefix||S.suffix)&&(C.value=q[B])}g++}const b=g-1;if(t.summary_fields){g+=1;const r=J(Math.max(0,d-2)),u=J(d-1),h=p.reduce((B,S)=>B+Number(A(S)||0),0),q={group_total:h};for(const B of t.summary_fields)j(B.type).hasDefault&&(q[B.field]=Number(B.default??0));q.grand_total=h+t.summary_fields.filter(B=>j(B.type).hasDefault).reduce((B,S)=>B+q[S.field],0);for(const B of t.summary_fields)j(B.type).hasFormula&&(q[B.field]=G(B.formula||"group_total",q));for(const B of t.summary_fields){const S=j(B.type);let C;S.hasFormula?C=G(B.formula||"group_total",q):S.hasText?C=B.text||"":C=Number(B.default??0);const z=((E=B.style)==null?void 0:E.fontSize)||ge,M=_.getCell(`${r}${g}`),$=_.getCell(`${u}${g}`);M.value=B.label,M.alignment={horizontal:"right",vertical:"middle",indent:1},M.font={name:"微软雅黑",size:ge};const R=B.style||{},F=()=>{const K={name:"微软雅黑",size:z,bold:!!R.bold,italic:!!R.italic};if(R.color){const he=R.color.replace("#","").toUpperCase();K.color={argb:he.length===6?"FF"+he:he}}return K},T=B.prefix||"",Q=B.suffix||"";if(typeof C=="number"){const K=C.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2});$.value=T+K+Q,$.alignment={horizontal:"right",vertical:"middle",indent:1}}else $.value=T+(C??"")+Q,$.alignment={horizontal:"right",vertical:"middle",indent:1};$.font=F(),_.getRow(g).height=Math.max(28,z*2+12),g++}const w=g-1;we(_,L,w,1,d),Be(_,L,w,1,d)}else we(_,L,b,1,d),Be(_,L,b,1,d);if(t.footer_sections){g+=1;for(const r of t.footer_sections)if(r.type==="divider")g++;else if(r.type==="text"){_.mergeCells(`A${g}:${f}${g}`);const u=_.getCell(`A${g}`);u.value=xe(r,k);const h=r.style||{},q=h.fontSize||13;if(u.font={size:q,bold:h.bold===!0,italic:h.italic===!0,name:"微软雅黑"},h.color){const w=h.color.replace("#","").toUpperCase();u.font.color={argb:w.length===6?"FF"+w:w}}u.alignment={horizontal:h.align||"left",vertical:"middle"},_.getRow(g).height=q*2+10,g++}else if(r.type==="row"&&r.cells){const u=r.cells.map(w=>{var B;return Ee((B=w.style)==null?void 0:B.width)||1/r.cells.length});let h=0;const q=u.map(w=>{const B=Math.round(h*d);h+=w;const S=Math.round(h*d)-1;return{start:B,end:Math.max(S,B)}});for(let w=0;w<r.cells.length;w++){const B=r.cells[w],S=q[w],C=`${J(S.start)}${g}`,z=`${J(S.end)}${g}`;C!==z&&_.mergeCells(`${C}:${z}`);const M=_.getCell(C);M.value=$e(B,k);const $=B.style||{};M.alignment={horizontal:$.align||"left",vertical:"middle"};const R={name:"微软雅黑",size:$.fontSize||11,bold:$.bold===!0,italic:$.italic===!0};if($.color){const F=$.color.replace("#","").toUpperCase();R.color={argb:F.length===6?"FF"+F:F}}M.font=R}_.getRow(g).height=22,g++}}const i=50,x=6;for(let r=0;r<d;r++){const u=t.columns[r],h=r+1;if(m==="auto-wrap")_.getColumn(h).width=u.width?Math.max(u.width/7,8):12;else{let q=0;for(let S=1;S<g;S++)q=Math.max(q,_e(_.getCell(S,h).value));const w=u.width?Math.max(u.width/7,10):12,B=Math.min(Math.max(q+2,x),i);_.getColumn(h).width=Math.max(B,w)}}const c=await y.xlsx.writeBuffer();return new Blob([c],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}function W(t){return JSON.parse(JSON.stringify(t))}function Y(t,o){try{return JSON.stringify(t)===JSON.stringify(o)}catch{return!1}}function Ze(t,o){let l=null;const a=function(...k){clearTimeout(l),l=setTimeout(()=>t.apply(this,k),o)};return a.cancel=()=>{clearTimeout(l),l=null},Object.defineProperty(a,"timer",{get(){return l},configurable:!0}),a}const Ce={color:"#303133",fontSize:13,bold:!1,italic:!1,align:"center"};function Se(t=[]){return Array.isArray(t)?t.map(o=>{const l=I(o.editor),a=Array.isArray(o.dict)?o.dict:[];return{...o,field:o.field||"",title:o.title||l.defaultTitle,editor:o.editor||P.INPUT.value,width:o.width??l.defaultWidth,dictStr:a.length?a.join(","):o.dictStr||"",formula:o.formula||"",merge_on_group:l.canMerge?o.merge_on_group??!1:!1,cellStyle:{...W(Ce),...o.cellStyle||{}},prefix:o.prefix||"",suffix:o.suffix||""}}):[]}function De(t){return t.map(o=>{const l=I(o.editor),a={field:o.field,title:o.title,editor:o.editor,width:o.width};return l.hasDict&&(a.dict=(o.dictStr||"").split(",").map(k=>k.trim()).filter(Boolean)),l.hasFormula&&(a.formula=o.formula||""),l.canMerge&&(a.merge_on_group=!!o.merge_on_group),o.cellStyle&&(a.cellStyle=o.cellStyle),o.prefix&&(a.prefix=o.prefix),o.suffix&&(a.suffix=o.suffix),a})}function ne(t={}){const o=t&&typeof t=="object"?t:{},l=o.merge_field||"";return l?{merge_field:l,show_detail_subtotal:o.show_detail_subtotal??!0,subtotal_prefix:o.subtotal_prefix??"",subtotal_suffix:o.subtotal_suffix??""}:{}}function Ke(t,o,l){const a=I(t);return{field:o,title:a.defaultTitle||l||"新列",editor:t,width:a.defaultWidth,dictStr:a.hasDict&&a.defaultDictStr||"",formula:"",merge_on_group:!1,cellStyle:W(Ce),prefix:"",suffix:""}}function Fe(){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 v(t="auto"){return{width:t,color:"#303133",fontSize:13,bold:!1,italic:!1,align:"left",border:Fe()}}function ie(t){const o=t.style||{},l={width:o.width||"auto"};l.textAlign=o.align||"left",o.color!=null&&o.color!==""&&(l.color=o.color),o.fontSize!=null&&(l.fontSize=Number(o.fontSize)+"px"),o.bold&&(l.fontWeight="bold"),o.italic&&(l.fontStyle="italic");const a=o.border;if(a)for(const k of["top","bottom","left","right"]){const p=a[k];p&&p.style&&p.width>0&&(l["border-"+k]=`${p.width}px ${p.style} ${p.color||"#dcdfe6"}`)}return l}function ve(t){const o=new Set;for(const l of t||[])if(l.type==="text"&&l.bindField)o.add(l.bindField);else if(l.type==="row"&&l.cells)for(const a of l.cells)a.bindField&&o.add(a.bindField);return o}function Te(t,o){const l=ve(o);let a=0;const k=new RegExp("^"+t+"(\\d+)$");for(const N of l){const y=k.exec(N);y&&(a=Math.max(a,parseInt(y[1],10)))}let p=a+1,m=t+String(p).padStart(4,"0");for(;l.has(m);)p++,m=t+String(p).padStart(4,"0");return m}function Ue(t){const o={},l=t&&t.style||{};return l.color&&(o.color=l.color),l.fontSize&&(o.fontSize=Number(l.fontSize)+"px"),l.bold&&(o.fontWeight="bold"),l.italic&&(o.fontStyle="italic"),o}function Z(t){const o=Ue(t),l=t&&t.style||{};return l.align?o.textAlign=l.align:t&&t.align&&(o.textAlign=t.align),o}function Me(t){return Ue(t)}function Ae(t,o,l){t.bindEnabled=!t.bindEnabled,t.bindEnabled?(t.text="",t.bindField=t.bindField||Te(o,l)):t.bindField=""}function Le(t,o,l){t.bindEnabled=!t.bindEnabled,t.bindEnabled?(t.text="",t.value="",t.bindField=t.bindField||Te(o,l)):t.bindField=""}function et(t,o){let l=t,a=2;for(;o.has(l);)l=t+"_"+a++;return l}function tt(t=[]){for(const o of t)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 lt(t=[]){for(const o of t)if(o.type==="row"&&o.cells)for(const l of o.cells)l.style||(l.style=v()),l.style.width===void 0&&(l.style.width="auto"),l.style.color===void 0&&(l.style.color="#303133"),l.style.fontSize===void 0&&(l.style.fontSize=13),l.style.bold===void 0&&(l.style.bold=!1),l.style.italic===void 0&&(l.style.italic=!1),l.style.align===void 0&&(l.style.align="left"),l.style.border===void 0&&(l.style.border=Fe()),l.bindEnabled===void 0&&(l.bindEnabled=!1),l.bindField===void 0&&(l.bindField=""),l.hideLabel===void 0&&(l.hideLabel=!1),l.bindEnabled&&(l.text="",l.value="")}function ze(t){const o=[];for(const l of t||[])if(l.type==="text"&&l.bindEnabled)o.push({field:l.bindField,label:l.label||""});else if(l.type==="row"&&l.cells)for(const a of l.cells)a.bindEnabled&&o.push({field:a.bindField,label:a.label||""});return o.filter(l=>l.field)}function ae(t){return!t||t.length===0?[]:(tt(t),lt(t),t)}const Re="sum_";let ce=0;function Oe(){return ce++,Re+String(ce).padStart(4,"0")}function ot(t){const o=j(t),l={color:"#606266",fontSize:13,bold:!1,italic:!1},k={field:Oe(),label:"标签",prefix:"",suffix:"",style:l};return o.hasFormula?{...k,type:o.value,formula:""}:o.hasText?{...k,type:o.value,text:""}:{...k,type:H.MANUAL_INPUT.value,default:0}}function me(t=[]){let o=0;for(const l of t)if(l.field){const a=new RegExp("^"+Re+"(\\d+)$").exec(l.field);a&&(o=Math.max(o,parseInt(a[1],10)))}ce=o;for(const l of t)l.field==null&&(l.field=Oe()),l.prefix===void 0&&(l.prefix=""),l.suffix===void 0&&(l.suffix=""),l.style===void 0&&(l.style={color:"#606266",fontSize:13,bold:!1,italic:!1}),l.style.color===void 0&&(l.style.color="#606266"),l.style.fontSize===void 0&&(l.style.fontSize=13),l.style.bold===void 0&&(l.style.bold=!1),l.style.italic===void 0&&(l.style.italic=!1)}function pe(){return{columns:[],group_rules:{},header_sections:[],footer_sections:[],summary_fields:[]}}function se(t){const o=t&&typeof t=="object"?t:{},l=De(Se(o.columns||[])),a=ne(o.group_rules||{}),k=ae(W(o.header_sections||[])),p=ae(W(o.footer_sections||[])),m=W(o.summary_fields||[]);return me(m),{columns:l,group_rules:a,header_sections:k,footer_sections:p,summary_fields:m}}const nt={class:"qukt-quote-sheet"},it={key:1,class:"qukt-q-divider"},at={key:3,class:"qukt-q-row"},st={key:0,class:"qukt-q-table-wrap"},rt={class:"qukt-q-table"},dt={key:0,class:"subtotal-row"},ct=["colspan"],mt={class:"subtotal-value"},pt={key:1},ut=["rowspan"],ft={key:0,class:"empty-row"},kt=["colspan"],bt={key:1,class:"qukt-q-summary"},ht={class:"qukt-q-summary-label"},yt={class:"qukt-q-footer"},Et={key:0,class:"qukt-q-divider"},gt={key:2,class:"qukt-q-row"},ue={__name:"QuokitSheet",props:{tpl:{type:Object,default:pe},data:{type:Object,default:()=>({headerData:{},rows:[],footerData:{}})},placeholder:{type:String,default:"-"}},setup(t,{expose:o}){const l=t,a=e.computed(()=>se(l.tpl)),k=e.computed(()=>{var c;return((c=l.data)==null?void 0:c.headerData)||{}}),p=e.computed(()=>{var c;return((c=l.data)==null?void 0:c.footerData)||{}}),m=e.computed(()=>{var c;return((c=l.data)==null?void 0:c.rows)||[]});function N(c,E){return c.bindEnabled&&c.bindField?(E==="footer"?p.value:k.value)[c.bindField]??"":c.text||""}function y(c,E){const r=c.type==="field"&&c.label&&!c.hideLabel;if(c.bindEnabled&&c.bindField){const h=(E==="footer"?p.value:k.value)[c.bindField]??"";return r?c.label+h:h}return c.type==="field"?(r?c.label:"")+(c.value??""):c.text||""}function _(c){const E={width:(c.width||100)+"px"},r=c.cellStyle||{};r.color!=null&&r.color!==""&&(E.color=r.color),r.fontSize!=null&&(E.fontSize=Number(r.fontSize)+"px"),r.bold&&(E.fontWeight="bold"),r.italic&&(E.fontStyle="italic"),r.align&&(E.textAlign=r.align);const u=r.border;if(u)for(const h of["top","bottom","left","right"]){const q=u[h];q&&q.style&&q.width>0&&(E["border-"+h]=`${q.width}px ${q.style} ${q.color||"#dcdfe6"}`)}return E}function d(c){return(Number(c)||0).toFixed(2)}const f=e.computed(()=>a.value.columns.find(c=>I(c.editor).hasFormula));function g(c){var r;const E=((r=f.value)==null?void 0:r.formula)||"quantity * unit_price";return G(E,c)}const U=e.computed(()=>m.value.reduce((c,E)=>c+Number(g(E)||0),0));function A(){let c=U.value;for(const E of a.value.summary_fields)j(E.type).hasDefault&&(c+=L(E));return c}function L(c){return Number(c.default??0)}function D(){const c={group_total:U.value},E=a.value.summary_fields;for(const r of E)j(r.type).hasDefault&&(c[r.field]=L(r));for(const r of E)if(j(r.type).hasFormula&&r.formula)try{c[r.field]=G(r.formula,c)}catch{c[r.field]=0}return c.grand_total=A(),c}function V(c){const E=j(c.type);return E.hasText?c.text||"":E.hasFormula?c.formula?D()[c.field]??0:0:L(c)}function s(c){if(j(c.type).hasText)return c.text||"";const E=Number(V(c))||0,r=Number.isInteger(E)?E:E.toFixed(2);return(c.prefix||"")+r+(c.suffix||"")}const n=e.computed(()=>{const c=m.value.map(q=>({...q})),E=a.value.group_rules;if(!(E!=null&&E.merge_field))return c;const r=[],u=E.merge_field;let h=0;for(;h<c.length;){const q=[c[h]];let w=h+1;for(;w<c.length&&c[w][u]===c[h][u];)q.push(c[w]),w++;if(r.push(...q),(E.show_detail_subtotal??!0)&&c[h][u]!==void 0&&c[h][u]!==null&&c[h][u]!==""){const S=q.reduce((C,z)=>C+Number(g(z)||0),0);r.push({__is_subtotal:!0,__group_key:c[h][u],__group_sum:S})}h=w}return r});function b(c,E){var z,M,$;const r=n.value,u=r[c];if(!u||u.__is_subtotal)return 1;const h=a.value.group_rules,q=h==null?void 0:h.merge_field,w=a.value.columns.find(R=>R.field===E),B=q&&E===q,S=(w==null?void 0:w.merge_on_group)===!0;if(!B&&!S)return 1;const C=(()=>{var T,Q;if(!q)return r.length;const R=u[q];let F=c+1;for(;F<r.length&&((T=r[F])==null?void 0:T[q])===R&&!((Q=r[F])!=null&&Q.__is_subtotal);)F++;return F})();if(B)return c>0&&((z=r[c-1])==null?void 0:z[q])===u[q]&&!((M=r[c-1])!=null&&M.__is_subtotal)?0:C-c;if(S){const R=u[E];if(c>0){const T=r[c-1];if((!q||(T==null?void 0:T[q])===u[q]&&!(T!=null&&T.__is_subtotal))&&(T==null?void 0:T[E])===R)return 0}let F=1;for(let T=c+1;T<C&&(($=r[T])==null?void 0:$[E])===R;T++)F++;return F}return 1}async function i(c=!1){const E=a.value;if(!E||E.columns.length===0){console.warn("[QuokitSheet] exportExcel skipped: template has no columns");return}const r=await Ye(E,l.data||{},c?{layout:"auto-width"}:void 0),u=URL.createObjectURL(r),h=document.createElement("a");h.href=u,h.download=`${Date.now()}.xlsx`,document.body.appendChild(h),h.click(),document.body.removeChild(h),setTimeout(()=>URL.revokeObjectURL(u),100)}function x(c=!1){const E=document.querySelector(".qukt-quote-sheet");if(!E)return;const r=c!==!0,u=window.open("","_blank",r?"width=1200,height=900":"width=900,height=1200");if(!u)return;const h=Array.from(document.styleSheets).map(w=>{try{return Array.from(w.cssRules).map(B=>B.cssText).join(`
|
|
5
5
|
`)}catch{return""}}).join(`
|
|
6
|
-
`),
|
|
6
|
+
`),q=E.outerHTML;u.document.write(`<!doctype html>
|
|
7
7
|
<html><head><meta charset="utf-8"><title>报价单打印</title>
|
|
8
8
|
<style>${h}
|
|
9
|
-
@page { size: ${
|
|
9
|
+
@page { size: ${r?"landscape":"portrait"}; margin: 15mm; }
|
|
10
10
|
body { margin: 0; padding: 20px; background: #fff; }
|
|
11
11
|
@media print { body { padding: 0; } }
|
|
12
|
-
</style></head><body>${_}</body></html>`),p.document.close(),p.onload=()=>{p.print()}}return l({print:O,exportExcel:c}),(u,E)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",ve,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.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(Y)(a))},e.toDisplayString(V(a,"header")),5)):a.type==="divider"?(e.openBlock(),e.createElementBlock("div",et)):a.type==="text"?(e.openBlock(),e.createElementBlock("div",{key:2,class:"qukt-q-text",style:e.normalizeStyle(e.unref(Y)(a))},e.toDisplayString(V(a,"header")),5)):a.type==="row"?(e.openBlock(),e.createElementBlock("div",tt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.cells,(h,_)=>(e.openBlock(),e.createElementBlock("div",{key:_,class:"qukt-q-cell",style:e.normalizeStyle(e.unref(oe)(h))},e.toDisplayString(N(h,"header")),5))),128))])):e.createCommentVNode("",!0)],64))),128)),d.value.columns.length>0?(e.openBlock(),e.createElementBlock("div",lt,[e.createElementVNode("table",ot,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.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(n.value,(a,p)=>{var h,_;return e.openBlock(),e.createElementBlock(e.Fragment,{key:p},[a.__is_subtotal?(e.openBlock(),e.createElementBlock("tr",nt,[e.createElementVNode("td",{colspan:d.value.columns.length-1,class:"subtotal-label"},"小计("+e.toDisplayString(a.__group_key)+")",9,it),e.createElementVNode("td",at,e.toDisplayString(((h=d.value.group_rules)==null?void 0:h.subtotal_prefix)||"")+e.toDisplayString(s(a.__group_sum))+e.toDisplayString(((_=d.value.group_rules)==null?void 0:_.subtotal_suffix)||""),1)])):(e.openBlock(),e.createElementBlock("tr",st,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value.columns,(w,B)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:w.field},[y(n.value.indexOf(a),w.field)>0?(e.openBlock(),e.createElementBlock("td",{key:0,rowspan:y(n.value.indexOf(a),w.field),class:e.normalizeClass({"merged-cell":y(n.value.indexOf(a),w.field)>1}),style:e.normalizeStyle(q(w))},[w.editor===e.unref(W).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(P)(w.editor).hasFormula?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(w.prefix||"")+e.toDisplayString(s(g(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,rt)):e.createCommentVNode("",!0)],64))),128))]))],64)}),128)),n.value.length===0?(e.openBlock(),e.createElementBlock("tr",dt,[e.createElementVNode("td",{colspan:d.value.columns.length,class:"qukt-q-empty"},"(暂无数据)",8,ct)])):e.createCommentVNode("",!0)])])])):e.createCommentVNode("",!0),d.value.summary_fields.length>0?(e.openBlock(),e.createElementBlock("div",mt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value.summary_fields,a=>(e.openBlock(),e.createElementBlock("div",{key:a.field,class:"qukt-q-summary-row"},[e.createElementVNode("span",pt,e.toDisplayString(a.label),1),e.createElementVNode("span",{class:"qukt-q-summary-value",style:e.normalizeStyle(e.unref(Fe)(a))},e.toDisplayString(i(a)),5)]))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",ut,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value.footer_sections,(a,p)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"f"+p},[a.type==="divider"?(e.openBlock(),e.createElementBlock("div",ft)):a.type==="text"?(e.openBlock(),e.createElementBlock("div",{key:1,class:"qukt-q-text",style:e.normalizeStyle(e.unref(Y)(a))},e.toDisplayString(V(a,"footer")),5)):a.type==="row"?(e.openBlock(),e.createElementBlock("div",kt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.cells,(h,_)=>(e.openBlock(),e.createElementBlock("div",{key:_,class:"qukt-q-cell",style:e.normalizeStyle(e.unref(oe)(h))},e.toDisplayString(N(h,"footer")),5))),128))])):e.createCommentVNode("",!0)],64))),128))])])]))}},bt=(o,l)=>{const t=o.__vccOpts||o;for(const[d,b]of l)t[d]=b;return t},ht={class:"qukt-preview-box"},Et={class:"qukt-preview-header"},gt={class:"qukt-preview-title"},yt={class:"qukt-preview-body"},Vt={class:"qukt-preview-footer"},Nt={class:"qukt-preview-json-box"},_t={class:"qukt-preview-header"},qt={class:"qukt-preview-title"},wt={class:"qukt-preview-json-body"},Bt={class:"qukt-preview-footer"},Ae=bt({__name:"QuokitPreview",props:{tpl:{type:Object,required:!0},data:{type:Object,default:()=>({headerData:{},rows:[],footerData:{}})},config:{type:Object,default:()=>({})}},emits:["close"],setup(o,{emit:l}){const t=l,d=e.ref(null),b=e.reactive({open:!1,title:"",text:""});function m(){t("close")}async function r(s){var f;await e.nextTick(),(f=d.value)==null||f.exportExcel(s)}async function V(s){var f;await e.nextTick(),(f=d.value)==null||f.print(s)}function N(s,f){b.title=s,b.text=JSON.stringify(f,null,2),b.open=!0}function q(){navigator.clipboard.writeText(b.text).catch(()=>{})}return(s,f)=>(e.openBlock(),e.createElementBlock("div",{class:"qukt-preview-mask",onClick:e.withModifiers(m,["self"])},[e.createElementVNode("div",ht,[e.createElementVNode("div",Et,[e.createElementVNode("span",gt,e.toDisplayString(o.config.title||"👁️ 总体预览"),1),e.createElementVNode("span",{class:"qukt-preview-close",onClick:m},"✕")]),e.createElementVNode("div",yt,[e.createVNode(me,{ref_key:"sheetRef",ref:d,tpl:o.tpl,data:o.data},null,8,["tpl","data"])]),e.createElementVNode("div",Vt,[o.config.excel!==!1?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("button",{class:"tool-btn",onClick:f[0]||(f[0]=g=>r(!1))},"📤 导出 Excel"),e.createElementVNode("button",{class:"tool-btn",onClick:f[1]||(f[1]=g=>r(!0))},"📤 导出(撑长)")],64)):e.createCommentVNode("",!0),o.config.print!==!1?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("button",{class:"tool-btn",onClick:f[2]||(f[2]=g=>V(!1))},"🖨️ 打印(横)"),e.createElementVNode("button",{class:"tool-btn",onClick:f[3]||(f[3]=g=>V(!0))},"🖨️ 打印(竖)")],64)):e.createCommentVNode("",!0),o.config.json!==!1?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("button",{class:"tool-btn",onClick:f[4]||(f[4]=g=>N("📄 模板 JSON",o.tpl))},"📄 模板 JSON"),e.createElementVNode("button",{class:"tool-btn",onClick:f[5]||(f[5]=g=>N("📦 数据 JSON",o.data))},"📦 数据 JSON")],64)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"tool-btn",onClick:m},"关闭")])]),b.open?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qukt-preview-json-mask",onClick:f[8]||(f[8]=e.withModifiers(g=>b.open=!1,["self"]))},[e.createElementVNode("div",Nt,[e.createElementVNode("div",_t,[e.createElementVNode("span",qt,e.toDisplayString(b.title),1),e.createElementVNode("span",{class:"qukt-preview-close",onClick:f[6]||(f[6]=g=>b.open=!1)},"✕")]),e.createElementVNode("pre",wt,e.toDisplayString(b.text),1),e.createElementVNode("div",Bt,[e.createElementVNode("button",{class:"tool-btn",onClick:q},"📋 复制"),e.createElementVNode("button",{class:"tool-btn",onClick:f[7]||(f[7]=g=>b.open=!1)},"关闭")])])])):e.createCommentVNode("",!0)]))}},[["__scopeId","data-v-8a922e81"]]);function Re(o=[],l={}){const t=e.ref(o||[]),d=e.ref(l||{}),b=e.computed(()=>({columns:t.value,group_rules:d.value}));function m(V){t.value=V||[]}function r(V){d.value=V||{}}return e.reactive({columns:t,groupRules:d,tpl:b,setColumns:m,setGroupRules:r})}function pe(o=[]){const l=e.ref(o||[]);function t(b){l.value=b||[]}function d(){return l.value||[]}return e.reactive({sections:l,setSections:t,toTpl:d})}function Oe(o=[]){const l=e.ref(o||[]);function t(b){l.value=b||[]}function d(){return l.value||[]}return e.reactive({fields:l,setFields:t,toTpl:d})}const xt=["XXXX","YYYY","ZZZZ","WWWW"];function Ie(o,l=3){const t=[],d=xt;for(let b=0;b<l;b++){const m={};for(const r of o){const V=P(r.editor);if(V.editable)if(r.editor===W.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[b%Math.max(N.length,1)]||d[b%d.length]}else m[r.field]=d[b%d.length]}t.push(m)}return t}function ae(o=1100){const l=e.ref(!1);function t(){l.value=window.innerWidth<=o}return e.onMounted(()=>{t(),window.addEventListener("resize",t)}),e.onUnmounted(()=>{window.removeEventListener("resize",t)}),{isNarrow:l}}const $t={class:"qukt-gr-dialog"},Ct={class:"qukt-gr-header"},St={class:"qukt-gr-content"},Dt={class:"qukt-gr-form"},Ft={class:"qukt-gr-form-row"},Tt={class:"qukt-gr-form-row"},Ut={class:"qukt-gr-form-row"},Mt={key:0,class:"qukt-gr-form-row"},zt={key:1,class:"qukt-gr-form-row"},Lt={class:"qukt-gr-form-row"},At={class:"qukt-border-group",style:{flex:"1"}},Rt={class:"qukt-border-item"},Ot={class:"qukt-border-item"},It={class:"qukt-border-item"},Wt={class:"qukt-border-item"},Pt={class:"qukt-gr-form-row"},jt={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(o,{emit:l}){const t=o,d=l,b=()=>({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:b()}),r=e.reactive(m());function V(q){const s=m(),f=R(q||{});if(f.color!==void 0&&(s.color=f.color),f.fontSize!==void 0&&(s.fontSize=f.fontSize),f.bold!==void 0&&(s.bold=f.bold),f.italic!==void 0&&(s.italic=f.italic),f.align!==void 0&&(s.align=f.align),f.width!==void 0&&(s.width=f.width),f.border!==void 0){s.border=R(b());for(const g of["top","bottom","left","right"])f.border[g]&&(s.border[g]={...s.border[g],...f.border[g]})}Object.assign(r,s)}e.watch(()=>t.visible,q=>{q&&V(t.modelValue)},{immediate:!0}),e.watch(r,()=>{d("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)=>o.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qukt-gr-mask",onClick:s[22]||(s[22]=e.withModifiers(f=>q.$emit("close"),["self"]))},[e.createElementVNode("div",$t,[e.createElementVNode("div",Ct,[e.createElementVNode("span",null,e.toDisplayString(o.title),1),e.createElementVNode("button",{class:"qukt-gr-close",onClick:s[0]||(s[0]=f=>q.$emit("close"))},"✕")]),e.createElementVNode("div",St,[e.createElementVNode("div",Dt,[e.createElementVNode("div",Ft,[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]=f=>r.color=f),class:"qukt-color-input"},null,512),[[e.vModelText,r.color]])]),e.createElementVNode("div",Tt,[s[24]||(s[24]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"字号",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":s[2]||(s[2]=f=>r.fontSize=f),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",Ut,[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]=f=>r.bold=f)},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]=f=>r.italic=f)},null,512),[[e.vModelCheckbox,r.italic]])]),o.showWidth?(e.openBlock(),e.createElementBlock("div",Mt,[s[27]||(s[27]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"宽度",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":s[5]||(s[5]=f=>r.width=f),class:"qukt-cell-input",placeholder:"如 33%、auto",style:{flex:"1"}},null,512),[[e.vModelText,r.width]])])):e.createCommentVNode("",!0),o.showAlign?(e.openBlock(),e.createElementBlock("div",zt,[s[29]||(s[29]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"对齐",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":s[6]||(s[6]=f=>r.align=f),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),o.showBorder?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("div",Lt,[s[38]||(s[38]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"边框",-1)),e.createElementVNode("div",At,[e.createElementVNode("div",Rt,[s[31]||(s[31]=e.createElementVNode("span",null,"上",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":s[7]||(s[7]=f=>r.border.top.style=f),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]=f=>r.border.top.width=f),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]=f=>r.border.top.color=f),class:"qukt-color-input"},null,512),[[e.vModelText,r.border.top.color]])]),e.createElementVNode("div",Ot,[s[33]||(s[33]=e.createElementVNode("span",null,"下",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":s[10]||(s[10]=f=>r.border.bottom.style=f),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]=f=>r.border.bottom.width=f),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]=f=>r.border.bottom.color=f),class:"qukt-color-input"},null,512),[[e.vModelText,r.border.bottom.color]])]),e.createElementVNode("div",It,[s[35]||(s[35]=e.createElementVNode("span",null,"左",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":s[13]||(s[13]=f=>r.border.left.style=f),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]=f=>r.border.left.width=f),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]=f=>r.border.left.color=f),class:"qukt-color-input"},null,512),[[e.vModelText,r.border.left.color]])]),e.createElementVNode("div",Wt,[s[37]||(s[37]=e.createElementVNode("span",null,"右",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":s[16]||(s[16]=f=>r.border.right.style=f),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]=f=>r.border.right.width=f),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]=f=>r.border.right.color=f),class:"qukt-color-input"},null,512),[[e.vModelText,r.border.right.color]])])])]),e.createElementVNode("div",Pt,[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]=f=>N("all"))},"四边"),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:s[20]||(s[20]=f=>N("none"))},"无边框")])],64)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",jt,[e.createElementVNode("button",{class:"qukt-btn",onClick:s[21]||(s[21]=f=>q.$emit("close"))},"关闭")])])])):e.createCommentVNode("",!0)}},Qt={class:"qukt-toolbar"},Xt={class:"qukt-btn-group-inline"},Jt={class:"qukt-design-table"},Gt={class:"idx"},Ht=["onUpdate:modelValue"],Yt={class:"qukt-title-group"},Zt=["onUpdate:modelValue"],Kt=["onUpdate:modelValue"],vt=["onUpdate:modelValue"],el=["onUpdate:modelValue"],tl=["value"],ll=["onUpdate:modelValue"],ol=["onUpdate:modelValue"],nl=["onUpdate:modelValue"],il={key:2,class:"qukt-muted"},al={key:3,class:"qukt-muted"},sl={class:"qukt-col-merge"},rl={key:0},dl=["onUpdate:modelValue"],cl={key:1,class:"qukt-muted"},ml=["onClick"],pl=["disabled","onClick"],ul=["disabled","onClick"],fl=["onClick"],kl={__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(o,{emit:l}){const t=Object.values(W),d=o,b=l,{isNarrow:m}=ae(d.breakpoint),r=e.ref([]),V=e.ref({});e.watch(()=>d.columns,k=>{const i=xe(R(k||[]));H(i,r.value)||(r.value=i)},{immediate:!0,deep:!0}),e.watch(()=>d.groupRules,k=>{const i=le(R(k||{}));H(i,V.value)||(V.value=i)},{immediate:!0,deep:!0}),e.watch(r,k=>{b("update:columns",$e(k))},{deep:!0}),e.watch(V,k=>{b("update:groupRules",R(k))},{deep:!0});const N=e.computed(()=>!!V.value.merge_field);function q(){let k=0;for(const i of r.value){const n=/^custom_(\d+)$/.exec(i.field);n&&(k=Math.max(k,parseInt(n[1],10)))}return k+1}function s(k){const i=new Set([...r.value.map(O=>O.field)]),n=P(k);let y;n.defaultFieldBase==="custom"?y="custom_"+String(q()).padStart(4,"0"):y=n.defaultFieldBase;const c=Je(k,He(y,i));r.value.push(c)}function f(k){r.value.splice(k,1)}function g(k,i){const n=k+i;n<0||n>=r.value.length||([r.value[k],r.value[n]]=[r.value[n],r.value[k]])}const D=e.ref(!1),M=e.ref({}),z=e.ref("");function F(k){k.cellStyle||(k.cellStyle={}),M.value=k.cellStyle,z.value=k.title||"单元格样式",D.value=!0}return(k,i)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",Qt,[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",Xt,[e.createElementVNode("button",{class:"qukt-btn",onClick:i[0]||(i[0]=n=>k.$emit("open-group"))},"分组 & 小计"+e.toDisplayString(N.value?" ✓":""),1),e.createElementVNode("button",{class:"qukt-btn",onClick:i[1]||(i[1]=n=>s("INPUT"))},"+ 添加字段"),e.createElementVNode("button",{class:"qukt-btn",onClick:i[2]||(i[2]=n=>k.$emit("help"))},"帮助")])]),e.createElementVNode("div",{class:e.normalizeClass(["qukt-table-wrap",{"is-narrow":e.unref(m)}])},[e.createElementVNode("table",Jt,[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,(n,y)=>(e.openBlock(),e.createElementBlock("tr",{key:y},[e.createElementVNode("td",Gt,e.toDisplayString(y+1),1),e.createElementVNode("td",null,[e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input","onUpdate:modelValue":c=>n.field=c},null,8,Ht),[[e.vModelText,n.field]])]),e.createElementVNode("td",null,[e.createElementVNode("div",Yt,[e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input pref-suf","onUpdate:modelValue":c=>n.prefix=c,placeholder:"前"},null,8,Zt),[[e.vModelText,n.prefix]]),e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input","onUpdate:modelValue":c=>n.title=c,placeholder:"列标题"},null,8,Kt),[[e.vModelText,n.title]]),e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input pref-suf","onUpdate:modelValue":c=>n.suffix=c,placeholder:"后"},null,8,vt),[[e.vModelText,n.suffix]])])]),e.createElementVNode("td",null,[e.withDirectives(e.createElementVNode("select",{class:"qukt-cell-input","onUpdate:modelValue":c=>n.editor=c},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(t),c=>(e.openBlock(),e.createElementBlock("option",{key:c.value,value:c.value},e.toDisplayString(c.label),9,tl))),128))],8,el),[[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":c=>n.width=c},null,8,ll),[[e.vModelText,n.width,void 0,{number:!0}]])]),e.createElementVNode("td",null,[e.unref(P)(n.editor).hasDict?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,class:"qukt-cell-input","onUpdate:modelValue":c=>n.dictStr=c,placeholder:"下拉选项,逗号分隔 如:设备,材料,安装"},null,8,ol)),[[e.vModelText,n.dictStr]]):e.unref(P)(n.editor).hasFormula?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:1,class:"qukt-cell-input","onUpdate:modelValue":c=>n.formula=c,placeholder:"公式,如 quantity * unit_price + tax"},null,8,nl)),[[e.vModelText,n.formula]]):n.editor===e.unref(W).AUTO_SEQ.value?(e.openBlock(),e.createElementBlock("span",il,"自动生成序号,无需配置")):(e.openBlock(),e.createElementBlock("span",al,"-"))]),e.createElementVNode("td",sl,[e.unref(P)(n.editor).canMerge?(e.openBlock(),e.createElementBlock("label",rl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":c=>n.merge_on_group=c},null,8,dl),[[e.vModelCheckbox,n.merge_on_group]]),i[6]||(i[6]=e.createElementVNode("span",null,"相同值合并",-1))])):(e.openBlock(),e.createElementBlock("span",cl,"—"))]),e.createElementVNode("td",null,[e.createElementVNode("button",{class:"qukt-mini-btn",onClick:c=>F(n)},"样式",8,ml)]),e.createElementVNode("td",null,[e.createElementVNode("button",{class:"qukt-mini-btn",disabled:y===0,onClick:c=>g(y,-1)},"↑",8,pl),e.createElementVNode("button",{class:"qukt-mini-btn",disabled:y>=r.value.length-1,onClick:c=>g(y,1)},"↓",8,ul),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:c=>f(y)},"删",8,fl)])]))),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]=n=>Object.assign(M.value,n)),onClose:i[4]||(i[4]=n=>D.value=!1)},null,8,["visible","modelValue","title"])]))}},bl={class:"qukt-gr-dialog"},hl={class:"qukt-gr-header"},El={class:"qukt-gr-content"},gl={class:"qukt-gr-form"},yl={class:"qukt-gr-form-row"},Vl=["value","disabled"],Nl={class:"qukt-gr-form-row"},_l={class:"qukt-gr-form-row"},ql={class:"qukt-gr-form-row"},wl={class:"qukt-gr-footer"},Bl={__name:"GroupDialog",props:{visible:{type:Boolean,default:!1},columns:{type:Array,default:()=>[]},groupRules:{type:Object,default:()=>({})}},emits:["close","update:groupRules"],setup(o,{emit:l}){const t=o,d=l,b=e.reactive({merge_field:"",show_detail_subtotal:!0,subtotal_prefix:"",subtotal_suffix:""});return e.watch(()=>t.groupRules,m=>{const r=le(R(m||{}));b.merge_field=r.merge_field||"",b.show_detail_subtotal=r.show_detail_subtotal??!0,b.subtotal_prefix=r.subtotal_prefix??"",b.subtotal_suffix=r.subtotal_suffix??""},{immediate:!0,deep:!0}),e.watch(b,()=>{d("update:groupRules",R(le({merge_field:b.merge_field,show_detail_subtotal:b.show_detail_subtotal,subtotal_prefix:b.subtotal_prefix,subtotal_suffix:b.subtotal_suffix})))},{deep:!0}),(m,r)=>o.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",bl,[e.createElementVNode("div",hl,[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",El,[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",gl,[e.createElementVNode("div",yl,[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=>b.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(o.columns,V=>(e.openBlock(),e.createElementBlock("option",{key:V.field,value:V.field,disabled:!e.unref(P)(V.editor).editable},e.toDisplayString(V.title)+"("+e.toDisplayString(V.field)+")",9,Vl))),128))],512),[[e.vModelSelect,b.merge_field]])]),e.createElementVNode("div",Nl,[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=>b.show_detail_subtotal=V)},null,512),[[e.vModelCheckbox,b.show_detail_subtotal]])]),e.createElementVNode("div",_l,[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=>b.subtotal_prefix=V),placeholder:"如 ¥、¥",style:{flex:"1"}},null,512),[[e.vModelText,b.subtotal_prefix]])]),e.createElementVNode("div",ql,[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=>b.subtotal_suffix=V),placeholder:"如 元、RMB",style:{flex:"1"}},null,512),[[e.vModelText,b.subtotal_suffix]])])])]),e.createElementVNode("div",wl,[e.createElementVNode("button",{class:"qukt-btn",onClick:r[5]||(r[5]=V=>m.$emit("close"))},"关闭")])])])):e.createCommentVNode("",!0)}},xl={class:"qukt-toolbar"},$l={class:"qukt-col-left"},Cl={class:"qukt-sec-header"},Sl={class:"qukt-sec-type"},Dl={class:"qukt-sec-actions"},Fl=["disabled","onClick"],Tl=["disabled","onClick"],Ul=["onClick"],Ml={class:"qukt-sec-row"},zl=["onUpdate:modelValue"],Ll={class:"qukt-sec-row"},Al=["checked","onChange"],Rl={key:0,class:"qukt-sec-row"},Ol=["onUpdate:modelValue"],Il={key:1,class:"qukt-sec-row"},Wl=["onUpdate:modelValue"],Pl={class:"qukt-sec-row"},jl=["onClick"],Ql={class:"qukt-cells-list"},Xl={class:"qukt-cell-toolbar"},Jl=["onClick"],Gl={class:"qukt-sec-row"},Hl=["onUpdate:modelValue"],Yl={key:0,class:"qukt-sec-row"},Zl=["onUpdate:modelValue"],Kl={class:"qukt-chk-label"},vl=["onUpdate:modelValue"],eo={class:"qukt-sec-row"},to=["checked","onChange"],lo={key:1,class:"qukt-sec-row"},oo=["onUpdate:modelValue"],no={key:0,class:"qukt-sec-row"},io=["onUpdate:modelValue"],ao={key:1,class:"qukt-sec-row"},so=["onUpdate:modelValue"],ro={class:"qukt-sec-row"},co=["onClick"],mo=["onClick"],po={class:"qukt-col-right"},uo={class:"qukt-preview-box"},fo={class:"qukt-preview-inner"},ko={key:1,class:"qukt-p-divider"},bo={key:3,class:"qukt-p-row"},ho={key:0,class:"qukt-p-label"},Eo={class:"qukt-p-value qukt-p-bind-placeholder"},go={key:1,class:"qukt-p-value qukt-p-bind-placeholder"},yo={key:0,class:"qukt-p-label"},Vo={class:"qukt-p-value"},We="hdr_",No={__name:"DesignHeader",props:{sections:{type:Array,default:()=>[]},breakpoint:{type:Number,default:1100}},emits:["update:sections"],setup(o,{emit:l}){const t=o,d=l,{isNarrow:b}=ae(t.breakpoint),m=e.ref([]);e.watch(()=>t.sections,k=>{const i=ne(R(k||[]));H(i,m.value)||(m.value=i)},{immediate:!0}),e.watch(m,k=>{d("update:sections",R(k))},{deep:!0});const r=e.ref(!1),V=e.ref({}),N=e.reactive({title:"样式配置",showBorder:!1,showAlign:!0,showWidth:!1});function q(k,i){V.value=k,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(k){k==="divider"?m.value.push({type:k}):k==="text"?m.value.push({type:k,label:"标签:",text:"纯文本内容",style:{color:"#303133",fontSize:14,bold:!1,italic:!1,align:"left"},bindEnabled:!1,bindField:""}):k==="row"&&m.value.push({type:k,cells:[{type:"field",label:"标签:",bindEnabled:!1,bindField:"",hideLabel:!1,style:K("50%")}]})}function f(k){m.value.splice(k,1)}function g(k,i){const n=k+i;n<0||n>=m.value.length||([m.value[k],m.value[n]]=[m.value[n],m.value[k]])}function D(k){k.cells||(k.cells=[]),k.cells.push({type:"field",label:"标签:",bindEnabled:!1,bindField:"",hideLabel:!1,style:K("33%")})}function M(k,i){k.cells.splice(i,1)}const z=k=>Te(k,We,m.value),F=k=>Ue(k,We,m.value);return(k,i)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",xl,[i[5]||(i[5]=e.createElementVNode("span",{class:"qukt-tip"},"这里定义报价单的大标题、项目信息行等,左侧是设计器,右侧实时预览",-1)),e.createElementVNode("button",{class:"qukt-btn",onClick:i[0]||(i[0]=n=>s("row"))},"+ 字段行"),e.createElementVNode("button",{class:"qukt-btn",onClick:i[1]||(i[1]=n=>s("divider"))},"+ 分隔线"),e.createElementVNode("button",{class:"qukt-btn",onClick:i[2]||(i[2]=n=>s("text"))},"+ 纯文本")]),e.createElementVNode("div",{class:e.normalizeClass(["qukt-two-col",{"is-narrow":e.unref(b)}])},[e.createElementVNode("div",$l,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,(n,y)=>(e.openBlock(),e.createElementBlock("div",{key:y,class:e.normalizeClass(["qukt-sec-block",{"qukt-sec-block--divider":n.type==="divider"}])},[e.createElementVNode("div",Cl,[e.createElementVNode("span",Sl,e.toDisplayString(n.type==="row"?"字段行":n.type==="divider"?"分隔线":"纯文本"),1),e.createElementVNode("div",Dl,[e.createElementVNode("button",{class:"qukt-mini-btn",disabled:y===0,onClick:c=>g(y,-1)},"↑",8,Fl),e.createElementVNode("button",{class:"qukt-mini-btn",disabled:y>=m.value.length-1,onClick:c=>g(y,1)},"↓",8,Tl),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:c=>f(y)},"删",8,Ul)])]),n.type==="text"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",Ml,[i[6]||(i[6]=e.createElementVNode("label",null,"标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>n.label=c,class:"qukt-cell-input",placeholder:"填写数据时用的提示"},null,8,zl),[[e.vModelText,n.label]])]),e.createElementVNode("div",Ll,[i[7]||(i[7]=e.createElementVNode("label",null,"暴露",-1)),e.createElementVNode("input",{type:"checkbox",checked:n.bindEnabled,onChange:c=>z(n)},null,40,Al)]),n.bindEnabled?(e.openBlock(),e.createElementBlock("div",Rl,[i[8]||(i[8]=e.createElementVNode("label",null,"字段名",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>n.bindField=c,class:"qukt-cell-input",placeholder:"如 salesman"},null,8,Ol),[[e.vModelText,n.bindField]])])):e.createCommentVNode("",!0),n.bindEnabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Il,[i[9]||(i[9]=e.createElementVNode("label",null,"文字",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>n.text=c,class:"qukt-cell-input"},null,8,Wl),[[e.vModelText,n.text]])])),e.createElementVNode("div",Pl,[i[10]||(i[10]=e.createElementVNode("label",null,"样式",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:c=>q(n.style,"text")},"设置",8,jl)])],64)):n.type==="row"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",Ql,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.cells,(c,O)=>(e.openBlock(),e.createElementBlock("div",{key:O,class:"qukt-cell-block"},[e.createElementVNode("div",Xl,[e.createElementVNode("strong",null,e.toDisplayString(O+1),1),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:u=>M(n,O)},"×",8,Jl)]),e.createElementVNode("div",Gl,[i[12]||(i[12]=e.createElementVNode("label",null,"类型",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":u=>c.type=u,class:"qukt-cell-input small"},[...i[11]||(i[11]=[e.createElementVNode("option",{value:"field"},"字段(可编辑)",-1),e.createElementVNode("option",{value:"text"},"纯文本",-1)])],8,Hl),[[e.vModelSelect,c.type]])]),c.type==="field"?(e.openBlock(),e.createElementBlock("div",Yl,[i[14]||(i[14]=e.createElementVNode("label",null,"标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":u=>c.label=u,class:"qukt-cell-input",placeholder:"标签"},null,8,Zl),[[e.vModelText,c.label]]),e.createElementVNode("label",Kl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":u=>c.hideLabel=u},null,8,vl),[[e.vModelCheckbox,c.hideLabel]]),i[13]||(i[13]=e.createTextVNode(" 隐藏 ",-1))])])):e.createCommentVNode("",!0),e.createElementVNode("div",eo,[i[15]||(i[15]=e.createElementVNode("label",null,"暴露",-1)),e.createElementVNode("input",{type:"checkbox",checked:c.bindEnabled,onChange:u=>F(c)},null,40,to)]),c.bindEnabled?(e.openBlock(),e.createElementBlock("div",lo,[i[16]||(i[16]=e.createElementVNode("label",null,"字段名",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":u=>c.bindField=u,class:"qukt-cell-input",placeholder:"如 salesman"},null,8,oo),[[e.vModelText,c.bindField]])])):e.createCommentVNode("",!0),c.bindEnabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[c.type==="field"?(e.openBlock(),e.createElementBlock("div",no,[i[17]||(i[17]=e.createElementVNode("label",null,"值",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":u=>c.value=u,class:"qukt-cell-input",placeholder:"字段的值"},null,8,io),[[e.vModelText,c.value]])])):e.createCommentVNode("",!0),c.type==="text"?(e.openBlock(),e.createElementBlock("div",ao,[i[18]||(i[18]=e.createElementVNode("label",null,"文字",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":u=>c.text=u,class:"qukt-cell-input"},null,8,so),[[e.vModelText,c.text]])])):e.createCommentVNode("",!0)],64)),e.createElementVNode("div",ro,[i[19]||(i[19]=e.createElementVNode("label",null,"样式",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:u=>q(c.style,"cell")},"设置",8,co)])]))),128))]),e.createElementVNode("button",{class:"qukt-btn qukt-btn-ghost",onClick:c=>D(n)},"+ 添加一个单元格",8,mo)],64)):e.createCommentVNode("",!0)],2))),128))]),e.createElementVNode("div",po,[e.createElementVNode("div",uo,[i[20]||(i[20]=e.createElementVNode("div",{class:"qukt-preview-label"},"实时预览",-1)),e.createElementVNode("div",fo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,(n,y)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:y},[n.type==="title"?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qukt-p-title",style:e.normalizeStyle(e.unref(Y)(n))},e.toDisplayString(n.bindEnabled?n.bindField||"待绑定":n.text||"大标题"),5)):n.type==="divider"?(e.openBlock(),e.createElementBlock("div",ko)):n.type==="text"?(e.openBlock(),e.createElementBlock("div",{key:2,class:"qukt-p-text",style:e.normalizeStyle(e.unref(Y)(n))},e.toDisplayString(n.bindEnabled?n.bindField||"待绑定":n.text||"纯文本"),5)):n.type==="row"?(e.openBlock(),e.createElementBlock("div",bo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.cells,(c,O)=>(e.openBlock(),e.createElementBlock("div",{key:O,class:"qukt-p-cell",style:e.normalizeStyle(e.unref(oe)(c))},[c.bindEnabled?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[c.type==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[c.label&&!c.hideLabel?(e.openBlock(),e.createElementBlock("span",ho,e.toDisplayString(c.label),1)):e.createCommentVNode("",!0),e.createElementVNode("span",Eo,e.toDisplayString(c.bindField||"待绑定"),1)],64)):(e.openBlock(),e.createElementBlock("span",go,e.toDisplayString(c.bindField||"待绑定"),1))],64)):c.type==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[c.label&&!c.hideLabel?(e.openBlock(),e.createElementBlock("span",yo,e.toDisplayString(c.label),1)):e.createCommentVNode("",!0),e.createElementVNode("span",Vo,e.toDisplayString(c.value||"字段值"),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(c.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]=n=>Object.assign(V.value,n)),onClose:i[4]||(i[4]=n=>r.value=!1)},null,8,["visible","modelValue","showBorder","showAlign","showWidth","title"])]))}},_o={class:"qukt-toolbar"},qo={class:"qukt-col-left"},wo={class:"qukt-sec-header"},Bo={class:"qukt-sec-type"},xo={class:"qukt-sec-actions"},$o=["disabled","onClick"],Co=["disabled","onClick"],So=["onClick"],Do={class:"qukt-cells-list"},Fo={class:"qukt-cell-toolbar"},To=["onClick"],Uo={class:"qukt-sec-row"},Mo=["onUpdate:modelValue"],zo={key:0,class:"qukt-sec-row"},Lo=["onUpdate:modelValue"],Ao={class:"qukt-chk-label"},Ro=["onUpdate:modelValue"],Oo={class:"qukt-sec-row"},Io=["checked","onChange"],Wo={key:1,class:"qukt-sec-row"},Po=["onUpdate:modelValue"],jo={key:0,class:"qukt-sec-row"},Qo=["onUpdate:modelValue"],Xo={key:1,class:"qukt-sec-row"},Jo=["onUpdate:modelValue"],Go={class:"qukt-sec-row"},Ho=["onClick"],Yo=["onClick"],Zo={class:"qukt-sec-row"},Ko=["onUpdate:modelValue"],vo={class:"qukt-sec-row"},en=["checked","onChange"],tn={key:0,class:"qukt-sec-row"},ln=["onUpdate:modelValue"],on={key:1,class:"qukt-sec-row"},nn=["onUpdate:modelValue"],an={class:"qukt-sec-row"},sn=["onClick"],rn={class:"qukt-col-right"},dn={class:"qukt-preview-box"},cn={class:"qukt-preview-inner"},mn={key:0,class:"qukt-p-divider"},pn={key:2,class:"qukt-p-row"},un={key:0,class:"qukt-p-label"},fn={class:"qukt-p-value qukt-p-bind-placeholder"},kn={key:1,class:"qukt-p-value qukt-p-bind-placeholder"},bn={key:0,class:"qukt-p-label"},hn={class:"qukt-p-value"},Pe="ftr_",En={__name:"DesignFooter",props:{sections:{type:Array,default:()=>[]},breakpoint:{type:Number,default:1100}},emits:["update:sections"],setup(o,{emit:l}){const t=o,d=l,{isNarrow:b}=ae(t.breakpoint),m=e.ref([]);e.watch(()=>t.sections,k=>{const i=ne(R(k||[]));H(i,m.value)||(m.value=i)},{immediate:!0}),e.watch(m,k=>{d("update:sections",R(k))},{deep:!0});const r=e.ref(!1),V=e.ref({}),N=e.reactive({title:"样式配置",showBorder:!1,showAlign:!0,showWidth:!1});function q(k,i){V.value=k,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(k){k==="divider"?m.value.push({type:k}):k==="text"?m.value.push({type:k,label:"标签:",text:"纯文本",style:{color:"#303133",fontSize:14,bold:!1,italic:!1,align:"left"},bindEnabled:!1,bindField:""}):k==="row"&&m.value.push({type:k,cells:[{type:"field",label:"标签:",bindEnabled:!1,bindField:"",hideLabel:!1,style:K("50%")}]})}function f(k){m.value.splice(k,1)}function g(k,i){const n=k+i;n<0||n>=m.value.length||([m.value[k],m.value[n]]=[m.value[n],m.value[k]])}function D(k){k.cells||(k.cells=[]),k.cells.push({type:"field",label:"标签:",bindEnabled:!1,bindField:"",hideLabel:!1,style:K("50%")})}function M(k,i){k.cells.splice(i,1)}const z=k=>Te(k,Pe,m.value),F=k=>Ue(k,Pe,m.value);return(k,i)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",_o,[i[5]||(i[5]=e.createElementVNode("span",{class:"qukt-tip"},"页面底部显示签字栏、盖章区等,结构和页面头部一样",-1)),e.createElementVNode("button",{class:"qukt-btn",onClick:i[0]||(i[0]=n=>s("divider"))},"+ 分隔线"),e.createElementVNode("button",{class:"qukt-btn",onClick:i[1]||(i[1]=n=>s("row"))},"+ 字段行"),e.createElementVNode("button",{class:"qukt-btn",onClick:i[2]||(i[2]=n=>s("text"))},"+ 纯文本")]),e.createElementVNode("div",{class:e.normalizeClass(["qukt-two-col",{"is-narrow":e.unref(b)}])},[e.createElementVNode("div",qo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,(n,y)=>(e.openBlock(),e.createElementBlock("div",{key:y,class:e.normalizeClass(["qukt-sec-block",{"qukt-sec-block--divider":n.type==="divider"}])},[e.createElementVNode("div",wo,[e.createElementVNode("span",Bo,e.toDisplayString(n.type==="row"?"字段行":n.type==="divider"?"分隔线":"纯文本"),1),e.createElementVNode("div",xo,[e.createElementVNode("button",{class:"qukt-mini-btn",disabled:y===0,onClick:c=>g(y,-1)},"↑",8,$o),e.createElementVNode("button",{class:"qukt-mini-btn",disabled:y>=m.value.length-1,onClick:c=>g(y,1)},"↓",8,Co),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:c=>f(y)},"删",8,So)])]),n.type==="row"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",Do,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.cells,(c,O)=>(e.openBlock(),e.createElementBlock("div",{key:O,class:"qukt-cell-block"},[e.createElementVNode("div",Fo,[e.createElementVNode("strong",null,e.toDisplayString(O+1),1),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:u=>M(n,O)},"×",8,To)]),e.createElementVNode("div",Uo,[i[7]||(i[7]=e.createElementVNode("label",null,"类型",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":u=>c.type=u,class:"qukt-cell-input small"},[...i[6]||(i[6]=[e.createElementVNode("option",{value:"field"},"字段(可编辑)",-1),e.createElementVNode("option",{value:"text"},"纯文本",-1)])],8,Mo),[[e.vModelSelect,c.type]])]),c.type==="field"?(e.openBlock(),e.createElementBlock("div",zo,[i[9]||(i[9]=e.createElementVNode("label",null,"标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":u=>c.label=u,class:"qukt-cell-input",placeholder:"标签"},null,8,Lo),[[e.vModelText,c.label]]),e.createElementVNode("label",Ao,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":u=>c.hideLabel=u},null,8,Ro),[[e.vModelCheckbox,c.hideLabel]]),i[8]||(i[8]=e.createTextVNode(" 隐藏 ",-1))])])):e.createCommentVNode("",!0),e.createElementVNode("div",Oo,[i[10]||(i[10]=e.createElementVNode("label",null,"对外暴露",-1)),e.createElementVNode("input",{type:"checkbox",checked:c.bindEnabled,onChange:u=>F(c)},null,40,Io)]),c.bindEnabled?(e.openBlock(),e.createElementBlock("div",Wo,[i[11]||(i[11]=e.createElementVNode("label",null,"字段名",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":u=>c.bindField=u,class:"qukt-cell-input",placeholder:"如 company_name"},null,8,Po),[[e.vModelText,c.bindField]])])):e.createCommentVNode("",!0),c.bindEnabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[c.type==="field"?(e.openBlock(),e.createElementBlock("div",jo,[i[12]||(i[12]=e.createElementVNode("label",null,"值",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":u=>c.value=u,class:"qukt-cell-input",placeholder:"字段的值"},null,8,Qo),[[e.vModelText,c.value]])])):e.createCommentVNode("",!0),c.type==="text"?(e.openBlock(),e.createElementBlock("div",Xo,[i[13]||(i[13]=e.createElementVNode("label",null,"文字",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":u=>c.text=u,class:"qukt-cell-input"},null,8,Jo),[[e.vModelText,c.text]])])):e.createCommentVNode("",!0)],64)),e.createElementVNode("div",Go,[i[14]||(i[14]=e.createElementVNode("label",null,"样式",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:u=>q(c.style,"cell")},"设置",8,Ho)])]))),128))]),e.createElementVNode("button",{class:"qukt-btn qukt-btn-ghost",onClick:c=>D(n)},"+ 添加一个单元格",8,Yo)],64)):n.type==="text"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",Zo,[i[15]||(i[15]=e.createElementVNode("label",null,"标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>n.label=c,class:"qukt-cell-input",placeholder:"填写数据时用的提示"},null,8,Ko),[[e.vModelText,n.label]])]),e.createElementVNode("div",vo,[i[16]||(i[16]=e.createElementVNode("label",null,"暴露",-1)),e.createElementVNode("input",{type:"checkbox",checked:n.bindEnabled,onChange:c=>z(n)},null,40,en)]),n.bindEnabled?(e.openBlock(),e.createElementBlock("div",tn,[i[17]||(i[17]=e.createElementVNode("label",null,"字段名",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>n.bindField=c,class:"qukt-cell-input",placeholder:"如 company_name"},null,8,ln),[[e.vModelText,n.bindField]])])):e.createCommentVNode("",!0),n.bindEnabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",on,[i[18]||(i[18]=e.createElementVNode("label",null,"文字",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>n.text=c,class:"qukt-cell-input"},null,8,nn),[[e.vModelText,n.text]])])),e.createElementVNode("div",an,[i[19]||(i[19]=e.createElementVNode("label",null,"样式",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:c=>q(n.style,"text")},"设置",8,sn)])],64)):e.createCommentVNode("",!0)],2))),128))]),e.createElementVNode("div",rn,[e.createElementVNode("div",dn,[i[20]||(i[20]=e.createElementVNode("div",{class:"qukt-preview-label"},"底部预览",-1)),e.createElementVNode("div",cn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,(n,y)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:y},[n.type==="divider"?(e.openBlock(),e.createElementBlock("div",mn)):n.type==="text"?(e.openBlock(),e.createElementBlock("div",{key:1,class:"qukt-p-text",style:e.normalizeStyle(e.unref(Y)(n))},e.toDisplayString(n.bindEnabled?n.bindField||"待绑定":n.text||"纯文本"),5)):n.type==="row"?(e.openBlock(),e.createElementBlock("div",pn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.cells,(c,O)=>(e.openBlock(),e.createElementBlock("div",{key:O,class:"qukt-p-cell",style:e.normalizeStyle(e.unref(oe)(c))},[c.bindEnabled?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[c.type==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[c.label&&!c.hideLabel?(e.openBlock(),e.createElementBlock("span",un,e.toDisplayString(c.label),1)):e.createCommentVNode("",!0),e.createElementVNode("span",fn,e.toDisplayString(c.bindField||"待绑定"),1)],64)):(e.openBlock(),e.createElementBlock("span",kn,e.toDisplayString(c.bindField||"待绑定"),1))],64)):c.type==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[c.label&&!c.hideLabel?(e.openBlock(),e.createElementBlock("span",bn,e.toDisplayString(c.label),1)):e.createCommentVNode("",!0),e.createElementVNode("span",hn,e.toDisplayString(c.value||"字段值"),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(c.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]=n=>Object.assign(V.value,n)),onClose:i[4]||(i[4]=n=>r.value=!1)},null,8,["visible","modelValue","showBorder","showAlign","showWidth","title"])]))}},gn={class:"qukt-col-left"},yn={class:"qukt-sec-header"},Vn={class:"qukt-sec-type"},Nn={class:"qukt-sec-actions"},_n=["disabled","onClick"],qn=["disabled","onClick"],wn=["onClick"],Bn={class:"qukt-sec-row"},xn=["onUpdate:modelValue"],$n=["value"],Cn={class:"qukt-sec-row"},Sn=["onUpdate:modelValue"],Dn={class:"qukt-sec-row"},Fn=["onUpdate:modelValue"],Tn={class:"qukt-sec-row"},Un=["onUpdate:modelValue"],Mn={class:"qukt-sec-row"},zn=["onUpdate:modelValue"],Ln={key:0,class:"qukt-sec-row"},An=["onUpdate:modelValue"],Rn={key:1,class:"qukt-sec-row"},On=["onUpdate:modelValue"],In={key:2,class:"qukt-sec-row"},Wn=["onUpdate:modelValue"],Pn={class:"qukt-sec-row"},jn=["onClick"],Qn={key:0,class:"qukt-q-empty"},Xn={class:"qukt-col-right"},Jn={class:"qukt-preview-box"},Gn={class:"qukt-preview-inner"},Hn={key:0,class:"qukt-empty-hint"},Yn={key:1,class:"qukt-summary-preview"},Zn={class:"qukt-sp-label"},Kn={key:2,class:"qukt-preview-help"},vn={__name:"DesignSummary",props:{fields:{type:Array,default:()=>[]},breakpoint:{type:Number,default:1100}},emits:["update:fields"],setup(o,{emit:l}){const t=Object.values(G),d=o,b=l,{isNarrow:m}=ae(d.breakpoint),r=e.ref([]);e.watch(()=>d.fields,i=>{const n=R(i||[]);de(n),!H(n,r.value)&&(r.value=n)},{immediate:!0}),e.watch(r,i=>{const n=R(i);de(n),b("update:fields",n)},{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 f={group_total:1e4},g=e.computed(()=>{const i={...f};for(const n of r.value)j(n.type).hasDefault&&(i[n.field]=Number(n.default??0));for(const n of r.value)if(j(n.type).hasFormula&&n.formula)try{i[n.field]=J(n.formula,i)}catch{i[n.field]=0}return i});function D(i){return j(i).label}function M(i){const n=j(i.type);if(n.hasText)return i.text||"";let y;n.hasFormula?y=Number(g.value[i.field])||0:y=Number(i.default)||0;const c=Number.isInteger(y)?y:y.toFixed(2);return(i.prefix||"")+c+(i.suffix||"")}function z(){r.value.push(Ke(G.AUTO_CALC.value))}function F(i){r.value.splice(i,1)}function k(i,n){const y=i+n;y<0||y>=r.value.length||([r.value[i],r.value[y]]=[r.value[y],r.value[i]])}return(i,n)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",{class:"qukt-toolbar"},[n[2]||(n[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",gn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,y=>(e.openBlock(),e.createElementBlock("div",{key:y.field,class:"qukt-sec-block"},[e.createElementVNode("div",yn,[e.createElementVNode("span",Vn,e.toDisplayString(D(y.type)),1),e.createElementVNode("div",Nn,[e.createElementVNode("button",{class:"qukt-mini-btn",disabled:V(y)===0,onClick:c=>k(V(y),-1)},"↑",8,_n),e.createElementVNode("button",{class:"qukt-mini-btn",disabled:V(y)>=r.value.length-1,onClick:c=>k(V(y),1)},"↓",8,qn),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:c=>F(V(y))},"删",8,wn)])]),e.createElementVNode("div",Bn,[n[3]||(n[3]=e.createElementVNode("label",null,"类型",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":c=>y.type=c,class:"qukt-cell-input"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(t),c=>(e.openBlock(),e.createElementBlock("option",{key:c.value,value:c.value},e.toDisplayString(c.label),9,$n))),128))],8,xn),[[e.vModelSelect,y.type]])]),e.createElementVNode("div",Cn,[n[4]||(n[4]=e.createElementVNode("label",null,"标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>y.label=c,class:"qukt-cell-input",placeholder:"如 合计、税后、业务员抽成"},null,8,Sn),[[e.vModelText,y.label]])]),e.createElementVNode("div",Dn,[n[5]||(n[5]=e.createElementVNode("label",null,"字段名",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>y.field=c,class:"qukt-cell-input",placeholder:"如 subtotal、tax (其他行公式可引用)"},null,8,Fn),[[e.vModelText,y.field]])]),e.createElementVNode("div",Tn,[n[6]||(n[6]=e.createElementVNode("label",null,"前缀",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>y.prefix=c,class:"qukt-cell-input",placeholder:"如 ¥、¥"},null,8,Un),[[e.vModelText,y.prefix]])]),e.createElementVNode("div",Mn,[n[7]||(n[7]=e.createElementVNode("label",null,"后缀",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>y.suffix=c,class:"qukt-cell-input",placeholder:"如 %"},null,8,zn),[[e.vModelText,y.suffix]])]),e.unref(j)(y.type).hasFormula?(e.openBlock(),e.createElementBlock("div",Ln,[n[8]||(n[8]=e.createElementVNode("label",null,"公式",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>y.formula=c,class:"qukt-cell-input",placeholder:"如 group_total * 0.01 + group_total"},null,8,An),[[e.vModelText,y.formula]])])):e.unref(j)(y.type).hasDefault?(e.openBlock(),e.createElementBlock("div",Rn,[n[9]||(n[9]=e.createElementVNode("label",null,"默认值",-1)),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":c=>y.default=c,class:"qukt-cell-input",placeholder:"默认值"},null,8,On),[[e.vModelText,y.default,void 0,{number:!0}]])])):e.unref(j)(y.type).hasText?(e.openBlock(),e.createElementBlock("div",In,[n[10]||(n[10]=e.createElementVNode("label",null,"显示文本",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>y.text=c,class:"qukt-cell-input",placeholder:"显示文本"},null,8,Wn),[[e.vModelText,y.text]])])):e.createCommentVNode("",!0),e.createElementVNode("div",Pn,[n[11]||(n[11]=e.createElementVNode("label",null,"样式",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:c=>s(y.style)},"设置",8,jn)])]))),128)),r.value.length===0?(e.openBlock(),e.createElementBlock("div",Qn,"还没有汇总行,点上方按钮添加")):e.createCommentVNode("",!0)]),e.createElementVNode("div",Xn,[e.createElementVNode("div",Jn,[n[13]||(n[13]=e.createElementVNode("div",{class:"qukt-preview-label"},"汇总预览",-1)),e.createElementVNode("div",Gn,[r.value.length===0?(e.openBlock(),e.createElementBlock("div",Hn,"暂无汇总字段")):(e.openBlock(),e.createElementBlock("div",Yn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,y=>(e.openBlock(),e.createElementBlock("div",{key:y.field,class:"qukt-sp-row"},[e.createElementVNode("span",Zn,e.toDisplayString(y.label||"标签"),1),e.createElementVNode("span",{class:"qukt-sp-value",style:e.normalizeStyle(e.unref(Fe)(y))},e.toDisplayString(M(y)),5)]))),128))])),r.value.length>0?(e.openBlock(),e.createElementBlock("div",Kn,[...n[12]||(n[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":n[0]||(n[0]=y=>Object.assign(q.value,y)),onClose:n[1]||(n[1]=y=>N.value=!1)},null,8,["visible","modelValue"])]))}},ei={class:"qukt-help-dialog"},ti={class:"qukt-help-header"},li={__name:"HelpModal",props:{visible:{type:Boolean,default:!1}},emits:["close"],setup(o){return(l,t)=>o.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qukt-help-modal",onClick:t[1]||(t[1]=e.withModifiers(d=>l.$emit("close"),["self"]))},[e.createElementVNode("div",ei,[e.createElementVNode("div",ti,[t[2]||(t[2]=e.createElementVNode("h3",null,"📖 报价单生成器 — 使用教程",-1)),e.createElementVNode("button",{class:"qukt-close-btn",onClick:t[0]||(t[0]=d=>l.$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">{
|
|
12
|
+
</style></head><body>${q}</body></html>`),u.document.close(),u.onload=()=>{u.print()}}return o({print:x,exportExcel:i}),(c,E)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",nt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value.header_sections,(r,u)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"h"+u},[r.type==="title"?(e.openBlock(),e.createElementBlock("h1",{key:0,class:"qukt-q-title",style:e.normalizeStyle(e.unref(Z)(r))},e.toDisplayString(N(r,"header")),5)):r.type==="divider"?(e.openBlock(),e.createElementBlock("div",it)):r.type==="text"?(e.openBlock(),e.createElementBlock("div",{key:2,class:"qukt-q-text",style:e.normalizeStyle(e.unref(Z)(r))},e.toDisplayString(N(r,"header")),5)):r.type==="row"?(e.openBlock(),e.createElementBlock("div",at,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.cells,(h,q)=>(e.openBlock(),e.createElementBlock("div",{key:q,class:"qukt-q-cell",style:e.normalizeStyle(e.unref(ie)(h))},e.toDisplayString(y(h,"header")),5))),128))])):e.createCommentVNode("",!0)],64))),128)),a.value.columns.length>0?(e.openBlock(),e.createElementBlock("div",st,[e.createElementVNode("table",rt,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value.columns,r=>(e.openBlock(),e.createElementBlock("th",{key:r.field,style:e.normalizeStyle({width:(r.width||100)+"px"})},e.toDisplayString(r.title),5))),128))])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(r,u)=>{var h,q;return e.openBlock(),e.createElementBlock(e.Fragment,{key:u},[r.__is_subtotal?(e.openBlock(),e.createElementBlock("tr",dt,[e.createElementVNode("td",{colspan:a.value.columns.length-1,class:"subtotal-label"},"小计("+e.toDisplayString(r.__group_key)+")",9,ct),e.createElementVNode("td",mt,e.toDisplayString(((h=a.value.group_rules)==null?void 0:h.subtotal_prefix)||"")+e.toDisplayString(d(r.__group_sum))+e.toDisplayString(((q=a.value.group_rules)==null?void 0:q.subtotal_suffix)||""),1)])):(e.openBlock(),e.createElementBlock("tr",pt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value.columns,(w,B)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:w.field},[b(n.value.indexOf(r),w.field)>0?(e.openBlock(),e.createElementBlock("td",{key:0,rowspan:b(n.value.indexOf(r),w.field),class:e.normalizeClass({"merged-cell":b(n.value.indexOf(r),w.field)>1}),style:e.normalizeStyle(_(w))},[w.editor===e.unref(P).AUTO_SEQ.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(w.prefix||"")+e.toDisplayString(u+1)+e.toDisplayString(w.suffix||""),1)],64)):e.unref(I)(w.editor).hasFormula?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(w.prefix||"")+e.toDisplayString(d(g(r)))+e.toDisplayString(w.suffix||""),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(w.prefix||"")+e.toDisplayString(r[w.field]??"")+e.toDisplayString(w.suffix||""),1)],64))],14,ut)):e.createCommentVNode("",!0)],64))),128))]))],64)}),128)),n.value.length===0?(e.openBlock(),e.createElementBlock("tr",ft,[e.createElementVNode("td",{colspan:a.value.columns.length,class:"qukt-q-empty"},"(暂无数据)",8,kt)])):e.createCommentVNode("",!0)])])])):e.createCommentVNode("",!0),a.value.summary_fields.length>0?(e.openBlock(),e.createElementBlock("div",bt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value.summary_fields,r=>(e.openBlock(),e.createElementBlock("div",{key:r.field,class:"qukt-q-summary-row"},[e.createElementVNode("span",ht,e.toDisplayString(r.label),1),e.createElementVNode("span",{class:"qukt-q-summary-value",style:e.normalizeStyle(e.unref(Me)(r))},e.toDisplayString(s(r)),5)]))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",yt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value.footer_sections,(r,u)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"f"+u},[r.type==="divider"?(e.openBlock(),e.createElementBlock("div",Et)):r.type==="text"?(e.openBlock(),e.createElementBlock("div",{key:1,class:"qukt-q-text",style:e.normalizeStyle(e.unref(Z)(r))},e.toDisplayString(N(r,"footer")),5)):r.type==="row"?(e.openBlock(),e.createElementBlock("div",gt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.cells,(h,q)=>(e.openBlock(),e.createElementBlock("div",{key:q,class:"qukt-q-cell",style:e.normalizeStyle(e.unref(ie)(h))},e.toDisplayString(y(h,"footer")),5))),128))])):e.createCommentVNode("",!0)],64))),128))])])]))}},Vt=(t,o)=>{const l=t.__vccOpts||t;for(const[a,k]of o)l[a]=k;return l},Nt={class:"qukt-preview-box"},_t={class:"qukt-preview-header"},qt={class:"qukt-preview-title"},wt={class:"qukt-preview-body"},Bt={class:"qukt-preview-footer"},xt={class:"qukt-preview-json-box"},$t={class:"qukt-preview-header"},Ct={class:"qukt-preview-title"},St={class:"qukt-preview-json-body"},Dt={class:"qukt-preview-footer"},Ie=Vt({__name:"QuokitPreview",props:{tpl:{type:Object,required:!0},data:{type:Object,default:()=>({headerData:{},rows:[],footerData:{}})},config:{type:Object,default:()=>({})}},emits:["close"],setup(t,{emit:o}){const l=o,a=e.ref(null),k=e.reactive({open:!1,title:"",text:""});function p(){l("close")}async function m(d){var f;await e.nextTick(),(f=a.value)==null||f.exportExcel(d)}async function N(d){var f;await e.nextTick(),(f=a.value)==null||f.print(d)}function y(d,f){k.title=d,k.text=JSON.stringify(f,null,2),k.open=!0}function _(){navigator.clipboard.writeText(k.text).catch(()=>{})}return(d,f)=>(e.openBlock(),e.createElementBlock("div",{class:"qukt-preview-mask",onClick:e.withModifiers(p,["self"])},[e.createElementVNode("div",Nt,[e.createElementVNode("div",_t,[e.createElementVNode("span",qt,e.toDisplayString(t.config.title||"👁️ 总体预览"),1),e.createElementVNode("span",{class:"qukt-preview-close",onClick:p},"✕")]),e.createElementVNode("div",wt,[e.createVNode(ue,{ref_key:"sheetRef",ref:a,tpl:t.tpl,data:t.data},null,8,["tpl","data"])]),e.createElementVNode("div",Bt,[t.config.excel!==!1?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("button",{class:"tool-btn",onClick:f[0]||(f[0]=g=>m(!1))},"📤 导出 Excel"),e.createElementVNode("button",{class:"tool-btn",onClick:f[1]||(f[1]=g=>m(!0))},"📤 导出(撑长)")],64)):e.createCommentVNode("",!0),t.config.print!==!1?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("button",{class:"tool-btn",onClick:f[2]||(f[2]=g=>N(!1))},"🖨️ 打印(横)"),e.createElementVNode("button",{class:"tool-btn",onClick:f[3]||(f[3]=g=>N(!0))},"🖨️ 打印(竖)")],64)):e.createCommentVNode("",!0),t.config.json!==!1?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("button",{class:"tool-btn",onClick:f[4]||(f[4]=g=>y("📄 模板 JSON",t.tpl))},"📄 模板 JSON"),e.createElementVNode("button",{class:"tool-btn",onClick:f[5]||(f[5]=g=>y("📦 数据 JSON",t.data))},"📦 数据 JSON")],64)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"tool-btn",onClick:p},"关闭")])]),k.open?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qukt-preview-json-mask",onClick:f[8]||(f[8]=e.withModifiers(g=>k.open=!1,["self"]))},[e.createElementVNode("div",xt,[e.createElementVNode("div",$t,[e.createElementVNode("span",Ct,e.toDisplayString(k.title),1),e.createElementVNode("span",{class:"qukt-preview-close",onClick:f[6]||(f[6]=g=>k.open=!1)},"✕")]),e.createElementVNode("pre",St,e.toDisplayString(k.text),1),e.createElementVNode("div",Dt,[e.createElementVNode("button",{class:"tool-btn",onClick:_},"📋 复制"),e.createElementVNode("button",{class:"tool-btn",onClick:f[7]||(f[7]=g=>k.open=!1)},"关闭")])])])):e.createCommentVNode("",!0)]))}},[["__scopeId","data-v-8a922e81"]]);function We(t=[],o={}){const l=e.ref(t||[]),a=e.ref(o||{}),k=e.computed(()=>({columns:l.value,group_rules:a.value}));function p(N){l.value=N||[]}function m(N){a.value=N||{}}return e.reactive({columns:l,groupRules:a,tpl:k,setColumns:p,setGroupRules:m})}function fe(t=[]){const o=e.ref(t||[]);function l(k){o.value=k||[]}function a(){return o.value||[]}return e.reactive({sections:o,setSections:l,toTpl:a})}function Pe(t=[]){const o=e.ref(t||[]);function l(k){o.value=k||[]}function a(){return o.value||[]}return e.reactive({fields:o,setFields:l,toTpl:a})}const Ft=["XXXX","YYYY","ZZZZ","WWWW"];function je(t,o=3){const l=[],a=Ft;for(let k=0;k<o;k++){const p={};for(const m of t){const N=I(m.editor);if(N.editable)if(m.editor===P.NUMBER.value)p[m.field]=Math.floor(Math.random()*900+100);else if(N.hasDict){const y=(m.dictStr||(m.dict?m.dict.join(","):"")).split(",").map(_=>_.trim()).filter(Boolean);p[m.field]=y[k%Math.max(y.length,1)]||a[k%a.length]}else p[m.field]=a[k%a.length]}l.push(p)}return l}const Tt={class:"qukt-gr-dialog"},Ut={class:"qukt-gr-header"},Mt={class:"qukt-gr-content"},At={class:"qukt-gr-form"},Lt={class:"qukt-gr-form-row"},zt={class:"qukt-gr-form-row"},Rt={class:"qukt-gr-form-row"},Ot={key:0,class:"qukt-gr-form-row"},It={key:1,class:"qukt-gr-form-row"},Wt={class:"qukt-gr-form-row"},Pt={class:"qukt-border-group",style:{flex:"1"}},jt={class:"qukt-border-item"},Jt={class:"qukt-border-item"},Qt={class:"qukt-border-item"},Xt={class:"qukt-border-item"},Gt={class:"qukt-gr-form-row"},Ht={class:"qukt-gr-footer"},re={__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(t,{emit:o}){const l=t,a=o,k=()=>({top:{style:"",width:1,color:"#dcdfe6"},bottom:{style:"",width:1,color:"#dcdfe6"},left:{style:"",width:1,color:"#dcdfe6"},right:{style:"",width:1,color:"#dcdfe6"}}),p=()=>({width:"auto",color:"#303133",fontSize:13,bold:!1,italic:!1,align:"left",border:k()}),m=e.reactive(p());function N(_){const d=p(),f=W(_||{});if(f.color!==void 0&&(d.color=f.color),f.fontSize!==void 0&&(d.fontSize=f.fontSize),f.bold!==void 0&&(d.bold=f.bold),f.italic!==void 0&&(d.italic=f.italic),f.align!==void 0&&(d.align=f.align),f.width!==void 0&&(d.width=f.width),f.border!==void 0){d.border=W(k());for(const g of["top","bottom","left","right"])f.border[g]&&(d.border[g]={...d.border[g],...f.border[g]})}Object.assign(m,d)}e.watch(()=>l.visible,_=>{_&&N(l.modelValue)},{immediate:!0}),e.watch(m,()=>{a("update:modelValue",W({...m}))},{deep:!0});function y(_){const d=_==="none"?{style:"",width:0,color:"#dcdfe6"}:{style:"solid",width:1,color:"#dcdfe6"};m.border={top:{...d},bottom:{...d},left:{...d},right:{...d}}}return(_,d)=>t.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qukt-gr-mask",onClick:d[22]||(d[22]=e.withModifiers(f=>_.$emit("close"),["self"]))},[e.createElementVNode("div",Tt,[e.createElementVNode("div",Ut,[e.createElementVNode("span",null,e.toDisplayString(t.title),1),e.createElementVNode("button",{class:"qukt-gr-close",onClick:d[0]||(d[0]=f=>_.$emit("close"))},"✕")]),e.createElementVNode("div",Mt,[e.createElementVNode("div",At,[e.createElementVNode("div",Lt,[d[23]||(d[23]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"颜色",-1)),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":d[1]||(d[1]=f=>m.color=f),class:"qukt-color-input"},null,512),[[e.vModelText,m.color]])]),e.createElementVNode("div",zt,[d[24]||(d[24]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"字号",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d[2]||(d[2]=f=>m.fontSize=f),type:"number",class:"qukt-cell-input tiny",min:"10",max:"48",style:{flex:"1"}},null,512),[[e.vModelText,m.fontSize,void 0,{number:!0}]])]),e.createElementVNode("div",Rt,[d[25]||(d[25]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"加粗",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":d[3]||(d[3]=f=>m.bold=f)},null,512),[[e.vModelCheckbox,m.bold]]),d[26]||(d[26]=e.createElementVNode("label",{class:"qukt-gr-form-label",style:{"margin-left":"20px"}},"斜体",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":d[4]||(d[4]=f=>m.italic=f)},null,512),[[e.vModelCheckbox,m.italic]])]),t.showWidth?(e.openBlock(),e.createElementBlock("div",Ot,[d[27]||(d[27]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"宽度",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d[5]||(d[5]=f=>m.width=f),class:"qukt-cell-input",placeholder:"如 33%、auto",style:{flex:"1"}},null,512),[[e.vModelText,m.width]])])):e.createCommentVNode("",!0),t.showAlign?(e.openBlock(),e.createElementBlock("div",It,[d[29]||(d[29]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"对齐",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":d[6]||(d[6]=f=>m.align=f),class:"qukt-cell-input",style:{flex:"1"}},[...d[28]||(d[28]=[e.createElementVNode("option",{value:"left"},"左",-1),e.createElementVNode("option",{value:"center"},"中",-1),e.createElementVNode("option",{value:"right"},"右",-1)])],512),[[e.vModelSelect,m.align]])])):e.createCommentVNode("",!0),t.showBorder?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("div",Wt,[d[38]||(d[38]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"边框",-1)),e.createElementVNode("div",Pt,[e.createElementVNode("div",jt,[d[31]||(d[31]=e.createElementVNode("span",null,"上",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":d[7]||(d[7]=f=>m.border.top.style=f),class:"qukt-cell-input tiny"},[...d[30]||(d[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,m.border.top.style]]),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":d[8]||(d[8]=f=>m.border.top.width=f),class:"qukt-cell-input tiny",min:"0",max:"20",step:"1"},null,512),[[e.vModelText,m.border.top.width,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":d[9]||(d[9]=f=>m.border.top.color=f),class:"qukt-color-input"},null,512),[[e.vModelText,m.border.top.color]])]),e.createElementVNode("div",Jt,[d[33]||(d[33]=e.createElementVNode("span",null,"下",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":d[10]||(d[10]=f=>m.border.bottom.style=f),class:"qukt-cell-input tiny"},[...d[32]||(d[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,m.border.bottom.style]]),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":d[11]||(d[11]=f=>m.border.bottom.width=f),class:"qukt-cell-input tiny",min:"0",max:"20",step:"1"},null,512),[[e.vModelText,m.border.bottom.width,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":d[12]||(d[12]=f=>m.border.bottom.color=f),class:"qukt-color-input"},null,512),[[e.vModelText,m.border.bottom.color]])]),e.createElementVNode("div",Qt,[d[35]||(d[35]=e.createElementVNode("span",null,"左",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":d[13]||(d[13]=f=>m.border.left.style=f),class:"qukt-cell-input tiny"},[...d[34]||(d[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,m.border.left.style]]),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":d[14]||(d[14]=f=>m.border.left.width=f),class:"qukt-cell-input tiny",min:"0",max:"20",step:"1"},null,512),[[e.vModelText,m.border.left.width,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":d[15]||(d[15]=f=>m.border.left.color=f),class:"qukt-color-input"},null,512),[[e.vModelText,m.border.left.color]])]),e.createElementVNode("div",Xt,[d[37]||(d[37]=e.createElementVNode("span",null,"右",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":d[16]||(d[16]=f=>m.border.right.style=f),class:"qukt-cell-input tiny"},[...d[36]||(d[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,m.border.right.style]]),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":d[17]||(d[17]=f=>m.border.right.width=f),class:"qukt-cell-input tiny",min:"0",max:"20",step:"1"},null,512),[[e.vModelText,m.border.right.width,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":d[18]||(d[18]=f=>m.border.right.color=f),class:"qukt-color-input"},null,512),[[e.vModelText,m.border.right.color]])])])]),e.createElementVNode("div",Gt,[d[39]||(d[39]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"预设",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:d[19]||(d[19]=f=>y("all"))},"四边"),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:d[20]||(d[20]=f=>y("none"))},"无边框")])],64)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Ht,[e.createElementVNode("button",{class:"qukt-btn",onClick:d[21]||(d[21]=f=>_.$emit("close"))},"关闭")])])])):e.createCommentVNode("",!0)}};function ee(t){if(t===null||typeof t!="object"||Array.isArray(t))return!1;const o=Object.getPrototypeOf(t);return o===Object.prototype||o===null}function Je(t){return!Array.isArray(t)||t.length===0?!1:t.every(o=>ee(o)&&"key"in o)}function Yt(t,o){const l=new Map;for(const a of t)l.set(a.key,a);for(const a of o)if(l.has(a.key)){const k=l.get(a.key);l.set(a.key,de({...k},a))}else l.set(a.key,a);return t.map(a=>l.get(a.key)).concat(o.filter(a=>!l.has(a.key)&&t.some(k=>k.key===a.key)===!1))}function de(t,o){if(!ee(o))return t;for(const l of Object.keys(o)){const a=o[l],k=t[l];ee(a)&&ee(k)?t[l]=de({...k},a):Je(a)&&Je(k)?t[l]=Yt(k,a):t[l]=a}return t}const Qe={templateCols:{layout:"auto",minWidth:960,columns:[{key:"idx",label:"#",width:50},{key:"field",label:"字段名",width:150},{key:"title",label:"列标题",width:200},{key:"editor",label:"类型",width:140},{key:"width",label:"宽度",width:100},{key:"editorCfg",label:"专属配置",width:200},{key:"merge",label:"分组时合并",width:120},{key:"style",label:"设置",width:80},{key:"ops",label:"操作",width:140}]}},X=e.reactive(JSON.parse(JSON.stringify(Qe)));function Zt(t){if(!ee(t)){console.warn("[vue-quokit] setConfig expected a plain object, got",typeof t);return}de(X,t)}function Kt(){return JSON.parse(JSON.stringify(X))}function vt(){Object.keys(X).forEach(t=>delete X[t]),de(X,JSON.parse(JSON.stringify(Qe)))}const el={class:"qukt-toolbar"},tl={class:"qukt-btn-group-inline"},ll={key:0,class:"qukt-design-table qukt-design-table--fixed"},ol=["width"],nl={class:"idx"},il=["onUpdate:modelValue"],al={class:"qukt-title-group"},sl=["onUpdate:modelValue"],rl=["onUpdate:modelValue"],dl=["onUpdate:modelValue"],cl=["onUpdate:modelValue"],ml=["value"],pl=["onUpdate:modelValue"],ul=["onUpdate:modelValue"],fl=["onUpdate:modelValue"],kl={key:2,class:"qukt-muted"},bl={key:3,class:"qukt-muted"},hl={class:"qukt-col-merge"},yl={key:0},El=["onUpdate:modelValue"],gl={key:1,class:"qukt-muted"},Vl=["onClick"],Nl=["disabled","onClick"],_l=["disabled","onClick"],ql=["onClick"],wl={key:1,class:"qukt-design-table"},Bl=["width"],xl={class:"idx"},$l=["onUpdate:modelValue"],Cl={class:"qukt-title-group"},Sl=["onUpdate:modelValue"],Dl=["onUpdate:modelValue"],Fl=["onUpdate:modelValue"],Tl=["onUpdate:modelValue"],Ul=["value"],Ml=["onUpdate:modelValue"],Al=["onUpdate:modelValue"],Ll=["onUpdate:modelValue"],zl={key:2,class:"qukt-muted"},Rl={key:3,class:"qukt-muted"},Ol={class:"qukt-col-merge"},Il={key:0},Wl=["onUpdate:modelValue"],Pl={key:1,class:"qukt-muted"},jl=["onClick"],Jl=["disabled","onClick"],Ql=["disabled","onClick"],Xl=["onClick"],Gl={__name:"DesignCols",props:{columns:{type:Array,default:()=>[]},groupRules:{type:Object,default:()=>({})}},emits:["update:columns","update:groupRules","help","open-group"],setup(t,{emit:o}){const l=Object.values(P),a=e.computed(()=>X.templateCols.columns),k=e.computed(()=>X.templateCols.layout==="fixed"),p=e.computed(()=>({"--qukt-cols-min-width":X.templateCols.minWidth+"px"})),m=t,N=o,y=e.ref([]),_=e.ref({});e.watch(()=>m.columns,n=>{const b=Se(W(n||[]));Y(b,y.value)||(y.value=b)},{immediate:!0,deep:!0}),e.watch(()=>m.groupRules,n=>{const b=ne(W(n||{}));Y(b,_.value)||(_.value=b)},{immediate:!0,deep:!0}),e.watch(y,n=>{N("update:columns",De(n))},{deep:!0}),e.watch(_,n=>{N("update:groupRules",W(n))},{deep:!0});const d=e.computed(()=>!!_.value.merge_field);function f(){let n=0;for(const b of y.value){const i=/^custom_(\d+)$/.exec(b.field);i&&(n=Math.max(n,parseInt(i[1],10)))}return n+1}function g(n){const b=new Set([...y.value.map(E=>E.field)]),i=I(n);let x;i.defaultFieldBase==="custom"?x="custom_"+String(f()).padStart(4,"0"):x=i.defaultFieldBase;const c=Ke(n,et(x,b));y.value.push(c)}function U(n){y.value.splice(n,1)}function A(n,b){const i=n+b;i<0||i>=y.value.length||([y.value[n],y.value[i]]=[y.value[i],y.value[n]])}const L=e.ref(!1),D=e.ref({}),V=e.ref("");function s(n){n.cellStyle||(n.cellStyle={}),D.value=n.cellStyle,V.value=n.title||"单元格样式",L.value=!0}return(n,b)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",el,[b[5]||(b[5]=e.createElementVNode("span",{class:"qukt-tip"},[e.createTextVNode("拖动或点 ↑↓ 调整顺序;支持自动序号和公式计算列,公式里可直接引用其他字段名,如 "),e.createElementVNode("code",null,"quantity * unit_price * 0.9")],-1)),e.createElementVNode("div",tl,[e.createElementVNode("button",{class:"qukt-btn",onClick:b[0]||(b[0]=i=>n.$emit("open-group"))},"分组 & 小计"+e.toDisplayString(d.value?" ✓":""),1),e.createElementVNode("button",{class:"qukt-btn",onClick:b[1]||(b[1]=i=>g("INPUT"))},"+ 添加字段"),e.createElementVNode("button",{class:"qukt-btn",onClick:b[2]||(b[2]=i=>n.$emit("help"))},"帮助")])]),e.createElementVNode("div",{class:"qukt-table-wrap",style:e.normalizeStyle(p.value)},[k.value?(e.openBlock(),e.createElementBlock("table",ll,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,i=>(e.openBlock(),e.createElementBlock("th",{key:i.key,width:i.width},e.toDisplayString(i.label),9,ol))),128))])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,(i,x)=>(e.openBlock(),e.createElementBlock("tr",{key:x},[e.createElementVNode("td",nl,e.toDisplayString(x+1),1),e.createElementVNode("td",null,[e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input","onUpdate:modelValue":c=>i.field=c},null,8,il),[[e.vModelText,i.field]])]),e.createElementVNode("td",null,[e.createElementVNode("div",al,[e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input pref-suf","onUpdate:modelValue":c=>i.prefix=c,placeholder:"前"},null,8,sl),[[e.vModelText,i.prefix]]),e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input","onUpdate:modelValue":c=>i.title=c,placeholder:"列标题"},null,8,rl),[[e.vModelText,i.title]]),e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input pref-suf","onUpdate:modelValue":c=>i.suffix=c,placeholder:"后"},null,8,dl),[[e.vModelText,i.suffix]])])]),e.createElementVNode("td",null,[e.withDirectives(e.createElementVNode("select",{class:"qukt-cell-input","onUpdate:modelValue":c=>i.editor=c},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l),c=>(e.openBlock(),e.createElementBlock("option",{key:c.value,value:c.value},e.toDisplayString(c.label),9,ml))),128))],8,cl),[[e.vModelSelect,i.editor]])]),e.createElementVNode("td",null,[e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input",type:"number",min:"50",max:"500","onUpdate:modelValue":c=>i.width=c},null,8,pl),[[e.vModelText,i.width,void 0,{number:!0}]])]),e.createElementVNode("td",null,[e.unref(I)(i.editor).hasDict?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,class:"qukt-cell-input","onUpdate:modelValue":c=>i.dictStr=c,placeholder:"下拉选项,逗号分隔 如:设备,材料,安装"},null,8,ul)),[[e.vModelText,i.dictStr]]):e.unref(I)(i.editor).hasFormula?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:1,class:"qukt-cell-input","onUpdate:modelValue":c=>i.formula=c,placeholder:"公式,如 quantity * unit_price + tax"},null,8,fl)),[[e.vModelText,i.formula]]):i.editor===e.unref(P).AUTO_SEQ.value?(e.openBlock(),e.createElementBlock("span",kl,"自动生成序号,无需配置")):(e.openBlock(),e.createElementBlock("span",bl,"-"))]),e.createElementVNode("td",hl,[e.unref(I)(i.editor).canMerge?(e.openBlock(),e.createElementBlock("label",yl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":c=>i.merge_on_group=c},null,8,El),[[e.vModelCheckbox,i.merge_on_group]]),b[6]||(b[6]=e.createElementVNode("span",null,"相同值合并",-1))])):(e.openBlock(),e.createElementBlock("span",gl,"—"))]),e.createElementVNode("td",null,[e.createElementVNode("button",{class:"qukt-mini-btn",onClick:c=>s(i)},"样式",8,Vl)]),e.createElementVNode("td",null,[e.createElementVNode("button",{class:"qukt-mini-btn",disabled:x===0,onClick:c=>A(x,-1)},"↑",8,Nl),e.createElementVNode("button",{class:"qukt-mini-btn",disabled:x>=y.value.length-1,onClick:c=>A(x,1)},"↓",8,_l),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:c=>U(x)},"删",8,ql)])]))),128))])])):(e.openBlock(),e.createElementBlock("table",wl,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,i=>(e.openBlock(),e.createElementBlock("th",{key:i.key,width:i.width??200},e.toDisplayString(i.label),9,Bl))),128))])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,(i,x)=>(e.openBlock(),e.createElementBlock("tr",{key:x},[e.createElementVNode("td",xl,e.toDisplayString(x+1),1),e.createElementVNode("td",null,[e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input","onUpdate:modelValue":c=>i.field=c},null,8,$l),[[e.vModelText,i.field]])]),e.createElementVNode("td",null,[e.createElementVNode("div",Cl,[e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input pref-suf","onUpdate:modelValue":c=>i.prefix=c,placeholder:"前"},null,8,Sl),[[e.vModelText,i.prefix]]),e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input","onUpdate:modelValue":c=>i.title=c,placeholder:"列标题"},null,8,Dl),[[e.vModelText,i.title]]),e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input pref-suf","onUpdate:modelValue":c=>i.suffix=c,placeholder:"后"},null,8,Fl),[[e.vModelText,i.suffix]])])]),e.createElementVNode("td",null,[e.withDirectives(e.createElementVNode("select",{class:"qukt-cell-input","onUpdate:modelValue":c=>i.editor=c},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l),c=>(e.openBlock(),e.createElementBlock("option",{key:c.value,value:c.value},e.toDisplayString(c.label),9,Ul))),128))],8,Tl),[[e.vModelSelect,i.editor]])]),e.createElementVNode("td",null,[e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input",type:"number",min:"50",max:"500","onUpdate:modelValue":c=>i.width=c},null,8,Ml),[[e.vModelText,i.width,void 0,{number:!0}]])]),e.createElementVNode("td",null,[e.unref(I)(i.editor).hasDict?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,class:"qukt-cell-input","onUpdate:modelValue":c=>i.dictStr=c,placeholder:"下拉选项,逗号分隔 如:设备,材料,安装"},null,8,Al)),[[e.vModelText,i.dictStr]]):e.unref(I)(i.editor).hasFormula?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:1,class:"qukt-cell-input","onUpdate:modelValue":c=>i.formula=c,placeholder:"公式,如 quantity * unit_price + tax"},null,8,Ll)),[[e.vModelText,i.formula]]):i.editor===e.unref(P).AUTO_SEQ.value?(e.openBlock(),e.createElementBlock("span",zl,"自动生成序号,无需配置")):(e.openBlock(),e.createElementBlock("span",Rl,"-"))]),e.createElementVNode("td",Ol,[e.unref(I)(i.editor).canMerge?(e.openBlock(),e.createElementBlock("label",Il,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":c=>i.merge_on_group=c},null,8,Wl),[[e.vModelCheckbox,i.merge_on_group]]),b[7]||(b[7]=e.createElementVNode("span",null,"相同值合并",-1))])):(e.openBlock(),e.createElementBlock("span",Pl,"—"))]),e.createElementVNode("td",null,[e.createElementVNode("button",{class:"qukt-mini-btn",onClick:c=>s(i)},"样式",8,jl)]),e.createElementVNode("td",null,[e.createElementVNode("button",{class:"qukt-mini-btn",disabled:x===0,onClick:c=>A(x,-1)},"↑",8,Jl),e.createElementVNode("button",{class:"qukt-mini-btn",disabled:x>=y.value.length-1,onClick:c=>A(x,1)},"↓",8,Ql),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:c=>U(x)},"删",8,Xl)])]))),128))])]))],4),e.createVNode(re,{visible:L.value,modelValue:D.value,showBorder:"",showAlign:!0,showWidth:!1,title:V.value,"onUpdate:modelValue":b[3]||(b[3]=i=>Object.assign(D.value,i)),onClose:b[4]||(b[4]=i=>L.value=!1)},null,8,["visible","modelValue","title"])]))}},Hl={class:"qukt-gr-dialog"},Yl={class:"qukt-gr-header"},Zl={class:"qukt-gr-content"},Kl={class:"qukt-gr-form"},vl={class:"qukt-gr-form-row"},eo=["value","disabled"],to={class:"qukt-gr-form-row"},lo={class:"qukt-gr-form-row"},oo={class:"qukt-gr-form-row"},no={class:"qukt-gr-footer"},io={__name:"GroupDialog",props:{visible:{type:Boolean,default:!1},columns:{type:Array,default:()=>[]},groupRules:{type:Object,default:()=>({})}},emits:["close","update:groupRules"],setup(t,{emit:o}){const l=t,a=o,k=e.reactive({merge_field:"",show_detail_subtotal:!0,subtotal_prefix:"",subtotal_suffix:""});return e.watch(()=>l.groupRules,p=>{const m=ne(W(p||{}));k.merge_field=m.merge_field||"",k.show_detail_subtotal=m.show_detail_subtotal??!0,k.subtotal_prefix=m.subtotal_prefix??"",k.subtotal_suffix=m.subtotal_suffix??""},{immediate:!0,deep:!0}),e.watch(k,()=>{a("update:groupRules",W(ne({merge_field:k.merge_field,show_detail_subtotal:k.show_detail_subtotal,subtotal_prefix:k.subtotal_prefix,subtotal_suffix:k.subtotal_suffix})))},{deep:!0}),(p,m)=>t.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qukt-gr-mask",onClick:m[6]||(m[6]=e.withModifiers(N=>p.$emit("close"),["self"]))},[e.createElementVNode("div",Hl,[e.createElementVNode("div",Yl,[m[7]||(m[7]=e.createElementVNode("span",null,"分组规则 & 小计配置",-1)),e.createElementVNode("button",{class:"qukt-gr-close",onClick:m[0]||(m[0]=N=>p.$emit("close"))},"✕")]),e.createElementVNode("div",Zl,[m[13]||(m[13]=e.createElementVNode("div",{class:"qukt-gr-tips"},[e.createElementVNode("p",null,[e.createElementVNode("b",null,"分组是什么?"),e.createTextVNode(" 选择某一列后,相同值的行会自动合并单元格(比如按「系统名称」分组,同系统的多条明细会合并成一个单元格)。每组末尾自动显示一行小计。")])],-1)),e.createElementVNode("div",Kl,[e.createElementVNode("div",vl,[m[9]||(m[9]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"按哪一列分组",-1)),e.withDirectives(e.createElementVNode("select",{class:"qukt-cell-input","onUpdate:modelValue":m[1]||(m[1]=N=>k.merge_field=N),style:{flex:"1"}},[m[8]||(m[8]=e.createElementVNode("option",{value:""},"— 不分组 —",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columns,N=>(e.openBlock(),e.createElementBlock("option",{key:N.field,value:N.field,disabled:!e.unref(I)(N.editor).editable},e.toDisplayString(N.title)+"("+e.toDisplayString(N.field)+")",9,eo))),128))],512),[[e.vModelSelect,k.merge_field]])]),e.createElementVNode("div",to,[m[10]||(m[10]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"显示小计",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":m[2]||(m[2]=N=>k.show_detail_subtotal=N)},null,512),[[e.vModelCheckbox,k.show_detail_subtotal]])]),e.createElementVNode("div",lo,[m[11]||(m[11]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"小计前缀",-1)),e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input","onUpdate:modelValue":m[3]||(m[3]=N=>k.subtotal_prefix=N),placeholder:"如 ¥、¥",style:{flex:"1"}},null,512),[[e.vModelText,k.subtotal_prefix]])]),e.createElementVNode("div",oo,[m[12]||(m[12]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"小计后缀",-1)),e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input","onUpdate:modelValue":m[4]||(m[4]=N=>k.subtotal_suffix=N),placeholder:"如 元、RMB",style:{flex:"1"}},null,512),[[e.vModelText,k.subtotal_suffix]])])])]),e.createElementVNode("div",no,[e.createElementVNode("button",{class:"qukt-btn",onClick:m[5]||(m[5]=N=>p.$emit("close"))},"关闭")])])])):e.createCommentVNode("",!0)}};function ke(t=1100){const o=e.ref(!1);function l(){o.value=window.innerWidth<=t}return e.onMounted(()=>{l(),window.addEventListener("resize",l)}),e.onUnmounted(()=>{window.removeEventListener("resize",l)}),{isNarrow:o}}const ao={class:"qukt-toolbar"},so={class:"qukt-col-left"},ro={class:"qukt-sec-header"},co={class:"qukt-sec-type"},mo={class:"qukt-sec-actions"},po=["disabled","onClick"],uo=["disabled","onClick"],fo=["onClick"],ko={class:"qukt-sec-row"},bo=["onUpdate:modelValue"],ho={class:"qukt-sec-row"},yo=["checked","onChange"],Eo={key:0,class:"qukt-sec-row"},go=["onUpdate:modelValue"],Vo={key:1,class:"qukt-sec-row"},No=["onUpdate:modelValue"],_o={class:"qukt-sec-row"},qo=["onClick"],wo={class:"qukt-cells-list"},Bo={class:"qukt-cell-toolbar"},xo=["onClick"],$o={class:"qukt-sec-row"},Co=["onUpdate:modelValue"],So={key:0,class:"qukt-sec-row"},Do=["onUpdate:modelValue"],Fo={class:"qukt-chk-label"},To=["onUpdate:modelValue"],Uo={class:"qukt-sec-row"},Mo=["checked","onChange"],Ao={key:1,class:"qukt-sec-row"},Lo=["onUpdate:modelValue"],zo={key:0,class:"qukt-sec-row"},Ro=["onUpdate:modelValue"],Oo={key:1,class:"qukt-sec-row"},Io=["onUpdate:modelValue"],Wo={class:"qukt-sec-row"},Po=["onClick"],jo=["onClick"],Jo={class:"qukt-col-right"},Qo={class:"qukt-preview-box"},Xo={class:"qukt-preview-inner"},Go={key:1,class:"qukt-p-divider"},Ho={key:3,class:"qukt-p-row"},Yo={key:0,class:"qukt-p-label"},Zo={class:"qukt-p-value qukt-p-bind-placeholder"},Ko={key:1,class:"qukt-p-value qukt-p-bind-placeholder"},vo={key:0,class:"qukt-p-label"},en={class:"qukt-p-value"},Xe="hdr_",tn={__name:"DesignHeader",props:{sections:{type:Array,default:()=>[]},breakpoint:{type:Number,default:1100}},emits:["update:sections"],setup(t,{emit:o}){const l=t,a=o,{isNarrow:k}=ke(l.breakpoint),p=e.ref([]);e.watch(()=>l.sections,V=>{const s=ae(W(V||[]));Y(s,p.value)||(p.value=s)},{immediate:!0}),e.watch(p,V=>{a("update:sections",W(V))},{deep:!0});const m=e.ref(!1),N=e.ref({}),y=e.reactive({title:"样式配置",showBorder:!1,showAlign:!0,showWidth:!1});function _(V,s){N.value=V,s==="cell"?(y.title="单元格样式",y.showBorder=!0,y.showAlign=!0,y.showWidth=!0):(y.title="文本样式",y.showBorder=!1,y.showAlign=!0,y.showWidth=!1),m.value=!0}function d(V){V==="divider"?p.value.push({type:V}):V==="text"?p.value.push({type:V,label:"标签:",text:"纯文本内容",style:{color:"#303133",fontSize:14,bold:!1,italic:!1,align:"left"},bindEnabled:!1,bindField:""}):V==="row"&&p.value.push({type:V,cells:[{type:"field",label:"标签:",bindEnabled:!1,bindField:"",hideLabel:!1,style:v("50%")}]})}function f(V){p.value.splice(V,1)}function g(V,s){const n=V+s;n<0||n>=p.value.length||([p.value[V],p.value[n]]=[p.value[n],p.value[V]])}function U(V){V.cells||(V.cells=[]),V.cells.push({type:"field",label:"标签:",bindEnabled:!1,bindField:"",hideLabel:!1,style:v("33%")})}function A(V,s){V.cells.splice(s,1)}const L=V=>Ae(V,Xe,p.value),D=V=>Le(V,Xe,p.value);return(V,s)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",ao,[s[5]||(s[5]=e.createElementVNode("span",{class:"qukt-tip"},"这里定义报价单的大标题、项目信息行等,左侧是设计器,右侧实时预览",-1)),e.createElementVNode("button",{class:"qukt-btn",onClick:s[0]||(s[0]=n=>d("row"))},"+ 字段行"),e.createElementVNode("button",{class:"qukt-btn",onClick:s[1]||(s[1]=n=>d("divider"))},"+ 分隔线"),e.createElementVNode("button",{class:"qukt-btn",onClick:s[2]||(s[2]=n=>d("text"))},"+ 纯文本")]),e.createElementVNode("div",{class:e.normalizeClass(["qukt-two-col",{"is-narrow":e.unref(k)}])},[e.createElementVNode("div",so,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,(n,b)=>(e.openBlock(),e.createElementBlock("div",{key:b,class:e.normalizeClass(["qukt-sec-block",{"qukt-sec-block--divider":n.type==="divider"}])},[e.createElementVNode("div",ro,[e.createElementVNode("span",co,e.toDisplayString(n.type==="row"?"字段行":n.type==="divider"?"分隔线":"纯文本"),1),e.createElementVNode("div",mo,[e.createElementVNode("button",{class:"qukt-mini-btn",disabled:b===0,onClick:i=>g(b,-1)},"↑",8,po),e.createElementVNode("button",{class:"qukt-mini-btn",disabled:b>=p.value.length-1,onClick:i=>g(b,1)},"↓",8,uo),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:i=>f(b)},"删",8,fo)])]),n.type==="text"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",ko,[s[6]||(s[6]=e.createElementVNode("label",null,"标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i=>n.label=i,class:"qukt-cell-input",placeholder:"填写数据时用的提示"},null,8,bo),[[e.vModelText,n.label]])]),e.createElementVNode("div",ho,[s[7]||(s[7]=e.createElementVNode("label",null,"暴露",-1)),e.createElementVNode("input",{type:"checkbox",checked:n.bindEnabled,onChange:i=>L(n)},null,40,yo)]),n.bindEnabled?(e.openBlock(),e.createElementBlock("div",Eo,[s[8]||(s[8]=e.createElementVNode("label",null,"字段名",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i=>n.bindField=i,class:"qukt-cell-input",placeholder:"如 salesman"},null,8,go),[[e.vModelText,n.bindField]])])):e.createCommentVNode("",!0),n.bindEnabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Vo,[s[9]||(s[9]=e.createElementVNode("label",null,"文字",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i=>n.text=i,class:"qukt-cell-input"},null,8,No),[[e.vModelText,n.text]])])),e.createElementVNode("div",_o,[s[10]||(s[10]=e.createElementVNode("label",null,"样式",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:i=>_(n.style,"text")},"设置",8,qo)])],64)):n.type==="row"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",wo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.cells,(i,x)=>(e.openBlock(),e.createElementBlock("div",{key:x,class:"qukt-cell-block"},[e.createElementVNode("div",Bo,[e.createElementVNode("strong",null,e.toDisplayString(x+1),1),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:c=>A(n,x)},"×",8,xo)]),e.createElementVNode("div",$o,[s[12]||(s[12]=e.createElementVNode("label",null,"类型",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":c=>i.type=c,class:"qukt-cell-input small"},[...s[11]||(s[11]=[e.createElementVNode("option",{value:"field"},"字段(可编辑)",-1),e.createElementVNode("option",{value:"text"},"纯文本",-1)])],8,Co),[[e.vModelSelect,i.type]])]),i.type==="field"?(e.openBlock(),e.createElementBlock("div",So,[s[14]||(s[14]=e.createElementVNode("label",null,"标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>i.label=c,class:"qukt-cell-input",placeholder:"标签"},null,8,Do),[[e.vModelText,i.label]]),e.createElementVNode("label",Fo,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":c=>i.hideLabel=c},null,8,To),[[e.vModelCheckbox,i.hideLabel]]),s[13]||(s[13]=e.createTextVNode(" 隐藏 ",-1))])])):e.createCommentVNode("",!0),e.createElementVNode("div",Uo,[s[15]||(s[15]=e.createElementVNode("label",null,"暴露",-1)),e.createElementVNode("input",{type:"checkbox",checked:i.bindEnabled,onChange:c=>D(i)},null,40,Mo)]),i.bindEnabled?(e.openBlock(),e.createElementBlock("div",Ao,[s[16]||(s[16]=e.createElementVNode("label",null,"字段名",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>i.bindField=c,class:"qukt-cell-input",placeholder:"如 salesman"},null,8,Lo),[[e.vModelText,i.bindField]])])):e.createCommentVNode("",!0),i.bindEnabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[i.type==="field"?(e.openBlock(),e.createElementBlock("div",zo,[s[17]||(s[17]=e.createElementVNode("label",null,"值",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>i.value=c,class:"qukt-cell-input",placeholder:"字段的值"},null,8,Ro),[[e.vModelText,i.value]])])):e.createCommentVNode("",!0),i.type==="text"?(e.openBlock(),e.createElementBlock("div",Oo,[s[18]||(s[18]=e.createElementVNode("label",null,"文字",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>i.text=c,class:"qukt-cell-input"},null,8,Io),[[e.vModelText,i.text]])])):e.createCommentVNode("",!0)],64)),e.createElementVNode("div",Wo,[s[19]||(s[19]=e.createElementVNode("label",null,"样式",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:c=>_(i.style,"cell")},"设置",8,Po)])]))),128))]),e.createElementVNode("button",{class:"qukt-btn qukt-btn-ghost",onClick:i=>U(n)},"+ 添加一个单元格",8,jo)],64)):e.createCommentVNode("",!0)],2))),128))]),e.createElementVNode("div",Jo,[e.createElementVNode("div",Qo,[s[20]||(s[20]=e.createElementVNode("div",{class:"qukt-preview-label"},"实时预览",-1)),e.createElementVNode("div",Xo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,(n,b)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:b},[n.type==="title"?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qukt-p-title",style:e.normalizeStyle(e.unref(Z)(n))},e.toDisplayString(n.bindEnabled?n.bindField||"待绑定":n.text||"大标题"),5)):n.type==="divider"?(e.openBlock(),e.createElementBlock("div",Go)):n.type==="text"?(e.openBlock(),e.createElementBlock("div",{key:2,class:"qukt-p-text",style:e.normalizeStyle(e.unref(Z)(n))},e.toDisplayString(n.bindEnabled?n.bindField||"待绑定":n.text||"纯文本"),5)):n.type==="row"?(e.openBlock(),e.createElementBlock("div",Ho,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.cells,(i,x)=>(e.openBlock(),e.createElementBlock("div",{key:x,class:"qukt-p-cell",style:e.normalizeStyle(e.unref(ie)(i))},[i.bindEnabled?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[i.type==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[i.label&&!i.hideLabel?(e.openBlock(),e.createElementBlock("span",Yo,e.toDisplayString(i.label),1)):e.createCommentVNode("",!0),e.createElementVNode("span",Zo,e.toDisplayString(i.bindField||"待绑定"),1)],64)):(e.openBlock(),e.createElementBlock("span",Ko,e.toDisplayString(i.bindField||"待绑定"),1))],64)):i.type==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[i.label&&!i.hideLabel?(e.openBlock(),e.createElementBlock("span",vo,e.toDisplayString(i.label),1)):e.createCommentVNode("",!0),e.createElementVNode("span",en,e.toDisplayString(i.value||"字段值"),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(i.text||"纯文本"),1)],64))],4))),128))])):e.createCommentVNode("",!0)],64))),128))])])])],2),e.createVNode(re,{visible:m.value,modelValue:N.value,showBorder:y.showBorder,showAlign:y.showAlign,showWidth:y.showWidth,title:y.title,"onUpdate:modelValue":s[3]||(s[3]=n=>Object.assign(N.value,n)),onClose:s[4]||(s[4]=n=>m.value=!1)},null,8,["visible","modelValue","showBorder","showAlign","showWidth","title"])]))}},ln={class:"qukt-toolbar"},on={class:"qukt-col-left"},nn={class:"qukt-sec-header"},an={class:"qukt-sec-type"},sn={class:"qukt-sec-actions"},rn=["disabled","onClick"],dn=["disabled","onClick"],cn=["onClick"],mn={class:"qukt-cells-list"},pn={class:"qukt-cell-toolbar"},un=["onClick"],fn={class:"qukt-sec-row"},kn=["onUpdate:modelValue"],bn={key:0,class:"qukt-sec-row"},hn=["onUpdate:modelValue"],yn={class:"qukt-chk-label"},En=["onUpdate:modelValue"],gn={class:"qukt-sec-row"},Vn=["checked","onChange"],Nn={key:1,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={class:"qukt-sec-row"},Cn=["onClick"],Sn=["onClick"],Dn={class:"qukt-sec-row"},Fn=["onUpdate:modelValue"],Tn={class:"qukt-sec-row"},Un=["checked","onChange"],Mn={key:0,class:"qukt-sec-row"},An=["onUpdate:modelValue"],Ln={key:1,class:"qukt-sec-row"},zn=["onUpdate:modelValue"],Rn={class:"qukt-sec-row"},On=["onClick"],In={class:"qukt-col-right"},Wn={class:"qukt-preview-box"},Pn={class:"qukt-preview-inner"},jn={key:0,class:"qukt-p-divider"},Jn={key:2,class:"qukt-p-row"},Qn={key:0,class:"qukt-p-label"},Xn={class:"qukt-p-value qukt-p-bind-placeholder"},Gn={key:1,class:"qukt-p-value qukt-p-bind-placeholder"},Hn={key:0,class:"qukt-p-label"},Yn={class:"qukt-p-value"},Ge="ftr_",Zn={__name:"DesignFooter",props:{sections:{type:Array,default:()=>[]},breakpoint:{type:Number,default:1100}},emits:["update:sections"],setup(t,{emit:o}){const l=t,a=o,{isNarrow:k}=ke(l.breakpoint),p=e.ref([]);e.watch(()=>l.sections,V=>{const s=ae(W(V||[]));Y(s,p.value)||(p.value=s)},{immediate:!0}),e.watch(p,V=>{a("update:sections",W(V))},{deep:!0});const m=e.ref(!1),N=e.ref({}),y=e.reactive({title:"样式配置",showBorder:!1,showAlign:!0,showWidth:!1});function _(V,s){N.value=V,s==="cell"?(y.title="单元格样式",y.showBorder=!0,y.showAlign=!0,y.showWidth=!0):(y.title="文本样式",y.showBorder=!1,y.showAlign=!0,y.showWidth=!1),m.value=!0}function d(V){V==="divider"?p.value.push({type:V}):V==="text"?p.value.push({type:V,label:"标签:",text:"纯文本",style:{color:"#303133",fontSize:14,bold:!1,italic:!1,align:"left"},bindEnabled:!1,bindField:""}):V==="row"&&p.value.push({type:V,cells:[{type:"field",label:"标签:",bindEnabled:!1,bindField:"",hideLabel:!1,style:v("50%")}]})}function f(V){p.value.splice(V,1)}function g(V,s){const n=V+s;n<0||n>=p.value.length||([p.value[V],p.value[n]]=[p.value[n],p.value[V]])}function U(V){V.cells||(V.cells=[]),V.cells.push({type:"field",label:"标签:",bindEnabled:!1,bindField:"",hideLabel:!1,style:v("50%")})}function A(V,s){V.cells.splice(s,1)}const L=V=>Ae(V,Ge,p.value),D=V=>Le(V,Ge,p.value);return(V,s)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",ln,[s[5]||(s[5]=e.createElementVNode("span",{class:"qukt-tip"},"页面底部显示签字栏、盖章区等,结构和页面头部一样",-1)),e.createElementVNode("button",{class:"qukt-btn",onClick:s[0]||(s[0]=n=>d("divider"))},"+ 分隔线"),e.createElementVNode("button",{class:"qukt-btn",onClick:s[1]||(s[1]=n=>d("row"))},"+ 字段行"),e.createElementVNode("button",{class:"qukt-btn",onClick:s[2]||(s[2]=n=>d("text"))},"+ 纯文本")]),e.createElementVNode("div",{class:e.normalizeClass(["qukt-two-col",{"is-narrow":e.unref(k)}])},[e.createElementVNode("div",on,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,(n,b)=>(e.openBlock(),e.createElementBlock("div",{key:b,class:e.normalizeClass(["qukt-sec-block",{"qukt-sec-block--divider":n.type==="divider"}])},[e.createElementVNode("div",nn,[e.createElementVNode("span",an,e.toDisplayString(n.type==="row"?"字段行":n.type==="divider"?"分隔线":"纯文本"),1),e.createElementVNode("div",sn,[e.createElementVNode("button",{class:"qukt-mini-btn",disabled:b===0,onClick:i=>g(b,-1)},"↑",8,rn),e.createElementVNode("button",{class:"qukt-mini-btn",disabled:b>=p.value.length-1,onClick:i=>g(b,1)},"↓",8,dn),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:i=>f(b)},"删",8,cn)])]),n.type==="row"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",mn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.cells,(i,x)=>(e.openBlock(),e.createElementBlock("div",{key:x,class:"qukt-cell-block"},[e.createElementVNode("div",pn,[e.createElementVNode("strong",null,e.toDisplayString(x+1),1),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:c=>A(n,x)},"×",8,un)]),e.createElementVNode("div",fn,[s[7]||(s[7]=e.createElementVNode("label",null,"类型",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":c=>i.type=c,class:"qukt-cell-input small"},[...s[6]||(s[6]=[e.createElementVNode("option",{value:"field"},"字段(可编辑)",-1),e.createElementVNode("option",{value:"text"},"纯文本",-1)])],8,kn),[[e.vModelSelect,i.type]])]),i.type==="field"?(e.openBlock(),e.createElementBlock("div",bn,[s[9]||(s[9]=e.createElementVNode("label",null,"标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>i.label=c,class:"qukt-cell-input",placeholder:"标签"},null,8,hn),[[e.vModelText,i.label]]),e.createElementVNode("label",yn,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":c=>i.hideLabel=c},null,8,En),[[e.vModelCheckbox,i.hideLabel]]),s[8]||(s[8]=e.createTextVNode(" 隐藏 ",-1))])])):e.createCommentVNode("",!0),e.createElementVNode("div",gn,[s[10]||(s[10]=e.createElementVNode("label",null,"对外暴露",-1)),e.createElementVNode("input",{type:"checkbox",checked:i.bindEnabled,onChange:c=>D(i)},null,40,Vn)]),i.bindEnabled?(e.openBlock(),e.createElementBlock("div",Nn,[s[11]||(s[11]=e.createElementVNode("label",null,"字段名",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>i.bindField=c,class:"qukt-cell-input",placeholder:"如 company_name"},null,8,_n),[[e.vModelText,i.bindField]])])):e.createCommentVNode("",!0),i.bindEnabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[i.type==="field"?(e.openBlock(),e.createElementBlock("div",qn,[s[12]||(s[12]=e.createElementVNode("label",null,"值",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>i.value=c,class:"qukt-cell-input",placeholder:"字段的值"},null,8,wn),[[e.vModelText,i.value]])])):e.createCommentVNode("",!0),i.type==="text"?(e.openBlock(),e.createElementBlock("div",Bn,[s[13]||(s[13]=e.createElementVNode("label",null,"文字",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>i.text=c,class:"qukt-cell-input"},null,8,xn),[[e.vModelText,i.text]])])):e.createCommentVNode("",!0)],64)),e.createElementVNode("div",$n,[s[14]||(s[14]=e.createElementVNode("label",null,"样式",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:c=>_(i.style,"cell")},"设置",8,Cn)])]))),128))]),e.createElementVNode("button",{class:"qukt-btn qukt-btn-ghost",onClick:i=>U(n)},"+ 添加一个单元格",8,Sn)],64)):n.type==="text"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",Dn,[s[15]||(s[15]=e.createElementVNode("label",null,"标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i=>n.label=i,class:"qukt-cell-input",placeholder:"填写数据时用的提示"},null,8,Fn),[[e.vModelText,n.label]])]),e.createElementVNode("div",Tn,[s[16]||(s[16]=e.createElementVNode("label",null,"暴露",-1)),e.createElementVNode("input",{type:"checkbox",checked:n.bindEnabled,onChange:i=>L(n)},null,40,Un)]),n.bindEnabled?(e.openBlock(),e.createElementBlock("div",Mn,[s[17]||(s[17]=e.createElementVNode("label",null,"字段名",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i=>n.bindField=i,class:"qukt-cell-input",placeholder:"如 company_name"},null,8,An),[[e.vModelText,n.bindField]])])):e.createCommentVNode("",!0),n.bindEnabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Ln,[s[18]||(s[18]=e.createElementVNode("label",null,"文字",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i=>n.text=i,class:"qukt-cell-input"},null,8,zn),[[e.vModelText,n.text]])])),e.createElementVNode("div",Rn,[s[19]||(s[19]=e.createElementVNode("label",null,"样式",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:i=>_(n.style,"text")},"设置",8,On)])],64)):e.createCommentVNode("",!0)],2))),128))]),e.createElementVNode("div",In,[e.createElementVNode("div",Wn,[s[20]||(s[20]=e.createElementVNode("div",{class:"qukt-preview-label"},"底部预览",-1)),e.createElementVNode("div",Pn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,(n,b)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:b},[n.type==="divider"?(e.openBlock(),e.createElementBlock("div",jn)):n.type==="text"?(e.openBlock(),e.createElementBlock("div",{key:1,class:"qukt-p-text",style:e.normalizeStyle(e.unref(Z)(n))},e.toDisplayString(n.bindEnabled?n.bindField||"待绑定":n.text||"纯文本"),5)):n.type==="row"?(e.openBlock(),e.createElementBlock("div",Jn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.cells,(i,x)=>(e.openBlock(),e.createElementBlock("div",{key:x,class:"qukt-p-cell",style:e.normalizeStyle(e.unref(ie)(i))},[i.bindEnabled?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[i.type==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[i.label&&!i.hideLabel?(e.openBlock(),e.createElementBlock("span",Qn,e.toDisplayString(i.label),1)):e.createCommentVNode("",!0),e.createElementVNode("span",Xn,e.toDisplayString(i.bindField||"待绑定"),1)],64)):(e.openBlock(),e.createElementBlock("span",Gn,e.toDisplayString(i.bindField||"待绑定"),1))],64)):i.type==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[i.label&&!i.hideLabel?(e.openBlock(),e.createElementBlock("span",Hn,e.toDisplayString(i.label),1)):e.createCommentVNode("",!0),e.createElementVNode("span",Yn,e.toDisplayString(i.value||"字段值"),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(i.text||"纯文本"),1)],64))],4))),128))])):e.createCommentVNode("",!0)],64))),128))])])])],2),e.createVNode(re,{visible:m.value,modelValue:N.value,showBorder:y.showBorder,showAlign:y.showAlign,showWidth:y.showWidth,title:y.title,"onUpdate:modelValue":s[3]||(s[3]=n=>Object.assign(N.value,n)),onClose:s[4]||(s[4]=n=>m.value=!1)},null,8,["visible","modelValue","showBorder","showAlign","showWidth","title"])]))}},Kn={class:"qukt-col-left"},vn={class:"qukt-sec-header"},ei={class:"qukt-sec-type"},ti={class:"qukt-sec-actions"},li=["disabled","onClick"],oi=["disabled","onClick"],ni=["onClick"],ii={class:"qukt-sec-row"},ai=["onUpdate:modelValue"],si=["value"],ri={class:"qukt-sec-row"},di=["onUpdate:modelValue"],ci={class:"qukt-sec-row"},mi=["onUpdate:modelValue"],pi={class:"qukt-sec-row"},ui=["onUpdate:modelValue"],fi={class:"qukt-sec-row"},ki=["onUpdate:modelValue"],bi={key:0,class:"qukt-sec-row"},hi=["onUpdate:modelValue"],yi={key:1,class:"qukt-sec-row"},Ei=["onUpdate:modelValue"],gi={key:2,class:"qukt-sec-row"},Vi=["onUpdate:modelValue"],Ni={class:"qukt-sec-row"},_i=["onClick"],qi={key:0,class:"qukt-q-empty"},wi={class:"qukt-col-right"},Bi={class:"qukt-preview-box"},xi={class:"qukt-preview-inner"},$i={key:0,class:"qukt-empty-hint"},Ci={key:1,class:"qukt-summary-preview"},Si={class:"qukt-sp-label"},Di={key:2,class:"qukt-preview-help"},Fi={__name:"DesignSummary",props:{fields:{type:Array,default:()=>[]},breakpoint:{type:Number,default:1100}},emits:["update:fields"],setup(t,{emit:o}){const l=Object.values(H),a=t,k=o,{isNarrow:p}=ke(a.breakpoint),m=e.ref([]);e.watch(()=>a.fields,s=>{const n=W(s||[]);me(n),!Y(n,m.value)&&(m.value=n)},{immediate:!0}),e.watch(m,s=>{const n=W(s);me(n),k("update:fields",n)},{deep:!0});function N(s){return m.value.indexOf(s)}const y=e.ref(!1),_=e.ref({});function d(s){_.value=s,y.value=!0}const f={group_total:1e4},g=e.computed(()=>{const s={...f};for(const n of m.value)j(n.type).hasDefault&&(s[n.field]=Number(n.default??0));for(const n of m.value)if(j(n.type).hasFormula&&n.formula)try{s[n.field]=G(n.formula,s)}catch{s[n.field]=0}return s});function U(s){return j(s).label}function A(s){const n=j(s.type);if(n.hasText)return s.text||"";let b;n.hasFormula?b=Number(g.value[s.field])||0:b=Number(s.default)||0;const i=Number.isInteger(b)?b:b.toFixed(2);return(s.prefix||"")+i+(s.suffix||"")}function L(){m.value.push(ot(H.AUTO_CALC.value))}function D(s){m.value.splice(s,1)}function V(s,n){const b=s+n;b<0||b>=m.value.length||([m.value[s],m.value[b]]=[m.value[b],m.value[s]])}return(s,n)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",{class:"qukt-toolbar"},[n[2]||(n[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:L},"+ 添加字段")]),e.createElementVNode("div",{class:e.normalizeClass(["qukt-two-col",{"is-narrow":e.unref(p)}])},[e.createElementVNode("div",Kn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,b=>(e.openBlock(),e.createElementBlock("div",{key:b.field,class:"qukt-sec-block"},[e.createElementVNode("div",vn,[e.createElementVNode("span",ei,e.toDisplayString(U(b.type)),1),e.createElementVNode("div",ti,[e.createElementVNode("button",{class:"qukt-mini-btn",disabled:N(b)===0,onClick:i=>V(N(b),-1)},"↑",8,li),e.createElementVNode("button",{class:"qukt-mini-btn",disabled:N(b)>=m.value.length-1,onClick:i=>V(N(b),1)},"↓",8,oi),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:i=>D(N(b))},"删",8,ni)])]),e.createElementVNode("div",ii,[n[3]||(n[3]=e.createElementVNode("label",null,"类型",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":i=>b.type=i,class:"qukt-cell-input"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l),i=>(e.openBlock(),e.createElementBlock("option",{key:i.value,value:i.value},e.toDisplayString(i.label),9,si))),128))],8,ai),[[e.vModelSelect,b.type]])]),e.createElementVNode("div",ri,[n[4]||(n[4]=e.createElementVNode("label",null,"标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i=>b.label=i,class:"qukt-cell-input",placeholder:"如 合计、税后、业务员抽成"},null,8,di),[[e.vModelText,b.label]])]),e.createElementVNode("div",ci,[n[5]||(n[5]=e.createElementVNode("label",null,"字段名",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i=>b.field=i,class:"qukt-cell-input",placeholder:"如 subtotal、tax (其他行公式可引用)"},null,8,mi),[[e.vModelText,b.field]])]),e.createElementVNode("div",pi,[n[6]||(n[6]=e.createElementVNode("label",null,"前缀",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i=>b.prefix=i,class:"qukt-cell-input",placeholder:"如 ¥、¥"},null,8,ui),[[e.vModelText,b.prefix]])]),e.createElementVNode("div",fi,[n[7]||(n[7]=e.createElementVNode("label",null,"后缀",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i=>b.suffix=i,class:"qukt-cell-input",placeholder:"如 %"},null,8,ki),[[e.vModelText,b.suffix]])]),e.unref(j)(b.type).hasFormula?(e.openBlock(),e.createElementBlock("div",bi,[n[8]||(n[8]=e.createElementVNode("label",null,"公式",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i=>b.formula=i,class:"qukt-cell-input",placeholder:"如 group_total * 0.01 + group_total"},null,8,hi),[[e.vModelText,b.formula]])])):e.unref(j)(b.type).hasDefault?(e.openBlock(),e.createElementBlock("div",yi,[n[9]||(n[9]=e.createElementVNode("label",null,"默认值",-1)),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":i=>b.default=i,class:"qukt-cell-input",placeholder:"默认值"},null,8,Ei),[[e.vModelText,b.default,void 0,{number:!0}]])])):e.unref(j)(b.type).hasText?(e.openBlock(),e.createElementBlock("div",gi,[n[10]||(n[10]=e.createElementVNode("label",null,"显示文本",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i=>b.text=i,class:"qukt-cell-input",placeholder:"显示文本"},null,8,Vi),[[e.vModelText,b.text]])])):e.createCommentVNode("",!0),e.createElementVNode("div",Ni,[n[11]||(n[11]=e.createElementVNode("label",null,"样式",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:i=>d(b.style)},"设置",8,_i)])]))),128)),m.value.length===0?(e.openBlock(),e.createElementBlock("div",qi,"还没有汇总行,点上方按钮添加")):e.createCommentVNode("",!0)]),e.createElementVNode("div",wi,[e.createElementVNode("div",Bi,[n[13]||(n[13]=e.createElementVNode("div",{class:"qukt-preview-label"},"汇总预览",-1)),e.createElementVNode("div",xi,[m.value.length===0?(e.openBlock(),e.createElementBlock("div",$i,"暂无汇总字段")):(e.openBlock(),e.createElementBlock("div",Ci,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,b=>(e.openBlock(),e.createElementBlock("div",{key:b.field,class:"qukt-sp-row"},[e.createElementVNode("span",Si,e.toDisplayString(b.label||"标签"),1),e.createElementVNode("span",{class:"qukt-sp-value",style:e.normalizeStyle(e.unref(Me)(b))},e.toDisplayString(A(b)),5)]))),128))])),m.value.length>0?(e.openBlock(),e.createElementBlock("div",Di,[...n[12]||(n[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(re,{visible:y.value,modelValue:_.value,showBorder:!1,showAlign:!1,showWidth:!1,title:"汇总值样式","onUpdate:modelValue":n[0]||(n[0]=b=>Object.assign(_.value,b)),onClose:n[1]||(n[1]=b=>y.value=!1)},null,8,["visible","modelValue"])]))}},Ti={class:"qukt-help-dialog"},Ui={class:"qukt-help-header"},Mi={__name:"HelpModal",props:{visible:{type:Boolean,default:!1}},emits:["close"],setup(t){return(o,l)=>t.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qukt-help-modal",onClick:l[1]||(l[1]=e.withModifiers(a=>o.$emit("close"),["self"]))},[e.createElementVNode("div",Ti,[e.createElementVNode("div",Ui,[l[2]||(l[2]=e.createElementVNode("h3",null,"📖 报价单生成器 — 使用教程",-1)),e.createElementVNode("button",{class:"qukt-close-btn",onClick:l[0]||(l[0]=a=>o.$emit("close"))},"✕")]),l[3]||(l[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)}},oi={class:"qukt-designer"},ni={class:"qukt-tabs"},ii={key:0,class:"qukt-tab-content"},ai={key:1,class:"qukt-tab-content"},si={key:2,class:"qukt-tab-content"},ri={key:3,class:"qukt-tab-content"},di={key:4,class:"qukt-tab-content qukt-tab-content-preview"},ci={__name:"QuokitTemplate",props:{tpl:{type:Object,default:ce},breakpoint:{type:Number,default:1100}},emits:["update:tpl"],setup(o,{expose:l,emit:t}){const d=o,b=t,m=e.ref("cols"),r=e.ref(!1),V=e.ref(!1),N=Re([],{}),q=pe([]),s=pe([]),f=Oe([]);let g="";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:f.toTpl()}));e.watch(()=>d.tpl,()=>{const k=ie(d.tpl);H(k,D.value)||(N.setColumns(d.tpl.columns),N.setGroupRules(d.tpl.group_rules),q.setSections(d.tpl.header_sections),s.setSections(d.tpl.footer_sections),f.setFields(d.tpl.summary_fields))},{immediate:!0});const M=Xe(k=>{b("update:tpl",k)},200);e.watch(D,()=>{const k=JSON.stringify(D.value);k!==g&&(g=k,M(D.value))},{deep:!0}),e.onMounted(()=>{b("update:tpl",D.value)}),e.onBeforeUnmount(()=>{M.cancel()});const z=e.computed(()=>D.value),F=e.computed(()=>Ie(N.tpl.columns,3));return l({getTemplateJSON(){return D.value},showHelp(){r.value=!0}}),(k,i)=>(e.openBlock(),e.createElementBlock("div",oi,[e.createElementVNode("div",ni,[e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:m.value==="cols"}]),onClick:i[0]||(i[0]=n=>m.value="cols")},"① 表头列",2),e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:m.value==="header"}]),onClick:i[1]||(i[1]=n=>m.value="header")},"② 页面头部",2),e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:m.value==="summary"}]),onClick:i[2]||(i[2]=n=>m.value="summary")},"③ 汇总区域",2),e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:m.value==="footer"}]),onClick:i[3]||(i[3]=n=>m.value="footer")},"④ 页面底部",2),e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:m.value==="preview"}]),onClick:i[4]||(i[4]=n=>m.value="preview")},"⑤ 总体预览",2)]),m.value==="cols"?(e.openBlock(),e.createElementBlock("div",ii,[e.createVNode(kl,{columns:e.unref(N).columns,"onUpdate:columns":i[5]||(i[5]=n=>e.unref(N).columns=n),"group-rules":e.unref(N).groupRules,"onUpdate:groupRules":i[6]||(i[6]=n=>e.unref(N).groupRules=n),breakpoint:o.breakpoint,onHelp:i[7]||(i[7]=n=>r.value=!0),onOpenGroup:i[8]||(i[8]=n=>V.value=!0)},null,8,["columns","group-rules","breakpoint"])])):e.createCommentVNode("",!0),m.value==="header"?(e.openBlock(),e.createElementBlock("div",ai,[e.createVNode(No,{sections:e.unref(q).sections,"onUpdate:sections":i[9]||(i[9]=n=>e.unref(q).sections=n),breakpoint:o.breakpoint},null,8,["sections","breakpoint"])])):e.createCommentVNode("",!0),m.value==="summary"?(e.openBlock(),e.createElementBlock("div",si,[e.createVNode(vn,{fields:e.unref(f).fields,"onUpdate:fields":i[10]||(i[10]=n=>e.unref(f).fields=n),breakpoint:o.breakpoint},null,8,["fields","breakpoint"])])):e.createCommentVNode("",!0),m.value==="footer"?(e.openBlock(),e.createElementBlock("div",ri,[e.createVNode(En,{sections:e.unref(s).sections,"onUpdate:sections":i[11]||(i[11]=n=>e.unref(s).sections=n),breakpoint:o.breakpoint},null,8,["sections","breakpoint"])])):e.createCommentVNode("",!0),m.value==="preview"?(e.openBlock(),e.createElementBlock("div",di,[e.createVNode(me,{tpl:z.value,data:F.value},null,8,["tpl","data"])])):e.createCommentVNode("",!0),e.createVNode(li,{visible:r.value,onClose:i[12]||(i[12]=n=>r.value=!1)},null,8,["visible"]),e.createVNode(Bl,{visible:V.value,columns:e.unref(N).columns,"group-rules":e.unref(N).groupRules,"onUpdate:groupRules":i[13]||(i[13]=n=>e.unref(N).groupRules=n),onClose:i[14]||(i[14]=n=>V.value=!1)},null,8,["visible","columns","group-rules"])]))}},mi={class:"qukt-page"},pi={key:0,class:"qukt-bind-section"},ui={class:"qukt-bind-grid"},fi={class:"qukt-bind-label"},ki=["value","onInput","placeholder"],bi={key:1,class:"qukt-bind-section"},hi={class:"qukt-bind-grid"},Ei={class:"qukt-bind-label"},gi=["value","onInput","placeholder"],yi={key:2,class:"qukt-empty-tip"},Vi={key:3,class:"qukt-data-table"},Ni={class:"qukt-main-table"},_i=["onClick"],qi={key:1,class:"qukt-subtotal"},wi=["onClick"],Bi=["onClick"],xi={class:"qukt-de-dialog"},$i={class:"qukt-de-header"},Ci={class:"qukt-de-content"},Si={class:"qukt-form-grid"},Di={class:"qukt-form-cell-label"},Fi=["onUpdate:modelValue","placeholder"],Ti=["step","min","max","onUpdate:modelValue"],Ui=["onUpdate:modelValue","placeholder"],Mi=["onUpdate:modelValue"],zi=["value"],Li={class:"qukt-de-footer"},Ai={__name:"QuokitData",props:{tpl:{type:Object,default:ce},data:{type:Object,default:()=>({headerData:{},rows:[],footerData:{}})}},emits:["update:data"],setup(o,{emit:l}){const t=o,d=l;function b(E){const a=E||{},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,E=>{const{next:a,changed:p}=b(E);p&&d("update:data",a)},{immediate:!0}),e.onMounted(()=>{d("update:data",b(t.data).next)});const m=e.computed(()=>ie(t.tpl)),r=e.computed(()=>Me(m.value.header_sections)),V=e.computed(()=>Me(m.value.footer_sections)),N=e.computed({get:()=>{var E;return((E=t.data)==null?void 0:E.headerData)||{}},set:E=>d("update:data",{...t.data,headerData:E})}),q=e.computed({get:()=>{var E;return((E=t.data)==null?void 0:E.footerData)||{}},set:E=>d("update:data",{...t.data,footerData:E})}),s=e.computed(()=>{var E;return((E=t.data)==null?void 0:E.rows)||[]}),f=e.computed(()=>m.value.columns),g=e.computed(()=>f.value.filter(E=>P(E.editor).editable)),D=e.ref(!1),M=e.ref("add"),z=e.ref(-1),F=e.ref({});function k(){const E={};for(const a of g.value)a.editor===W.NUMBER.value?E[a.field]=a.default??a.min??0:E[a.field]=a.default??"";return E}function i(E,a){var p;d("update:data",{...t.data,headerData:{...((p=t.data)==null?void 0:p.headerData)||{},[E]:a}})}function n(E,a){var p;d("update:data",{...t.data,footerData:{...((p=t.data)==null?void 0:p.footerData)||{},[E]:a}})}function y(){M.value="add",z.value=-1,F.value=k(),D.value=!0}function c(E){M.value="edit",z.value=E,F.value={...s.value[E]},D.value=!0}function O(E){if(!confirm("确定删除这条明细?"))return;const a=[...s.value];a.splice(E,1),d("update:data",{...t.data,rows:a})}function u(){if(M.value==="edit"){const E=[...s.value];E[z.value]={...F.value},d("update:data",{...t.data,rows:E})}else d("update:data",{...t.data,rows:[...s.value,{...F.value}]});D.value=!1}return(E,a)=>(e.openBlock(),e.createElementBlock("div",mi,[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:y},"+ 添加新条目")])]),r.value.length>0?(e.openBlock(),e.createElementBlock("div",pi,[a[5]||(a[5]=e.createElementVNode("div",{class:"qukt-bind-title"},"📌 头部信息",-1)),e.createElementVNode("div",ui,[(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",fi,e.toDisplayString(p.label||p.field),1),e.createElementVNode("input",{class:"qukt-cell-input",value:N.value[p.field]??"",onInput:h=>i(p.field,h.target.value),placeholder:"请输入"+(p.label||p.field)},null,40,ki)]))),128))])])):e.createCommentVNode("",!0),V.value.length>0?(e.openBlock(),e.createElementBlock("div",bi,[a[6]||(a[6]=e.createElementVNode("div",{class:"qukt-bind-title"},"📌 底部信息",-1)),e.createElementVNode("div",hi,[(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",Ei,e.toDisplayString(p.label||p.field),1),e.createElementVNode("input",{class:"qukt-cell-input",value:q.value[p.field]??"",onInput:h=>n(p.field,h.target.value),placeholder:"请输入"+(p.label||p.field)},null,40,gi)]))),128))])])):e.createCommentVNode("",!0),s.value.length===0?(e.openBlock(),e.createElementBlock("div",yi,[...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",Vi,[e.createElementVNode("table",Ni,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.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,h)=>(e.openBlock(),e.createElementBlock("tr",{key:h,onClick:_=>c(h)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,_=>(e.openBlock(),e.createElementBlock("td",{key:_.field},[_.editor===e.unref(W).AUTO_SEQ.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(h+1),1)],64)):e.unref(P)(_.editor).hasFormula?(e.openBlock(),e.createElementBlock("span",qi,e.toDisplayString(e.unref(J)(_.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:_=>c(h)},"编辑",8,wi),e.createElementVNode("button",{class:"qukt-row-btn danger",onClick:_=>O(h)},"删除",8,Bi)])],8,_i))),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",xi,[e.createElementVNode("div",$i,[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",Ci,[e.createElementVNode("div",Si,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,p=>(e.openBlock(),e.createElementBlock("div",{key:p.field,class:e.normalizeClass(["qukt-form-cell",{full:p.editor===e.unref(W).TEXTAREA.value}])},[e.createElementVNode("label",Di,e.toDisplayString(p.title),1),p.editor===e.unref(W).INPUT.value||p.editor===void 0?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,class:"qukt-cell-input","onUpdate:modelValue":h=>F.value[p.field]=h,placeholder:p.title},null,8,Fi)),[[e.vModelText,F.value[p.field]]]):p.editor===e.unref(W).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":h=>F.value[p.field]=h},null,8,Ti)),[[e.vModelText,F.value[p.field],void 0,{number:!0}]]):p.editor===e.unref(W).TEXTAREA.value?e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{key:2,class:"qukt-cell-input",rows:"3","onUpdate:modelValue":h=>F.value[p.field]=h,placeholder:p.title},null,8,Ui)),[[e.vModelText,F.value[p.field]]]):e.unref(P)(p.editor).hasDict?e.withDirectives((e.openBlock(),e.createElementBlock("select",{key:3,class:"qukt-cell-input","onUpdate:modelValue":h=>F.value[p.field]=h},[a[9]||(a[9]=e.createElementVNode("option",{value:""},"-- 请选择 --",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.dict||[],h=>(e.openBlock(),e.createElementBlock("option",{key:h,value:h},e.toDisplayString(h),9,zi))),128))],8,Mi)),[[e.vModelSelect,F.value[p.field]]]):e.createCommentVNode("",!0)],2))),128))])]),e.createElementVNode("div",Li,[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)]))}},ue={title:"总体预览",excel:!0,print:!0,json:!0};function Ri(){const o=e.ref(!1),l=e.reactive({tpl:null,data:null,config:{...ue}});function t(b,m,r={}){l.tpl=b,l.data=m,l.config={...ue,...r},o.value=!0}function d(){o.value=!1}return{open:o,current:l,openPreview:t,closePreview:d}}function Oi(o,l,t={}){const d={...ue,...t},b=document.createElement("div");document.body.appendChild(b);const m=e.createApp({setup(){const r=e.ref(!1);function V(){r.value=!0,setTimeout(()=>{m.unmount(),b.parentNode&&b.parentNode.removeChild(b)},50)}return()=>r.value?null:e.h(Ae,{tpl:o,data:l,config:d,onClose:V})}});m.mount(b)}I.QuokitData=Ai,I.QuokitPreview=Ae,I.QuokitSheet=me,I.QuokitTemplate=ci,I.generateMockRows=Ie,I.openPreviewStatic=Oi,I.useColumns=Re,I.usePreview=Ri,I.useSections=pe,I.useSummary=Oe,Object.defineProperty(I,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)}},Ai={class:"qukt-designer"},Li={class:"qukt-tabs"},zi={key:0,class:"qukt-tab-content"},Ri={key:1,class:"qukt-tab-content"},Oi={key:2,class:"qukt-tab-content"},Ii={key:3,class:"qukt-tab-content"},Wi={key:4,class:"qukt-tab-content qukt-tab-content-preview"},Pi={__name:"QuokitTemplate",props:{tpl:{type:Object,default:pe},breakpoint:{type:Number,default:1100}},emits:["update:tpl"],setup(t,{expose:o,emit:l}){const a=t,k=l,p=e.ref("cols"),m=e.ref(!1),N=e.ref(!1),y=We([],{}),_=fe([]),d=fe([]),f=Pe([]);let g="";const U=e.computed(()=>se({columns:y.tpl.columns,group_rules:y.tpl.group_rules,header_sections:_.toTpl(),footer_sections:d.toTpl(),summary_fields:f.toTpl()}));e.watch(()=>a.tpl,()=>{const V=se(a.tpl);Y(V,U.value)||(y.setColumns(a.tpl.columns),y.setGroupRules(a.tpl.group_rules),_.setSections(a.tpl.header_sections),d.setSections(a.tpl.footer_sections),f.setFields(a.tpl.summary_fields))},{immediate:!0});const A=Ze(V=>{k("update:tpl",V)},200);e.watch(U,()=>{const V=JSON.stringify(U.value);V!==g&&(g=V,A(U.value))},{deep:!0}),e.onMounted(()=>{k("update:tpl",U.value)}),e.onBeforeUnmount(()=>{A.cancel()});const L=e.computed(()=>U.value),D=e.computed(()=>je(y.tpl.columns,3));return o({getTemplateJSON(){return U.value},showHelp(){m.value=!0}}),(V,s)=>(e.openBlock(),e.createElementBlock("div",Ai,[e.createElementVNode("div",Li,[e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:p.value==="cols"}]),onClick:s[0]||(s[0]=n=>p.value="cols")},"① 表头列",2),e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:p.value==="header"}]),onClick:s[1]||(s[1]=n=>p.value="header")},"② 页面头部",2),e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:p.value==="summary"}]),onClick:s[2]||(s[2]=n=>p.value="summary")},"③ 汇总区域",2),e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:p.value==="footer"}]),onClick:s[3]||(s[3]=n=>p.value="footer")},"④ 页面底部",2),e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:p.value==="preview"}]),onClick:s[4]||(s[4]=n=>p.value="preview")},"⑤ 总体预览",2)]),p.value==="cols"?(e.openBlock(),e.createElementBlock("div",zi,[e.createVNode(Gl,{columns:e.unref(y).columns,"onUpdate:columns":s[5]||(s[5]=n=>e.unref(y).columns=n),"group-rules":e.unref(y).groupRules,"onUpdate:groupRules":s[6]||(s[6]=n=>e.unref(y).groupRules=n),onHelp:s[7]||(s[7]=n=>m.value=!0),onOpenGroup:s[8]||(s[8]=n=>N.value=!0)},null,8,["columns","group-rules"])])):e.createCommentVNode("",!0),p.value==="header"?(e.openBlock(),e.createElementBlock("div",Ri,[e.createVNode(tn,{sections:e.unref(_).sections,"onUpdate:sections":s[9]||(s[9]=n=>e.unref(_).sections=n),breakpoint:t.breakpoint},null,8,["sections","breakpoint"])])):e.createCommentVNode("",!0),p.value==="summary"?(e.openBlock(),e.createElementBlock("div",Oi,[e.createVNode(Fi,{fields:e.unref(f).fields,"onUpdate:fields":s[10]||(s[10]=n=>e.unref(f).fields=n),breakpoint:t.breakpoint},null,8,["fields","breakpoint"])])):e.createCommentVNode("",!0),p.value==="footer"?(e.openBlock(),e.createElementBlock("div",Ii,[e.createVNode(Zn,{sections:e.unref(d).sections,"onUpdate:sections":s[11]||(s[11]=n=>e.unref(d).sections=n),breakpoint:t.breakpoint},null,8,["sections","breakpoint"])])):e.createCommentVNode("",!0),p.value==="preview"?(e.openBlock(),e.createElementBlock("div",Wi,[e.createVNode(ue,{tpl:L.value,data:D.value},null,8,["tpl","data"])])):e.createCommentVNode("",!0),e.createVNode(Mi,{visible:m.value,onClose:s[12]||(s[12]=n=>m.value=!1)},null,8,["visible"]),e.createVNode(io,{visible:N.value,columns:e.unref(y).columns,"group-rules":e.unref(y).groupRules,"onUpdate:groupRules":s[13]||(s[13]=n=>e.unref(y).groupRules=n),onClose:s[14]||(s[14]=n=>N.value=!1)},null,8,["visible","columns","group-rules"])]))}},ji={class:"qukt-page"},Ji={key:0,class:"qukt-bind-section"},Qi={class:"qukt-bind-grid"},Xi={class:"qukt-bind-label"},Gi=["value","onInput","placeholder"],Hi={key:1,class:"qukt-bind-section"},Yi={class:"qukt-bind-grid"},Zi={class:"qukt-bind-label"},Ki=["value","onInput","placeholder"],vi={key:2,class:"qukt-empty-tip"},ea={key:3,class:"qukt-data-table"},ta={class:"qukt-main-table"},la=["onClick"],oa={key:1,class:"qukt-subtotal"},na=["onClick"],ia=["onClick"],aa={class:"qukt-de-dialog"},sa={class:"qukt-de-header"},ra={class:"qukt-de-content"},da={class:"qukt-form-grid"},ca={class:"qukt-form-cell-label"},ma=["onUpdate:modelValue","placeholder"],pa=["step","min","max","onUpdate:modelValue"],ua=["onUpdate:modelValue","placeholder"],fa=["onUpdate:modelValue"],ka=["value"],ba={class:"qukt-de-footer"},ha={__name:"QuokitData",props:{tpl:{type:Object,default:pe},data:{type:Object,default:()=>({headerData:{},rows:[],footerData:{}})}},emits:["update:data"],setup(t,{emit:o}){const l=t,a=o;function k(E){const r=E||{},u=!("headerData"in r)||!("rows"in r)||!("footerData"in r);return{next:{headerData:r.headerData||{},rows:r.rows||[],footerData:r.footerData||{}},changed:u}}e.watch(()=>l.data,E=>{const{next:r,changed:u}=k(E);u&&a("update:data",r)},{immediate:!0}),e.onMounted(()=>{a("update:data",k(l.data).next)});const p=e.computed(()=>se(l.tpl)),m=e.computed(()=>ze(p.value.header_sections)),N=e.computed(()=>ze(p.value.footer_sections)),y=e.computed({get:()=>{var E;return((E=l.data)==null?void 0:E.headerData)||{}},set:E=>a("update:data",{...l.data,headerData:E})}),_=e.computed({get:()=>{var E;return((E=l.data)==null?void 0:E.footerData)||{}},set:E=>a("update:data",{...l.data,footerData:E})}),d=e.computed(()=>{var E;return((E=l.data)==null?void 0:E.rows)||[]}),f=e.computed(()=>p.value.columns),g=e.computed(()=>f.value.filter(E=>I(E.editor).editable)),U=e.ref(!1),A=e.ref("add"),L=e.ref(-1),D=e.ref({});function V(){const E={};for(const r of g.value)r.editor===P.NUMBER.value?E[r.field]=r.default??r.min??0:E[r.field]=r.default??"";return E}function s(E,r){var u;a("update:data",{...l.data,headerData:{...((u=l.data)==null?void 0:u.headerData)||{},[E]:r}})}function n(E,r){var u;a("update:data",{...l.data,footerData:{...((u=l.data)==null?void 0:u.footerData)||{},[E]:r}})}function b(){A.value="add",L.value=-1,D.value=V(),U.value=!0}function i(E){A.value="edit",L.value=E,D.value={...d.value[E]},U.value=!0}function x(E){if(!confirm("确定删除这条明细?"))return;const r=[...d.value];r.splice(E,1),a("update:data",{...l.data,rows:r})}function c(){if(A.value==="edit"){const E=[...d.value];E[L.value]={...D.value},a("update:data",{...l.data,rows:E})}else a("update:data",{...l.data,rows:[...d.value,{...D.value}]});U.value=!1}return(E,r)=>(e.openBlock(),e.createElementBlock("div",ji,[e.createElementVNode("div",{class:"qukt-toolbar"},[r[4]||(r[4]=e.createElementVNode("span",{class:"qukt-tip"},"点击行可快速编辑,预估总价会自动计算",-1)),e.createElementVNode("div",{class:"qukt-btn-group-inline"},[e.createElementVNode("button",{class:"qukt-btn",onClick:b},"+ 添加新条目")])]),m.value.length>0?(e.openBlock(),e.createElementBlock("div",Ji,[r[5]||(r[5]=e.createElementVNode("div",{class:"qukt-bind-title"},"📌 头部信息",-1)),e.createElementVNode("div",Qi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,u=>(e.openBlock(),e.createElementBlock("div",{key:"h-"+u.field,class:"qukt-bind-item"},[e.createElementVNode("label",Xi,e.toDisplayString(u.label||u.field),1),e.createElementVNode("input",{class:"qukt-cell-input",value:y.value[u.field]??"",onInput:h=>s(u.field,h.target.value),placeholder:"请输入"+(u.label||u.field)},null,40,Gi)]))),128))])])):e.createCommentVNode("",!0),N.value.length>0?(e.openBlock(),e.createElementBlock("div",Hi,[r[6]||(r[6]=e.createElementVNode("div",{class:"qukt-bind-title"},"📌 底部信息",-1)),e.createElementVNode("div",Yi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.value,u=>(e.openBlock(),e.createElementBlock("div",{key:"f-"+u.field,class:"qukt-bind-item"},[e.createElementVNode("label",Zi,e.toDisplayString(u.label||u.field),1),e.createElementVNode("input",{class:"qukt-cell-input",value:_.value[u.field]??"",onInput:h=>n(u.field,h.target.value),placeholder:"请输入"+(u.label||u.field)},null,40,Ki)]))),128))])])):e.createCommentVNode("",!0),d.value.length===0?(e.openBlock(),e.createElementBlock("div",vi,[...r[7]||(r[7]=[e.createElementVNode("div",{class:"qukt-empty-icon"},"📋",-1),e.createElementVNode("div",{class:"qukt-empty-text"},"暂无数据,点击下方按钮添加第一条明细",-1)])])):e.createCommentVNode("",!0),d.value.length>0?(e.openBlock(),e.createElementBlock("div",ea,[e.createElementVNode("table",ta,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,u=>(e.openBlock(),e.createElementBlock("th",{key:u.field,style:e.normalizeStyle({width:u.width+"px"})},e.toDisplayString(u.title),5))),128)),r[8]||(r[8]=e.createElementVNode("th",{width:"140"},"操作",-1))])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(u,h)=>(e.openBlock(),e.createElementBlock("tr",{key:h,onClick:q=>i(h)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,q=>(e.openBlock(),e.createElementBlock("td",{key:q.field},[q.editor===e.unref(P).AUTO_SEQ.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(h+1),1)],64)):e.unref(I)(q.editor).hasFormula?(e.openBlock(),e.createElementBlock("span",oa,e.toDisplayString(e.unref(G)(q.formula||"0",u).toFixed(2)),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(u[q.field]),1)],64))]))),128)),e.createElementVNode("td",{class:"qukt-op-cell",onClick:r[0]||(r[0]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("button",{class:"qukt-row-btn",onClick:q=>i(h)},"编辑",8,na),e.createElementVNode("button",{class:"qukt-row-btn danger",onClick:q=>x(h)},"删除",8,ia)])],8,la))),128))])])])):e.createCommentVNode("",!0),U.value?(e.openBlock(),e.createElementBlock("div",{key:4,class:"qukt-de-mask",onClick:r[3]||(r[3]=e.withModifiers(u=>U.value=!1,["self"]))},[e.createElementVNode("div",aa,[e.createElementVNode("div",sa,[e.createElementVNode("span",null,e.toDisplayString(A.value==="edit"?"编辑明细":"添加明细"),1),e.createElementVNode("button",{class:"qukt-de-close",onClick:r[1]||(r[1]=u=>U.value=!1)},"✕")]),e.createElementVNode("div",ra,[e.createElementVNode("div",da,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,u=>(e.openBlock(),e.createElementBlock("div",{key:u.field,class:e.normalizeClass(["qukt-form-cell",{full:u.editor===e.unref(P).TEXTAREA.value}])},[e.createElementVNode("label",ca,e.toDisplayString(u.title),1),u.editor===e.unref(P).INPUT.value||u.editor===void 0?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,class:"qukt-cell-input","onUpdate:modelValue":h=>D.value[u.field]=h,placeholder:u.title},null,8,ma)),[[e.vModelText,D.value[u.field]]]):u.editor===e.unref(P).NUMBER.value?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:1,class:"qukt-cell-input",type:"number",step:u.step??(u.min??0)<1?"0.01":"1",min:u.min,max:u.max,"onUpdate:modelValue":h=>D.value[u.field]=h},null,8,pa)),[[e.vModelText,D.value[u.field],void 0,{number:!0}]]):u.editor===e.unref(P).TEXTAREA.value?e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{key:2,class:"qukt-cell-input",rows:"3","onUpdate:modelValue":h=>D.value[u.field]=h,placeholder:u.title},null,8,ua)),[[e.vModelText,D.value[u.field]]]):e.unref(I)(u.editor).hasDict?e.withDirectives((e.openBlock(),e.createElementBlock("select",{key:3,class:"qukt-cell-input","onUpdate:modelValue":h=>D.value[u.field]=h},[r[9]||(r[9]=e.createElementVNode("option",{value:""},"-- 请选择 --",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.dict||[],h=>(e.openBlock(),e.createElementBlock("option",{key:h,value:h},e.toDisplayString(h),9,ka))),128))],8,fa)),[[e.vModelSelect,D.value[u.field]]]):e.createCommentVNode("",!0)],2))),128))])]),e.createElementVNode("div",ba,[e.createElementVNode("button",{class:"qukt-btn",onClick:r[2]||(r[2]=u=>U.value=!1)},"取消"),e.createElementVNode("button",{class:"qukt-btn qukt-btn-primary",onClick:c},"确定")])])])):e.createCommentVNode("",!0)]))}},be={title:"总体预览",excel:!0,print:!0,json:!0};function ya(){const t=e.ref(!1),o=e.reactive({tpl:null,data:null,config:{...be}});function l(k,p,m={}){o.tpl=k,o.data=p,o.config={...be,...m},t.value=!0}function a(){t.value=!1}return{open:t,current:o,openPreview:l,closePreview:a}}function Ea(t,o,l={}){const a={...be,...l},k=document.createElement("div");document.body.appendChild(k);const p=e.createApp({setup(){const m=e.ref(!1);function N(){m.value=!0,setTimeout(()=>{p.unmount(),k.parentNode&&k.parentNode.removeChild(k)},50)}return()=>m.value?null:e.h(Ie,{tpl:t,data:o,config:a,onClose:N})}});p.mount(k)}O.QuokitData=ha,O.QuokitPreview=Ie,O.QuokitSheet=ue,O.QuokitTemplate=Pi,O.generateMockRows=je,O.getConfig=Kt,O.openPreviewStatic=Ea,O.resetConfig=vt,O.setConfig=Zt,O.useColumns=We,O.usePreview=ya,O.useSections=fe,O.useSummary=Pe,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})});
|