rpt_tpl_pre_handle.js 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648
  1. /**
  2. * Created by Tony on 2017/12/26.
  3. */
  4. const sort_types = ["normal", "tree", "accord_to_parent", "self_define"];
  5. const condition_types = [
  6. "==",
  7. "===",
  8. ">",
  9. ">=",
  10. "<",
  11. "<=",
  12. "!=",
  13. "in",
  14. "not in",
  15. ];
  16. const pre_handle_data_objects = ["bills", "ration", "ration_glj", "projectGLJ"];
  17. const pre_handle_data_objects_name = [
  18. "清单",
  19. "定额",
  20. "定额人材机",
  21. "项目人材机",
  22. ];
  23. //供货方式
  24. const fixed_supply_types = [
  25. { Name: "自行采购(0)", Title: "", Value: 0 },
  26. { Name: "部分甲供(1)", Title: "", Value: 1 },
  27. { Name: "完全甲供(2)", Title: "", Value: 2 },
  28. { Name: "甲定乙供(3)", Title: "", Value: 3 },
  29. ];
  30. //三材类别
  31. const fixed_material_types = [
  32. { Name: "钢材(1)", Title: "", Value: 1 },
  33. { Name: "钢筋(2)", Title: "", Value: 2 },
  34. { Name: "木材(3)", Title: "", Value: 3 },
  35. { Name: "水泥(4)", Title: "", Value: 4 },
  36. { Name: "商品砼(5)", Title: "", Value: 5 },
  37. { Name: "商品砂浆(6)", Title: "", Value: 6 },
  38. ];
  39. const fixed_glj_types = [
  40. { Name: "人工(1)", Title: "", Value: 1 },
  41. { Name: "普通材料(201)", Title: "", Value: 201 },
  42. { Name: "混凝土(202)", Title: "", Value: 202 },
  43. { Name: "砂浆(203)", Title: "", Value: 203 },
  44. { Name: "配合比(204)", Title: "", Value: 204 },
  45. { Name: "商品混凝土(205)", Title: "", Value: 205 },
  46. { Name: "商品砂浆(206)", Title: "", Value: 206 },
  47. { Name: "其他材料(207)", Title: "", Value: 207 },
  48. { Name: "普通机械(301)", Title: "", Value: 301 },
  49. { Name: "机械组成物(302)", Title: "", Value: 302 },
  50. { Name: "机上人工(303)", Value: 303 },
  51. { Name: "仪器仪表(304)", Value: 304 },
  52. { Name: "燃料动力费(305)", Value: 305 },
  53. { Name: "折旧费(306)", Value: 306 },
  54. { Name: "检修费(307)", Value: 307 },
  55. { Name: "维护费(308)", Value: 308 },
  56. { Name: "安拆费及场外运费(309)", Value: 309 },
  57. { Name: "校验费(310)", Value: 310 },
  58. { Name: "其他费用(311)", Value: 311 },
  59. { Name: "其他施工机具使用费(312)", Value: 312 },
  60. { Name: "主材(4)", Title: "", Value: 4 },
  61. { Name: "设备(5)", Title: "", Value: 5 },
  62. { Name: "企业管理费(6)", Title: "", Value: 6 },
  63. { Name: "利润(7)", Title: "", Value: 7 },
  64. { Name: "一般风险费(8)", Title: "", Value: 8 },
  65. ];
  66. const fixed_top_bills_nodes = [
  67. { Name: "分部分项工程(1)", Title: "", Value: 1 },
  68. { Name: "措施项目(2)", Title: "", Value: 2 },
  69. { Name: "其他项目(7)", Title: "", Value: 7 },
  70. { Name: "规费(15)", Title: "", Value: 15 },
  71. { Name: "税金(18)", Title: "", Value: 18 },
  72. { Name: "工程造价(19)", Title: "", Value: 19 },
  73. ];
  74. const fixed_other_bills_types = [
  75. { Name: "施工技术措施项目(3)", Title: "", Value: 3 },
  76. { Name: "安全文明施工按实计算费用(4)", Title: "", Value: 4 },
  77. { Name: "施工组织措施专项费用(5)", Title: "", Value: 5 },
  78. { Name: "安全文明施工专项费用(6)", Title: "", Value: 6 },
  79. { Name: "暂列金额(8)", Title: "", Value: 8 },
  80. { Name: "暂估价(9)", Title: "", Value: 9 },
  81. { Name: "材料(工程设备)暂估价(10)", Title: "", Value: 10 },
  82. { Name: "专业工程暂估价(11)", Title: "", Value: 11 },
  83. { Name: "计日工(12)", Title: "", Value: 12 },
  84. { Name: "总承包服务费(13)", Title: "", Value: 13 },
  85. { Name: "索赔与现场签证(14)", Title: "", Value: 14 },
  86. { Name: "社会保险费及住房公积金(16)", Title: "", Value: 16 },
  87. { Name: "工程排污费(17)", Title: "", Value: 17 },
  88. { Name: "增值税(20)", Title: "", Value: 20 },
  89. { Name: "索赔费用(26)", Title: "", Value: 26 },
  90. { Name: "现场签证费用(27)", Title: "", Value: 27 },
  91. ];
  92. const fixed_bills_flags = [
  93. { Name: "分部分项工程(1)", Title: "", Value: 1 },
  94. { Name: "措施项目(2)", Title: "", Value: 2 },
  95. { Name: "施工技术措施项目(3)", Title: "", Value: 3 },
  96. { Name: "安全文明施工按实计算费用(4)", Title: "", Value: 4 },
  97. { Name: "施工组织措施专项费用(5)", Title: "", Value: 5 },
  98. { Name: "安全文明施工专项费用(6)", Title: "", Value: 6 },
  99. { Name: "其他项目(7)", Title: "", Value: 7 },
  100. { Name: "暂列金额(8)", Title: "", Value: 8 },
  101. { Name: "暂估价(9)", Title: "", Value: 9 },
  102. { Name: "材料(工程设备)暂估价(10)", Title: "", Value: 10 },
  103. { Name: "专业工程暂估价(11)", Title: "", Value: 11 },
  104. { Name: "计日工(12)", Title: "", Value: 12 },
  105. { Name: "总承包服务费(13)", Title: "", Value: 13 },
  106. { Name: "索赔与现场签证(14)", Title: "", Value: 14 },
  107. { Name: "规费(15)", Title: "", Value: 15 },
  108. { Name: "社会保险费及住房公积金(16)", Title: "", Value: 16 },
  109. { Name: "工程排污费(17)", Title: "", Value: 17 },
  110. { Name: "税金(18)", Title: "", Value: 18 },
  111. { Name: "工程造价(19)", Title: "", Value: 19 },
  112. { Name: "增值税(20)", Title: "", Value: 20 },
  113. ];
  114. const fixed_bills_types = [
  115. { Name: "大项费用(1)", Title: "", Value: 1 },
  116. { Name: "分部(2)", Title: "", Value: 2 },
  117. { Name: "分项(3)", Title: "", Value: 3 },
  118. { Name: "清单(4)", Title: "", Value: 4 },
  119. { Name: "补项(5)", Title: "", Value: 5 },
  120. ];
  121. const exposed_bills_properties = [
  122. { Name: "清单_所属项目ID", Title: "", Key: "projectID", Order: "ascend" },
  123. { Name: "清单_ID", Title: "", Key: "ID", Order: "ascend" },
  124. {
  125. Name: "顶层父清单_标记",
  126. Title: "",
  127. Key: "topBillID",
  128. Order: "ascend",
  129. individualType: fixed_top_bills_nodes,
  130. },
  131. { Name: "清单_层次", Title: "", Key: "treeLevel", Order: "ascend" },
  132. {
  133. Name: "清单_类别",
  134. Title: "",
  135. Key: "type",
  136. Order: "ascend",
  137. individualType: fixed_bills_types,
  138. },
  139. {
  140. Name: "清单_标记",
  141. Title: "",
  142. Key: "flags.flag",
  143. Order: "ascend",
  144. individualType: fixed_bills_flags,
  145. },
  146. ];
  147. const exposed_ration_properties = [
  148. { Name: "定额_工程内部ID", Title: "", Key: "ID", Order: "ascend" },
  149. { Name: "定额_所属项目ID", Title: "", Key: "projectID", Order: "ascend" },
  150. { Name: "定额_所属清单ID", Title: "", Key: "billsItemID", Order: "ascend" },
  151. { Name: "定额_清单内顺序", Title: "", Key: "serialNo", Order: "ascend" },
  152. { Name: "定额_来源(标准|补充)", Title: "", Key: "from", Order: "ascend" },
  153. ];
  154. const exposed_ration_glj_properties = [
  155. { Name: "定额人材机_ID", Title: "", Key: "ID" },
  156. {
  157. Name: "定额人材机_项目人材机映射ID",
  158. Title: "",
  159. Key: "projectGLJID",
  160. Order: "ascend",
  161. },
  162. {
  163. Name: "定额人材机_所属定额ID",
  164. Title: "",
  165. Key: "rationID",
  166. Order: "ascend",
  167. },
  168. {
  169. Name: "定额人材机_所属清单ID",
  170. Title: "",
  171. Key: "billsItemID",
  172. Order: "ascend",
  173. },
  174. {
  175. Name: "定额人材机_所属工程ID",
  176. Title: "",
  177. Key: "projectID",
  178. Order: "ascend",
  179. },
  180. { Name: "定额人材机_代码", Title: "", Key: "code", Order: "ascend" },
  181. {
  182. Name: "定额人材机_类型",
  183. Title: "",
  184. Key: "type",
  185. Order: "ascend",
  186. individualType: fixed_glj_types,
  187. },
  188. {
  189. Name: "定额人材机_是否暂估",
  190. Title: "",
  191. Key: "ref_join(projectGLJID,projectGLJ,id).is_evaluate",
  192. Order: "ascend",
  193. isBoolean: true,
  194. booleanOptions: [1, 0],
  195. },
  196. {
  197. Name: "定额人材机_是否主要材料",
  198. Title: "",
  199. Key: "ref_join(projectGLJID,projectGLJ,id).is_main_material",
  200. Order: "ascend",
  201. isBoolean: true,
  202. booleanOptions: [1, 0],
  203. },
  204. {
  205. Name: "定额人材机_供货方式",
  206. Title: "",
  207. Key: "ref_join(projectGLJID,projectGLJ,id).supply",
  208. Order: "ascend",
  209. individualType: fixed_supply_types,
  210. },
  211. {
  212. Name: "定额人材机_三材类别",
  213. Title: "",
  214. Key: "ref_join(projectGLJID,projectGLJ,id).materialType",
  215. Order: "ascend",
  216. individualType: fixed_material_types,
  217. },
  218. ];
  219. const exposed_prj_glj_properties = [
  220. { Name: "项目人材机_ID", Title: "", Key: "id" },
  221. {
  222. Name: "项目人材机_所属工程ID",
  223. Title: "",
  224. Key: "projectID",
  225. Order: "ascend",
  226. },
  227. { Name: "项目人材机_代码", Title: "", Key: "code", Order: "ascend" },
  228. {
  229. Name: "项目人材机_类型",
  230. Title: "",
  231. Key: "type",
  232. Order: "ascend",
  233. individualType: fixed_glj_types,
  234. },
  235. { Name: "项目人材机_数量", Title: "", Key: "quantity", Order: "ascend" },
  236. {
  237. Name: "项目人材机_是否暂估",
  238. Title: "",
  239. Key: "is_evaluate",
  240. Order: "ascend",
  241. isBoolean: true,
  242. booleanOptions: [1, 0],
  243. },
  244. {
  245. Name: "项目人材机_是否主要材料",
  246. Title: "",
  247. Key: "is_main_material",
  248. Order: "ascend",
  249. isBoolean: true,
  250. booleanOptions: [1, 0],
  251. },
  252. {
  253. Name: "项目人材机_供货方式",
  254. Title: "",
  255. Key: "supply",
  256. Order: "ascend",
  257. individualType: fixed_supply_types,
  258. },
  259. {
  260. Name: "项目人材机_三材类别",
  261. Title: "",
  262. Key: "materialType",
  263. Order: "ascend",
  264. individualType: fixed_material_types,
  265. },
  266. ];
  267. const exposed_properties_arr = [
  268. exposed_bills_properties,
  269. exposed_ration_properties,
  270. exposed_ration_glj_properties,
  271. exposed_prj_glj_properties,
  272. ];
  273. let preHandleObj = {
  274. treeObj: null,
  275. typeTreeObj: null,
  276. currentNode: null,
  277. iniTree: function (rptTpl) {
  278. let me = this;
  279. me.buildData(rptTpl);
  280. },
  281. buildData: function (rptTpl) {
  282. let me = this,
  283. handles = [];
  284. if (rptTpl[JV.NODE_MAP_DATA_HANDLE_INFO]) {
  285. for (let item of rptTpl[JV.NODE_MAP_DATA_HANDLE_INFO]) {
  286. let hd = { Name: "预处理环节" };
  287. me.private_copy_node(item, hd);
  288. me.private_set_title(hd);
  289. hd.Operations = []; //考虑到用户可能会换来换去,这样会有冗余的属性出现
  290. handles.push(hd);
  291. }
  292. }
  293. me.treeObj = $.fn.zTree.init(
  294. $("#pre_handle_data_info_reversed"),
  295. preHandleSetting,
  296. handles
  297. );
  298. },
  299. build_handle_data_selection: function () {
  300. let sel = $("#select_mapping_data"),
  301. sel2 = $("#select_mapping_data_for_sort_type");
  302. for (let i = 0; i < pre_handle_data_objects.length; i++) {
  303. sel2.append(
  304. "<option value='" +
  305. pre_handle_data_objects[i] +
  306. "'>" +
  307. pre_handle_data_objects_name[i] +
  308. "</option>"
  309. );
  310. sel.append(
  311. "<option value='" +
  312. pre_handle_data_objects[i] +
  313. "'>" +
  314. pre_handle_data_objects_name[i] +
  315. "</option>"
  316. );
  317. }
  318. },
  319. buildTypeData: function () {
  320. let me = this,
  321. types = [];
  322. types.push({ Name: JV.PROP_HANDLE_TYPE_SORT, Title: "" });
  323. types.push({ Name: JV.PROP_HANDLE_TYPE_FILTER, Title: "" });
  324. types.push({ Name: JV.PROP_HANDLE_TYPE_BILLS_DATA_MOVE, Title: "" });
  325. types.push({ Name: JV.PROP_HANDLE_TYPE_SUM, Title: "" });
  326. types.push({ Name: JV.PROP_HANDLE_TYPE_ADJUST, Title: "" });
  327. types.push({ Name: JV.PROP_HANDLE_TYPE_ADD_DUMMY, Title: "" });
  328. types.push({
  329. Name: JV.PROP_HANDLE_TYPE_CHANGE_QUANTITIES_BILLS,
  330. Title: "",
  331. });
  332. // types.push({Name: "纯手工填写", Title: ""});
  333. me.typeTreeObj = $.fn.zTree.init(
  334. $("#pre_handle_type_reversed"),
  335. preHandleTypeSetting,
  336. types
  337. );
  338. me.setDisabledBandSelect([0, 1, 2, 3, 4, 5]);
  339. me.build_handle_data_selection();
  340. },
  341. setDisabledBandSelect: function (disabledIdxArr) {
  342. let me = this;
  343. if (me.typeTreeObj) {
  344. let nodes = me.typeTreeObj.getNodes();
  345. for (let idx = 0; idx < nodes.length; idx++) {
  346. if (disabledIdxArr.indexOf(idx) >= 0) {
  347. me.typeTreeObj.setChkDisabled(nodes[idx], true, true, true);
  348. } else {
  349. me.typeTreeObj.setChkDisabled(nodes[idx], false, true, true);
  350. }
  351. }
  352. }
  353. },
  354. createNewNode: function (nodeType) {
  355. let rst = null,
  356. preHandleType = nodeType;
  357. if (!nodeType) {
  358. preHandleType = JV.PROP_HANDLE_TYPE_SORT;
  359. }
  360. switch (nodeType) {
  361. case JV.PROP_HANDLE_TYPE_SORT:
  362. rst = {
  363. Name: "预处理环节",
  364. Title: "",
  365. 映射数据对象: "bills",
  366. 预处理类型: preHandleType,
  367. 排序方式: "normal",
  368. 排序键值集: [],
  369. };
  370. break;
  371. case JV.PROP_HANDLE_TYPE_FILTER:
  372. rst = {
  373. Name: "预处理环节",
  374. Title: "",
  375. 映射数据对象: "bills",
  376. 预处理类型: preHandleType,
  377. 过滤键值集: [],
  378. };
  379. break;
  380. case JV.PROP_HANDLE_TYPE_BILLS_DATA_MOVE:
  381. rst = {
  382. Name: "预处理环节",
  383. Title: "",
  384. 映射数据对象: "ration",
  385. 预处理类型: preHandleType,
  386. };
  387. break;
  388. case JV.PROP_HANDLE_TYPE_SUM:
  389. rst = {
  390. Name: "预处理环节",
  391. Title: "",
  392. 映射数据对象: "bills",
  393. 预处理类型: preHandleType,
  394. 分组键值集: [],
  395. 统计键值集: [],
  396. };
  397. break;
  398. case JV.PROP_HANDLE_TYPE_ADJUST:
  399. rst = {
  400. Name: "预处理环节",
  401. Title: "",
  402. 映射数据对象: "bills",
  403. 预处理类型: preHandleType,
  404. 数据调整集: [],
  405. };
  406. break;
  407. case JV.PROP_HANDLE_TYPE_ADD_DUMMY:
  408. rst = {
  409. Name: "预处理环节",
  410. Title: "",
  411. 映射数据对象: "bills",
  412. 预处理类型: preHandleType,
  413. Dummy数据集: [],
  414. };
  415. break;
  416. case JV.PROP_HANDLE_TYPE_CHANGE_QUANTITIES_BILLS:
  417. rst = {
  418. Name: "预处理环节",
  419. Title: "",
  420. 映射数据对象: "bills",
  421. 预处理类型: preHandleType,
  422. };
  423. break;
  424. default:
  425. rst = {
  426. Name: "预处理环节",
  427. Title: "",
  428. 映射数据对象: "bills",
  429. 预处理类型: "排序",
  430. 排序方式: "normal",
  431. 排序键值集: [],
  432. };
  433. break;
  434. }
  435. return rst;
  436. },
  437. addNewNode: function (nodeType) {
  438. let me = this,
  439. item = me.createNewNode(nodeType);
  440. me.private_set_title(item);
  441. me.treeObj.addNodes(null, -1, [item], true);
  442. },
  443. private_change_node_by_type: function (handleType, item) {
  444. let preHandleType = handleType;
  445. if (!handleType) {
  446. preHandleType = JV.PROP_HANDLE_TYPE_SORT;
  447. }
  448. item[JV.PROP_HANDLE_TYPE] = preHandleType;
  449. switch (handleType) {
  450. case JV.PROP_HANDLE_TYPE_SORT:
  451. item[JV.PROP_SORT_TYPE] = "normal";
  452. item[JV.PROP_SORT_KEYS] = [];
  453. break;
  454. case JV.PROP_HANDLE_TYPE_FILTER:
  455. item[JV.PROP_FILTER_KEYS] = [];
  456. break;
  457. case JV.PROP_HANDLE_TYPE_BILLS_DATA_MOVE:
  458. break;
  459. case JV.PROP_HANDLE_TYPE_SUM:
  460. item[JV.PROP_SUM_GROUP_KEYS] = [];
  461. item[JV.PROP_SUM_SUM_KEYS] = [];
  462. break;
  463. case JV.PROP_HANDLE_TYPE_ADJUST:
  464. item[JV.PROP_ADJUST_COLLECTION] = [];
  465. break;
  466. case JV.PROP_HANDLE_TYPE_ADD_DUMMY:
  467. item[JV.PROP_DUMMY_COLLECTION] = [];
  468. break;
  469. case JV.PROP_HANDLE_TYPE_CHANGE_QUANTITIES_BILLS:
  470. item[JV.PROP_HANDLE_TYPE_CHANGE_QUANTITIES_BILLS_SORT_TYPE] = "all"; // 工程量清单排序
  471. item[JV.PROP_HANDLE_TYPE_CHANGE_QUANTITIES_BILLS_DATA_TYPE] = "bills"; // 工程量清单输出级别
  472. break;
  473. default:
  474. item[JV.PROP_HANDLE_TYPE] = JV.PROP_HANDLE_TYPE_SORT;
  475. item[JV.PROP_SORT_TYPE] = "normal";
  476. item[JV.PROP_SORT_KEYS] = [];
  477. break;
  478. }
  479. // return rst;
  480. },
  481. private_copy_node: function (src, dest) {
  482. let me = this;
  483. dest[JV.PROP_DATA_KEY] = src[JV.PROP_DATA_KEY];
  484. dest[JV.PROP_HANDLE_TYPE] = src[JV.PROP_HANDLE_TYPE];
  485. if (src[JV.PROP_HANDLE_TYPE] === JV.PROP_HANDLE_TYPE_SORT) {
  486. preHandleSortObj.copyNode(src, dest);
  487. } else if (src[JV.PROP_HANDLE_TYPE] === JV.PROP_HANDLE_TYPE_FILTER) {
  488. preHandleFilterObj.copyNode(src, dest);
  489. } else if (src[JV.PROP_HANDLE_TYPE] === JV.PROP_HANDLE_TYPE_SUM) {
  490. preHandleSummaryObj.copyNode(src, dest);
  491. } else if (src[JV.PROP_HANDLE_TYPE] === JV.PROP_HANDLE_TYPE_ADJUST) {
  492. preHandleAdjustObj.copyNode(src, dest);
  493. } else if (src[JV.PROP_HANDLE_TYPE] === JV.PROP_HANDLE_TYPE_ADD_DUMMY) {
  494. preHandleAddDummyObj.copyNode(src, dest);
  495. } else if (
  496. src[JV.PROP_HANDLE_TYPE] === JV.PROP_HANDLE_TYPE_CHANGE_QUANTITIES_BILLS
  497. ) {
  498. preHandleQuantitiesBillsSortObj.copyNode(src, dest);
  499. }
  500. },
  501. private_set_title: function (node) {
  502. let nameStr = node[JV.PROP_NAME],
  503. idx = nameStr.indexOf("(");
  504. if (idx >= 0) {
  505. nameStr = nameStr.slice(0, idx);
  506. }
  507. node[JV.PROP_NAME] = nameStr + "(" + node[JV.PROP_HANDLE_TYPE] + ")";
  508. node.Title =
  509. "映射数据对象:" +
  510. node[JV.PROP_DATA_KEY] +
  511. " | " +
  512. node[JV.PROP_HANDLE_TYPE];
  513. },
  514. refreshByNode: function (treeNode) {
  515. let me = preHandleObj;
  516. if (me.typeTreeObj) {
  517. let nodes = me.typeTreeObj.getNodes();
  518. let typeNode = null;
  519. for (let node of nodes) {
  520. if (treeNode[JV.PROP_NAME].indexOf(node[JV.PROP_NAME]) > 0) {
  521. me.typeTreeObj.checkNode(node, true, false, false);
  522. typeNode = node;
  523. break;
  524. }
  525. }
  526. let md = $("#select_mapping_data")[0];
  527. for (let i = 0; i < md.children.length; i++) {
  528. if (treeNode[JV.PROP_DATA_KEY] === md.children[i].value) {
  529. md.selectedIndex = i;
  530. break;
  531. }
  532. }
  533. if (typeNode) {
  534. me.hide_all_dom();
  535. $("#div_pre_handle_data")[0].style.display = "";
  536. if (typeNode[JV.PROP_NAME] === "排序") {
  537. preHandleSortObj.refresh_node();
  538. } else if (typeNode[JV.PROP_NAME] === "过滤") {
  539. preHandleFilterObj.refresh_node();
  540. } else if (typeNode[JV.PROP_NAME] === "合计") {
  541. preHandleSummaryObj.refresh_node();
  542. } else if (typeNode[JV.PROP_NAME] === "数据调整") {
  543. preHandleAdjustObj.refresh_node();
  544. } else if (typeNode[JV.PROP_NAME] === "增加Dummy数据") {
  545. preHandleAddDummyObj.refresh_node();
  546. } else if (typeNode[JV.PROP_NAME] === "转化工程量清单") {
  547. preHandleQuantitiesBillsSortObj.refresh_node();
  548. }
  549. }
  550. }
  551. },
  552. hide_all_dom: function () {
  553. $("#div_pre_handle_data")[0].style.display = "none";
  554. $("#div_sort_type")[0].style.display = "none";
  555. $("#div_sort_type_normal")[0].style.display = "none";
  556. $("#div_filter_type")[0].style.display = "none";
  557. $("#div_summary_type")[0].style.display = "none";
  558. $("#div_adjust_type")[0].style.display = "none";
  559. $("#div_add_dummy_type")[0].style.display = "none";
  560. $("#div_sort_type_according_to_parent")[0].style.display = "none";
  561. $("#div_sort_type_parent_data")[0].style.display = "none";
  562. $("#div_sort_tree")[0].style.display = "none";
  563. $("#div_sort_self_define")[0].style.display = "none";
  564. },
  565. onPreHandleClick: function (event, treeId, treeNode) {
  566. //点击预处理环节 节点
  567. let me = preHandleObj;
  568. me.currentNode = treeNode;
  569. me.setDisabledBandSelect([3, 4, 5]);
  570. // me.setDisabledBandSelect([]);
  571. me.refreshByNode(treeNode);
  572. },
  573. onTypeClick: function (event, treeId, treeNode) {
  574. //选择预处理类型(排序、过滤。。。)
  575. let me = preHandleObj;
  576. if (me.currentNode) {
  577. // me.currentNode[JV.PROP_HANDLE_TYPE] = treeNode[JV.PROP_NAME];
  578. me.private_change_node_by_type(treeNode[JV.PROP_NAME], me.currentNode);
  579. me.private_set_title(me.currentNode);
  580. me.treeObj.updateNode(me.currentNode, false);
  581. me.refreshByNode(me.currentNode);
  582. }
  583. },
  584. onChangeDataMappingObj: function (dom, oprType) {
  585. //更改(或选择)预处理环节中的 数据依据(就是说报表想预处理什么数据)
  586. let me = preHandleObj;
  587. if (oprType === "top") {
  588. preHandleObj.currentNode[JV.PROP_DATA_KEY] = dom.value;
  589. preHandleSortObj.childTreeObj = $.fn.zTree.init(
  590. $("#child_sorting_keys"),
  591. sortingKeysSetting,
  592. exposed_properties_arr[dom.selectedIndex]
  593. );
  594. preHandleSortObj.treeObj = $.fn.zTree.init(
  595. $("#pre_handle_sort_keys_reversed"),
  596. sortingKeysSetting,
  597. exposed_properties_arr[dom.selectedIndex]
  598. );
  599. preHandleFilterObj.treeObj = $.fn.zTree.init(
  600. $("#pre_handle_filter_keys_reversed"),
  601. filterKeysSetting,
  602. exposed_properties_arr[dom.selectedIndex]
  603. );
  604. } else if (oprType === "accord_to_parent") {
  605. preHandleSortObj.parentTreeObj = $.fn.zTree.init(
  606. $("#parent_sorting_keys"),
  607. sortingKeysSetting,
  608. exposed_properties_arr[dom.selectedIndex]
  609. );
  610. preHandleObj.currentNode[JV.PROP_PARENT_CHILD_SORT_KEY][
  611. JV.PROP_PARENT_DATA_KEY
  612. ] = dom.value;
  613. }
  614. },
  615. onBeforeDrag: function (treeId, treeNodes) {
  616. let rst = true;
  617. for (let node of treeNodes) {
  618. if (node.level > 0) {
  619. rst = false;
  620. break;
  621. }
  622. }
  623. return rst;
  624. },
  625. onBeforeDrop: function (treeId, treeNodes, targetNode, moveType) {
  626. let rst = false;
  627. if (targetNode.level === 0 && moveType !== "inner") {
  628. rst = true;
  629. }
  630. return rst;
  631. },
  632. onBeforeRemove: function (treeId, treeNode) {
  633. let rst = true;
  634. if (treeNode.isParent) {
  635. rst = false;
  636. } else {
  637. //
  638. }
  639. return rst;
  640. },
  641. addHoverDom: function (treeId, treeNode) {
  642. let me = preHandleObj,
  643. sObj = $("#" + treeNode.tId + "_span");
  644. if (
  645. (treeNode.level > 0 &&
  646. treeNode[JV.PROP_HANDLE_TYPE] !== JV.PROP_HANDLE_TYPE_FILTER) ||
  647. $("#addBtn_" + treeNode.tId).length > 0
  648. )
  649. return;
  650. if (
  651. treeNode[JV.PROP_HANDLE_TYPE] === JV.PROP_HANDLE_TYPE_SORT &&
  652. treeNode[JV.PROP_SORT_TYPE] === "accord_to_parent"
  653. ) {
  654. let addStr =
  655. "<span class='button add' id='addBtn_" +
  656. treeNode.tId +
  657. "' title='新增子排序' onfocus='this.blur();'></span>";
  658. sObj.after(addStr);
  659. let btn = $("#addBtn_" + treeNode.tId);
  660. if (btn)
  661. btn.bind("click", function () {
  662. let newSubNodes = [];
  663. let newNode = me.createNewNode(treeNode[JV.PROP_HANDLE_TYPE]);
  664. newNode.Name = "子排序";
  665. newNode[JV.PROP_DATA_KEY] = treeNode[JV.PROP_DATA_KEY];
  666. me.private_set_title(newNode);
  667. newSubNodes.push(newNode);
  668. treeNode.isParent = true;
  669. me.treeObj.addNodes(treeNode, -1, newSubNodes, true);
  670. me.treeObj.expandNode(treeNode, true, false);
  671. });
  672. } else if (treeNode[JV.PROP_HANDLE_TYPE] === JV.PROP_HANDLE_TYPE_FILTER) {
  673. let addStr =
  674. "<span class='button add' id='addBtn_" +
  675. treeNode.tId +
  676. "' title='新增子过滤' onfocus='this.blur();'></span>";
  677. sObj.after(addStr);
  678. let btn = $("#addBtn_" + treeNode.tId);
  679. if (btn)
  680. btn.bind("click", function () {
  681. let newSubNodes = [];
  682. let newNode = me.createNewNode(treeNode[JV.PROP_HANDLE_TYPE]);
  683. newNode.Name = "子过滤";
  684. newNode[JV.PROP_DATA_KEY] = treeNode[JV.PROP_DATA_KEY];
  685. newNode.Title = "";
  686. newNode[JV.PROP_HANDLE_TYPE] = JV.PROP_HANDLE_TYPE_FILTER;
  687. // me.private_set_title(newNode);
  688. newSubNodes.push(newNode);
  689. treeNode.isParent = true;
  690. me.treeObj.addNodes(treeNode, -1, newSubNodes, true);
  691. me.treeObj.expandNode(treeNode, true, false);
  692. });
  693. }
  694. },
  695. removeHoverDom: function (treeId, treeNode) {
  696. $("#addBtn_" + treeNode.tId)
  697. .unbind()
  698. .remove();
  699. },
  700. extractTabFields: function (rptTpl) {
  701. let me = this,
  702. nodes = me.treeObj.getNodes();
  703. let rst = [];
  704. if (nodes && nodes.length > 0) {
  705. for (let handleObj of nodes) {
  706. switch (handleObj[JV.PROP_HANDLE_TYPE]) {
  707. case JV.PROP_HANDLE_TYPE_SORT:
  708. rst.push(preHandleSortObj.extractTabFields(handleObj));
  709. break;
  710. case JV.PROP_HANDLE_TYPE_FILTER:
  711. rst.push(preHandleFilterObj.extractTabFields(handleObj));
  712. break;
  713. case JV.PROP_HANDLE_TYPE_SUM:
  714. rst.push(preHandleSummaryObj.extractTabFields(handleObj));
  715. break;
  716. case JV.PROP_HANDLE_TYPE_ADJUST:
  717. rst.push(preHandleAdjustObj.extractTabFields(handleObj));
  718. break;
  719. case JV.PROP_HANDLE_TYPE_ADD_DUMMY:
  720. rst.push(preHandleAddDummyObj.extractTabFields(handleObj));
  721. break;
  722. case JV.PROP_HANDLE_TYPE_CHANGE_QUANTITIES_BILLS:
  723. rst.push(
  724. preHandleQuantitiesBillsSortObj.extractTabFields(handleObj)
  725. );
  726. break;
  727. default:
  728. break;
  729. }
  730. }
  731. }
  732. rptTpl[JV.NODE_MAP_DATA_HANDLE_INFO] = rst;
  733. },
  734. };
  735. let preHandleSortObj = {
  736. normalTreeObj: null,
  737. parentTreeObj: null,
  738. childTreeObj: null,
  739. topBillsTreeObj: null,
  740. otherBillsTreeObj: null,
  741. copyNode: function (src, dest) {
  742. let me = preHandleSortObj;
  743. dest[JV.PROP_SORT_TYPE] = src[JV.PROP_SORT_TYPE];
  744. switch (sort_types.indexOf(src[JV.PROP_SORT_TYPE])) {
  745. case -1:
  746. //unknown!
  747. break;
  748. case 0:
  749. //normal
  750. let keys = [];
  751. for (let sortKeyItem of src[JV.PROP_SORT_KEYS]) {
  752. let item = { key: sortKeyItem.key, order: sortKeyItem.order };
  753. keys.push(item);
  754. }
  755. dest[JV.PROP_SORT_KEYS] = keys;
  756. break;
  757. case 1:
  758. //tree
  759. let billKeys = [];
  760. if (
  761. src[JV.PROP_FILTER_TOP_BILLS_NODES] &&
  762. src[JV.PROP_FILTER_TOP_BILLS_NODES].length > 0
  763. ) {
  764. billKeys = billKeys.concat(src[JV.PROP_FILTER_TOP_BILLS_NODES]);
  765. }
  766. dest[JV.PROP_FILTER_TOP_BILLS_NODES] = billKeys;
  767. let otherBillKeys = [];
  768. if (
  769. src[JV.PROP_FILTER_OTHER_BILLS_NODES] &&
  770. src[JV.PROP_FILTER_OTHER_BILLS_NODES].length > 0
  771. ) {
  772. otherBillKeys = otherBillKeys.concat(
  773. src[JV.PROP_FILTER_OTHER_BILLS_NODES]
  774. );
  775. }
  776. dest[JV.PROP_FILTER_OTHER_BILLS_NODES] = otherBillKeys;
  777. break;
  778. case 2:
  779. //according to parent
  780. dest[JV.PROP_PARENT_CHILD_SORT_KEY] = {};
  781. dest[JV.PROP_PARENT_CHILD_SORT_KEY][JV.PROP_PARENT_DATA_KEY] =
  782. src[JV.PROP_PARENT_CHILD_SORT_KEY][JV.PROP_PARENT_DATA_KEY];
  783. dest[JV.PROP_PARENT_CHILD_SORT_KEY][JV.PROP_PARENT_SORT_KEYS] = [];
  784. for (let item of src[JV.PROP_PARENT_CHILD_SORT_KEY][
  785. JV.PROP_PARENT_SORT_KEYS
  786. ]) {
  787. dest[JV.PROP_PARENT_CHILD_SORT_KEY][JV.PROP_PARENT_SORT_KEYS].push(
  788. item
  789. );
  790. }
  791. dest[JV.PROP_PARENT_CHILD_SORT_KEY][JV.PROP_CHILD_SORT_KEYS] = [];
  792. for (let item of src[JV.PROP_PARENT_CHILD_SORT_KEY][
  793. JV.PROP_CHILD_SORT_KEYS
  794. ]) {
  795. dest[JV.PROP_PARENT_CHILD_SORT_KEY][JV.PROP_CHILD_SORT_KEYS].push(
  796. item
  797. );
  798. }
  799. dest[JV.PROP_OTHER_SUB_SORT] = [];
  800. if (
  801. src[JV.PROP_OTHER_SUB_SORT] !== null &&
  802. src[JV.PROP_OTHER_SUB_SORT] !== undefined
  803. ) {
  804. dest.items = [];
  805. for (let subSort of src[JV.PROP_OTHER_SUB_SORT]) {
  806. let destSubSort = { Name: "子排序" };
  807. me.copyNode(subSort, destSubSort);
  808. destSubSort[JV.PROP_DATA_KEY] = src[JV.PROP_DATA_KEY];
  809. dest.items.push(destSubSort);
  810. }
  811. }
  812. break;
  813. case 3:
  814. //self define
  815. dest[JV.PROP_SORT_TYPE_SELF_DEFINE_LOGIC] =
  816. src[JV.PROP_SORT_TYPE_SELF_DEFINE_LOGIC];
  817. break;
  818. default:
  819. break;
  820. }
  821. },
  822. refresh_node: function () {
  823. let me = this;
  824. $("#div_sort_type")[0].style.display = "";
  825. if (preHandleObj.currentNode) {
  826. let sel = $("#select_sort_types")[0];
  827. let idx = -1;
  828. let sortTypeIdx = sort_types.indexOf(
  829. preHandleObj.currentNode[JV.PROP_SORT_TYPE]
  830. );
  831. sel.selectedIndex = sortTypeIdx;
  832. switch (sortTypeIdx) {
  833. case -1:
  834. //unknown!
  835. break;
  836. case 0:
  837. //normal
  838. $("#div_sort_type_normal")[0].style.display = "";
  839. idx = pre_handle_data_objects.indexOf(
  840. preHandleObj.currentNode[JV.PROP_DATA_KEY]
  841. );
  842. me.normalTreeObj = $.fn.zTree.init(
  843. $("#pre_handle_sort_keys_reversed"),
  844. sortingKeysSetting,
  845. exposed_properties_arr[idx]
  846. );
  847. let nodes = me.normalTreeObj.getNodes();
  848. for (let sortItem of preHandleObj.currentNode[JV.PROP_SORT_KEYS]) {
  849. for (let keyNode of nodes) {
  850. if (sortItem.key === keyNode.Key) {
  851. me.normalTreeObj.checkNode(keyNode, true, false, false);
  852. break;
  853. }
  854. }
  855. }
  856. break;
  857. case 1:
  858. //tree
  859. //tree排序是我们特有的数据结构方式,与数据结构有关,非common用
  860. $("#div_sort_tree")[0].style.display = "";
  861. me.topBillsTreeObj = $.fn.zTree.init(
  862. $("#bills_top_nodes"),
  863. sortingTreeSetting,
  864. fixed_top_bills_nodes
  865. );
  866. let topBillnodes = me.topBillsTreeObj.getNodes();
  867. if (preHandleObj.currentNode[JV.PROP_FILTER_TOP_BILLS_NODES]) {
  868. for (let topBillsNodeId of preHandleObj.currentNode[
  869. JV.PROP_FILTER_TOP_BILLS_NODES
  870. ]) {
  871. for (let topBillsNode of topBillnodes) {
  872. if (topBillsNode.Value === topBillsNodeId) {
  873. me.topBillsTreeObj.checkNode(
  874. topBillsNode,
  875. true,
  876. false,
  877. false
  878. );
  879. break;
  880. }
  881. }
  882. }
  883. } else {
  884. preHandleObj.currentNode[JV.PROP_FILTER_TOP_BILLS_NODES] = [];
  885. }
  886. me.otherBillsTreeObj = $.fn.zTree.init(
  887. $("#bills_other_nodes"),
  888. sortingTreeSetting2,
  889. fixed_other_bills_types
  890. );
  891. let otherBillnodes = me.otherBillsTreeObj.getNodes();
  892. if (preHandleObj.currentNode[JV.PROP_FILTER_OTHER_BILLS_NODES]) {
  893. for (let otherBillsNodeId of preHandleObj.currentNode[
  894. JV.PROP_FILTER_OTHER_BILLS_NODES
  895. ]) {
  896. for (let otherBillsNode of otherBillnodes) {
  897. if (otherBillsNode.Value === otherBillsNodeId) {
  898. me.otherBillsTreeObj.checkNode(
  899. otherBillsNode,
  900. true,
  901. false,
  902. false
  903. );
  904. break;
  905. }
  906. }
  907. }
  908. } else {
  909. preHandleObj.currentNode[JV.PROP_FILTER_OTHER_BILLS_NODES] = [];
  910. }
  911. break;
  912. case 2:
  913. //according to parent
  914. $("#div_sort_type_according_to_parent")[0].style.display = "";
  915. $("#div_sort_type_parent_data")[0].style.display = "";
  916. sel = $("#select_mapping_data_for_sort_type")[0];
  917. idx = pre_handle_data_objects.indexOf(
  918. preHandleObj.currentNode[JV.PROP_PARENT_CHILD_SORT_KEY][
  919. JV.PROP_PARENT_DATA_KEY
  920. ]
  921. );
  922. sel.selectedIndex = idx;
  923. me.parentTreeObj = $.fn.zTree.init(
  924. $("#parent_sorting_keys"),
  925. sortingKeysSetting,
  926. exposed_properties_arr[idx]
  927. );
  928. me.checkupNode(
  929. preHandleObj.currentNode[JV.PROP_PARENT_CHILD_SORT_KEY][
  930. JV.PROP_PARENT_SORT_KEYS
  931. ],
  932. me.parentTreeObj
  933. );
  934. idx = pre_handle_data_objects.indexOf(
  935. preHandleObj.currentNode[JV.PROP_DATA_KEY]
  936. );
  937. me.childTreeObj = $.fn.zTree.init(
  938. $("#child_sorting_keys"),
  939. sortingKeysSetting,
  940. exposed_properties_arr[idx]
  941. );
  942. me.checkupNode(
  943. preHandleObj.currentNode[JV.PROP_PARENT_CHILD_SORT_KEY][
  944. JV.PROP_CHILD_SORT_KEYS
  945. ],
  946. me.childTreeObj
  947. );
  948. break;
  949. case 3:
  950. //self define
  951. $("#div_sort_self_define")[0].style.display = "";
  952. $("#selfDefineSort")[0].value =
  953. preHandleObj.currentNode[JV.PROP_SORT_TYPE_SELF_DEFINE_LOGIC];
  954. break;
  955. default:
  956. break;
  957. }
  958. }
  959. },
  960. checkupNode: function (keysArr, treeObj) {
  961. let nodes = treeObj.getNodes();
  962. for (let key of keysArr) {
  963. for (let node of nodes) {
  964. if (node.Key === key) {
  965. treeObj.checkNode(node, true, false, false);
  966. break;
  967. }
  968. }
  969. }
  970. },
  971. onCheck: function (event, treeId, treeNode) {
  972. let me = preHandleSortObj;
  973. if (treeId.indexOf("parent_sorting_keys") >= 0) {
  974. me.resetParentSort();
  975. } else if (treeId.indexOf("child_sorting_keys") >= 0) {
  976. me.resetChildSort();
  977. } else {
  978. me.resetNormalSort();
  979. }
  980. },
  981. onTopBillsNodeCheck: function (event, treeId, treeNode) {
  982. let me = preHandleSortObj;
  983. if (treeNode.checked) {
  984. if (
  985. preHandleObj.currentNode[JV.PROP_FILTER_TOP_BILLS_NODES].indexOf(
  986. treeNode.Value
  987. ) < 0
  988. ) {
  989. preHandleObj.currentNode[JV.PROP_FILTER_TOP_BILLS_NODES].push(
  990. treeNode.Value
  991. );
  992. }
  993. } else {
  994. let idx = preHandleObj.currentNode[
  995. JV.PROP_FILTER_TOP_BILLS_NODES
  996. ].indexOf(treeNode.Value);
  997. if (idx >= 0) {
  998. preHandleObj.currentNode[JV.PROP_FILTER_TOP_BILLS_NODES].splice(idx, 1);
  999. }
  1000. }
  1001. },
  1002. onOtherBillsNodeCheck: function (event, treeId, treeNode) {
  1003. let me = preHandleSortObj;
  1004. if (treeNode.checked) {
  1005. if (
  1006. preHandleObj.currentNode[JV.PROP_FILTER_OTHER_BILLS_NODES].indexOf(
  1007. treeNode.Value
  1008. ) < 0
  1009. ) {
  1010. preHandleObj.currentNode[JV.PROP_FILTER_OTHER_BILLS_NODES].push(
  1011. treeNode.Value
  1012. );
  1013. }
  1014. } else {
  1015. let idx = preHandleObj.currentNode[
  1016. JV.PROP_FILTER_OTHER_BILLS_NODES
  1017. ].indexOf(treeNode.Value);
  1018. if (idx >= 0) {
  1019. preHandleObj.currentNode[JV.PROP_FILTER_OTHER_BILLS_NODES].splice(
  1020. idx,
  1021. 1
  1022. );
  1023. }
  1024. }
  1025. },
  1026. resetParentSort: function () {
  1027. let me = preHandleSortObj;
  1028. let nodes = me.parentTreeObj.getCheckedNodes();
  1029. let sortKeys = [];
  1030. for (let node of nodes) {
  1031. sortKeys.push(node.Key);
  1032. }
  1033. preHandleObj.currentNode[JV.PROP_PARENT_CHILD_SORT_KEY][
  1034. JV.PROP_PARENT_SORT_KEYS
  1035. ] = sortKeys;
  1036. },
  1037. resetChildSort: function () {
  1038. let me = preHandleSortObj;
  1039. let nodes = me.childTreeObj.getCheckedNodes();
  1040. let sortKeys = [];
  1041. for (let node of nodes) {
  1042. sortKeys.push(node.Key);
  1043. }
  1044. preHandleObj.currentNode[JV.PROP_PARENT_CHILD_SORT_KEY][
  1045. JV.PROP_CHILD_SORT_KEYS
  1046. ] = sortKeys;
  1047. },
  1048. resetNormalSort: function () {
  1049. let me = preHandleSortObj;
  1050. let nodes = me.normalTreeObj.getCheckedNodes();
  1051. let normalSortKeys = [];
  1052. for (let node of nodes) {
  1053. let keyObj = { key: node.Key, order: node.Order };
  1054. normalSortKeys.push(keyObj);
  1055. }
  1056. preHandleObj.currentNode[JV.PROP_SORT_KEYS] = normalSortKeys;
  1057. },
  1058. addDiyDom: function (treeId, treeNode) {
  1059. let aObj = $("#" + treeNode.tId + IDMark_A);
  1060. let editStr =
  1061. "<select class='selDemo' id='diySelect_" +
  1062. treeNode.tId +
  1063. "'><option value='ascend'>升序 </option><option value='descend'>降序 </option></select>";
  1064. aObj.after(editStr);
  1065. let sel = $("#diySelect_" + treeNode.tId);
  1066. if (sel) {
  1067. sel.bind("change", function () {
  1068. treeNode.Order = sel[0].value;
  1069. preHandleSortObj.resetNormalSort();
  1070. });
  1071. }
  1072. },
  1073. onSortTypeChange: function (dom) {
  1074. //排序类型的选择/更改
  1075. let me = preHandleObj;
  1076. me.hide_all_dom();
  1077. $("#div_pre_handle_data")[0].style.display = "";
  1078. $("#div_sort_type")[0].style.display = "";
  1079. let data_dom = $("#select_mapping_data")[0];
  1080. if (dom.selectedIndex === 2) {
  1081. $("#div_sort_type_according_to_parent")[0].style.display = "";
  1082. $("#div_sort_type_parent_data")[0].style.display = "";
  1083. preHandleSortObj.parentTreeObj = $.fn.zTree.init(
  1084. $("#parent_sorting_keys"),
  1085. sortingKeysSetting,
  1086. exposed_properties_arr[0]
  1087. );
  1088. preHandleSortObj.childTreeObj = $.fn.zTree.init(
  1089. $("#child_sorting_keys"),
  1090. sortingKeysSetting,
  1091. exposed_properties_arr[data_dom.selectedIndex]
  1092. );
  1093. me.currentNode[JV.PROP_PARENT_CHILD_SORT_KEY] = {};
  1094. me.currentNode[JV.PROP_PARENT_CHILD_SORT_KEY][JV.PROP_PARENT_DATA_KEY] =
  1095. pre_handle_data_objects[0];
  1096. me.currentNode[JV.PROP_PARENT_CHILD_SORT_KEY][JV.PROP_PARENT_SORT_KEYS] =
  1097. [];
  1098. me.currentNode[JV.PROP_PARENT_CHILD_SORT_KEY][JV.PROP_CHILD_SORT_KEYS] =
  1099. [];
  1100. me.currentNode[JV.PROP_OTHER_SUB_SORT] = [];
  1101. } else if (dom.selectedIndex === 0) {
  1102. $("#div_sort_type_normal")[0].style.display = "";
  1103. preHandleSortObj.normalTreeObj = $.fn.zTree.init(
  1104. $("#pre_handle_sort_keys_reversed"),
  1105. sortingKeysSetting,
  1106. exposed_properties_arr[data_dom.selectedIndex]
  1107. );
  1108. me.currentNode[JV.PROP_SORT_KEYS] = [];
  1109. } else if (dom.selectedIndex === 1) {
  1110. $("#div_sort_tree")[0].style.display = "";
  1111. preHandleSortObj.normalTreeObj = $.fn.zTree.init(
  1112. $("#bills_top_nodes"),
  1113. sortingTreeSetting,
  1114. fixed_top_bills_nodes
  1115. );
  1116. } else {
  1117. //自定义
  1118. $("#div_sort_self_define")[0].style.display = "";
  1119. $("#selfDefineSort")[0].value = "";
  1120. me.currentNode[JV.PROP_SORT_TYPE_SELF_DEFINE_LOGIC] = "";
  1121. }
  1122. me.currentNode[JV.PROP_SORT_TYPE] = dom.value;
  1123. },
  1124. changeSelfDefineExpression: function (dom) {
  1125. let me = preHandleObj;
  1126. if (me.currentNode) {
  1127. me.currentNode[JV.PROP_SORT_TYPE_SELF_DEFINE_LOGIC] = dom.value;
  1128. }
  1129. },
  1130. extractTabFields: function (handleObj) {
  1131. let me = this,
  1132. rst = {};
  1133. rst[JV.PROP_HANDLE_TYPE] = handleObj[JV.PROP_HANDLE_TYPE];
  1134. rst[JV.PROP_DATA_KEY] = handleObj[JV.PROP_DATA_KEY];
  1135. rst[JV.PROP_SORT_TYPE] = handleObj[JV.PROP_SORT_TYPE];
  1136. switch (sort_types.indexOf(handleObj[JV.PROP_SORT_TYPE])) {
  1137. case -1:
  1138. //unknown!
  1139. break;
  1140. case 0:
  1141. //normal
  1142. rst[JV.PROP_SORT_KEYS] = handleObj[JV.PROP_SORT_KEYS];
  1143. break;
  1144. case 1:
  1145. //tree
  1146. rst[JV.PROP_FILTER_TOP_BILLS_NODES] =
  1147. handleObj[JV.PROP_FILTER_TOP_BILLS_NODES];
  1148. rst[JV.PROP_FILTER_OTHER_BILLS_NODES] =
  1149. handleObj[JV.PROP_FILTER_OTHER_BILLS_NODES];
  1150. break;
  1151. case 2:
  1152. //according to parent
  1153. rst[JV.PROP_PARENT_CHILD_SORT_KEY] =
  1154. handleObj[JV.PROP_PARENT_CHILD_SORT_KEY];
  1155. rst[JV.PROP_OTHER_SUB_SORT] = [];
  1156. if (handleObj.items && handleObj.items.length > 0) {
  1157. for (let subSort of handleObj.items) {
  1158. let dtlRst = {};
  1159. me.copyNode(subSort, dtlRst);
  1160. delete dtlRst.Name;
  1161. delete dtlRst.PROP_DATA_KEY;
  1162. rst[JV.PROP_OTHER_SUB_SORT].push(dtlRst);
  1163. dtlRst = null;
  1164. }
  1165. }
  1166. break;
  1167. case 3:
  1168. //self define
  1169. rst[JV.PROP_SORT_TYPE_SELF_DEFINE_LOGIC] =
  1170. handleObj[JV.PROP_SORT_TYPE_SELF_DEFINE_LOGIC];
  1171. break;
  1172. default:
  1173. break;
  1174. }
  1175. return rst;
  1176. },
  1177. };
  1178. let preHandleFilterObj = {
  1179. treeObj: null,
  1180. copyNode: function (src, dest) {
  1181. let me = preHandleFilterObj,
  1182. keys = [];
  1183. for (let filterItem of src[JV.PROP_FILTER_KEYS]) {
  1184. let item = { key: filterItem.key };
  1185. item[JV.PROP_FILTER_CONDITION] = filterItem[JV.PROP_FILTER_CONDITION];
  1186. item[JV.PROP_FILTER_COMPARE_VAL] = filterItem[JV.PROP_FILTER_COMPARE_VAL];
  1187. if (filterItem[JV.PROP_FILTER_COMPARE_OBJ]) {
  1188. item[JV.PROP_FILTER_COMPARE_OBJ] =
  1189. filterItem[JV.PROP_FILTER_COMPARE_OBJ];
  1190. item[JV.PROP_FILTER_COMPARE_OBJ_KEY] =
  1191. filterItem[JV.PROP_FILTER_COMPARE_OBJ_KEY];
  1192. }
  1193. keys.push(item);
  1194. }
  1195. dest[JV.PROP_HANDLE_TYPE] = src[JV.PROP_HANDLE_TYPE];
  1196. dest[JV.PROP_DATA_KEY] = src[JV.PROP_DATA_KEY];
  1197. dest[JV.PROP_FILTER_KEYS] = keys;
  1198. if (
  1199. src[JV.PROP_OTHER_SUB_FILTER] &&
  1200. src[JV.PROP_OTHER_SUB_FILTER].length > 0
  1201. ) {
  1202. dest.items = [];
  1203. for (let subFilter of src[JV.PROP_OTHER_SUB_FILTER]) {
  1204. let dtlRst = { Name: "子过滤", Title: "" };
  1205. subFilter[JV.PROP_DATA_KEY] = src[JV.PROP_DATA_KEY];
  1206. me.copyNode(subFilter, dtlRst);
  1207. dtlRst[JV.PROP_HANDLE_TYPE] = src[JV.PROP_HANDLE_TYPE];
  1208. dtlRst[JV.PROP_DATA_KEY] = src[JV.PROP_DATA_KEY];
  1209. dest.items.push(dtlRst);
  1210. }
  1211. }
  1212. },
  1213. refresh_node: function () {
  1214. let me = this;
  1215. $("#div_filter_type")[0].style.display = "";
  1216. if (preHandleObj.currentNode) {
  1217. let idx = pre_handle_data_objects.indexOf(
  1218. preHandleObj.currentNode[JV.PROP_DATA_KEY]
  1219. );
  1220. me.treeObj = $.fn.zTree.init(
  1221. $("#pre_handle_filter_keys_reversed"),
  1222. filterKeysSetting,
  1223. exposed_properties_arr[idx]
  1224. );
  1225. let nodes = me.treeObj.getNodes();
  1226. for (let filterItem of preHandleObj.currentNode[JV.PROP_FILTER_KEYS]) {
  1227. for (let keyNode of nodes) {
  1228. if (filterItem.key === keyNode.Key) {
  1229. me.treeObj.checkNode(keyNode, true, false, false);
  1230. //and then others...
  1231. //过滤条件
  1232. keyNode[JV.PROP_FILTER_CONDITION] =
  1233. filterItem[JV.PROP_FILTER_CONDITION];
  1234. if (keyNode.isBoolean) {
  1235. keyNode[JV.PROP_FILTER_COMPARE_VAL] =
  1236. filterItem[JV.PROP_FILTER_COMPARE_VAL];
  1237. $("#diyCheck_" + keyNode.tId)[0].checked =
  1238. keyNode["booleanOptions"].indexOf(
  1239. filterItem["compareValue"]
  1240. ) === 0;
  1241. } else if (keyNode.hasOwnProperty("individualType")) {
  1242. $("#diySelect_" + keyNode.tId)[0].selectedIndex =
  1243. condition_types.indexOf(filterItem[JV.PROP_FILTER_CONDITION]);
  1244. //条件值
  1245. keyNode[JV.PROP_FILTER_COMPARE_VAL] =
  1246. filterItem[JV.PROP_FILTER_COMPARE_VAL];
  1247. $("#diyInput_" + keyNode.tId)[0].value =
  1248. filterItem[JV.PROP_FILTER_COMPARE_VAL];
  1249. for (let idx = 0; idx < keyNode["individualType"].length; idx++) {
  1250. let idType = keyNode["individualType"][idx];
  1251. if (
  1252. idType.Value.toString() ===
  1253. filterItem[JV.PROP_FILTER_COMPARE_VAL].toString()
  1254. ) {
  1255. $("#diyDataDetailSelect_" + keyNode.tId)[0].selectedIndex =
  1256. idx;
  1257. break;
  1258. }
  1259. }
  1260. } else {
  1261. $("#diySelect_" + keyNode.tId)[0].selectedIndex =
  1262. condition_types.indexOf(filterItem[JV.PROP_FILTER_CONDITION]);
  1263. //条件值
  1264. keyNode[JV.PROP_FILTER_COMPARE_VAL] =
  1265. filterItem[JV.PROP_FILTER_COMPARE_VAL];
  1266. $("#diyInput_" + keyNode.tId)[0].value =
  1267. filterItem[JV.PROP_FILTER_COMPARE_VAL];
  1268. //其他关联业务数据对象
  1269. if (filterItem[JV.PROP_FILTER_COMPARE_OBJ]) {
  1270. let cmpObjDom = $("#diyDataSelect_" + keyNode.tId)[0];
  1271. keyNode[JV.PROP_FILTER_COMPARE_OBJ] =
  1272. filterItem[JV.PROP_FILTER_COMPARE_OBJ];
  1273. let idx = pre_handle_data_objects.indexOf(
  1274. filterItem[JV.PROP_FILTER_COMPARE_OBJ]
  1275. );
  1276. cmpObjDom.selectedIndex = idx + 1;
  1277. me.private_setup_compare_obj(cmpObjDom);
  1278. let cmpObjIdDom = $("#diyDataDetailSelect_" + keyNode.tId)[0];
  1279. for (let i = 0; i < cmpObjIdDom.children.length; i++) {
  1280. let option = cmpObjIdDom.children[i];
  1281. if (
  1282. option.value === filterItem[JV.PROP_FILTER_COMPARE_OBJ_KEY]
  1283. ) {
  1284. keyNode[JV.PROP_FILTER_COMPARE_OBJ_KEY] =
  1285. filterItem[JV.PROP_FILTER_COMPARE_OBJ_KEY];
  1286. cmpObjIdDom.selectedIndex = i;
  1287. break;
  1288. }
  1289. }
  1290. }
  1291. }
  1292. break;
  1293. }
  1294. }
  1295. }
  1296. }
  1297. },
  1298. onCheck: function (event, treeId, treeNode) {
  1299. let me = preHandleFilterObj;
  1300. me.resetFilter();
  1301. },
  1302. resetFilter: function () {
  1303. let me = this;
  1304. let nodes = me.treeObj.getCheckedNodes();
  1305. let normalSortKeys = [];
  1306. for (let node of nodes) {
  1307. let keyObj = { key: node.Key };
  1308. if (!node[JV.PROP_FILTER_CONDITION]) {
  1309. node[JV.PROP_FILTER_CONDITION] = "==";
  1310. }
  1311. keyObj[JV.PROP_FILTER_CONDITION] = node[JV.PROP_FILTER_CONDITION];
  1312. keyObj[JV.PROP_FILTER_COMPARE_VAL] = node[JV.PROP_FILTER_COMPARE_VAL];
  1313. if (node[JV.PROP_FILTER_COMPARE_OBJ]) {
  1314. keyObj[JV.PROP_FILTER_COMPARE_OBJ] = node[JV.PROP_FILTER_COMPARE_OBJ];
  1315. keyObj[JV.PROP_FILTER_COMPARE_OBJ_KEY] =
  1316. node[JV.PROP_FILTER_COMPARE_OBJ_KEY];
  1317. }
  1318. normalSortKeys.push(keyObj);
  1319. }
  1320. preHandleObj.currentNode[JV.PROP_FILTER_KEYS] = normalSortKeys;
  1321. },
  1322. build_filter_handle_data_selection_str: function (treeId, treeNode) {
  1323. let rst = [];
  1324. rst.push(
  1325. "<select class='selDemo' id='diyDataSelect_" + treeNode.tId + "'>"
  1326. );
  1327. rst.push("<option value='empty'>无</option>");
  1328. for (let i = 0; i < pre_handle_data_objects.length; i++) {
  1329. rst.push(
  1330. "<option value='" +
  1331. pre_handle_data_objects[i] +
  1332. "'>" +
  1333. pre_handle_data_objects_name[i] +
  1334. "</option>"
  1335. );
  1336. }
  1337. rst.push("</select>");
  1338. return rst.join("");
  1339. },
  1340. build_filter_handle_data_detail_selection_str: function (treeId, treeNode) {
  1341. let rst = [];
  1342. rst.push(
  1343. "<select class='selDemo' id='diyDataDetailSelect_" + treeNode.tId + "'>"
  1344. );
  1345. rst.push("</select>");
  1346. return rst.join("");
  1347. },
  1348. build_individual_filter_selection_str: function (individualTypes, treeNode) {
  1349. let rst = [];
  1350. rst.push(
  1351. "<select class='selDemo' id='diyDataDetailSelect_" + treeNode.tId + "'>"
  1352. );
  1353. for (let i = 0; i < individualTypes.length; i++) {
  1354. rst.push(
  1355. "<option value='" +
  1356. individualTypes[i].Value +
  1357. "'>" +
  1358. individualTypes[i].Name +
  1359. "</option>"
  1360. );
  1361. }
  1362. rst.push("</select>");
  1363. return rst.join("");
  1364. },
  1365. addDiyDom: function (treeId, treeNode) {
  1366. let me = preHandleFilterObj;
  1367. let aObj = $("#" + treeNode.tId + IDMark_A);
  1368. if (treeNode.hasOwnProperty("isBoolean")) {
  1369. let checkStr =
  1370. "<input type='checkbox' id='diyCheck_" + treeNode.tId + "' />";
  1371. aObj.after(checkStr);
  1372. let sel = $("#diyCheck_" + treeNode.tId);
  1373. if (sel) {
  1374. sel.bind("change", me.filterConditionCheck);
  1375. }
  1376. } else if (treeNode.hasOwnProperty("individualType")) {
  1377. let dataDtlSelStr = me.build_individual_filter_selection_str(
  1378. treeNode.individualType,
  1379. treeNode
  1380. );
  1381. aObj.after(dataDtlSelStr);
  1382. let editStr =
  1383. "<input type='text' id='diyInput_" + treeNode.tId + "' width='10'/>";
  1384. aObj.after(editStr);
  1385. let selStr =
  1386. "<select class='selDemo' id='diySelect_" +
  1387. treeNode.tId +
  1388. "'><option value='=='>等于</option><option value='==='>全等于</option><option value='>'>大于</option><option value='>='>大于等于</option><option value='<'>小于</option><option value='<='>小于等于</option><option value='!='>不等于</option><option value='in'>在</option><option value='not in'>不在</option></select>";
  1389. aObj.after(selStr);
  1390. let sel = $("#diySelect_" + treeNode.tId);
  1391. if (sel) {
  1392. sel.bind("change", me.filterConditionChange);
  1393. }
  1394. sel = $("#diyInput_" + treeNode.tId);
  1395. if (sel) {
  1396. sel.bind("change", me.filterCompareValChange);
  1397. }
  1398. sel = $("#diyDataDetailSelect_" + treeNode.tId);
  1399. if (sel) {
  1400. sel.bind("change", me.filterIndividualCompareObjKeyChange);
  1401. }
  1402. } else {
  1403. //注意:这是后面的DOM先生成
  1404. let dataDtlSelStr = me.build_filter_handle_data_detail_selection_str(
  1405. treeId,
  1406. treeNode
  1407. );
  1408. aObj.after(dataDtlSelStr);
  1409. let dataSelStr = me.build_filter_handle_data_selection_str(
  1410. treeId,
  1411. treeNode
  1412. );
  1413. aObj.after(dataSelStr);
  1414. let editStr =
  1415. "<input type='text' id='diyInput_" + treeNode.tId + "' width='10'/>";
  1416. aObj.after(editStr);
  1417. let selStr =
  1418. "<select class='selDemo' id='diySelect_" +
  1419. treeNode.tId +
  1420. "'><option value='=='>等于</option><option value='==='>全等于</option><option value='>'>大于</option><option value='>='>大于等于</option><option value='<'>小于</option><option value='<='>小于等于</option><option value='!='>不等于</option><option value='in'>在</option><option value='not in'>不在</option></select>";
  1421. aObj.after(selStr);
  1422. let sel = $("#diySelect_" + treeNode.tId);
  1423. if (sel) {
  1424. sel.bind("change", me.filterConditionChange);
  1425. }
  1426. sel = $("#diyInput_" + treeNode.tId);
  1427. if (sel) {
  1428. sel.bind("change", me.filterCompareValChange);
  1429. }
  1430. sel = $("#diyDataSelect_" + treeNode.tId);
  1431. if (sel) {
  1432. sel.bind("change", me.filterCompareObjChange);
  1433. }
  1434. sel = $("#diyDataDetailSelect_" + treeNode.tId);
  1435. if (sel) {
  1436. sel.bind("change", me.filterCompareObjKeyChange);
  1437. }
  1438. }
  1439. },
  1440. filterCompareValChange(event) {
  1441. let me = preHandleFilterObj,
  1442. sel = event.currentTarget,
  1443. tId = sel.id.slice(9);
  1444. let node = me.treeObj.getNodeByTId(tId);
  1445. node[JV.PROP_FILTER_COMPARE_VAL] = sel.value;
  1446. me.resetFilter();
  1447. },
  1448. filterConditionCheck: function (event) {
  1449. let me = preHandleFilterObj,
  1450. sel = event.currentTarget,
  1451. tId = sel.id.slice(9);
  1452. let node = me.treeObj.getNodeByTId(tId);
  1453. node[JV.PROP_FILTER_CONDITION] = "===";
  1454. if (sel.checked === true) {
  1455. node[JV.PROP_FILTER_COMPARE_VAL] = node.booleanOptions[0];
  1456. } else {
  1457. node[JV.PROP_FILTER_COMPARE_VAL] = node.booleanOptions[1];
  1458. }
  1459. //注:这里虽然是boolean选项,但实际有可能是0,1的选择(非true,false),所以需要设置node节点的booleanOptions
  1460. me.resetFilter();
  1461. },
  1462. filterConditionChange: function (event) {
  1463. let me = preHandleFilterObj,
  1464. sel = event.currentTarget,
  1465. tId = sel.id.slice(10);
  1466. let node = me.treeObj.getNodeByTId(tId);
  1467. node[JV.PROP_FILTER_CONDITION] = sel.value;
  1468. me.resetFilter();
  1469. },
  1470. private_setup_compare_obj: function (dom) {
  1471. let me = this,
  1472. sel = dom,
  1473. tId = sel.id.slice(14);
  1474. let node = me.treeObj.getNodeByTId(tId);
  1475. node[JV.PROP_FILTER_COMPARE_OBJ] = sel.value;
  1476. let idx = pre_handle_data_objects.indexOf(sel.value);
  1477. let dtlKey = "diyDataDetailSelect_" + tId;
  1478. let dtlSel = document.getElementById(dtlKey);
  1479. dtlSel.length = 0;
  1480. if (idx >= 0) {
  1481. let jdtlSel = $("#" + dtlKey);
  1482. for (let item of exposed_properties_arr[idx]) {
  1483. jdtlSel.append(
  1484. "<option value='" + item.Key + "'>" + item.Name + "</option>"
  1485. );
  1486. }
  1487. } else {
  1488. //清除所有key选项
  1489. node[JV.PROP_FILTER_COMPARE_OBJ_KEY] = null;
  1490. }
  1491. },
  1492. filterCompareObjChange: function (event) {
  1493. let me = preHandleFilterObj,
  1494. sel = event.currentTarget;
  1495. me.private_setup_compare_obj(sel);
  1496. me.resetFilter();
  1497. },
  1498. filterIndividualCompareObjKeyChange: function (event) {
  1499. let me = preHandleFilterObj,
  1500. sel = event.currentTarget,
  1501. tId = sel.id.slice(20);
  1502. let inTxt = $("#diyInput_" + tId);
  1503. if (inTxt) {
  1504. inTxt[0].value = sel.value;
  1505. }
  1506. let node = me.treeObj.getNodeByTId(tId);
  1507. node[JV.PROP_FILTER_COMPARE_VAL] = sel.value;
  1508. me.resetFilter();
  1509. },
  1510. filterCompareObjKeyChange: function (event) {
  1511. let me = preHandleFilterObj,
  1512. sel = event.currentTarget,
  1513. tId = sel.id.slice(20);
  1514. let node = me.treeObj.getNodeByTId(tId);
  1515. node[JV.PROP_FILTER_COMPARE_OBJ_KEY] = sel.value;
  1516. me.resetFilter();
  1517. },
  1518. extractTabFields: function (handleObj) {
  1519. let me = preHandleFilterObj,
  1520. rst = {};
  1521. me.copyNode(handleObj, rst);
  1522. rst[JV.PROP_OTHER_SUB_FILTER] = [];
  1523. let private_extract_other_sub_filter = function (
  1524. parentFilter,
  1525. currentFilterNode
  1526. ) {
  1527. let dtlRst = {};
  1528. me.copyNode(currentFilterNode, dtlRst);
  1529. parentFilter[JV.PROP_OTHER_SUB_FILTER].push(dtlRst);
  1530. if (currentFilterNode.items && currentFilterNode.items.length > 0) {
  1531. dtlRst[JV.PROP_OTHER_SUB_FILTER] = [];
  1532. for (let subFilterNode of currentFilterNode.items) {
  1533. private_extract_other_sub_filter(dtlRst, subFilterNode);
  1534. }
  1535. }
  1536. delete dtlRst.Name;
  1537. delete dtlRst[JV.PROP_DATA_KEY];
  1538. dtlRst = null;
  1539. };
  1540. if (handleObj.items && handleObj.items.length > 0) {
  1541. for (let subFilter of handleObj.items) {
  1542. private_extract_other_sub_filter(rst, subFilter);
  1543. }
  1544. }
  1545. return rst;
  1546. },
  1547. };
  1548. let preHandleSummaryObj = {
  1549. copyNode: function (src, dest) {
  1550. //
  1551. },
  1552. refresh_node: function () {
  1553. $("#div_summary_type")[0].style.display = "";
  1554. if (preHandleObj.currentNode) {
  1555. }
  1556. },
  1557. extractTabFields: function (handleObj) {
  1558. let rst = {};
  1559. //
  1560. return rst;
  1561. },
  1562. };
  1563. let preHandleAdjustObj = {
  1564. copyNode: function (src, dest) {
  1565. //
  1566. },
  1567. refresh_node: function () {
  1568. $("#div_adjust_type")[0].style.display = "";
  1569. if (preHandleObj.currentNode) {
  1570. }
  1571. },
  1572. extractTabFields: function (handleObj) {
  1573. let rst = {};
  1574. //
  1575. return rst;
  1576. },
  1577. };
  1578. let preHandleAddDummyObj = {
  1579. copyNode: function (src, dest) {
  1580. //
  1581. },
  1582. refresh_node: function () {
  1583. $("#div_add_dummy_type")[0].style.display = "";
  1584. if (preHandleObj.currentNode) {
  1585. }
  1586. },
  1587. extractTabFields: function (handleObj) {
  1588. let rst = {};
  1589. //
  1590. return rst;
  1591. },
  1592. };
  1593. let preHandleQuantitiesBillsSortObj = {
  1594. copyNode: function (src, dest) {
  1595. dest[JV.PROP_HANDLE_TYPE_CHANGE_QUANTITIES_BILLS_SORT_TYPE] =
  1596. src.billSortType;
  1597. dest[JV.PROP_HANDLE_TYPE_CHANGE_QUANTITIES_BILLS_DATA_TYPE] =
  1598. src.billSortData;
  1599. },
  1600. refresh_node: function () {
  1601. $("#div_quantities_bills_sort_bar")[0].style.display = "";
  1602. if (preHandleObj.currentNode) {
  1603. $("#select_quantities_bills_sort_types")[0].value =
  1604. preHandleObj.currentNode[
  1605. JV.PROP_HANDLE_TYPE_CHANGE_QUANTITIES_BILLS_SORT_TYPE
  1606. ] || "all";
  1607. $("#select_quantities_bills_types")[0].value =
  1608. preHandleObj.currentNode[
  1609. JV.PROP_HANDLE_TYPE_CHANGE_QUANTITIES_BILLS_DATA_TYPE
  1610. ] || "bills";
  1611. }
  1612. },
  1613. extractTabFields: function (handleObj) {
  1614. let me = preHandleQuantitiesBillsSortObj,
  1615. rst = {};
  1616. me.copyNode(handleObj, rst);
  1617. rst = {
  1618. 预处理类型: "转化工程量清单",
  1619. 映射数据对象: "bills",
  1620. billSortType:
  1621. handleObj[JV.PROP_HANDLE_TYPE_CHANGE_QUANTITIES_BILLS_SORT_TYPE],
  1622. billSortData:
  1623. handleObj[JV.PROP_HANDLE_TYPE_CHANGE_QUANTITIES_BILLS_DATA_TYPE],
  1624. };
  1625. return rst;
  1626. },
  1627. onQuantitiesBillsSortTypeChange: function (dom) {
  1628. // 工程量清单排序类型
  1629. let me = preHandleObj;
  1630. me.currentNode[JV.PROP_HANDLE_TYPE_CHANGE_QUANTITIES_BILLS_SORT_TYPE] =
  1631. dom.value;
  1632. },
  1633. onQuantitiesBillsTypesChange: function (dom) {
  1634. // 工程量清单排序对象类型
  1635. let me = preHandleObj;
  1636. me.currentNode[JV.PROP_HANDLE_TYPE_CHANGE_QUANTITIES_BILLS_DATA_TYPE] =
  1637. dom.value;
  1638. },
  1639. };