anhui_chizhou.js 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. INTERFACE_EXPORT = (() => {
  2. 'use strict';
  3. /**
  4. *
  5. * @param {String} areaKey - 地区标识,如:'安徽@马鞍山',有些地区的接口只是取值上有不同,共有一个接口脚本, 需要通过地区标识确定一些特殊处理
  6. * @param {Number} exportKind - 导出类型,招标、投标、控制价
  7. * @param {Object} projectData - 项目表数据:{ 建设项目Data, children: [单位工程...] }
  8. * @param {Object} tenderDetailMap - 单位工程ID与getData接口数据(projectObj.project的结构)的映射。
  9. * @return {Promise<Array>} - 返回的数据结构必须按照规定:[{ data, exportKind, fileName }],参考web\building_saas\standard_interface\index.js中的注释说明
  10. */
  11. async function entry(areaKey, exportKind, projectData, tenderDetailMap) {
  12. const {
  13. CONFIG: {
  14. TYPE,
  15. WHITE_SPACE
  16. },
  17. UTIL: {
  18. getValueByKey,
  19. getFee,
  20. generateHardwareId,
  21. },
  22. Element,
  23. } = INTERFACE_EXPORT_BASE;
  24. const {
  25. EXPORT_KIND: { BID_INVITATION, BID_SUBMISSION, CONTROL },
  26. fixedFlag,
  27. RationType,
  28. } = window.commonConstants
  29. const isBidInvitation = exportKind === BID_INVITATION; // 是否是招标
  30. const isBidSubmission = exportKind === BID_SUBMISSION; // 是否是投标
  31. const isControl = exportKind === CONTROL; // 是否是控制价
  32. let serialNo;
  33. let vTree;
  34. const info = projectData.property && projectData.property.basicInformation || [];
  35. const summary = projectData.summaryInfo[projectData.ID];
  36. // const feature = tenderDetailMap[projectData.children[0].ID].property.projectFeature;
  37. // ------------------------------------------------------------------------------------------------------------
  38. // 提取字符串中的数字
  39. function getNum(str) {
  40. let num = str.replace(/[^0-9]/ig, "");
  41. return num;
  42. }
  43. function CheckNull(Value) {
  44. if (!Value)
  45. return 0
  46. else
  47. return Value;
  48. }
  49. function GetRationDataType(ration){
  50. let dt;
  51. if (calcTools.isRationItem(ration))
  52. dt = 3
  53. else if (calcTools.isGljRation(ration))
  54. dt = 1
  55. else if (calcTools.isVolumePrice(ration))
  56. dt = 4;
  57. return dt;
  58. }
  59. const valueMapArr = [
  60. ['新建', '1'],
  61. ['改扩建', '2'],
  62. ['高速公路', '1'],
  63. ['一级公路', '2'],
  64. ['二级公路', '3'],
  65. ['三级公路', '4'],
  66. ['四级公路', '5'],
  67. ['独立桥梁', '6'],
  68. ['独立隧道', '7'],
  69. ['一般计税', '1'],
  70. ['简易计税', '2'],
  71. ['清单', '1'],
  72. ['招标控制价', '2'],
  73. ['投标报价', '3'],
  74. ['支票', '1'],
  75. ['电汇', '2'],
  76. ['银行汇票', '3'],
  77. ['现金', '4'],
  78. ['银行保函', '5'],
  79. ['其他保函', '6'],
  80. ['其他', '7']
  81. ];
  82. function valueMap(AValue){
  83. let rst = AValue;
  84. for (let i in valueMapArr) {
  85. if (valueMapArr[i][0] == AValue){
  86. rst = valueMapArr[i][1];
  87. break;
  88. }
  89. }
  90. return rst;
  91. }
  92. function getRCJLB(AType){ // 1=人工;2=材料;3=机械组成物;4=设备;5=混凝土/砂浆/配合比;6=机械台班
  93. let rst = 2;
  94. AType+="";
  95. if (AType == '1'){
  96. rst = '1';
  97. }
  98. else if (['201', '205', '206', '207', '4'].includes(AType)){
  99. rst = '2';
  100. }
  101. else if (['202', '203', '204'].includes(AType)){
  102. rst = '5';
  103. }
  104. else if (['301'].includes(AType)){
  105. rst = '6';
  106. }
  107. else if (['302', '303'].includes(AType)){
  108. rst = '3';
  109. }
  110. else if (AType == '5'){
  111. rst = '4';
  112. };
  113. return rst;
  114. }
  115. // ------------------------------------------------------------------------------------------------------------
  116. function CreateNode(nodeName, attrArr = []) {
  117. Element.call(this, nodeName, attrArr);
  118. }
  119. function GongCXX() {
  120. const attrs = [
  121. { name: '项目编号', value: getValueByKey(info, 'projNum') },
  122. { name: '项目名称', value: projectData.name }, // projName
  123. { name: '建设单位', value: getValueByKey(info, 'constructingUnits') },
  124. { name: '起始桩号', value: getValueByKey(info, 'startChainages') },
  125. { name: '终点桩号', value: getValueByKey(info, 'endChainages') },
  126. { name: '建设地址', value: getValueByKey(info, 'constructionAddress') },
  127. { name: '项目概况', value: getValueByKey(info, 'projOverview') },
  128. { name: '建设性质', value: valueMap(getValueByKey(info, 'natureConstruction')) },
  129. { name: '专业划分', value: valueMap(getValueByKey(info, 'roadGrade')) },
  130. { name: '道路里程', value: getValueByKey(info, 'roadDistance') },
  131. { name: '设计单位', value: getValueByKey(info, 'designUnit') },
  132. { name: '计税方式', value: valueMap(getValueByKey(info, 'taxMode')) },
  133. // { name: '文件类型', value: valueMap(getValueByKey(info, 'projType')) },
  134. {name: '文件类型', value: isBidInvitation ? 1 : (isControl ? 2 : 3)}, // 1=工程量清单;2=招标控制价;3=投标报价;
  135. { name: '标准版本号', value: '1.0' },
  136. { name: 'GUID', value: projectData._id }
  137. ];
  138. Element.call(this, '工程信息', attrs);
  139. }
  140. function ZhaoBiaoXX() {
  141. const attrs = [
  142. { name: '招标人', value: getValueByKey(info, 'tendereeName') },
  143. { name: '招标人纳税识别号', value: getValueByKey(info, 'tendereeTaxpayerIdentificationNo') },
  144. { name: '招标法定代表人或其授权人', value: getValueByKey(info, 'tenderAuthorizer') },
  145. { name: '招标法人或其授权人身份证号', value: getValueByKey(info, 'tenderAuthorizerIDNo') },
  146. { name: '造价咨询人', value: getValueByKey(info, 'costConsultant') },
  147. { name: '造价咨询人纳税识别号', value: getValueByKey(info, 'costConsultantTaxpayerIdentificationNo') },
  148. { name: '造价咨询人法定代表人或其授权人', value: getValueByKey(info, 'consultantAuthorizer') },
  149. { name: '造价咨询法人或其授权人身份证号', value: getValueByKey(info, 'consultantAuthorizerTaxpayerIdentificationNo') },
  150. { name: '编制人', value: getValueByKey(info, 'compileApprover') },
  151. { name: '编制人资格证号', value: getValueByKey(info, 'compileCertNo') },
  152. { name: '编制日期', value: getValueByKey(info, 'compileDate'), type: TYPE.DATE},
  153. { name: '复核人', value: getValueByKey(info, 'reviewApprover') },
  154. { name: '复核人资格证号', value: getValueByKey(info, 'reviewCertNo') },
  155. { name: '复核日期', value: getValueByKey(info, 'reviewDate'), type: TYPE.DATE },
  156. { name: '软件公司识别码', value: ''},
  157. ];
  158. Element.call(this, '招标信息', attrs);
  159. }
  160. function ZhaoBiaoKZJ() {
  161. const attrs = [
  162. { name: '招标人', value: getValueByKey(info, 'tendereeName') },
  163. { name: '招标人纳税识别号', value: getValueByKey(info, 'tendereeTaxpayerIdentificationNo') },
  164. { name: '招标法定代表人或其授权人', value: getValueByKey(info, 'tenderAuthorizer') },
  165. { name: '招标法人或其授权人身份证号', value: getValueByKey(info, 'tenderAuthorizerIDNo') },
  166. { name: '造价咨询人', value: getValueByKey(info, 'costConsultant') },
  167. { name: '造价咨询人纳税识别号', value: getValueByKey(info, 'costConsultantTaxpayerIdentificationNo') },
  168. { name: '造价咨询人法定代表人或其授权人', value: getValueByKey(info, 'consultantAuthorizer') },
  169. { name: '造价咨询法人或其授权人身份证号', value: getValueByKey(info, 'consultantAuthorizerTaxpayerIdentificationNo') },
  170. { name: '编制人', value: getValueByKey(info, 'compileApprover') },
  171. { name: '编制人资格证号', value: getValueByKey(info, 'compileCertNo') },
  172. { name: '编制日期', value: getValueByKey(info, 'compileDate'), type: TYPE.DATE},
  173. { name: '复核人', value: getValueByKey(info, 'reviewApprover') },
  174. { name: '复核人资格证号', value: getValueByKey(info, 'reviewCertNo') },
  175. { name: '复核日期', value: getValueByKey(info, 'reviewDate'), type: TYPE.DATE },
  176. { name: '审核人', value: getValueByKey(info, 'examineApprover') },
  177. { name: '审核人资格证号', value: getValueByKey(info, 'examineCertNo') },
  178. { name: '审核日期', value: getValueByKey(info, 'examineDate'), type: TYPE.DATE },
  179. { name: '控制价总价', value: summary.totalCost, type: TYPE.DECIMAL },
  180. { name: '工期', value: getValueByKey(info, 'timeLimit') },
  181. { name: '质量要求', value: getValueByKey(info, 'qualityRequirements') }
  182. ];
  183. Element.call(this, '招标控制价', attrs);
  184. }
  185. function TouBiaoXX() {
  186. let hardID = generateHardwareId();
  187. let [cpuId, diskId, macId] = hardID.split(";");
  188. const attrs = [
  189. { name: '投标人', value: getValueByKey(info, 'bidderName') },
  190. { name: '投标人纳税识别号', value: getValueByKey(info, 'bidderAuthorizerIDNo') },
  191. { name: '投标人法定代表或其授权人', value: getValueByKey(info, 'bidderAuthorizer') },
  192. { name: '投标人法人或其授权人身份证号', value: getValueByKey(info, 'bidderAuthorizerTaxpayerIdentificationNo') },
  193. { name: '编制人', value: getValueByKey(info, 'compileApprover') },
  194. { name: '编制人资格证号', value: getValueByKey(info, 'compileCertNo') },
  195. { name: '编制日期', value: getValueByKey(info, 'compileDate'), type: TYPE.DATE},
  196. { name: '复核人', value: getValueByKey(info, 'reviewApprover') },
  197. { name: '复核人资格证号', value: getValueByKey(info, 'reviewCertNo') },
  198. { name: '复核日期', value: getValueByKey(info, 'reviewDate'), type: TYPE.DATE },
  199. { name: '审核人', value: getValueByKey(info, 'examineApprover') },
  200. { name: '审核人资格证号', value: getValueByKey(info, 'examineCertNo') },
  201. { name: '审核日期', value: getValueByKey(info, 'examineDate'), type: TYPE.DATE },
  202. { name: '投标总价', value: summary.totalCost, type: TYPE.DECIMAL },
  203. { name: '工期', value: getValueByKey(info, 'timeLimit') },
  204. { name: '投标担保金额', value: getValueByKey(info, 'tenderGuaranteeAmount') },
  205. { name: '质量承诺', value: getValueByKey(info, 'qualityCommitment') },
  206. { name: '投标担保方式', value: valueMap(getValueByKey(info, 'tenderGuaranteeMethod')) },
  207. { name: '造价软件品牌', value: '珠海纵横创新软件有限公司' },
  208. { name: '造价软件版本', value: "Ver" + VERSION },
  209. // { name: '造价软件加密锁编号', value: userID },
  210. { name: '造价软件加密锁编号', value: `ZH${userMobile}` }, // 池州有验证码,需要用户输入这个信息,但用户不知道自己的ID,换成 ZH + 手机号
  211. //
  212. { name: '计算机硬件信息', value: cpuId + diskId + macId },
  213. { name: '软件公司识别码', value: (projectObj.project.property.boqType !== 1) ? $('#certifyInputForAH_CZ')[0].value : ''},
  214. //
  215. ];
  216. Element.call(this, '投标信息', attrs);
  217. }
  218. function addRationGLJs(rData, rationNode){
  219. for (let i = 0; i < rData.rationGLJList.length; i++) {
  220. let glj = rData.rationGLJList[i];
  221. const attrs = [
  222. { name: '人材机标识', value: glj.GLJID},
  223. { name: '人材机含量', value: glj.tenderQuantity}
  224. ];
  225. let gljNode = new CreateNode('定额人材机含量明细', attrs);
  226. rationNode.children.push(gljNode);
  227. }
  228. }
  229. function addRations(ABillItem, ABillNode){
  230. for (let i = 0; i < ABillItem.children.length; i++) {
  231. let r = ABillItem.children[i];
  232. let rData = ABillItem.children[i].data;
  233. const attrs = [
  234. { name: '序号', value: r.row()},
  235. { name: '定额编号', value: rData.code},
  236. { name: '定额名称', value: rData.name},
  237. { name: '单位', value: rData.unit},
  238. { name: '数量', value: rData.tenderQuantity},
  239. { name: '单价', value: rData.feesIndex && rData.feesIndex.common ? rData.feesIndex.common.tenderUnitFee : 0},
  240. { name: '合价', value: rData.feesIndex && rData.feesIndex.common ? rData.feesIndex.common.tenderTotalFee : 0},
  241. { name: '备注', value: ''},
  242. { name: '数据类型', value: GetRationDataType(r)},
  243. { name: '人工费', value: getFee(rData.fees, 'marketLabour.tenderTotalFee'), type: TYPE.DECIMAL},
  244. { name: '主材费', value: getFee(rData.fees, 'marketMaterial.tenderTotalFee'), type: TYPE.DECIMAL},
  245. { name: '辅材费', value: 0},
  246. { name: '机械使用费', value: getFee(rData.fees, 'marketMachine.tenderTotalFee'), type: TYPE.DECIMAL},
  247. { name: '设备费', value: 0},
  248. { name: '措施费1', value: getFee(rData.fees, 'measure.tenderTotalFee'), type: TYPE.DECIMAL}, // FQuery2.FieldByName('OtherDirectFee'},
  249. { name: '措施费2', value: 0}, //getFee(r.fees, 'measure.tenderTotalFee'), type: TYPE.DECIMAL
  250. { name: '企业管理费', value: getFee(rData.fees, 'manage.tenderTotalFee'), type: TYPE.DECIMAL},
  251. { name: '规费', value: getFee(rData.fees, 'force.tenderTotalFee'), type: TYPE.DECIMAL},
  252. { name: '利润', value: getFee(rData.fees, 'profit.tenderTotalFee'), type: TYPE.DECIMAL},
  253. { name: '税金', value: getFee(rData.fees, 'tax.tenderTotalFee'), type: TYPE.DECIMAL},
  254. ];
  255. let rationNode = new CreateNode('定额信息表', attrs);
  256. ABillNode.children.push(rationNode);
  257. addRationGLJs(rData, rationNode);
  258. }
  259. }
  260. function recursiveAddBills(AItem, AXMLParent) {
  261. if (AItem == undefined || !calcTools.isBill(AItem)) return;
  262. let vBillNode;
  263. function addBillNode () {
  264. serialNo++;
  265. let zmh = (AItem.parent == vTree.roots[0]) ? getNum(AItem.data.name) : AItem.data.code;
  266. const attrs = [
  267. {name: "序号", value: serialNo},
  268. {name: "清单章节号", value: AItem.data.sectionCode ? AItem.data.sectionCode : zmh},
  269. {name: "子目号", value: zmh},
  270. {name: "子目名称", value: AItem.data.name},
  271. {name: "单位", value: AItem.data.unit},
  272. {name: "数量", value: AItem.data.quantity, type: TYPE.DECIMAL}
  273. ];
  274. // debugger;
  275. let dj = 0, hj = 0;
  276. // if ((isBidSubmission || isControl) || (AItem.data.specialProvisional == '专业工程')){
  277. if (isBidSubmission || isControl) {
  278. hj = CheckNull(AItem.data.feesIndex && AItem.data.feesIndex.common ? AItem.data.feesIndex.common.tenderTotalFee : 0);
  279. dj = CheckNull(AItem.data.feesIndex && AItem.data.feesIndex.common ? AItem.data.feesIndex.common.tenderUnitFee : 0);
  280. }
  281. attrs.push({name: "单价", value: dj}, {name: "合价", value: hj});
  282. attrs.push({name: "备注", value: isBidInvitation ? '' : AItem.data.remark});
  283. let sjlx;
  284. if (AItem.data.specialProvisional == '专业工程') // 专项暂定
  285. sjlx = 21;
  286. else {
  287. if (calcTools.isLeafBill(AItem)) {
  288. if (AItem.data.code == '102-3') // 安全生产费
  289. sjlx = '22'
  290. else if ((AItem.data.code == '-a') && (AItem.parent && (AItem.parent.data.code == '101-1'))) // 工程一切险
  291. sjlx = '23'
  292. else if ((AItem.data.code == '-b') && (AItem.parent && (AItem.parent.data.code == '101-1'))) // 第三者责任险
  293. sjlx = '24'
  294. else
  295. sjlx = '20';
  296. }
  297. else {
  298. sjlx = '1'; // 父清单
  299. attrs.find(function getE(e) {return e.name == '单位'}).value = '项';
  300. }
  301. }
  302. attrs.push({name: "数据类型", value: sjlx});
  303. if (isBidSubmission || isControl){
  304. attrs.push(
  305. {name: "人工费", value: getFee(AItem.data.fees, 'marketLabour.tenderTotalFee'), type: TYPE.DECIMAL},
  306. {name: "主材费", value: getFee(AItem.data.fees, 'marketMaterial.tenderTotalFee'), type: TYPE.DECIMAL},
  307. {name: "辅材费", value: 0},
  308. {name: "机械使用费", value: getFee(AItem.data.fees, 'marketMachine.tenderTotalFee'), type: TYPE.DECIMAL},
  309. {name: "设备费", value: 0},
  310. {name: "措施费1", value: getFee(AItem.data.fees, 'measure.tenderTotalFee'), type: TYPE.DECIMAL},
  311. {name: "措施费2", value: 0}, // getFee(AItem.data.fees, 'measure.tenderTotalFee'), type: TYPE.DECIMAL},
  312. {name: "企业管理费", value: getFee(AItem.data.fees, 'manage.tenderTotalFee'), type: TYPE.DECIMAL},
  313. {name: "规费", value: getFee(AItem.data.fees, 'force.tenderTotalFee'), type: TYPE.DECIMAL},
  314. {name: "利润", value: getFee(AItem.data.fees, 'profit.tenderTotalFee'), type: TYPE.DECIMAL},
  315. {name: "税金", value: getFee(AItem.data.fees, 'tax.tenderTotalFee'), type: TYPE.DECIMAL}
  316. );
  317. }
  318. else{
  319. attrs.push(
  320. {name: "人工费", value: 0},
  321. {name: "主材费", value: 0},
  322. {name: "辅材费", value: 0},
  323. {name: "机械使用费", value: 0},
  324. {name: "设备费", value: 0},
  325. {name: "措施费1", value: 0},
  326. {name: "措施费2", value: 0},
  327. {name: "企业管理费", value: 0},
  328. {name: "规费", value: 0},
  329. {name: "利润", value: 0},
  330. {name: "税金", value: 0}
  331. );
  332. }
  333. vBillNode = new CreateNode('工程量清单明细', attrs);
  334. AXMLParent.children.push(vBillNode);
  335. if (isBidSubmission || isControl) {
  336. if (calcTools.isLeafBill(AItem))
  337. addRations(AItem, vBillNode)
  338. };
  339. }
  340. addBillNode();
  341. recursiveAddBills(AItem.children[0], vBillNode);
  342. recursiveAddBills(AItem.nextSibling, AXMLParent);
  343. }
  344. function createGCLQDB(Bid, gongCLQDB){
  345. vTree = tenderDetailMap[Bid.ID].mainTree;
  346. serialNo = 0;
  347. recursiveAddBills(vTree.roots[0].children[0], gongCLQDB);
  348. };
  349. function createJiRGXXB(Bid, jiRGXXB){
  350. let vJRG, vKind, vChild;
  351. let vJRGNode, vKindNode, vChildNode;
  352. vJRG = vTree.roots.find(function getElement(e) {return e.getFlag() == fixedFlag.DAYWORK_LABOR});
  353. if (!vJRG) return;
  354. let attrs = [
  355. { name: '序号', value: 1 },
  356. { name: '名称', value: vJRG.data.name },
  357. { name: '数据类型', value: 0 },
  358. { name: '合价', value: isBidInvitation ? 0 : ( vJRG.data.feesIndex && vJRG.data.feesIndex.common ? vJRG.data.feesIndex.common.tenderTotalFee : 0) },
  359. ];
  360. vJRGNode = new CreateNode('计日工信息标题', attrs);
  361. jiRGXXB.children.push(vJRGNode);
  362. function getDataType_JRG(name) {
  363. if (name.includes('劳务'))
  364. return 1
  365. else if (name.includes('材料'))
  366. return 2
  367. else if (name.includes('机械'))
  368. return 3
  369. else
  370. return 0;
  371. }
  372. let jrgNo = 1;
  373. for (let i = 0; i < vJRG.children.length; i++) {
  374. vKind = vJRG.children[i];
  375. jrgNo++;
  376. let attrs = [
  377. { name: '序号', value: jrgNo },
  378. { name: '名称', value: vKind.data.name },
  379. { name: '数据类型', value: getDataType_JRG(vKind.data.name) },
  380. { name: '合价', value: isBidInvitation ? 0 : (vKind.data.feesIndex && vKind.data.feesIndex.common ? vKind.data.feesIndex.common.tenderTotalFee : 0) },
  381. ];
  382. vKindNode = new CreateNode('计日工信息标题', attrs);
  383. jiRGXXB.children.push(vKindNode);
  384. for (let j = 0; j < vKind.children.length; j++) {
  385. vChild = vKind.children[j];
  386. let attrs = [
  387. { name: '编号', value: vChild.data.code },
  388. { name: '名称', value: vChild.data.name },
  389. { name: '数据类型', value: getDataType_JRG(vKind.data.name) + 3},
  390. { name: '单位', value: vChild.data.unit },
  391. { name: '暂定数量', value: vChild.data.quantity },
  392. { name: '单价', value: isBidInvitation ? 0 : (vChild.data.feesIndex && vChild.data.feesIndex.common ? vChild.data.feesIndex.common.tenderUnitFee : 0) },
  393. { name: '合价', value: isBidInvitation ? 0 : (vChild.data.feesIndex && vChild.data.feesIndex.common ? vChild.data.feesIndex.common.tenderTotalFee : 0) }
  394. ];
  395. vChildNode = new CreateNode('计日工信息明细', attrs);
  396. vKindNode.children.push(vChildNode);
  397. }
  398. }
  399. }
  400. function createZaoJHZB(Bid, ZaoJHZB) {
  401. const flagToLB = {
  402. [fixedFlag.ONE_SEVEN_BILLS]: '1',
  403. [fixedFlag.PROVISIONAL_TOTAL]: '2',
  404. [fixedFlag.BILLS_TOTAL_WT_PROV]: '3',
  405. [fixedFlag.DAYWORK_LABOR]: '4',
  406. [fixedFlag.PROVISIONAL]: '5',
  407. [fixedFlag.TOTAL_COST]: '6',
  408. };
  409. const map_ZC_LB = [
  410. {reg: /(第?100章?至第?700章?)/, zc: '', lb: '1'},
  411. {reg: /已包含在清单合计中的材料/, zc: '', lb: '2'},
  412. {reg: /清单合计减去材料/, zc: '', lb: '3'},
  413. {reg: /计日工合计/, zc: '', lb: '4'},
  414. {reg: /暂列金额/, zc: '', lb: '5'},
  415. {reg: /投标报价/, zc: '', lb: '6'},
  416. {reg: /第100章/, zc: '100', lb: '11'}, // 我们软件"章"字后面有2个空格!
  417. {reg: /第200章/, zc: '200', lb: '12'},
  418. {reg: /第300章/, zc: '300', lb: '13'},
  419. {reg: /第400章/, zc: '400', lb: '14'},
  420. {reg: /第500章/, zc: '500', lb: '15'},
  421. {reg: /第600章/, zc: '600', lb: '16'},
  422. {reg: /第700章/, zc: '700', lb: '17'}
  423. ]
  424. function getZCLB(flag, name, kind){
  425. let rst = kind === 2 ? flagToLB[flag] || '' : '';
  426. if (rst) {
  427. return rst;
  428. }
  429. const trimName = (name || '').replace(/\s/g, '');
  430. for (let i = 0; i < map_ZC_LB.length; i++){
  431. if (map_ZC_LB[i].reg.test(trimName)){
  432. if (kind == 1)
  433. rst = map_ZC_LB[i].zc
  434. else if (kind == 2)
  435. rst = map_ZC_LB[i].lb;
  436. break;
  437. }
  438. }
  439. return rst;
  440. }
  441. function getJE(node){
  442. if (isBidInvitation && ![fixedFlag.PROVISIONAL_TOTAL, fixedFlag.PROVISIONAL].includes(node.getFlag()))
  443. return 0
  444. else
  445. return (node.data.feesIndex && node.data.feesIndex.common ? node.data.feesIndex.common.tenderTotalFee : 0);
  446. }
  447. let nodes = [vTree.roots[0], ...vTree.roots[0].children, ...vTree.roots.slice(1)];
  448. let hzmxNo = 0;
  449. for (let i = 0; i < nodes.length; i++){
  450. let node = nodes[i];
  451. hzmxNo++;
  452. let attrs = [
  453. { name: '序号', value: hzmxNo },
  454. { name: '章次', value: getZCLB(node.getFlag(), node.data.name, 1) },
  455. { name: '名称', value: node.data.name },
  456. { name: '金额', value: getJE(node) },
  457. { name: '类别', value: getZCLB(node.getFlag(), node.data.name, 2) },
  458. { name: '备注', value: node.data.remark }
  459. ];
  460. const zaoJHZMX = new CreateNode('造价汇总明细', attrs);
  461. ZaoJHZB.children.push(zaoJHZMX);
  462. };
  463. }
  464. function createRenCJHZ(Bid, RenCJHZ) {
  465. const pGLJs = tenderDetailMap[Bid.ID].projectGLJ.datas.gljList;
  466. for (let i = 0; i < pGLJs.length; i++){
  467. let pGLJ = pGLJs[i];
  468. let attrs = [
  469. { name: '人材机标识', value: pGLJ.glj_id },
  470. { name: '人材机编号', value: pGLJ.code },
  471. { name: '人材机名称', value: pGLJ.name },
  472. { name: '规格型号', value: pGLJ.specs },
  473. { name: '单位', value: pGLJ.unit },
  474. { name: '数量', value: pGLJ.quantity },
  475. { name: '单价', value: pGLJ.unit_price.market_price },
  476. { name: '人材机类别', value: getRCJLB(pGLJ.type) },
  477. { name: '是否主要材料', value: pGLJ.is_main_material }, // , type: TYPE.BOOL
  478. { name: '是否甲供', value: pGLJ.supply },
  479. { name: '是否暂估', value: pGLJ.is_evaluate },
  480. { name: '备注', value: pGLJ.remark }
  481. ];
  482. // if (pGLJ.type != 9){
  483. const renCJHZMXB = new CreateNode('人材机汇总明细表', attrs);
  484. RenCJHZ.children.push(renCJHZMXB);
  485. // }
  486. }
  487. }
  488. // 生成标段工程
  489. function createGLBDGC(Bid, gongLGCSJ, gongLGCHZ, Num){
  490. let attrs0 = [
  491. { name: '序号', value: Num },
  492. { name: '标段名称', value: Bid.name },
  493. { name: '金额', value: isBidInvitation ? 0 : projectData.summaryInfo[Bid.ID].totalCost }
  494. ];
  495. const GUID = (Bid.GUID ? Bid.GUID : Bid.property.GUID) || Bid._id;
  496. const attrs1 = [{ name: '唯一标识-Guid', value: GUID }]; // 公路标段工程
  497. const gongLBDGC = new CreateNode('公路标段工程', attrs0.concat(attrs1));
  498. gongLGCSJ.children.push(gongLBDGC);
  499. const gongCLQDB = new CreateNode('工程量清单表');
  500. const jiRGXXB = new CreateNode('计日工信息表');
  501. const ZaoJHZB = new CreateNode('造价汇总表');
  502. const RenCJHZ = new CreateNode('人材机汇总');
  503. gongLBDGC.children = [gongCLQDB, jiRGXXB, ZaoJHZB, RenCJHZ];
  504. createGCLQDB(Bid, gongCLQDB);
  505. createJiRGXXB(Bid, jiRGXXB);
  506. createZaoJHZB(Bid, ZaoJHZB);
  507. createRenCJHZ(Bid, RenCJHZ);
  508. // 同步生成 公路工程汇总明细 数据
  509. const attrs2 = [{ name: '备注', value: '' }];
  510. const gongLGCHZMX = new CreateNode('公路工程汇总明细', attrs0.concat(attrs2));
  511. gongLGCHZ.children.push(gongLGCHZMX);
  512. }
  513. // 组装主体框架数据
  514. function setupConstruction() {
  515. const chiZGLGC = new CreateNode('池州公路工程');
  516. const gongCXX = new GongCXX(); // 工程信息
  517. const zhaoTBXX = new CreateNode('招投标信息');
  518. const gongLGCSJ = new CreateNode('公路工程数据');
  519. chiZGLGC.children = [gongCXX, zhaoTBXX, gongLGCSJ];
  520. if (isBidInvitation)
  521. zhaoTBXX.children.push(new ZhaoBiaoXX());
  522. else if (isControl)
  523. zhaoTBXX.children.push(new ZhaoBiaoKZJ());
  524. else
  525. zhaoTBXX.children.push(new TouBiaoXX());
  526. const gongLGCHZ = new CreateNode('公路工程汇总');
  527. gongLGCSJ.children.push(gongLGCHZ);
  528. let n = 0;
  529. for (const Bid of projectData.children) {
  530. n++;
  531. createGLBDGC(Bid, gongLGCSJ, gongLGCHZ, n);
  532. }
  533. gongLGCSJ.children.push(gongLGCSJ.children.shift());
  534. const suffix = INTERFACE_CONFIG[areaKey]['fileSuffix'][exportKind];
  535. return [{
  536. data: chiZGLGC,
  537. exportKind,
  538. fileName: `${projectData.name}${suffix}`
  539. }];
  540. }
  541. return setupConstruction();
  542. }
  543. return {
  544. entry
  545. };
  546. })();