block_controller.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  1. /**
  2. * Created by zhang on 2018/5/10.
  3. */
  4. let BlockController = {
  5. datas:[],
  6. copyBtnDisable:function (selected) {
  7. if(this.isDXFYorMainEq(selected)){
  8. return true;
  9. }
  10. if(selected.sourceType == ModuleNames.ration && selected.data.type == rationType.install){
  11. return true;
  12. }
  13. return false;
  14. },
  15. pasteBtnDisable:function (selected) {
  16. let blockData = this.getBlockData();
  17. let Bills = projectObj.project.Bills;
  18. if(this.isDXFYorMainEq(selected)){
  19. return true;
  20. }
  21. if(blockData == null){
  22. return true;
  23. }
  24. if(blockData.firstNodeType != blockType.RATION && blockData.isFBFX != Bills.isFBFX(selected)){//除了复制定额外,焦点行和复制的块不是来自同一个地方(分部分项工其它)
  25. return true;
  26. }
  27. if(selected.sourceType == Bills.getSourceType() && selected.data.type == billType.FX && blockData.firstNodeType == blockType.FB){//焦点行是分项,复制块的第一层是分部,则无效。
  28. return true;
  29. }
  30. if(blockData.firstNodeType == blockType.RATION && selected.sourceType == Bills.getSourceType()){ //复制的是定额/量价/工料机、焦点行是分部/清单父项则无效
  31. if( selected.data.type == billType.FB ){
  32. return true;
  33. }
  34. if(MainTreeCol.readOnly.billsParent(selected)){
  35. return true;
  36. }
  37. if(this.haveCalcBase(selected)){//有使用基数计算,disable
  38. return true;
  39. }
  40. }
  41. if(blockData.firstNodeType != blockType.RATION && selected.sourceType == ModuleNames.ration){
  42. return true;
  43. }
  44. return false;
  45. },
  46. haveCalcBase : function (node) {
  47. if(node.data.calcBase ==null||node.data.calcBase ==undefined|| node.data.calcBase == ""){
  48. return false;
  49. }
  50. return true;
  51. },
  52. isDXFYorMainEq:function (node) {//焦点行是大项费用或定额下的主材设备
  53. if(node.sourceType == ModuleNames.bills && node.data.type == billType.DXFY){//焦点行是大项费用则无效;
  54. return true;
  55. }
  56. if(node.sourceType == ModuleNames.ration_glj){// 焦点行是定额下的主材设备则无效;
  57. return true;
  58. }
  59. return false;
  60. },
  61. getBlockData:function () {
  62. let blockString =getLocalCache('project_block');
  63. if(blockString !=null){
  64. return JSON.parse(blockString);
  65. }
  66. return null;
  67. },
  68. copyBlock:function (selected) {
  69. let startTime = +new Date();
  70. let blockOjb = {
  71. compilationID:projectInfoObj.projectInfo.compilation
  72. };
  73. if(selected.sourceType == projectObj.project.Bills.getSourceType()){
  74. blockOjb.firstNodeType = selected.data.type;
  75. }else if(selected.sourceType == projectObj.project.Ration.getSourceType()){
  76. blockOjb.firstNodeType = blockType.RATION;
  77. }
  78. blockOjb.isFBFX = projectObj.project.Bills.isFBFX(selected);
  79. let ration_glj_Map = _.groupBy(projectObj.project.ration_glj.datas, 'rationID');
  80. blockOjb.data = this.getNodeDatas(selected,ration_glj_Map);
  81. let getDataTime = +new Date();
  82. console.log(`复制所用时间——${getDataTime - startTime}`);
  83. blockOjb.copyTime = +new Date();//设置复制时间,可以用来做过期处理
  84. setLocalCache('project_block',JSON.stringify(blockOjb));
  85. let endTime = +new Date();
  86. console.log(`复制所用时间——${endTime - startTime}`);
  87. },
  88. getNodeDatas : function (node,ration_glj_Map) {
  89. let data = node.data;
  90. data.sourceType = node.sourceType;
  91. if(node.sourceType == projectObj.project.Bills.getSourceType()){
  92. data.quantity_details = projectObj.project.quantity_detail.getDetailByBillID(data.ID);
  93. }
  94. if(node.sourceType == projectObj.project.Ration.getSourceType()){
  95. if(node.data.type == rationType.install){ //如果是生成的安装增加费,则跳过
  96. return null;
  97. }
  98. let gljList = ration_glj_Map[data.ID]?ration_glj_Map[data.ID]:[];//gljOprObj.filterGljByRation(node.data, datas);
  99. gljList = gljOprObj.combineWithProjectGlj(gljList,false);
  100. data.ration_gljs = gljList;
  101. data.ration_coes = projectObj.project.ration_coe.getCoeByRationID(data.ID);
  102. data.ration_installations = projectObj.project.ration_installation.getInstallationByRationID(data.ID);
  103. data.quantity_details = projectObj.project.quantity_detail.getDetailByRationID(data.ID);
  104. }else if(node.children.length>0){
  105. let children = [];
  106. for(let c of node.children){
  107. let tem_data = this.getNodeDatas(c,ration_glj_Map);
  108. tem_data?children.push(tem_data):'';
  109. }
  110. data.children = children;
  111. }
  112. return data;
  113. },
  114. pasteBlock:function (selected) {
  115. let blockData = this.getBlockData();
  116. let position = this.initOptionDiv(selected,blockData);
  117. if(position == null){
  118. return;
  119. }
  120. this.confirmPaste(blockData,selected,position);
  121. //do paste
  122. },
  123. initOptionDiv:function (selected,blockData) {
  124. let Bills = projectObj.project.Bills;
  125. if( blockData.firstNodeType == blockType.RATION){//如果剪切板中是复制的定额块
  126. if(selected.sourceType == ModuleNames.ration && selected.data.type != rationType.install ){//焦点行是定额/量价/工料机,则粘贴为后项
  127. return "next";
  128. }
  129. if(isFXorBX(selected)||(selected.sourceType === Bills.getSourceType()&& selected.source.children.length == 0)){//焦点行是分项/叶子清单,且无基数计算,则粘贴到分项/叶子清单下
  130. if(!this.haveCalcBase(selected)){//无基数计算
  131. return "sub";
  132. }
  133. }
  134. }
  135. //设置选项的初始值
  136. setRadioProp('next_node',{checked:true,disabled:false});
  137. setRadioProp('pre_node',{checked:false,disabled:false});
  138. if(Bills.isFBFX(selected)){// (2.1)、焦点行属于“分部分项工程”:
  139. //复制块的第一层、焦点行的类型都是“分部”
  140. if(blockData.firstNodeType == blockType.FB && isFB(selected)){
  141. //默认为当前行的后项,可选前项、子项。
  142. setRadioProp('sub_node',{checked:false,disabled:false});
  143. }
  144. //复制块的第一层、焦点行的类型都是“分项”或补项
  145. if(blockIsFXorBX(blockData.firstNodeType) && isFXorBX(selected)){
  146. //默认为当前行的后项,可选前项,子项灰显不可选。
  147. setRadioProp('sub_node',{checked:false,disabled:true});
  148. }
  149. //复制块的第一层是分项,焦点行是分部,且分部下无子项或者子项是分项
  150. if(blockIsFXorBX(blockData.firstNodeType)&& isFB(selected)){
  151. if(selected.children.length == 0 || isFXorBX(selected.children[0])){
  152. return 'sub';//不弹出选择窗口,直接粘贴为子项。
  153. }
  154. }
  155. }else {//焦点行不属于“分部分项工程”
  156. if(blockData.firstNodeType == blockType.BILL &&selected.sourceType == Bills.getSourceType()){//如果剪切板中是从“分部分项工程”以外复制的清单块
  157. if(selected.children.length==0 || selected.children[0].sourceType == Bills.getSourceType()){//焦点行没有子项,或者子项是清单,判断是否有基数计算
  158. if(this.haveCalcBase(selected)){//如果焦点行有基数计算,则子项灰显不可选。
  159. setRadioProp('sub_node',{checked:false,disabled:true});
  160. }else{//如果焦点行没有基数计算,则子项可选。
  161. setRadioProp('sub_node',{checked:false,disabled:false});
  162. }
  163. }else {
  164. setRadioProp('sub_node',{checked:false,disabled:true});
  165. }
  166. }
  167. }
  168. $("#pastePosition").modal({show:true});
  169. return null;
  170. function setRadioProp(id,options) {
  171. $("#"+id).prop("checked",options.checked);
  172. $("#"+id).prop("disabled",options.disabled);
  173. }
  174. function isFB(selected) {
  175. return selected.sourceType == Bills.getSourceType() && selected.data.type == billType.FB;
  176. }
  177. function isFXorBX(selected) {//是分项或者补项
  178. if(selected.sourceType == Bills.getSourceType()){
  179. return selected.data.type == billType.FX || selected.data.type == billType.BX;
  180. }
  181. return false;
  182. }
  183. function blockIsFXorBX(type) {
  184. return type == blockType.FX||type == blockType.BX;
  185. }
  186. },
  187. /**
  188. * @param blockData
  189. * @param selected
  190. * @param position next/pre/sub
  191. */
  192. confirmPaste:function (blockData,selected,position) {
  193. let me = this;
  194. let project = projectObj.project;
  195. let Bills = project.Bills;
  196. let parent = null,next = null,pre = null;
  197. let updateData = [],billUpdate = null;
  198. let billsIDMap = {};//用来做新旧ID映射
  199. if(blockData.compilationID != projectInfoObj.projectInfo.compilation){//如果编办不一样,不能复制
  200. alert("编办不一致,不能粘贴!");
  201. return;
  202. }
  203. if(position == 'next'){ //插入为选中节点的后项,即选中节点为前项
  204. parent = selected.parent;
  205. next = selected.nextSibling;
  206. pre = selected;
  207. }
  208. if(position == 'pre'){//插入为选中节点的前项,即选中节点为后项
  209. parent = selected.parent;
  210. next = selected;
  211. pre = selected.preSibling;
  212. }
  213. if(position == 'sub'){//即选中节点为父项
  214. parent = selected;
  215. pre = selected.lastChild();
  216. }
  217. let parentID = parent?parent.getID():-1;
  218. let nextID = next?next.getID():-1;
  219. if(blockData.firstNodeType == blockType.RATION){ //复制的是定额,需根据新的父项信息和工程量明细计算工程量
  220. blockData.data.billsItemID = parentID;
  221. let billsQuantity = scMathUtil.roundForObj(parent.data.quantity,getDecimal("quantity",parent));
  222. this.calcRationQuantityAndContain(billsQuantity,blockData.data);
  223. //如果粘贴位置不属于分部分项工程,或者不是安装工程,则把安装增加费内容置空
  224. if(!Bills.isFBFX(parent)|| projectInfoObj.projectInfo.property.engineering!=engineeringType.BUILD_IN){
  225. blockData.data.ration_installations = [];
  226. }
  227. //计算序列号
  228. this.calcRationSerialNo(parentID,blockData,updateData,pre,next);
  229. }else {
  230. blockData.data.ParentID = parentID;
  231. blockData.data.NextSiblingID=nextID;
  232. if(pre){
  233. billUpdate = {type:blockData.data.sourceType,query:{ID:pre.getID()},doc:{NextSiblingID:blockData.data.ID}};
  234. }
  235. }
  236. let dataMap = this.preparePasteData(blockData.data,billsIDMap);
  237. if(billUpdate){
  238. billUpdate.doc.NextSiblingID = billsIDMap[billUpdate.doc.NextSiblingID];
  239. updateData.push(billUpdate);
  240. }
  241. dataMap.updateData = updateData;
  242. dataMap.projectID = projectObj.project.ID();
  243. console.log(dataMap);
  244. $.bootstrapLoading.start();
  245. CommonAjax.post('/bills/pasteBlock',dataMap,function (result) {
  246. $.bootstrapLoading.end();
  247. //更新前端缓存
  248. me.updateCache(result);
  249. //插入树节点
  250. let rationNodes = me.addToTree(parentID,nextID,result.bills,result.rations);
  251. //主材设备工料机插入主树
  252. project.ration_glj.addToMainTree(result.ration_gljs);
  253. //更新计算程序模板,并进行重新计算
  254. project.calcProgram.calcRationsAndSave(rationNodes);
  255. })
  256. },
  257. updateCache:function(result){
  258. let project = projectObj.project;
  259. let Bills = project.Bills,Ration = project.Ration;
  260. let mainTree = project.mainTree;
  261. Bills.addDatasToList(result.bills);
  262. Ration.addDatasToList(result.rations);
  263. project.quantity_detail.addDatasToList(result.quantity_details);
  264. project.ration_glj.addDatasToList(result.ration_gljs);
  265. project.ration_coe.addDatasToList(result.ration_coes);
  266. project.ration_installation.addDatasToList(result.ration_installations)
  267. for(let u of result.updateData){
  268. let unode = mainTree.findNode(u.query.ID);
  269. if(unode){
  270. for(let ukey in u.doc){
  271. unode.data[ukey] = u.doc[ukey];
  272. }
  273. }
  274. }
  275. //更新项目工料机模块信息-计算消耗量
  276. project.projectGLJ.datas = result.gljData;
  277. project.projectGLJ.calcQuantity();
  278. },
  279. addToTree:function (parentID,nextID,bills,rations) {
  280. let project = projectObj.project;
  281. let Bills = project.Bills,mainTree = project.mainTree;
  282. let parentMap_b = {},parentMap_r = {};
  283. let newNodes = [],firstNode = null,rationNodes=[];
  284. createParentMap(parentMap_b,bills,'bills');
  285. createParentMap(parentMap_r,rations,'ration');
  286. if(parentMap_b[parentID]){
  287. firstNode = loadTreeNode(parentID,nextID,parentMap_b[parentID][0],'bills');
  288. }else if(parentMap_r[parentID]){
  289. firstNode = loadTreeNode(parentID,nextID,parentMap_r[parentID][0],'ration');
  290. }
  291. ProjectController.syncDisplayNewNodes(projectObj.mainController, newNodes);
  292. let sels = projectObj.mainController.sheet.getSelections();
  293. //设置选中并更新下方显示
  294. projectObj.mainController.setTreeSelected(firstNode);
  295. projectObj.mainController.sheet.setSelection(firstNode.serialNo(), sels[0].col, 1, 1);
  296. return rationNodes;
  297. function loadTreeNode(parentID,nextID,data,type) {
  298. let newNode = null;
  299. if(type == 'bills'){
  300. let newSource = Bills.tree.insertByData(data,parentID,nextID,true);
  301. newNode = mainTree.insert(parentID, nextID,data.ID);
  302. if (newNode) {
  303. newNode.source = newSource;
  304. newNode.sourceType = Bills.getSourceType();
  305. newNode.data = data;
  306. newNodes.push(newNode);
  307. let subType = 'bills';
  308. let children = parentMap_b[data.ID];
  309. if(!children){
  310. children = parentMap_r[data.ID];
  311. subType = 'ration';
  312. }
  313. if(children){
  314. for(let c of children){
  315. loadTreeNode(data.ID,-1,c,subType);
  316. }
  317. }
  318. }
  319. }else if(type == 'ration'){
  320. newNode = project.mainTree.insert(parentID, nextID, data.ID);
  321. newNode.source = data;
  322. newNode.sourceType = project.Ration.getSourceType();
  323. newNode.data = data;
  324. newNodes.push(newNode);
  325. rationNodes.push(newNode);
  326. }
  327. return newNode;
  328. }
  329. function createParentMap(parentMap,list,type) {
  330. let parentKey = type=='bills'?'ParentID':'billsItemID';
  331. for(let l of list){
  332. let parentID = l[parentKey];
  333. if(parentMap[parentID]){
  334. parentMap[parentID].push(l);
  335. }else {
  336. parentMap[parentID] = [l];
  337. }
  338. }
  339. }
  340. },
  341. preparePasteData : function (data,billsIDMap) {
  342. let me = this;
  343. me.datas = _.cloneDeep(projectObj.project.Bills.datas);
  344. let bills = [],rations=[],ration_gljs = [],ration_coes = [],quantity_details = [],ration_installations = [];
  345. eachData(data);
  346. for(let b of bills){//更新ID
  347. billsIDMap[b.ParentID]?b.ParentID = billsIDMap[b.ParentID]:'';
  348. billsIDMap[b.NextSiblingID]?b.NextSiblingID = billsIDMap[b.NextSiblingID]:'';
  349. }
  350. return {bills:bills,rations:rations,ration_gljs:ration_gljs,ration_coes:ration_coes,quantity_details:quantity_details,ration_installations:ration_installations};
  351. function eachData(data) {
  352. if(data.sourceType == 'bills'){
  353. let tem_b = createBillsData(data);
  354. bills.push(tem_b);
  355. for(let d of data.quantity_details){
  356. quantity_details.push(createQuantityDetails(d,tem_b,'bills'));
  357. }
  358. if(data.children && data.children.length>0){
  359. for(let c of data.children){
  360. eachData(c);
  361. }
  362. }
  363. }
  364. if( data.sourceType == 'ration'){
  365. let tem_r = createRationData(data);
  366. rations.push(tem_r);
  367. for(let d of data.quantity_details){
  368. quantity_details.push(createQuantityDetails(d,tem_r, 'ration'));
  369. }
  370. for(let g of data.ration_gljs){
  371. let tem_rg = createSubList(g,tem_r);
  372. tem_rg.billsItemID = tem_r.billsItemID;
  373. ration_gljs.push(tem_rg);
  374. }
  375. for(let o of data.ration_coes){
  376. ration_coes.push(createSubList(o,tem_r));
  377. }
  378. for(let ri of data.ration_installations){
  379. ration_installations.push(createSubList(ri,tem_r));
  380. }
  381. }
  382. }
  383. function createSubList(subData,rationData) {
  384. let tem_sub = _.cloneDeep(subData);
  385. delete tem_sub._id;
  386. tem_sub.ID = uuid.v1();
  387. tem_sub.projectID = projectObj.project.ID();
  388. tem_sub.rationID = rationData.ID;
  389. return tem_sub;
  390. }
  391. function createQuantityDetails(detailData,pdata,type) {
  392. let tem_detail = _.cloneDeep(detailData);
  393. delete tem_detail._id;
  394. tem_detail.ID = uuid.v1();
  395. tem_detail.projectID = projectObj.project.ID();
  396. if(type == 'bills'){
  397. tem_detail.billID = pdata.ID;
  398. }
  399. if(type == 'ration'){
  400. tem_detail.rationID = pdata.ID;
  401. }
  402. return tem_detail;
  403. }
  404. function createRationData(rationData) {
  405. let tem_ration = _.cloneDeep(rationData);
  406. //删除旧数据
  407. delete tem_ration._id;
  408. delete tem_ration.fees;
  409. delete tem_ration.feesIndex;
  410. delete tem_ration.ration_gljs;
  411. delete tem_ration.ration_coes;
  412. delete tem_ration.ration_installations;
  413. delete tem_ration.quantity_details;
  414. delete tem_ration.__v;
  415. delete tem_ration.sourceType;
  416. tem_ration.projectID = projectObj.project.ID();
  417. tem_ration.ID = uuid.v1();
  418. billsIDMap[tem_ration.billsItemID]?tem_ration.billsItemID = billsIDMap[tem_ration.billsItemID]:'';
  419. let firstLibID = rationLibObj.getFirstStdRationLibID();
  420. if(firstLibID){
  421. tem_ration.prefix = projectObj.project.Ration.getRationPrefix(firstLibID,tem_ration);
  422. }
  423. return tem_ration;
  424. }
  425. function createBillsData(billsData) { //ID、重新生成code
  426. let temData = _.cloneDeep(billsData);
  427. //删除旧数据
  428. delete temData._id;
  429. delete temData.fees;
  430. delete temData.feesIndex;
  431. delete temData.children;
  432. delete temData.quantity_details;
  433. delete temData.__v;
  434. delete temData.sourceType;
  435. temData.projectID = projectObj.project.ID();
  436. let newID = uuid.v1(); //新的清单ID
  437. billsIDMap[temData.ID] = newID;
  438. temData.ID = newID; //新的清单ID
  439. if(temData.billsLibId && temData.billsLibId!="" && temData.code.length == 12){//是从清单库来的
  440. let value = temData.code.substr(0,9);
  441. if (value&&value.length === 9 && /^[\d]+$/.test(value)) {
  442. temData.code = projectObj.project.Bills.newFormatCode(value);
  443. }
  444. }
  445. me.datas.push(temData);//为了下一个清单的std code 一样
  446. return temData;
  447. }
  448. },
  449. calcRationSerialNo:function (billsItemID,blockData,updateData,pre,next) {
  450. let br = projectObj.project.Ration.getBillsSortRation(billsItemID);
  451. if(next == null){ //没有下一树节点,即为最后节点
  452. blockData.data.serialNo = br.length > 0 ? br[br.length - 1].serialNo + 1 : 1;
  453. }else {//有下一节点
  454. let startIndex =0;
  455. if(pre){
  456. startIndex = br.indexOf(pre.data)+1;
  457. }
  458. blockData.data.serialNo = br[startIndex].serialNo;
  459. for(let i = startIndex;i < br.length; i++){
  460. let br_serialNo = i < br.length - 1 ? br [i + 1].serialNo : br[i].serialNo + 1;
  461. updateData.push({type:blockData.data.sourceType,query:{ID:br[i].ID},doc:{serialNo:br_serialNo}});//更新兄弟节点序列号
  462. }
  463. }
  464. },
  465. calcRationQuantityAndContain : function (billsQuantity,ration) {//计算定额工程量和含量
  466. let EXPString = ration.quantityEXP+"";
  467. if(EXPString.indexOf("QDL") != -1){
  468. if(EXPString=="QDL"){//定额的工程量是直接通过清单量填进来的;
  469. let times = parseInt(ration.unit);
  470. if(isNaN(times)){
  471. times = 1;
  472. }
  473. ration.quantity = scMathUtil.roundForObj(billsQuantity / times,getDecimal("ration.quantity"));
  474. billsQuantity?ration.contain = scMathUtil.roundForObj(ration.quantity/billsQuantity,getDecimal("process")):ration.contain = 0;
  475. } else {//如果定额的工程量是通过计算出来的,则应该重新计算。
  476. let tem_contain = scMathUtil.roundForObj(ration.contain,getDecimal("process"));
  477. let tem_quantity = scMathUtil.roundForObj(billsQuantity*tem_contain,getDecimal("ration.quantity")); //this.autoTransformQuantity(tem_quantity,rationNode);
  478. ration.quantity = tem_quantity;
  479. }
  480. }else {//GCLMXHJ
  481. let tem_contain=0;
  482. if(billsQuantity&&billsQuantity!=0){
  483. let children_quantity = scMathUtil.roundForObj(ration.quantity,getDecimal("ration.quantity"));
  484. // children_quantity = scMathUtil.roundForObj(this.reverseQuantity(children_quantity,rationNode),getDecimal("quantity",rationNode)); 原先是要反算的,现在改成不用反算了
  485. tem_contain =scMathUtil.roundForObj(children_quantity/billsQuantity,getDecimal("process"));
  486. }
  487. ration.contain = tem_contain;
  488. }
  489. },
  490. newFormatCode : function (stdCode, filterCode) {
  491. let matchs = this.sameStdCode(stdCode, filterCode);
  492. let format = function (Number) {
  493. let s = Number + '';
  494. while (s.length < 3) {
  495. s = '0' + s;
  496. }
  497. return s;
  498. };
  499. for (let i = 0; i <= matchs.length; i++) {
  500. let formatCode = stdCode + format(i+1);
  501. if (matchs.indexOf(formatCode) === -1) {
  502. return formatCode;
  503. }
  504. }
  505. },
  506. sameStdCode : function (stdCode, filterCode) {
  507. let reg = new RegExp('^' + stdCode), matchs= [];
  508. for (let data of this.datas) {
  509. if (data.code && data.code.length === 12 && reg.test(data.code) && data.code !== filterCode) {
  510. matchs.push(data.code);
  511. }
  512. }
  513. return matchs;
  514. },
  515. removeBlock:function () {
  516. removeLocalCache('project_block');
  517. }
  518. };