Procházet zdrojové kódy

报表测试页,显示可用指标

MaiXinRong před 17 hodinami
rodič
revize
5f58c16e86
1 změnil soubory, kde provedl 859 přidání a 1 odebrání
  1. 859 1
      app/view/spss/dev_test.ejs

+ 859 - 1
app/view/spss/dev_test.ejs

@@ -20,7 +20,7 @@
                                     </div>
                                     </div>
                                     <select class="form-control m-0" id="st-rpt-source-type">
                                     <select class="form-control m-0" id="st-rpt-source-type">
                                         <% for (const std of sourceType.sourceTypeData) { %>
                                         <% for (const std of sourceType.sourceTypeData) { %>
-                                        <option value="<%- std.id %>" stParams="<%- JSON.stringify(std.params) %>"><%- std.name %></option>
+                                        <option value="<%- std.id %>" stType="<%- std.key %>" stParams="<%- JSON.stringify(std.params) %>"><%- std.name %></option>
                                         <% } %>
                                         <% } %>
                                     </select>
                                     </select>
                                 </div>
                                 </div>
@@ -43,11 +43,869 @@
                         </div>
                         </div>
                     </div>
                     </div>
                 </div>
                 </div>
+                <div class="col-7 mb-2">
+                    <h6>数据源可用指标表</h6>
+                    <div class="card p-2">
+                        <div class="mt-1 scroll-y modal-height-600">
+                            <table class="table table-sm table-bordered table-hover" id="valid-table-list">
+                            </table>
+                        </div>
+                    </div>
+                </div>
             </div>
             </div>
         </div>
         </div>
     </div>
     </div>
 </div>
 </div>
 <script>
 <script>
