Kaynağa Gözat

部位台账,提供下载部位台账Excel

MaiXinRong 5 yıl önce
ebeveyn
işleme
7e5ad7526f

+ 42 - 0
app/public/js/ledger_bwtz.js

@@ -105,4 +105,46 @@ $(document).ready(() => {
             }
         });
     })('a[name=showLevel]', xmjSheet);
+
+    $('#exportBwtz').click(function () {
+        const data = [];
+        const setting = {
+            cols: [
+                {title: '项目节编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 100, formatter: '@'},
+                {title: '清单编号', colSpan: '1', rowSpan: '2', field: 'b_code', hAlign: 0, width: 70, formatter: '@'},
+                {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 300, formatter: '@'},
+                {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 60, formatter: '@'},
+                {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 80, type: 'Number'},
+                {title: '台账|数量', colSpan: '2|1', rowSpan: '1|1', field: 'quantity', hAlign: 2, width: 80, type: 'Number'},
+                {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'total_price', hAlign: 2, width: 80, type: 'Number'},
+                {title: '图(册)号', colSpan: '1', rowSpan: '2', field: 'drawing_code', hAlign: 0, width: 100, formatter: '@'},
+                {title: '备注', colSpan: '1', rowSpan: '2', field: 'memo', hAlign: 0, width: 100, formatter: '@'},
+            ],
+            headRows: 2,
+            headRowHeight: [25, 25],
+            defaultRowHeight: 21,
+            headerFont: 'bold 10px 微软雅黑',
+            font: '10px 微软雅黑'
+        };
+        if (!xmjSheet.zh_tree) return;
+        for (const node of xmjSheet.zh_tree.nodes) {
+            data.push({
+                code: node.code, b_code: node.b_code, name: node.name, unit: node.unit,
+                unit_price: node.unit_price, quantity: node.quantity, total_price: node.total_price,
+                drawing_code: node.drawing_code, memo: node.memo
+            });
+            if (node.unitTree) {
+                for (const unitNode of node.unitTree.nodes) {
+                    data.push({
+                        code: unitNode.code, b_code: unitNode.b_code,
+                        name: unitNode.pos_name ? unitNode.pos_name : unitNode.name, unit: unitNode.unit,
+                        unit_price: unitNode.unit_price, quantity: unitNode.quantity, total_price: unitNode.total_price,
+                        drawing_code: unitNode.drawing_code, memo: unitNode.memo
+                    });
+                }
+            }
+        }
+
+        SpreadExcelObj.exportSimpleXlsxSheet(setting, data, $('h2')[0].innerHTML + "-部位台账.xlsx");
+    });
 });

+ 67 - 0
app/public/js/stage_bwtz.js

@@ -123,4 +123,71 @@ $(document).ready(() => {
         const tag = $(this).attr('tag');
         loadData(tag);
     });
