change_information_add_list.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. 'use strict';
  2. /**
  3. * 变更令详细页js
  4. *
  5. * @author EllisRan.
  6. * @date 2018/11/22
  7. * @version
  8. */
  9. // 编号排序,多重判断
  10. function sortByCode(a, b) {
  11. let code1 = a.code.split('-');
  12. let code2 = b.code.split('-');
  13. let code1length = code1.length;
  14. let code2length = code2.length;
  15. for (let i = 0; i < code1length; i ++) {
  16. if (i+1 <= code2length) {
  17. if (code1[i] != code2[i]) {
  18. if (/^\d+$/.test(code1[i]) && /^\d+$/.test(code2[i])) {
  19. return parseInt(code1[i]) - parseInt(code2[i]);
  20. } else if (!/^\d+$/.test(code1[i]) && /^\d+$/.test(code2[i])) {
  21. return 1;
  22. } else if (/^\d+$/.test(code1[i]) && !/^\d+$/.test(code2[i])) {
  23. return -1;
  24. } else {
  25. const str1length = code1[i].length;
  26. const str2length = code2[i].length;
  27. for (let j = 0; j < str1length; j++) {
  28. if (j+1 <= str2length) {
  29. if (code1[i].charAt(j) != code2[i].charAt(j)) {
  30. return code1[i].charAt(j).charCodeAt() - code2[i].charAt(j).charCodeAt();
  31. } else if (j+1 == str1length && code1[i].charAt(j) == code2[i].charAt(j)) {
  32. if (str1length == str2length) {
  33. return 0;
  34. } else {
  35. return str1length - str2length;
  36. }
  37. }
  38. } else {
  39. if (j+1 >= str1length) {
  40. return 1;
  41. } else {
  42. return -1;
  43. }
  44. }
  45. }
  46. }
  47. } else if (i+1 == code1length && code1[i] == code2[i]) {
  48. if (code1length == code2length) {
  49. return 0;
  50. } else {
  51. return code1length - code2length;
  52. }
  53. }
  54. } else {
  55. if (i+1 >= code1length) {
  56. return 1;
  57. } else {
  58. return -1;
  59. }
  60. }
  61. }
  62. }
  63. let searchCodeList = [];
  64. $(document).ready(() => {
  65. let searchGcl;
  66. autoFlashHeight();
  67. const gclSpreadSetting = {
  68. cols: [
  69. {title: '清单编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 120, formatter: '@'},
  70. {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 300, formatter: '@'},
  71. {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 100, formatter: '@'},
  72. {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 100},
  73. {title: '数量', colSpan: '1', rowSpan: '2', field: 'quantity', hAlign: 2, width: 100},
  74. ],
  75. emptyRows: 0,
  76. headRows: 2,
  77. headRowHeight: [25, 25],
  78. defaultRowHeight: 21,
  79. headerFont: '12px 微软雅黑',
  80. font: '12px 微软雅黑',
  81. readOnly: true,
  82. rowHeader:[
  83. {
  84. rowHeaderType: 'circle',
  85. setting: {
  86. size: 5,
  87. indent: 16,
  88. getColor: function (index, data) {
  89. if (!data) return;
  90. if (data.cid) {
  91. return '#dc3545';
  92. }
  93. }
  94. },
  95. },
  96. ],
  97. localCache: {
  98. key: 'change-add-list-gcl-spread',
  99. colWidth: true,
  100. }
  101. };
  102. gclSpreadSetting.getColor = function (sheet, data, row, col, defaultColor) {
  103. if (data && data.settle_status && data.settle_status === settleStatus.finish) {
  104. return spreadColor.stage.settle;
  105. }
  106. if (data && data.is_change) {
  107. return '#c3e6cb';
  108. }
  109. return defaultColor;
  110. }
  111. const gclSpreadObj = {
  112. resetXmjSpread: function(data = null) {
  113. const xmjs = [];
  114. if (data && data.id) {
  115. xmjs.push({
  116. deal_id: data.id,
  117. cid: '',
  118. is_change: _.findIndex(changeList, { lid: data.id }) !== -1 ? 1 : 0,
  119. code: '',
  120. jldy: '',
  121. dwgc: '',
  122. fbgc: '',
  123. fxgc: '',
  124. bwmx: '',
  125. quantity: '',
  126. })
  127. } else if (data && data.leafXmjs) {
  128. for (const leaf of data.leafXmjs) {
  129. xmjs.push({
  130. gcl_id: leaf.gcl_id,
  131. mx_id: leaf.mx_id || '',
  132. is_change: _.findIndex(changeList, { gcl_id: leaf.gcl_id, mx_id: leaf.mx_id || '' }) !== -1 ? 1 : 0,
  133. cid: leaf.cid || '',
  134. code: leaf.code,
  135. jldy: leaf.jldy || '',
  136. dwgc: leaf.dwgc || '',
  137. fbgc: leaf.fbgc || '',
  138. fxgc: leaf.fxgc || '',
  139. bwmx: leaf.bwmx || '',
  140. quantity: leaf.quantity ? ZhCalc.round(leaf.quantity, findDecimal(data.unit)).toString() : '0',
  141. });
  142. }
  143. }
  144. SpreadJsObj.loadSheetData(xmjSpreadSheet, SpreadJsObj.DataType.Data, xmjs);
  145. checkSelectAll();
  146. },
  147. selectionChanged: function (e, info) {
  148. const data = SpreadJsObj.getSelectObject(info.sheet);
  149. gclSpreadObj.resetXmjSpread(data);
  150. xmjSearch.searchAndLocate($('#xmj-keyword').val());
  151. }
  152. };
  153. const xmjSpreadSetting = {
  154. cols: [
  155. { title: '变更清单', colSpan: '1', rowSpan: '2', field: 'is_change', hAlign: 1, width: 60, cellType: 'checkbox', readOnly: 'readOnly.isChangeList'},
  156. {title: '项目节编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 120, formatter: '@', readOnly: true},
  157. {title: '细目', colSpan: '1', rowSpan: '2', field: 'jldy', hAlign: 0, width: 150, formatter: '@', readOnly: true},
  158. {title: '单位工程', colSpan: '1', rowSpan: '2', field: 'dwgc', hAlign: 0, width: 150, formatter: '@', readOnly: true},
  159. {title: '分部工程', colSpan: '1', rowSpan: '2', field: 'fbgc', hAlign: 0, width: 150, readOnly: true},
  160. {title: '分项工程', colSpan: '1', rowSpan: '2', field: 'fxgc', hAlign: 0, width: 150, readOnly: true},
  161. {title: '计量单元', colSpan: '1', rowSpan: '2', field: 'bwmx', hAlign: 0, width: 150, readOnly: true},
  162. {title: '数量', colSpan: '1', rowSpan: '2', field: 'quantity', hAlign: 2, width: 100, readOnly: true},
  163. ],
  164. emptyRows: 0,
  165. headRows: 2,
  166. headRowHeight: [25, 25],
  167. defaultRowHeight: 21,
  168. headerFont: '12px 微软雅黑',
  169. font: '12px 微软雅黑',
  170. rowHeader:[
  171. {
  172. rowHeaderType: 'circle',
  173. setting: {
  174. size: 5,
  175. indent: 16,
  176. getColor: function (index, data) {
  177. if (!data) return;
  178. if (data.cid) {
  179. return '#dc3545';
  180. }
  181. }
  182. },
  183. },
  184. ],
  185. };
  186. const xmjCol = {
  187. readOnly: {
  188. isChangeList: function (data) {
  189. if (!data) return true;
  190. return readOnly;
  191. }
  192. }
  193. };
  194. const xmjSpreadObj = {
  195. buttonClicked: function (e, info) {
  196. if (info.sheet.zh_setting) {
  197. const select = SpreadJsObj.getSelectObject(info.sheet);
  198. const col = info.sheet.zh_setting.cols[info.col];
  199. if (col.field === 'is_change') {
  200. if (xmjCol.readOnly.isChangeList(select)) {
  201. info.sheet.setValue(info.row, info.col, !select || !select.is_change ? 0 : 1);
  202. return
  203. }
  204. if (info.sheet.isEditing()) {
  205. info.sheet.endEdit(true);
  206. }
  207. const is_change = info.sheet.getValue(info.row, info.col) ? 1 : 0;
  208. let gclIndex = -1;
  209. let gclInfo = null;
  210. if (select.deal_id) {
  211. gclInfo = _.find(changeListData, function (item) {
  212. return item.id && item.id === select.deal_id; });
  213. gclIndex =_.findIndex(changeListData, function (item) {
  214. return item.id && item.id === select.deal_id; });
  215. } else {
  216. gclInfo = _.find(changeListData, function (item) {
  217. return item.leafXmjs && _.find(item.leafXmjs, function (item2) {
  218. return item2.gcl_id === select.gcl_id && (item2.mx_id === undefined || item2.mx_id === select.mx_id) });
  219. });
  220. gclIndex = _.findIndex(changeListData, function (item) {
  221. return item.leafXmjs && _.find(item.leafXmjs, function (item2) {
  222. return item2.gcl_id === select.gcl_id && (item2.mx_id === undefined || item2.mx_id === select.mx_id) });
  223. });
  224. }
  225. console.log(gclIndex);
  226. if (!gclInfo) {
  227. info.sheet.setValue(info.row, info.col, 0);
  228. return;
  229. }
  230. if (is_change) {
  231. const oldCInfo = select.deal_id ? _.find(oldChangeList, { lid: select.deal_id }) : _.find(oldChangeList, { gcl_id: select.gcl_id, mx_id: select.mx_id });
  232. const data = {};
  233. if (oldCInfo) {
  234. data.detail = oldCInfo.detail;
  235. data.camount = oldCInfo.camount;
  236. data.spamount = oldCInfo.spamount;
  237. data.is_valuation = oldCInfo.is_valuation;
  238. data.delimit = oldCInfo.delimit;
  239. }
  240. if (select.deal_id) {
  241. const newData = {
  242. lid: select.deal_id,
  243. code: gclInfo.code,
  244. name: gclInfo.name,
  245. unit: gclInfo.unit,
  246. unit_price: gclInfo.unit_price,
  247. oamount: gclInfo.quantity ? parseFloat(gclInfo.quantity) : 0,
  248. oamount2: oldCInfo ? oldCInfo.oamount2 : gclInfo.quantity ? parseFloat(gclInfo.quantity) : 0,
  249. bwmx: '',
  250. xmj_code: '',
  251. xmj_jldy: '',
  252. xmj_dwgc: '',
  253. xmj_fbgc: '',
  254. xmj_fxgc: '',
  255. gcl_id: '',
  256. mx_id: '',
  257. }
  258. _.assign(data, newData);
  259. } else {
  260. const xmjInfo = _.find(gclInfo.leafXmjs, function (item) {
  261. return item.gcl_id === select.gcl_id && (item.mx_id === undefined || item.mx_id === select.mx_id);
  262. });
  263. const newData = {
  264. lid: select.gcl_id,
  265. code: gclInfo.b_code,
  266. name: gclInfo.name,
  267. unit: gclInfo.unit,
  268. unit_price: gclInfo.unit_price,
  269. oamount: xmjInfo.quantity,
  270. oamount2: oldCInfo ? oldCInfo.oamount2 : xmjInfo.quantity,
  271. bwmx: xmjInfo.bwmx || xmjInfo.jldy || '',
  272. xmj_code: xmjInfo.code || '',
  273. xmj_jldy: xmjInfo.jldy || '',
  274. xmj_dwgc: xmjInfo.dwgc || '',
  275. xmj_fbgc: xmjInfo.fbgc || '',
  276. xmj_fxgc: xmjInfo.fxgc || '',
  277. gcl_id: select.gcl_id,
  278. mx_id: select.mx_id,
  279. }
  280. _.assign(data, newData);
  281. }
  282. console.log(data);
  283. // 更新至服务器
  284. postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', {
  285. type: 'add-change-list',
  286. postData: [data]
  287. }, function (result) {
  288. changeList = result.changeList;
  289. select.is_change = 1;
  290. changeListData[gclIndex].is_change = 1;
  291. SpreadJsObj.reLoadRowData(gclSpreadSheet, gclIndex);
  292. }, function () {
  293. info.sheet.setValue(info.row, info.col, 0);
  294. });
  295. } else {
  296. const cInfo = select.deal_id ? _.find(changeList, { lid: select.deal_id }) : _.find(changeList, { gcl_id: select.gcl_id, mx_id: select.mx_id });
  297. if (_.find(changeUsedData, {cbid: cInfo.id})) {
  298. toastr.warning('该清单已被使用,无法取消变更');
  299. info.sheet.setValue(info.row, info.col, 1);
  300. return
  301. } else if (checkIsSettle(cInfo)) {
  302. toastr.warning('该清单已结算,无法取消变更');
  303. info.sheet.setValue(info.row, info.col, 1);
  304. return
  305. } else {
  306. postData('/tender/' + window.location.pathname.split('/')[2] + '/change/' + window.location.pathname.split('/')[4] + '/information/save', {
  307. type: 'del-change-list',
  308. ids: [cInfo.id],
  309. postData: null
  310. }, function (result) {
  311. changeList = result.changeList;
  312. select.is_change = 0;
  313. if (select.deal_id) {
  314. changeListData[gclIndex].is_change = 0;
  315. SpreadJsObj.reLoadRowData(gclSpreadSheet, gclIndex);
  316. } else {
  317. let isChange = false;
  318. gclInfo.leafXmjs.forEach(function (item) {
  319. if (item.gcl_id === select.gcl_id && (item.mx_id === undefined || item.mx_id === select.mx_id) && item.is_change) {
  320. isChange = true;
  321. }
  322. });
  323. if (!isChange) {
  324. changeListData[gclIndex].is_change = 0;
  325. SpreadJsObj.reLoadRowData(gclSpreadSheet, gclIndex);
  326. }
  327. }
  328. }, function () {
  329. info.sheet.setValue(info.row, info.col, 1);
  330. });
  331. }
  332. }
  333. }
  334. }
  335. }
  336. };
  337. const preUrl = window.location.pathname.split('/').slice(0, 4).join('/');
  338. let changeListData;
  339. let gclGatherData;
  340. const gclSpread = SpreadJsObj.createNewSpread($('#gcl-spread')[0]);
  341. const gclSpreadSheet = gclSpread.getActiveSheet();
  342. const xmjSpread = SpreadJsObj.createNewSpread($('#xmj-spread')[0]);
  343. const xmjSpreadSheet = xmjSpread.getActiveSheet();
  344. sjsSettingObj.setGridSelectStyle(gclSpreadSetting);
  345. SpreadJsObj.initSheet(gclSpreadSheet, gclSpreadSetting);
  346. sjsSettingObj.setGridSelectStyle(xmjSpreadSetting);
  347. SpreadJsObj.initSpreadSettingEvents(xmjSpreadSetting, xmjCol);
  348. SpreadJsObj.initSheet(xmjSpreadSheet, xmjSpreadSetting);
  349. postData(preUrl + '/defaultBills', { from: 'batch' }, function (result) {
  350. gclGatherModel.loadLedgerData(result.bills);
  351. gclGatherModel.loadPosData(result.pos);
  352. gclGatherData = gclGatherModel.gatherGclData();
  353. gclGatherData = _.filter(gclGatherData, function (item) {
  354. return item.leafXmjs && item.leafXmjs.length !== 0;
  355. });
  356. for (const ggd in gclGatherData) {
  357. if (gclGatherData[ggd].leafXmjs && gclGatherData[ggd].leafXmjs.length === 0) {
  358. gclGatherData.splice(ggd, 1);
  359. }
  360. gclGatherData[ggd].code = gclGatherData[ggd].b_code;
  361. let hadcid = 0;
  362. for (const xmj of gclGatherData[ggd].leafXmjs) {
  363. const changeLedger = _.find(result.changeLedgerList, { id: xmj.gcl_id });
  364. const changePos = _.find(result.changePosList, { id: xmj.mx_id, lid: xmj.gcl_id });
  365. if (changeLedger || changePos) {
  366. xmj.cid = 1;
  367. xmj.ccid = changeLedger ? changeLedger.ccid : changePos.ccid;
  368. hadcid = 1;
  369. }
  370. }
  371. if (hadcid !== 0) gclGatherData[ggd].cid = 1;
  372. }
  373. // 数组去重
  374. const dealBillList = result.dealBills;
  375. for (const db of gclGatherData) {
  376. const exist_index = dealBillList.findIndex(function (item) {
  377. return item.code === db.code && item.name === db.name && item.unit === db.unit && item.unit_price === db.unit_price;
  378. });
  379. if (exist_index !== -1) {
  380. dealBillList.splice(exist_index, 1);
  381. }
  382. }
  383. changeListData = gclGatherData.concat(dealBillList).sort(sortByCode);
  384. for (const gcl of changeListData) {
  385. gcl.unit = gcl.unit !== undefined && gcl.unit !== null ? gcl.unit : '';
  386. gcl.quantity = gcl.quantity !== 0 && gcl.quantity !== null && gcl.quantity !== undefined ? (gcl.unit !== '' ? ZhCalc.round(gcl.quantity, findDecimal(gcl.unit)) : gcl.quantity).toString() : '0';
  387. gcl.unit_price = gcl.unit_price !== null && gcl.unit_price !== undefined ? ZhCalc.round(gcl.unit_price, unitPriceUnit) : 0;
  388. // 用id值区分签约清单和台账
  389. if (gcl.id) {
  390. const cInfo = gcl.id ? _.find(changeList, { lid: gcl.id }) : null;
  391. gcl.is_change = cInfo ? 1 : 0;
  392. } else {
  393. const index = gcl.leafXmjs && gcl.leafXmjs.length !== 0 ? _.findIndex(gcl.leafXmjs, function (item) {
  394. return _.findIndex(changeList, { gcl_id: item.gcl_id }) !== -1;
  395. }) : -1;
  396. gcl.is_change = index !== -1 ? 1 : 0;
  397. }
  398. }
  399. console.log(changeListData);
  400. SpreadJsObj.loadSheetData(gclSpreadSheet, SpreadJsObj.DataType.Data, changeListData);
  401. gclSpreadObj.resetXmjSpread(SpreadJsObj.getSelectObject(gclSpreadSheet));
  402. });
  403. gclSpread.bind(spreadNS.Events.SelectionChanged, gclSpreadObj.selectionChanged);
  404. xmjSpread.bind(spreadNS.Events.ButtonClicked, xmjSpreadObj.buttonClicked)
  405. const xmjSearch = $.xmjSearch({
  406. selector: '#xmj-search',
  407. searchSpread: xmjSpread,
  408. searchRangeStr: '输入项目节编号、细目、计量单元查找',
  409. });
  410. $.divResizer({
  411. select: '#revise-right-spr',
  412. callback: function () {
  413. gclSpread.refresh();
  414. xmjSpread.refresh();
  415. if (searchGcl) searchGcl.spread.refresh();
  416. }
  417. });
  418. $.subMenu({
  419. menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
  420. toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
  421. key: 'menu.1.0.0',
  422. miniHint: '#sub-mini-hint', hintKey: 'menu.hint.1.0.1',
  423. callback: function (info) {
  424. if (info.mini) {
  425. $('.panel-title').addClass('fluid');
  426. $('#sub-menu').removeClass('panel-sidebar');
  427. } else {
  428. $('.panel-title').removeClass('fluid');
  429. $('#sub-menu').addClass('panel-sidebar');
  430. }
  431. autoFlashHeight();
  432. gclSpread.refresh();
  433. xmjSpread.refresh();
  434. if (searchGcl) searchGcl.spread.refresh();
  435. }
  436. });
  437. gclSpread.refresh();
  438. xmjSpread.refresh();
  439. // 展开收起标准节点
  440. $('a', '#side-menu').bind('click', function (e) {
  441. e.preventDefault();
  442. const tab = $(this), tabPanel = $(tab.attr('content'));
  443. // 展开工具栏、切换标签
  444. if (!tab.hasClass('active')) {
  445. const close = $('.active', '#side-menu').length === 0;
  446. $('a', '#side-menu').removeClass('active');
  447. tab.addClass('active');
  448. $('.tab-content .tab-pane').removeClass('active');
  449. tabPanel.addClass('active');
  450. showSideTools(tab.hasClass('active'));
  451. if (tab.attr('content') === '#search') {
  452. if (!searchGcl) {
  453. searchGcl = $.listSearch({
  454. selector: '#search',
  455. searchSpread: gclSpread,
  456. searchOver: true,
  457. searchEmpty: true,
  458. resultSpreadSetting: {
  459. cols: [
  460. {title: '清单编号', field: 'code', hAlign: 0, width: 80, formatter: '@'},
  461. {title: '名称', field: 'name', width: 150, hAlign: 0, formatter: '@'},
  462. {title: '单位', field: 'unit', width: 50, hAlign: 1, formatter: '@'},
  463. {title: '单价', field: 'unit_price', hAlign: 2, width: 50},
  464. {title: '数量', field: 'quantity', hAlign: 2, width: 50},
  465. ],
  466. emptyRows: 0,
  467. headRows: 1,
  468. headRowHeight: [32],
  469. headColWidth: [30],
  470. defaultRowHeight: 21,
  471. headerFont: '12px 微软雅黑',
  472. font: '12px 微软雅黑',
  473. selectedBackColor: '#fffacd',
  474. readOnly: true,
  475. },
  476. afterLocated: function () {
  477. gclSpreadObj.resetXmjSpread(SpreadJsObj.getSelectObject(gclSpreadSheet));
  478. },
  479. check: function(data, keyword) {
  480. return !keyword ||
  481. (data.code && data.code.indexOf(keyword) > -1) ||
  482. (data.name && data.name.indexOf(keyword) > -1);
  483. },
  484. customSearch: [
  485. {
  486. key: 'revise', title: '新增部位', valid: true, parent: true,
  487. check: function (node) {
  488. if (node.formc || node.cid) {
  489. return true;
  490. } else {
  491. return false;
  492. }
  493. }
  494. }
  495. ],
  496. });
  497. }
  498. searchGcl.spread.refresh();
  499. }
  500. }
  501. else {// 收起工具栏
  502. tab.removeClass('active');
  503. tabPanel.removeClass('active');
  504. showSideTools(tab.hasClass('active'));
  505. }
  506. gclSpread.refresh();
  507. xmjSpread.refresh();
  508. });
  509. });
  510. function checkSelectAll() {
  511. let check = $('#code-list tr').length > 0 ? true : false;
  512. const codeNum = $('#code-list tr').length;
  513. let i = 0;
  514. $('#code-list tr').each(function () {
  515. if ($(this).css('display') !== 'none' && !$(this).find('input').is(':checked')) {
  516. check = false;
  517. return;
  518. }
  519. else if ($(this).css('display') === 'none') {
  520. i++;
  521. }
  522. });
  523. if (check && i === codeNum) {
  524. check = false;
  525. }
  526. $('#code-select-all').prop('checked', check);
  527. }
  528. function findDecimal(unit) {
  529. let value = precision.other.value;
  530. const changeUnits = precision;
  531. for (const d in changeUnits) {
  532. if (changeUnits[d].unit !== undefined && changeUnits[d].unit === unit) {
  533. value = changeUnits[d].value;
  534. break;
  535. }
  536. }
  537. return value;
  538. }
  539. // 判断是否是已结算清单
  540. function checkIsSettle(data) {
  541. const info = data.mx_id ? _.find(settlePos, { lid: data.gcl_id, pid: data.mx_id }) : _.find(settleBills, { lid: data.gcl_id });
  542. if (info && info.settle_status && info.settle_status === settleStatus.finish) {
  543. return true;
  544. }
  545. return false;
  546. }