rpt_tpl_pre_handle.js 66 KB

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