vue-quokit 0.1.2 → 0.1.4

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