pm_import.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  1. 'use strict';
  2. /**
  3. *
  4. *
  5. * @author Zhong
  6. * @date 2019/5/15
  7. * @version
  8. */
  9. //操作接口为eventListen
  10. const importView = (() => {
  11. let importXML = null;
  12. let xmlObj = null; //导入xml转化后的对象
  13. let tbcObj = null; //待确认对象
  14. //显示、隐藏提示上传文件窗口相关提示信息
  15. function showUploadAlert(success, msg) {
  16. if (!success) {
  17. $('#uploadAlert').removeClass('alert-success');
  18. $('#uploadAlert').addClass('alert-danger');
  19. } else {
  20. $('#uploadAlert').removeClass('alert-danger');
  21. $('#uploadAlert').addClass('alert-success');
  22. }
  23. $('#uploadAlert').text(msg);
  24. $('#uploadAlert').show();
  25. }
  26. /*
  27. * 获取单位工程数据(将所有单项工程里的单位工程放到一起,含有单项工程的一些信息)
  28. * @param {Object} xmlObj @return {Array}
  29. * */
  30. function getTenderDatas(xmlObj) {
  31. if (!xmlObj || !xmlObj.engs) {
  32. return [];
  33. }
  34. let rst = [];
  35. for (let eng of xmlObj.engs) {
  36. if (Array.isArray(eng.tenders)) {
  37. for (let tender of eng.tenders) {
  38. tender.temp = {}; //暂时存放的信息(不是从导入文件中获取的,记录当前工程已阅、选择的费用标准、计算程序)
  39. tender.engName = eng.name;
  40. }
  41. rst.push(...eng.tenders);
  42. }
  43. }
  44. return rst;
  45. }
  46. //确认界面提示信息隐藏
  47. function hideTBCInfo() {
  48. $('#tbc-engName-info').hide();
  49. $('#tbc-tenderName-info').hide();
  50. $('#tbc-engineering-info').hide();
  51. $('#tbc-calcProgram-info').hide();
  52. }
  53. //待确认界面相关
  54. class TBC {
  55. constructor(xmlObj, fileKind, valuation, taxType) {
  56. this.datas = getTenderDatas(xmlObj);
  57. this.fileKind = fileKind; //文件类型
  58. this.valuationType = 'bill'; //计价方式 暂时默认为清单计价
  59. this.valuation = valuation; //计价规则数据
  60. this.taxType = taxType; //计税方法
  61. this.engineeringList = valuation ? valuation.engineering_list : []; //工程专业库数据
  62. this.curIdx = 0; //当前单位工程数据索引
  63. this.init();
  64. }
  65. //初始化
  66. init() {
  67. this.next(this.curIdx);
  68. $('#importInterface .modal-content:eq(1) p:eq(0)').text(`该文件共有${this.datas.length}个单位工程待导入`); //信息统计信息
  69. }
  70. checkConfirmed() {
  71. //检查数据是否都确认过了
  72. let allConfirmed = this.datas.every(data => data.temp.confirmed);
  73. if (allConfirmed) {
  74. $('#import-confirm').prop('disabled', false);
  75. }
  76. }
  77. //检测当前待确认工程是否有效,有效才可确认
  78. checkValid() {
  79. let engName = $('#tbc-engName').val();
  80. if (!engName) {
  81. return $('#tbc-engName-info').show();
  82. } else {
  83. $('#tbc-engName-info').hide();
  84. }
  85. let tenderName = $('#tbc-tenderName').val();
  86. if (!tenderName) {
  87. return $('#tbc-tenderName-info').show();
  88. } else {
  89. $('#tbc-tenderName-info').hide();
  90. }
  91. let engineering = $('#tbc-engineering').val();
  92. if (!engineering) {
  93. return $('#tbc-engineering-info').show();
  94. } else {
  95. $('#tbc-engineering-info').hide();
  96. }
  97. let feeStandard = $('#tbc-feeStandard').val();
  98. if (!feeStandard) {
  99. return $('#tbc-feeStandard-info').show();
  100. } else {
  101. $('#tbc-feeStandard-info').hide();
  102. }
  103. let calcProgram = $('#tbc-calcProgram').val();
  104. if (!calcProgram) {
  105. return $('#tbc-calcProgram-info').show();
  106. } else {
  107. $('#tbc-calcProgram-info').hide();
  108. }
  109. return null;
  110. }
  111. //下一工程
  112. next(idx = null) {
  113. this.curIdx = idx !== null ? idx : this.curIdx + 1;
  114. if (this.curIdx && this.checkValid()) {
  115. this.curIdx--;
  116. return;
  117. }
  118. let curData = this.datas[this.curIdx];
  119. //显示这个工程的相关信息
  120. $('#tbc-engName').val(curData.engName || '');
  121. $('#tbc-tenderName').val(curData.name || '');
  122. $('#tbc-engineering').val(curData.engineering || '');
  123. curData.temp.confirmed = true; //增加确认信息(已读)
  124. if (this.curIdx === this.datas.length - 1) { //到最后一个数据了,无法点击下一工程
  125. $('#tbc-next').prop('disabled', true);
  126. } else {
  127. $('#tbc-next').prop('disabled', false);
  128. }
  129. if (this.curIdx !== 0) { //不为第一个数据,可以点击上一工程
  130. $('#tbc-prev').prop('disabled', false);
  131. } else {
  132. $('#tbc-prev').prop('disabled', true);
  133. }
  134. //更新x/x信息
  135. $('#tbc-info').text(`${this.curIdx + 1}/${this.datas.length} 已确认`);
  136. //更新选项信息
  137. this.initFeeOpts(curData);
  138. this.checkConfirmed();
  139. }
  140. //上一工程
  141. prev(idx = null) {
  142. this.curIdx = idx !== null ? idx : this.curIdx - 1;
  143. let curData = this.datas[this.curIdx];
  144. $('#tbc-engName').val(curData.engName || '');
  145. $('#tbc-tenderName').val(curData.name || '');
  146. $('#tbc-engineering').val(curData.engineering || '');
  147. if (this.curIdx === 0) { //到第一个数据了,无法点击上一工程
  148. $('#tbc-prev').prop('disabled', true);
  149. } else {
  150. $('#tbc-prev').prop('disabled', false);
  151. }
  152. if (this.curIdx !== this.datas.length - 1) { //不为最后一个数据了,可以点击下一工程
  153. $('#tbc-next').prop('disabled', false);
  154. } else {
  155. $('#tbc-next').prop('disabled', true);
  156. }
  157. //更新x/x信息
  158. $('#tbc-info').text(`${this.curIdx + 1}/${this.datas.length} 已确认`);
  159. //更新选项信息
  160. this.initFeeOpts(curData);
  161. this.checkConfirmed();
  162. }
  163. /*
  164. * 初始化工程的费用选项等相关信息(专业工程、费用标准、计算程序等)
  165. * 根据导入文件提取的专业工程等数据确定,需要我们软件有对应的工程专业数据,否则下拉选择为空
  166. * @param {Object}tenderData(当前确认单位工程数据) {Array}engineeringList(当前计价规则下的工程专业数据)
  167. * @return {void}
  168. * */
  169. initFeeOpts(tenderData) {
  170. $('#tbc-engineering').empty(); //清空工程专业选项
  171. $('#tbc-feeStandard').empty(); //清空费用标准选项
  172. $('#tbc-calcProgram').empty(); //清空计算程序选项
  173. let engineerings = [];
  174. if (tenderData.temp.engineering) {
  175. engineerings = this.engineeringList.filter(data => data.lib.name === tenderData.temp.engineering);
  176. } else {
  177. engineerings = this.engineeringList.filter(data => data.lib.name === tenderData.engineering);
  178. tenderData.temp.engineering = tenderData.engineering;
  179. }
  180. //文件里的工程专业跟软件里的对应不上,取第一个
  181. if (!engineerings.length) {
  182. let firstEngineering = this.engineeringList[0];
  183. engineerings = this.engineeringList.filter(data => data.lib.name === firstEngineering.lib.name);
  184. tenderData.temp.engineering = engineerings[0] ? engineerings[0].lib.name : tenderData.engineering;
  185. }
  186. if (!engineerings.length) {
  187. return;
  188. }
  189. //工程专业名称去重
  190. let engineeringNames = [...new Set(this.engineeringList.map(data => data.lib.name))];
  191. let engineeringHtml = engineeringNames.map(name =>
  192. `<option ${tenderData.temp.engineering === name ? 'selected' : ''} value="${name}">${name}</option>`);
  193. $('#tbc-engineering').html(engineeringHtml);
  194. //$('#tbc-engineering').html(`<option selected value="${tenderData.engineering}">${tenderData.engineering}</option>`);
  195. //费用标准,若当前工程有费用标准数据(该数据本身没有费用标准数据,选择过了,就会记录),则选中该费用标准
  196. let feeOptsHtml = engineerings.map(data =>
  197. `<option ${tenderData.temp.feeStandard === data.lib.feeName ? 'selected' : ''} value="${data.lib.feeName}">${data.lib.feeName}</option>`).join('');
  198. $('#tbc-feeStandard').html(feeOptsHtml);
  199. //记录选中的费用标准
  200. tenderData.temp.feeStandard = $('#tbc-feeStandard').val();
  201. //根据工程专业及费用标准确定的当前选中的工程专业库
  202. let curEngineering = engineerings.find(data => data.lib.feeName === tenderData.temp.feeStandard) || engineerings[0];
  203. //根据计税方法过滤出来的计税组合
  204. let taxDatas = curEngineering.lib.tax_group.filter(data => data.taxType == this.taxType);
  205. //计算程序,若当前工程有计算程序(该数据本身没有计算程序数据,选择过了,就会记录),则选中该计算程序
  206. let calcOptsHtml = taxDatas.map(data =>
  207. `<option ${tenderData.temp.calcProgram === data.program_lib.name ? 'selected' : ''} value="${data.program_lib.name}">${data.program_lib.name}</option>`);
  208. $('#tbc-calcProgram').html(calcOptsHtml);
  209. tenderData.temp.calcProgram = $('#tbc-calcProgram').val();
  210. }
  211. }
  212. /*
  213. * 根据条件获取计税组合数据
  214. * @param {Object}query ({engineeringName, feeName, taxType, calcProgram}) {Array}engineeringList(当前计价规则下的所有工程专业数据)
  215. * @return {Object}
  216. * */
  217. function getTaxData(query, engineeringList) {
  218. //工程专业名称 + 费用标准名称 确定一个工程专业数据
  219. let engineering = engineeringList.find(data => query.engineeringName === data.lib.name &&
  220. query.feeStandard === data.lib.feeName);
  221. if (!engineering || !Array.isArray(engineering.lib.tax_group)) {
  222. return null;
  223. }
  224. return engineering.lib.tax_group.find(data => query.taxType == data.taxType &&
  225. query.calcProgram === data.program_lib.name);
  226. }
  227. //获取单位工程项目属性的一些数据(新建单位工程需要,前端能获取到的一些数据,还有一些数据需要后端获取: rootProjectID, projectFeature..)
  228. /*
  229. * @param {Object}tbcObj(TBC实例) {Object}curData(单位工程数据)
  230. * @return {Object}
  231. * */
  232. function getProperty(tbcObj, curData) {
  233. if (!tbcObj) {
  234. throw '存在无效数据,无法生成项目。';
  235. }
  236. //计税数据
  237. let query = {
  238. engineeringName: curData.temp.engineering || curData.engineering,
  239. feeStandard: curData.temp.feeStandard,
  240. taxType: tbcObj.taxType, //取导入时选择的计税方法,不读取文件中的计税方法
  241. calcProgram: curData.temp.calcProgram
  242. };
  243. let taxData = getTaxData(query, tbcObj.engineeringList);
  244. if (!taxData) {
  245. throw '无效计税数据,无法生成项目。';
  246. }
  247. //当前工程专业数据
  248. let curEngineering = tbcObj.engineeringList.find(data => query.engineeringName === data.lib.name &&
  249. query.feeStandard === data.lib.feeName);
  250. return {
  251. region: '全省', //地区
  252. valuationType: tbcObj.valuationType, //计价方式
  253. valuation: tbcObj.valuation.id, //计价规则
  254. valuationName: tbcObj.valuation.name,
  255. engineering_id: curEngineering.engineering_id, //工程专业
  256. engineeringName: curEngineering.lib.name,
  257. taxType: parseInt(tbcObj.taxType), //计税方法
  258. isInstall: !!curEngineering.lib.isInstall, //是安装工程?
  259. isItemIncrease: !!curEngineering.lib.isItemIncrease, //是否子目增加费?
  260. isAreaIncrease: !!curEngineering.lib.isAreaIncrease, //是否子目增加费?
  261. feeStandardName: curEngineering.lib.feeName, //费用标准
  262. engineering: curEngineering.lib.engineering, //定额取费专业
  263. projectEngineering: curEngineering.lib.projectEngineering, //单位工程取费专业
  264. featureLibID: curEngineering.lib.feature_lib[0] ? curEngineering.lib.feature_lib[0].id : '', //工程特征
  265. indexName: curEngineering.lib.indexName, // 指标名称
  266. engineerInfoLibID: curEngineering.lib.engineer_info_lib[0] ? curEngineering.lib.engineer_info_lib[0].id : '', // 工程信息指标
  267. engineerFeatureLibID: curEngineering.lib.engineer_feature_lib[0] ? curEngineering.lib.engineer_feature_lib[0].id : '', //工程特征指标
  268. economicLibID: curEngineering.lib.economic_lib[0] ? curEngineering.lib.economic_lib[0].id : '', // 主要经济指标
  269. mainQuantityLibID: curEngineering.lib.main_quantity_lib[0] ? curEngineering.lib.main_quantity_lib[0].id : '', // 主要工程量指标
  270. materialLibID: curEngineering.lib.material_lib[0] ? curEngineering.lib.material_lib[0].id : '', // 主要工料指标
  271. calcProgram: { name: taxData.program_lib.name, id: taxData.program_lib.id }, //计算程序
  272. colLibID: taxData.col_lib.id, //列设置
  273. templateLibID: taxData.template_lib.id, //清单模板
  274. unitPriceFile: { name: curData.name, id: '' }, //新建单价文件
  275. feeFile: { name: curData.name, id: `newFeeRate@@${taxData.fee_lib.id}` } //新建费率文件
  276. };
  277. }
  278. function eventListen() {
  279. //选择文件
  280. $('#customFile').change(async function () {
  281. let file = $(this)[0].files[0];
  282. $('#import-confirm').prop('disabled', true); //确认导入无效
  283. $('.custom-file-label').text(`${file ? file.name : ''}`); //设置选择框文本
  284. $('#uploadAlert').hide();
  285. $('.selFile').hide();
  286. hideTBCInfo();
  287. if (file) {
  288. let reg = /(xml|XML|qtf|QTF)$/;
  289. if (file.name && !reg.test(file.name)) {
  290. $('.selFile').hide();
  291. showUploadAlert(false, '请选择xml或qtf文件。');
  292. return;
  293. }
  294. $.bootstrapLoading.start();
  295. $('#loadingPage').css('z-index', '2000');
  296. //转换数据
  297. importXML = new ImportXML();
  298. try {
  299. xmlObj = await importXML.extractData(file, false);
  300. $('.selFile input:eq(0)').val(xmlObj && xmlObj.name ? xmlObj.name : '');
  301. $('.selFile input[name="fileKind-import"]:eq(0)').prop('checked', true); //文件类型恢复成投标
  302. $('#import-taxType').val('1'); //计税方法显示回默认的一般计税法
  303. $('.selFile').show(); //显示建设项目、计价规则
  304. } catch (err) {
  305. console.log(err);
  306. showUploadAlert(false, err);
  307. $(this).val('');
  308. }
  309. $.bootstrapLoading.end();
  310. }
  311. });
  312. //下一步
  313. $('#import-next').click(function () {
  314. let file = $('#customFile')[0].files[0];
  315. if (!file) {
  316. showUploadAlert(false, '请选择导入文件。');
  317. return;
  318. }
  319. if (!xmlObj) {
  320. showUploadAlert(false, '不存在有效数据。');
  321. return;
  322. }
  323. let projectName = $('.selFile input:eq(0)').val();
  324. if (!projectName) {
  325. showUploadAlert(false, '不存在有效建设项目。');
  326. return;
  327. }
  328. //文件类型
  329. let fileKind = $('.selFile input[name="fileKind-import"]:checked').val();
  330. if (!fileKind) {
  331. showUploadAlert(false, '不存在有效文件类型。');
  332. }
  333. //计价规则
  334. let valuation = $('#import-valuation').val();
  335. if (!valuation) {
  336. showUploadAlert(false, '不存在有效计价规则。');
  337. return;
  338. }
  339. //计税方法
  340. let taxType = $('#import-taxType').val();
  341. if (!taxType) {
  342. showUploadAlert(false, '不存在有效计税方法。');
  343. return;
  344. }
  345. if (!xmlObj.engs.length) {
  346. showUploadAlert(false, '不存在单项工程数据。');
  347. return;
  348. }
  349. if (!getTenderDatas(xmlObj).length) {
  350. showUploadAlert(false, '不存在单位工程数据。');
  351. return;
  352. }
  353. $('#importInterface .modal-content:eq(0)').hide(); //隐藏第一步内容
  354. $('#importInterface .modal-content:eq(1)').show(); //显示第二步内容
  355. //console.log(getTenderDatas(xmlObj));
  356. //console.log(xmlObj);
  357. let selValuation = billValuation.find(data => data.id === valuation);
  358. tbcObj = new TBC(xmlObj, fileKind, selValuation, taxType);
  359. });
  360. //上一步
  361. $('#import-prev').click(function () {
  362. $('#importInterface .modal-content:eq(0)').show(); //显示第一步内容
  363. $('#importInterface .modal-content:eq(1)').hide(); //隐藏第二步内容
  364. hideTBCInfo();
  365. $('#import-confirm').prop('disabled', true); //确认导入无效
  366. //清空确认字段
  367. if (tbcObj) {
  368. for (let data of tbcObj.datas) {
  369. delete data.temp.confirmed;
  370. }
  371. }
  372. });
  373. //变换专业工程
  374. $('#tbc-engineering').change(function () {
  375. let curData = tbcObj ? tbcObj.datas[tbcObj.curIdx] : null;
  376. if (!curData) {
  377. return;
  378. }
  379. curData.temp.engineering = $(this).val();
  380. tbcObj.initFeeOpts(curData);
  381. });
  382. //变换费用标准
  383. $('#tbc-feeStandard').change(function () {
  384. let curData = tbcObj ? tbcObj.datas[tbcObj.curIdx] : null;
  385. if (!curData) {
  386. return;
  387. }
  388. curData.temp.feeStandard = $(this).val();
  389. tbcObj.initFeeOpts(curData);
  390. });
  391. //变换计算程序
  392. $('#tbc-calcProgram').change(function () {
  393. let curData = tbcObj ? tbcObj.datas[tbcObj.curIdx] : null;
  394. if (!curData) {
  395. return;
  396. }
  397. curData.temp.calcProgram = $(this).val();
  398. tbcObj.initFeeOpts(curData);
  399. });
  400. //待确认-下一工程
  401. $('#tbc-next').click(function () {
  402. tbcObj.next();
  403. });
  404. //待确认-上一工程
  405. $('#tbc-prev').click(function () {
  406. tbcObj.prev();
  407. hideTBCInfo();
  408. });
  409. //确认导入
  410. $('#import-confirm').click(async function () {
  411. if (STATE.importing) {
  412. return;
  413. }
  414. STATE.importing = true;
  415. if (tbcObj && tbcObj.checkValid()) {
  416. return;
  417. }
  418. let pr = new SCComponent.InitProgressBar();
  419. try {
  420. //建设项目设置选择的文件类型和选择的计税方法
  421. xmlObj.property.fileKind = tbcObj.fileKind;
  422. xmlObj.property.taxType = tbcObj.taxType;
  423. //确定使用的计税组合
  424. tbcObj.datas.map(data => {
  425. data.property = getProperty(tbcObj, data);
  426. //默认定额库
  427. let curEngineering = tbcObj.engineeringList.find(enData => data.temp.engineering === enData.lib.name &&
  428. data.temp.feeStandard === enData.lib.feeName);
  429. let defaultLib = curEngineering.lib.ration_lib.find(data => data.isDefault) || curEngineering.lib.ration_lib[0];
  430. data.defaultRationLib = parseInt(defaultLib.id);
  431. //此费用定额下可用的定额库id,人材机库id
  432. data.rationLibIDs = curEngineering.lib.ration_lib.map(data => parseInt(data.id));
  433. data.gljLibIDs = curEngineering.lib.glj_lib.map(data => parseInt(data.id));
  434. });
  435. //确定生成建设项目的父、前、后节点ID
  436. let { parentProjectID, preProjectID, nextProjectID } = projTreeObj.getRelProjectID(projTreeObj.tree.selected);
  437. xmlObj.ParentID = parentProjectID;
  438. xmlObj.preID = preProjectID;
  439. xmlObj.NextSiblingID = nextProjectID;
  440. //确定建设项目的名称(不允许重复)
  441. let sameDepthProjs = getProjs(projTreeObj.tree.selected);
  442. if (sameDepthProjs.find(node => node.data.name === xmlObj.name)) {
  443. xmlObj.name += `(${moment(Date.now()).format('YYYY-MM-DD HH:mm:ss')})`;
  444. }
  445. $('#importInterface').modal('hide');
  446. pr.start('导入文件', '正在生成文件,请稍候……');
  447. let importData = await importXML.transformData(xmlObj);
  448. let blob = new Blob([JSON.stringify(importData)], { type: 'text/plain;charset=utf-8' });
  449. // 转换成File实例
  450. const key = `${uuid.v1()}.json`;
  451. const file = new File([blob], key);
  452. // 上传文件
  453. console.time();
  454. await projTreeObj.getUploadToken();
  455. await UPLOAD_CDN.uploadSync(file, key, projTreeObj.uptoken);
  456. // 下载并处理文件
  457. const rstData = await ajaxPost('/pm/import/importInterface', { key });
  458. console.timeEnd();
  459. if (Array.isArray(rstData)) {
  460. doAfterImport(rstData);
  461. }
  462. } catch (err) {
  463. console.log(err);
  464. alert(err);
  465. } finally {
  466. projTreeObj.uptoken = null;
  467. setTimeout(function () {
  468. STATE.importing = false;
  469. }, 500);
  470. pr.end();
  471. }
  472. });
  473. // 导入窗口激活
  474. $('#importInterface').on('show.bs.modal', function () {
  475. // 恢复计价规则下拉
  476. setValuationSels($('#import-valuation'), billValuation);
  477. });
  478. //导入窗口消失后
  479. $('#importInterface').on('hidden.bs.modal', function () {
  480. importXML = null;
  481. xmlObj = null; //重置数据
  482. tbcObj = null;
  483. $('#importInterface .modal-content:eq(0)').show(); //显示第一步内容
  484. $('#importInterface .modal-content:eq(1)').hide(); //隐藏第二步内容
  485. $('#customFile').val(''); //清除选择
  486. $('.custom-file-label').text(''); //设置选择框文本
  487. $('#uploadAlert').hide(); //隐藏提示
  488. $('.selFile').hide(); //隐藏建设项目及计价规则
  489. $('#import-confirm').prop('disabled', true); //确认导入无效
  490. $('.selFile input[name="fileKind-import"]:eq(0)').prop('checked', true); //文件类型恢复成投标
  491. $('#import-taxType').val('1'); //显示回一般计税
  492. hideTBCInfo();
  493. });
  494. }
  495. //projectDatas在后端已经按照顺序排过了: project eng1 tender1-1 tender1-2 eng2 tender2-1 tender2-2
  496. function doAfterImport(projectDatas) {
  497. //插入节点
  498. let lastNode;
  499. for (let data of projectDatas) {
  500. data.feeStandardName = data.property && data.property.feeStandardName || ''; //工程专业列显示用
  501. let parent = projTreeObj.tree.items.find(node => node.data.ID === data.ParentID),
  502. next = projTreeObj.tree.items.find(node => node.data.ID === data.NextSiblingID);
  503. lastNode = projTreeObj.insert(data, parent, next);
  504. }
  505. if (lastNode) {
  506. projTreeObj.workBook.getSheet(0).showRow(lastNode.serialNo(), GC.Spread.Sheets.VerticalPosition.center);
  507. }
  508. }
  509. return { eventListen };
  510. })();