+    const validTablePart = [
+        {
+            "id": 1,
+            "name": "标段&期",
+            "key": "tender",
+            "tables": [
+                {
+                    type: "advance",
+                    "tables": [
+                        "advance_pay"
+                    ]
+                },
+                {
+                    type: "budget",
+                    "tables": [
+                        "mem_budget_info",
+                        "mem_budget_gu",
+                        "mem_budget_gai",
+                        "mem_budget_yu",
+                        "mem_budget_zb",
+                        "mem_budget_final"
+                    ]
+                },
+                {
+                    type: "change",
+                    "tables": [
+                        "mem_change",
+                        "mem_change_bills",
+                        "mem_change_audit"
+                    ]
+                },
+                {
+                    type: "change_apply",
+                    "tables": [
+                        "mem_change_apply",
+                        "mem_change_apply_audit",
+                        "mem_change_apply_bills"
+                    ]
+                },
+                {
+                    type: "change_plan",
+                    "tables": [
+                        "mem_change_plan",
+                        "mem_change_plan_audit",
+                        "mem_change_plan_bills"
+                    ]
+                },
+                {
+                    type: "change_project",
+                    "tables": [
+                        "mem_change_project",
+                        "mem_change_project_audit"
+                    ]
+                },
+                {
+                    type: "contract",
+                    "tables": [
+                        "contract_tree_1",
+                        "contract_1",
+                        "contract_pay_1",
+                        "contract_tree_2",
+                        "contract_2",
+                        "contract_pay_2",
+                        "sp_contract_tree_1",
+                        "sp_contract_1",
+                        "sp_contract_pay_1",
+                        "sp_contract_tree_2",
+                        "sp_contract_2",
+                        "sp_contract_pay_2"
+                    ]
+                },
+                {
+                    type: "fenjian",
+                    "tables": [
+                        "mem_fj_change_progress",
+                        "mem_fj_change_sum"
+                    ]
+                },
+                {
+                    type: "fund",
+                    "tables": [
+                        "mem_financial_pay",
+                        "mem_financial_pay_contract",
+                        "mem_financial_pay_tender",
+                        "mem_financial_transfer",
+                        "mem_financial_transfer_tender",
+                        "mem_financial_pay_stage"
+                    ]
+                },
+                {
+                    type: "gather",
+                    "tables": [
+                        "mem_gather_stage_bills",
+                        "mem_gather_stage_pos",
+                        "mem_gather_tender_info",
+                        "mem_gather_stage_pay",
+                        "mem_gather_deal_bills",
+                        "mem_gather_change",
+                        "mem_gather_change_bills",
+                        "mem_gather_stage_change",
+                        "mem_gather_stage_jgcl",
+                        "mem_gather_stage_yjcl",
+                        "mem_gather_stage_bonus",
+                        "mem_gather_stage_other",
+                        "mem_gather_stage_safe_prod",
+                        "mem_gather_stage_temp_land",
+                        "mem_gather_advance_pay",
+                        "mem_gather_tender_cert"
+                    ]
+                },
+                {
+                    type: "import_change",
+                    "tables": [
+                        "mem_import_change",
+                        "mem_import_change_bills"
+                    ]
+                },
+                {
+                    type: "jh",
+                    "tables": [
+                        "mem_jh_im_change",
+                        "mem_jh_gather_im_change",
+                        "mem_jh_gather_stage_bills_compare"
+                    ]
+                },
+                {
+                    type: "material",
+                    "tables": [
+                        "mem_material",
+                        "mem_material_gl",
+                        "mem_material_bills",
+                        "mem_material_pos",
+                        "mem_material_gl_detail",
+                        "mem_material_stage",
+                        "mem_select_material",
+                        "mem_select_material_audit",
+                        "mem_material_gather_bills",
+                        "mem_material_gather_xmj",
+                        "mem_material_gather_gl"
+                    ]
+                },
+                {
+                    type: "material_sum",
+                    "tables": [
+                        "mem_material_sum_gl"
+                    ]
+                },
+                {
+                    type: "other",
+                    "tables": [
+                        "ledger_cooperation",
+                        "mem_month_progress",
+                        "mem_sign_select",
+                        "mem_tender_cert",
+                        "mem_pos_calc_detail"
+                    ]
+                },
+                {
+                    type: "phase_pay",
+                    "tables": [
+                        "mem_phase_pay",
+                        "mem_phase_pay_detail"
+                    ]
+                },
+                {
+                    type: "pm",
+                    "tables": [
+                        "mem_pm_deal_pay",
+                        "mem_pm_deal_tree"
+                    ]
+                },
+                {
+                    type: "project",
+                    "tables": [
+                        "construction_unit",
+                        "mem_calc_template"
+                    ]
+                },
+                {
+                    type: "rpt_analysis",
+                    "tables": [
+                        "mem_union_data",
+                        "mem_gcl_gather_bills",
+                        "mem_gcl_gather_xmj",
+                        "mem_master_converse"
+                    ]
+                },
+                {
+                    type: "rpt_custom",
+                    "tables": [
+                        "mem_custom_select"
+                    ]
+                },
+                {
+                    type: "schedule",
+                    "tables": [
+                        "mem_schedule",
+                        "mem_schedule_month",
+                        "mem_schedule_month"
+                    ]
+                },
+                {
+                    type: "spss",
+                    "tables": [
+                        "mem_spss_gather_info_tender",
+                        "mem_spss_gather_info",
+                        "mem_spss_gather_ledger_tender",
+                        "mem_spss_gather_ledger_bills",
+                        "mem_spss_gather_ledger_bills",
+                        "mem_spss_gather_stage_tender",
+                        "mem_spss_gather_stage_bills",
+                        "mem_spss_gather_stage_pos",
+                        "mem_spss_gather_stage_extra_tender",
+                        "mem_spss_gather_stage_jgcl",
+                        "mem_spss_gather_stage_yjcl",
+                        "mem_spss_gather_stage_bonus",
+                        "mem_spss_gather_stage_other",
+                        "mem_spss_gather_stage_safe_prod",
+                        "mem_spss_gather_stage_temp_land",
+                        "mem_spss_gather_stage_pay_tender",
+                        "mem_spss_gather_stage_pay",
+                        "mem_spss_compare_ledger_tender",
+                        "mem_spss_compare_ledger_bills",
+                        "mem_spss_compare_ledger_pos",
+                        "mem_spss_compare_stage_tender",
+                        "mem_spss_compare_stage_bills",
+                        "mem_spss_compare_stage_pos"
+                    ]
+                },
+                {
+                    type: "stage",
+                    "tables": [
+                        "mem_stages",
+                        "mem_stage_bills",
+                        "mem_stage_bills_compare",
+                        "mem_stage_pos",
+                        "mem_stage_pos_compare",
+                        "mem_stage_pay",
+                        "stage_audit",
+                        "mem_stage_audit_ass",
+                        "mem_stage_change",
+                        "mem_stage_change_bills",
+                        "mem_stage_change_ledger",
+                        "mem_change_info",
+                        "mem_change_info_bills",
+                        "mem_stage_import_change"
+                    ]
+                },
+                {
+                    type: "stage_extra",
+                    "tables": [
+                        "mem_stage_jgcl",
+                        "mem_stage_yjcl",
+                        "mem_stage_bonus",
+                        "mem_stage_other",
+                        "mem_stage_safe_prod",
+                        "mem_stage_temp_land"
+                    ]
+                },
+                {
+                    type: "stage_im",
+                    "tables": [
+                        "mem_stage_im_zl",
+                        "mem_stage_im_tz",
+                        "mem_stage_im_tz_bills"
+                    ]
+                },
+                {
+                    type: "stage_rela",
+                    "tables": [
+                        "mem_stage_rela_im",
+                        "mem_stage_rela_im_bills"
+                    ]
+                },
+                {
+                    type: "stage_sum",
+                    "tables": [
+                        "mem_stage_sum_bills",
+                        "mem_stage_sum_pos",
+                        "mem_stage_sum_pay"
+                    ]
+                },
+                {
+                    type: "tag",
+                    "tables": [
+                        "mem_ledger_tag",
+                        "mem_stage_tag",
+                        "mem_all_tag"
+                    ]
+                },
+                {
+                    type: "xj",
+                    "tables": [
+                        "mem_xj_material_calc"
+                    ]
+                }
+            ]
+        },
+        {
+            "id": 2,
+            "name": "合同支付",
+            "key": "phase_pay",
+            "tables": [
+                {
+                    type: "base",
+                    "tables": [
+                        "mem_phase_pay",
+                        "mem_phase_pay_detail"
+                    ]
+                },
+                {
+                    type: "rpt_analysis",
+                    "tables": [
+                        "mem_union_data",
+                        "mem_master_converse"
+                    ]
+                },
+                {
+                    type: "tender",
+                    "tables": [
+                        "mem_project",
+                        "mem_tender",
+                        "mem_tender_info"
+                    ]
+                }
+            ]
+        },
+        {
+            "id": 10,
+            "name": "预付款",
+            "key": "advance",
+            "tables": [
+                {
+                    type: "base",
+                    "tables": [
+                        "mem_advance",
+                        "mem_advance_audit",
+                        "mem_advance_file"
+                    ]
+                },
+                {
+                    type: "rpt_analysis",
+                    "tables": [
+                        "mem_union_data",
+                        "mem_master_converse"
+                    ]
+                },
+                {
+                    type: "tender",
+                    "tables": [
+                        "mem_project",
+                        "mem_tender",
+                        "mem_tender_info"
+                    ]
+                }
+            ]
+        },
+        {
+            "id": 20,
+            "name": "变更令",
+            "key": "change",
+            "tables": [
+                {
+                    type: "base",
+                    "tables": [
+                        "mem_change",
+                        "mem_change_bills",
+                        "mem_change_bills_recalc",
+                        "mem_change_audit",
+                        "mem_change_att"
+                    ]
+                },
+                {
+                    type: "multi",
+                    "tables": [
+                        "mem_change_ledger_bills",
+                        "mem_change_ledger_pos"
+                    ]
+                },
+                {
+                    type: "rpt_analysis",
+                    "tables": [
+                        "mem_union_data",
+                        "mem_master_converse"
+                    ]
+                },
+                {
+                    type: "tender",
+                    "tables": [
+                        "mem_project",
+                        "mem_tender",
+                        "mem_tender_info",
+                        "mem_deal_bills"
+                    ]
+                }
+            ]
+        },
+        {
+            "id": 21,
+            "name": "变更方案",
+            "key": "change_plan",
+            "tables": [
+                {
+                    type: "base",
+                    "tables": [
+                        "mem_change_plan",
+                        "mem_change_plan_bills",
+                        "mem_change_plan_audit",
+                        "mem_change_plan_att"
+                    ]
+                },
+                {
+                    type: "rpt_analysis",
+                    "tables": [
+                        "mem_union_data",
+                        "mem_master_converse"
+                    ]
+                },
+                {
+                    type: "tender",
+                    "tables": [
+                        "mem_project",
+                        "mem_tender",
+                        "mem_tender_info"
+                    ]
+                }
+            ]
+        },
+        {
+            "id": 22,
+            "name": "变更立项",
+            "key": "change_project",
+            "tables": [
+                {
+                    type: "base",
+                    "tables": [
+                        "mem_change_project",
+                        "mem_change_project_audit",
+                        "mem_change_project_att"
+                    ]
+                },
+                {
+                    type: "rpt_analysis",
+                    "tables": [
+                        "mem_union_data",
+                        "mem_master_converse"
+                    ]
+                },
+                {
+                    type: "tender",
+                    "tables": [
+                        "mem_project",
+                        "mem_tender",
+                        "mem_tender_info"
+                    ]
+                }
+            ]
+        },
+        {
+            "id": 23,
+            "name": "变更申请",
+            "key": "change_apply",
+            "tables": [
+                {
+                    type: "base",
+                    "tables": [
+                        "mem_change_apply",
+                        "mem_change_apply_bills",
+                        "mem_change_apply_audit",
+                        "mem_change_apply_att"
+                    ]
+                },
+                {
+                    type: "rpt_analysis",
+                    "tables": [
+                        "mem_union_data",
+                        "mem_master_converse"
+                    ]
+                },
+                {
+                    type: "tender",
+                    "tables": [
+                        "mem_project",
+                        "mem_tender",
+                        "mem_tender_info"
+                    ]
+                }
+            ]
+        },
+        {
+            "id": 30,
+            "name": "材料调差",
+            "key": "material",
+            "tables": [
+                {
+                    type: "base",
+                    "tables": [
+                        "mem_material",
+                        "mem_material_audit",
+                        "mem_material_gl",
+                        "mem_material_gl_detail",
+                        "mem_material_bills",
+                        "mem_material_pos",
+                        "mem_material_stage",
+                        "mem_material_exponent",
+                        "mem_material_gather_bills",
+                        "mem_material_gather_xmj",
+                        "mem_material_gather_gl",
+                        "mem_material_exponent_node",
+                        "mem_material_exponent_shard"
+                    ]
+                },
+                {
+                    type: "rpt_analysis",
+                    "tables": [
+                        "mem_union_data",
+                        "mem_master_converse"
+                    ]
+                },
+                {
+                    type: "tender",
+                    "tables": [
+                        "mem_project",
+                        "mem_tender",
+                        "mem_tender_info",
+                        "mem_deal_bills"
+                    ]
+                },
+                {
+                    type: "xj",
+                    "tables": [
+                        "mem_xj_material_calc"
+                    ]
+                }
+            ]
+        },
+        {
+            "id": 40,
+            "name": "安全计量",
+            "key": "safe_stage",
+            "tables": [
+                {
+                    type: "base",
+                    "tables": [
+                        "mem_safe_stage",
+                        "mem_safe_stage_audit"
+                    ]
+                },
+                {
+                    type: "bills",
+                    "tables": [
+                        "mem_safe_stage_bills",
+                        "mem_safe_stage_bills_compare"
+                    ]
+                },
+                {
+                    type: "rpt_analysis",
+                    "tables": [
+                        "mem_union_data",
+                        "mem_master_converse"
+                    ]
+                },
+                {
+                    type: "tender",
+                    "tables": [
+                        "mem_project",
+                        "mem_tender",
+                        "mem_tender_info"
+                    ]
+                }
+            ]
+        },
+        {
+            "id": 100,
+            "name": "支付审批",
+            "key": "payment",
+            "tables": [
+                {
+                    type: "base",
+                    "tables": [
+                        "mem_payment_tender",
+                        "mem_payment_tender_info",
+                        "mem_payment_detail"
+                    ]
+                },
+                {
+                    type: "rpt_analysis",
+                    "tables": [
+                        "mem_union_data",
+                        "mem_master_converse"
+                    ]
+                }
+            ]
+        },
+        {
+            "id": 101,
+            "name": "安全生产费",
+            "key": "payment_safe",
+            "tables": [
+                {
+                    type: "base",
+                    "tables": [
+                        "mem_payment_tender",
+                        "mem_payment_tender_info",
+                        "mem_payment_detail"
+                    ]
+                },
+                {
+                    type: "bills",
+                    "tables": [
+                        "mem_payment_safe_bills",
+                        "mem_payment_safe_bills_compare"
+                    ]
+                },
+                {
+                    type: "rpt_analysis",
+                    "tables": [
+                        "mem_union_data",
+                        "mem_master_converse"
+                    ]
+                }
+            ]
+        },
+        {
+            "id": 200,
+            "name": "动态投资",
+            "key": "budget",
+            "tables": [
+                {
+                    type: "base",
+                    "tables": [
+                        "mem_info",
+                        "mem_payment_tender_info",
+                        "mem_budget"
+                    ]
+                },
+                {
+                    type: "bills",
+                    "tables": [
+                        "mem_budget_gu",
+                        "mem_budget_gai",
+                        "mem_budget_yu",
+                        "mem_budget_zb",
+                        "mem_budget_final"
+                    ]
+                },
+                {
+                    type: "rpt_analysis",
+                    "tables": [
+                        "mem_union_data",
+                        "mem_master_converse"
+                    ]
+                }
+            ]
+        },
+        {
+            "id": 300,
+            "name": "合同管理",
+            "key": "contract",
+            "tables": [
+                {
+                    type: "base",
+                    "tables": [
+                        "sp_contract_tree_1",
+                        "sp_contract_1",
+                        "sp_contract_pay_1",
+                        "sp_contract_tree_2",
+                        "sp_contract_2",
+                        "sp_contract_pay_2",
+                        "contract_tree_1",
+                        "contract_1",
+                        "contract_pay_1",
+                        "contract_tree_2",
+                        "contract_2",
+                        "contract_pay_2"
+                    ]
+                },
+                {
+                    type: "rpt_analysis",
+                    "tables": [
+                        "mem_union_data",
+                        "mem_master_converse"
+                    ]
+                }
+            ]
+        },
+        {
+            "id": 400,
+            "name": "成本报审",
+            "key": "cost_ledger",
+            "params": {
+                "tender_id": 1,
+                "cost_stage_id": "uuid"
+            },
+            "tables": [
+                {
+                    type: "base",
+                    "tables": [
+                        "mem_cost_stage",
+                        "mem_cost_stage_audit"
+                    ]
+                },
+                {
+                    type: "bills",
+                    "tables": [
+                        "mem_cost_stage_ledger",
+                        "mem_cost_stage_ledger_compare",
+                        "mem_cost_stage_detail",
+                        "mem_cost_stage_detail_compare"
+                    ]
+                },
+                {
+                    type: "rpt_analysis",
+                    "tables": [
+                        "mem_union_data",
+                        "mem_master_converse"
+                    ]
+                },
+                {
+                    type: "tender",
+                    "tables": [
+                        "mem_project",
+                        "mem_tender",
+                        "mem_tender_info"
+                    ]
+                }
+            ]
+        },
+        {
+            "id": 401,
+            "name": "财务账面",
+            "key": "cost_book",
+            "params": {
+                "tender_id": 1,
+                "cost_stage_id": "uuid"
+            },
+            "tables": [
+                {
+                    type: "base",
+                    "tables": [
+                        "mem_cost_stage",
+                        "mem_cost_stage_audit"
+                    ]
+                },
+                {
+                    type: "bills",
+                    "tables": [
+                        "mem_cost_stage_book",
+                        "mem_cost_stage_book_compare",
+                        "mem_cost_stage_book_detail",
+                        "mem_cost_stage_detail_compare"
+                    ]
+                },
+                {
+                    type: "rpt_analysis",
+                    "tables": [
+                        "mem_union_data",
+                        "mem_master_converse"
+                    ]
+                },
+                {
+                    type: "tender",
+                    "tables": [
+                        "mem_project",
+                        "mem_tender",
+                        "mem_tender_info"
+                    ]
+                }
+            ]
+        },
+        {
+            "id": 402,
+            "name": "成本分析",
+            "key": "cost_analysis",
+            "params": {
+                "tender_id": 1,
+                "cost_stage_id": "uuid"
+            },
+            "tables": [
+                {
+                    type: "base",
+                    "tables": [
+                        "mem_cost_stage",
+                        "mem_cost_stage_audit"
+                    ]
+                },
+                {
+                    type: "bills",
+                    "tables": [
+                        "mem_cost_stage_analysis",
+                        "mem_cost_stage_analysis_compare",
+                        "mem_cost_stage_analysis_detail",
+                        "mem_cost_stage_analysis_detail_compare"
+                    ]
+                },
+                {
+                    type: "rpt_analysis",
+                    "tables": [
+                        "mem_union_data",
+                        "mem_master_converse"
+                    ]
+                },
+                {
+                    type: "tender",
+                    "tables": [
+                        "mem_project",
+                        "mem_tender",
+                        "mem_tender_info"
+                    ]
+                }
+            ]
+        }
+    ];
+    const testInfo = {
+        cost_ledger: { params: {tender_id: 5612, cost_stage_id: "920e0388-5c66-48c3-afa0-aede084b1417" }, table: 'mem_cost_stage;mem_cost_stage_audit;mem_cost_stage_ledger;mem_cost_stage_detail' },
+        cost_book: { params: {tender_id: 5612, cost_stage_id: "5a653840-32be-42d6-8943-ef412a55d148" }, table: 'mem_cost_stage;mem_cost_stage_audit;mem_cost_stage_book;mem_cost_stage_book_detail' },
+        cost_analysis: { params: {tender_id: 5612, cost_stage_id: "e9747d42-bf09-49a9-ac0b-91ccecb95bff" }, table: 'mem_cost_stage;mem_cost_stage_audit;mem_cost_stage_analysis;mem_cost_stage_analysis_detail' },
+    };
+    function chunkArray(array, size) {
+        const chunks = [];
+        for (let i = 0; i < array.length; i += size) {
+            // slice 不会修改原数组,返回从 i 开始到 i+size 的新数组
+            chunks.push(array.slice(i, i + size));
+        }
+        return chunks;
+    }
+    const loadValidTable = function(type) {
+        const vt = validTablePart.find(x => { return x.key === type; });
+        const html = [];
+        if (vt) {
+            for (const t of vt.tables) {
+                html.push(`<tr><th class="text-center" colspan="4">${t.type}</th></tr>`);
+                const partTables = chunkArray(t.tables, 4);
+                for (const pt of partTables) {
+                    html.push(`<tr><td>${pt[0] || ''}</td><td>${pt[1] || ''}</td><td>${pt[2] || ''}</td><td>${pt[3] || ''}</td></tr>`);
+                }
+            }
+        }
+        $('#valid-table-list').html(html.join(''));
+    }
+    loadValidTable('tender');
+    $('#st-rpt-source-type').change(function() {
+        const stType = $(`option[value=${this.value}]`).attr('stType');
+        if (testInfo[stType]) {
+            $('#st-rpt-params').val(JSON.stringify(testInfo[stType].params));
+            $('#st-rpt-source-filters').val(testInfo[stType].table);
+        }
+        loadValidTable(stType);
+    });
     $('#st-rpt-check').click(function() {
     $('#st-rpt-check').click(function() {
         const data = { type: 'report', detail: { source_type: parseInt($('#st-rpt-source-type').val()) } };
         const data = { type: 'report', detail: { source_type: parseInt($('#st-rpt-source-type').val()) } };
         try {
         try {