| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922 |
- <div class="panel-content">
- <div class="panel-title">
- <div class="title-main d-flex">
- <div class="title-main d-flex justify-content-between">
- 测试用模块
- </div>
- </div>
- </div>
- <div class="content-wrap">
- <div class="c-body">
- <div class="row mt-2 ml-2">
- <div class="col-5">
- <div class="form-group">
- <h6>测试报表指标</h6>
- <div class="card p-2">
- <div class="d-flex m-1">
- <div class="input-group input-group-sm w-75">
- <div class="input-group-prepend">
- <span class="input-group-text">指定数据源</span>
- </div>
- <select class="form-control m-0" id="st-rpt-source-type">
- <% for (const std of sourceType.sourceTypeData) { %>
- <option value="<%- std.id %>" stType="<%- std.key %>" stParams="<%- JSON.stringify(std.params) %>"><%- std.name %></option>
- <% } %>
- </select>
- </div>
- <div class="ml-auto">
- <button class="btn btn-sm btn-primary" id="st-rpt-check">查询</button>
- </div>
- </div>
- <div class="mt-1">
- <span>数据源 必须参数 <span class="text-danger">JSON</span>:</span>
- <textarea class="form-control form-control-sm mt-1" rows="6" id="st-rpt-params"></textarea>
- </div>
- <div class="mt-1">
- <div class="input-group input-group-sm">
- <div class="input-group-prepend">
- <span class="input-group-text">指标表</span>
- </div>
- <input class="form-control m-0" id="st-rpt-source-filters">
- </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>
- <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() {
- const data = { type: 'report', detail: { source_type: parseInt($('#st-rpt-source-type').val()) } };
- try {
- data.detail.params = JSON.parse($('#st-rpt-params').val());
- } catch (err) {
- toastr.error('必须参数:不是有效的json数据,请检查');
- return;
- }
- data.detail.source_filters = $('#st-rpt-source-filters').val().split(';');
- postData('devTest/load', data, function(result) {
- console.log(result);
- })
- });
- </script>
|