vue-quokit 0.1.2 → 0.1.3

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