project.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  1. /**
  2. * Created by Mai on 2017/4/1.
  3. */
  4. var PROJECT = {
  5. createNew: function (projectID, userID) {
  6. // 定义private方法
  7. var tools = {
  8. _project: null,
  9. _ID: parseInt(projectID),
  10. _userID: userID,
  11. updateLock: 0,
  12. updateData: [],
  13. operation: '',
  14. modules: {},
  15. projCounter: 'projCounter',
  16. projSetting: 'proj_setting'
  17. };
  18. var me = tools;
  19. tools.doAfterUpdate = function(result){
  20. if (!result) { return }
  21. result.forEach(function(item){
  22. if(_.isArray(item)){
  23. item.forEach(function (e) {
  24. me.eachItem(e);
  25. })
  26. }else {
  27. me.eachItem(item)
  28. }
  29. });
  30. };
  31. // isInit: 是否是初始化,导出接口用到getData,但是非初始化,多次调用getData不会覆盖原有缓存数据
  32. tools.doAfterLoad = function(result, isInit, callback){
  33. var counter;
  34. //必须要先load ProjectInfo的信息
  35. let projectInfoModule = result.find(data => data.moduleName === ModuleNames.projectInfo);
  36. if (projectInfoModule) {
  37. me._project.projectInfo = projectInfoModule.data;
  38. }
  39. result.forEach(function(item){
  40. if (item.moduleName !== ModuleNames.projectInfo) {
  41. if (me.modules[item.moduleName]){
  42. me.modules[item.moduleName].loadData(item.data, isInit);
  43. } else if (item.moduleName === me.projCounter) {
  44. counter = item.data;
  45. } else if (item.moduleName === me.projSetting) {
  46. me._project.projSetting = item.data;
  47. me._project.projSetting.moduleName = me.projSetting;
  48. } else if(item.moduleName === ModuleNames.projectGLJ){
  49. me._project.projectGLJ.loadToCache(item.data);
  50. }
  51. }
  52. });
  53. for (module in counter) {
  54. if (me.modules[module]) {
  55. me.modules[module].setMaxID(counter[module]);
  56. }
  57. }
  58. if (isInit) {
  59. projectInfoObj.showProjectInfo(me._project.projectInfo);
  60. }
  61. me._project.property = me._project.projectInfo.property;
  62. me._project.loadMainTree();
  63. //me.test(result[0].data[0]);
  64. if (callback) {
  65. callback(0);
  66. }
  67. };
  68. /* tools.doAfterLoad = function(result, callback){
  69. var counter;
  70. //必须要先load ProjectInfo的信息
  71. let projectInfoModule = result.find(data => data.moduleName === ModuleNames.projectInfo);
  72. if (projectInfoModule) {
  73. me._project.projectInfo = projectInfoModule.data;
  74. }
  75. result.forEach(function(item){
  76. if (item.moduleName !== ModuleNames.projectInfo) {
  77. if (me.modules[item.moduleName]){
  78. me.modules[item.moduleName].loadData(item.data);
  79. } else if (item.moduleName === me.projCounter) {
  80. counter = item.data;
  81. } else if (item.moduleName === me.projSetting) {
  82. me._project.projSetting = item.data;
  83. me._project.projSetting.moduleName = me.projSetting;
  84. } else if(item.moduleName === ModuleNames.projectGLJ){
  85. me._project.projectGLJ.loadToCache(item.data);
  86. }
  87. }
  88. });
  89. for (module in counter) {
  90. if (me.modules[module]) {
  91. me.modules[module].setMaxID(counter[module]);
  92. }
  93. }
  94. me._project.property = me._project.projectInfo.property;
  95. me._project.loadMainTree();
  96. //me.test(result[0].data[0]);
  97. if (callback) {
  98. callback(0);
  99. }
  100. }; */
  101. tools.eachItem=function(item){
  102. if (me.modules[item.moduleName]){
  103. me.modules[item.moduleName].doAfterUpdate(item.err, item.data);
  104. }
  105. };
  106. /*tools.test = function(data){
  107. me._project.beginUpdate('修改名称');
  108. data.name = 'test';
  109. data['updateType'] = 'ut_update';
  110. me._project.push(ModuleNames.bills, [data]);
  111. me._project.endUpdate();
  112. };*/
  113. // 所有通过this访问的属性,都不应在此单元外部进行写入操作
  114. var project = function () {
  115. tools._project = this;
  116. this.mainTree = cacheTree.createNew(this);
  117. this.Bills = Bills.createNew(this);
  118. this.Ration = Ration.createNew(this);
  119. this.GLJ = GLJ.createNew(this);
  120. this.ration_glj = ration_glj.createNew(this);
  121. this.ration_coe = ration_coe.createNew(this);
  122. this.ration_ass = ration_ass.createNew(this);
  123. this.ration_installation = ration_installation.createNew(this);
  124. this.ration_template = ration_template.createNew(this);
  125. this.quantity_detail = quantity_detail.createNew(this);
  126. this.installation_fee = installation_fee.createNew(this);
  127. this.FeeRate = FeeRate.createNew(this);
  128. // this.VolumePrice = VolumePrice.createNew(this);
  129. this.projectGLJ = new ProjectGLJ();
  130. // this.projectGLJ.loadData();
  131. this.composition = new Composition();
  132. this.composition.loadData();
  133. this.labourCoe = new LabourCoe(this);
  134. this.calcProgram = new CalcProgram(this);
  135. this.calcBase = calcBase;
  136. this.divide_setting = new DivideSetting(this);
  137. this.evaluate_list = new EvaluateList(this);
  138. this.bid_evaluation_list = new BidEvaluationList(this);
  139. // this.masterField = {ration: 'billsItemID', volumePrice: 'billsItemID'};
  140. this.masterField = {ration: 'billsItemID'};
  141. };
  142. // prototype用于定义public方法
  143. project.prototype.modify = function (modifyDatas, callback) {
  144. // To Do
  145. };
  146. // prototype用于定义public方法
  147. project.prototype.ID = function () {
  148. return tools._ID;
  149. };
  150. project.prototype.projCounter = function () {
  151. return tools.projCounter;
  152. };
  153. project.prototype.getDecimal = function (fullName) {
  154. let names = fullName.split('.'), decimal = this.Decimal;
  155. for (let name of names) {
  156. if (decimal[name]) {
  157. decimal = decimal[name];
  158. } else {
  159. return null;
  160. }
  161. }
  162. if (Object.prototype.toString.apply(decimal) === '[object Number]') {
  163. return decimal;
  164. } else {
  165. return null;
  166. }
  167. };
  168. project.prototype.loadMainTree = function () {
  169. var that = this;
  170. let loadRationGLJNode = function (cacheNode) {
  171. var newNode, bj = that.ration_glj.getMainAndEquGLJ(cacheNode.source.ID), i;
  172. for(i=0;i<bj.length;i++){
  173. that.ration_glj.transferToNodeData(bj[i]);
  174. newNode = that.mainTree.addNode(cacheNode, null, bj[i].ID);
  175. newNode.source = bj[i];
  176. newNode.sourceType = that.ration_glj.getSourceType();
  177. newNode.data = bj[i];
  178. }
  179. };
  180. var loadRationNode = function (rations, cacheNode) {
  181. var newNode, br = that.Ration.getBillsSortRation(cacheNode.source.getID()), i;
  182. for (i = 0; i < br.length; i++) {
  183. newNode = that.mainTree.addNode(cacheNode, null, br[i].ID);
  184. if(br[i].type==rationType.gljRation){
  185. br[i]= that.ration_glj.combineRationAndGLJ(br[i]);
  186. }
  187. newNode.source = br[i];
  188. newNode.sourceType = that.Ration.getSourceType();
  189. newNode.data = br[i];
  190. if(projectObj.project.projectInfo.property.displaySetting !== undefined &&
  191. projectObj.project.projectInfo.property.displaySetting.disPlayMainMaterial==true){
  192. loadRationGLJNode(newNode);
  193. }
  194. }
  195. };
  196. /* let loadVolumePriceNode = function (cacheNode) {
  197. let newNode = null, bv = that.VolumePrice.getBillsSortVolumePrice(cacheNode.source.getID());
  198. for (let v of bv) {
  199. newNode = that.mainTree.addNode(cacheNode);
  200. newNode.source = v;
  201. newNode.sourceType = that.VolumePrice.getSourceType();
  202. newNode.data = v;
  203. }
  204. };*/
  205. var loadIdTreeNode = function (nodes, parent) {
  206. var newNode, i;
  207. for (i = 0; i < nodes.length; i++) {
  208. newNode = that.mainTree.addNode(parent, null, nodes[i].data.ID);
  209. newNode.source = nodes[i];
  210. newNode.sourceType = that.Bills.getSourceType();
  211. newNode.data = nodes[i].data;
  212. that.FeeRate.loadFeeRateToBill(newNode);
  213. if (nodes[i].children.length === 0) {
  214. loadRationNode(that.Ration.datas, newNode);
  215. // loadVolumePriceNode(newNode);
  216. } else {
  217. loadIdTreeNode(nodes[i].children, newNode);
  218. }
  219. }
  220. };
  221. loadIdTreeNode(this.Bills.tree.roots, null);
  222. this.mainTree.sortTreeItems();
  223. this.mainTree.selected = this.mainTree.firstNode();
  224. };
  225. project.prototype.getParentTarget = function (node, targetField, targetValue) {
  226. var parent = node;
  227. while (parent && parent[targetField] !== targetValue) {
  228. parent = parent.parent;
  229. }
  230. return parent;
  231. };
  232. // 提供给各模块调用的统一从后台获取数据的方法
  233. /*project.prototype.pullData = function (url, data, successCallback, errorCallback) {
  234. $.ajax({
  235. type:"POST",
  236. url: url,
  237. data: {'data': JSON.stringify(data)},
  238. dataType: 'json',
  239. cache: false,
  240. timeout: 50000,
  241. success: function(result){
  242. successCallback(result);
  243. },
  244. error: function(jqXHR, textStatus, errorThrown){
  245. alert('error ' + textStatus + " " + errorThrown);
  246. errorCallback();
  247. }
  248. });
  249. };*/
  250. // 所有模块在此从后台获取数据
  251. project.prototype.loadDatas = function (callback){
  252. $.ajax({
  253. type: "POST",
  254. url: '/project/getData',
  255. data: {'data': JSON.stringify({
  256. "project_id": tools._ID,
  257. "user_id": tools._userID
  258. })},
  259. dataType: 'json',
  260. cache: false,
  261. timeout: 50000,
  262. success: function (result) {
  263. if (!result.error) {
  264. const isInit = true;
  265. tools.doAfterLoad(result.data, isInit, callback);
  266. // for test calc
  267. //tools.doAfterLoad([{moduleName: 'bills', data: BillsData}, {'moduleName': 'ration', data: DrawingData}], callback);
  268. } else {
  269. alert('error: ' + result.message);
  270. callback(result.error);
  271. }
  272. },
  273. error: function(jqXHR, textStatus, errorThrown){
  274. alert('error ' + textStatus + " " + errorThrown);
  275. }
  276. });
  277. };
  278. project.prototype.loadDataSync = async function () {
  279. const data = await ajaxPost('/project/getDataForInterface', {user_id: tools._userID, project_id: tools._ID});
  280. if (data) {
  281. const isInit = false;
  282. tools.doAfterLoad(data, isInit);
  283. }
  284. };
  285. project.prototype.beginUpdate = function(operation){
  286. if (tools.updateLock === 0){
  287. tools.operation = operation
  288. }
  289. tools.updateLock += 1;
  290. };
  291. project.prototype.endUpdate = function(){
  292. if (tools.updateLock === 0){
  293. throw "project can not endUpdate before beginUpdate";
  294. }
  295. tools.updateLock -= 1;
  296. if (tools.updateLock === 0) {
  297. $.ajax({
  298. type: "POST",
  299. url: '/project/save',
  300. data: {'data': JSON.stringify({
  301. "project_id": tools._ID,
  302. "user_id": tools._userID,
  303. "date": new Date,
  304. "operation": tools.operation,
  305. "update_data": tools.updateData
  306. })},
  307. dataType: 'json',
  308. cache: false,
  309. timeout: 50000,
  310. success: function (result) {
  311. if (!result.error) {
  312. tools.doAfterUpdate(result.data);
  313. } else {
  314. alert('error: ' + result.message);
  315. }
  316. $.bootstrapLoading.end();
  317. },
  318. error: function(jqXHR, textStatus, errorThrown){
  319. alert('error ' + textStatus + " " + errorThrown);
  320. $.bootstrapLoading.end();
  321. }
  322. });
  323. tools.updateData = [];
  324. tools.operation = "";
  325. }
  326. };
  327. project.prototype.push = function(moduleName, data){
  328. if (tools.updateLock === 0){
  329. throw "project can not push data before beginUpdate";
  330. }
  331. var moduleData = {
  332. moduleName: moduleName,
  333. data: data
  334. };
  335. tools.updateData.push(moduleData);
  336. };
  337. project.prototype.pushNow = function (operation, moduleName, data) {
  338. var that = this;
  339. this.beginUpdate(operation);
  340. if (Object.prototype.toString.apply(moduleName) === "[object Array]" && Object.prototype.toString.apply(data) === "[object Array]") {
  341. moduleName.forEach(function (name, index) {
  342. if(name != 'projCounter'){
  343. that.push(moduleName[index], data[index]);
  344. }
  345. });
  346. } else {
  347. this.push(moduleName, data);
  348. }
  349. this.endUpdate();
  350. };
  351. project.prototype.registerModule = function(moduleName, obj){
  352. if (!tools.modules.hasOwnProperty(moduleName)){
  353. tools.modules[moduleName] = obj;
  354. }
  355. };
  356. project.prototype.markUpdateProject = function (data,type,callback) {
  357. CommonAjax.post("/project/markUpdateProject",{updateInfo:data,type:type},callback);
  358. };
  359. project.prototype.saveProperty = function (propertyName, propertyValue) {
  360. CommonAjax.post("/project/saveProperty", {projectID: this.ID(), propertyName: propertyName, propertyValue: propertyValue});
  361. };
  362. project.prototype.projectMarkChecking = function () {
  363. let me = this;
  364. let changeMark = projectObj.project.projectInfo.changeMark;
  365. if(changeMark&&changeMark!=''){
  366. let totalNode = this.Bills.getTotalCostNode(projectObj.mainController);
  367. if(totalNode) totalNode.changed = true;
  368. this.calcProgram.calcAllNodesAndSave();
  369. CommonAjax.post("/project/removeProjectMark",{projectID:me.ID()},function (data) {
  370. delete projectObj.project.projectInfo.changeMark;
  371. if(socket.connected == true){//如果这时候socket已经连接成功,则发送删除标记广播
  372. socket.emit('removeProjectMark',{projectID:me.ID(),userID:userID});
  373. }else {//如果还没连接成功,则放入消息对象缓存,等socket连接成功后发送
  374. socketObject.messages.push({message:'removeProjectMark',data:{projectID:me.ID(),userID:userID}});
  375. }
  376. });
  377. }
  378. };
  379. project.prototype.updateLockBills = function (value,callback) {
  380. let mixDatas = {
  381. projectID: projectObj.project.ID(),
  382. updateType: 'update',
  383. properties: {
  384. "property.lockBills":value
  385. },
  386. labourCoes: {},
  387. rations: [],
  388. bills: []
  389. };
  390. $.bootstrapLoading.start();
  391. CommonAjax.post('/pm/api/updateMixDatas', {user_id: userID, mixDataArr: mixDatas}, function (rstData) {
  392. projectObj.project.projectInfo.property.lockBills = value;
  393. if(callback){
  394. callback();
  395. }
  396. $.bootstrapLoading.end();
  397. });
  398. };
  399. //返回清单是否被锁定
  400. project.prototype.isBillsLocked =function(){
  401. if(projectObj.project.projectInfo.property.lockBills == true){
  402. return true;
  403. }
  404. return false;
  405. };
  406. // 清单是否属于锁定范围(所有清单)
  407. project.prototype.withinBillsLocked = function (node) {
  408. return node && node.sourceType === commonConstants.SourceType.BILLS;
  409. };
  410. project.prototype.updateNodes = function (datas,callback) {
  411. /* let datas = [
  412. {
  413. type:'ration',
  414. data:{
  415. projectID:1605,
  416. ID:"7b962fb0-1131-11e8-b3da-af725dadd7ae",
  417. name:'testRation'
  418. }
  419. },
  420. {
  421. type:'bills',
  422. data:{
  423. projectID:1605,
  424. ID:"af9f0081-1127-11e8-99a8-2fc02230b6e7",
  425. name:'安全文明施工专项费用123'
  426. }
  427. }
  428. ]*/
  429. CommonAjax.post("/project/updateNodes",datas,function (data) {
  430. if(callback){
  431. callback(data);
  432. }
  433. })
  434. };
  435. project.prototype.syncUpdateNodesAndRefresh =async function (datas) {
  436. let me = this;
  437. return new Promise(function (resolve, reject) {
  438. me.updateNodes(datas,function (result) {
  439. let nodes = me.updateNodesCache(result);
  440. projectObj.mainController.refreshTreeNode(nodes);
  441. resolve(nodes);
  442. });
  443. });
  444. };
  445. project.prototype.updateNodesCache =function (datas) {
  446. let refreshNode = [];
  447. let reclacQuantity = false;
  448. let deleteNode=[],addNodeDatas=[];
  449. for(let d of datas){
  450. let temObj = null;
  451. if(d.type == ModuleNames.bills || d.type == ModuleNames.ration){//如果是树节点类型,直接取树节点更新
  452. if(d.action =="add"){
  453. if(d.type == ModuleNames.ration) this.Ration.datas.push(d.data);
  454. reclacQuantity = true;
  455. addNodeDatas.push(d);
  456. }else {
  457. let temNode = this.mainTree.getNodeByID(d.data.ID);
  458. if(temNode){
  459. if(d.action =="delete"){
  460. if(d.type == ModuleNames.ration){
  461. _.remove(this.Ration.datas,{'ID':d.data.ID});
  462. this.Ration.deleteSubListOfRation({ID:d.data.ID});
  463. reclacQuantity = true;
  464. }
  465. deleteNode.push(temNode);//对于删除节点,统一不加入refreshNode中,由外部加入,避免重复
  466. }else {
  467. temObj = temNode.data;
  468. if(gljUtil.isDef(d.data.quantity))reclacQuantity = true;
  469. refreshNode.push(temNode);
  470. }
  471. }
  472. }
  473. }else if(d.type == ModuleNames.project){
  474. temObj = this;
  475. }else if (d.type == ModuleNames.ration_glj && d.action == "add"){
  476. this[d.type].datas.push(d.data);
  477. if(d.projectGLJ) this.projectGLJ.loadNewProjectGLJToCache(d.projectGLJ);
  478. } else {//其它类型,更新datas
  479. temObj = _.find(this[d.type].datas,{"ID":d.data.ID});
  480. }
  481. if(temObj){
  482. for(let key in d.data){
  483. if(key == 'ID' || key == 'id'){
  484. continue;
  485. }
  486. this.setValue(temObj,key,d.data[key])
  487. }
  488. }
  489. }
  490. //对树节点的操作并删除、添加清单、删除添加定额、删除对应的定额工料机缓存
  491. TREE_SHEET_HELPER.massOperationSheet(projectObj.mainController.sheet, function () {
  492. deleteTreeNodes(deleteNode);
  493. addNewNodes(addNodeDatas,refreshNode);
  494. });
  495. if(reclacQuantity) this.projectGLJ.calcQuantity();
  496. return refreshNode;
  497. function deleteTreeNodes(deleteNodes) {
  498. let controller = projectObj.mainController, project = projectObj.project;
  499. let Bill = project.Bills, Ration = project.Ration;
  500. for(let rd of deleteNodes){
  501. controller.sheet.deleteRows(rd.serialNo(),1);
  502. controller.tree.delete(rd);
  503. if(rd.sourceType == Bill.getSourceType()) Bill.tree.delete(rd.source);
  504. }
  505. }
  506. function addNewNodes(newDatas,refreshNode) {
  507. let controller = projectObj.mainController;
  508. let Bill = projectObj.project.Bills;
  509. let newAddNode = [];
  510. for(let nr of newDatas){
  511. let nextID = -1;
  512. let preNode = projectObj.project.mainTree.getNodeByID(nr.preSiblingID);
  513. if(preNode) nextID = preNode.getNextSiblingID();
  514. let newNode = projectObj.project.mainTree.insert(nr.parentID, nextID, nr.data.ID);
  515. if(nr.type == ModuleNames.bills){
  516. let newSource = Bill.tree.insertByData(nr.data, nr.ParentID, nextID, true);
  517. newNode.source = newSource;
  518. }else {
  519. newNode.source = nr.data;
  520. }
  521. newNode.sourceType = nr.type;
  522. newNode.data = nr.data;
  523. controller.sheet.addRows(newNode.serialNo(), 1);
  524. controller.sheet.showRow(newNode.serialNo(), GC.Spread.Sheets.VerticalPosition.center);
  525. newAddNode.push(newNode);
  526. refreshNode.push(newNode);
  527. }
  528. TREE_SHEET_HELPER.refreshTreeNodeData(controller.setting, controller.sheet, newAddNode, false);
  529. }
  530. };
  531. project.prototype.setValue=function (obj,key,value) {
  532. let keyArray = key.split('.');
  533. t_set(obj,value,keyArray,0);
  534. function t_set(obj,value,arr,index) {
  535. let nextIndex = index + 1;
  536. let tkey = arr[index];
  537. if(nextIndex < arr.length){
  538. if(obj[tkey]==undefined){
  539. obj[tkey] = {};
  540. }
  541. t_set(obj[tkey],value,arr,nextIndex)
  542. }else if(nextIndex == arr.length){
  543. obj[tkey] = value;
  544. }
  545. }
  546. }
  547. project.prototype.updateEvalproject = function (evalProject,data,callback){
  548. let programID = null;
  549. if(evalProject ==1){//当打勾估价项目选项后,该定额取费专业读取计算程序名称为“估价项目”的计算程序,且为只读状态
  550. programID = this.calcProgram.compiledTemplateMaps["估价项目"];
  551. if(callback) callback(programID);
  552. }else {//如果evalProject==0,则是去掉勾选估价项目选项,需要获取定额默认的取费专业。
  553. let libID = data.from == 'cpt'?"compleRationLib":data.libID;
  554. let query = {code:data.code,projectID:data.projectID,libID:libID};
  555. CommonAjax.post("/ration/getDefaultProgramID",query,function (result) {
  556. if(callback) callback(result);
  557. })
  558. }
  559. };
  560. //判断项目是否安装工程
  561. project.prototype.isInstall = function () {
  562. return projectObj.project.projectInfo.property.isInstall?true:false;//如果是undefinded 就也返回false
  563. };
  564. /* project.prototype.setBillsCalcMode = function (calcMode) {
  565. this.property.billsCalcMode = calcMode;
  566. this.initCalcFields();
  567. };*/
  568. /*project.prototype.initCalcFields = function () {
  569. // let settingConst = this.projSetting.settingConst;
  570. if (this.calcFields) {
  571. for (let field of this.calcFields) {
  572. // unitFeeCalcFlag
  573. if (field.type === 'zangu') {
  574. field.unitFeeFlag = converseUnitFeeFlag;
  575. } else {
  576. // if (this.projSetting.billsCalcMode === settingConst.billsCalcMode.rationContent) {
  577. if (this.property.billsCalcMode === leafBillGetFeeType.rationContent) {
  578. field.unitFeeFlag = rationContentUnitFeeFlag;
  579. // } else if ( this.projSetting.billsCalcMode === settingConst.billsCalcMode.billsPrice) {
  580. } else if ( this.property.billsCalcMode === leafBillGetFeeType.billsPrice) {
  581. field.unitFeeFlag = billsPriceUnitFeeFlag;
  582. } else {
  583. field.unitFeeFlag = averageQtyUnitFeeFlag;
  584. }
  585. }
  586. // totalFeeCalcFlag
  587. if (field.type === 'common') {
  588. // if (this.projSetting.billsCalcMode === settingConst.billsCalcMode.rationPriceConverse) {
  589. if (this.property.billsCalcMode === leafBillGetFeeType.rationPriceConverse) {
  590. field.totalFeeFlag = sumTotalFeeFlag;
  591. } else {
  592. field.totalFeeFlag = totalFeeFlag;
  593. }
  594. } else {
  595. field.totalFeeFlag = sumTotalFeeFlag;
  596. }
  597. }
  598. }
  599. }*/
  600. return new project();
  601. }
  602. };