vue-quokit 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +6 -6
- package/dist/index.mjs +1093 -1107
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".qukt-toolbar{display:flex;align-items:center;gap:10px;margin-bottom:12px;flex-wrap:wrap}.qukt-tip{color:#909399;font-size:13px;margin-right:auto}.qukt-tip code{background:#f5f7fa;padding:1px 6px;border-radius:3px}.qukt-btn-group-inline{display:flex;gap:6px}.qukt-btn{padding:6px 14px;border:1px solid #dcdfe6;border-radius:4px;background:#fff;cursor:pointer;font-size:13px}.qukt-btn:hover{border-color:#409eff;color:#409eff}.qukt-btn-primary{background:#409eff;border-color:#409eff;color:#fff}.qukt-btn-primary:hover{background:#66b1ff;color:#fff}.qukt-btn-ghost{background:transparent;border:1px dashed #dcdfe6;color:#909399;margin-top:8px}.qukt-mini-btn{background:transparent;border:1px solid #dcdfe6;border-radius:3px;padding:2px 8px;cursor:pointer;font-size:12px;margin-right:3px}.qukt-mini-btn:hover{border-color:#409eff;color:#409eff}.qukt-mini-btn:disabled{opacity:.3;cursor:not-allowed}.qukt-mini-btn.danger:hover{border-color:#f56c6c;color:#f56c6c}.qukt-muted{color:#c0c4cc;font-size:12px}.qukt-cell-input{flex:1;width:100%;border:1px solid #dcdfe6;border-radius:3px;padding:4px 8px;font-size:13px;outline:none;min-width:0;box-sizing:border-box}.qukt-cell-input:focus{border-color:#409eff}.qukt-cell-input.small{flex:0 0 160px;max-width:100%}.qukt-cell-input.tiny{width:56px;height:22px;font-size:11px;padding:0 4px;flex:none}.qukt-color-input{width:24px;height:22px;border:1px solid #dcdfe6;border-radius:3px;padding:0;cursor:pointer;background:#fff}.qukt-chk-label{font-size:12px;color:#606266;display:inline-flex;align-items:center;gap:3px;flex-shrink:0}.qukt-designer{padding:0;display:flex;flex-direction:column;height:100%;min-height:0}.qukt-tabs{display:flex;gap:0;border-bottom:2px solid #ebeef5;margin-bottom:16px;flex-shrink:0}.qukt-tab{padding:10px 20px;cursor:pointer;font-size:14px;color:#909399;border-bottom:2px solid transparent;margin-bottom:-2px;transition:all .2s}.qukt-tab:hover{color:#409eff}.qukt-tab.active{color:#409eff;border-bottom-color:#409eff;font-weight:600}.qukt-tab-content{padding:10px 0;flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.qukt-tab-content>*{flex:1;min-height:0;display:flex;flex-direction:column}.qukt-tab-content-preview{overflow-y:auto}.qukt-tab-content-preview>*{flex:none;min-height:0}.qukt-page{padding:20px;background:#fff;border-radius:8px;height:100%;overflow-y:auto}.qukt-empty-tip{text-align:center;padding:60px 20px;background:#fafbfc;border:2px dashed #dcdfe6;border-radius:8px}.qukt-empty-icon{font-size:48px;margin-bottom:12px}.qukt-empty-text{color:#909399;font-size:14px;margin-bottom:16px}.qukt-data-table{border:1px solid #ebeef5;border-radius:6px;overflow:hidden;margin-bottom:16px}.qukt-main-table{width:100%;border-collapse:collapse;font-size:13px}.qukt-main-table th{background:#f5f7fa;padding:10px 12px;text-align:left;font-weight:600;color:#303133;border:1px solid #ebeef5}.qukt-main-table td{padding:10px 12px;border:1px solid #ebeef5;color:#606266}.qukt-main-table tbody tr{cursor:pointer;transition:background .15s}.qukt-main-table tbody tr:hover{background:#f5f7fa}.qukt-subtotal{color:#67c23a;font-weight:500;text-align:right;display:block}.qukt-op-cell{white-space:nowrap}.qukt-row-btn{background:none;border:none;cursor:pointer;font-size:13px;color:#409eff;margin-right:10px;padding:2px 4px;border-radius:3px}.qukt-row-btn:hover{text-decoration:underline}.qukt-row-btn.danger{color:#f56c6c}.qukt-de-mask,.qukt-gr-mask{position:fixed;top:0;right:0;bottom:0;left:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:1000}.qukt-de-dialog{background:#fff;border-radius:10px;width:420px;max-width:92vw;max-height:86vh;display:flex;flex-direction:column;box-shadow:0 10px 40px #00000040}.qukt-de-header{padding:16px 20px;border-bottom:1px solid #ebeef5;display:flex;justify-content:space-between;align-items:center;font-size:15px;font-weight:600;color:#303133;flex-shrink:0}.qukt-de-close{border:none;background:transparent;cursor:pointer;font-size:16px;color:#909399}.qukt-de-close:hover{color:#f56c6c}.qukt-de-content{padding:16px 20px;flex:1;overflow-y:auto}.qukt-de-footer{padding:12px 20px;border-top:1px solid #ebeef5;text-align:right;flex-shrink:0}.qukt-form-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.qukt-form-cell.full{grid-column:1 / -1}.qukt-form-cell-label{display:block;font-size:13px;color:#606266;margin-bottom:6px}.qukt-gr-dialog{width:380px;background:#fff;border-radius:8px;box-shadow:0 8px 28px #0003}.qukt-gr-header{padding:12px 16px;border-bottom:1px solid #ebeef5;display:flex;justify-content:space-between;align-items:center;font-size:15px;font-weight:600;color:#303133}.qukt-gr-close{border:none;background:transparent;cursor:pointer;font-size:16px;color:#909399}.qukt-gr-close:hover{color:#f56c6c}.qukt-gr-content{padding:14px 16px;max-height:70vh;overflow-y:auto}.qukt-gr-footer{padding:10px 16px;border-top:1px solid #ebeef5;text-align:right}.qukt-gr-tips{background:#ecf5ff;border:1px solid #d9ecff;border-radius:6px;padding:8px 10px;margin-bottom:14px}.qukt-gr-tips p{font-size:12px;color:#606266;margin:4px 0;line-height:1.6}.qukt-gr-tips code{background:#fff;padding:1px 6px;border-radius:3px;font-size:11px}.qukt-gr-form{display:flex;flex-direction:column;gap:10px}.qukt-gr-form-row{display:flex;align-items:center;gap:10px}.qukt-gr-form-label{width:80px;text-align:right;font-size:12px;color:#606266;flex-shrink:0}.qukt-table-wrap{width:100%;overflow:auto;flex:1;min-height:0}.qukt-design-table{width:100%;min-width:var(--qukt-cols-min-width, 960px);border-collapse:collapse;font-size:13px}.qukt-design-table--fixed{table-layout:fixed;width:auto;border-collapse:collapse;font-size:13px}.qukt-design-table th,.qukt-design-table td,.qukt-design-table--fixed th,.qukt-design-table--fixed td{border:1px solid #ebeef5;padding:6px 8px;text-align:center}.qukt-design-table th,.qukt-design-table--fixed th{background:#f5f7fa;font-weight:600;color:#303133}.qukt-design-table td.idx,.qukt-design-table--fixed td.idx{color:#909399;background:#fafbfc;width:50px;text-align:center}.qukt-design-table tbody tr:hover,.qukt-design-table--fixed tbody tr:hover{background:#fafbfc}.qukt-col-merge label{display:flex;align-items:center;gap:4px;font-size:12px;cursor:pointer}.qukt-title-group{display:flex;gap:2px;align-items:center}.qukt-title-group .qukt-cell-input{min-width:0}.qukt-title-group .pref-suf{flex:0 0 36px;max-width:48px;background:#fafbfc;font-size:12px;color:#606266}.qukt-title-group .pref-suf::placeholder{color:#c0c4cc;font-size:11px}.qukt-quote-sheet{background:#fff;padding:32px 40px;border-radius:4px}.qukt-q-title{margin:0 0 12px;font-size:18px;font-weight:700;color:#303133;text-align:center}.qukt-q-divider{border-top:1px solid #dcdfe6;margin:10px 0}.qukt-q-text{margin:4px 0;font-size:13px;color:#606266}.qukt-q-row{display:flex;margin-bottom:4px}.qukt-q-cell{padding:8px 12px;font-size:13px;background:#fff;box-sizing:border-box}.qukt-q-label{color:#909399}.qukt-q-value{color:#303133;font-weight:500}.qukt-q-table-wrap{margin-top:10px}.qukt-q-table{width:100%;border-collapse:collapse;font-size:13px}.qukt-q-table th{background:#f5f7fa;padding:10px 12px;border:1px solid #dcdfe6;text-align:center;font-weight:600;color:#303133;white-space:pre-wrap}.qukt-q-table td{padding:9px 12px;border:1px solid #dcdfe6;color:#606266;text-align:center;vertical-align:middle;white-space:pre-wrap}.qukt-q-table td.merged-cell{background:#fafbfc;font-weight:500}.qukt-q-table tr.subtotal-row td.subtotal-label{background:#f0f9ff;color:#409eff;font-weight:600;text-align:right;padding-right:16px;font-style:italic;white-space:pre}.qukt-q-table tr.subtotal-row td.subtotal-value{background:#f0f9ff;color:#409eff;font-weight:600;text-align:right;white-space:pre}.qukt-q-empty{text-align:center;padding:30px;color:#c0c4cc;font-size:14px}.qukt-q-summary{margin-top:10px;margin-left:auto;width:320px}.qukt-q-summary-row{display:flex;justify-content:space-between;padding:6px 0;border-bottom:1px dashed #ebeef5;font-size:13px}.qukt-q-summary-label{color:#606266}.qukt-q-summary-value{font-variant-numeric:tabular-nums;white-space:pre}.qukt-q-footer{margin-top:10px}.qukt-help-modal{position:fixed;top:0;left:0;right:0;bottom:0;background:#00000073;z-index:9999;display:flex;align-items:center;justify-content:center}.qukt-help-dialog{background:#fff;border-radius:10px;width:780px;max-width:92vw;max-height:86vh;display:flex;flex-direction:column;box-shadow:0 10px 40px #00000040}.qukt-help-header{padding:16px 24px;border-bottom:1px solid #ebeef5;display:flex;justify-content:space-between;align-items:center}.qukt-help-header h3{margin:0;font-size:17px;color:#303133}.qukt-close-btn{background:transparent;border:none;font-size:20px;cursor:pointer;color:#909399;padding:4px 10px;border-radius:4px}.qukt-close-btn:hover{background:#f5f7fa;color:#303133}.qukt-help-body{padding:20px 28px 28px;overflow-y:auto;font-size:13px;color:#606266;line-height:1.7}.qukt-help-section{margin-bottom:24px}.qukt-help-section h4{font-size:15px;color:#409eff;margin:0 0 10px;padding-bottom:6px;border-bottom:1px dashed #dcdfe6}.qukt-help-section p{margin:6px 0}.qukt-help-section ul,.qukt-help-section ol{margin:6px 0 6px 22px;padding:0}.qukt-help-section li{margin:3px 0}.qukt-help-section code{background:#f0f2f5;color:#d63384;padding:1px 6px;border-radius:3px;font-size:12px;font-family:Consolas,monospace}.qukt-help-section pre.code{background:#f5f7fa;border:1px solid #ebeef5;border-radius:5px;padding:10px 14px;overflow-x:auto;font-size:12px;font-family:Consolas,Monaco,monospace;line-height:1.55;margin:8px 0;color:#495057}.qukt-help-table{width:100%;border-collapse:collapse;margin:10px 0;font-size:12.5px}.qukt-help-table th,.qukt-help-table td{border:1px solid #ebeef5;padding:7px 10px;text-align:left}.qukt-help-table th{background:#f5f7fa;font-weight:600;color:#303133}.qukt-help-table td:first-child{white-space:nowrap;font-weight:500}.qukt-tip-box{background:#ecf5ff;border-left:3px solid #409eff;padding:8px 14px;border-radius:3px;color:#606266;margin:10px 0;font-size:12.5px}.qukt-tip-box.final-tip{background:#f0f9eb;border-left-color:#67c23a;font-size:13px;padding:14px 18px}.qukt-steps{padding-left:22px}.qukt-steps li{margin-bottom:4px}.qukt-two-col{display:flex;gap:16px;flex:1;min-height:0;overflow:hidden}.qukt-col-left{flex:1;min-width:0;overflow-y:auto;padding-right:4px}.qukt-col-right{width:360px;flex-shrink:0;overflow-y:auto;max-height:100%}.qukt-two-col.is-narrow{flex-direction:column;overflow-y:auto}.qukt-two-col.is-narrow .qukt-col-right{width:100%;flex-shrink:0;overflow:visible}.qukt-two-col.is-narrow .qukt-col-left{overflow:visible}.qukt-sec-block{border:1px solid #ebeef5;border-radius:6px;padding:12px;margin-bottom:10px;background:#fafbfc}.qukt-sec-block--divider .qukt-sec-header{margin-bottom:0}.qukt-sec-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}.qukt-sec-type{font-size:13px;font-weight:600;color:#409eff;background:#ecf5ff;padding:2px 8px;border-radius:3px}.qukt-sec-actions{display:flex;gap:2px}.qukt-sec-row{display:flex;align-items:center;gap:6px;margin-bottom:6px;flex-wrap:wrap}.qukt-sec-row label,.qukt-sec-row .label{font-size:12px;color:#606266;min-width:54px;flex-shrink:0}.qukt-inline-group{display:inline-flex;align-items:center;gap:6px;flex-shrink:0}.qukt-cells-list{display:flex;flex-direction:column;gap:8px}.qukt-cell-block{border:1px dashed #dcdfe6;border-radius:4px;padding:8px;background:#fff}.qukt-cell-toolbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px;font-size:12px;color:#909399}.qukt-border-config{flex-wrap:wrap}.qukt-border-config>.label{width:100%;margin-bottom:4px}.qukt-border-group{display:flex;flex-wrap:wrap;gap:4px;flex:1}.qukt-border-item{display:flex;align-items:center;gap:2px;padding:2px 4px;background:#f8f9fb;border-radius:3px;font-size:11px;color:#606266}.qukt-border-item>span{min-width:12px;text-align:center}.qukt-border-config .qukt-mini-btn{margin-left:4px}.qukt-preview-box{border:1px solid #dcdfe6;border-radius:6px;overflow:hidden;background:#fff;top:20px}.qukt-preview-label{padding:8px 12px;background:#f5f7fa;font-size:13px;font-weight:600;color:#606266;border-bottom:1px solid #ebeef5}.qukt-preview-inner{padding:14px}.qukt-p-title{margin:6px 0 10px}.qukt-p-divider{height:1px;background:#dcdfe6;margin:8px 0}.qukt-p-text{margin:4px 0}.qukt-p-row{display:flex;margin-bottom:6px}.qukt-p-cell{padding:6px 10px;background:#fff}.qukt-p-label{opacity:.8}.qukt-p-bind-placeholder{opacity:.7}.qukt-empty-hint{text-align:center;padding:20px;color:#c0c4cc;font-size:13px}.qukt-preview-title{font-size:13px;font-weight:600;color:#606266;margin:0 0 10px}.qukt-summary-preview{border:1px solid #ebeef5;border-radius:6px;padding:12px;background:#fff}.qukt-sp-row{display:flex;justify-content:space-between;align-items:center;padding:6px 0;font-size:13px}.qukt-sp-label{color:#606266}.qukt-sp-value{font-weight:500;font-size:12px;white-space:pre}.qukt-preview-help{margin-top:12px;padding:10px 12px;background:#f4f4f5;border-radius:6px;font-size:12px;color:#909399;line-height:1.8}.qukt-preview-help b{color:#606266}.qukt-preview-help code{background:#e9e9eb;padding:1px 5px;border-radius:3px;color:#606266;font-family:monospace}.qukt-bind-section{margin-bottom:16px;background:#f4f9ff;border:1px solid #dbe8fb;border-radius:8px;padding:14px 16px}.qukt-bind-title{font-size:13px;font-weight:600;color:#409eff;margin-bottom:10px}.qukt-bind-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:10px 16px}.qukt-bind-item{display:flex;flex-direction:row;align-items:center;gap:8px}.qukt-bind-label{font-size:12px;color:#606266;font-weight:500;white-space:nowrap;min-width:60px;flex-shrink:0}.qukt-bind-item .qukt-cell-input{flex:1}.qukt-preview-mask[data-v-8a922e81]{position:fixed;top:0;right:0;bottom:0;left:0;background:#00000073;display:flex;align-items:flex-start;justify-content:center;padding:40px 24px;overflow-y:auto;z-index:9999}.qukt-preview-box[data-v-8a922e81]{width:min(1100px,96vw);background:#fff;border-radius:8px;display:flex;flex-direction:column;box-shadow:0 10px 40px #0000002e}.qukt-preview-header[data-v-8a922e81]{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;border-bottom:1px solid #ebeef5;flex-shrink:0}.qukt-preview-title[data-v-8a922e81]{font-size:15px;font-weight:600;color:#303133}.qukt-preview-close[data-v-8a922e81]{cursor:pointer;color:#909399;font-size:16px;padding:2px 6px;border-radius:3px}.qukt-preview-close[data-v-8a922e81]:hover{background:#f5f7fa;color:#f56c6c}.qukt-preview-body[data-v-8a922e81]{padding:20px;background:#f5f7fa;max-height:75vh;overflow:auto}.qukt-preview-footer[data-v-8a922e81]{display:flex;justify-content:flex-end;gap:8px;flex-wrap:wrap;padding:10px 16px;border-top:1px solid #ebeef5;flex-shrink:0}.tool-btn[data-v-8a922e81]{padding:7px 14px;border:1px solid #dcdfe6;border-radius:4px;background:#fff;cursor:pointer;font-size:13px;color:#606266;transition:all .15s}.tool-btn[data-v-8a922e81]:hover{border-color:#409eff;color:#409eff}.qukt-preview-json-mask[data-v-8a922e81]{position:fixed;top:0;right:0;bottom:0;left:0;background:#00000073;display:flex;align-items:center;justify-content:center;z-index:10000}.qukt-preview-json-box[data-v-8a922e81]{width:min(720px,92vw);max-height:80vh;background:#fff;border-radius:8px;display:flex;flex-direction:column;box-shadow:0 10px 40px #0000002e}.qukt-preview-json-body[data-v-8a922e81]{flex:1;overflow:auto;margin:0;padding:14px 16px;background:#1e1e1e;color:#d4d4d4;font-family:Consolas,Monaco,Courier New,monospace;font-size:12.5px;line-height:1.6;white-space:pre}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
-
(function(
|
|
2
|
+
(function(R,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("exceljs")):typeof define=="function"&&define.amd?define(["exports","vue","exceljs"],e):(R=typeof globalThis<"u"?globalThis:R||self,e(R.VueQuokit={},R.Vue,R.ExcelJS))})(this,function(R,e,He){"use strict";function G(t,o){if(!t)return 0;const l=String(t).replace(/\s+/g,"");if(!l)return 0;let a=0;function k(){return l[a]}function p(){return l[a++]}function m(d){if(k()!==d)throw new Error("公式解析错误: 期望 "+d+" at "+a);a++}function N(){const d=k();if(d==="("){p();const f=q();return m(")"),f}if(d==="-")return p(),-N();if(d==="+")return p(),N();if(d>="0"&&d<="9"||d==="."){let f="";for(;a<l.length&&(l[a]>="0"&&l[a]<="9"||l[a]===".");)f+=l[a++];return parseFloat(f)}if(d>="a"&&d<="z"||d>="A"&&d<="Z"||d==="_"){let f="";for(;a<l.length&&(l[a]>="a"&&l[a]<="z"||l[a]>="A"&&l[a]<="Z"||l[a]==="_"||l[a]>="0"&&l[a]<="9");)f+=l[a++];return Number(o[f]||0)}throw new Error('公式解析错误: 非法字符 "'+d+'" at '+a)}function g(){let d=N();for(;a<l.length&&(k()==="*"||k()==="/");){const f=p(),V=N();d=f==="*"?d*V:V===0?0:d/V}return d}function q(){let d=g();for(;a<l.length&&(k()==="+"||k()==="-");){const f=p(),V=g();d=f==="+"?d+V:d-V}return d}try{const d=q();return Math.round(d*100)/100}catch{return 0}}const W={AUTO_SEQ:{value:"AUTO_SEQ",label:"自动序号",defaultWidth:60,defaultTitle:"序号",defaultFieldBase:"seq",hasDict:!1,hasFormula:!1,canMerge:!1,editable:!1},AUTO_CALC:{value:"AUTO_CALC",label:"公式计算",defaultWidth:120,defaultTitle:"计算值",defaultFieldBase:"subtotal",hasDict:!1,hasFormula:!0,canMerge:!1,editable:!1},INPUT:{value:"INPUT",label:"文本输入",defaultWidth:130,defaultTitle:"文本",defaultFieldBase:"custom",hasDict:!1,hasFormula:!1,canMerge:!0,editable:!0},NUMBER:{value:"NUMBER",label:"数字输入",defaultWidth:100,defaultTitle:"数值",defaultFieldBase:"custom",hasDict:!1,hasFormula:!1,canMerge:!0,editable:!0},TEXTAREA:{value:"TEXTAREA",label:"多行文本",defaultWidth:200,defaultTitle:"说明",defaultFieldBase:"custom",hasDict:!1,hasFormula:!1,canMerge:!0,editable:!0},SELECT_DICT:{value:"SELECT_DICT",label:"下拉选择",defaultWidth:130,defaultTitle:"选项",defaultFieldBase:"custom",hasDict:!0,defaultDictStr:"选项1,选项2",hasFormula:!1,canMerge:!0,editable:!0}};Object.keys(W).map(t=>W[t].value);function I(t){return W[t]||W.INPUT}const H={MANUAL_INPUT:{value:"MANUAL_INPUT",label:"手动数值",hasDefault:!0,hasFormula:!1,hasText:!1},AUTO_CALC:{value:"AUTO_CALC",label:"自动计算",hasDefault:!1,hasFormula:!0,hasText:!1},PLAIN_TEXT:{value:"PLAIN_TEXT",label:"纯文本",hasDefault:!1,hasFormula:!1,hasText:!0}};Object.keys(H).map(t=>H[t].value);function j(t){return H[t]||H.MANUAL_INPUT}const ye={TEXT:{value:"text",label:"纯文本"},ROW:{value:"row",label:"表格行"},DIVIDER:{value:"divider",label:"分割线"}};Object.keys(ye).map(t=>ye[t].value);const te={FIELD:{value:"field",label:"绑定字段"},TEXT:{value:"text",label:"纯文本"},IMAGE:{value:"image",label:"图片"}};Object.keys(te).map(t=>te[t].value);function J(t){let o="";for(;t>=0;)o=String.fromCharCode(65+t%26)+o,t=Math.floor(t/26)-1;return o}function Ee(t){return typeof t=="string"?parseFloat(t)/100:0}const le={style:"thin",color:{argb:"FFDCDFE6"}},oe={style:"medium",color:{argb:"FF606266"}},ge=11;function Ve(t){if(!t)return null;const o=t.replace("#","").toUpperCase();return o.length===6?"FF"+o:o}function Ne(t,o){if(!o)return;const l={name:"微软雅黑"};if(o.fontSize&&(l.size=o.fontSize),o.bold&&(l.bold=!0),o.italic&&(l.italic=!0),o.color){const a=Ve(o.color);a&&(l.color={argb:a})}if(t.font=l,o.align&&(t.alignment={horizontal:o.align,vertical:"middle",wrapText:!0,indent:1}),o.border){const a={};for(const k of["top","bottom","left","right"]){const p=o.border[k];if(p&&p.style&&p.width>0){const m=Ve(p.color)||"FFDCDFE6";let N=p.style;N==="solid"&&(N="thin"),a[k]={style:N,color:{argb:m}}}}Object.keys(a).length>0&&(t.border=a)}}function _e(t){if(t==null)return 0;if(typeof t=="number")return String(t).length;const o=String(t);let l=0;for(const a of o)a!==`
|
|
3
3
|
`&&(/[\u4e00-\u9fa5\u3000-\u303f\uff00-\uffef\u2e80-\u2fdf\u31c0-\u31ef]/.test(a)?l+=2:l+=1);return l}function qe(t,o=11){let l=1;for(const p of t){const m=String(p??""),N=m.split(`
|
|
4
|
-
`).length,y=_e(m),d=m.length===0?1:Math.ceil(y/12);l=Math.max(l,N,d)}const a=o+8;return Math.max(50,l*a+16*2)}function we(t,o,l,a,k){for(let p=o;p<=l;p++)for(let m=a;m<=k;m++){const N=t.getCell(p,m),y=N.border||{};N.border={top:y.top||le,left:y.left||le,right:y.right||le,bottom:y.bottom||le}}}function Be(t,o,l,a,k){for(let p=a;p<=k;p++)t.getCell(o,p).border={...t.getCell(o,p).border||{},top:oe},t.getCell(l,p).border={...t.getCell(l,p).border||{},bottom:oe};for(let p=o;p<=l;p++)t.getCell(p,a).border={...t.getCell(p,a).border||{},left:oe},t.getCell(p,k).border={...t.getCell(p,k).border||{},right:oe}}function xe(t,o){return t.bindEnabled&&t.bindField?o[t.bindField]??"":t.text??""}function $e(t,o){const l=t.type===te.FIELD.value&&t.label&&!t.hideLabel;if(t.bindEnabled&&t.bindField){const a=o[t.bindField]??"";return l?t.label+a:a}return t.type===te.FIELD.value?(l?t.label:"")+(t.value??""):t.text??""}async function Ye(t,o,l={}){var E;if(!t||!Array.isArray(t.columns)||t.columns.length===0)throw new Error("模板为空或缺少列定义");const a=(o==null?void 0:o.headerData)||{},k=(o==null?void 0:o.footerData)||{};let p=(o==null?void 0:o.rows)||o||[];Array.isArray(p)||(p=[]);const m=l.layout||"auto-wrap",N=m==="auto-wrap",y=new He.Workbook,_=y.addWorksheet("报价单"),d=t.columns.length,f=J(d-1);let g=1;const U=()=>(t.columns||[]).find(r=>I(r.editor).hasFormula),A=r=>{const u=U(),h=(u==null?void 0:u.formula)||"quantity * unit_price";return G(h,r)};if(t.header_sections){for(const r of t.header_sections)if(r.type==="divider")g++;else if(r.type==="text"){_.mergeCells(`A${g}:${f}${g}`);const u=_.getCell(`A${g}`);u.value=xe(r,a);const h=r.style||{},q=h.fontSize||13;if(u.font={size:q,bold:h.bold===!0,italic:h.italic===!0,name:"微软雅黑"},h.color){const w=h.color.replace("#","").toUpperCase();u.font.color={argb:w.length===6?"FF"+w:w}}u.alignment={horizontal:h.align||"left",vertical:"middle"},_.getRow(g).height=q*2+10,g++}else if(r.type==="row"&&r.cells){const u=r.cells.map(w=>{var B;return Ee((B=w.style)==null?void 0:B.width)||1/r.cells.length});let h=0;const q=u.map(w=>{const B=Math.round(h*d);h+=w;const S=Math.round(h*d)-1;return{start:B,end:Math.max(S,B)}});for(let w=0;w<r.cells.length;w++){const B=r.cells[w],S=q[w],C=`${J(S.start)}${g}`,z=`${J(S.end)}${g}`;C!==z&&_.mergeCells(`${C}:${z}`);const M=_.getCell(C);M.value=$e(B,a);const $=B.style||{},R=$.fontSize||11;if(M.font={size:R,bold:$.bold===!0,italic:$.italic===!0,name:"微软雅黑"},$.color){const F=$.color.replace("#","").toUpperCase();M.font.color={argb:F.length===6?"FF"+F:F}}M.alignment={horizontal:$.align||"left",vertical:"middle"}}_.getRow(g).height=22,g++}}const L=g,D=_.getRow(g);D.values=t.columns.map(r=>r.title),D.font={bold:!0,name:"微软雅黑",size:12},D.fill={type:"pattern",pattern:"solid",fgColor:{argb:"FFE0E0E0"}},D.alignment={horizontal:"center",vertical:"middle",wrapText:N,indent:1},D.height=N?48:44,g++;const V=t.group_rules,s=V==null?void 0:V.merge_field,n=t.columns;if(s){let r=0,u=0;for(;r<p.length;){const h=[];let q=r;for(;q<p.length&&p[q][s]===p[r][s];)h.push(p[q]),q++;const w=g;for(let C=0;C<h.length;C++){u++;const z=h[C],M=n.map(F=>F.editor===P.AUTO_SEQ.value?u:I(F.editor).hasFormula?A(z):z[F.field]??""),$=M.map((F,T)=>(n[T].prefix||"")+F+(n[T].suffix||"")),R=_.getRow(g);R.values=M,R.height=N?qe($,11):36;for(let F=0;F<n.length;F++){const T=n[F],Q=R.getCell(F+1);Ne(Q,T.cellStyle),(T.prefix||T.suffix)&&(Q.value=$[F])}g++}const B=g-1;for(let C=0;C<n.length;C++){const z=n[C];if(z.merge_on_group!==!0)continue;let M=w;for(let $=1;$<h.length;$++)h[$][z.field]!==h[$-1][z.field]&&(w+$-1>M&&_.mergeCells(`${J(C)}${M}:${J(C)}${w+$-1}`),M=w+$);B>M&&_.mergeCells(`${J(C)}${M}:${J(C)}${B}`)}if(V.show_detail_subtotal!==!1&&p[r][s]!==void 0&&p[r][s]!==null&&p[r][s]!==""){const C=h.reduce((Q,K)=>Q+Number(A(K)||0),0),z=J(Math.max(0,d-2));_.mergeCells(`A${g}:${z}${g}`);const M=_.getCell(`A${g}`);M.value=`小计(${p[r][s]})`,M.alignment={horizontal:"right",vertical:"middle"},M.font={bold:!0,italic:!0,color:{argb:"FF409EFF"},name:"微软雅黑",size:11};const $=_.getCell(`${f}${g}`),R=V.subtotal_prefix??"",F=V.subtotal_suffix??"";$.value=R+C.toFixed(2)+F,$.alignment={horizontal:"right",vertical:"middle"},$.font={bold:!0,italic:!0,color:{argb:"FF409EFF"},name:"微软雅黑",size:11};const T=_.getRow(g);T.fill={type:"pattern",pattern:"solid",fgColor:{argb:"FFF0F9FF"}},T.alignment={horizontal:"right",vertical:"middle",wrapText:!0},T.height=32,g++}r=q}}else for(let r=0;r<p.length;r++){const u=p[r],h=n.map(B=>B.editor===P.AUTO_SEQ.value?r+1:I(B.editor).hasFormula?A(u):u[B.field]??""),q=h.map((B,S)=>(n[S].prefix||"")+B+(n[S].suffix||"")),w=_.getRow(g);w.values=h,w.height=N?qe(q,11):36;for(let B=0;B<n.length;B++){const S=n[B],C=w.getCell(B+1);Ne(C,S.cellStyle),(S.prefix||S.suffix)&&(C.value=q[B])}g++}const b=g-1;if(t.summary_fields){g+=1;const r=J(Math.max(0,d-2)),u=J(d-1),h=p.reduce((B,S)=>B+Number(A(S)||0),0),q={group_total:h};for(const B of t.summary_fields)j(B.type).hasDefault&&(q[B.field]=Number(B.default??0));q.grand_total=h+t.summary_fields.filter(B=>j(B.type).hasDefault).reduce((B,S)=>B+q[S.field],0);for(const B of t.summary_fields)j(B.type).hasFormula&&(q[B.field]=G(B.formula||"group_total",q));for(const B of t.summary_fields){const S=j(B.type);let C;S.hasFormula?C=G(B.formula||"group_total",q):S.hasText?C=B.text||"":C=Number(B.default??0);const z=((E=B.style)==null?void 0:E.fontSize)||ge,M=_.getCell(`${r}${g}`),$=_.getCell(`${u}${g}`);M.value=B.label,M.alignment={horizontal:"right",vertical:"middle",indent:1},M.font={name:"微软雅黑",size:ge};const R=B.style||{},F=()=>{const K={name:"微软雅黑",size:z,bold:!!R.bold,italic:!!R.italic};if(R.color){const he=R.color.replace("#","").toUpperCase();K.color={argb:he.length===6?"FF"+he:he}}return K},T=B.prefix||"",Q=B.suffix||"";if(typeof C=="number"){const K=C.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2});$.value=T+K+Q,$.alignment={horizontal:"right",vertical:"middle",indent:1}}else $.value=T+(C??"")+Q,$.alignment={horizontal:"right",vertical:"middle",indent:1};$.font=F(),_.getRow(g).height=Math.max(28,z*2+12),g++}const w=g-1;we(_,L,w,1,d),Be(_,L,w,1,d)}else we(_,L,b,1,d),Be(_,L,b,1,d);if(t.footer_sections){g+=1;for(const r of t.footer_sections)if(r.type==="divider")g++;else if(r.type==="text"){_.mergeCells(`A${g}:${f}${g}`);const u=_.getCell(`A${g}`);u.value=xe(r,k);const h=r.style||{},q=h.fontSize||13;if(u.font={size:q,bold:h.bold===!0,italic:h.italic===!0,name:"微软雅黑"},h.color){const w=h.color.replace("#","").toUpperCase();u.font.color={argb:w.length===6?"FF"+w:w}}u.alignment={horizontal:h.align||"left",vertical:"middle"},_.getRow(g).height=q*2+10,g++}else if(r.type==="row"&&r.cells){const u=r.cells.map(w=>{var B;return Ee((B=w.style)==null?void 0:B.width)||1/r.cells.length});let h=0;const q=u.map(w=>{const B=Math.round(h*d);h+=w;const S=Math.round(h*d)-1;return{start:B,end:Math.max(S,B)}});for(let w=0;w<r.cells.length;w++){const B=r.cells[w],S=q[w],C=`${J(S.start)}${g}`,z=`${J(S.end)}${g}`;C!==z&&_.mergeCells(`${C}:${z}`);const M=_.getCell(C);M.value=$e(B,k);const $=B.style||{};M.alignment={horizontal:$.align||"left",vertical:"middle"};const R={name:"微软雅黑",size:$.fontSize||11,bold:$.bold===!0,italic:$.italic===!0};if($.color){const F=$.color.replace("#","").toUpperCase();R.color={argb:F.length===6?"FF"+F:F}}M.font=R}_.getRow(g).height=22,g++}}const i=50,x=6;for(let r=0;r<d;r++){const u=t.columns[r],h=r+1;if(m==="auto-wrap")_.getColumn(h).width=u.width?Math.max(u.width/7,8):12;else{let q=0;for(let S=1;S<g;S++)q=Math.max(q,_e(_.getCell(S,h).value));const w=u.width?Math.max(u.width/7,10):12,B=Math.min(Math.max(q+2,x),i);_.getColumn(h).width=Math.max(B,w)}}const c=await y.xlsx.writeBuffer();return new Blob([c],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}function W(t){return JSON.parse(JSON.stringify(t))}function Y(t,o){try{return JSON.stringify(t)===JSON.stringify(o)}catch{return!1}}function Ze(t,o){let l=null;const a=function(...k){clearTimeout(l),l=setTimeout(()=>t.apply(this,k),o)};return a.cancel=()=>{clearTimeout(l),l=null},Object.defineProperty(a,"timer",{get(){return l},configurable:!0}),a}const Ce={color:"#303133",fontSize:13,bold:!1,italic:!1,align:"center"};function Se(t=[]){return Array.isArray(t)?t.map(o=>{const l=I(o.editor),a=Array.isArray(o.dict)?o.dict:[];return{...o,field:o.field||"",title:o.title||l.defaultTitle,editor:o.editor||P.INPUT.value,width:o.width??l.defaultWidth,dictStr:a.length?a.join(","):o.dictStr||"",formula:o.formula||"",merge_on_group:l.canMerge?o.merge_on_group??!1:!1,cellStyle:{...W(Ce),...o.cellStyle||{}},prefix:o.prefix||"",suffix:o.suffix||""}}):[]}function De(t){return t.map(o=>{const l=I(o.editor),a={field:o.field,title:o.title,editor:o.editor,width:o.width};return l.hasDict&&(a.dict=(o.dictStr||"").split(",").map(k=>k.trim()).filter(Boolean)),l.hasFormula&&(a.formula=o.formula||""),l.canMerge&&(a.merge_on_group=!!o.merge_on_group),o.cellStyle&&(a.cellStyle=o.cellStyle),o.prefix&&(a.prefix=o.prefix),o.suffix&&(a.suffix=o.suffix),a})}function ne(t={}){const o=t&&typeof t=="object"?t:{},l=o.merge_field||"";return l?{merge_field:l,show_detail_subtotal:o.show_detail_subtotal??!0,subtotal_prefix:o.subtotal_prefix??"",subtotal_suffix:o.subtotal_suffix??""}:{}}function Ke(t,o,l){const a=I(t);return{field:o,title:a.defaultTitle||l||"新列",editor:t,width:a.defaultWidth,dictStr:a.hasDict&&a.defaultDictStr||"",formula:"",merge_on_group:!1,cellStyle:W(Ce),prefix:"",suffix:""}}function Fe(){return{top:{style:"",width:1,color:"#dcdfe6"},bottom:{style:"",width:1,color:"#dcdfe6"},left:{style:"",width:1,color:"#dcdfe6"},right:{style:"",width:1,color:"#dcdfe6"}}}function v(t="auto"){return{width:t,color:"#303133",fontSize:13,bold:!1,italic:!1,align:"left",border:Fe()}}function ie(t){const o=t.style||{},l={width:o.width||"auto"};l.textAlign=o.align||"left",o.color!=null&&o.color!==""&&(l.color=o.color),o.fontSize!=null&&(l.fontSize=Number(o.fontSize)+"px"),o.bold&&(l.fontWeight="bold"),o.italic&&(l.fontStyle="italic");const a=o.border;if(a)for(const k of["top","bottom","left","right"]){const p=a[k];p&&p.style&&p.width>0&&(l["border-"+k]=`${p.width}px ${p.style} ${p.color||"#dcdfe6"}`)}return l}function ve(t){const o=new Set;for(const l of t||[])if(l.type==="text"&&l.bindField)o.add(l.bindField);else if(l.type==="row"&&l.cells)for(const a of l.cells)a.bindField&&o.add(a.bindField);return o}function Te(t,o){const l=ve(o);let a=0;const k=new RegExp("^"+t+"(\\d+)$");for(const N of l){const y=k.exec(N);y&&(a=Math.max(a,parseInt(y[1],10)))}let p=a+1,m=t+String(p).padStart(4,"0");for(;l.has(m);)p++,m=t+String(p).padStart(4,"0");return m}function Ue(t){const o={},l=t&&t.style||{};return l.color&&(o.color=l.color),l.fontSize&&(o.fontSize=Number(l.fontSize)+"px"),l.bold&&(o.fontWeight="bold"),l.italic&&(o.fontStyle="italic"),o}function Z(t){const o=Ue(t),l=t&&t.style||{};return l.align?o.textAlign=l.align:t&&t.align&&(o.textAlign=t.align),o}function Me(t){return Ue(t)}function Ae(t,o,l){t.bindEnabled=!t.bindEnabled,t.bindEnabled?(t.text="",t.bindField=t.bindField||Te(o,l)):t.bindField=""}function Le(t,o,l){t.bindEnabled=!t.bindEnabled,t.bindEnabled?(t.text="",t.value="",t.bindField=t.bindField||Te(o,l)):t.bindField=""}function et(t,o){let l=t,a=2;for(;o.has(l);)l=t+"_"+a++;return l}function tt(t=[]){for(const o of t)o.type==="title"&&(o.type="text",o.style=o.style||{color:"#303133",fontSize:18,bold:!0,italic:!1,align:"center"},o.align&&!o.style.align&&(o.style.align=o.align,delete o.align)),o.type==="text"&&(o.style=o.style||{},o.align&&!o.style.align&&(o.style.align=o.align,delete o.align),o.style.color===void 0&&(o.style.color="#303133"),o.style.fontSize===void 0&&(o.style.fontSize=14),o.style.bold===void 0&&(o.style.bold=!1),o.style.italic===void 0&&(o.style.italic=!1),o.style.align===void 0&&(o.style.align="left"),o.bindEnabled===void 0&&(o.bindEnabled=!1),o.bindField===void 0&&(o.bindField=""),o.bindEnabled&&(o.text=""))}function lt(t=[]){for(const o of t)if(o.type==="row"&&o.cells)for(const l of o.cells)l.style||(l.style=v()),l.style.width===void 0&&(l.style.width="auto"),l.style.color===void 0&&(l.style.color="#303133"),l.style.fontSize===void 0&&(l.style.fontSize=13),l.style.bold===void 0&&(l.style.bold=!1),l.style.italic===void 0&&(l.style.italic=!1),l.style.align===void 0&&(l.style.align="left"),l.style.border===void 0&&(l.style.border=Fe()),l.bindEnabled===void 0&&(l.bindEnabled=!1),l.bindField===void 0&&(l.bindField=""),l.hideLabel===void 0&&(l.hideLabel=!1),l.bindEnabled&&(l.text="",l.value="")}function ze(t){const o=[];for(const l of t||[])if(l.type==="text"&&l.bindEnabled)o.push({field:l.bindField,label:l.label||""});else if(l.type==="row"&&l.cells)for(const a of l.cells)a.bindEnabled&&o.push({field:a.bindField,label:a.label||""});return o.filter(l=>l.field)}function ae(t){return!t||t.length===0?[]:(tt(t),lt(t),t)}const Re="sum_";let ce=0;function Oe(){return ce++,Re+String(ce).padStart(4,"0")}function ot(t){const o=j(t),l={color:"#606266",fontSize:13,bold:!1,italic:!1},k={field:Oe(),label:"标签",prefix:"",suffix:"",style:l};return o.hasFormula?{...k,type:o.value,formula:""}:o.hasText?{...k,type:o.value,text:""}:{...k,type:H.MANUAL_INPUT.value,default:0}}function me(t=[]){let o=0;for(const l of t)if(l.field){const a=new RegExp("^"+Re+"(\\d+)$").exec(l.field);a&&(o=Math.max(o,parseInt(a[1],10)))}ce=o;for(const l of t)l.field==null&&(l.field=Oe()),l.prefix===void 0&&(l.prefix=""),l.suffix===void 0&&(l.suffix=""),l.style===void 0&&(l.style={color:"#606266",fontSize:13,bold:!1,italic:!1}),l.style.color===void 0&&(l.style.color="#606266"),l.style.fontSize===void 0&&(l.style.fontSize=13),l.style.bold===void 0&&(l.style.bold=!1),l.style.italic===void 0&&(l.style.italic=!1)}function pe(){return{columns:[],group_rules:{},header_sections:[],footer_sections:[],summary_fields:[]}}function se(t){const o=t&&typeof t=="object"?t:{},l=De(Se(o.columns||[])),a=ne(o.group_rules||{}),k=ae(W(o.header_sections||[])),p=ae(W(o.footer_sections||[])),m=W(o.summary_fields||[]);return me(m),{columns:l,group_rules:a,header_sections:k,footer_sections:p,summary_fields:m}}const nt={class:"qukt-quote-sheet"},it={key:1,class:"qukt-q-divider"},at={key:3,class:"qukt-q-row"},st={key:0,class:"qukt-q-table-wrap"},rt={class:"qukt-q-table"},dt={key:0,class:"subtotal-row"},ct=["colspan"],mt={class:"subtotal-value"},pt={key:1},ut=["rowspan"],ft={key:0,class:"empty-row"},kt=["colspan"],bt={key:1,class:"qukt-q-summary"},ht={class:"qukt-q-summary-label"},yt={class:"qukt-q-footer"},Et={key:0,class:"qukt-q-divider"},gt={key:2,class:"qukt-q-row"},ue={__name:"QuokitSheet",props:{tpl:{type:Object,default:pe},data:{type:Object,default:()=>({headerData:{},rows:[],footerData:{}})},placeholder:{type:String,default:"-"}},setup(t,{expose:o}){const l=t,a=e.computed(()=>se(l.tpl)),k=e.computed(()=>{var c;return((c=l.data)==null?void 0:c.headerData)||{}}),p=e.computed(()=>{var c;return((c=l.data)==null?void 0:c.footerData)||{}}),m=e.computed(()=>{var c;return((c=l.data)==null?void 0:c.rows)||[]});function N(c,E){return c.bindEnabled&&c.bindField?(E==="footer"?p.value:k.value)[c.bindField]??"":c.text||""}function y(c,E){const r=c.type==="field"&&c.label&&!c.hideLabel;if(c.bindEnabled&&c.bindField){const h=(E==="footer"?p.value:k.value)[c.bindField]??"";return r?c.label+h:h}return c.type==="field"?(r?c.label:"")+(c.value??""):c.text||""}function _(c){const E={width:(c.width||100)+"px"},r=c.cellStyle||{};r.color!=null&&r.color!==""&&(E.color=r.color),r.fontSize!=null&&(E.fontSize=Number(r.fontSize)+"px"),r.bold&&(E.fontWeight="bold"),r.italic&&(E.fontStyle="italic"),r.align&&(E.textAlign=r.align);const u=r.border;if(u)for(const h of["top","bottom","left","right"]){const q=u[h];q&&q.style&&q.width>0&&(E["border-"+h]=`${q.width}px ${q.style} ${q.color||"#dcdfe6"}`)}return E}function d(c){return(Number(c)||0).toFixed(2)}const f=e.computed(()=>a.value.columns.find(c=>I(c.editor).hasFormula));function g(c){var r;const E=((r=f.value)==null?void 0:r.formula)||"quantity * unit_price";return G(E,c)}const U=e.computed(()=>m.value.reduce((c,E)=>c+Number(g(E)||0),0));function A(){let c=U.value;for(const E of a.value.summary_fields)j(E.type).hasDefault&&(c+=L(E));return c}function L(c){return Number(c.default??0)}function D(){const c={group_total:U.value},E=a.value.summary_fields;for(const r of E)j(r.type).hasDefault&&(c[r.field]=L(r));for(const r of E)if(j(r.type).hasFormula&&r.formula)try{c[r.field]=G(r.formula,c)}catch{c[r.field]=0}return c.grand_total=A(),c}function V(c){const E=j(c.type);return E.hasText?c.text||"":E.hasFormula?c.formula?D()[c.field]??0:0:L(c)}function s(c){if(j(c.type).hasText)return c.text||"";const E=Number(V(c))||0,r=Number.isInteger(E)?E:E.toFixed(2);return(c.prefix||"")+r+(c.suffix||"")}const n=e.computed(()=>{const c=m.value.map(q=>({...q})),E=a.value.group_rules;if(!(E!=null&&E.merge_field))return c;const r=[],u=E.merge_field;let h=0;for(;h<c.length;){const q=[c[h]];let w=h+1;for(;w<c.length&&c[w][u]===c[h][u];)q.push(c[w]),w++;if(r.push(...q),(E.show_detail_subtotal??!0)&&c[h][u]!==void 0&&c[h][u]!==null&&c[h][u]!==""){const S=q.reduce((C,z)=>C+Number(g(z)||0),0);r.push({__is_subtotal:!0,__group_key:c[h][u],__group_sum:S})}h=w}return r});function b(c,E){var z,M,$;const r=n.value,u=r[c];if(!u||u.__is_subtotal)return 1;const h=a.value.group_rules,q=h==null?void 0:h.merge_field,w=a.value.columns.find(R=>R.field===E),B=q&&E===q,S=(w==null?void 0:w.merge_on_group)===!0;if(!B&&!S)return 1;const C=(()=>{var T,Q;if(!q)return r.length;const R=u[q];let F=c+1;for(;F<r.length&&((T=r[F])==null?void 0:T[q])===R&&!((Q=r[F])!=null&&Q.__is_subtotal);)F++;return F})();if(B)return c>0&&((z=r[c-1])==null?void 0:z[q])===u[q]&&!((M=r[c-1])!=null&&M.__is_subtotal)?0:C-c;if(S){const R=u[E];if(c>0){const T=r[c-1];if((!q||(T==null?void 0:T[q])===u[q]&&!(T!=null&&T.__is_subtotal))&&(T==null?void 0:T[E])===R)return 0}let F=1;for(let T=c+1;T<C&&(($=r[T])==null?void 0:$[E])===R;T++)F++;return F}return 1}async function i(c=!1){const E=a.value;if(!E||E.columns.length===0){console.warn("[QuokitSheet] exportExcel skipped: template has no columns");return}const r=await Ye(E,l.data||{},c?{layout:"auto-width"}:void 0),u=URL.createObjectURL(r),h=document.createElement("a");h.href=u,h.download=`${Date.now()}.xlsx`,document.body.appendChild(h),h.click(),document.body.removeChild(h),setTimeout(()=>URL.revokeObjectURL(u),100)}function x(c=!1){const E=document.querySelector(".qukt-quote-sheet");if(!E)return;const r=c!==!0,u=window.open("","_blank",r?"width=1200,height=900":"width=900,height=1200");if(!u)return;const h=Array.from(document.styleSheets).map(w=>{try{return Array.from(w.cssRules).map(B=>B.cssText).join(`
|
|
4
|
+
`).length,g=_e(m),d=m.length===0?1:Math.ceil(g/12);l=Math.max(l,N,d)}const a=o+8;return Math.max(50,l*a+16*2)}function we(t,o,l,a,k){for(let p=o;p<=l;p++)for(let m=a;m<=k;m++){const N=t.getCell(p,m),g=N.border||{};N.border={top:g.top||le,left:g.left||le,right:g.right||le,bottom:g.bottom||le}}}function Be(t,o,l,a,k){for(let p=a;p<=k;p++)t.getCell(o,p).border={...t.getCell(o,p).border||{},top:oe},t.getCell(l,p).border={...t.getCell(l,p).border||{},bottom:oe};for(let p=o;p<=l;p++)t.getCell(p,a).border={...t.getCell(p,a).border||{},left:oe},t.getCell(p,k).border={...t.getCell(p,k).border||{},right:oe}}function xe(t,o){return t.bindEnabled&&t.bindField?o[t.bindField]??"":t.text??""}function $e(t,o){const l=t.type===te.FIELD.value&&t.label&&!t.hideLabel;if(t.bindEnabled&&t.bindField){const a=o[t.bindField]??"";return l?t.label+a:a}return t.type===te.FIELD.value?(l?t.label:"")+(t.value??""):t.text??""}async function Ye(t,o,l={}){var E;if(!t||!Array.isArray(t.columns)||t.columns.length===0)throw new Error("模板为空或缺少列定义");const a=(o==null?void 0:o.headerData)||{},k=(o==null?void 0:o.footerData)||{};let p=(o==null?void 0:o.rows)||o||[];Array.isArray(p)||(p=[]);const m=l.layout||"auto-wrap",N=m==="auto-wrap",g=new He.Workbook,q=g.addWorksheet("报价单"),d=t.columns.length,f=J(d-1);let V=1;const U=()=>(t.columns||[]).find(r=>I(r.editor).hasFormula),A=r=>{const u=U(),y=(u==null?void 0:u.formula)||"quantity * unit_price";return G(y,r)};if(t.header_sections){for(const r of t.header_sections)if(r.type==="divider")V++;else if(r.type==="text"){q.mergeCells(`A${V}:${f}${V}`);const u=q.getCell(`A${V}`);u.value=xe(r,a);const y=r.style||{},_=y.fontSize||13;if(u.font={size:_,bold:y.bold===!0,italic:y.italic===!0,name:"微软雅黑"},y.color){const w=y.color.replace("#","").toUpperCase();u.font.color={argb:w.length===6?"FF"+w:w}}u.alignment={horizontal:y.align||"left",vertical:"middle"},q.getRow(V).height=_*2+10,V++}else if(r.type==="row"&&r.cells){const u=r.cells.map(w=>{var B;return Ee((B=w.style)==null?void 0:B.width)||1/r.cells.length});let y=0;const _=u.map(w=>{const B=Math.round(y*d);y+=w;const D=Math.round(y*d)-1;return{start:B,end:Math.max(D,B)}});for(let w=0;w<r.cells.length;w++){const B=r.cells[w],D=_[w],S=`${J(D.start)}${V}`,z=`${J(D.end)}${V}`;S!==z&&q.mergeCells(`${S}:${z}`);const M=q.getCell(S);M.value=$e(B,a);const C=B.style||{},O=C.fontSize||11;if(M.font={size:O,bold:C.bold===!0,italic:C.italic===!0,name:"微软雅黑"},C.color){const F=C.color.replace("#","").toUpperCase();M.font.color={argb:F.length===6?"FF"+F:F}}M.alignment={horizontal:C.align||"left",vertical:"middle"}}q.getRow(V).height=22,V++}}const L=V,x=q.getRow(V);x.values=t.columns.map(r=>r.title),x.font={bold:!0,name:"微软雅黑",size:12},x.fill={type:"pattern",pattern:"solid",fgColor:{argb:"FFE0E0E0"}},x.alignment={horizontal:"center",vertical:"middle",wrapText:N,indent:1},x.height=N?48:44,V++;const b=t.group_rules,c=b==null?void 0:b.merge_field,i=t.columns;if(c){let r=0,u=0;for(;r<p.length;){const y=[];let _=r;for(;_<p.length&&p[_][c]===p[r][c];)y.push(p[_]),_++;const w=V;for(let S=0;S<y.length;S++){u++;const z=y[S],M=i.map(F=>F.editor===W.AUTO_SEQ.value?u:I(F.editor).hasFormula?A(z):z[F.field]??""),C=M.map((F,T)=>(i[T].prefix||"")+F+(i[T].suffix||"")),O=q.getRow(V);O.values=M,O.height=N?qe(C,11):36;for(let F=0;F<i.length;F++){const T=i[F],Q=O.getCell(F+1);Ne(Q,T.cellStyle),(T.prefix||T.suffix)&&(Q.value=C[F])}V++}const B=V-1;for(let S=0;S<i.length;S++){const z=i[S];if(z.merge_on_group!==!0)continue;let M=w;for(let C=1;C<y.length;C++)y[C][z.field]!==y[C-1][z.field]&&(w+C-1>M&&q.mergeCells(`${J(S)}${M}:${J(S)}${w+C-1}`),M=w+C);B>M&&q.mergeCells(`${J(S)}${M}:${J(S)}${B}`)}if(b.show_detail_subtotal!==!1&&p[r][c]!==void 0&&p[r][c]!==null&&p[r][c]!==""){const S=y.reduce((Q,Z)=>Q+Number(A(Z)||0),0),z=J(Math.max(0,d-2));q.mergeCells(`A${V}:${z}${V}`);const M=q.getCell(`A${V}`);M.value=`小计(${p[r][c]})`,M.alignment={horizontal:"right",vertical:"middle"},M.font={bold:!0,italic:!0,color:{argb:"FF409EFF"},name:"微软雅黑",size:11};const C=q.getCell(`${f}${V}`),O=b.subtotal_prefix??"",F=b.subtotal_suffix??"";C.value=O+S.toFixed(2)+F,C.alignment={horizontal:"right",vertical:"middle"},C.font={bold:!0,italic:!0,color:{argb:"FF409EFF"},name:"微软雅黑",size:11};const T=q.getRow(V);T.fill={type:"pattern",pattern:"solid",fgColor:{argb:"FFF0F9FF"}},T.alignment={horizontal:"right",vertical:"middle",wrapText:!0},T.height=32,V++}r=_}}else for(let r=0;r<p.length;r++){const u=p[r],y=i.map(B=>B.editor===W.AUTO_SEQ.value?r+1:I(B.editor).hasFormula?A(u):u[B.field]??""),_=y.map((B,D)=>(i[D].prefix||"")+B+(i[D].suffix||"")),w=q.getRow(V);w.values=y,w.height=N?qe(_,11):36;for(let B=0;B<i.length;B++){const D=i[B],S=w.getCell(B+1);Ne(S,D.cellStyle),(D.prefix||D.suffix)&&(S.value=_[B])}V++}const h=V-1;if(t.summary_fields){V+=1;const r=J(Math.max(0,d-2)),u=J(d-1),y=p.reduce((B,D)=>B+Number(A(D)||0),0),_={group_total:y};for(const B of t.summary_fields)j(B.type).hasDefault&&(_[B.field]=Number(B.default??0));_.grand_total=y+t.summary_fields.filter(B=>j(B.type).hasDefault).reduce((B,D)=>B+_[D.field],0);for(const B of t.summary_fields)j(B.type).hasFormula&&(_[B.field]=G(B.formula||"group_total",_));for(const B of t.summary_fields){const D=j(B.type);let S;D.hasFormula?S=G(B.formula||"group_total",_):D.hasText?S=B.text||"":S=Number(B.default??0);const z=((E=B.style)==null?void 0:E.fontSize)||ge,M=q.getCell(`${r}${V}`),C=q.getCell(`${u}${V}`);M.value=B.label,M.alignment={horizontal:"right",vertical:"middle",indent:1},M.font={name:"微软雅黑",size:ge};const O=B.style||{},F=()=>{const Z={name:"微软雅黑",size:z,bold:!!O.bold,italic:!!O.italic};if(O.color){const he=O.color.replace("#","").toUpperCase();Z.color={argb:he.length===6?"FF"+he:he}}return Z},T=B.prefix||"",Q=B.suffix||"";if(typeof S=="number"){const Z=S.toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2});C.value=T+Z+Q,C.alignment={horizontal:"right",vertical:"middle",indent:1}}else C.value=T+(S??"")+Q,C.alignment={horizontal:"right",vertical:"middle",indent:1};C.font=F(),q.getRow(V).height=Math.max(28,z*2+12),V++}const w=V-1;we(q,L,w,1,d),Be(q,L,w,1,d)}else we(q,L,h,1,d),Be(q,L,h,1,d);if(t.footer_sections){V+=1;for(const r of t.footer_sections)if(r.type==="divider")V++;else if(r.type==="text"){q.mergeCells(`A${V}:${f}${V}`);const u=q.getCell(`A${V}`);u.value=xe(r,k);const y=r.style||{},_=y.fontSize||13;if(u.font={size:_,bold:y.bold===!0,italic:y.italic===!0,name:"微软雅黑"},y.color){const w=y.color.replace("#","").toUpperCase();u.font.color={argb:w.length===6?"FF"+w:w}}u.alignment={horizontal:y.align||"left",vertical:"middle"},q.getRow(V).height=_*2+10,V++}else if(r.type==="row"&&r.cells){const u=r.cells.map(w=>{var B;return Ee((B=w.style)==null?void 0:B.width)||1/r.cells.length});let y=0;const _=u.map(w=>{const B=Math.round(y*d);y+=w;const D=Math.round(y*d)-1;return{start:B,end:Math.max(D,B)}});for(let w=0;w<r.cells.length;w++){const B=r.cells[w],D=_[w],S=`${J(D.start)}${V}`,z=`${J(D.end)}${V}`;S!==z&&q.mergeCells(`${S}:${z}`);const M=q.getCell(S);M.value=$e(B,k);const C=B.style||{};M.alignment={horizontal:C.align||"left",vertical:"middle"};const O={name:"微软雅黑",size:C.fontSize||11,bold:C.bold===!0,italic:C.italic===!0};if(C.color){const F=C.color.replace("#","").toUpperCase();O.color={argb:F.length===6?"FF"+F:F}}M.font=O}q.getRow(V).height=22,V++}}const n=50,$=6;for(let r=0;r<d;r++){const u=t.columns[r],y=r+1;if(m==="auto-wrap")q.getColumn(y).width=u.width?Math.max(u.width/7,8):12;else{let _=0;for(let D=1;D<V;D++)_=Math.max(_,_e(q.getCell(D,y).value));const w=u.width?Math.max(u.width/7,10):12,B=Math.min(Math.max(_+2,$),n);q.getColumn(y).width=Math.max(B,w)}}const s=await g.xlsx.writeBuffer();return new Blob([s],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}function P(t){return JSON.parse(JSON.stringify(t))}function Y(t,o){try{return JSON.stringify(t)===JSON.stringify(o)}catch{return!1}}function Ke(t,o){let l=null;const a=function(...k){clearTimeout(l),l=setTimeout(()=>t.apply(this,k),o)};return a.cancel=()=>{clearTimeout(l),l=null},Object.defineProperty(a,"timer",{get(){return l},configurable:!0}),a}const Ce={color:"#303133",fontSize:13,bold:!1,italic:!1,align:"center"};function Se(t=[]){return Array.isArray(t)?t.map(o=>{const l=I(o.editor),a=Array.isArray(o.dict)?o.dict:[];return{...o,field:o.field||"",title:o.title||l.defaultTitle,editor:o.editor||W.INPUT.value,width:o.width??l.defaultWidth,dictStr:a.length?a.join(","):o.dictStr||"",formula:o.formula||"",merge_on_group:l.canMerge?o.merge_on_group??!1:!1,cellStyle:{...P(Ce),...o.cellStyle||{}},prefix:o.prefix||"",suffix:o.suffix||""}}):[]}function De(t){return t.map(o=>{const l=I(o.editor),a={field:o.field,title:o.title,editor:o.editor,width:o.width};return l.hasDict&&(a.dict=(o.dictStr||"").split(",").map(k=>k.trim()).filter(Boolean)),l.hasFormula&&(a.formula=o.formula||""),l.canMerge&&(a.merge_on_group=!!o.merge_on_group),o.cellStyle&&(a.cellStyle=o.cellStyle),o.prefix&&(a.prefix=o.prefix),o.suffix&&(a.suffix=o.suffix),a})}function ne(t={}){const o=t&&typeof t=="object"?t:{},l=o.merge_field||"";return l?{merge_field:l,show_detail_subtotal:o.show_detail_subtotal??!0,subtotal_prefix:o.subtotal_prefix??"",subtotal_suffix:o.subtotal_suffix??""}:{}}function Ze(t,o,l){const a=I(t);return{field:o,title:a.defaultTitle||l||"新列",editor:t,width:a.defaultWidth,dictStr:a.hasDict&&a.defaultDictStr||"",formula:"",merge_on_group:!1,cellStyle:P(Ce),prefix:"",suffix:""}}function Fe(){return{top:{style:"",width:1,color:"#dcdfe6"},bottom:{style:"",width:1,color:"#dcdfe6"},left:{style:"",width:1,color:"#dcdfe6"},right:{style:"",width:1,color:"#dcdfe6"}}}function v(t="auto"){return{width:t,color:"#303133",fontSize:13,bold:!1,italic:!1,align:"left",border:Fe()}}function ie(t){const o=t.style||{},l={width:o.width||"auto"};l.textAlign=o.align||"left",o.color!=null&&o.color!==""&&(l.color=o.color),o.fontSize!=null&&(l.fontSize=Number(o.fontSize)+"px"),o.bold&&(l.fontWeight="bold"),o.italic&&(l.fontStyle="italic");const a=o.border;if(a)for(const k of["top","bottom","left","right"]){const p=a[k];p&&p.style&&p.width>0&&(l["border-"+k]=`${p.width}px ${p.style} ${p.color||"#dcdfe6"}`)}return l}function ve(t){const o=new Set;for(const l of t||[])if(l.type==="text"&&l.bindField)o.add(l.bindField);else if(l.type==="row"&&l.cells)for(const a of l.cells)a.bindField&&o.add(a.bindField);return o}function Te(t,o){const l=ve(o);let a=0;const k=new RegExp("^"+t+"(\\d+)$");for(const N of l){const g=k.exec(N);g&&(a=Math.max(a,parseInt(g[1],10)))}let p=a+1,m=t+String(p).padStart(4,"0");for(;l.has(m);)p++,m=t+String(p).padStart(4,"0");return m}function Ue(t){const o={},l=t&&t.style||{};return l.color&&(o.color=l.color),l.fontSize&&(o.fontSize=Number(l.fontSize)+"px"),l.bold&&(o.fontWeight="bold"),l.italic&&(o.fontStyle="italic"),o}function K(t){const o=Ue(t),l=t&&t.style||{};return l.align?o.textAlign=l.align:t&&t.align&&(o.textAlign=t.align),o}function Me(t){return Ue(t)}function Ae(t,o,l){t.bindEnabled=!t.bindEnabled,t.bindEnabled?(t.text="",t.bindField=t.bindField||Te(o,l)):t.bindField=""}function Le(t,o,l){t.bindEnabled=!t.bindEnabled,t.bindEnabled?(t.text="",t.value="",t.bindField=t.bindField||Te(o,l)):t.bindField=""}function et(t,o){let l=t,a=2;for(;o.has(l);)l=t+"_"+a++;return l}function tt(t=[]){for(const o of t)o.type==="title"&&(o.type="text",o.style=o.style||{color:"#303133",fontSize:18,bold:!0,italic:!1,align:"center"},o.align&&!o.style.align&&(o.style.align=o.align,delete o.align)),o.type==="text"&&(o.style=o.style||{},o.align&&!o.style.align&&(o.style.align=o.align,delete o.align),o.style.color===void 0&&(o.style.color="#303133"),o.style.fontSize===void 0&&(o.style.fontSize=14),o.style.bold===void 0&&(o.style.bold=!1),o.style.italic===void 0&&(o.style.italic=!1),o.style.align===void 0&&(o.style.align="left"),o.bindEnabled===void 0&&(o.bindEnabled=!1),o.bindField===void 0&&(o.bindField=""),o.bindEnabled&&(o.text=""))}function lt(t=[]){for(const o of t)if(o.type==="row"&&o.cells)for(const l of o.cells)l.style||(l.style=v()),l.style.width===void 0&&(l.style.width="auto"),l.style.color===void 0&&(l.style.color="#303133"),l.style.fontSize===void 0&&(l.style.fontSize=13),l.style.bold===void 0&&(l.style.bold=!1),l.style.italic===void 0&&(l.style.italic=!1),l.style.align===void 0&&(l.style.align="left"),l.style.border===void 0&&(l.style.border=Fe()),l.bindEnabled===void 0&&(l.bindEnabled=!1),l.bindField===void 0&&(l.bindField=""),l.hideLabel===void 0&&(l.hideLabel=!1),l.bindEnabled&&(l.text="",l.value="")}function ze(t){const o=[];for(const l of t||[])if(l.type==="text"&&l.bindEnabled)o.push({field:l.bindField,label:l.label||""});else if(l.type==="row"&&l.cells)for(const a of l.cells)a.bindEnabled&&o.push({field:a.bindField,label:a.label||""});return o.filter(l=>l.field)}function ae(t){return!t||t.length===0?[]:(tt(t),lt(t),t)}const Oe="sum_";let ce=0;function Re(){return ce++,Oe+String(ce).padStart(4,"0")}function ot(t){const o=j(t),l={color:"#606266",fontSize:13,bold:!1,italic:!1},k={field:Re(),label:"标签",prefix:"",suffix:"",style:l};return o.hasFormula?{...k,type:o.value,formula:""}:o.hasText?{...k,type:o.value,text:""}:{...k,type:H.MANUAL_INPUT.value,default:0}}function me(t=[]){let o=0;for(const l of t)if(l.field){const a=new RegExp("^"+Oe+"(\\d+)$").exec(l.field);a&&(o=Math.max(o,parseInt(a[1],10)))}ce=o;for(const l of t)l.field==null&&(l.field=Re()),l.prefix===void 0&&(l.prefix=""),l.suffix===void 0&&(l.suffix=""),l.style===void 0&&(l.style={color:"#606266",fontSize:13,bold:!1,italic:!1}),l.style.color===void 0&&(l.style.color="#606266"),l.style.fontSize===void 0&&(l.style.fontSize=13),l.style.bold===void 0&&(l.style.bold=!1),l.style.italic===void 0&&(l.style.italic=!1)}function pe(){return{columns:[],group_rules:{},header_sections:[],footer_sections:[],summary_fields:[]}}function se(t){const o=t&&typeof t=="object"?t:{},l=De(Se(o.columns||[])),a=ne(o.group_rules||{}),k=ae(P(o.header_sections||[])),p=ae(P(o.footer_sections||[])),m=P(o.summary_fields||[]);return me(m),{columns:l,group_rules:a,header_sections:k,footer_sections:p,summary_fields:m}}const nt={class:"qukt-quote-sheet"},it={key:1,class:"qukt-q-divider"},at={key:3,class:"qukt-q-row"},st={key:0,class:"qukt-q-table-wrap"},rt={class:"qukt-q-table"},dt={key:0,class:"subtotal-row"},ct=["colspan"],mt={class:"subtotal-value"},pt={key:1},ut=["rowspan"],ft={key:0,class:"empty-row"},kt=["colspan"],bt={key:1,class:"qukt-q-summary"},ht={class:"qukt-q-summary-label"},yt={class:"qukt-q-footer"},Et={key:0,class:"qukt-q-divider"},gt={key:2,class:"qukt-q-row"},ue={__name:"QuokitSheet",props:{tpl:{type:Object,default:pe},data:{type:Object,default:()=>({headerData:{},rows:[],footerData:{}})},placeholder:{type:String,default:"-"}},setup(t,{expose:o}){const l=t,a=e.computed(()=>se(l.tpl)),k=e.computed(()=>{var s;return((s=l.data)==null?void 0:s.headerData)||{}}),p=e.computed(()=>{var s;return((s=l.data)==null?void 0:s.footerData)||{}}),m=e.computed(()=>{var s;return((s=l.data)==null?void 0:s.rows)||[]});function N(s,E){return s.bindEnabled&&s.bindField?(E==="footer"?p.value:k.value)[s.bindField]??s.bindField:s.text||""}function g(s,E){const r=s.type==="field"&&s.label&&!s.hideLabel;if(s.bindEnabled&&s.bindField){const _=(E==="footer"?p.value:k.value)[s.bindField]??s.bindField;return r?s.label+_:_}return s.type==="field"?(r?s.label:"")+(s.value??""):s.text||""}function q(s){const E={width:(s.width||100)+"px"},r=s.cellStyle||{};r.color!=null&&r.color!==""&&(E.color=r.color),r.fontSize!=null&&(E.fontSize=Number(r.fontSize)+"px"),r.bold&&(E.fontWeight="bold"),r.italic&&(E.fontStyle="italic"),r.align&&(E.textAlign=r.align);const u=r.border;if(u)for(const y of["top","bottom","left","right"]){const _=u[y];_&&_.style&&_.width>0&&(E["border-"+y]=`${_.width}px ${_.style} ${_.color||"#dcdfe6"}`)}return E}function d(s){return(Number(s)||0).toFixed(2)}const f=e.computed(()=>a.value.columns.find(s=>I(s.editor).hasFormula));function V(s){var r;const E=((r=f.value)==null?void 0:r.formula)||"quantity * unit_price";return G(E,s)}const U=e.computed(()=>m.value.reduce((s,E)=>s+Number(V(E)||0),0));function A(){let s=U.value;for(const E of a.value.summary_fields)j(E.type).hasDefault&&(s+=L(E));return s}function L(s){return Number(s.default??0)}function x(){const s={group_total:U.value},E=a.value.summary_fields;for(const r of E)j(r.type).hasDefault&&(s[r.field]=L(r));for(const r of E)if(j(r.type).hasFormula&&r.formula)try{s[r.field]=G(r.formula,s)}catch{s[r.field]=0}return s.grand_total=A(),s}function b(s){const E=j(s.type);return E.hasText?s.text||"":E.hasFormula?s.formula?x()[s.field]??0:0:L(s)}function c(s){if(j(s.type).hasText)return s.text||"";const E=Number(b(s))||0,r=Number.isInteger(E)?E:E.toFixed(2);return(s.prefix||"")+r+(s.suffix||"")}const i=e.computed(()=>{const s=m.value.map(_=>({..._})),E=a.value.group_rules;if(!(E!=null&&E.merge_field))return s;const r=[],u=E.merge_field;let y=0;for(;y<s.length;){const _=[s[y]];let w=y+1;for(;w<s.length&&s[w][u]===s[y][u];)_.push(s[w]),w++;if(r.push(..._),(E.show_detail_subtotal??!0)&&s[y][u]!==void 0&&s[y][u]!==null&&s[y][u]!==""){const D=_.reduce((S,z)=>S+Number(V(z)||0),0);r.push({__is_subtotal:!0,__group_key:s[y][u],__group_sum:D})}y=w}return r});function h(s,E){var z,M,C;const r=i.value,u=r[s];if(!u||u.__is_subtotal)return 1;const y=a.value.group_rules,_=y==null?void 0:y.merge_field,w=a.value.columns.find(O=>O.field===E),B=_&&E===_,D=(w==null?void 0:w.merge_on_group)===!0;if(!B&&!D)return 1;const S=(()=>{var T,Q;if(!_)return r.length;const O=u[_];let F=s+1;for(;F<r.length&&((T=r[F])==null?void 0:T[_])===O&&!((Q=r[F])!=null&&Q.__is_subtotal);)F++;return F})();if(B)return s>0&&((z=r[s-1])==null?void 0:z[_])===u[_]&&!((M=r[s-1])!=null&&M.__is_subtotal)?0:S-s;if(D){const O=u[E];if(s>0){const T=r[s-1];if((!_||(T==null?void 0:T[_])===u[_]&&!(T!=null&&T.__is_subtotal))&&(T==null?void 0:T[E])===O)return 0}let F=1;for(let T=s+1;T<S&&((C=r[T])==null?void 0:C[E])===O;T++)F++;return F}return 1}async function n(s=!1){const E=a.value;if(!E||E.columns.length===0){console.warn("[QuokitSheet] exportExcel skipped: template has no columns");return}const r=await Ye(E,l.data||{},s?{layout:"auto-width"}:void 0),u=URL.createObjectURL(r),y=document.createElement("a");y.href=u,y.download=`${Date.now()}.xlsx`,document.body.appendChild(y),y.click(),document.body.removeChild(y),setTimeout(()=>URL.revokeObjectURL(u),100)}function $(s=!1){const E=document.querySelector(".qukt-quote-sheet");if(!E)return;const r=s!==!0,u=window.open("","_blank",r?"width=1200,height=900":"width=900,height=1200");if(!u)return;const y=Array.from(document.styleSheets).map(w=>{try{return Array.from(w.cssRules).map(B=>B.cssText).join(`
|
|
5
5
|
`)}catch{return""}}).join(`
|
|
6
|
-
`),
|
|
6
|
+
`),_=E.outerHTML;u.document.write(`<!doctype html>
|
|
7
7
|
<html><head><meta charset="utf-8"><title>报价单打印</title>
|
|
8
|
-
<style>${
|
|
8
|
+
<style>${y}
|
|
9
9
|
@page { size: ${r?"landscape":"portrait"}; margin: 15mm; }
|
|
10
10
|
body { margin: 0; padding: 20px; background: #fff; }
|
|
11
11
|
@media print { body { padding: 0; } }
|
|
12
|
-
</style></head><body>${q}</body></html>`),u.document.close(),u.onload=()=>{u.print()}}return o({print:x,exportExcel:i}),(c,E)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",nt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value.header_sections,(r,u)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"h"+u},[r.type==="title"?(e.openBlock(),e.createElementBlock("h1",{key:0,class:"qukt-q-title",style:e.normalizeStyle(e.unref(Z)(r))},e.toDisplayString(N(r,"header")),5)):r.type==="divider"?(e.openBlock(),e.createElementBlock("div",it)):r.type==="text"?(e.openBlock(),e.createElementBlock("div",{key:2,class:"qukt-q-text",style:e.normalizeStyle(e.unref(Z)(r))},e.toDisplayString(N(r,"header")),5)):r.type==="row"?(e.openBlock(),e.createElementBlock("div",at,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.cells,(h,q)=>(e.openBlock(),e.createElementBlock("div",{key:q,class:"qukt-q-cell",style:e.normalizeStyle(e.unref(ie)(h))},e.toDisplayString(y(h,"header")),5))),128))])):e.createCommentVNode("",!0)],64))),128)),a.value.columns.length>0?(e.openBlock(),e.createElementBlock("div",st,[e.createElementVNode("table",rt,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value.columns,r=>(e.openBlock(),e.createElementBlock("th",{key:r.field,style:e.normalizeStyle({width:(r.width||100)+"px"})},e.toDisplayString(r.title),5))),128))])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(r,u)=>{var h,q;return e.openBlock(),e.createElementBlock(e.Fragment,{key:u},[r.__is_subtotal?(e.openBlock(),e.createElementBlock("tr",dt,[e.createElementVNode("td",{colspan:a.value.columns.length-1,class:"subtotal-label"},"小计("+e.toDisplayString(r.__group_key)+")",9,ct),e.createElementVNode("td",mt,e.toDisplayString(((h=a.value.group_rules)==null?void 0:h.subtotal_prefix)||"")+e.toDisplayString(d(r.__group_sum))+e.toDisplayString(((q=a.value.group_rules)==null?void 0:q.subtotal_suffix)||""),1)])):(e.openBlock(),e.createElementBlock("tr",pt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value.columns,(w,B)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:w.field},[b(n.value.indexOf(r),w.field)>0?(e.openBlock(),e.createElementBlock("td",{key:0,rowspan:b(n.value.indexOf(r),w.field),class:e.normalizeClass({"merged-cell":b(n.value.indexOf(r),w.field)>1}),style:e.normalizeStyle(_(w))},[w.editor===e.unref(P).AUTO_SEQ.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(w.prefix||"")+e.toDisplayString(u+1)+e.toDisplayString(w.suffix||""),1)],64)):e.unref(I)(w.editor).hasFormula?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(w.prefix||"")+e.toDisplayString(d(g(r)))+e.toDisplayString(w.suffix||""),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(w.prefix||"")+e.toDisplayString(r[w.field]??"")+e.toDisplayString(w.suffix||""),1)],64))],14,ut)):e.createCommentVNode("",!0)],64))),128))]))],64)}),128)),n.value.length===0?(e.openBlock(),e.createElementBlock("tr",ft,[e.createElementVNode("td",{colspan:a.value.columns.length,class:"qukt-q-empty"},"(暂无数据)",8,kt)])):e.createCommentVNode("",!0)])])])):e.createCommentVNode("",!0),a.value.summary_fields.length>0?(e.openBlock(),e.createElementBlock("div",bt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value.summary_fields,r=>(e.openBlock(),e.createElementBlock("div",{key:r.field,class:"qukt-q-summary-row"},[e.createElementVNode("span",ht,e.toDisplayString(r.label),1),e.createElementVNode("span",{class:"qukt-q-summary-value",style:e.normalizeStyle(e.unref(Me)(r))},e.toDisplayString(s(r)),5)]))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",yt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value.footer_sections,(r,u)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"f"+u},[r.type==="divider"?(e.openBlock(),e.createElementBlock("div",Et)):r.type==="text"?(e.openBlock(),e.createElementBlock("div",{key:1,class:"qukt-q-text",style:e.normalizeStyle(e.unref(Z)(r))},e.toDisplayString(N(r,"footer")),5)):r.type==="row"?(e.openBlock(),e.createElementBlock("div",gt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.cells,(h,q)=>(e.openBlock(),e.createElementBlock("div",{key:q,class:"qukt-q-cell",style:e.normalizeStyle(e.unref(ie)(h))},e.toDisplayString(y(h,"footer")),5))),128))])):e.createCommentVNode("",!0)],64))),128))])])]))}},Vt=(t,o)=>{const l=t.__vccOpts||t;for(const[a,k]of o)l[a]=k;return l},Nt={class:"qukt-preview-box"},_t={class:"qukt-preview-header"},qt={class:"qukt-preview-title"},wt={class:"qukt-preview-body"},Bt={class:"qukt-preview-footer"},xt={class:"qukt-preview-json-box"},$t={class:"qukt-preview-header"},Ct={class:"qukt-preview-title"},St={class:"qukt-preview-json-body"},Dt={class:"qukt-preview-footer"},Ie=Vt({__name:"QuokitPreview",props:{tpl:{type:Object,required:!0},data:{type:Object,default:()=>({headerData:{},rows:[],footerData:{}})},config:{type:Object,default:()=>({})}},emits:["close"],setup(t,{emit:o}){const l=o,a=e.ref(null),k=e.reactive({open:!1,title:"",text:""});function p(){l("close")}async function m(d){var f;await e.nextTick(),(f=a.value)==null||f.exportExcel(d)}async function N(d){var f;await e.nextTick(),(f=a.value)==null||f.print(d)}function y(d,f){k.title=d,k.text=JSON.stringify(f,null,2),k.open=!0}function _(){navigator.clipboard.writeText(k.text).catch(()=>{})}return(d,f)=>(e.openBlock(),e.createElementBlock("div",{class:"qukt-preview-mask",onClick:e.withModifiers(p,["self"])},[e.createElementVNode("div",Nt,[e.createElementVNode("div",_t,[e.createElementVNode("span",qt,e.toDisplayString(t.config.title||"👁️ 总体预览"),1),e.createElementVNode("span",{class:"qukt-preview-close",onClick:p},"✕")]),e.createElementVNode("div",wt,[e.createVNode(ue,{ref_key:"sheetRef",ref:a,tpl:t.tpl,data:t.data},null,8,["tpl","data"])]),e.createElementVNode("div",Bt,[t.config.excel!==!1?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("button",{class:"tool-btn",onClick:f[0]||(f[0]=g=>m(!1))},"📤 导出 Excel"),e.createElementVNode("button",{class:"tool-btn",onClick:f[1]||(f[1]=g=>m(!0))},"📤 导出(撑长)")],64)):e.createCommentVNode("",!0),t.config.print!==!1?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("button",{class:"tool-btn",onClick:f[2]||(f[2]=g=>N(!1))},"🖨️ 打印(横)"),e.createElementVNode("button",{class:"tool-btn",onClick:f[3]||(f[3]=g=>N(!0))},"🖨️ 打印(竖)")],64)):e.createCommentVNode("",!0),t.config.json!==!1?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("button",{class:"tool-btn",onClick:f[4]||(f[4]=g=>y("📄 模板 JSON",t.tpl))},"📄 模板 JSON"),e.createElementVNode("button",{class:"tool-btn",onClick:f[5]||(f[5]=g=>y("📦 数据 JSON",t.data))},"📦 数据 JSON")],64)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"tool-btn",onClick:p},"关闭")])]),k.open?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qukt-preview-json-mask",onClick:f[8]||(f[8]=e.withModifiers(g=>k.open=!1,["self"]))},[e.createElementVNode("div",xt,[e.createElementVNode("div",$t,[e.createElementVNode("span",Ct,e.toDisplayString(k.title),1),e.createElementVNode("span",{class:"qukt-preview-close",onClick:f[6]||(f[6]=g=>k.open=!1)},"✕")]),e.createElementVNode("pre",St,e.toDisplayString(k.text),1),e.createElementVNode("div",Dt,[e.createElementVNode("button",{class:"tool-btn",onClick:_},"📋 复制"),e.createElementVNode("button",{class:"tool-btn",onClick:f[7]||(f[7]=g=>k.open=!1)},"关闭")])])])):e.createCommentVNode("",!0)]))}},[["__scopeId","data-v-8a922e81"]]);function We(t=[],o={}){const l=e.ref(t||[]),a=e.ref(o||{}),k=e.computed(()=>({columns:l.value,group_rules:a.value}));function p(N){l.value=N||[]}function m(N){a.value=N||{}}return e.reactive({columns:l,groupRules:a,tpl:k,setColumns:p,setGroupRules:m})}function fe(t=[]){const o=e.ref(t||[]);function l(k){o.value=k||[]}function a(){return o.value||[]}return e.reactive({sections:o,setSections:l,toTpl:a})}function Pe(t=[]){const o=e.ref(t||[]);function l(k){o.value=k||[]}function a(){return o.value||[]}return e.reactive({fields:o,setFields:l,toTpl:a})}const Ft=["XXXX","YYYY","ZZZZ","WWWW"];function je(t,o=3){const l=[],a=Ft;for(let k=0;k<o;k++){const p={};for(const m of t){const N=I(m.editor);if(N.editable)if(m.editor===P.NUMBER.value)p[m.field]=Math.floor(Math.random()*900+100);else if(N.hasDict){const y=(m.dictStr||(m.dict?m.dict.join(","):"")).split(",").map(_=>_.trim()).filter(Boolean);p[m.field]=y[k%Math.max(y.length,1)]||a[k%a.length]}else p[m.field]=a[k%a.length]}l.push(p)}return l}const Tt={class:"qukt-gr-dialog"},Ut={class:"qukt-gr-header"},Mt={class:"qukt-gr-content"},At={class:"qukt-gr-form"},Lt={class:"qukt-gr-form-row"},zt={class:"qukt-gr-form-row"},Rt={class:"qukt-gr-form-row"},Ot={key:0,class:"qukt-gr-form-row"},It={key:1,class:"qukt-gr-form-row"},Wt={class:"qukt-gr-form-row"},Pt={class:"qukt-border-group",style:{flex:"1"}},jt={class:"qukt-border-item"},Jt={class:"qukt-border-item"},Qt={class:"qukt-border-item"},Xt={class:"qukt-border-item"},Gt={class:"qukt-gr-form-row"},Ht={class:"qukt-gr-footer"},re={__name:"StyleDialog",props:{visible:{type:Boolean,default:!1},modelValue:{type:Object,default:()=>({})},showBorder:{type:Boolean,default:!0},showAlign:{type:Boolean,default:!0},showWidth:{type:Boolean,default:!1},title:{type:String,default:"样式配置"}},emits:["close","update:modelValue"],setup(t,{emit:o}){const l=t,a=o,k=()=>({top:{style:"",width:1,color:"#dcdfe6"},bottom:{style:"",width:1,color:"#dcdfe6"},left:{style:"",width:1,color:"#dcdfe6"},right:{style:"",width:1,color:"#dcdfe6"}}),p=()=>({width:"auto",color:"#303133",fontSize:13,bold:!1,italic:!1,align:"left",border:k()}),m=e.reactive(p());function N(_){const d=p(),f=W(_||{});if(f.color!==void 0&&(d.color=f.color),f.fontSize!==void 0&&(d.fontSize=f.fontSize),f.bold!==void 0&&(d.bold=f.bold),f.italic!==void 0&&(d.italic=f.italic),f.align!==void 0&&(d.align=f.align),f.width!==void 0&&(d.width=f.width),f.border!==void 0){d.border=W(k());for(const g of["top","bottom","left","right"])f.border[g]&&(d.border[g]={...d.border[g],...f.border[g]})}Object.assign(m,d)}e.watch(()=>l.visible,_=>{_&&N(l.modelValue)},{immediate:!0}),e.watch(m,()=>{a("update:modelValue",W({...m}))},{deep:!0});function y(_){const d=_==="none"?{style:"",width:0,color:"#dcdfe6"}:{style:"solid",width:1,color:"#dcdfe6"};m.border={top:{...d},bottom:{...d},left:{...d},right:{...d}}}return(_,d)=>t.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qukt-gr-mask",onClick:d[22]||(d[22]=e.withModifiers(f=>_.$emit("close"),["self"]))},[e.createElementVNode("div",Tt,[e.createElementVNode("div",Ut,[e.createElementVNode("span",null,e.toDisplayString(t.title),1),e.createElementVNode("button",{class:"qukt-gr-close",onClick:d[0]||(d[0]=f=>_.$emit("close"))},"✕")]),e.createElementVNode("div",Mt,[e.createElementVNode("div",At,[e.createElementVNode("div",Lt,[d[23]||(d[23]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"颜色",-1)),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":d[1]||(d[1]=f=>m.color=f),class:"qukt-color-input"},null,512),[[e.vModelText,m.color]])]),e.createElementVNode("div",zt,[d[24]||(d[24]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"字号",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d[2]||(d[2]=f=>m.fontSize=f),type:"number",class:"qukt-cell-input tiny",min:"10",max:"48",style:{flex:"1"}},null,512),[[e.vModelText,m.fontSize,void 0,{number:!0}]])]),e.createElementVNode("div",Rt,[d[25]||(d[25]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"加粗",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":d[3]||(d[3]=f=>m.bold=f)},null,512),[[e.vModelCheckbox,m.bold]]),d[26]||(d[26]=e.createElementVNode("label",{class:"qukt-gr-form-label",style:{"margin-left":"20px"}},"斜体",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":d[4]||(d[4]=f=>m.italic=f)},null,512),[[e.vModelCheckbox,m.italic]])]),t.showWidth?(e.openBlock(),e.createElementBlock("div",Ot,[d[27]||(d[27]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"宽度",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d[5]||(d[5]=f=>m.width=f),class:"qukt-cell-input",placeholder:"如 33%、auto",style:{flex:"1"}},null,512),[[e.vModelText,m.width]])])):e.createCommentVNode("",!0),t.showAlign?(e.openBlock(),e.createElementBlock("div",It,[d[29]||(d[29]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"对齐",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":d[6]||(d[6]=f=>m.align=f),class:"qukt-cell-input",style:{flex:"1"}},[...d[28]||(d[28]=[e.createElementVNode("option",{value:"left"},"左",-1),e.createElementVNode("option",{value:"center"},"中",-1),e.createElementVNode("option",{value:"right"},"右",-1)])],512),[[e.vModelSelect,m.align]])])):e.createCommentVNode("",!0),t.showBorder?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("div",Wt,[d[38]||(d[38]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"边框",-1)),e.createElementVNode("div",Pt,[e.createElementVNode("div",jt,[d[31]||(d[31]=e.createElementVNode("span",null,"上",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":d[7]||(d[7]=f=>m.border.top.style=f),class:"qukt-cell-input tiny"},[...d[30]||(d[30]=[e.createElementVNode("option",{value:""},"无",-1),e.createElementVNode("option",{value:"solid"},"实线",-1),e.createElementVNode("option",{value:"dashed"},"虚线",-1),e.createElementVNode("option",{value:"dotted"},"点线",-1)])],512),[[e.vModelSelect,m.border.top.style]]),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":d[8]||(d[8]=f=>m.border.top.width=f),class:"qukt-cell-input tiny",min:"0",max:"20",step:"1"},null,512),[[e.vModelText,m.border.top.width,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":d[9]||(d[9]=f=>m.border.top.color=f),class:"qukt-color-input"},null,512),[[e.vModelText,m.border.top.color]])]),e.createElementVNode("div",Jt,[d[33]||(d[33]=e.createElementVNode("span",null,"下",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":d[10]||(d[10]=f=>m.border.bottom.style=f),class:"qukt-cell-input tiny"},[...d[32]||(d[32]=[e.createElementVNode("option",{value:""},"无",-1),e.createElementVNode("option",{value:"solid"},"实线",-1),e.createElementVNode("option",{value:"dashed"},"虚线",-1),e.createElementVNode("option",{value:"dotted"},"点线",-1)])],512),[[e.vModelSelect,m.border.bottom.style]]),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":d[11]||(d[11]=f=>m.border.bottom.width=f),class:"qukt-cell-input tiny",min:"0",max:"20",step:"1"},null,512),[[e.vModelText,m.border.bottom.width,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":d[12]||(d[12]=f=>m.border.bottom.color=f),class:"qukt-color-input"},null,512),[[e.vModelText,m.border.bottom.color]])]),e.createElementVNode("div",Qt,[d[35]||(d[35]=e.createElementVNode("span",null,"左",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":d[13]||(d[13]=f=>m.border.left.style=f),class:"qukt-cell-input tiny"},[...d[34]||(d[34]=[e.createElementVNode("option",{value:""},"无",-1),e.createElementVNode("option",{value:"solid"},"实线",-1),e.createElementVNode("option",{value:"dashed"},"虚线",-1),e.createElementVNode("option",{value:"dotted"},"点线",-1)])],512),[[e.vModelSelect,m.border.left.style]]),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":d[14]||(d[14]=f=>m.border.left.width=f),class:"qukt-cell-input tiny",min:"0",max:"20",step:"1"},null,512),[[e.vModelText,m.border.left.width,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":d[15]||(d[15]=f=>m.border.left.color=f),class:"qukt-color-input"},null,512),[[e.vModelText,m.border.left.color]])]),e.createElementVNode("div",Xt,[d[37]||(d[37]=e.createElementVNode("span",null,"右",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":d[16]||(d[16]=f=>m.border.right.style=f),class:"qukt-cell-input tiny"},[...d[36]||(d[36]=[e.createElementVNode("option",{value:""},"无",-1),e.createElementVNode("option",{value:"solid"},"实线",-1),e.createElementVNode("option",{value:"dashed"},"虚线",-1),e.createElementVNode("option",{value:"dotted"},"点线",-1)])],512),[[e.vModelSelect,m.border.right.style]]),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":d[17]||(d[17]=f=>m.border.right.width=f),class:"qukt-cell-input tiny",min:"0",max:"20",step:"1"},null,512),[[e.vModelText,m.border.right.width,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":d[18]||(d[18]=f=>m.border.right.color=f),class:"qukt-color-input"},null,512),[[e.vModelText,m.border.right.color]])])])]),e.createElementVNode("div",Gt,[d[39]||(d[39]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"预设",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:d[19]||(d[19]=f=>y("all"))},"四边"),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:d[20]||(d[20]=f=>y("none"))},"无边框")])],64)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Ht,[e.createElementVNode("button",{class:"qukt-btn",onClick:d[21]||(d[21]=f=>_.$emit("close"))},"关闭")])])])):e.createCommentVNode("",!0)}};function ee(t){if(t===null||typeof t!="object"||Array.isArray(t))return!1;const o=Object.getPrototypeOf(t);return o===Object.prototype||o===null}function Je(t){return!Array.isArray(t)||t.length===0?!1:t.every(o=>ee(o)&&"key"in o)}function Yt(t,o){const l=new Map;for(const a of t)l.set(a.key,a);for(const a of o)if(l.has(a.key)){const k=l.get(a.key);l.set(a.key,de({...k},a))}else l.set(a.key,a);return t.map(a=>l.get(a.key)).concat(o.filter(a=>!l.has(a.key)&&t.some(k=>k.key===a.key)===!1))}function de(t,o){if(!ee(o))return t;for(const l of Object.keys(o)){const a=o[l],k=t[l];ee(a)&&ee(k)?t[l]=de({...k},a):Je(a)&&Je(k)?t[l]=Yt(k,a):t[l]=a}return t}const Qe={templateCols:{layout:"auto",minWidth:960,columns:[{key:"idx",label:"#",width:50},{key:"field",label:"字段名",width:150},{key:"title",label:"列标题",width:200},{key:"editor",label:"类型",width:140},{key:"width",label:"宽度",width:100},{key:"editorCfg",label:"专属配置",width:200},{key:"merge",label:"分组时合并",width:120},{key:"style",label:"设置",width:80},{key:"ops",label:"操作",width:140}]}},X=e.reactive(JSON.parse(JSON.stringify(Qe)));function Zt(t){if(!ee(t)){console.warn("[vue-quokit] setConfig expected a plain object, got",typeof t);return}de(X,t)}function Kt(){return JSON.parse(JSON.stringify(X))}function vt(){Object.keys(X).forEach(t=>delete X[t]),de(X,JSON.parse(JSON.stringify(Qe)))}const el={class:"qukt-toolbar"},tl={class:"qukt-btn-group-inline"},ll={key:0,class:"qukt-design-table qukt-design-table--fixed"},ol=["width"],nl={class:"idx"},il=["onUpdate:modelValue"],al={class:"qukt-title-group"},sl=["onUpdate:modelValue"],rl=["onUpdate:modelValue"],dl=["onUpdate:modelValue"],cl=["onUpdate:modelValue"],ml=["value"],pl=["onUpdate:modelValue"],ul=["onUpdate:modelValue"],fl=["onUpdate:modelValue"],kl={key:2,class:"qukt-muted"},bl={key:3,class:"qukt-muted"},hl={class:"qukt-col-merge"},yl={key:0},El=["onUpdate:modelValue"],gl={key:1,class:"qukt-muted"},Vl=["onClick"],Nl=["disabled","onClick"],_l=["disabled","onClick"],ql=["onClick"],wl={key:1,class:"qukt-design-table"},Bl=["width"],xl={class:"idx"},$l=["onUpdate:modelValue"],Cl={class:"qukt-title-group"},Sl=["onUpdate:modelValue"],Dl=["onUpdate:modelValue"],Fl=["onUpdate:modelValue"],Tl=["onUpdate:modelValue"],Ul=["value"],Ml=["onUpdate:modelValue"],Al=["onUpdate:modelValue"],Ll=["onUpdate:modelValue"],zl={key:2,class:"qukt-muted"},Rl={key:3,class:"qukt-muted"},Ol={class:"qukt-col-merge"},Il={key:0},Wl=["onUpdate:modelValue"],Pl={key:1,class:"qukt-muted"},jl=["onClick"],Jl=["disabled","onClick"],Ql=["disabled","onClick"],Xl=["onClick"],Gl={__name:"DesignCols",props:{columns:{type:Array,default:()=>[]},groupRules:{type:Object,default:()=>({})}},emits:["update:columns","update:groupRules","help","open-group"],setup(t,{emit:o}){const l=Object.values(P),a=e.computed(()=>X.templateCols.columns),k=e.computed(()=>X.templateCols.layout==="fixed"),p=e.computed(()=>({"--qukt-cols-min-width":X.templateCols.minWidth+"px"})),m=t,N=o,y=e.ref([]),_=e.ref({});e.watch(()=>m.columns,n=>{const b=Se(W(n||[]));Y(b,y.value)||(y.value=b)},{immediate:!0,deep:!0}),e.watch(()=>m.groupRules,n=>{const b=ne(W(n||{}));Y(b,_.value)||(_.value=b)},{immediate:!0,deep:!0}),e.watch(y,n=>{N("update:columns",De(n))},{deep:!0}),e.watch(_,n=>{N("update:groupRules",W(n))},{deep:!0});const d=e.computed(()=>!!_.value.merge_field);function f(){let n=0;for(const b of y.value){const i=/^custom_(\d+)$/.exec(b.field);i&&(n=Math.max(n,parseInt(i[1],10)))}return n+1}function g(n){const b=new Set([...y.value.map(E=>E.field)]),i=I(n);let x;i.defaultFieldBase==="custom"?x="custom_"+String(f()).padStart(4,"0"):x=i.defaultFieldBase;const c=Ke(n,et(x,b));y.value.push(c)}function U(n){y.value.splice(n,1)}function A(n,b){const i=n+b;i<0||i>=y.value.length||([y.value[n],y.value[i]]=[y.value[i],y.value[n]])}const L=e.ref(!1),D=e.ref({}),V=e.ref("");function s(n){n.cellStyle||(n.cellStyle={}),D.value=n.cellStyle,V.value=n.title||"单元格样式",L.value=!0}return(n,b)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",el,[b[5]||(b[5]=e.createElementVNode("span",{class:"qukt-tip"},[e.createTextVNode("拖动或点 ↑↓ 调整顺序;支持自动序号和公式计算列,公式里可直接引用其他字段名,如 "),e.createElementVNode("code",null,"quantity * unit_price * 0.9")],-1)),e.createElementVNode("div",tl,[e.createElementVNode("button",{class:"qukt-btn",onClick:b[0]||(b[0]=i=>n.$emit("open-group"))},"分组 & 小计"+e.toDisplayString(d.value?" ✓":""),1),e.createElementVNode("button",{class:"qukt-btn",onClick:b[1]||(b[1]=i=>g("INPUT"))},"+ 添加字段"),e.createElementVNode("button",{class:"qukt-btn",onClick:b[2]||(b[2]=i=>n.$emit("help"))},"帮助")])]),e.createElementVNode("div",{class:"qukt-table-wrap",style:e.normalizeStyle(p.value)},[k.value?(e.openBlock(),e.createElementBlock("table",ll,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,i=>(e.openBlock(),e.createElementBlock("th",{key:i.key,width:i.width},e.toDisplayString(i.label),9,ol))),128))])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,(i,x)=>(e.openBlock(),e.createElementBlock("tr",{key:x},[e.createElementVNode("td",nl,e.toDisplayString(x+1),1),e.createElementVNode("td",null,[e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input","onUpdate:modelValue":c=>i.field=c},null,8,il),[[e.vModelText,i.field]])]),e.createElementVNode("td",null,[e.createElementVNode("div",al,[e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input pref-suf","onUpdate:modelValue":c=>i.prefix=c,placeholder:"前"},null,8,sl),[[e.vModelText,i.prefix]]),e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input","onUpdate:modelValue":c=>i.title=c,placeholder:"列标题"},null,8,rl),[[e.vModelText,i.title]]),e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input pref-suf","onUpdate:modelValue":c=>i.suffix=c,placeholder:"后"},null,8,dl),[[e.vModelText,i.suffix]])])]),e.createElementVNode("td",null,[e.withDirectives(e.createElementVNode("select",{class:"qukt-cell-input","onUpdate:modelValue":c=>i.editor=c},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l),c=>(e.openBlock(),e.createElementBlock("option",{key:c.value,value:c.value},e.toDisplayString(c.label),9,ml))),128))],8,cl),[[e.vModelSelect,i.editor]])]),e.createElementVNode("td",null,[e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input",type:"number",min:"50",max:"500","onUpdate:modelValue":c=>i.width=c},null,8,pl),[[e.vModelText,i.width,void 0,{number:!0}]])]),e.createElementVNode("td",null,[e.unref(I)(i.editor).hasDict?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,class:"qukt-cell-input","onUpdate:modelValue":c=>i.dictStr=c,placeholder:"下拉选项,逗号分隔 如:设备,材料,安装"},null,8,ul)),[[e.vModelText,i.dictStr]]):e.unref(I)(i.editor).hasFormula?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:1,class:"qukt-cell-input","onUpdate:modelValue":c=>i.formula=c,placeholder:"公式,如 quantity * unit_price + tax"},null,8,fl)),[[e.vModelText,i.formula]]):i.editor===e.unref(P).AUTO_SEQ.value?(e.openBlock(),e.createElementBlock("span",kl,"自动生成序号,无需配置")):(e.openBlock(),e.createElementBlock("span",bl,"-"))]),e.createElementVNode("td",hl,[e.unref(I)(i.editor).canMerge?(e.openBlock(),e.createElementBlock("label",yl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":c=>i.merge_on_group=c},null,8,El),[[e.vModelCheckbox,i.merge_on_group]]),b[6]||(b[6]=e.createElementVNode("span",null,"相同值合并",-1))])):(e.openBlock(),e.createElementBlock("span",gl,"—"))]),e.createElementVNode("td",null,[e.createElementVNode("button",{class:"qukt-mini-btn",onClick:c=>s(i)},"样式",8,Vl)]),e.createElementVNode("td",null,[e.createElementVNode("button",{class:"qukt-mini-btn",disabled:x===0,onClick:c=>A(x,-1)},"↑",8,Nl),e.createElementVNode("button",{class:"qukt-mini-btn",disabled:x>=y.value.length-1,onClick:c=>A(x,1)},"↓",8,_l),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:c=>U(x)},"删",8,ql)])]))),128))])])):(e.openBlock(),e.createElementBlock("table",wl,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,i=>(e.openBlock(),e.createElementBlock("th",{key:i.key,width:i.width??200},e.toDisplayString(i.label),9,Bl))),128))])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,(i,x)=>(e.openBlock(),e.createElementBlock("tr",{key:x},[e.createElementVNode("td",xl,e.toDisplayString(x+1),1),e.createElementVNode("td",null,[e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input","onUpdate:modelValue":c=>i.field=c},null,8,$l),[[e.vModelText,i.field]])]),e.createElementVNode("td",null,[e.createElementVNode("div",Cl,[e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input pref-suf","onUpdate:modelValue":c=>i.prefix=c,placeholder:"前"},null,8,Sl),[[e.vModelText,i.prefix]]),e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input","onUpdate:modelValue":c=>i.title=c,placeholder:"列标题"},null,8,Dl),[[e.vModelText,i.title]]),e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input pref-suf","onUpdate:modelValue":c=>i.suffix=c,placeholder:"后"},null,8,Fl),[[e.vModelText,i.suffix]])])]),e.createElementVNode("td",null,[e.withDirectives(e.createElementVNode("select",{class:"qukt-cell-input","onUpdate:modelValue":c=>i.editor=c},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l),c=>(e.openBlock(),e.createElementBlock("option",{key:c.value,value:c.value},e.toDisplayString(c.label),9,Ul))),128))],8,Tl),[[e.vModelSelect,i.editor]])]),e.createElementVNode("td",null,[e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input",type:"number",min:"50",max:"500","onUpdate:modelValue":c=>i.width=c},null,8,Ml),[[e.vModelText,i.width,void 0,{number:!0}]])]),e.createElementVNode("td",null,[e.unref(I)(i.editor).hasDict?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,class:"qukt-cell-input","onUpdate:modelValue":c=>i.dictStr=c,placeholder:"下拉选项,逗号分隔 如:设备,材料,安装"},null,8,Al)),[[e.vModelText,i.dictStr]]):e.unref(I)(i.editor).hasFormula?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:1,class:"qukt-cell-input","onUpdate:modelValue":c=>i.formula=c,placeholder:"公式,如 quantity * unit_price + tax"},null,8,Ll)),[[e.vModelText,i.formula]]):i.editor===e.unref(P).AUTO_SEQ.value?(e.openBlock(),e.createElementBlock("span",zl,"自动生成序号,无需配置")):(e.openBlock(),e.createElementBlock("span",Rl,"-"))]),e.createElementVNode("td",Ol,[e.unref(I)(i.editor).canMerge?(e.openBlock(),e.createElementBlock("label",Il,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":c=>i.merge_on_group=c},null,8,Wl),[[e.vModelCheckbox,i.merge_on_group]]),b[7]||(b[7]=e.createElementVNode("span",null,"相同值合并",-1))])):(e.openBlock(),e.createElementBlock("span",Pl,"—"))]),e.createElementVNode("td",null,[e.createElementVNode("button",{class:"qukt-mini-btn",onClick:c=>s(i)},"样式",8,jl)]),e.createElementVNode("td",null,[e.createElementVNode("button",{class:"qukt-mini-btn",disabled:x===0,onClick:c=>A(x,-1)},"↑",8,Jl),e.createElementVNode("button",{class:"qukt-mini-btn",disabled:x>=y.value.length-1,onClick:c=>A(x,1)},"↓",8,Ql),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:c=>U(x)},"删",8,Xl)])]))),128))])]))],4),e.createVNode(re,{visible:L.value,modelValue:D.value,showBorder:"",showAlign:!0,showWidth:!1,title:V.value,"onUpdate:modelValue":b[3]||(b[3]=i=>Object.assign(D.value,i)),onClose:b[4]||(b[4]=i=>L.value=!1)},null,8,["visible","modelValue","title"])]))}},Hl={class:"qukt-gr-dialog"},Yl={class:"qukt-gr-header"},Zl={class:"qukt-gr-content"},Kl={class:"qukt-gr-form"},vl={class:"qukt-gr-form-row"},eo=["value","disabled"],to={class:"qukt-gr-form-row"},lo={class:"qukt-gr-form-row"},oo={class:"qukt-gr-form-row"},no={class:"qukt-gr-footer"},io={__name:"GroupDialog",props:{visible:{type:Boolean,default:!1},columns:{type:Array,default:()=>[]},groupRules:{type:Object,default:()=>({})}},emits:["close","update:groupRules"],setup(t,{emit:o}){const l=t,a=o,k=e.reactive({merge_field:"",show_detail_subtotal:!0,subtotal_prefix:"",subtotal_suffix:""});return e.watch(()=>l.groupRules,p=>{const m=ne(W(p||{}));k.merge_field=m.merge_field||"",k.show_detail_subtotal=m.show_detail_subtotal??!0,k.subtotal_prefix=m.subtotal_prefix??"",k.subtotal_suffix=m.subtotal_suffix??""},{immediate:!0,deep:!0}),e.watch(k,()=>{a("update:groupRules",W(ne({merge_field:k.merge_field,show_detail_subtotal:k.show_detail_subtotal,subtotal_prefix:k.subtotal_prefix,subtotal_suffix:k.subtotal_suffix})))},{deep:!0}),(p,m)=>t.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qukt-gr-mask",onClick:m[6]||(m[6]=e.withModifiers(N=>p.$emit("close"),["self"]))},[e.createElementVNode("div",Hl,[e.createElementVNode("div",Yl,[m[7]||(m[7]=e.createElementVNode("span",null,"分组规则 & 小计配置",-1)),e.createElementVNode("button",{class:"qukt-gr-close",onClick:m[0]||(m[0]=N=>p.$emit("close"))},"✕")]),e.createElementVNode("div",Zl,[m[13]||(m[13]=e.createElementVNode("div",{class:"qukt-gr-tips"},[e.createElementVNode("p",null,[e.createElementVNode("b",null,"分组是什么?"),e.createTextVNode(" 选择某一列后,相同值的行会自动合并单元格(比如按「系统名称」分组,同系统的多条明细会合并成一个单元格)。每组末尾自动显示一行小计。")])],-1)),e.createElementVNode("div",Kl,[e.createElementVNode("div",vl,[m[9]||(m[9]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"按哪一列分组",-1)),e.withDirectives(e.createElementVNode("select",{class:"qukt-cell-input","onUpdate:modelValue":m[1]||(m[1]=N=>k.merge_field=N),style:{flex:"1"}},[m[8]||(m[8]=e.createElementVNode("option",{value:""},"— 不分组 —",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columns,N=>(e.openBlock(),e.createElementBlock("option",{key:N.field,value:N.field,disabled:!e.unref(I)(N.editor).editable},e.toDisplayString(N.title)+"("+e.toDisplayString(N.field)+")",9,eo))),128))],512),[[e.vModelSelect,k.merge_field]])]),e.createElementVNode("div",to,[m[10]||(m[10]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"显示小计",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":m[2]||(m[2]=N=>k.show_detail_subtotal=N)},null,512),[[e.vModelCheckbox,k.show_detail_subtotal]])]),e.createElementVNode("div",lo,[m[11]||(m[11]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"小计前缀",-1)),e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input","onUpdate:modelValue":m[3]||(m[3]=N=>k.subtotal_prefix=N),placeholder:"如 ¥、¥",style:{flex:"1"}},null,512),[[e.vModelText,k.subtotal_prefix]])]),e.createElementVNode("div",oo,[m[12]||(m[12]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"小计后缀",-1)),e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input","onUpdate:modelValue":m[4]||(m[4]=N=>k.subtotal_suffix=N),placeholder:"如 元、RMB",style:{flex:"1"}},null,512),[[e.vModelText,k.subtotal_suffix]])])])]),e.createElementVNode("div",no,[e.createElementVNode("button",{class:"qukt-btn",onClick:m[5]||(m[5]=N=>p.$emit("close"))},"关闭")])])])):e.createCommentVNode("",!0)}};function ke(t=1100){const o=e.ref(!1);function l(){o.value=window.innerWidth<=t}return e.onMounted(()=>{l(),window.addEventListener("resize",l)}),e.onUnmounted(()=>{window.removeEventListener("resize",l)}),{isNarrow:o}}const ao={class:"qukt-toolbar"},so={class:"qukt-col-left"},ro={class:"qukt-sec-header"},co={class:"qukt-sec-type"},mo={class:"qukt-sec-actions"},po=["disabled","onClick"],uo=["disabled","onClick"],fo=["onClick"],ko={class:"qukt-sec-row"},bo=["onUpdate:modelValue"],ho={class:"qukt-sec-row"},yo=["checked","onChange"],Eo={key:0,class:"qukt-sec-row"},go=["onUpdate:modelValue"],Vo={key:1,class:"qukt-sec-row"},No=["onUpdate:modelValue"],_o={class:"qukt-sec-row"},qo=["onClick"],wo={class:"qukt-cells-list"},Bo={class:"qukt-cell-toolbar"},xo=["onClick"],$o={class:"qukt-sec-row"},Co=["onUpdate:modelValue"],So={key:0,class:"qukt-sec-row"},Do=["onUpdate:modelValue"],Fo={class:"qukt-chk-label"},To=["onUpdate:modelValue"],Uo={class:"qukt-sec-row"},Mo=["checked","onChange"],Ao={key:1,class:"qukt-sec-row"},Lo=["onUpdate:modelValue"],zo={key:0,class:"qukt-sec-row"},Ro=["onUpdate:modelValue"],Oo={key:1,class:"qukt-sec-row"},Io=["onUpdate:modelValue"],Wo={class:"qukt-sec-row"},Po=["onClick"],jo=["onClick"],Jo={class:"qukt-col-right"},Qo={class:"qukt-preview-box"},Xo={class:"qukt-preview-inner"},Go={key:1,class:"qukt-p-divider"},Ho={key:3,class:"qukt-p-row"},Yo={key:0,class:"qukt-p-label"},Zo={class:"qukt-p-value qukt-p-bind-placeholder"},Ko={key:1,class:"qukt-p-value qukt-p-bind-placeholder"},vo={key:0,class:"qukt-p-label"},en={class:"qukt-p-value"},Xe="hdr_",tn={__name:"DesignHeader",props:{sections:{type:Array,default:()=>[]},breakpoint:{type:Number,default:1100}},emits:["update:sections"],setup(t,{emit:o}){const l=t,a=o,{isNarrow:k}=ke(l.breakpoint),p=e.ref([]);e.watch(()=>l.sections,V=>{const s=ae(W(V||[]));Y(s,p.value)||(p.value=s)},{immediate:!0}),e.watch(p,V=>{a("update:sections",W(V))},{deep:!0});const m=e.ref(!1),N=e.ref({}),y=e.reactive({title:"样式配置",showBorder:!1,showAlign:!0,showWidth:!1});function _(V,s){N.value=V,s==="cell"?(y.title="单元格样式",y.showBorder=!0,y.showAlign=!0,y.showWidth=!0):(y.title="文本样式",y.showBorder=!1,y.showAlign=!0,y.showWidth=!1),m.value=!0}function d(V){V==="divider"?p.value.push({type:V}):V==="text"?p.value.push({type:V,label:"标签:",text:"纯文本内容",style:{color:"#303133",fontSize:14,bold:!1,italic:!1,align:"left"},bindEnabled:!1,bindField:""}):V==="row"&&p.value.push({type:V,cells:[{type:"field",label:"标签:",bindEnabled:!1,bindField:"",hideLabel:!1,style:v("50%")}]})}function f(V){p.value.splice(V,1)}function g(V,s){const n=V+s;n<0||n>=p.value.length||([p.value[V],p.value[n]]=[p.value[n],p.value[V]])}function U(V){V.cells||(V.cells=[]),V.cells.push({type:"field",label:"标签:",bindEnabled:!1,bindField:"",hideLabel:!1,style:v("33%")})}function A(V,s){V.cells.splice(s,1)}const L=V=>Ae(V,Xe,p.value),D=V=>Le(V,Xe,p.value);return(V,s)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",ao,[s[5]||(s[5]=e.createElementVNode("span",{class:"qukt-tip"},"这里定义报价单的大标题、项目信息行等,左侧是设计器,右侧实时预览",-1)),e.createElementVNode("button",{class:"qukt-btn",onClick:s[0]||(s[0]=n=>d("row"))},"+ 字段行"),e.createElementVNode("button",{class:"qukt-btn",onClick:s[1]||(s[1]=n=>d("divider"))},"+ 分隔线"),e.createElementVNode("button",{class:"qukt-btn",onClick:s[2]||(s[2]=n=>d("text"))},"+ 纯文本")]),e.createElementVNode("div",{class:e.normalizeClass(["qukt-two-col",{"is-narrow":e.unref(k)}])},[e.createElementVNode("div",so,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,(n,b)=>(e.openBlock(),e.createElementBlock("div",{key:b,class:e.normalizeClass(["qukt-sec-block",{"qukt-sec-block--divider":n.type==="divider"}])},[e.createElementVNode("div",ro,[e.createElementVNode("span",co,e.toDisplayString(n.type==="row"?"字段行":n.type==="divider"?"分隔线":"纯文本"),1),e.createElementVNode("div",mo,[e.createElementVNode("button",{class:"qukt-mini-btn",disabled:b===0,onClick:i=>g(b,-1)},"↑",8,po),e.createElementVNode("button",{class:"qukt-mini-btn",disabled:b>=p.value.length-1,onClick:i=>g(b,1)},"↓",8,uo),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:i=>f(b)},"删",8,fo)])]),n.type==="text"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",ko,[s[6]||(s[6]=e.createElementVNode("label",null,"标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i=>n.label=i,class:"qukt-cell-input",placeholder:"填写数据时用的提示"},null,8,bo),[[e.vModelText,n.label]])]),e.createElementVNode("div",ho,[s[7]||(s[7]=e.createElementVNode("label",null,"暴露",-1)),e.createElementVNode("input",{type:"checkbox",checked:n.bindEnabled,onChange:i=>L(n)},null,40,yo)]),n.bindEnabled?(e.openBlock(),e.createElementBlock("div",Eo,[s[8]||(s[8]=e.createElementVNode("label",null,"字段名",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i=>n.bindField=i,class:"qukt-cell-input",placeholder:"如 salesman"},null,8,go),[[e.vModelText,n.bindField]])])):e.createCommentVNode("",!0),n.bindEnabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Vo,[s[9]||(s[9]=e.createElementVNode("label",null,"文字",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i=>n.text=i,class:"qukt-cell-input"},null,8,No),[[e.vModelText,n.text]])])),e.createElementVNode("div",_o,[s[10]||(s[10]=e.createElementVNode("label",null,"样式",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:i=>_(n.style,"text")},"设置",8,qo)])],64)):n.type==="row"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",wo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.cells,(i,x)=>(e.openBlock(),e.createElementBlock("div",{key:x,class:"qukt-cell-block"},[e.createElementVNode("div",Bo,[e.createElementVNode("strong",null,e.toDisplayString(x+1),1),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:c=>A(n,x)},"×",8,xo)]),e.createElementVNode("div",$o,[s[12]||(s[12]=e.createElementVNode("label",null,"类型",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":c=>i.type=c,class:"qukt-cell-input small"},[...s[11]||(s[11]=[e.createElementVNode("option",{value:"field"},"字段(可编辑)",-1),e.createElementVNode("option",{value:"text"},"纯文本",-1)])],8,Co),[[e.vModelSelect,i.type]])]),i.type==="field"?(e.openBlock(),e.createElementBlock("div",So,[s[14]||(s[14]=e.createElementVNode("label",null,"标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>i.label=c,class:"qukt-cell-input",placeholder:"标签"},null,8,Do),[[e.vModelText,i.label]]),e.createElementVNode("label",Fo,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":c=>i.hideLabel=c},null,8,To),[[e.vModelCheckbox,i.hideLabel]]),s[13]||(s[13]=e.createTextVNode(" 隐藏 ",-1))])])):e.createCommentVNode("",!0),e.createElementVNode("div",Uo,[s[15]||(s[15]=e.createElementVNode("label",null,"暴露",-1)),e.createElementVNode("input",{type:"checkbox",checked:i.bindEnabled,onChange:c=>D(i)},null,40,Mo)]),i.bindEnabled?(e.openBlock(),e.createElementBlock("div",Ao,[s[16]||(s[16]=e.createElementVNode("label",null,"字段名",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>i.bindField=c,class:"qukt-cell-input",placeholder:"如 salesman"},null,8,Lo),[[e.vModelText,i.bindField]])])):e.createCommentVNode("",!0),i.bindEnabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[i.type==="field"?(e.openBlock(),e.createElementBlock("div",zo,[s[17]||(s[17]=e.createElementVNode("label",null,"值",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>i.value=c,class:"qukt-cell-input",placeholder:"字段的值"},null,8,Ro),[[e.vModelText,i.value]])])):e.createCommentVNode("",!0),i.type==="text"?(e.openBlock(),e.createElementBlock("div",Oo,[s[18]||(s[18]=e.createElementVNode("label",null,"文字",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>i.text=c,class:"qukt-cell-input"},null,8,Io),[[e.vModelText,i.text]])])):e.createCommentVNode("",!0)],64)),e.createElementVNode("div",Wo,[s[19]||(s[19]=e.createElementVNode("label",null,"样式",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:c=>_(i.style,"cell")},"设置",8,Po)])]))),128))]),e.createElementVNode("button",{class:"qukt-btn qukt-btn-ghost",onClick:i=>U(n)},"+ 添加一个单元格",8,jo)],64)):e.createCommentVNode("",!0)],2))),128))]),e.createElementVNode("div",Jo,[e.createElementVNode("div",Qo,[s[20]||(s[20]=e.createElementVNode("div",{class:"qukt-preview-label"},"实时预览",-1)),e.createElementVNode("div",Xo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,(n,b)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:b},[n.type==="title"?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qukt-p-title",style:e.normalizeStyle(e.unref(Z)(n))},e.toDisplayString(n.bindEnabled?n.bindField||"待绑定":n.text||"大标题"),5)):n.type==="divider"?(e.openBlock(),e.createElementBlock("div",Go)):n.type==="text"?(e.openBlock(),e.createElementBlock("div",{key:2,class:"qukt-p-text",style:e.normalizeStyle(e.unref(Z)(n))},e.toDisplayString(n.bindEnabled?n.bindField||"待绑定":n.text||"纯文本"),5)):n.type==="row"?(e.openBlock(),e.createElementBlock("div",Ho,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.cells,(i,x)=>(e.openBlock(),e.createElementBlock("div",{key:x,class:"qukt-p-cell",style:e.normalizeStyle(e.unref(ie)(i))},[i.bindEnabled?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[i.type==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[i.label&&!i.hideLabel?(e.openBlock(),e.createElementBlock("span",Yo,e.toDisplayString(i.label),1)):e.createCommentVNode("",!0),e.createElementVNode("span",Zo,e.toDisplayString(i.bindField||"待绑定"),1)],64)):(e.openBlock(),e.createElementBlock("span",Ko,e.toDisplayString(i.bindField||"待绑定"),1))],64)):i.type==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[i.label&&!i.hideLabel?(e.openBlock(),e.createElementBlock("span",vo,e.toDisplayString(i.label),1)):e.createCommentVNode("",!0),e.createElementVNode("span",en,e.toDisplayString(i.value||"字段值"),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(i.text||"纯文本"),1)],64))],4))),128))])):e.createCommentVNode("",!0)],64))),128))])])])],2),e.createVNode(re,{visible:m.value,modelValue:N.value,showBorder:y.showBorder,showAlign:y.showAlign,showWidth:y.showWidth,title:y.title,"onUpdate:modelValue":s[3]||(s[3]=n=>Object.assign(N.value,n)),onClose:s[4]||(s[4]=n=>m.value=!1)},null,8,["visible","modelValue","showBorder","showAlign","showWidth","title"])]))}},ln={class:"qukt-toolbar"},on={class:"qukt-col-left"},nn={class:"qukt-sec-header"},an={class:"qukt-sec-type"},sn={class:"qukt-sec-actions"},rn=["disabled","onClick"],dn=["disabled","onClick"],cn=["onClick"],mn={class:"qukt-cells-list"},pn={class:"qukt-cell-toolbar"},un=["onClick"],fn={class:"qukt-sec-row"},kn=["onUpdate:modelValue"],bn={key:0,class:"qukt-sec-row"},hn=["onUpdate:modelValue"],yn={class:"qukt-chk-label"},En=["onUpdate:modelValue"],gn={class:"qukt-sec-row"},Vn=["checked","onChange"],Nn={key:1,class:"qukt-sec-row"},_n=["onUpdate:modelValue"],qn={key:0,class:"qukt-sec-row"},wn=["onUpdate:modelValue"],Bn={key:1,class:"qukt-sec-row"},xn=["onUpdate:modelValue"],$n={class:"qukt-sec-row"},Cn=["onClick"],Sn=["onClick"],Dn={class:"qukt-sec-row"},Fn=["onUpdate:modelValue"],Tn={class:"qukt-sec-row"},Un=["checked","onChange"],Mn={key:0,class:"qukt-sec-row"},An=["onUpdate:modelValue"],Ln={key:1,class:"qukt-sec-row"},zn=["onUpdate:modelValue"],Rn={class:"qukt-sec-row"},On=["onClick"],In={class:"qukt-col-right"},Wn={class:"qukt-preview-box"},Pn={class:"qukt-preview-inner"},jn={key:0,class:"qukt-p-divider"},Jn={key:2,class:"qukt-p-row"},Qn={key:0,class:"qukt-p-label"},Xn={class:"qukt-p-value qukt-p-bind-placeholder"},Gn={key:1,class:"qukt-p-value qukt-p-bind-placeholder"},Hn={key:0,class:"qukt-p-label"},Yn={class:"qukt-p-value"},Ge="ftr_",Zn={__name:"DesignFooter",props:{sections:{type:Array,default:()=>[]},breakpoint:{type:Number,default:1100}},emits:["update:sections"],setup(t,{emit:o}){const l=t,a=o,{isNarrow:k}=ke(l.breakpoint),p=e.ref([]);e.watch(()=>l.sections,V=>{const s=ae(W(V||[]));Y(s,p.value)||(p.value=s)},{immediate:!0}),e.watch(p,V=>{a("update:sections",W(V))},{deep:!0});const m=e.ref(!1),N=e.ref({}),y=e.reactive({title:"样式配置",showBorder:!1,showAlign:!0,showWidth:!1});function _(V,s){N.value=V,s==="cell"?(y.title="单元格样式",y.showBorder=!0,y.showAlign=!0,y.showWidth=!0):(y.title="文本样式",y.showBorder=!1,y.showAlign=!0,y.showWidth=!1),m.value=!0}function d(V){V==="divider"?p.value.push({type:V}):V==="text"?p.value.push({type:V,label:"标签:",text:"纯文本",style:{color:"#303133",fontSize:14,bold:!1,italic:!1,align:"left"},bindEnabled:!1,bindField:""}):V==="row"&&p.value.push({type:V,cells:[{type:"field",label:"标签:",bindEnabled:!1,bindField:"",hideLabel:!1,style:v("50%")}]})}function f(V){p.value.splice(V,1)}function g(V,s){const n=V+s;n<0||n>=p.value.length||([p.value[V],p.value[n]]=[p.value[n],p.value[V]])}function U(V){V.cells||(V.cells=[]),V.cells.push({type:"field",label:"标签:",bindEnabled:!1,bindField:"",hideLabel:!1,style:v("50%")})}function A(V,s){V.cells.splice(s,1)}const L=V=>Ae(V,Ge,p.value),D=V=>Le(V,Ge,p.value);return(V,s)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",ln,[s[5]||(s[5]=e.createElementVNode("span",{class:"qukt-tip"},"页面底部显示签字栏、盖章区等,结构和页面头部一样",-1)),e.createElementVNode("button",{class:"qukt-btn",onClick:s[0]||(s[0]=n=>d("divider"))},"+ 分隔线"),e.createElementVNode("button",{class:"qukt-btn",onClick:s[1]||(s[1]=n=>d("row"))},"+ 字段行"),e.createElementVNode("button",{class:"qukt-btn",onClick:s[2]||(s[2]=n=>d("text"))},"+ 纯文本")]),e.createElementVNode("div",{class:e.normalizeClass(["qukt-two-col",{"is-narrow":e.unref(k)}])},[e.createElementVNode("div",on,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,(n,b)=>(e.openBlock(),e.createElementBlock("div",{key:b,class:e.normalizeClass(["qukt-sec-block",{"qukt-sec-block--divider":n.type==="divider"}])},[e.createElementVNode("div",nn,[e.createElementVNode("span",an,e.toDisplayString(n.type==="row"?"字段行":n.type==="divider"?"分隔线":"纯文本"),1),e.createElementVNode("div",sn,[e.createElementVNode("button",{class:"qukt-mini-btn",disabled:b===0,onClick:i=>g(b,-1)},"↑",8,rn),e.createElementVNode("button",{class:"qukt-mini-btn",disabled:b>=p.value.length-1,onClick:i=>g(b,1)},"↓",8,dn),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:i=>f(b)},"删",8,cn)])]),n.type==="row"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",mn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.cells,(i,x)=>(e.openBlock(),e.createElementBlock("div",{key:x,class:"qukt-cell-block"},[e.createElementVNode("div",pn,[e.createElementVNode("strong",null,e.toDisplayString(x+1),1),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:c=>A(n,x)},"×",8,un)]),e.createElementVNode("div",fn,[s[7]||(s[7]=e.createElementVNode("label",null,"类型",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":c=>i.type=c,class:"qukt-cell-input small"},[...s[6]||(s[6]=[e.createElementVNode("option",{value:"field"},"字段(可编辑)",-1),e.createElementVNode("option",{value:"text"},"纯文本",-1)])],8,kn),[[e.vModelSelect,i.type]])]),i.type==="field"?(e.openBlock(),e.createElementBlock("div",bn,[s[9]||(s[9]=e.createElementVNode("label",null,"标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>i.label=c,class:"qukt-cell-input",placeholder:"标签"},null,8,hn),[[e.vModelText,i.label]]),e.createElementVNode("label",yn,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":c=>i.hideLabel=c},null,8,En),[[e.vModelCheckbox,i.hideLabel]]),s[8]||(s[8]=e.createTextVNode(" 隐藏 ",-1))])])):e.createCommentVNode("",!0),e.createElementVNode("div",gn,[s[10]||(s[10]=e.createElementVNode("label",null,"对外暴露",-1)),e.createElementVNode("input",{type:"checkbox",checked:i.bindEnabled,onChange:c=>D(i)},null,40,Vn)]),i.bindEnabled?(e.openBlock(),e.createElementBlock("div",Nn,[s[11]||(s[11]=e.createElementVNode("label",null,"字段名",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>i.bindField=c,class:"qukt-cell-input",placeholder:"如 company_name"},null,8,_n),[[e.vModelText,i.bindField]])])):e.createCommentVNode("",!0),i.bindEnabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[i.type==="field"?(e.openBlock(),e.createElementBlock("div",qn,[s[12]||(s[12]=e.createElementVNode("label",null,"值",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>i.value=c,class:"qukt-cell-input",placeholder:"字段的值"},null,8,wn),[[e.vModelText,i.value]])])):e.createCommentVNode("",!0),i.type==="text"?(e.openBlock(),e.createElementBlock("div",Bn,[s[13]||(s[13]=e.createElementVNode("label",null,"文字",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":c=>i.text=c,class:"qukt-cell-input"},null,8,xn),[[e.vModelText,i.text]])])):e.createCommentVNode("",!0)],64)),e.createElementVNode("div",$n,[s[14]||(s[14]=e.createElementVNode("label",null,"样式",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:c=>_(i.style,"cell")},"设置",8,Cn)])]))),128))]),e.createElementVNode("button",{class:"qukt-btn qukt-btn-ghost",onClick:i=>U(n)},"+ 添加一个单元格",8,Sn)],64)):n.type==="text"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",Dn,[s[15]||(s[15]=e.createElementVNode("label",null,"标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i=>n.label=i,class:"qukt-cell-input",placeholder:"填写数据时用的提示"},null,8,Fn),[[e.vModelText,n.label]])]),e.createElementVNode("div",Tn,[s[16]||(s[16]=e.createElementVNode("label",null,"暴露",-1)),e.createElementVNode("input",{type:"checkbox",checked:n.bindEnabled,onChange:i=>L(n)},null,40,Un)]),n.bindEnabled?(e.openBlock(),e.createElementBlock("div",Mn,[s[17]||(s[17]=e.createElementVNode("label",null,"字段名",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i=>n.bindField=i,class:"qukt-cell-input",placeholder:"如 company_name"},null,8,An),[[e.vModelText,n.bindField]])])):e.createCommentVNode("",!0),n.bindEnabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Ln,[s[18]||(s[18]=e.createElementVNode("label",null,"文字",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i=>n.text=i,class:"qukt-cell-input"},null,8,zn),[[e.vModelText,n.text]])])),e.createElementVNode("div",Rn,[s[19]||(s[19]=e.createElementVNode("label",null,"样式",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:i=>_(n.style,"text")},"设置",8,On)])],64)):e.createCommentVNode("",!0)],2))),128))]),e.createElementVNode("div",In,[e.createElementVNode("div",Wn,[s[20]||(s[20]=e.createElementVNode("div",{class:"qukt-preview-label"},"底部预览",-1)),e.createElementVNode("div",Pn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,(n,b)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:b},[n.type==="divider"?(e.openBlock(),e.createElementBlock("div",jn)):n.type==="text"?(e.openBlock(),e.createElementBlock("div",{key:1,class:"qukt-p-text",style:e.normalizeStyle(e.unref(Z)(n))},e.toDisplayString(n.bindEnabled?n.bindField||"待绑定":n.text||"纯文本"),5)):n.type==="row"?(e.openBlock(),e.createElementBlock("div",Jn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.cells,(i,x)=>(e.openBlock(),e.createElementBlock("div",{key:x,class:"qukt-p-cell",style:e.normalizeStyle(e.unref(ie)(i))},[i.bindEnabled?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[i.type==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[i.label&&!i.hideLabel?(e.openBlock(),e.createElementBlock("span",Qn,e.toDisplayString(i.label),1)):e.createCommentVNode("",!0),e.createElementVNode("span",Xn,e.toDisplayString(i.bindField||"待绑定"),1)],64)):(e.openBlock(),e.createElementBlock("span",Gn,e.toDisplayString(i.bindField||"待绑定"),1))],64)):i.type==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[i.label&&!i.hideLabel?(e.openBlock(),e.createElementBlock("span",Hn,e.toDisplayString(i.label),1)):e.createCommentVNode("",!0),e.createElementVNode("span",Yn,e.toDisplayString(i.value||"字段值"),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(i.text||"纯文本"),1)],64))],4))),128))])):e.createCommentVNode("",!0)],64))),128))])])])],2),e.createVNode(re,{visible:m.value,modelValue:N.value,showBorder:y.showBorder,showAlign:y.showAlign,showWidth:y.showWidth,title:y.title,"onUpdate:modelValue":s[3]||(s[3]=n=>Object.assign(N.value,n)),onClose:s[4]||(s[4]=n=>m.value=!1)},null,8,["visible","modelValue","showBorder","showAlign","showWidth","title"])]))}},Kn={class:"qukt-col-left"},vn={class:"qukt-sec-header"},ei={class:"qukt-sec-type"},ti={class:"qukt-sec-actions"},li=["disabled","onClick"],oi=["disabled","onClick"],ni=["onClick"],ii={class:"qukt-sec-row"},ai=["onUpdate:modelValue"],si=["value"],ri={class:"qukt-sec-row"},di=["onUpdate:modelValue"],ci={class:"qukt-sec-row"},mi=["onUpdate:modelValue"],pi={class:"qukt-sec-row"},ui=["onUpdate:modelValue"],fi={class:"qukt-sec-row"},ki=["onUpdate:modelValue"],bi={key:0,class:"qukt-sec-row"},hi=["onUpdate:modelValue"],yi={key:1,class:"qukt-sec-row"},Ei=["onUpdate:modelValue"],gi={key:2,class:"qukt-sec-row"},Vi=["onUpdate:modelValue"],Ni={class:"qukt-sec-row"},_i=["onClick"],qi={key:0,class:"qukt-q-empty"},wi={class:"qukt-col-right"},Bi={class:"qukt-preview-box"},xi={class:"qukt-preview-inner"},$i={key:0,class:"qukt-empty-hint"},Ci={key:1,class:"qukt-summary-preview"},Si={class:"qukt-sp-label"},Di={key:2,class:"qukt-preview-help"},Fi={__name:"DesignSummary",props:{fields:{type:Array,default:()=>[]},breakpoint:{type:Number,default:1100}},emits:["update:fields"],setup(t,{emit:o}){const l=Object.values(H),a=t,k=o,{isNarrow:p}=ke(a.breakpoint),m=e.ref([]);e.watch(()=>a.fields,s=>{const n=W(s||[]);me(n),!Y(n,m.value)&&(m.value=n)},{immediate:!0}),e.watch(m,s=>{const n=W(s);me(n),k("update:fields",n)},{deep:!0});function N(s){return m.value.indexOf(s)}const y=e.ref(!1),_=e.ref({});function d(s){_.value=s,y.value=!0}const f={group_total:1e4},g=e.computed(()=>{const s={...f};for(const n of m.value)j(n.type).hasDefault&&(s[n.field]=Number(n.default??0));for(const n of m.value)if(j(n.type).hasFormula&&n.formula)try{s[n.field]=G(n.formula,s)}catch{s[n.field]=0}return s});function U(s){return j(s).label}function A(s){const n=j(s.type);if(n.hasText)return s.text||"";let b;n.hasFormula?b=Number(g.value[s.field])||0:b=Number(s.default)||0;const i=Number.isInteger(b)?b:b.toFixed(2);return(s.prefix||"")+i+(s.suffix||"")}function L(){m.value.push(ot(H.AUTO_CALC.value))}function D(s){m.value.splice(s,1)}function V(s,n){const b=s+n;b<0||b>=m.value.length||([m.value[s],m.value[b]]=[m.value[b],m.value[s]])}return(s,n)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",{class:"qukt-toolbar"},[n[2]||(n[2]=e.createElementVNode("span",{class:"qukt-tip"},[e.createTextVNode("汇总区域每行显示一项,公式里可引用 "),e.createElementVNode("code",null,"group_total"),e.createTextVNode("、"),e.createElementVNode("code",null,"grand_total"),e.createTextVNode(" 以及其他汇总字段")],-1)),e.createElementVNode("button",{class:"qukt-btn",onClick:L},"+ 添加字段")]),e.createElementVNode("div",{class:e.normalizeClass(["qukt-two-col",{"is-narrow":e.unref(p)}])},[e.createElementVNode("div",Kn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,b=>(e.openBlock(),e.createElementBlock("div",{key:b.field,class:"qukt-sec-block"},[e.createElementVNode("div",vn,[e.createElementVNode("span",ei,e.toDisplayString(U(b.type)),1),e.createElementVNode("div",ti,[e.createElementVNode("button",{class:"qukt-mini-btn",disabled:N(b)===0,onClick:i=>V(N(b),-1)},"↑",8,li),e.createElementVNode("button",{class:"qukt-mini-btn",disabled:N(b)>=m.value.length-1,onClick:i=>V(N(b),1)},"↓",8,oi),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:i=>D(N(b))},"删",8,ni)])]),e.createElementVNode("div",ii,[n[3]||(n[3]=e.createElementVNode("label",null,"类型",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":i=>b.type=i,class:"qukt-cell-input"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l),i=>(e.openBlock(),e.createElementBlock("option",{key:i.value,value:i.value},e.toDisplayString(i.label),9,si))),128))],8,ai),[[e.vModelSelect,b.type]])]),e.createElementVNode("div",ri,[n[4]||(n[4]=e.createElementVNode("label",null,"标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i=>b.label=i,class:"qukt-cell-input",placeholder:"如 合计、税后、业务员抽成"},null,8,di),[[e.vModelText,b.label]])]),e.createElementVNode("div",ci,[n[5]||(n[5]=e.createElementVNode("label",null,"字段名",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i=>b.field=i,class:"qukt-cell-input",placeholder:"如 subtotal、tax (其他行公式可引用)"},null,8,mi),[[e.vModelText,b.field]])]),e.createElementVNode("div",pi,[n[6]||(n[6]=e.createElementVNode("label",null,"前缀",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i=>b.prefix=i,class:"qukt-cell-input",placeholder:"如 ¥、¥"},null,8,ui),[[e.vModelText,b.prefix]])]),e.createElementVNode("div",fi,[n[7]||(n[7]=e.createElementVNode("label",null,"后缀",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i=>b.suffix=i,class:"qukt-cell-input",placeholder:"如 %"},null,8,ki),[[e.vModelText,b.suffix]])]),e.unref(j)(b.type).hasFormula?(e.openBlock(),e.createElementBlock("div",bi,[n[8]||(n[8]=e.createElementVNode("label",null,"公式",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i=>b.formula=i,class:"qukt-cell-input",placeholder:"如 group_total * 0.01 + group_total"},null,8,hi),[[e.vModelText,b.formula]])])):e.unref(j)(b.type).hasDefault?(e.openBlock(),e.createElementBlock("div",yi,[n[9]||(n[9]=e.createElementVNode("label",null,"默认值",-1)),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":i=>b.default=i,class:"qukt-cell-input",placeholder:"默认值"},null,8,Ei),[[e.vModelText,b.default,void 0,{number:!0}]])])):e.unref(j)(b.type).hasText?(e.openBlock(),e.createElementBlock("div",gi,[n[10]||(n[10]=e.createElementVNode("label",null,"显示文本",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i=>b.text=i,class:"qukt-cell-input",placeholder:"显示文本"},null,8,Vi),[[e.vModelText,b.text]])])):e.createCommentVNode("",!0),e.createElementVNode("div",Ni,[n[11]||(n[11]=e.createElementVNode("label",null,"样式",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:i=>d(b.style)},"设置",8,_i)])]))),128)),m.value.length===0?(e.openBlock(),e.createElementBlock("div",qi,"还没有汇总行,点上方按钮添加")):e.createCommentVNode("",!0)]),e.createElementVNode("div",wi,[e.createElementVNode("div",Bi,[n[13]||(n[13]=e.createElementVNode("div",{class:"qukt-preview-label"},"汇总预览",-1)),e.createElementVNode("div",xi,[m.value.length===0?(e.openBlock(),e.createElementBlock("div",$i,"暂无汇总字段")):(e.openBlock(),e.createElementBlock("div",Ci,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,b=>(e.openBlock(),e.createElementBlock("div",{key:b.field,class:"qukt-sp-row"},[e.createElementVNode("span",Si,e.toDisplayString(b.label||"标签"),1),e.createElementVNode("span",{class:"qukt-sp-value",style:e.normalizeStyle(e.unref(Me)(b))},e.toDisplayString(A(b)),5)]))),128))])),m.value.length>0?(e.openBlock(),e.createElementBlock("div",Di,[...n[12]||(n[12]=[e.createElementVNode("b",null,"系统变量:",-1),e.createElementVNode("code",null,"group_total",-1),e.createTextVNode("(明细小计合计)、 ",-1),e.createElementVNode("code",null,"grand_total",-1),e.createTextVNode("(报价总额) ",-1)])])):e.createCommentVNode("",!0)])])])],2),e.createVNode(re,{visible:y.value,modelValue:_.value,showBorder:!1,showAlign:!1,showWidth:!1,title:"汇总值样式","onUpdate:modelValue":n[0]||(n[0]=b=>Object.assign(_.value,b)),onClose:n[1]||(n[1]=b=>y.value=!1)},null,8,["visible","modelValue"])]))}},Ti={class:"qukt-help-dialog"},Ui={class:"qukt-help-header"},Mi={__name:"HelpModal",props:{visible:{type:Boolean,default:!1}},emits:["close"],setup(t){return(o,l)=>t.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qukt-help-modal",onClick:l[1]||(l[1]=e.withModifiers(a=>o.$emit("close"),["self"]))},[e.createElementVNode("div",Ti,[e.createElementVNode("div",Ui,[l[2]||(l[2]=e.createElementVNode("h3",null,"📖 报价单生成器 — 使用教程",-1)),e.createElementVNode("button",{class:"qukt-close-btn",onClick:l[0]||(l[0]=a=>o.$emit("close"))},"✕")]),l[3]||(l[3]=e.createStaticVNode(`<div class="qukt-help-body"><section class="qukt-help-section"><h4>🔁 整体三步流程</h4><p>顶部导航栏有三个步骤,按顺序操作即可生成一份完整报价单:</p><ol class="qukt-steps"><li><b>① 设计模板</b> — 定义表头列、页面头部信息、汇总区域、底部签字栏等</li><li><b>② 填写数据</b> — 根据模板录入每条明细,自动分组、自动算小计</li><li><b>③ 预览导出</b> — 查看最终效果,一键导出 Excel 或打印</li></ol><p class="qukt-tip-box">💡 也可以从第 ② 步开始,系统已内置 3 个示例模板可直接使用</p></section><section class="qukt-help-section"><h4>① 表头列 — 定义表格里有哪些列</h4><p>点击顶部工具栏的 <b>+ 添加字段</b> 按钮可以新增一列,然后在表格中把「类型」改成你想要的:</p><table class="qukt-help-table"><thead><tr><th>按钮</th><th>字段类型</th><th>说明</th></tr></thead><tbody><tr><td>文本列</td><td>INPUT</td><td>普通文字输入,用于名称、描述等</td></tr><tr><td>数字列</td><td>NUMBER</td><td>只能填数字,用于数量、单价等</td></tr><tr><td>下拉列</td><td>SELECT_DICT</td><td>固定选项,点击列中的"下拉选项"输入选项,用逗号分隔,如 <code>设备,材料,安装</code></td></tr><tr><td>多行文本列</td><td>TEXTAREA</td><td>可输入较长文字,用于备注、说明等</td></tr></tbody></table><p><b>特殊类型列:</b></p><ul><li><b>自动序号</b> — 自动从 1 开始递增,字段名随便改(建议叫 <code>seq</code>)</li><li><b>自动计算(公式)</b> — 用任意公式算值,公式里可引用<b>同一行其他列的字段名</b>,如 <code>quantity * unit_price</code>。字段名必须和你在表头里设置的一致,比如数量列叫 <code>qty</code> 就要写 <code>qty * unit_price</code></li></ul><p><b>列顺序:</b>点行末的 ↑ ↓ 按钮上下移动,或拖动行来调整</p><p><b>列宽度:</b>单位是像素(px),在"宽度"列填数字</p><p class="qukt-tip-box">💡 下拉列的选项是写在逗号分隔的输入框里,保存后切换到「填写数据」页面时会变成下拉选择框</p></section><section class="qukt-help-section"><h4>② 页面头部 — 报价单的标题和项目信息</h4><p>头部由多个"段落"顺序组成,每个段落可以是以下 4 种类型:</p><table class="qukt-help-table"><thead><tr><th>类型</th><th>说明</th><th>配置项</th></tr></thead><tbody><tr><td><b>大标题</b></td><td>最顶部的报价单标题</td><td>文字、字号、粗体、对齐方式</td></tr><tr><td><b>字段行</b></td><td>一行可以放多个单元格,每个单元格要么是可编辑字段,要么是固定文字</td><td>每个单元格单独配置</td></tr><tr><td><b>分隔线</b></td><td>画一条灰色横线</td><td>无配置</td></tr><tr><td><b>纯文本</b></td><td>一段固定文字,如"此报价单有效期30天"</td><td>文字内容、对齐方式</td></tr></tbody></table><p><b>字段行详解:</b></p><ul><li>点"➕ 添加一个单元格"来增加这一行里的格子数量</li><li>每个格子选"类型":<b>字段(可编辑)</b> 或 <b>纯文本</b></li><li>字段类型要填 <b>标签</b>(如"项目名称")和 <b>绑定字段</b>(如 <code>projectName</code>)</li><li>绑定字段是关键!同一个绑定字段名在整个模板中要保持一致,后续数据填写和导出都靠它</li><li>宽度用百分比,如 <code>50%</code>、<code>33%</code>,一行所有格子宽度加起来建议 = 100%</li></ul><p class="qukt-tip-box">💡 右侧"实时预览"区域会随着你的编辑即时变化,所见即所得</p></section><section class="qukt-help-section"><h4>③ 汇总区域 — 表格底部的费用合计</h4><p>汇总项显示在明细表格的下方(导出 Excel 时会自动排在表格右侧底部)。</p><table class="qukt-help-table"><thead><tr><th>类型</th><th>说明</th></tr></thead><tbody><tr><td><b>手动输入(自定义金额)</b></td><td>任意需要手工填写的金额项:人工费、服务费、运费、税费、折扣、其他费用等。可以在"默认值"里预设一个初始值</td></tr><tr><td><b>自动计算(公式)</b></td><td>系统自动算好的值,需要写公式。<code>grand_total</code> 会自动把所有手动输入项加进去</td></tr></tbody></table><p><b>自动计算公式里的可用变量(固定):</b></p><table class="qukt-help-table"><thead><tr><th>变量名</th><th>含义</th><th>说明</th></tr></thead><tbody><tr><td><code>group_total</code></td><td>明细小计合计</td><td>所有行的自动计算列(小计列)求和</td></tr><tr><td><code>grand_total</code></td><td>报价总额</td><td>group_total + 所有手动输入项之和</td></tr></tbody></table><p><b>动态可用变量(随你的模板定义):</b></p><p>你在汇总区域里定义的<b>每一个手动输入项的字段名</b>,都会自动成为可用变量,它们之间也能互相引用。</p><p>举个例子:如果你定义了 <code>labor_cost</code>、<code>service_fee</code>、<code>discount</code> 三个手动项,那么自动计算公式里可以写:</p><pre class="code">group_total + labor_cost + service_fee - discount</pre><p><b>字段名命名建议:</b></p><ul><li><code>grand_total</code> — 报价总额(特殊字段,系统会把所有手动项加进去)</li><li><code>group_total</code> — 明细小计(建议不要手动改成别的,公式里会用到)</li><li>其他手动项随意,如 <code>service_fee</code>、<code>freight</code>、<code>tax_amount</code>、<code>discount</code> 等</li></ul></section><section class="qukt-help-section"><h4>④ 页面底部 — 签字栏、盖章区</h4><p>结构和"页面头部"完全一样,支持:分隔线、字段行、纯文本。</p><p>常见用法:</p><ul><li>分隔线 → 分隔表格和签字区</li><li>字段行 → 左边"客户签字:________",右边"业务员签字:________"</li><li>纯文本 → 居中写"公司盖章:"</li></ul></section><section class="qukt-help-section"><h4>💾 保存与模板管理</h4><ul><li><b>💾 保存修改</b> — 直接更新当前选中的模板</li><li><b>➕ 另存为新模板</b> — 输入一个新名字,基于当前模板复制出一个全新的模板</li><li>顶部的下拉框可以在已有的模板之间切换,切换后下方所有配置会自动加载</li></ul><p class="qukt-tip-box">⚠️ 目前模板数据保存在浏览器内存中(刷新后会恢复默认),如果要持久化存储,需要把模板同步到后端接口</p></section><section class="qukt-help-section"><h4>🔢 分组与计算规则(高级)</h4><p>在「表头列」tab 的列表下方,有一个<b>分组规则</b>配置框:</p><ul><li><b>按哪一列分组</b> — 选择一列后,相同值的行会自动合并单元格,每组末尾自动生成小计行。选「不分组」则不分组、不显示小计,但列上勾选了「相同值合并」的列仍然会对相邻相同值做合并</li></ul><p>对应模板数据结构:</p><pre class="code">{
|
|
12
|
+
</style></head><body>${_}</body></html>`),u.document.close(),u.onload=()=>{u.print()}}return o({print:$,exportExcel:n}),(s,E)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",nt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value.header_sections,(r,u)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"h"+u},[r.type==="title"?(e.openBlock(),e.createElementBlock("h1",{key:0,class:"qukt-q-title",style:e.normalizeStyle(e.unref(K)(r))},e.toDisplayString(N(r,"header")),5)):r.type==="divider"?(e.openBlock(),e.createElementBlock("div",it)):r.type==="text"?(e.openBlock(),e.createElementBlock("div",{key:2,class:"qukt-q-text",style:e.normalizeStyle(e.unref(K)(r))},e.toDisplayString(N(r,"header")),5)):r.type==="row"?(e.openBlock(),e.createElementBlock("div",at,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.cells,(y,_)=>(e.openBlock(),e.createElementBlock("div",{key:_,class:"qukt-q-cell",style:e.normalizeStyle(e.unref(ie)(y))},e.toDisplayString(g(y,"header")),5))),128))])):e.createCommentVNode("",!0)],64))),128)),a.value.columns.length>0?(e.openBlock(),e.createElementBlock("div",st,[e.createElementVNode("table",rt,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value.columns,r=>(e.openBlock(),e.createElementBlock("th",{key:r.field,style:e.normalizeStyle({width:(r.width||100)+"px"})},e.toDisplayString(r.title),5))),128))])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(r,u)=>{var y,_;return e.openBlock(),e.createElementBlock(e.Fragment,{key:u},[r.__is_subtotal?(e.openBlock(),e.createElementBlock("tr",dt,[e.createElementVNode("td",{colspan:a.value.columns.length-1,class:"subtotal-label"},"小计("+e.toDisplayString(r.__group_key)+")",9,ct),e.createElementVNode("td",mt,e.toDisplayString(((y=a.value.group_rules)==null?void 0:y.subtotal_prefix)||"")+e.toDisplayString(d(r.__group_sum))+e.toDisplayString(((_=a.value.group_rules)==null?void 0:_.subtotal_suffix)||""),1)])):(e.openBlock(),e.createElementBlock("tr",pt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value.columns,(w,B)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:w.field},[h(i.value.indexOf(r),w.field)>0?(e.openBlock(),e.createElementBlock("td",{key:0,rowspan:h(i.value.indexOf(r),w.field),class:e.normalizeClass({"merged-cell":h(i.value.indexOf(r),w.field)>1}),style:e.normalizeStyle(q(w))},[w.editor===e.unref(W).AUTO_SEQ.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(w.prefix||"")+e.toDisplayString(u+1)+e.toDisplayString(w.suffix||""),1)],64)):e.unref(I)(w.editor).hasFormula?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(w.prefix||"")+e.toDisplayString(d(V(r)))+e.toDisplayString(w.suffix||""),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(w.prefix||"")+e.toDisplayString(r[w.field]??"")+e.toDisplayString(w.suffix||""),1)],64))],14,ut)):e.createCommentVNode("",!0)],64))),128))]))],64)}),128)),i.value.length===0?(e.openBlock(),e.createElementBlock("tr",ft,[e.createElementVNode("td",{colspan:a.value.columns.length,class:"qukt-q-empty"},"(暂无数据)",8,kt)])):e.createCommentVNode("",!0)])])])):e.createCommentVNode("",!0),a.value.summary_fields.length>0?(e.openBlock(),e.createElementBlock("div",bt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value.summary_fields,r=>(e.openBlock(),e.createElementBlock("div",{key:r.field,class:"qukt-q-summary-row"},[e.createElementVNode("span",ht,e.toDisplayString(r.label),1),e.createElementVNode("span",{class:"qukt-q-summary-value",style:e.normalizeStyle(e.unref(Me)(r))},e.toDisplayString(c(r)),5)]))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",yt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value.footer_sections,(r,u)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:"f"+u},[r.type==="divider"?(e.openBlock(),e.createElementBlock("div",Et)):r.type==="text"?(e.openBlock(),e.createElementBlock("div",{key:1,class:"qukt-q-text",style:e.normalizeStyle(e.unref(K)(r))},e.toDisplayString(N(r,"footer")),5)):r.type==="row"?(e.openBlock(),e.createElementBlock("div",gt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.cells,(y,_)=>(e.openBlock(),e.createElementBlock("div",{key:_,class:"qukt-q-cell",style:e.normalizeStyle(e.unref(ie)(y))},e.toDisplayString(g(y,"footer")),5))),128))])):e.createCommentVNode("",!0)],64))),128))])])]))}},Vt=(t,o)=>{const l=t.__vccOpts||t;for(const[a,k]of o)l[a]=k;return l},Nt={class:"qukt-preview-box"},_t={class:"qukt-preview-header"},qt={class:"qukt-preview-title"},wt={class:"qukt-preview-body"},Bt={class:"qukt-preview-footer"},xt={class:"qukt-preview-json-box"},$t={class:"qukt-preview-header"},Ct={class:"qukt-preview-title"},St={class:"qukt-preview-json-body"},Dt={class:"qukt-preview-footer"},Ie=Vt({__name:"QuokitPreview",props:{tpl:{type:Object,required:!0},data:{type:Object,default:()=>({headerData:{},rows:[],footerData:{}})},config:{type:Object,default:()=>({})}},emits:["close"],setup(t,{emit:o}){const l=o,a=e.ref(null),k=e.reactive({open:!1,title:"",text:""});function p(){l("close")}async function m(d){var f;await e.nextTick(),(f=a.value)==null||f.exportExcel(d)}async function N(d){var f;await e.nextTick(),(f=a.value)==null||f.print(d)}function g(d,f){k.title=d,k.text=JSON.stringify(f,null,2),k.open=!0}function q(){navigator.clipboard.writeText(k.text).catch(()=>{})}return(d,f)=>(e.openBlock(),e.createElementBlock("div",{class:"qukt-preview-mask",onClick:e.withModifiers(p,["self"])},[e.createElementVNode("div",Nt,[e.createElementVNode("div",_t,[e.createElementVNode("span",qt,e.toDisplayString(t.config.title||"👁️ 总体预览"),1),e.createElementVNode("span",{class:"qukt-preview-close",onClick:p},"✕")]),e.createElementVNode("div",wt,[e.createVNode(ue,{ref_key:"sheetRef",ref:a,tpl:t.tpl,data:t.data},null,8,["tpl","data"])]),e.createElementVNode("div",Bt,[t.config.excel!==!1?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("button",{class:"tool-btn",onClick:f[0]||(f[0]=V=>m(!1))},"📤 导出 Excel"),e.createElementVNode("button",{class:"tool-btn",onClick:f[1]||(f[1]=V=>m(!0))},"📤 导出(撑长)")],64)):e.createCommentVNode("",!0),t.config.print!==!1?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("button",{class:"tool-btn",onClick:f[2]||(f[2]=V=>N(!1))},"🖨️ 打印(横)"),e.createElementVNode("button",{class:"tool-btn",onClick:f[3]||(f[3]=V=>N(!0))},"🖨️ 打印(竖)")],64)):e.createCommentVNode("",!0),t.config.json!==!1?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("button",{class:"tool-btn",onClick:f[4]||(f[4]=V=>g("📄 模板 JSON",t.tpl))},"📄 模板 JSON"),e.createElementVNode("button",{class:"tool-btn",onClick:f[5]||(f[5]=V=>g("📦 数据 JSON",t.data))},"📦 数据 JSON")],64)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"tool-btn",onClick:p},"关闭")])]),k.open?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qukt-preview-json-mask",onClick:f[8]||(f[8]=e.withModifiers(V=>k.open=!1,["self"]))},[e.createElementVNode("div",xt,[e.createElementVNode("div",$t,[e.createElementVNode("span",Ct,e.toDisplayString(k.title),1),e.createElementVNode("span",{class:"qukt-preview-close",onClick:f[6]||(f[6]=V=>k.open=!1)},"✕")]),e.createElementVNode("pre",St,e.toDisplayString(k.text),1),e.createElementVNode("div",Dt,[e.createElementVNode("button",{class:"tool-btn",onClick:q},"📋 复制"),e.createElementVNode("button",{class:"tool-btn",onClick:f[7]||(f[7]=V=>k.open=!1)},"关闭")])])])):e.createCommentVNode("",!0)]))}},[["__scopeId","data-v-8a922e81"]]);function Pe(t=[],o={}){const l=e.ref(t||[]),a=e.ref(o||{}),k=e.computed(()=>({columns:l.value,group_rules:a.value}));function p(N){l.value=N||[]}function m(N){a.value=N||{}}return e.reactive({columns:l,groupRules:a,tpl:k,setColumns:p,setGroupRules:m})}function fe(t=[]){const o=e.ref(t||[]);function l(k){o.value=k||[]}function a(){return o.value||[]}return e.reactive({sections:o,setSections:l,toTpl:a})}function We(t=[]){const o=e.ref(t||[]);function l(k){o.value=k||[]}function a(){return o.value||[]}return e.reactive({fields:o,setFields:l,toTpl:a})}const Ft={class:"qukt-gr-dialog"},Tt={class:"qukt-gr-header"},Ut={class:"qukt-gr-content"},Mt={class:"qukt-gr-form"},At={class:"qukt-gr-form-row"},Lt={class:"qukt-gr-form-row"},zt={class:"qukt-gr-form-row"},Ot={key:0,class:"qukt-gr-form-row"},Rt={key:1,class:"qukt-gr-form-row"},It={class:"qukt-gr-form-row"},Pt={class:"qukt-border-group",style:{flex:"1"}},Wt={class:"qukt-border-item"},jt={class:"qukt-border-item"},Jt={class:"qukt-border-item"},Qt={class:"qukt-border-item"},Xt={class:"qukt-gr-form-row"},Gt={class:"qukt-gr-footer"},re={__name:"StyleDialog",props:{visible:{type:Boolean,default:!1},modelValue:{type:Object,default:()=>({})},showBorder:{type:Boolean,default:!0},showAlign:{type:Boolean,default:!0},showWidth:{type:Boolean,default:!1},title:{type:String,default:"样式配置"}},emits:["close","update:modelValue"],setup(t,{emit:o}){const l=t,a=o,k=()=>({top:{style:"",width:1,color:"#dcdfe6"},bottom:{style:"",width:1,color:"#dcdfe6"},left:{style:"",width:1,color:"#dcdfe6"},right:{style:"",width:1,color:"#dcdfe6"}}),p=()=>({width:"auto",color:"#303133",fontSize:13,bold:!1,italic:!1,align:"left",border:k()}),m=e.reactive(p());function N(q){const d=p(),f=P(q||{});if(f.color!==void 0&&(d.color=f.color),f.fontSize!==void 0&&(d.fontSize=f.fontSize),f.bold!==void 0&&(d.bold=f.bold),f.italic!==void 0&&(d.italic=f.italic),f.align!==void 0&&(d.align=f.align),f.width!==void 0&&(d.width=f.width),f.border!==void 0){d.border=P(k());for(const V of["top","bottom","left","right"])f.border[V]&&(d.border[V]={...d.border[V],...f.border[V]})}Object.assign(m,d)}e.watch(()=>l.visible,q=>{q&&N(l.modelValue)},{immediate:!0}),e.watch(m,()=>{a("update:modelValue",P({...m}))},{deep:!0});function g(q){const d=q==="none"?{style:"",width:0,color:"#dcdfe6"}:{style:"solid",width:1,color:"#dcdfe6"};m.border={top:{...d},bottom:{...d},left:{...d},right:{...d}}}return(q,d)=>t.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qukt-gr-mask",onClick:d[22]||(d[22]=e.withModifiers(f=>q.$emit("close"),["self"]))},[e.createElementVNode("div",Ft,[e.createElementVNode("div",Tt,[e.createElementVNode("span",null,e.toDisplayString(t.title),1),e.createElementVNode("button",{class:"qukt-gr-close",onClick:d[0]||(d[0]=f=>q.$emit("close"))},"✕")]),e.createElementVNode("div",Ut,[e.createElementVNode("div",Mt,[e.createElementVNode("div",At,[d[23]||(d[23]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"颜色",-1)),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":d[1]||(d[1]=f=>m.color=f),class:"qukt-color-input"},null,512),[[e.vModelText,m.color]])]),e.createElementVNode("div",Lt,[d[24]||(d[24]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"字号",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d[2]||(d[2]=f=>m.fontSize=f),type:"number",class:"qukt-cell-input tiny",min:"10",max:"48",style:{flex:"1"}},null,512),[[e.vModelText,m.fontSize,void 0,{number:!0}]])]),e.createElementVNode("div",zt,[d[25]||(d[25]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"加粗",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":d[3]||(d[3]=f=>m.bold=f)},null,512),[[e.vModelCheckbox,m.bold]]),d[26]||(d[26]=e.createElementVNode("label",{class:"qukt-gr-form-label",style:{"margin-left":"20px"}},"斜体",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":d[4]||(d[4]=f=>m.italic=f)},null,512),[[e.vModelCheckbox,m.italic]])]),t.showWidth?(e.openBlock(),e.createElementBlock("div",Ot,[d[27]||(d[27]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"宽度",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d[5]||(d[5]=f=>m.width=f),class:"qukt-cell-input",placeholder:"如 33%、auto",style:{flex:"1"}},null,512),[[e.vModelText,m.width]])])):e.createCommentVNode("",!0),t.showAlign?(e.openBlock(),e.createElementBlock("div",Rt,[d[29]||(d[29]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"对齐",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":d[6]||(d[6]=f=>m.align=f),class:"qukt-cell-input",style:{flex:"1"}},[...d[28]||(d[28]=[e.createElementVNode("option",{value:"left"},"左",-1),e.createElementVNode("option",{value:"center"},"中",-1),e.createElementVNode("option",{value:"right"},"右",-1)])],512),[[e.vModelSelect,m.align]])])):e.createCommentVNode("",!0),t.showBorder?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("div",It,[d[38]||(d[38]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"边框",-1)),e.createElementVNode("div",Pt,[e.createElementVNode("div",Wt,[d[31]||(d[31]=e.createElementVNode("span",null,"上",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":d[7]||(d[7]=f=>m.border.top.style=f),class:"qukt-cell-input tiny"},[...d[30]||(d[30]=[e.createElementVNode("option",{value:""},"无",-1),e.createElementVNode("option",{value:"solid"},"实线",-1),e.createElementVNode("option",{value:"dashed"},"虚线",-1),e.createElementVNode("option",{value:"dotted"},"点线",-1)])],512),[[e.vModelSelect,m.border.top.style]]),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":d[8]||(d[8]=f=>m.border.top.width=f),class:"qukt-cell-input tiny",min:"0",max:"20",step:"1"},null,512),[[e.vModelText,m.border.top.width,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":d[9]||(d[9]=f=>m.border.top.color=f),class:"qukt-color-input"},null,512),[[e.vModelText,m.border.top.color]])]),e.createElementVNode("div",jt,[d[33]||(d[33]=e.createElementVNode("span",null,"下",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":d[10]||(d[10]=f=>m.border.bottom.style=f),class:"qukt-cell-input tiny"},[...d[32]||(d[32]=[e.createElementVNode("option",{value:""},"无",-1),e.createElementVNode("option",{value:"solid"},"实线",-1),e.createElementVNode("option",{value:"dashed"},"虚线",-1),e.createElementVNode("option",{value:"dotted"},"点线",-1)])],512),[[e.vModelSelect,m.border.bottom.style]]),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":d[11]||(d[11]=f=>m.border.bottom.width=f),class:"qukt-cell-input tiny",min:"0",max:"20",step:"1"},null,512),[[e.vModelText,m.border.bottom.width,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":d[12]||(d[12]=f=>m.border.bottom.color=f),class:"qukt-color-input"},null,512),[[e.vModelText,m.border.bottom.color]])]),e.createElementVNode("div",Jt,[d[35]||(d[35]=e.createElementVNode("span",null,"左",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":d[13]||(d[13]=f=>m.border.left.style=f),class:"qukt-cell-input tiny"},[...d[34]||(d[34]=[e.createElementVNode("option",{value:""},"无",-1),e.createElementVNode("option",{value:"solid"},"实线",-1),e.createElementVNode("option",{value:"dashed"},"虚线",-1),e.createElementVNode("option",{value:"dotted"},"点线",-1)])],512),[[e.vModelSelect,m.border.left.style]]),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":d[14]||(d[14]=f=>m.border.left.width=f),class:"qukt-cell-input tiny",min:"0",max:"20",step:"1"},null,512),[[e.vModelText,m.border.left.width,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":d[15]||(d[15]=f=>m.border.left.color=f),class:"qukt-color-input"},null,512),[[e.vModelText,m.border.left.color]])]),e.createElementVNode("div",Qt,[d[37]||(d[37]=e.createElementVNode("span",null,"右",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":d[16]||(d[16]=f=>m.border.right.style=f),class:"qukt-cell-input tiny"},[...d[36]||(d[36]=[e.createElementVNode("option",{value:""},"无",-1),e.createElementVNode("option",{value:"solid"},"实线",-1),e.createElementVNode("option",{value:"dashed"},"虚线",-1),e.createElementVNode("option",{value:"dotted"},"点线",-1)])],512),[[e.vModelSelect,m.border.right.style]]),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":d[17]||(d[17]=f=>m.border.right.width=f),class:"qukt-cell-input tiny",min:"0",max:"20",step:"1"},null,512),[[e.vModelText,m.border.right.width,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":d[18]||(d[18]=f=>m.border.right.color=f),class:"qukt-color-input"},null,512),[[e.vModelText,m.border.right.color]])])])]),e.createElementVNode("div",Xt,[d[39]||(d[39]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"预设",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:d[19]||(d[19]=f=>g("all"))},"四边"),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:d[20]||(d[20]=f=>g("none"))},"无边框")])],64)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Gt,[e.createElementVNode("button",{class:"qukt-btn",onClick:d[21]||(d[21]=f=>q.$emit("close"))},"关闭")])])])):e.createCommentVNode("",!0)}};function ee(t){if(t===null||typeof t!="object"||Array.isArray(t))return!1;const o=Object.getPrototypeOf(t);return o===Object.prototype||o===null}function je(t){return!Array.isArray(t)||t.length===0?!1:t.every(o=>ee(o)&&"key"in o)}function Ht(t,o){const l=new Map;for(const a of t)l.set(a.key,a);for(const a of o)if(l.has(a.key)){const k=l.get(a.key);l.set(a.key,de({...k},a))}else l.set(a.key,a);return t.map(a=>l.get(a.key)).concat(o.filter(a=>!l.has(a.key)&&t.some(k=>k.key===a.key)===!1))}function de(t,o){if(!ee(o))return t;for(const l of Object.keys(o)){const a=o[l],k=t[l];ee(a)&&ee(k)?t[l]=de({...k},a):je(a)&&je(k)?t[l]=Ht(k,a):t[l]=a}return t}const Je={templateCols:{layout:"auto",minWidth:960,columns:[{key:"idx",label:"#",width:50},{key:"field",label:"字段名",width:150},{key:"title",label:"列标题",width:200},{key:"editor",label:"类型",width:140},{key:"width",label:"宽度",width:100},{key:"editorCfg",label:"专属配置",width:200},{key:"merge",label:"分组时合并",width:120},{key:"style",label:"设置",width:80},{key:"ops",label:"操作",width:140}]}},X=e.reactive(JSON.parse(JSON.stringify(Je)));function Yt(t){if(!ee(t)){console.warn("[vue-quokit] setConfig expected a plain object, got",typeof t);return}de(X,t)}function Kt(){return JSON.parse(JSON.stringify(X))}function Zt(){Object.keys(X).forEach(t=>delete X[t]),de(X,JSON.parse(JSON.stringify(Je)))}const vt={class:"qukt-toolbar"},el={class:"qukt-btn-group-inline"},tl={key:0,class:"qukt-design-table qukt-design-table--fixed"},ll=["width"],ol={class:"idx"},nl=["onUpdate:modelValue"],il={class:"qukt-title-group"},al=["onUpdate:modelValue"],sl=["onUpdate:modelValue"],rl=["onUpdate:modelValue"],dl=["onUpdate:modelValue"],cl=["value"],ml=["onUpdate:modelValue"],pl=["onUpdate:modelValue"],ul=["onUpdate:modelValue"],fl={key:2,class:"qukt-muted"},kl={key:3,class:"qukt-muted"},bl={class:"qukt-col-merge"},hl={key:0},yl=["onUpdate:modelValue"],El={key:1,class:"qukt-muted"},gl=["onClick"],Vl=["disabled","onClick"],Nl=["disabled","onClick"],_l=["onClick"],ql={key:1,class:"qukt-design-table"},wl=["width"],Bl={class:"idx"},xl=["onUpdate:modelValue"],$l={class:"qukt-title-group"},Cl=["onUpdate:modelValue"],Sl=["onUpdate:modelValue"],Dl=["onUpdate:modelValue"],Fl=["onUpdate:modelValue"],Tl=["value"],Ul=["onUpdate:modelValue"],Ml=["onUpdate:modelValue"],Al=["onUpdate:modelValue"],Ll={key:2,class:"qukt-muted"},zl={key:3,class:"qukt-muted"},Ol={class:"qukt-col-merge"},Rl={key:0},Il=["onUpdate:modelValue"],Pl={key:1,class:"qukt-muted"},Wl=["onClick"],jl=["disabled","onClick"],Jl=["disabled","onClick"],Ql=["onClick"],Xl={__name:"DesignCols",props:{columns:{type:Array,default:()=>[]},groupRules:{type:Object,default:()=>({})}},emits:["update:columns","update:groupRules","help","open-group"],setup(t,{emit:o}){const l=Object.values(W),a=e.computed(()=>X.templateCols.columns),k=e.computed(()=>X.templateCols.layout==="fixed"),p=e.computed(()=>({"--qukt-cols-min-width":X.templateCols.minWidth+"px"})),m=t,N=o,g=e.ref([]),q=e.ref({});e.watch(()=>m.columns,i=>{const h=Se(P(i||[]));Y(h,g.value)||(g.value=h)},{immediate:!0,deep:!0}),e.watch(()=>m.groupRules,i=>{const h=ne(P(i||{}));Y(h,q.value)||(q.value=h)},{immediate:!0,deep:!0}),e.watch(g,i=>{N("update:columns",De(i))},{deep:!0}),e.watch(q,i=>{N("update:groupRules",P(i))},{deep:!0});const d=e.computed(()=>!!q.value.merge_field);function f(){let i=0;for(const h of g.value){const n=/^custom_(\d+)$/.exec(h.field);n&&(i=Math.max(i,parseInt(n[1],10)))}return i+1}function V(i){const h=new Set([...g.value.map(E=>E.field)]),n=I(i);let $;n.defaultFieldBase==="custom"?$="custom_"+String(f()).padStart(4,"0"):$=n.defaultFieldBase;const s=Ze(i,et($,h));g.value.push(s)}function U(i){g.value.splice(i,1)}function A(i,h){const n=i+h;n<0||n>=g.value.length||([g.value[i],g.value[n]]=[g.value[n],g.value[i]])}const L=e.ref(!1),x=e.ref({}),b=e.ref("");function c(i){i.cellStyle||(i.cellStyle={}),x.value=i.cellStyle,b.value=i.title||"单元格样式",L.value=!0}return(i,h)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",vt,[h[5]||(h[5]=e.createElementVNode("span",{class:"qukt-tip"},[e.createTextVNode("拖动或点 ↑↓ 调整顺序;支持自动序号和公式计算列,公式里可直接引用其他字段名,如 "),e.createElementVNode("code",null,"quantity * unit_price * 0.9")],-1)),e.createElementVNode("div",el,[e.createElementVNode("button",{class:"qukt-btn",onClick:h[0]||(h[0]=n=>i.$emit("open-group"))},"分组 & 小计"+e.toDisplayString(d.value?" ✓":""),1),e.createElementVNode("button",{class:"qukt-btn",onClick:h[1]||(h[1]=n=>V("INPUT"))},"+ 添加字段"),e.createElementVNode("button",{class:"qukt-btn",onClick:h[2]||(h[2]=n=>i.$emit("help"))},"帮助")])]),e.createElementVNode("div",{class:"qukt-table-wrap",style:e.normalizeStyle(p.value)},[k.value?(e.openBlock(),e.createElementBlock("table",tl,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,n=>(e.openBlock(),e.createElementBlock("th",{key:n.key,width:n.width},e.toDisplayString(n.label),9,ll))),128))])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,(n,$)=>(e.openBlock(),e.createElementBlock("tr",{key:$},[e.createElementVNode("td",ol,e.toDisplayString($+1),1),e.createElementVNode("td",null,[e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input","onUpdate:modelValue":s=>n.field=s},null,8,nl),[[e.vModelText,n.field]])]),e.createElementVNode("td",null,[e.createElementVNode("div",il,[e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input pref-suf","onUpdate:modelValue":s=>n.prefix=s,placeholder:"前"},null,8,al),[[e.vModelText,n.prefix]]),e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input","onUpdate:modelValue":s=>n.title=s,placeholder:"列标题"},null,8,sl),[[e.vModelText,n.title]]),e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input pref-suf","onUpdate:modelValue":s=>n.suffix=s,placeholder:"后"},null,8,rl),[[e.vModelText,n.suffix]])])]),e.createElementVNode("td",null,[e.withDirectives(e.createElementVNode("select",{class:"qukt-cell-input","onUpdate:modelValue":s=>n.editor=s},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l),s=>(e.openBlock(),e.createElementBlock("option",{key:s.value,value:s.value},e.toDisplayString(s.label),9,cl))),128))],8,dl),[[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":s=>n.width=s},null,8,ml),[[e.vModelText,n.width,void 0,{number:!0}]])]),e.createElementVNode("td",null,[e.unref(I)(n.editor).hasDict?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,class:"qukt-cell-input","onUpdate:modelValue":s=>n.dictStr=s,placeholder:"下拉选项,逗号分隔 如:设备,材料,安装"},null,8,pl)),[[e.vModelText,n.dictStr]]):e.unref(I)(n.editor).hasFormula?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:1,class:"qukt-cell-input","onUpdate:modelValue":s=>n.formula=s,placeholder:"公式,如 quantity * unit_price + tax"},null,8,ul)),[[e.vModelText,n.formula]]):n.editor===e.unref(W).AUTO_SEQ.value?(e.openBlock(),e.createElementBlock("span",fl,"自动生成序号,无需配置")):(e.openBlock(),e.createElementBlock("span",kl,"-"))]),e.createElementVNode("td",bl,[e.unref(I)(n.editor).canMerge?(e.openBlock(),e.createElementBlock("label",hl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":s=>n.merge_on_group=s},null,8,yl),[[e.vModelCheckbox,n.merge_on_group]]),h[6]||(h[6]=e.createElementVNode("span",null,"相同值合并",-1))])):(e.openBlock(),e.createElementBlock("span",El,"—"))]),e.createElementVNode("td",null,[e.createElementVNode("button",{class:"qukt-mini-btn",onClick:s=>c(n)},"样式",8,gl)]),e.createElementVNode("td",null,[e.createElementVNode("button",{class:"qukt-mini-btn",disabled:$===0,onClick:s=>A($,-1)},"↑",8,Vl),e.createElementVNode("button",{class:"qukt-mini-btn",disabled:$>=g.value.length-1,onClick:s=>A($,1)},"↓",8,Nl),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:s=>U($)},"删",8,_l)])]))),128))])])):(e.openBlock(),e.createElementBlock("table",ql,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,n=>(e.openBlock(),e.createElementBlock("th",{key:n.key,width:n.width??200},e.toDisplayString(n.label),9,wl))),128))])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,(n,$)=>(e.openBlock(),e.createElementBlock("tr",{key:$},[e.createElementVNode("td",Bl,e.toDisplayString($+1),1),e.createElementVNode("td",null,[e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input","onUpdate:modelValue":s=>n.field=s},null,8,xl),[[e.vModelText,n.field]])]),e.createElementVNode("td",null,[e.createElementVNode("div",$l,[e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input pref-suf","onUpdate:modelValue":s=>n.prefix=s,placeholder:"前"},null,8,Cl),[[e.vModelText,n.prefix]]),e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input","onUpdate:modelValue":s=>n.title=s,placeholder:"列标题"},null,8,Sl),[[e.vModelText,n.title]]),e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input pref-suf","onUpdate:modelValue":s=>n.suffix=s,placeholder:"后"},null,8,Dl),[[e.vModelText,n.suffix]])])]),e.createElementVNode("td",null,[e.withDirectives(e.createElementVNode("select",{class:"qukt-cell-input","onUpdate:modelValue":s=>n.editor=s},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l),s=>(e.openBlock(),e.createElementBlock("option",{key:s.value,value:s.value},e.toDisplayString(s.label),9,Tl))),128))],8,Fl),[[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":s=>n.width=s},null,8,Ul),[[e.vModelText,n.width,void 0,{number:!0}]])]),e.createElementVNode("td",null,[e.unref(I)(n.editor).hasDict?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,class:"qukt-cell-input","onUpdate:modelValue":s=>n.dictStr=s,placeholder:"下拉选项,逗号分隔 如:设备,材料,安装"},null,8,Ml)),[[e.vModelText,n.dictStr]]):e.unref(I)(n.editor).hasFormula?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:1,class:"qukt-cell-input","onUpdate:modelValue":s=>n.formula=s,placeholder:"公式,如 quantity * unit_price + tax"},null,8,Al)),[[e.vModelText,n.formula]]):n.editor===e.unref(W).AUTO_SEQ.value?(e.openBlock(),e.createElementBlock("span",Ll,"自动生成序号,无需配置")):(e.openBlock(),e.createElementBlock("span",zl,"-"))]),e.createElementVNode("td",Ol,[e.unref(I)(n.editor).canMerge?(e.openBlock(),e.createElementBlock("label",Rl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":s=>n.merge_on_group=s},null,8,Il),[[e.vModelCheckbox,n.merge_on_group]]),h[7]||(h[7]=e.createElementVNode("span",null,"相同值合并",-1))])):(e.openBlock(),e.createElementBlock("span",Pl,"—"))]),e.createElementVNode("td",null,[e.createElementVNode("button",{class:"qukt-mini-btn",onClick:s=>c(n)},"样式",8,Wl)]),e.createElementVNode("td",null,[e.createElementVNode("button",{class:"qukt-mini-btn",disabled:$===0,onClick:s=>A($,-1)},"↑",8,jl),e.createElementVNode("button",{class:"qukt-mini-btn",disabled:$>=g.value.length-1,onClick:s=>A($,1)},"↓",8,Jl),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:s=>U($)},"删",8,Ql)])]))),128))])]))],4),e.createVNode(re,{visible:L.value,modelValue:x.value,showBorder:"",showAlign:!0,showWidth:!1,title:b.value,"onUpdate:modelValue":h[3]||(h[3]=n=>Object.assign(x.value,n)),onClose:h[4]||(h[4]=n=>L.value=!1)},null,8,["visible","modelValue","title"])]))}},Gl={class:"qukt-gr-dialog"},Hl={class:"qukt-gr-header"},Yl={class:"qukt-gr-content"},Kl={class:"qukt-gr-form"},Zl={class:"qukt-gr-form-row"},vl=["value","disabled"],eo={class:"qukt-gr-form-row"},to={class:"qukt-gr-form-row"},lo={class:"qukt-gr-form-row"},oo={class:"qukt-gr-footer"},no={__name:"GroupDialog",props:{visible:{type:Boolean,default:!1},columns:{type:Array,default:()=>[]},groupRules:{type:Object,default:()=>({})}},emits:["close","update:groupRules"],setup(t,{emit:o}){const l=t,a=o,k=e.reactive({merge_field:"",show_detail_subtotal:!0,subtotal_prefix:"",subtotal_suffix:""});return e.watch(()=>l.groupRules,p=>{const m=ne(P(p||{}));k.merge_field=m.merge_field||"",k.show_detail_subtotal=m.show_detail_subtotal??!0,k.subtotal_prefix=m.subtotal_prefix??"",k.subtotal_suffix=m.subtotal_suffix??""},{immediate:!0,deep:!0}),e.watch(k,()=>{a("update:groupRules",P(ne({merge_field:k.merge_field,show_detail_subtotal:k.show_detail_subtotal,subtotal_prefix:k.subtotal_prefix,subtotal_suffix:k.subtotal_suffix})))},{deep:!0}),(p,m)=>t.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qukt-gr-mask",onClick:m[6]||(m[6]=e.withModifiers(N=>p.$emit("close"),["self"]))},[e.createElementVNode("div",Gl,[e.createElementVNode("div",Hl,[m[7]||(m[7]=e.createElementVNode("span",null,"分组规则 & 小计配置",-1)),e.createElementVNode("button",{class:"qukt-gr-close",onClick:m[0]||(m[0]=N=>p.$emit("close"))},"✕")]),e.createElementVNode("div",Yl,[m[13]||(m[13]=e.createElementVNode("div",{class:"qukt-gr-tips"},[e.createElementVNode("p",null,[e.createElementVNode("b",null,"分组是什么?"),e.createTextVNode(" 选择某一列后,相同值的行会自动合并单元格(比如按「系统名称」分组,同系统的多条明细会合并成一个单元格)。每组末尾自动显示一行小计。")])],-1)),e.createElementVNode("div",Kl,[e.createElementVNode("div",Zl,[m[9]||(m[9]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"按哪一列分组",-1)),e.withDirectives(e.createElementVNode("select",{class:"qukt-cell-input","onUpdate:modelValue":m[1]||(m[1]=N=>k.merge_field=N),style:{flex:"1"}},[m[8]||(m[8]=e.createElementVNode("option",{value:""},"— 不分组 —",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columns,N=>(e.openBlock(),e.createElementBlock("option",{key:N.field,value:N.field,disabled:!e.unref(I)(N.editor).editable},e.toDisplayString(N.title)+"("+e.toDisplayString(N.field)+")",9,vl))),128))],512),[[e.vModelSelect,k.merge_field]])]),e.createElementVNode("div",eo,[m[10]||(m[10]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"显示小计",-1)),e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":m[2]||(m[2]=N=>k.show_detail_subtotal=N)},null,512),[[e.vModelCheckbox,k.show_detail_subtotal]])]),e.createElementVNode("div",to,[m[11]||(m[11]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"小计前缀",-1)),e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input","onUpdate:modelValue":m[3]||(m[3]=N=>k.subtotal_prefix=N),placeholder:"如 ¥、¥",style:{flex:"1"}},null,512),[[e.vModelText,k.subtotal_prefix]])]),e.createElementVNode("div",lo,[m[12]||(m[12]=e.createElementVNode("label",{class:"qukt-gr-form-label"},"小计后缀",-1)),e.withDirectives(e.createElementVNode("input",{class:"qukt-cell-input","onUpdate:modelValue":m[4]||(m[4]=N=>k.subtotal_suffix=N),placeholder:"如 元、RMB",style:{flex:"1"}},null,512),[[e.vModelText,k.subtotal_suffix]])])])]),e.createElementVNode("div",oo,[e.createElementVNode("button",{class:"qukt-btn",onClick:m[5]||(m[5]=N=>p.$emit("close"))},"关闭")])])])):e.createCommentVNode("",!0)}};function ke(t=1100){const o=e.ref(!1);function l(){o.value=window.innerWidth<=t}return e.onMounted(()=>{l(),window.addEventListener("resize",l)}),e.onUnmounted(()=>{window.removeEventListener("resize",l)}),{isNarrow:o}}const io={class:"qukt-toolbar"},ao={class:"qukt-col-left"},so={class:"qukt-sec-header"},ro={class:"qukt-sec-type"},co={class:"qukt-sec-actions"},mo=["disabled","onClick"],po=["disabled","onClick"],uo=["onClick"],fo={class:"qukt-sec-row"},ko=["onUpdate:modelValue"],bo={class:"qukt-sec-row"},ho=["checked","onChange"],yo={key:0,class:"qukt-sec-row"},Eo=["onUpdate:modelValue"],go={key:1,class:"qukt-sec-row"},Vo=["onUpdate:modelValue"],No={class:"qukt-sec-row"},_o=["onClick"],qo={class:"qukt-cells-list"},wo={class:"qukt-cell-toolbar"},Bo=["onClick"],xo={class:"qukt-sec-row"},$o=["onUpdate:modelValue"],Co={key:0,class:"qukt-sec-row"},So=["onUpdate:modelValue"],Do={class:"qukt-chk-label"},Fo=["onUpdate:modelValue"],To={class:"qukt-sec-row"},Uo=["checked","onChange"],Mo={key:1,class:"qukt-sec-row"},Ao=["onUpdate:modelValue"],Lo={key:0,class:"qukt-sec-row"},zo=["onUpdate:modelValue"],Oo={key:1,class:"qukt-sec-row"},Ro=["onUpdate:modelValue"],Io={class:"qukt-sec-row"},Po=["onClick"],Wo=["onClick"],jo={class:"qukt-col-right"},Jo={class:"qukt-preview-box"},Qo={class:"qukt-preview-inner"},Xo={key:1,class:"qukt-p-divider"},Go={key:3,class:"qukt-p-row"},Ho={key:0,class:"qukt-p-label"},Yo={class:"qukt-p-value qukt-p-bind-placeholder"},Ko={key:1,class:"qukt-p-value qukt-p-bind-placeholder"},Zo={key:0,class:"qukt-p-label"},vo={class:"qukt-p-value"},Qe="hdr_",en={__name:"DesignHeader",props:{sections:{type:Array,default:()=>[]},breakpoint:{type:Number,default:1100}},emits:["update:sections"],setup(t,{emit:o}){const l=t,a=o,{isNarrow:k}=ke(l.breakpoint),p=e.ref([]);e.watch(()=>l.sections,b=>{const c=ae(P(b||[]));Y(c,p.value)||(p.value=c)},{immediate:!0}),e.watch(p,b=>{a("update:sections",P(b))},{deep:!0});const m=e.ref(!1),N=e.ref({}),g=e.reactive({title:"样式配置",showBorder:!1,showAlign:!0,showWidth:!1});function q(b,c){N.value=b,c==="cell"?(g.title="单元格样式",g.showBorder=!0,g.showAlign=!0,g.showWidth=!0):(g.title="文本样式",g.showBorder=!1,g.showAlign=!0,g.showWidth=!1),m.value=!0}function d(b){b==="divider"?p.value.push({type:b}):b==="text"?p.value.push({type:b,label:"标签:",text:"纯文本内容",style:{color:"#303133",fontSize:14,bold:!1,italic:!1,align:"left"},bindEnabled:!1,bindField:""}):b==="row"&&p.value.push({type:b,cells:[{type:"field",label:"标签:",bindEnabled:!1,bindField:"",hideLabel:!1,style:v("50%")}]})}function f(b){p.value.splice(b,1)}function V(b,c){const i=b+c;i<0||i>=p.value.length||([p.value[b],p.value[i]]=[p.value[i],p.value[b]])}function U(b){b.cells||(b.cells=[]),b.cells.push({type:"field",label:"标签:",bindEnabled:!1,bindField:"",hideLabel:!1,style:v("33%")})}function A(b,c){b.cells.splice(c,1)}const L=b=>Ae(b,Qe,p.value),x=b=>Le(b,Qe,p.value);return(b,c)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",io,[c[5]||(c[5]=e.createElementVNode("span",{class:"qukt-tip"},"这里定义报价单的大标题、项目信息行等,左侧是设计器,右侧实时预览",-1)),e.createElementVNode("button",{class:"qukt-btn",onClick:c[0]||(c[0]=i=>d("row"))},"+ 字段行"),e.createElementVNode("button",{class:"qukt-btn",onClick:c[1]||(c[1]=i=>d("divider"))},"+ 分隔线"),e.createElementVNode("button",{class:"qukt-btn",onClick:c[2]||(c[2]=i=>d("text"))},"+ 纯文本")]),e.createElementVNode("div",{class:e.normalizeClass(["qukt-two-col",{"is-narrow":e.unref(k)}])},[e.createElementVNode("div",ao,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,(i,h)=>(e.openBlock(),e.createElementBlock("div",{key:h,class:e.normalizeClass(["qukt-sec-block",{"qukt-sec-block--divider":i.type==="divider"}])},[e.createElementVNode("div",so,[e.createElementVNode("span",ro,e.toDisplayString(i.type==="row"?"字段行":i.type==="divider"?"分隔线":"纯文本"),1),e.createElementVNode("div",co,[e.createElementVNode("button",{class:"qukt-mini-btn",disabled:h===0,onClick:n=>V(h,-1)},"↑",8,mo),e.createElementVNode("button",{class:"qukt-mini-btn",disabled:h>=p.value.length-1,onClick:n=>V(h,1)},"↓",8,po),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:n=>f(h)},"删",8,uo)])]),i.type==="text"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",fo,[c[6]||(c[6]=e.createElementVNode("label",null,"标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":n=>i.label=n,class:"qukt-cell-input",placeholder:"填写数据时用的提示"},null,8,ko),[[e.vModelText,i.label]])]),e.createElementVNode("div",bo,[c[7]||(c[7]=e.createElementVNode("label",null,"暴露",-1)),e.createElementVNode("input",{type:"checkbox",checked:i.bindEnabled,onChange:n=>L(i)},null,40,ho)]),i.bindEnabled?(e.openBlock(),e.createElementBlock("div",yo,[c[8]||(c[8]=e.createElementVNode("label",null,"字段名",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":n=>i.bindField=n,class:"qukt-cell-input",placeholder:"如 salesman"},null,8,Eo),[[e.vModelText,i.bindField]])])):e.createCommentVNode("",!0),i.bindEnabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",go,[c[9]||(c[9]=e.createElementVNode("label",null,"文字",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":n=>i.text=n,class:"qukt-cell-input"},null,8,Vo),[[e.vModelText,i.text]])])),e.createElementVNode("div",No,[c[10]||(c[10]=e.createElementVNode("label",null,"样式",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:n=>q(i.style,"text")},"设置",8,_o)])],64)):i.type==="row"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",qo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.cells,(n,$)=>(e.openBlock(),e.createElementBlock("div",{key:$,class:"qukt-cell-block"},[e.createElementVNode("div",wo,[e.createElementVNode("strong",null,e.toDisplayString($+1),1),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:s=>A(i,$)},"×",8,Bo)]),e.createElementVNode("div",xo,[c[12]||(c[12]=e.createElementVNode("label",null,"类型",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":s=>n.type=s,class:"qukt-cell-input small"},[...c[11]||(c[11]=[e.createElementVNode("option",{value:"field"},"字段(可编辑)",-1),e.createElementVNode("option",{value:"text"},"纯文本",-1)])],8,$o),[[e.vModelSelect,n.type]])]),n.type==="field"?(e.openBlock(),e.createElementBlock("div",Co,[c[14]||(c[14]=e.createElementVNode("label",null,"标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":s=>n.label=s,class:"qukt-cell-input",placeholder:"标签"},null,8,So),[[e.vModelText,n.label]]),e.createElementVNode("label",Do,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":s=>n.hideLabel=s},null,8,Fo),[[e.vModelCheckbox,n.hideLabel]]),c[13]||(c[13]=e.createTextVNode(" 隐藏 ",-1))])])):e.createCommentVNode("",!0),e.createElementVNode("div",To,[c[15]||(c[15]=e.createElementVNode("label",null,"暴露",-1)),e.createElementVNode("input",{type:"checkbox",checked:n.bindEnabled,onChange:s=>x(n)},null,40,Uo)]),n.bindEnabled?(e.openBlock(),e.createElementBlock("div",Mo,[c[16]||(c[16]=e.createElementVNode("label",null,"字段名",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":s=>n.bindField=s,class:"qukt-cell-input",placeholder:"如 salesman"},null,8,Ao),[[e.vModelText,n.bindField]])])):e.createCommentVNode("",!0),n.bindEnabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[n.type==="field"?(e.openBlock(),e.createElementBlock("div",Lo,[c[17]||(c[17]=e.createElementVNode("label",null,"值",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":s=>n.value=s,class:"qukt-cell-input",placeholder:"字段的值"},null,8,zo),[[e.vModelText,n.value]])])):e.createCommentVNode("",!0),n.type==="text"?(e.openBlock(),e.createElementBlock("div",Oo,[c[18]||(c[18]=e.createElementVNode("label",null,"文字",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":s=>n.text=s,class:"qukt-cell-input"},null,8,Ro),[[e.vModelText,n.text]])])):e.createCommentVNode("",!0)],64)),e.createElementVNode("div",Io,[c[19]||(c[19]=e.createElementVNode("label",null,"样式",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:s=>q(n.style,"cell")},"设置",8,Po)])]))),128))]),e.createElementVNode("button",{class:"qukt-btn qukt-btn-ghost",onClick:n=>U(i)},"+ 添加一个单元格",8,Wo)],64)):e.createCommentVNode("",!0)],2))),128))]),e.createElementVNode("div",jo,[e.createElementVNode("div",Jo,[c[20]||(c[20]=e.createElementVNode("div",{class:"qukt-preview-label"},"实时预览",-1)),e.createElementVNode("div",Qo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,(i,h)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:h},[i.type==="title"?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qukt-p-title",style:e.normalizeStyle(e.unref(K)(i))},e.toDisplayString(i.bindEnabled?i.bindField||"待绑定":i.text||"大标题"),5)):i.type==="divider"?(e.openBlock(),e.createElementBlock("div",Xo)):i.type==="text"?(e.openBlock(),e.createElementBlock("div",{key:2,class:"qukt-p-text",style:e.normalizeStyle(e.unref(K)(i))},e.toDisplayString(i.bindEnabled?i.bindField||"待绑定":i.text||"纯文本"),5)):i.type==="row"?(e.openBlock(),e.createElementBlock("div",Go,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.cells,(n,$)=>(e.openBlock(),e.createElementBlock("div",{key:$,class:"qukt-p-cell",style:e.normalizeStyle(e.unref(ie)(n))},[n.bindEnabled?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[n.type==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[n.label&&!n.hideLabel?(e.openBlock(),e.createElementBlock("span",Ho,e.toDisplayString(n.label),1)):e.createCommentVNode("",!0),e.createElementVNode("span",Yo,e.toDisplayString(n.bindField||"待绑定"),1)],64)):(e.openBlock(),e.createElementBlock("span",Ko,e.toDisplayString(n.bindField||"待绑定"),1))],64)):n.type==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[n.label&&!n.hideLabel?(e.openBlock(),e.createElementBlock("span",Zo,e.toDisplayString(n.label),1)):e.createCommentVNode("",!0),e.createElementVNode("span",vo,e.toDisplayString(n.value||"字段值"),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(n.text||"纯文本"),1)],64))],4))),128))])):e.createCommentVNode("",!0)],64))),128))])])])],2),e.createVNode(re,{visible:m.value,modelValue:N.value,showBorder:g.showBorder,showAlign:g.showAlign,showWidth:g.showWidth,title:g.title,"onUpdate:modelValue":c[3]||(c[3]=i=>Object.assign(N.value,i)),onClose:c[4]||(c[4]=i=>m.value=!1)},null,8,["visible","modelValue","showBorder","showAlign","showWidth","title"])]))}},tn={class:"qukt-toolbar"},ln={class:"qukt-col-left"},on={class:"qukt-sec-header"},nn={class:"qukt-sec-type"},an={class:"qukt-sec-actions"},sn=["disabled","onClick"],rn=["disabled","onClick"],dn=["onClick"],cn={class:"qukt-cells-list"},mn={class:"qukt-cell-toolbar"},pn=["onClick"],un={class:"qukt-sec-row"},fn=["onUpdate:modelValue"],kn={key:0,class:"qukt-sec-row"},bn=["onUpdate:modelValue"],hn={class:"qukt-chk-label"},yn=["onUpdate:modelValue"],En={class:"qukt-sec-row"},gn=["checked","onChange"],Vn={key:1,class:"qukt-sec-row"},Nn=["onUpdate:modelValue"],_n={key:0,class:"qukt-sec-row"},qn=["onUpdate:modelValue"],wn={key:1,class:"qukt-sec-row"},Bn=["onUpdate:modelValue"],xn={class:"qukt-sec-row"},$n=["onClick"],Cn=["onClick"],Sn={class:"qukt-sec-row"},Dn=["onUpdate:modelValue"],Fn={class:"qukt-sec-row"},Tn=["checked","onChange"],Un={key:0,class:"qukt-sec-row"},Mn=["onUpdate:modelValue"],An={key:1,class:"qukt-sec-row"},Ln=["onUpdate:modelValue"],zn={class:"qukt-sec-row"},On=["onClick"],Rn={class:"qukt-col-right"},In={class:"qukt-preview-box"},Pn={class:"qukt-preview-inner"},Wn={key:0,class:"qukt-p-divider"},jn={key:2,class:"qukt-p-row"},Jn={key:0,class:"qukt-p-label"},Qn={class:"qukt-p-value qukt-p-bind-placeholder"},Xn={key:1,class:"qukt-p-value qukt-p-bind-placeholder"},Gn={key:0,class:"qukt-p-label"},Hn={class:"qukt-p-value"},Xe="ftr_",Yn={__name:"DesignFooter",props:{sections:{type:Array,default:()=>[]},breakpoint:{type:Number,default:1100}},emits:["update:sections"],setup(t,{emit:o}){const l=t,a=o,{isNarrow:k}=ke(l.breakpoint),p=e.ref([]);e.watch(()=>l.sections,b=>{const c=ae(P(b||[]));Y(c,p.value)||(p.value=c)},{immediate:!0}),e.watch(p,b=>{a("update:sections",P(b))},{deep:!0});const m=e.ref(!1),N=e.ref({}),g=e.reactive({title:"样式配置",showBorder:!1,showAlign:!0,showWidth:!1});function q(b,c){N.value=b,c==="cell"?(g.title="单元格样式",g.showBorder=!0,g.showAlign=!0,g.showWidth=!0):(g.title="文本样式",g.showBorder=!1,g.showAlign=!0,g.showWidth=!1),m.value=!0}function d(b){b==="divider"?p.value.push({type:b}):b==="text"?p.value.push({type:b,label:"标签:",text:"纯文本",style:{color:"#303133",fontSize:14,bold:!1,italic:!1,align:"left"},bindEnabled:!1,bindField:""}):b==="row"&&p.value.push({type:b,cells:[{type:"field",label:"标签:",bindEnabled:!1,bindField:"",hideLabel:!1,style:v("50%")}]})}function f(b){p.value.splice(b,1)}function V(b,c){const i=b+c;i<0||i>=p.value.length||([p.value[b],p.value[i]]=[p.value[i],p.value[b]])}function U(b){b.cells||(b.cells=[]),b.cells.push({type:"field",label:"标签:",bindEnabled:!1,bindField:"",hideLabel:!1,style:v("50%")})}function A(b,c){b.cells.splice(c,1)}const L=b=>Ae(b,Xe,p.value),x=b=>Le(b,Xe,p.value);return(b,c)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",tn,[c[5]||(c[5]=e.createElementVNode("span",{class:"qukt-tip"},"页面底部显示签字栏、盖章区等,结构和页面头部一样",-1)),e.createElementVNode("button",{class:"qukt-btn",onClick:c[0]||(c[0]=i=>d("divider"))},"+ 分隔线"),e.createElementVNode("button",{class:"qukt-btn",onClick:c[1]||(c[1]=i=>d("row"))},"+ 字段行"),e.createElementVNode("button",{class:"qukt-btn",onClick:c[2]||(c[2]=i=>d("text"))},"+ 纯文本")]),e.createElementVNode("div",{class:e.normalizeClass(["qukt-two-col",{"is-narrow":e.unref(k)}])},[e.createElementVNode("div",ln,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,(i,h)=>(e.openBlock(),e.createElementBlock("div",{key:h,class:e.normalizeClass(["qukt-sec-block",{"qukt-sec-block--divider":i.type==="divider"}])},[e.createElementVNode("div",on,[e.createElementVNode("span",nn,e.toDisplayString(i.type==="row"?"字段行":i.type==="divider"?"分隔线":"纯文本"),1),e.createElementVNode("div",an,[e.createElementVNode("button",{class:"qukt-mini-btn",disabled:h===0,onClick:n=>V(h,-1)},"↑",8,sn),e.createElementVNode("button",{class:"qukt-mini-btn",disabled:h>=p.value.length-1,onClick:n=>V(h,1)},"↓",8,rn),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:n=>f(h)},"删",8,dn)])]),i.type==="row"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",cn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.cells,(n,$)=>(e.openBlock(),e.createElementBlock("div",{key:$,class:"qukt-cell-block"},[e.createElementVNode("div",mn,[e.createElementVNode("strong",null,e.toDisplayString($+1),1),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:s=>A(i,$)},"×",8,pn)]),e.createElementVNode("div",un,[c[7]||(c[7]=e.createElementVNode("label",null,"类型",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":s=>n.type=s,class:"qukt-cell-input small"},[...c[6]||(c[6]=[e.createElementVNode("option",{value:"field"},"字段(可编辑)",-1),e.createElementVNode("option",{value:"text"},"纯文本",-1)])],8,fn),[[e.vModelSelect,n.type]])]),n.type==="field"?(e.openBlock(),e.createElementBlock("div",kn,[c[9]||(c[9]=e.createElementVNode("label",null,"标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":s=>n.label=s,class:"qukt-cell-input",placeholder:"标签"},null,8,bn),[[e.vModelText,n.label]]),e.createElementVNode("label",hn,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":s=>n.hideLabel=s},null,8,yn),[[e.vModelCheckbox,n.hideLabel]]),c[8]||(c[8]=e.createTextVNode(" 隐藏 ",-1))])])):e.createCommentVNode("",!0),e.createElementVNode("div",En,[c[10]||(c[10]=e.createElementVNode("label",null,"对外暴露",-1)),e.createElementVNode("input",{type:"checkbox",checked:n.bindEnabled,onChange:s=>x(n)},null,40,gn)]),n.bindEnabled?(e.openBlock(),e.createElementBlock("div",Vn,[c[11]||(c[11]=e.createElementVNode("label",null,"字段名",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":s=>n.bindField=s,class:"qukt-cell-input",placeholder:"如 company_name"},null,8,Nn),[[e.vModelText,n.bindField]])])):e.createCommentVNode("",!0),n.bindEnabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[n.type==="field"?(e.openBlock(),e.createElementBlock("div",_n,[c[12]||(c[12]=e.createElementVNode("label",null,"值",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":s=>n.value=s,class:"qukt-cell-input",placeholder:"字段的值"},null,8,qn),[[e.vModelText,n.value]])])):e.createCommentVNode("",!0),n.type==="text"?(e.openBlock(),e.createElementBlock("div",wn,[c[13]||(c[13]=e.createElementVNode("label",null,"文字",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":s=>n.text=s,class:"qukt-cell-input"},null,8,Bn),[[e.vModelText,n.text]])])):e.createCommentVNode("",!0)],64)),e.createElementVNode("div",xn,[c[14]||(c[14]=e.createElementVNode("label",null,"样式",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:s=>q(n.style,"cell")},"设置",8,$n)])]))),128))]),e.createElementVNode("button",{class:"qukt-btn qukt-btn-ghost",onClick:n=>U(i)},"+ 添加一个单元格",8,Cn)],64)):i.type==="text"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("div",Sn,[c[15]||(c[15]=e.createElementVNode("label",null,"标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":n=>i.label=n,class:"qukt-cell-input",placeholder:"填写数据时用的提示"},null,8,Dn),[[e.vModelText,i.label]])]),e.createElementVNode("div",Fn,[c[16]||(c[16]=e.createElementVNode("label",null,"暴露",-1)),e.createElementVNode("input",{type:"checkbox",checked:i.bindEnabled,onChange:n=>L(i)},null,40,Tn)]),i.bindEnabled?(e.openBlock(),e.createElementBlock("div",Un,[c[17]||(c[17]=e.createElementVNode("label",null,"字段名",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":n=>i.bindField=n,class:"qukt-cell-input",placeholder:"如 company_name"},null,8,Mn),[[e.vModelText,i.bindField]])])):e.createCommentVNode("",!0),i.bindEnabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",An,[c[18]||(c[18]=e.createElementVNode("label",null,"文字",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":n=>i.text=n,class:"qukt-cell-input"},null,8,Ln),[[e.vModelText,i.text]])])),e.createElementVNode("div",zn,[c[19]||(c[19]=e.createElementVNode("label",null,"样式",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:n=>q(i.style,"text")},"设置",8,On)])],64)):e.createCommentVNode("",!0)],2))),128))]),e.createElementVNode("div",Rn,[e.createElementVNode("div",In,[c[20]||(c[20]=e.createElementVNode("div",{class:"qukt-preview-label"},"底部预览",-1)),e.createElementVNode("div",Pn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,(i,h)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:h},[i.type==="divider"?(e.openBlock(),e.createElementBlock("div",Wn)):i.type==="text"?(e.openBlock(),e.createElementBlock("div",{key:1,class:"qukt-p-text",style:e.normalizeStyle(e.unref(K)(i))},e.toDisplayString(i.bindEnabled?i.bindField||"待绑定":i.text||"纯文本"),5)):i.type==="row"?(e.openBlock(),e.createElementBlock("div",jn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.cells,(n,$)=>(e.openBlock(),e.createElementBlock("div",{key:$,class:"qukt-p-cell",style:e.normalizeStyle(e.unref(ie)(n))},[n.bindEnabled?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[n.type==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[n.label&&!n.hideLabel?(e.openBlock(),e.createElementBlock("span",Jn,e.toDisplayString(n.label),1)):e.createCommentVNode("",!0),e.createElementVNode("span",Qn,e.toDisplayString(n.bindField||"待绑定"),1)],64)):(e.openBlock(),e.createElementBlock("span",Xn,e.toDisplayString(n.bindField||"待绑定"),1))],64)):n.type==="field"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[n.label&&!n.hideLabel?(e.openBlock(),e.createElementBlock("span",Gn,e.toDisplayString(n.label),1)):e.createCommentVNode("",!0),e.createElementVNode("span",Hn,e.toDisplayString(n.value||"字段值"),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(n.text||"纯文本"),1)],64))],4))),128))])):e.createCommentVNode("",!0)],64))),128))])])])],2),e.createVNode(re,{visible:m.value,modelValue:N.value,showBorder:g.showBorder,showAlign:g.showAlign,showWidth:g.showWidth,title:g.title,"onUpdate:modelValue":c[3]||(c[3]=i=>Object.assign(N.value,i)),onClose:c[4]||(c[4]=i=>m.value=!1)},null,8,["visible","modelValue","showBorder","showAlign","showWidth","title"])]))}},Kn={class:"qukt-col-left"},Zn={class:"qukt-sec-header"},vn={class:"qukt-sec-type"},ei={class:"qukt-sec-actions"},ti=["disabled","onClick"],li=["disabled","onClick"],oi=["onClick"],ni={class:"qukt-sec-row"},ii=["onUpdate:modelValue"],ai=["value"],si={class:"qukt-sec-row"},ri=["onUpdate:modelValue"],di={class:"qukt-sec-row"},ci=["onUpdate:modelValue"],mi={class:"qukt-sec-row"},pi=["onUpdate:modelValue"],ui={class:"qukt-sec-row"},fi=["onUpdate:modelValue"],ki={key:0,class:"qukt-sec-row"},bi=["onUpdate:modelValue"],hi={key:1,class:"qukt-sec-row"},yi=["onUpdate:modelValue"],Ei={key:2,class:"qukt-sec-row"},gi=["onUpdate:modelValue"],Vi={class:"qukt-sec-row"},Ni=["onClick"],_i={key:0,class:"qukt-q-empty"},qi={class:"qukt-col-right"},wi={class:"qukt-preview-box"},Bi={class:"qukt-preview-inner"},xi={key:0,class:"qukt-empty-hint"},$i={key:1,class:"qukt-summary-preview"},Ci={class:"qukt-sp-label"},Si={key:2,class:"qukt-preview-help"},Di={__name:"DesignSummary",props:{fields:{type:Array,default:()=>[]},breakpoint:{type:Number,default:1100}},emits:["update:fields"],setup(t,{emit:o}){const l=Object.values(H),a=t,k=o,{isNarrow:p}=ke(a.breakpoint),m=e.ref([]);e.watch(()=>a.fields,c=>{const i=P(c||[]);me(i),!Y(i,m.value)&&(m.value=i)},{immediate:!0}),e.watch(m,c=>{const i=P(c);me(i),k("update:fields",i)},{deep:!0});function N(c){return m.value.indexOf(c)}const g=e.ref(!1),q=e.ref({});function d(c){q.value=c,g.value=!0}const f={group_total:1e4},V=e.computed(()=>{const c={...f};for(const i of m.value)j(i.type).hasDefault&&(c[i.field]=Number(i.default??0));for(const i of m.value)if(j(i.type).hasFormula&&i.formula)try{c[i.field]=G(i.formula,c)}catch{c[i.field]=0}return c});function U(c){return j(c).label}function A(c){const i=j(c.type);if(i.hasText)return c.text||"";let h;i.hasFormula?h=Number(V.value[c.field])||0:h=Number(c.default)||0;const n=Number.isInteger(h)?h:h.toFixed(2);return(c.prefix||"")+n+(c.suffix||"")}function L(){m.value.push(ot(H.AUTO_CALC.value))}function x(c){m.value.splice(c,1)}function b(c,i){const h=c+i;h<0||h>=m.value.length||([m.value[c],m.value[h]]=[m.value[h],m.value[c]])}return(c,i)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",{class:"qukt-toolbar"},[i[2]||(i[2]=e.createElementVNode("span",{class:"qukt-tip"},[e.createTextVNode("汇总区域每行显示一项,公式里可引用 "),e.createElementVNode("code",null,"group_total"),e.createTextVNode("、"),e.createElementVNode("code",null,"grand_total"),e.createTextVNode(" 以及其他汇总字段")],-1)),e.createElementVNode("button",{class:"qukt-btn",onClick:L},"+ 添加字段")]),e.createElementVNode("div",{class:e.normalizeClass(["qukt-two-col",{"is-narrow":e.unref(p)}])},[e.createElementVNode("div",Kn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,h=>(e.openBlock(),e.createElementBlock("div",{key:h.field,class:"qukt-sec-block"},[e.createElementVNode("div",Zn,[e.createElementVNode("span",vn,e.toDisplayString(U(h.type)),1),e.createElementVNode("div",ei,[e.createElementVNode("button",{class:"qukt-mini-btn",disabled:N(h)===0,onClick:n=>b(N(h),-1)},"↑",8,ti),e.createElementVNode("button",{class:"qukt-mini-btn",disabled:N(h)>=m.value.length-1,onClick:n=>b(N(h),1)},"↓",8,li),e.createElementVNode("button",{class:"qukt-mini-btn danger",onClick:n=>x(N(h))},"删",8,oi)])]),e.createElementVNode("div",ni,[i[3]||(i[3]=e.createElementVNode("label",null,"类型",-1)),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":n=>h.type=n,class:"qukt-cell-input"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l),n=>(e.openBlock(),e.createElementBlock("option",{key:n.value,value:n.value},e.toDisplayString(n.label),9,ai))),128))],8,ii),[[e.vModelSelect,h.type]])]),e.createElementVNode("div",si,[i[4]||(i[4]=e.createElementVNode("label",null,"标签",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":n=>h.label=n,class:"qukt-cell-input",placeholder:"如 合计、税后、业务员抽成"},null,8,ri),[[e.vModelText,h.label]])]),e.createElementVNode("div",di,[i[5]||(i[5]=e.createElementVNode("label",null,"字段名",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":n=>h.field=n,class:"qukt-cell-input",placeholder:"如 subtotal、tax (其他行公式可引用)"},null,8,ci),[[e.vModelText,h.field]])]),e.createElementVNode("div",mi,[i[6]||(i[6]=e.createElementVNode("label",null,"前缀",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":n=>h.prefix=n,class:"qukt-cell-input",placeholder:"如 ¥、¥"},null,8,pi),[[e.vModelText,h.prefix]])]),e.createElementVNode("div",ui,[i[7]||(i[7]=e.createElementVNode("label",null,"后缀",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":n=>h.suffix=n,class:"qukt-cell-input",placeholder:"如 %"},null,8,fi),[[e.vModelText,h.suffix]])]),e.unref(j)(h.type).hasFormula?(e.openBlock(),e.createElementBlock("div",ki,[i[8]||(i[8]=e.createElementVNode("label",null,"公式",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":n=>h.formula=n,class:"qukt-cell-input",placeholder:"如 group_total * 0.01 + group_total"},null,8,bi),[[e.vModelText,h.formula]])])):e.unref(j)(h.type).hasDefault?(e.openBlock(),e.createElementBlock("div",hi,[i[9]||(i[9]=e.createElementVNode("label",null,"默认值",-1)),e.withDirectives(e.createElementVNode("input",{type:"number","onUpdate:modelValue":n=>h.default=n,class:"qukt-cell-input",placeholder:"默认值"},null,8,yi),[[e.vModelText,h.default,void 0,{number:!0}]])])):e.unref(j)(h.type).hasText?(e.openBlock(),e.createElementBlock("div",Ei,[i[10]||(i[10]=e.createElementVNode("label",null,"显示文本",-1)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":n=>h.text=n,class:"qukt-cell-input",placeholder:"显示文本"},null,8,gi),[[e.vModelText,h.text]])])):e.createCommentVNode("",!0),e.createElementVNode("div",Vi,[i[11]||(i[11]=e.createElementVNode("label",null,"样式",-1)),e.createElementVNode("button",{class:"qukt-mini-btn",onClick:n=>d(h.style)},"设置",8,Ni)])]))),128)),m.value.length===0?(e.openBlock(),e.createElementBlock("div",_i,"还没有汇总行,点上方按钮添加")):e.createCommentVNode("",!0)]),e.createElementVNode("div",qi,[e.createElementVNode("div",wi,[i[13]||(i[13]=e.createElementVNode("div",{class:"qukt-preview-label"},"汇总预览",-1)),e.createElementVNode("div",Bi,[m.value.length===0?(e.openBlock(),e.createElementBlock("div",xi,"暂无汇总字段")):(e.openBlock(),e.createElementBlock("div",$i,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,h=>(e.openBlock(),e.createElementBlock("div",{key:h.field,class:"qukt-sp-row"},[e.createElementVNode("span",Ci,e.toDisplayString(h.label||"标签"),1),e.createElementVNode("span",{class:"qukt-sp-value",style:e.normalizeStyle(e.unref(Me)(h))},e.toDisplayString(A(h)),5)]))),128))])),m.value.length>0?(e.openBlock(),e.createElementBlock("div",Si,[...i[12]||(i[12]=[e.createElementVNode("b",null,"系统变量:",-1),e.createElementVNode("code",null,"group_total",-1),e.createTextVNode("(明细小计合计)、 ",-1),e.createElementVNode("code",null,"grand_total",-1),e.createTextVNode("(报价总额) ",-1)])])):e.createCommentVNode("",!0)])])])],2),e.createVNode(re,{visible:g.value,modelValue:q.value,showBorder:!1,showAlign:!1,showWidth:!1,title:"汇总值样式","onUpdate:modelValue":i[0]||(i[0]=h=>Object.assign(q.value,h)),onClose:i[1]||(i[1]=h=>g.value=!1)},null,8,["visible","modelValue"])]))}},Fi={class:"qukt-help-dialog"},Ti={class:"qukt-help-header"},Ui={__name:"HelpModal",props:{visible:{type:Boolean,default:!1}},emits:["close"],setup(t){return(o,l)=>t.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"qukt-help-modal",onClick:l[1]||(l[1]=e.withModifiers(a=>o.$emit("close"),["self"]))},[e.createElementVNode("div",Fi,[e.createElementVNode("div",Ti,[l[2]||(l[2]=e.createElementVNode("h3",null,"📖 报价单生成器 — 使用教程",-1)),e.createElementVNode("button",{class:"qukt-close-btn",onClick:l[0]||(l[0]=a=>o.$emit("close"))},"✕")]),l[3]||(l[3]=e.createStaticVNode(`<div class="qukt-help-body"><section class="qukt-help-section"><h4>🔁 整体三步流程</h4><p>顶部导航栏有三个步骤,按顺序操作即可生成一份完整报价单:</p><ol class="qukt-steps"><li><b>① 设计模板</b> — 定义表头列、页面头部信息、汇总区域、底部签字栏等</li><li><b>② 填写数据</b> — 根据模板录入每条明细,自动分组、自动算小计</li><li><b>③ 预览导出</b> — 查看最终效果,一键导出 Excel 或打印</li></ol><p class="qukt-tip-box">💡 也可以从第 ② 步开始,系统已内置 3 个示例模板可直接使用</p></section><section class="qukt-help-section"><h4>① 表头列 — 定义表格里有哪些列</h4><p>点击顶部工具栏的 <b>+ 添加字段</b> 按钮可以新增一列,然后在表格中把「类型」改成你想要的:</p><table class="qukt-help-table"><thead><tr><th>按钮</th><th>字段类型</th><th>说明</th></tr></thead><tbody><tr><td>文本列</td><td>INPUT</td><td>普通文字输入,用于名称、描述等</td></tr><tr><td>数字列</td><td>NUMBER</td><td>只能填数字,用于数量、单价等</td></tr><tr><td>下拉列</td><td>SELECT_DICT</td><td>固定选项,点击列中的"下拉选项"输入选项,用逗号分隔,如 <code>设备,材料,安装</code></td></tr><tr><td>多行文本列</td><td>TEXTAREA</td><td>可输入较长文字,用于备注、说明等</td></tr></tbody></table><p><b>特殊类型列:</b></p><ul><li><b>自动序号</b> — 自动从 1 开始递增,字段名随便改(建议叫 <code>seq</code>)</li><li><b>自动计算(公式)</b> — 用任意公式算值,公式里可引用<b>同一行其他列的字段名</b>,如 <code>quantity * unit_price</code>。字段名必须和你在表头里设置的一致,比如数量列叫 <code>qty</code> 就要写 <code>qty * unit_price</code></li></ul><p><b>列顺序:</b>点行末的 ↑ ↓ 按钮上下移动,或拖动行来调整</p><p><b>列宽度:</b>单位是像素(px),在"宽度"列填数字</p><p class="qukt-tip-box">💡 下拉列的选项是写在逗号分隔的输入框里,保存后切换到「填写数据」页面时会变成下拉选择框</p></section><section class="qukt-help-section"><h4>② 页面头部 — 报价单的标题和项目信息</h4><p>头部由多个"段落"顺序组成,每个段落可以是以下 4 种类型:</p><table class="qukt-help-table"><thead><tr><th>类型</th><th>说明</th><th>配置项</th></tr></thead><tbody><tr><td><b>大标题</b></td><td>最顶部的报价单标题</td><td>文字、字号、粗体、对齐方式</td></tr><tr><td><b>字段行</b></td><td>一行可以放多个单元格,每个单元格要么是可编辑字段,要么是固定文字</td><td>每个单元格单独配置</td></tr><tr><td><b>分隔线</b></td><td>画一条灰色横线</td><td>无配置</td></tr><tr><td><b>纯文本</b></td><td>一段固定文字,如"此报价单有效期30天"</td><td>文字内容、对齐方式</td></tr></tbody></table><p><b>字段行详解:</b></p><ul><li>点"➕ 添加一个单元格"来增加这一行里的格子数量</li><li>每个格子选"类型":<b>字段(可编辑)</b> 或 <b>纯文本</b></li><li>字段类型要填 <b>标签</b>(如"项目名称")和 <b>绑定字段</b>(如 <code>projectName</code>)</li><li>绑定字段是关键!同一个绑定字段名在整个模板中要保持一致,后续数据填写和导出都靠它</li><li>宽度用百分比,如 <code>50%</code>、<code>33%</code>,一行所有格子宽度加起来建议 = 100%</li></ul><p class="qukt-tip-box">💡 右侧"实时预览"区域会随着你的编辑即时变化,所见即所得</p></section><section class="qukt-help-section"><h4>③ 汇总区域 — 表格底部的费用合计</h4><p>汇总项显示在明细表格的下方(导出 Excel 时会自动排在表格右侧底部)。</p><table class="qukt-help-table"><thead><tr><th>类型</th><th>说明</th></tr></thead><tbody><tr><td><b>手动输入(自定义金额)</b></td><td>任意需要手工填写的金额项:人工费、服务费、运费、税费、折扣、其他费用等。可以在"默认值"里预设一个初始值</td></tr><tr><td><b>自动计算(公式)</b></td><td>系统自动算好的值,需要写公式。<code>grand_total</code> 会自动把所有手动输入项加进去</td></tr></tbody></table><p><b>自动计算公式里的可用变量(固定):</b></p><table class="qukt-help-table"><thead><tr><th>变量名</th><th>含义</th><th>说明</th></tr></thead><tbody><tr><td><code>group_total</code></td><td>明细小计合计</td><td>所有行的自动计算列(小计列)求和</td></tr><tr><td><code>grand_total</code></td><td>报价总额</td><td>group_total + 所有手动输入项之和</td></tr></tbody></table><p><b>动态可用变量(随你的模板定义):</b></p><p>你在汇总区域里定义的<b>每一个手动输入项的字段名</b>,都会自动成为可用变量,它们之间也能互相引用。</p><p>举个例子:如果你定义了 <code>labor_cost</code>、<code>service_fee</code>、<code>discount</code> 三个手动项,那么自动计算公式里可以写:</p><pre class="code">group_total + labor_cost + service_fee - discount</pre><p><b>字段名命名建议:</b></p><ul><li><code>grand_total</code> — 报价总额(特殊字段,系统会把所有手动项加进去)</li><li><code>group_total</code> — 明细小计(建议不要手动改成别的,公式里会用到)</li><li>其他手动项随意,如 <code>service_fee</code>、<code>freight</code>、<code>tax_amount</code>、<code>discount</code> 等</li></ul></section><section class="qukt-help-section"><h4>④ 页面底部 — 签字栏、盖章区</h4><p>结构和"页面头部"完全一样,支持:分隔线、字段行、纯文本。</p><p>常见用法:</p><ul><li>分隔线 → 分隔表格和签字区</li><li>字段行 → 左边"客户签字:________",右边"业务员签字:________"</li><li>纯文本 → 居中写"公司盖章:"</li></ul></section><section class="qukt-help-section"><h4>💾 保存与模板管理</h4><ul><li><b>💾 保存修改</b> — 直接更新当前选中的模板</li><li><b>➕ 另存为新模板</b> — 输入一个新名字,基于当前模板复制出一个全新的模板</li><li>顶部的下拉框可以在已有的模板之间切换,切换后下方所有配置会自动加载</li></ul><p class="qukt-tip-box">⚠️ 目前模板数据保存在浏览器内存中(刷新后会恢复默认),如果要持久化存储,需要把模板同步到后端接口</p></section><section class="qukt-help-section"><h4>🔢 分组与计算规则(高级)</h4><p>在「表头列」tab 的列表下方,有一个<b>分组规则</b>配置框:</p><ul><li><b>按哪一列分组</b> — 选择一列后,相同值的行会自动合并单元格,每组末尾自动生成小计行。选「不分组」则不分组、不显示小计,但列上勾选了「相同值合并」的列仍然会对相邻相同值做合并</li></ul><p>对应模板数据结构:</p><pre class="code">{
|
|
13
13
|
group_rules: { merge_field: 'system_name' },
|
|
14
14
|
// 不分组时 group_rules 为 null 或 { merge_field: '' }
|
|
15
|
-
}</pre><p>例如模板 TPL-001 按 <code>system_name</code>(系统名称)分组,相同系统名称的多条明细会自动合并成一个单元格,每组末尾自动生成小计行。</p></section><section class="qukt-help-section"><h4>📝 切换到「填写数据」</h4><p>模板设计好后,点顶部的"下一步"进入填写数据页面,注意:</p><ul><li>点 ➕ 添加新条目,会弹出表单,表单字段完全根据你的模板表头列生成</li><li>分组字段(如 <code>system_name</code>)会自动继承上一行的值,让同组合并不间断</li><li>右侧"实时汇总"卡片会根据汇总区域配置动态显示</li></ul></section><section class="qukt-help-section qukt-tip-box final-tip"> 🎯 <b>推荐操作顺序:</b>选一个最接近的示例模板 → 点"另存为新模板"复制一份 → 按需要改表头列 / 头部信息 / 汇总项 → 保存 → 下一步填写数据 → 导出 Excel </section></div>`,1))])])):e.createCommentVNode("",!0)}},Ai={class:"qukt-designer"},Li={class:"qukt-tabs"},zi={key:0,class:"qukt-tab-content"},Ri={key:1,class:"qukt-tab-content"},Oi={key:2,class:"qukt-tab-content"},Ii={key:3,class:"qukt-tab-content"},Wi={key:4,class:"qukt-tab-content qukt-tab-content-preview"},Pi={__name:"QuokitTemplate",props:{tpl:{type:Object,default:pe},breakpoint:{type:Number,default:1100}},emits:["update:tpl"],setup(t,{expose:o,emit:l}){const a=t,k=l,p=e.ref("cols"),m=e.ref(!1),N=e.ref(!1),y=We([],{}),_=fe([]),d=fe([]),f=Pe([]);let g="";const U=e.computed(()=>se({columns:y.tpl.columns,group_rules:y.tpl.group_rules,header_sections:_.toTpl(),footer_sections:d.toTpl(),summary_fields:f.toTpl()}));e.watch(()=>a.tpl,()=>{const V=se(a.tpl);Y(V,U.value)||(y.setColumns(a.tpl.columns),y.setGroupRules(a.tpl.group_rules),_.setSections(a.tpl.header_sections),d.setSections(a.tpl.footer_sections),f.setFields(a.tpl.summary_fields))},{immediate:!0});const A=Ze(V=>{k("update:tpl",V)},200);e.watch(U,()=>{const V=JSON.stringify(U.value);V!==g&&(g=V,A(U.value))},{deep:!0}),e.onMounted(()=>{k("update:tpl",U.value)}),e.onBeforeUnmount(()=>{A.cancel()});const L=e.computed(()=>U.value),D=e.computed(()=>je(y.tpl.columns,3));return o({getTemplateJSON(){return U.value},showHelp(){m.value=!0}}),(V,s)=>(e.openBlock(),e.createElementBlock("div",Ai,[e.createElementVNode("div",Li,[e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:p.value==="cols"}]),onClick:s[0]||(s[0]=n=>p.value="cols")},"① 表头列",2),e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:p.value==="header"}]),onClick:s[1]||(s[1]=n=>p.value="header")},"② 页面头部",2),e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:p.value==="summary"}]),onClick:s[2]||(s[2]=n=>p.value="summary")},"③ 汇总区域",2),e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:p.value==="footer"}]),onClick:s[3]||(s[3]=n=>p.value="footer")},"④ 页面底部",2),e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:p.value==="preview"}]),onClick:s[4]||(s[4]=n=>p.value="preview")},"⑤ 总体预览",2)]),p.value==="cols"?(e.openBlock(),e.createElementBlock("div",zi,[e.createVNode(Gl,{columns:e.unref(y).columns,"onUpdate:columns":s[5]||(s[5]=n=>e.unref(y).columns=n),"group-rules":e.unref(y).groupRules,"onUpdate:groupRules":s[6]||(s[6]=n=>e.unref(y).groupRules=n),onHelp:s[7]||(s[7]=n=>m.value=!0),onOpenGroup:s[8]||(s[8]=n=>N.value=!0)},null,8,["columns","group-rules"])])):e.createCommentVNode("",!0),p.value==="header"?(e.openBlock(),e.createElementBlock("div",Ri,[e.createVNode(tn,{sections:e.unref(_).sections,"onUpdate:sections":s[9]||(s[9]=n=>e.unref(_).sections=n),breakpoint:t.breakpoint},null,8,["sections","breakpoint"])])):e.createCommentVNode("",!0),p.value==="summary"?(e.openBlock(),e.createElementBlock("div",Oi,[e.createVNode(Fi,{fields:e.unref(f).fields,"onUpdate:fields":s[10]||(s[10]=n=>e.unref(f).fields=n),breakpoint:t.breakpoint},null,8,["fields","breakpoint"])])):e.createCommentVNode("",!0),p.value==="footer"?(e.openBlock(),e.createElementBlock("div",Ii,[e.createVNode(Zn,{sections:e.unref(d).sections,"onUpdate:sections":s[11]||(s[11]=n=>e.unref(d).sections=n),breakpoint:t.breakpoint},null,8,["sections","breakpoint"])])):e.createCommentVNode("",!0),p.value==="preview"?(e.openBlock(),e.createElementBlock("div",Wi,[e.createVNode(ue,{tpl:L.value,data:D.value},null,8,["tpl","data"])])):e.createCommentVNode("",!0),e.createVNode(Mi,{visible:m.value,onClose:s[12]||(s[12]=n=>m.value=!1)},null,8,["visible"]),e.createVNode(io,{visible:N.value,columns:e.unref(y).columns,"group-rules":e.unref(y).groupRules,"onUpdate:groupRules":s[13]||(s[13]=n=>e.unref(y).groupRules=n),onClose:s[14]||(s[14]=n=>N.value=!1)},null,8,["visible","columns","group-rules"])]))}},ji={class:"qukt-page"},Ji={key:0,class:"qukt-bind-section"},Qi={class:"qukt-bind-grid"},Xi={class:"qukt-bind-label"},Gi=["value","onInput","placeholder"],Hi={key:1,class:"qukt-bind-section"},Yi={class:"qukt-bind-grid"},Zi={class:"qukt-bind-label"},Ki=["value","onInput","placeholder"],vi={key:2,class:"qukt-empty-tip"},ea={key:3,class:"qukt-data-table"},ta={class:"qukt-main-table"},la=["onClick"],oa={key:1,class:"qukt-subtotal"},na=["onClick"],ia=["onClick"],aa={class:"qukt-de-dialog"},sa={class:"qukt-de-header"},ra={class:"qukt-de-content"},da={class:"qukt-form-grid"},ca={class:"qukt-form-cell-label"},ma=["onUpdate:modelValue","placeholder"],pa=["step","min","max","onUpdate:modelValue"],ua=["onUpdate:modelValue","placeholder"],fa=["onUpdate:modelValue"],ka=["value"],ba={class:"qukt-de-footer"},ha={__name:"QuokitData",props:{tpl:{type:Object,default:pe},data:{type:Object,default:()=>({headerData:{},rows:[],footerData:{}})}},emits:["update:data"],setup(t,{emit:o}){const l=t,a=o;function k(E){const r=E||{},u=!("headerData"in r)||!("rows"in r)||!("footerData"in r);return{next:{headerData:r.headerData||{},rows:r.rows||[],footerData:r.footerData||{}},changed:u}}e.watch(()=>l.data,E=>{const{next:r,changed:u}=k(E);u&&a("update:data",r)},{immediate:!0}),e.onMounted(()=>{a("update:data",k(l.data).next)});const p=e.computed(()=>se(l.tpl)),m=e.computed(()=>ze(p.value.header_sections)),N=e.computed(()=>ze(p.value.footer_sections)),y=e.computed({get:()=>{var E;return((E=l.data)==null?void 0:E.headerData)||{}},set:E=>a("update:data",{...l.data,headerData:E})}),_=e.computed({get:()=>{var E;return((E=l.data)==null?void 0:E.footerData)||{}},set:E=>a("update:data",{...l.data,footerData:E})}),d=e.computed(()=>{var E;return((E=l.data)==null?void 0:E.rows)||[]}),f=e.computed(()=>p.value.columns),g=e.computed(()=>f.value.filter(E=>I(E.editor).editable)),U=e.ref(!1),A=e.ref("add"),L=e.ref(-1),D=e.ref({});function V(){const E={};for(const r of g.value)r.editor===P.NUMBER.value?E[r.field]=r.default??r.min??0:E[r.field]=r.default??"";return E}function s(E,r){var u;a("update:data",{...l.data,headerData:{...((u=l.data)==null?void 0:u.headerData)||{},[E]:r}})}function n(E,r){var u;a("update:data",{...l.data,footerData:{...((u=l.data)==null?void 0:u.footerData)||{},[E]:r}})}function b(){A.value="add",L.value=-1,D.value=V(),U.value=!0}function i(E){A.value="edit",L.value=E,D.value={...d.value[E]},U.value=!0}function x(E){if(!confirm("确定删除这条明细?"))return;const r=[...d.value];r.splice(E,1),a("update:data",{...l.data,rows:r})}function c(){if(A.value==="edit"){const E=[...d.value];E[L.value]={...D.value},a("update:data",{...l.data,rows:E})}else a("update:data",{...l.data,rows:[...d.value,{...D.value}]});U.value=!1}return(E,r)=>(e.openBlock(),e.createElementBlock("div",ji,[e.createElementVNode("div",{class:"qukt-toolbar"},[r[4]||(r[4]=e.createElementVNode("span",{class:"qukt-tip"},"点击行可快速编辑,预估总价会自动计算",-1)),e.createElementVNode("div",{class:"qukt-btn-group-inline"},[e.createElementVNode("button",{class:"qukt-btn",onClick:b},"+ 添加新条目")])]),m.value.length>0?(e.openBlock(),e.createElementBlock("div",Ji,[r[5]||(r[5]=e.createElementVNode("div",{class:"qukt-bind-title"},"📌 头部信息",-1)),e.createElementVNode("div",Qi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,u=>(e.openBlock(),e.createElementBlock("div",{key:"h-"+u.field,class:"qukt-bind-item"},[e.createElementVNode("label",Xi,e.toDisplayString(u.label||u.field),1),e.createElementVNode("input",{class:"qukt-cell-input",value:y.value[u.field]??"",onInput:h=>s(u.field,h.target.value),placeholder:"请输入"+(u.label||u.field)},null,40,Gi)]))),128))])])):e.createCommentVNode("",!0),N.value.length>0?(e.openBlock(),e.createElementBlock("div",Hi,[r[6]||(r[6]=e.createElementVNode("div",{class:"qukt-bind-title"},"📌 底部信息",-1)),e.createElementVNode("div",Yi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.value,u=>(e.openBlock(),e.createElementBlock("div",{key:"f-"+u.field,class:"qukt-bind-item"},[e.createElementVNode("label",Zi,e.toDisplayString(u.label||u.field),1),e.createElementVNode("input",{class:"qukt-cell-input",value:_.value[u.field]??"",onInput:h=>n(u.field,h.target.value),placeholder:"请输入"+(u.label||u.field)},null,40,Ki)]))),128))])])):e.createCommentVNode("",!0),d.value.length===0?(e.openBlock(),e.createElementBlock("div",vi,[...r[7]||(r[7]=[e.createElementVNode("div",{class:"qukt-empty-icon"},"📋",-1),e.createElementVNode("div",{class:"qukt-empty-text"},"暂无数据,点击下方按钮添加第一条明细",-1)])])):e.createCommentVNode("",!0),d.value.length>0?(e.openBlock(),e.createElementBlock("div",ea,[e.createElementVNode("table",ta,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,u=>(e.openBlock(),e.createElementBlock("th",{key:u.field,style:e.normalizeStyle({width:u.width+"px"})},e.toDisplayString(u.title),5))),128)),r[8]||(r[8]=e.createElementVNode("th",{width:"140"},"操作",-1))])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(u,h)=>(e.openBlock(),e.createElementBlock("tr",{key:h,onClick:q=>i(h)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,q=>(e.openBlock(),e.createElementBlock("td",{key:q.field},[q.editor===e.unref(P).AUTO_SEQ.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(h+1),1)],64)):e.unref(I)(q.editor).hasFormula?(e.openBlock(),e.createElementBlock("span",oa,e.toDisplayString(e.unref(G)(q.formula||"0",u).toFixed(2)),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(u[q.field]),1)],64))]))),128)),e.createElementVNode("td",{class:"qukt-op-cell",onClick:r[0]||(r[0]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("button",{class:"qukt-row-btn",onClick:q=>i(h)},"编辑",8,na),e.createElementVNode("button",{class:"qukt-row-btn danger",onClick:q=>x(h)},"删除",8,ia)])],8,la))),128))])])])):e.createCommentVNode("",!0),U.value?(e.openBlock(),e.createElementBlock("div",{key:4,class:"qukt-de-mask",onClick:r[3]||(r[3]=e.withModifiers(u=>U.value=!1,["self"]))},[e.createElementVNode("div",aa,[e.createElementVNode("div",sa,[e.createElementVNode("span",null,e.toDisplayString(A.value==="edit"?"编辑明细":"添加明细"),1),e.createElementVNode("button",{class:"qukt-de-close",onClick:r[1]||(r[1]=u=>U.value=!1)},"✕")]),e.createElementVNode("div",ra,[e.createElementVNode("div",da,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,u=>(e.openBlock(),e.createElementBlock("div",{key:u.field,class:e.normalizeClass(["qukt-form-cell",{full:u.editor===e.unref(P).TEXTAREA.value}])},[e.createElementVNode("label",ca,e.toDisplayString(u.title),1),u.editor===e.unref(P).INPUT.value||u.editor===void 0?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,class:"qukt-cell-input","onUpdate:modelValue":h=>D.value[u.field]=h,placeholder:u.title},null,8,ma)),[[e.vModelText,D.value[u.field]]]):u.editor===e.unref(P).NUMBER.value?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:1,class:"qukt-cell-input",type:"number",step:u.step??(u.min??0)<1?"0.01":"1",min:u.min,max:u.max,"onUpdate:modelValue":h=>D.value[u.field]=h},null,8,pa)),[[e.vModelText,D.value[u.field],void 0,{number:!0}]]):u.editor===e.unref(P).TEXTAREA.value?e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{key:2,class:"qukt-cell-input",rows:"3","onUpdate:modelValue":h=>D.value[u.field]=h,placeholder:u.title},null,8,ua)),[[e.vModelText,D.value[u.field]]]):e.unref(I)(u.editor).hasDict?e.withDirectives((e.openBlock(),e.createElementBlock("select",{key:3,class:"qukt-cell-input","onUpdate:modelValue":h=>D.value[u.field]=h},[r[9]||(r[9]=e.createElementVNode("option",{value:""},"-- 请选择 --",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.dict||[],h=>(e.openBlock(),e.createElementBlock("option",{key:h,value:h},e.toDisplayString(h),9,ka))),128))],8,fa)),[[e.vModelSelect,D.value[u.field]]]):e.createCommentVNode("",!0)],2))),128))])]),e.createElementVNode("div",ba,[e.createElementVNode("button",{class:"qukt-btn",onClick:r[2]||(r[2]=u=>U.value=!1)},"取消"),e.createElementVNode("button",{class:"qukt-btn qukt-btn-primary",onClick:c},"确定")])])])):e.createCommentVNode("",!0)]))}},be={title:"总体预览",excel:!0,print:!0,json:!0};function ya(){const t=e.ref(!1),o=e.reactive({tpl:null,data:null,config:{...be}});function l(k,p,m={}){o.tpl=k,o.data=p,o.config={...be,...m},t.value=!0}function a(){t.value=!1}return{open:t,current:o,openPreview:l,closePreview:a}}function Ea(t,o,l={}){const a={...be,...l},k=document.createElement("div");document.body.appendChild(k);const p=e.createApp({setup(){const m=e.ref(!1);function N(){m.value=!0,setTimeout(()=>{p.unmount(),k.parentNode&&k.parentNode.removeChild(k)},50)}return()=>m.value?null:e.h(Ie,{tpl:t,data:o,config:a,onClose:N})}});p.mount(k)}O.QuokitData=ha,O.QuokitPreview=Ie,O.QuokitSheet=ue,O.QuokitTemplate=Pi,O.generateMockRows=je,O.getConfig=Kt,O.openPreviewStatic=Ea,O.resetConfig=vt,O.setConfig=Zt,O.useColumns=We,O.usePreview=ya,O.useSections=fe,O.useSummary=Pe,Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})});
|
|
15
|
+
}</pre><p>例如模板 TPL-001 按 <code>system_name</code>(系统名称)分组,相同系统名称的多条明细会自动合并成一个单元格,每组末尾自动生成小计行。</p></section><section class="qukt-help-section"><h4>📝 切换到「填写数据」</h4><p>模板设计好后,点顶部的"下一步"进入填写数据页面,注意:</p><ul><li>点 ➕ 添加新条目,会弹出表单,表单字段完全根据你的模板表头列生成</li><li>分组字段(如 <code>system_name</code>)会自动继承上一行的值,让同组合并不间断</li><li>右侧"实时汇总"卡片会根据汇总区域配置动态显示</li></ul></section><section class="qukt-help-section qukt-tip-box final-tip"> 🎯 <b>推荐操作顺序:</b>选一个最接近的示例模板 → 点"另存为新模板"复制一份 → 按需要改表头列 / 头部信息 / 汇总项 → 保存 → 下一步填写数据 → 导出 Excel </section></div>`,1))])])):e.createCommentVNode("",!0)}},Mi={class:"qukt-designer"},Ai={class:"qukt-tabs"},Li={key:0,class:"qukt-tab-content"},zi={key:1,class:"qukt-tab-content"},Oi={key:2,class:"qukt-tab-content"},Ri={key:3,class:"qukt-tab-content"},Ii={key:4,class:"qukt-tab-content qukt-tab-content-preview"},Pi={__name:"QuokitTemplate",props:{tpl:{type:Object,default:pe},breakpoint:{type:Number,default:1100}},emits:["update:tpl"],setup(t,{expose:o,emit:l}){const a=t,k=l,p=e.ref("cols"),m=e.ref(!1),N=e.ref(!1),g=Pe([],{}),q=fe([]),d=fe([]),f=We([]);let V="";const U=e.computed(()=>se({columns:g.tpl.columns,group_rules:g.tpl.group_rules,header_sections:q.toTpl(),footer_sections:d.toTpl(),summary_fields:f.toTpl()}));e.watch(()=>a.tpl,()=>{const x=se(a.tpl);Y(x,U.value)||(g.setColumns(a.tpl.columns),g.setGroupRules(a.tpl.group_rules),q.setSections(a.tpl.header_sections),d.setSections(a.tpl.footer_sections),f.setFields(a.tpl.summary_fields))},{immediate:!0});const A=Ke(x=>{k("update:tpl",x)},200);e.watch(U,()=>{const x=JSON.stringify(U.value);x!==V&&(V=x,A(U.value))},{deep:!0}),e.onMounted(()=>{k("update:tpl",U.value)}),e.onBeforeUnmount(()=>{A.cancel()});const L=e.computed(()=>U.value);return o({getTemplateJSON(){return U.value},showHelp(){m.value=!0}}),(x,b)=>(e.openBlock(),e.createElementBlock("div",Mi,[e.createElementVNode("div",Ai,[e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:p.value==="cols"}]),onClick:b[0]||(b[0]=c=>p.value="cols")},"① 表头列",2),e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:p.value==="header"}]),onClick:b[1]||(b[1]=c=>p.value="header")},"② 页面头部",2),e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:p.value==="summary"}]),onClick:b[2]||(b[2]=c=>p.value="summary")},"③ 汇总区域",2),e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:p.value==="footer"}]),onClick:b[3]||(b[3]=c=>p.value="footer")},"④ 页面底部",2),e.createElementVNode("div",{class:e.normalizeClass(["qukt-tab",{active:p.value==="preview"}]),onClick:b[4]||(b[4]=c=>p.value="preview")},"⑤ 总体预览",2)]),p.value==="cols"?(e.openBlock(),e.createElementBlock("div",Li,[e.createVNode(Xl,{columns:e.unref(g).columns,"onUpdate:columns":b[5]||(b[5]=c=>e.unref(g).columns=c),"group-rules":e.unref(g).groupRules,"onUpdate:groupRules":b[6]||(b[6]=c=>e.unref(g).groupRules=c),onHelp:b[7]||(b[7]=c=>m.value=!0),onOpenGroup:b[8]||(b[8]=c=>N.value=!0)},null,8,["columns","group-rules"])])):e.createCommentVNode("",!0),p.value==="header"?(e.openBlock(),e.createElementBlock("div",zi,[e.createVNode(en,{sections:e.unref(q).sections,"onUpdate:sections":b[9]||(b[9]=c=>e.unref(q).sections=c),breakpoint:t.breakpoint},null,8,["sections","breakpoint"])])):e.createCommentVNode("",!0),p.value==="summary"?(e.openBlock(),e.createElementBlock("div",Oi,[e.createVNode(Di,{fields:e.unref(f).fields,"onUpdate:fields":b[10]||(b[10]=c=>e.unref(f).fields=c),breakpoint:t.breakpoint},null,8,["fields","breakpoint"])])):e.createCommentVNode("",!0),p.value==="footer"?(e.openBlock(),e.createElementBlock("div",Ri,[e.createVNode(Yn,{sections:e.unref(d).sections,"onUpdate:sections":b[11]||(b[11]=c=>e.unref(d).sections=c),breakpoint:t.breakpoint},null,8,["sections","breakpoint"])])):e.createCommentVNode("",!0),p.value==="preview"?(e.openBlock(),e.createElementBlock("div",Ii,[e.createVNode(ue,{tpl:L.value},null,8,["tpl"])])):e.createCommentVNode("",!0),e.createVNode(Ui,{visible:m.value,onClose:b[12]||(b[12]=c=>m.value=!1)},null,8,["visible"]),e.createVNode(no,{visible:N.value,columns:e.unref(g).columns,"group-rules":e.unref(g).groupRules,"onUpdate:groupRules":b[13]||(b[13]=c=>e.unref(g).groupRules=c),onClose:b[14]||(b[14]=c=>N.value=!1)},null,8,["visible","columns","group-rules"])]))}},Wi={class:"qukt-page"},ji={key:0,class:"qukt-bind-section"},Ji={class:"qukt-bind-grid"},Qi={class:"qukt-bind-label"},Xi=["value","onInput","placeholder"],Gi={key:1,class:"qukt-bind-section"},Hi={class:"qukt-bind-grid"},Yi={class:"qukt-bind-label"},Ki=["value","onInput","placeholder"],Zi={key:2,class:"qukt-empty-tip"},vi={key:3,class:"qukt-data-table"},ea={class:"qukt-main-table"},ta=["onClick"],la={key:1,class:"qukt-subtotal"},oa=["onClick"],na=["onClick"],ia={class:"qukt-de-dialog"},aa={class:"qukt-de-header"},sa={class:"qukt-de-content"},ra={class:"qukt-form-grid"},da={class:"qukt-form-cell-label"},ca=["onUpdate:modelValue","placeholder"],ma=["step","min","max","onUpdate:modelValue"],pa=["onUpdate:modelValue","placeholder"],ua=["onUpdate:modelValue"],fa=["value"],ka={class:"qukt-de-footer"},ba={__name:"QuokitData",props:{tpl:{type:Object,default:pe},data:{type:Object,default:()=>({headerData:{},rows:[],footerData:{}})}},emits:["update:data"],setup(t,{emit:o}){const l=t,a=o;function k(E){const r=E||{},u=!("headerData"in r)||!("rows"in r)||!("footerData"in r);return{next:{headerData:r.headerData||{},rows:r.rows||[],footerData:r.footerData||{}},changed:u}}e.watch(()=>l.data,E=>{const{next:r,changed:u}=k(E);u&&a("update:data",r)},{immediate:!0}),e.onMounted(()=>{a("update:data",k(l.data).next)});const p=e.computed(()=>se(l.tpl)),m=e.computed(()=>ze(p.value.header_sections)),N=e.computed(()=>ze(p.value.footer_sections)),g=e.computed({get:()=>{var E;return((E=l.data)==null?void 0:E.headerData)||{}},set:E=>a("update:data",{...l.data,headerData:E})}),q=e.computed({get:()=>{var E;return((E=l.data)==null?void 0:E.footerData)||{}},set:E=>a("update:data",{...l.data,footerData:E})}),d=e.computed(()=>{var E;return((E=l.data)==null?void 0:E.rows)||[]}),f=e.computed(()=>p.value.columns),V=e.computed(()=>f.value.filter(E=>I(E.editor).editable)),U=e.ref(!1),A=e.ref("add"),L=e.ref(-1),x=e.ref({});function b(){const E={};for(const r of V.value)r.editor===W.NUMBER.value?E[r.field]=r.default??r.min??0:E[r.field]=r.default??"";return E}function c(E,r){var u;a("update:data",{...l.data,headerData:{...((u=l.data)==null?void 0:u.headerData)||{},[E]:r}})}function i(E,r){var u;a("update:data",{...l.data,footerData:{...((u=l.data)==null?void 0:u.footerData)||{},[E]:r}})}function h(){A.value="add",L.value=-1,x.value=b(),U.value=!0}function n(E){A.value="edit",L.value=E,x.value={...d.value[E]},U.value=!0}function $(E){if(!confirm("确定删除这条明细?"))return;const r=[...d.value];r.splice(E,1),a("update:data",{...l.data,rows:r})}function s(){if(A.value==="edit"){const E=[...d.value];E[L.value]={...x.value},a("update:data",{...l.data,rows:E})}else a("update:data",{...l.data,rows:[...d.value,{...x.value}]});U.value=!1}return(E,r)=>(e.openBlock(),e.createElementBlock("div",Wi,[e.createElementVNode("div",{class:"qukt-toolbar"},[r[4]||(r[4]=e.createElementVNode("span",{class:"qukt-tip"},"点击行可快速编辑,预估总价会自动计算",-1)),e.createElementVNode("div",{class:"qukt-btn-group-inline"},[e.createElementVNode("button",{class:"qukt-btn",onClick:h},"+ 添加新条目")])]),m.value.length>0?(e.openBlock(),e.createElementBlock("div",ji,[r[5]||(r[5]=e.createElementVNode("div",{class:"qukt-bind-title"},"📌 头部信息",-1)),e.createElementVNode("div",Ji,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.value,u=>(e.openBlock(),e.createElementBlock("div",{key:"h-"+u.field,class:"qukt-bind-item"},[e.createElementVNode("label",Qi,e.toDisplayString(u.label||u.field),1),e.createElementVNode("input",{class:"qukt-cell-input",value:g.value[u.field]??"",onInput:y=>c(u.field,y.target.value),placeholder:"请输入"+(u.label||u.field)},null,40,Xi)]))),128))])])):e.createCommentVNode("",!0),N.value.length>0?(e.openBlock(),e.createElementBlock("div",Gi,[r[6]||(r[6]=e.createElementVNode("div",{class:"qukt-bind-title"},"📌 底部信息",-1)),e.createElementVNode("div",Hi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.value,u=>(e.openBlock(),e.createElementBlock("div",{key:"f-"+u.field,class:"qukt-bind-item"},[e.createElementVNode("label",Yi,e.toDisplayString(u.label||u.field),1),e.createElementVNode("input",{class:"qukt-cell-input",value:q.value[u.field]??"",onInput:y=>i(u.field,y.target.value),placeholder:"请输入"+(u.label||u.field)},null,40,Ki)]))),128))])])):e.createCommentVNode("",!0),d.value.length===0?(e.openBlock(),e.createElementBlock("div",Zi,[...r[7]||(r[7]=[e.createElementVNode("div",{class:"qukt-empty-icon"},"📋",-1),e.createElementVNode("div",{class:"qukt-empty-text"},"暂无数据,点击下方按钮添加第一条明细",-1)])])):e.createCommentVNode("",!0),d.value.length>0?(e.openBlock(),e.createElementBlock("div",vi,[e.createElementVNode("table",ea,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,u=>(e.openBlock(),e.createElementBlock("th",{key:u.field,style:e.normalizeStyle({width:u.width+"px"})},e.toDisplayString(u.title),5))),128)),r[8]||(r[8]=e.createElementVNode("th",{width:"140"},"操作",-1))])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(u,y)=>(e.openBlock(),e.createElementBlock("tr",{key:y,onClick:_=>n(y)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,_=>(e.openBlock(),e.createElementBlock("td",{key:_.field},[_.editor===e.unref(W).AUTO_SEQ.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(y+1),1)],64)):e.unref(I)(_.editor).hasFormula?(e.openBlock(),e.createElementBlock("span",la,e.toDisplayString(e.unref(G)(_.formula||"0",u).toFixed(2)),1)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(u[_.field]),1)],64))]))),128)),e.createElementVNode("td",{class:"qukt-op-cell",onClick:r[0]||(r[0]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("button",{class:"qukt-row-btn",onClick:_=>n(y)},"编辑",8,oa),e.createElementVNode("button",{class:"qukt-row-btn danger",onClick:_=>$(y)},"删除",8,na)])],8,ta))),128))])])])):e.createCommentVNode("",!0),U.value?(e.openBlock(),e.createElementBlock("div",{key:4,class:"qukt-de-mask",onClick:r[3]||(r[3]=e.withModifiers(u=>U.value=!1,["self"]))},[e.createElementVNode("div",ia,[e.createElementVNode("div",aa,[e.createElementVNode("span",null,e.toDisplayString(A.value==="edit"?"编辑明细":"添加明细"),1),e.createElementVNode("button",{class:"qukt-de-close",onClick:r[1]||(r[1]=u=>U.value=!1)},"✕")]),e.createElementVNode("div",sa,[e.createElementVNode("div",ra,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V.value,u=>(e.openBlock(),e.createElementBlock("div",{key:u.field,class:e.normalizeClass(["qukt-form-cell",{full:u.editor===e.unref(W).TEXTAREA.value}])},[e.createElementVNode("label",da,e.toDisplayString(u.title),1),u.editor===e.unref(W).INPUT.value||u.editor===void 0?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,class:"qukt-cell-input","onUpdate:modelValue":y=>x.value[u.field]=y,placeholder:u.title},null,8,ca)),[[e.vModelText,x.value[u.field]]]):u.editor===e.unref(W).NUMBER.value?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:1,class:"qukt-cell-input",type:"number",step:u.step??(u.min??0)<1?"0.01":"1",min:u.min,max:u.max,"onUpdate:modelValue":y=>x.value[u.field]=y},null,8,ma)),[[e.vModelText,x.value[u.field],void 0,{number:!0}]]):u.editor===e.unref(W).TEXTAREA.value?e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{key:2,class:"qukt-cell-input",rows:"3","onUpdate:modelValue":y=>x.value[u.field]=y,placeholder:u.title},null,8,pa)),[[e.vModelText,x.value[u.field]]]):e.unref(I)(u.editor).hasDict?e.withDirectives((e.openBlock(),e.createElementBlock("select",{key:3,class:"qukt-cell-input","onUpdate:modelValue":y=>x.value[u.field]=y},[r[9]||(r[9]=e.createElementVNode("option",{value:""},"-- 请选择 --",-1)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.dict||[],y=>(e.openBlock(),e.createElementBlock("option",{key:y,value:y},e.toDisplayString(y),9,fa))),128))],8,ua)),[[e.vModelSelect,x.value[u.field]]]):e.createCommentVNode("",!0)],2))),128))])]),e.createElementVNode("div",ka,[e.createElementVNode("button",{class:"qukt-btn",onClick:r[2]||(r[2]=u=>U.value=!1)},"取消"),e.createElementVNode("button",{class:"qukt-btn qukt-btn-primary",onClick:s},"确定")])])])):e.createCommentVNode("",!0)]))}},be={title:"总体预览",excel:!0,print:!0,json:!0};function ha(){const t=e.ref(!1),o=e.reactive({tpl:null,data:null,config:{...be}});function l(k,p,m={}){o.tpl=k,o.data=p,o.config={...be,...m},t.value=!0}function a(){t.value=!1}return{open:t,current:o,openPreview:l,closePreview:a}}function Ge(t,o,l={}){const a={...be,...l},k=document.createElement("div");document.body.appendChild(k);const p=e.createApp({setup(){const m=e.ref(!1);function N(){m.value=!0,setTimeout(()=>{p.unmount(),k.parentNode&&k.parentNode.removeChild(k)},50)}return()=>m.value?null:e.h(Ie,{tpl:t,data:o,config:a,onClose:N})}});p.mount(k)}function ya(t,o={}){Ge(t,null,{title:"模板预览",excel:!1,print:!1,json:!1,...o})}R.QuokitData=ba,R.QuokitPreview=Ie,R.QuokitSheet=ue,R.QuokitTemplate=Pi,R.getConfig=Kt,R.openPreview=Ge,R.openTemplatePreview=ya,R.resetConfig=Zt,R.setConfig=Yt,R.useColumns=Pe,R.usePreview=ha,R.useSections=fe,R.useSummary=We,Object.defineProperty(R,Symbol.toStringTag,{value:"Module"})});
|