dev_test.ejs 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922
  1. <div class="panel-content">
  2. <div class="panel-title">
  3. <div class="title-main d-flex">
  4. <div class="title-main d-flex justify-content-between">
  5. 测试用模块
  6. </div>
  7. </div>
  8. </div>
  9. <div class="content-wrap">
  10. <div class="c-body">
  11. <div class="row mt-2 ml-2">
  12. <div class="col-5">
  13. <div class="form-group">
  14. <h6>测试报表指标</h6>
  15. <div class="card p-2">
  16. <div class="d-flex m-1">
  17. <div class="input-group input-group-sm w-75">
  18. <div class="input-group-prepend">
  19. <span class="input-group-text">指定数据源</span>
  20. </div>
  21. <select class="form-control m-0" id="st-rpt-source-type">
  22. <% for (const std of sourceType.sourceTypeData) { %>
  23. <option value="<%- std.id %>" stType="<%- std.key %>" stParams="<%- JSON.stringify(std.params) %>"><%- std.name %></option>
  24. <% } %>
  25. </select>
  26. </div>
  27. <div class="ml-auto">
  28. <button class="btn btn-sm btn-primary" id="st-rpt-check">查询</button>
  29. </div>
  30. </div>
  31. <div class="mt-1">
  32. <span>数据源 必须参数 <span class="text-danger">JSON</span>:</span>
  33. <textarea class="form-control form-control-sm mt-1" rows="6" id="st-rpt-params"></textarea>
  34. </div>
  35. <div class="mt-1">
  36. <div class="input-group input-group-sm">
  37. <div class="input-group-prepend">
  38. <span class="input-group-text">指标表</span>
  39. </div>
  40. <input class="form-control m-0" id="st-rpt-source-filters">
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. </div>
  46. <div class="col-7 mb-2">
  47. <h6>数据源可用指标表</h6>
  48. <div class="card p-2">
  49. <div class="mt-1 scroll-y modal-height-600">
  50. <table class="table table-sm table-bordered table-hover" id="valid-table-list">
  51. </table>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. <script>
  60. const validTablePart = [
  61. {
  62. "id": 1,
  63. "name": "标段&期",
  64. "key": "tender",
  65. "tables": [
  66. {
  67. type: "advance",
  68. "tables": [
  69. "advance_pay"
  70. ]
  71. },
  72. {
  73. type: "budget",
  74. "tables": [
  75. "mem_budget_info",
  76. "mem_budget_gu",
  77. "mem_budget_gai",
  78. "mem_budget_yu",
  79. "mem_budget_zb",
  80. "mem_budget_final"
  81. ]
  82. },
  83. {
  84. type: "change",
  85. "tables": [
  86. "mem_change",
  87. "mem_change_bills",
  88. "mem_change_audit"
  89. ]
  90. },
  91. {
  92. type: "change_apply",
  93. "tables": [
  94. "mem_change_apply",
  95. "mem_change_apply_audit",
  96. "mem_change_apply_bills"
  97. ]
  98. },
  99. {
  100. type: "change_plan",
  101. "tables": [
  102. "mem_change_plan",
  103. "mem_change_plan_audit",
  104. "mem_change_plan_bills"
  105. ]
  106. },
  107. {
  108. type: "change_project",
  109. "tables": [
  110. "mem_change_project",
  111. "mem_change_project_audit"
  112. ]
  113. },
  114. {
  115. type: "contract",
  116. "tables": [
  117. "contract_tree_1",
  118. "contract_1",
  119. "contract_pay_1",
  120. "contract_tree_2",
  121. "contract_2",
  122. "contract_pay_2",
  123. "sp_contract_tree_1",
  124. "sp_contract_1",
  125. "sp_contract_pay_1",
  126. "sp_contract_tree_2",
  127. "sp_contract_2",
  128. "sp_contract_pay_2"
  129. ]
  130. },
  131. {
  132. type: "fenjian",
  133. "tables": [
  134. "mem_fj_change_progress",
  135. "mem_fj_change_sum"
  136. ]
  137. },
  138. {
  139. type: "fund",
  140. "tables": [
  141. "mem_financial_pay",
  142. "mem_financial_pay_contract",
  143. "mem_financial_pay_tender",
  144. "mem_financial_transfer",
  145. "mem_financial_transfer_tender",
  146. "mem_financial_pay_stage"
  147. ]
  148. },
  149. {
  150. type: "gather",
  151. "tables": [
  152. "mem_gather_stage_bills",
  153. "mem_gather_stage_pos",
  154. "mem_gather_tender_info",
  155. "mem_gather_stage_pay",
  156. "mem_gather_deal_bills",
  157. "mem_gather_change",
  158. "mem_gather_change_bills",
  159. "mem_gather_stage_change",
  160. "mem_gather_stage_jgcl",
  161. "mem_gather_stage_yjcl",
  162. "mem_gather_stage_bonus",
  163. "mem_gather_stage_other",
  164. "mem_gather_stage_safe_prod",
  165. "mem_gather_stage_temp_land",
  166. "mem_gather_advance_pay",
  167. "mem_gather_tender_cert"
  168. ]
  169. },
  170. {
  171. type: "import_change",
  172. "tables": [
  173. "mem_import_change",
  174. "mem_import_change_bills"
  175. ]
  176. },
  177. {
  178. type: "jh",
  179. "tables": [
  180. "mem_jh_im_change",
  181. "mem_jh_gather_im_change",
  182. "mem_jh_gather_stage_bills_compare"
  183. ]
  184. },
  185. {
  186. type: "material",
  187. "tables": [
  188. "mem_material",
  189. "mem_material_gl",
  190. "mem_material_bills",
  191. "mem_material_pos",
  192. "mem_material_gl_detail",
  193. "mem_material_stage",
  194. "mem_select_material",
  195. "mem_select_material_audit",
  196. "mem_material_gather_bills",
  197. "mem_material_gather_xmj",
  198. "mem_material_gather_gl"
  199. ]
  200. },
  201. {
  202. type: "material_sum",
  203. "tables": [
  204. "mem_material_sum_gl"
  205. ]
  206. },
  207. {
  208. type: "other",
  209. "tables": [
  210. "ledger_cooperation",
  211. "mem_month_progress",
  212. "mem_sign_select",
  213. "mem_tender_cert",
  214. "mem_pos_calc_detail"
  215. ]
  216. },
  217. {
  218. type: "phase_pay",
  219. "tables": [
  220. "mem_phase_pay",
  221. "mem_phase_pay_detail"
  222. ]
  223. },
  224. {
  225. type: "pm",
  226. "tables": [
  227. "mem_pm_deal_pay",
  228. "mem_pm_deal_tree"
  229. ]
  230. },
  231. {
  232. type: "project",
  233. "tables": [
  234. "construction_unit",
  235. "mem_calc_template"
  236. ]
  237. },
  238. {
  239. type: "rpt_analysis",
  240. "tables": [
  241. "mem_union_data",
  242. "mem_gcl_gather_bills",
  243. "mem_gcl_gather_xmj",
  244. "mem_master_converse"
  245. ]
  246. },
  247. {
  248. type: "rpt_custom",
  249. "tables": [
  250. "mem_custom_select"
  251. ]
  252. },
  253. {
  254. type: "schedule",
  255. "tables": [
  256. "mem_schedule",
  257. "mem_schedule_month",
  258. "mem_schedule_month"
  259. ]
  260. },
  261. {
  262. type: "spss",
  263. "tables": [
  264. "mem_spss_gather_info_tender",
  265. "mem_spss_gather_info",
  266. "mem_spss_gather_ledger_tender",
  267. "mem_spss_gather_ledger_bills",
  268. "mem_spss_gather_ledger_bills",
  269. "mem_spss_gather_stage_tender",
  270. "mem_spss_gather_stage_bills",
  271. "mem_spss_gather_stage_pos",
  272. "mem_spss_gather_stage_extra_tender",
  273. "mem_spss_gather_stage_jgcl",
  274. "mem_spss_gather_stage_yjcl",
  275. "mem_spss_gather_stage_bonus",
  276. "mem_spss_gather_stage_other",
  277. "mem_spss_gather_stage_safe_prod",
  278. "mem_spss_gather_stage_temp_land",
  279. "mem_spss_gather_stage_pay_tender",
  280. "mem_spss_gather_stage_pay",
  281. "mem_spss_compare_ledger_tender",
  282. "mem_spss_compare_ledger_bills",
  283. "mem_spss_compare_ledger_pos",
  284. "mem_spss_compare_stage_tender",
  285. "mem_spss_compare_stage_bills",
  286. "mem_spss_compare_stage_pos"
  287. ]
  288. },
  289. {
  290. type: "stage",
  291. "tables": [
  292. "mem_stages",
  293. "mem_stage_bills",
  294. "mem_stage_bills_compare",
  295. "mem_stage_pos",
  296. "mem_stage_pos_compare",
  297. "mem_stage_pay",
  298. "stage_audit",
  299. "mem_stage_audit_ass",
  300. "mem_stage_change",
  301. "mem_stage_change_bills",
  302. "mem_stage_change_ledger",
  303. "mem_change_info",
  304. "mem_change_info_bills",
  305. "mem_stage_import_change"
  306. ]
  307. },
  308. {
  309. type: "stage_extra",
  310. "tables": [
  311. "mem_stage_jgcl",
  312. "mem_stage_yjcl",
  313. "mem_stage_bonus",
  314. "mem_stage_other",
  315. "mem_stage_safe_prod",
  316. "mem_stage_temp_land"
  317. ]
  318. },
  319. {
  320. type: "stage_im",
  321. "tables": [
  322. "mem_stage_im_zl",
  323. "mem_stage_im_tz",
  324. "mem_stage_im_tz_bills"
  325. ]
  326. },
  327. {
  328. type: "stage_rela",
  329. "tables": [
  330. "mem_stage_rela_im",
  331. "mem_stage_rela_im_bills"
  332. ]
  333. },
  334. {
  335. type: "stage_sum",
  336. "tables": [
  337. "mem_stage_sum_bills",
  338. "mem_stage_sum_pos",
  339. "mem_stage_sum_pay"
  340. ]
  341. },
  342. {
  343. type: "tag",
  344. "tables": [
  345. "mem_ledger_tag",
  346. "mem_stage_tag",
  347. "mem_all_tag"
  348. ]
  349. },
  350. {
  351. type: "xj",
  352. "tables": [
  353. "mem_xj_material_calc"
  354. ]
  355. }
  356. ]
  357. },
  358. {
  359. "id": 2,
  360. "name": "合同支付",
  361. "key": "phase_pay",
  362. "tables": [
  363. {
  364. type: "base",
  365. "tables": [
  366. "mem_phase_pay",
  367. "mem_phase_pay_detail"
  368. ]
  369. },
  370. {
  371. type: "rpt_analysis",
  372. "tables": [
  373. "mem_union_data",
  374. "mem_master_converse"
  375. ]
  376. },
  377. {
  378. type: "tender",
  379. "tables": [
  380. "mem_project",
  381. "mem_tender",
  382. "mem_tender_info"
  383. ]
  384. }
  385. ]
  386. },
  387. {
  388. "id": 10,
  389. "name": "预付款",
  390. "key": "advance",
  391. "tables": [
  392. {
  393. type: "base",
  394. "tables": [
  395. "mem_advance",
  396. "mem_advance_audit",
  397. "mem_advance_file"
  398. ]
  399. },
  400. {
  401. type: "rpt_analysis",
  402. "tables": [
  403. "mem_union_data",
  404. "mem_master_converse"
  405. ]
  406. },
  407. {
  408. type: "tender",
  409. "tables": [
  410. "mem_project",
  411. "mem_tender",
  412. "mem_tender_info"
  413. ]
  414. }
  415. ]
  416. },
  417. {
  418. "id": 20,
  419. "name": "变更令",
  420. "key": "change",
  421. "tables": [
  422. {
  423. type: "base",
  424. "tables": [
  425. "mem_change",
  426. "mem_change_bills",
  427. "mem_change_bills_recalc",
  428. "mem_change_audit",
  429. "mem_change_att"
  430. ]
  431. },
  432. {
  433. type: "multi",
  434. "tables": [
  435. "mem_change_ledger_bills",
  436. "mem_change_ledger_pos"
  437. ]
  438. },
  439. {
  440. type: "rpt_analysis",
  441. "tables": [
  442. "mem_union_data",
  443. "mem_master_converse"
  444. ]
  445. },
  446. {
  447. type: "tender",
  448. "tables": [
  449. "mem_project",
  450. "mem_tender",
  451. "mem_tender_info",
  452. "mem_deal_bills"
  453. ]
  454. }
  455. ]
  456. },
  457. {
  458. "id": 21,
  459. "name": "变更方案",
  460. "key": "change_plan",
  461. "tables": [
  462. {
  463. type: "base",
  464. "tables": [
  465. "mem_change_plan",
  466. "mem_change_plan_bills",
  467. "mem_change_plan_audit",
  468. "mem_change_plan_att"
  469. ]
  470. },
  471. {
  472. type: "rpt_analysis",
  473. "tables": [
  474. "mem_union_data",
  475. "mem_master_converse"
  476. ]
  477. },
  478. {
  479. type: "tender",
  480. "tables": [
  481. "mem_project",
  482. "mem_tender",
  483. "mem_tender_info"
  484. ]
  485. }
  486. ]
  487. },
  488. {
  489. "id": 22,
  490. "name": "变更立项",
  491. "key": "change_project",
  492. "tables": [
  493. {
  494. type: "base",
  495. "tables": [
  496. "mem_change_project",
  497. "mem_change_project_audit",
  498. "mem_change_project_att"
  499. ]
  500. },
  501. {
  502. type: "rpt_analysis",
  503. "tables": [
  504. "mem_union_data",
  505. "mem_master_converse"
  506. ]
  507. },
  508. {
  509. type: "tender",
  510. "tables": [
  511. "mem_project",
  512. "mem_tender",
  513. "mem_tender_info"
  514. ]
  515. }
  516. ]
  517. },
  518. {
  519. "id": 23,
  520. "name": "变更申请",
  521. "key": "change_apply",
  522. "tables": [
  523. {
  524. type: "base",
  525. "tables": [
  526. "mem_change_apply",
  527. "mem_change_apply_bills",
  528. "mem_change_apply_audit",
  529. "mem_change_apply_att"
  530. ]
  531. },
  532. {
  533. type: "rpt_analysis",
  534. "tables": [
  535. "mem_union_data",
  536. "mem_master_converse"
  537. ]
  538. },
  539. {
  540. type: "tender",
  541. "tables": [
  542. "mem_project",
  543. "mem_tender",
  544. "mem_tender_info"
  545. ]
  546. }
  547. ]
  548. },
  549. {
  550. "id": 30,
  551. "name": "材料调差",
  552. "key": "material",
  553. "tables": [
  554. {
  555. type: "base",
  556. "tables": [
  557. "mem_material",
  558. "mem_material_audit",
  559. "mem_material_gl",
  560. "mem_material_gl_detail",
  561. "mem_material_bills",
  562. "mem_material_pos",
  563. "mem_material_stage",
  564. "mem_material_exponent",
  565. "mem_material_gather_bills",
  566. "mem_material_gather_xmj",
  567. "mem_material_gather_gl",
  568. "mem_material_exponent_node",
  569. "mem_material_exponent_shard"
  570. ]
  571. },
  572. {
  573. type: "rpt_analysis",
  574. "tables": [
  575. "mem_union_data",
  576. "mem_master_converse"
  577. ]
  578. },
  579. {
  580. type: "tender",
  581. "tables": [
  582. "mem_project",
  583. "mem_tender",
  584. "mem_tender_info",
  585. "mem_deal_bills"
  586. ]
  587. },
  588. {
  589. type: "xj",
  590. "tables": [
  591. "mem_xj_material_calc"
  592. ]
  593. }
  594. ]
  595. },
  596. {
  597. "id": 40,
  598. "name": "安全计量",
  599. "key": "safe_stage",
  600. "tables": [
  601. {
  602. type: "base",
  603. "tables": [
  604. "mem_safe_stage",
  605. "mem_safe_stage_audit"
  606. ]
  607. },
  608. {
  609. type: "bills",
  610. "tables": [
  611. "mem_safe_stage_bills",
  612. "mem_safe_stage_bills_compare"
  613. ]
  614. },
  615. {
  616. type: "rpt_analysis",
  617. "tables": [
  618. "mem_union_data",
  619. "mem_master_converse"
  620. ]
  621. },
  622. {
  623. type: "tender",
  624. "tables": [
  625. "mem_project",
  626. "mem_tender",
  627. "mem_tender_info"
  628. ]
  629. }
  630. ]
  631. },
  632. {
  633. "id": 100,
  634. "name": "支付审批",
  635. "key": "payment",
  636. "tables": [
  637. {
  638. type: "base",
  639. "tables": [
  640. "mem_payment_tender",
  641. "mem_payment_tender_info",
  642. "mem_payment_detail"
  643. ]
  644. },
  645. {
  646. type: "rpt_analysis",
  647. "tables": [
  648. "mem_union_data",
  649. "mem_master_converse"
  650. ]
  651. }
  652. ]
  653. },
  654. {
  655. "id": 101,
  656. "name": "安全生产费",
  657. "key": "payment_safe",
  658. "tables": [
  659. {
  660. type: "base",
  661. "tables": [
  662. "mem_payment_tender",
  663. "mem_payment_tender_info",
  664. "mem_payment_detail"
  665. ]
  666. },
  667. {
  668. type: "bills",
  669. "tables": [
  670. "mem_payment_safe_bills",
  671. "mem_payment_safe_bills_compare"
  672. ]
  673. },
  674. {
  675. type: "rpt_analysis",
  676. "tables": [
  677. "mem_union_data",
  678. "mem_master_converse"
  679. ]
  680. }
  681. ]
  682. },
  683. {
  684. "id": 200,
  685. "name": "动态投资",
  686. "key": "budget",
  687. "tables": [
  688. {
  689. type: "base",
  690. "tables": [
  691. "mem_info",
  692. "mem_payment_tender_info",
  693. "mem_budget"
  694. ]
  695. },
  696. {
  697. type: "bills",
  698. "tables": [
  699. "mem_budget_gu",
  700. "mem_budget_gai",
  701. "mem_budget_yu",
  702. "mem_budget_zb",
  703. "mem_budget_final"
  704. ]
  705. },
  706. {
  707. type: "rpt_analysis",
  708. "tables": [
  709. "mem_union_data",
  710. "mem_master_converse"
  711. ]
  712. }
  713. ]
  714. },
  715. {
  716. "id": 300,
  717. "name": "合同管理",
  718. "key": "contract",
  719. "tables": [
  720. {
  721. type: "base",
  722. "tables": [
  723. "sp_contract_tree_1",
  724. "sp_contract_1",
  725. "sp_contract_pay_1",
  726. "sp_contract_tree_2",
  727. "sp_contract_2",
  728. "sp_contract_pay_2",
  729. "contract_tree_1",
  730. "contract_1",
  731. "contract_pay_1",
  732. "contract_tree_2",
  733. "contract_2",
  734. "contract_pay_2"
  735. ]
  736. },
  737. {
  738. type: "rpt_analysis",
  739. "tables": [
  740. "mem_union_data",
  741. "mem_master_converse"
  742. ]
  743. }
  744. ]
  745. },
  746. {
  747. "id": 400,
  748. "name": "成本报审",
  749. "key": "cost_ledger",
  750. "params": {
  751. "tender_id": 1,
  752. "cost_stage_id": "uuid"
  753. },
  754. "tables": [
  755. {
  756. type: "base",
  757. "tables": [
  758. "mem_cost_stage",
  759. "mem_cost_stage_audit"
  760. ]
  761. },
  762. {
  763. type: "bills",
  764. "tables": [
  765. "mem_cost_stage_ledger",
  766. "mem_cost_stage_ledger_compare",
  767. "mem_cost_stage_detail",
  768. "mem_cost_stage_detail_compare"
  769. ]
  770. },
  771. {
  772. type: "rpt_analysis",
  773. "tables": [
  774. "mem_union_data",
  775. "mem_master_converse"
  776. ]
  777. },
  778. {
  779. type: "tender",
  780. "tables": [
  781. "mem_project",
  782. "mem_tender",
  783. "mem_tender_info"
  784. ]
  785. }
  786. ]
  787. },
  788. {
  789. "id": 401,
  790. "name": "财务账面",
  791. "key": "cost_book",
  792. "params": {
  793. "tender_id": 1,
  794. "cost_stage_id": "uuid"
  795. },
  796. "tables": [
  797. {
  798. type: "base",
  799. "tables": [
  800. "mem_cost_stage",
  801. "mem_cost_stage_audit"
  802. ]
  803. },
  804. {
  805. type: "bills",
  806. "tables": [
  807. "mem_cost_stage_book",
  808. "mem_cost_stage_book_compare",
  809. "mem_cost_stage_book_detail",
  810. "mem_cost_stage_detail_compare"
  811. ]
  812. },
  813. {
  814. type: "rpt_analysis",
  815. "tables": [
  816. "mem_union_data",
  817. "mem_master_converse"
  818. ]
  819. },
  820. {
  821. type: "tender",
  822. "tables": [
  823. "mem_project",
  824. "mem_tender",
  825. "mem_tender_info"
  826. ]
  827. }
  828. ]
  829. },
  830. {
  831. "id": 402,
  832. "name": "成本分析",
  833. "key": "cost_analysis",
  834. "params": {
  835. "tender_id": 1,
  836. "cost_stage_id": "uuid"
  837. },
  838. "tables": [
  839. {
  840. type: "base",
  841. "tables": [
  842. "mem_cost_stage",
  843. "mem_cost_stage_audit"
  844. ]
  845. },
  846. {
  847. type: "bills",
  848. "tables": [
  849. "mem_cost_stage_analysis",
  850. "mem_cost_stage_analysis_compare",
  851. "mem_cost_stage_analysis_detail",
  852. "mem_cost_stage_analysis_detail_compare"
  853. ]
  854. },
  855. {
  856. type: "rpt_analysis",
  857. "tables": [
  858. "mem_union_data",
  859. "mem_master_converse"
  860. ]
  861. },
  862. {
  863. type: "tender",
  864. "tables": [
  865. "mem_project",
  866. "mem_tender",
  867. "mem_tender_info"
  868. ]
  869. }
  870. ]
  871. }
  872. ];
  873. const testInfo = {
  874. 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' },
  875. 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' },
  876. 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' },
  877. };
  878. function chunkArray(array, size) {
  879. const chunks = [];
  880. for (let i = 0; i < array.length; i += size) {
  881. // slice 不会修改原数组,返回从 i 开始到 i+size 的新数组
  882. chunks.push(array.slice(i, i + size));
  883. }
  884. return chunks;
  885. }
  886. const loadValidTable = function(type) {
  887. const vt = validTablePart.find(x => { return x.key === type; });
  888. const html = [];
  889. if (vt) {
  890. for (const t of vt.tables) {
  891. html.push(`<tr><th class="text-center" colspan="4">${t.type}</th></tr>`);
  892. const partTables = chunkArray(t.tables, 4);
  893. for (const pt of partTables) {
  894. html.push(`<tr><td>${pt[0] || ''}</td><td>${pt[1] || ''}</td><td>${pt[2] || ''}</td><td>${pt[3] || ''}</td></tr>`);
  895. }
  896. }
  897. }
  898. $('#valid-table-list').html(html.join(''));
  899. }
  900. loadValidTable('tender');
  901. $('#st-rpt-source-type').change(function() {
  902. const stType = $(`option[value=${this.value}]`).attr('stType');
  903. if (testInfo[stType]) {
  904. $('#st-rpt-params').val(JSON.stringify(testInfo[stType].params));
  905. $('#st-rpt-source-filters').val(testInfo[stType].table);
  906. }
  907. loadValidTable(stType);
  908. });
  909. $('#st-rpt-check').click(function() {
  910. const data = { type: 'report', detail: { source_type: parseInt($('#st-rpt-source-type').val()) } };
  911. try {
  912. data.detail.params = JSON.parse($('#st-rpt-params').val());
  913. } catch (err) {
  914. toastr.error('必须参数:不是有效的json数据,请检查');
  915. return;
  916. }
  917. data.detail.source_filters = $('#st-rpt-source-filters').val().split(';');
  918. postData('devTest/load', data, function(result) {
  919. console.log(result);
  920. })
  921. });
  922. </script>