+
+    $('#exportBwtz').click(function () {
+        const data = [];
+        const setting = {
+            cols: [
+                {title: '项目节编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 100, formatter: '@'},
+                {title: '清单编号', colSpan: '1', rowSpan: '2', field: 'b_code', hAlign: 0, width: 70, formatter: '@'},
+                {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 300, formatter: '@'},
+                {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 60, formatter: '@'},
+                {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 80, type: 'Number'},
+                {title: '台账|数量', colSpan: '2|1', rowSpan: '1|1', field: 'quantity', hAlign: 2, width: 80, type: 'Number'},
+                {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'total_price', hAlign: 2, width: 80, type: 'Number'},
+                {title: '本期合同计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'contract_qty', hAlign: 2, width: 60, type: 'Number'},
+                {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'contract_tp', hAlign: 2, width: 60, type: 'Number'},
+                {title: '本期数量变更|数量', colSpan: '3|1', rowSpan: '1|1', field: 'qc_qty', hAlign: 2, width: 60, type: 'Number'},
+                {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'qc_tp', hAlign: 2, width: 60, type: 'Number'},
+                {title: '|变更令', colSpan: '|1', rowSpan: '|1', field: 'bgl_code', hAlign: 2, width: 60, formatter: '@'},
+                {title: '本期完成计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'gather_qty', hAlign: 2, width: 60, type: 'Number'},
+                {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'gather_tp', hAlign: 2, width: 60, type: 'Number'},
+                {title: '截止本期合同计量|数量', colSpan: '2|1', rowSpan: '1|1', field: 'end_contract_qty', hAlign: 2, width: 60, type: 'Number'},
+                {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_contract_tp', hAlign: 2, width: 60, type: 'Number'},
+                {title: '截止本期数量变更|数量', colSpan: '2|1', rowSpan: '1|1', field: 'end_qc_qty', hAlign: 2, width: 60, type: 'Number'},
+                {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_qc_tp', hAlign: 2, width: 60, type: 'Number'},
+                {title: '截止本期完成计量|数量', colSpan: '3|1', rowSpan: '1|1', field: 'end_gather_qty', hAlign: 2, width: 60, type: 'Number'},
+                {title: '|金额', colSpan: '|1', rowSpan: '|1', field: 'end_gather_tp', hAlign: 2, width: 60, type: 'Number'},
+                {title: '|完成率(%)', colSpan: '1', rowSpan: '|1', field: 'end_gather_percent', hAlign: 2, width: 60, type: 'Number'},
+                {title: '图(册)号', colSpan: '1', rowSpan: '2', field: 'drawing_code', hAlign: 0, width: 100, formatter: '@'},
+                {title: '本期批注', colSpan: '1', rowSpan: '2', field: 'postil', hAlign: 0, width: 100, formatter: '@'},
+                {title: '备注', colSpan: '1', rowSpan: '2', field: 'memo', hAlign: 0, width: 100, formatter: '@'},
+            ],
+            headRows: 2,
+            headRowHeight: [25, 25],
+            defaultRowHeight: 21,
+            headerFont: 'bold 10px 微软雅黑',
+            font: '10px 微软雅黑'
+        };
+        if (!xmjSheet.zh_tree) return;
+        for (const node of xmjSheet.zh_tree.nodes) {
+            data.push({
+                code: node.code, b_code: node.b_code, name: node.name, unit: node.unit,
+                unit_price: node.unit_price, quantity: node.quantity, total_price: node.total_price,
+                contract_tp: node.contract_tp, qc_tp: node.qc_tp, gather_tp: node.gather_tp,
+                end_contract_tp: node.end_contract_tp, end_qc_tp: node.end_qc_tp, end_gather_tp: node.end_gather_tp,
+                end_gather_percent: node.end_gather_percent,
+                drawing_code: node.drawing_code, postil: node.postil, memo: node.memo
+            });
+            if (node.unitTree) {
+                for (const unitNode of node.unitTree.nodes) {
+                    data.push({
+                        code: unitNode.code, b_code: unitNode.b_code,
+                        name: unitNode.pos_name ? unitNode.pos_name : unitNode.name, unit: unitNode.unit,
+                        unit_price: unitNode.unit_price, quantity: unitNode.quantity, total_price: unitNode.total_price,
+                        contract_qty: unitNode.contract_qty, contract_tp: unitNode.contract_tp,
+                        qc_qty: unitNode.qc_qty, qc_tp: unitNode.qc_tp,
+                        gather_qty: unitNode.gather_qty, gather_tp: unitNode.gather_tp,
+                        end_contract_qty: unitNode.end_contract_qty, end_contract_tp: unitNode.end_contract_tp,
+                        end_qc_qty: unitNode.end_qc_qty, end_qc_tp: unitNode.end_qc_tp,
+                        end_gather_qty: unitNode.end_gather_qty, end_gather_tp: unitNode.end_gather_tp,
+                        end_gather_percent: unitNode.end_gather_percent,
+                        drawing_code: unitNode.drawing_code, postil: unitNode.postil_merge, memo: unitNode.memo
+                    });
+                }
+            }
+        }
+
+        SpreadExcelObj.exportSimpleXlsxSheet(setting, data, $('h2')[0].innerHTML + "-部位台账.xlsx");
+    });
 });

+ 5 - 0
app/view/ledger/bwtz.ejs

@@ -19,6 +19,11 @@
                         </div>
                     </div>
                 </div>
+                <% if (ctx.app.config.is_debug) { %>
+                <div class="d-inline-block ml-3">
+                    <a id="exportBwtz" class="btn btn-primary btn-sm" href="javascript: void(0)">下载部位台账Excel</a>
+                </div>
+                <% } %>
             </div>
             <div class="ml-auto">
             </div>

+ 5 - 0
app/view/stage/bwtz.ejs

@@ -32,6 +32,11 @@
                         </div>
                     </div>
                 </div>
+                <% if (ctx.app.config.is_debug) { %>
+                <div class="d-inline-block ml-3">
+                    <a id="exportBwtz" class="btn btn-primary btn-sm" href="javascript: void(0)">下载部位台账Excel</a>
+                </div>
+                <% } %>
             </div>
             <div class="ml-auto">
             </div>

+ 6 - 0
config/web.js

@@ -168,7 +168,10 @@ const JsFiles = {
             bwtz: {
                 files: [
                     "/public/js/spreadjs/sheets/v11/gc.spread.sheets.all.11.2.2.min.js",
+                    "/public/js/spreadjs/sheets/v11/interop/gc.spread.excelio.11.2.2.min.js",
                     "/public/js/decimal.min.js",
+                    "/public/js/file-saver/FileSaver.js",
+                    "/public/js/shares/export_excel.js",
                 ],
                 mergeFiles: [
                     "/public/js/sub_menu.js",
@@ -314,7 +317,10 @@ const JsFiles = {
             bwtz: {
                 files: [
                     "/public/js/spreadjs/sheets/v11/gc.spread.sheets.all.11.2.2.min.js",
+                    "/public/js/spreadjs/sheets/v11/interop/gc.spread.excelio.11.2.2.min.js",
                     "/public/js/decimal.min.js",
+                    "/public/js/file-saver/FileSaver.js",
+                    "/public/js/shares/export_excel.js",
                 ],
                 mergeFiles: [
                     "/public/js/sub_menu.js",