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