schedule_plan.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. /**
  2. * 进度台账相关js
  3. *
  4. * @author Ellisran
  5. * @date 2020/11/6
  6. * @version
  7. */
  8. function getTenderId() {
  9. return window.location.pathname.split('/')[2];
  10. }
  11. $(function () {
  12. autoFlashHeight();
  13. if(schedule && !schedule.mode) {
  14. $('#mode').modal('show');
  15. }
  16. // 初始化台账
  17. const ledgerSpread = SpreadJsObj.createNewSpread($('#ledger-spread')[0]);
  18. const treeSetting = {
  19. id: 'ledger_id',
  20. pid: 'ledger_pid',
  21. order: 'order',
  22. level: 'level',
  23. rootId: -1,
  24. fullPath: 'full_path',
  25. calcFun: function (node) {
  26. node.dgn_price = ZhCalc.round(ZhCalc.div(node.total_price, node.dgn_qty1), 2);
  27. }
  28. //treeCacheKey: 'ledger_bills_fold' + '_' + getTenderId(),
  29. // markFoldKey: 'bills-fold',
  30. // markFoldSubKey: window.location.pathname.split('/')[2],
  31. };
  32. const static_cols = [
  33. {title: '编号', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 145, formatter: '@', readOnly: true, cellType: 'tree'},
  34. {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 185, formatter: '@', readOnly: true},
  35. {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 50, formatter: '@', readOnly: true},
  36. {title: '经济指标', colSpan: '1', rowSpan: '2', field: 'dgn_price', hAlign: 2, width: 60, type: 'Number', readOnly: true},
  37. {title: '总设计|工程量', colSpan: '2|1', rowSpan: '1|1', field: 'dgn_qty1', hAlign: 2, width: 70, type: 'Number', readOnly: true},
  38. {title: '|金额(元)', colSpan: '|1', rowSpan: '|1', field: 'total_price', hAlign: 2, width: 70, type: 'Number', readOnly: true},
  39. ];
  40. const ledgerSpreadSetting = {
  41. emptyRows: 0,
  42. headRows: 2,
  43. headRowHeight: [25, 25],
  44. defaultRowHeight: 21,
  45. headerFont: '12px 微软雅黑',
  46. font: '12px 微软雅黑',
  47. // readOnly: true,
  48. localCache: {
  49. key: 'ledger-bills',
  50. colWidth: true,
  51. }
  52. };
  53. const monthsCols = [];
  54. const calcCols = ['total_price'];
  55. if(scheduleMonth.length > 0) {
  56. for (const sm of scheduleMonth) {
  57. const readOnly = sm.stage_gcl_used !== 0 || sm.stage_tp_used !== 0;
  58. const yearmonth = sm.yearmonth.split('-')[0] + '年' + parseInt(sm.yearmonth.split('-')[1]) + '月';
  59. const cols = {title: yearmonth + '|计划工程量', colSpan: '2|1', rowSpan: '1|1', field: sm.yearmonth+'_gcl', hAlign: 2, width: 90, type: 'Number', readOnly: readOnly ? readOnly : 'readOnly.gcl'};
  60. const cols2 = {title: '|计划金额(元)', colSpan: '|1', rowSpan: '|1', field: sm.yearmonth+'_tp', hAlign: 2, width: 90, type: 'Number', readOnly: readOnly ? readOnly : 'readOnly.tp'};
  61. monthsCols.push(cols);
  62. monthsCols.push(cols2);
  63. // calcCols.push(sm.yearmonth+'_gcl');
  64. calcCols.push(sm.yearmonth+'_tp');
  65. }
  66. }
  67. treeSetting.calcFields = calcCols;
  68. const ledgerTree = createNewPathTree('filter', treeSetting);
  69. const spreadHeaderCols = static_cols.concat(monthsCols);
  70. ledgerSpreadSetting.cols = spreadHeaderCols;
  71. const ledgerCol = {
  72. readOnly: {
  73. tp: function (data) {
  74. let flag = data.is_leaf;
  75. if (data.is_leaf) {
  76. flag = schedule && schedule.mode === mode.tp;
  77. }
  78. return !flag;
  79. },
  80. gcl: function (data) {
  81. let flag = data.is_leaf;
  82. if (data.is_leaf) {
  83. flag = schedule && schedule.mode === mode.gcl;
  84. }
  85. return !flag;
  86. },
  87. },
  88. };
  89. sjsSettingObj.setFxTreeStyle(ledgerSpreadSetting, sjsSettingObj.FxTreeStyle.jz);
  90. if (thousandth) sjsSettingObj.setTpThousandthFormat(ledgerSpreadSetting);
  91. SpreadJsObj.initSpreadSettingEvents(ledgerSpreadSetting, ledgerCol);
  92. SpreadJsObj.initSheet(ledgerSpread.getActiveSheet(), ledgerSpreadSetting);
  93. SpreadJsObj.selChangedRefreshBackColor(ledgerSpread.getActiveSheet());
  94. postData('/tender/' + getTenderId() + '/schedule/ledger/load', {}, function (data) {
  95. // let treeData = [];
  96. // for(const sl of selectedLedgerList) {
  97. // const one = _.find(data, { 'ledger_id' : sl });
  98. // treeData.push(one);
  99. // }
  100. // treeData = setLeafData(treeData);
  101. // console.log(treeData);
  102. // let treeData = data;
  103. const calcList = ['total_price'];
  104. const showList = ['ledger_id', 'ledger_pid', 'order', 'level', 'tender_id', 'full_path',
  105. 'code', 'name', 'unit', 'dgn_qty1', 'dgn_qty2', 'dgn_price', 'quantity', 'total_price'];
  106. for (const m of monthList) {
  107. showList.push(m + '_tp');
  108. showList.push(m + '_gcl');
  109. // calcList.push(m + '_tp');
  110. // calcList.push(m + '_gcl');
  111. }
  112. const baseLedgerTree = createNewPathTree('base', {
  113. id: 'ledger_id',
  114. pid: 'ledger_pid',
  115. order: 'order',
  116. level: 'level',
  117. rootId: -1,
  118. fullPath: 'full_path',
  119. calcFields: calcList,
  120. calcFun: function (node) {
  121. node.dgn_price = ZhCalc.round(ZhCalc.div(node.total_price, node.dgn_qty1), 2);
  122. }
  123. });
  124. const newLedgerList = setMonthToLedger(data.bills, data.slm);
  125. baseLedgerTree.loadDatas(newLedgerList);
  126. treeCalc.calculateAll(baseLedgerTree);
  127. console.log(baseLedgerTree);
  128. for (const d of baseLedgerTree.nodes) {
  129. if (!d.b_code) {
  130. const one = _.find(selectedLedgerList, function (item) {
  131. return item === d.ledger_id;
  132. });
  133. if(one) {
  134. ledgerTree.addData(d, showList);
  135. }
  136. }
  137. }
  138. // console.log(ledgerTree);
  139. ledgerTree.sortTreeNode(true);
  140. treeCalc.calculateAll(ledgerTree);
  141. console.log(ledgerTree);
  142. SpreadJsObj.loadSheetData(ledgerSpread.getActiveSheet(), SpreadJsObj.DataType.Tree, ledgerTree);
  143. }, null, true);
  144. const ledgerSpreadObj = {
  145. refreshTree: function (sheet, data) {
  146. SpreadJsObj.massOperationSheet(sheet, function () {
  147. const tree = sheet.zh_tree;
  148. // 处理删除
  149. if (data.delete) {
  150. data.delete.sort(function (x, y) {
  151. return y.deleteIndex - x.deleteIndex;
  152. });
  153. for (const d of data.delete) {
  154. sheet.deleteRows(d.deleteIndex, 1);
  155. }
  156. }
  157. // 处理新增
  158. if (data.create) {
  159. const newNodes = data.create;
  160. if (newNodes) {
  161. newNodes.sort(function (a, b) {
  162. return a.index - b.index;
  163. });
  164. for (const node of newNodes) {
  165. sheet.addRows(node.index, 1);
  166. SpreadJsObj.reLoadRowData(sheet, tree.nodes.indexOf(node), 1);
  167. }
  168. }
  169. }
  170. // 处理更新
  171. if (data.update) {
  172. const rows = [];
  173. for (const u of data.update) {
  174. rows.push(tree.nodes.indexOf(u));
  175. }
  176. SpreadJsObj.reLoadRowsData(sheet, rows);
  177. }
  178. // 处理展开
  179. if (data.expand) {
  180. const expanded = [];
  181. for (const e of data.expand) {
  182. if (expanded.indexOf(e) === -1) {
  183. const posterity = tree.getPosterity(e);
  184. for (const p of posterity) {
  185. sheet.setRowVisible(tree.nodes.indexOf(p), p.visible);
  186. expanded.push(p);
  187. }
  188. }
  189. }
  190. }
  191. });
  192. },
  193. editEnded: function (e, info) {
  194. if (info.sheet.zh_setting) {
  195. const select = SpreadJsObj.getSelectObject(info.sheet);
  196. const col = info.sheet.zh_setting.cols[info.col];
  197. let validText = is_numeric(info.editingText) ? parseFloat(info.editingText) : (info.editingText ? trimInvalidChar(info.editingText) : null);
  198. const orgValue = select[col.field];
  199. if (orgValue == validText || ((!orgValue || orgValue === '') && (validText === ''))) {
  200. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  201. return;
  202. }
  203. if (isNaN(validText)) {
  204. toastr.error('不能输入其它非数字类型字符');
  205. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  206. return;
  207. }
  208. const yearmonth = col.field.split('_')[0];
  209. const mode = col.field.split('_')[1];
  210. let plan_gcl = 0;
  211. let plan_tp = 0;
  212. // 判断输入位数,提示
  213. if (mode === 'tp') {
  214. const reg = new RegExp('^([-]?)\\d+$');
  215. if (validText !== null && (!reg.test(validText))) {
  216. // toastr.error('输入金额请为整数');
  217. // SpreadJsObj.reLoadRowData(info.sheet, info.row);
  218. // return;
  219. validText = ZhCalc.round(validText, 0);
  220. }
  221. plan_gcl = select.dgn_price && select.dgn_price !== 0 ? ZhCalc.round(ZhCalc.div(validText, select.dgn_price), 3) : 0;
  222. plan_tp = validText;
  223. } else {
  224. const reg = new RegExp('^([-]?)\\d+$');
  225. if (validText !== null && (!reg.test(validText))) {
  226. // toastr.error('输入工程量小数位数不能大于3位');
  227. // SpreadJsObj.reLoadRowData(info.sheet, info.row);
  228. // return;
  229. validText = ZhCalc.round(validText, 3);
  230. }
  231. plan_gcl = validText;
  232. plan_tp = select.dgn_price && select.dgn_price !== 0 ? ZhCalc.round(ZhCalc.mul(validText, select.dgn_price), 0) : 0;
  233. }
  234. select[col.field] = validText;
  235. const updateData = {
  236. lid: select.ledger_id,
  237. yearmonth,
  238. plan_gcl,
  239. plan_tp,
  240. };
  241. console.log(updateData);
  242. postData(window.location.pathname + '/save', {type: 'ledger_edit', postData: updateData}, function (result) {
  243. if (mode === 'tp') {
  244. select[yearmonth + '_gcl'] = plan_gcl;
  245. } else {
  246. select[yearmonth + '_tp'] = plan_tp;
  247. }
  248. const nodes = treeCalc.calculateParent(info.sheet.zh_tree, select);
  249. const refreshNode = ledgerTree.loadPostData({update: nodes});
  250. ledgerSpreadObj.refreshTree(info.sheet, refreshNode);
  251. },function () {
  252. select[col.field] = orgValue;
  253. const nodes = treeCalc.calculateParent(info.sheet.zh_tree, select);
  254. const refreshNode = ledgerTree.loadPostData({update: nodes});
  255. ledgerSpreadObj.refreshTree(info.sheet, refreshNode);
  256. })
  257. }
  258. },
  259. deletePress: function (sheet) {
  260. return;
  261. },
  262. clipboardPasted(e, info) {
  263. const hint = {
  264. cellError: {type: 'error', msg: '粘贴内容超出了表格范围'},
  265. numberExpr: {type: 'error', msg: '不能粘贴其它非数字类型字符'},
  266. };
  267. const range = info.cellRange;
  268. if (range.rowCount > 1 || range.colCount > 1) {
  269. toastMessageUniq(hint.cellError);
  270. SpreadJsObj.reLoadSheetHeader(ledgerSpread.getActiveSheet());
  271. SpreadJsObj.reLoadSheetData(ledgerSpread.getActiveSheet());
  272. return;
  273. }
  274. const select = SpreadJsObj.getSelectObject(info.sheet);
  275. const col = info.sheet.zh_setting.cols[range.col];
  276. let validText = is_numeric(info.pasteData.text) ? parseFloat(info.pasteData.text) : (info.pasteData.text ? trimInvalidChar(info.pasteData.text) : null);
  277. const orgValue = select[col.field];
  278. if (orgValue == validText || ((!orgValue || orgValue === '') && (validText === ''))) {
  279. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  280. return;
  281. }
  282. if (isNaN(validText)) {
  283. toastr.error('不能粘贴其它非数字类型字符');
  284. SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
  285. return;
  286. }
  287. const yearmonth = col.field.split('_')[0];
  288. const mode = col.field.split('_')[1];
  289. let plan_gcl = 0;
  290. let plan_tp = 0;
  291. // 判断输入位数,提示
  292. if (mode === 'tp') {
  293. const reg = new RegExp('^([-]?)\\d+$');
  294. if (validText !== null && (!reg.test(validText))) {
  295. // toastr.error('粘贴的金额小数位数不能大于0位');
  296. // SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
  297. // return;
  298. validText = ZhCalc.round(validText, 0);
  299. }
  300. plan_gcl = select.dgn_price && select.dgn_price !== 0 ? ZhCalc.round(ZhCalc.div(validText, select.dgn_price), 3) : 0;
  301. plan_tp = validText;
  302. } else {
  303. // const reg = new RegExp('^([-]?)\\d+(\\.\\d{0,3})?$');
  304. const reg = new RegExp('^([-]?)\\d+$');
  305. if (validText !== null && (!reg.test(validText))) {
  306. // toastr.error('粘贴的工程量小数位数不能大于3位');
  307. // SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
  308. // return;
  309. validText = ZhCalc.round(validText, 3);
  310. }
  311. plan_gcl = validText;
  312. plan_tp = select.dgn_price && select.dgn_price !== 0 ? ZhCalc.round(ZhCalc.mul(validText, select.dgn_price), 0) : 0;
  313. }
  314. select[col.field] = validText;
  315. const updateData = {
  316. lid: select.ledger_id,
  317. yearmonth,
  318. plan_gcl,
  319. plan_tp,
  320. };
  321. postData(window.location.pathname + '/save', {type: 'ledger_edit', postData: updateData}, function (result) {
  322. if (mode === 'tp') {
  323. select[yearmonth + '_gcl'] = plan_gcl;
  324. } else {
  325. select[yearmonth + '_tp'] = plan_tp;
  326. }
  327. const nodes = treeCalc.calculateParent(info.sheet.zh_tree, select);
  328. const refreshNode = ledgerTree.loadPostData({update: nodes});
  329. ledgerSpreadObj.refreshTree(info.sheet, refreshNode);
  330. },function () {
  331. select[col.field] = orgValue;
  332. const nodes = treeCalc.calculateParent(info.sheet.zh_tree, select);
  333. const refreshNode = ledgerTree.loadPostData({update: nodes});
  334. ledgerSpreadObj.refreshTree(info.sheet, refreshNode);
  335. })
  336. },
  337. };
  338. ledgerSpread.bind(spreadNS.Events.EditEnded, ledgerSpreadObj.editEnded);
  339. SpreadJsObj.addDeleteBind(ledgerSpread, ledgerSpreadObj.deletePress);
  340. ledgerSpread.bind(spreadNS.Events.ClipboardPasted, ledgerSpreadObj.clipboardPasted);
  341. // 进度计算方式选择
  342. $('.mode-select').on('click', function () {
  343. const _self = $(this);
  344. postData(window.location.pathname + '/save', {type: 'mode', postData: $(this).data('mode')}, function (result) {
  345. _self.addClass('disabled').attr('disabled', true);
  346. _self.parents('.col-6').siblings('.col-6').find('button').removeClass('disabled').removeAttr('disabled');
  347. $('#mode-tips').show();
  348. $('#mode-cancel').show();
  349. $('#mode').modal('hide');
  350. schedule.mode = _self.data('mode');
  351. SpreadJsObj.reLoadSheetData(ledgerSpread.getActiveSheet());
  352. })
  353. });
  354. // 月份添加
  355. $('#add-month').click(function () {
  356. const range = $('#month-range').val();
  357. if(range === '') {
  358. toastr.error('请选择计划周期时间');
  359. return;
  360. }
  361. const addMonthList = [];
  362. const cycle = range.split(' ~ ');
  363. if(cycle.length === 1) {
  364. addMonthList.push(cycle[0]);
  365. } else {
  366. // 多个月份
  367. const back_year = parseInt(cycle[1].split('-')[0]);
  368. const back_month = parseInt(cycle[1].split('-')[1]);
  369. const front_year = parseInt(cycle[0].split('-')[0]);
  370. const front_month = parseInt(cycle[0].split('-')[1]);
  371. if(back_year > front_year) {
  372. const num = getDistanceMonth(cycle[0], cycle[1]);
  373. let j = 1;
  374. for (let i = 0; i <= num; i++) {
  375. if(front_month + i > 12*j) {
  376. j = j + 1;
  377. }
  378. const m = (front_month + i)%12 === 0 ? 12 : (front_month + i)%12;
  379. addMonthList.push((front_year + (j-1)) + '-' + (m < 10 ? '0' + m : m));
  380. }
  381. } else if (back_year === front_year) {
  382. // 小于1年并没有跨年
  383. for (let i = front_month; i <= back_month; i++) {
  384. addMonthList.push(back_year + '-' + (i < 10 ? '0' + i : i));
  385. }
  386. }
  387. }
  388. // 判断是否已添加本月份
  389. if (addMonthList.length > 0) {
  390. const hadmonth = [];
  391. for (const m of addMonthList) {
  392. const one = _.find(scheduleMonth, { yearmonth: m });
  393. console.log(one, m);
  394. if (one) {
  395. hadmonth.push(m);
  396. }
  397. }
  398. if (hadmonth.length > 0) {
  399. let html = '';
  400. for (const hm of hadmonth) {
  401. html += `<div class="alert alert-danger">${hm} 已创建</div>`;
  402. }
  403. $('#add-month-error-list').html(html);
  404. $('#add-month-error-list').show();
  405. return;
  406. }
  407. } else {
  408. toastr.error('请选择计划周期时间');
  409. return;
  410. }
  411. $('#add-month-error-list').html('');
  412. $('#add-month-error-list').hide();
  413. const _self = $(this);
  414. postData(window.location.pathname + '/save', {type: 'addmonth', postData: addMonthList}, function (result) {
  415. _self.addClass('disabled').attr('disabled', true);
  416. toastr.success('新增成功');
  417. setTimeout(function () {
  418. window.location.reload();
  419. }, 500)
  420. })
  421. });
  422. $('#month-table input[type="checkbox"]').click(function () {
  423. const selectedMonth = [];
  424. $('#month-table input:checkbox:checked').each(function () {
  425. selectedMonth.push('「' + $(this).parents('td').siblings('td').text() + '」');
  426. });
  427. if(selectedMonth.length > 0) {
  428. $('#del-month-list').text(selectedMonth.join(''));
  429. $('#del-month-list').parent().show();
  430. $('#del-month').removeAttr('disabled');
  431. } else {
  432. $('#del-month-list').parent().hide();
  433. $('#del-month').attr('disabled', true);
  434. }
  435. });
  436. $('#del-month').click(function () {
  437. const selectedMonth = [];
  438. $('#month-table input:checkbox:checked').each(function () {
  439. selectedMonth.push($(this).parents('td').siblings().text());
  440. });
  441. if (selectedMonth.length === 0) {
  442. toastr.error('请选择删除的计划周期');
  443. return;
  444. }
  445. const _self = $(this);
  446. postData(window.location.pathname + '/save', {type: 'delmonth', postData: selectedMonth}, function (result) {
  447. _self.addClass('disabled').attr('disabled', true);
  448. toastr.success('删除成功');
  449. setTimeout(function () {
  450. window.location.reload();
  451. }, 500)
  452. })
  453. });
  454. $.subMenu({
  455. menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
  456. toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
  457. key: 'menu.1.0.0',
  458. miniHint: '#sub-mini-hint', hintKey: 'menu.hint.1.0.1',
  459. callback: function (info) {
  460. if (info.mini) {
  461. $('.panel-title').addClass('fluid');
  462. $('#sub-menu').removeClass('panel-sidebar');
  463. } else {
  464. $('.panel-title').removeClass('fluid');
  465. $('#sub-menu').addClass('panel-sidebar');
  466. }
  467. ledgerSpread.refresh();
  468. autoFlashHeight();
  469. }
  470. });
  471. });
  472. // 月份间隔
  473. function getDistanceMonth(startTime,endTime){
  474. startTime = new Date(startTime);
  475. endTime = new Date(endTime);
  476. var dateToMonth = 0;
  477. var startDate=startTime.getDate() + startTime.getHours()/24 + startTime.getMinutes()/24/60;
  478. var endDate=endTime.getDate() +endTime.getHours()/24 + endTime.getMinutes()/24/60;
  479. if(endDate >= startDate){
  480. dateToMonth = 0;
  481. }else{
  482. dateToMonth = -1;
  483. }
  484. let yearToMonth = (endTime.getYear() - startTime.getYear()) * 12;
  485. let monthToMonth = endTime.getMonth() - startTime.getMonth();
  486. return yearToMonth + monthToMonth + dateToMonth;
  487. }
  488. function setLeafData(tree) {
  489. const newtree = [];
  490. for (const t of tree) {
  491. const child = _.find(tree, { 'ledger_pid': t.ledger_id });
  492. if (!child && !t.is_leaf) {
  493. t.is_leaf = true;
  494. }
  495. newtree.push(t);
  496. }
  497. return newtree;
  498. }
  499. function setMonthToLedger(ledgerList, slm) {
  500. if (slm.length > 0) {
  501. for(const s of slm) {
  502. const index = _.findIndex(ledgerList, { 'ledger_id': s.lid });
  503. if (index && index !== -1) {
  504. ledgerList[index][s.yearmonth + '_tp'] = s.plan_tp;
  505. ledgerList[index][s.yearmonth + '_gcl'] = s.plan_gcl;
  506. }
  507. }
  508. }
  509. return ledgerList;
  510. }
  511. const is_numeric = (value) => {
  512. if (typeof(value) === 'object') {
  513. return false;
  514. } else {
  515. return !Number.isNaN(Number(value)) && value.toString().trim() !== '';
  516. }
  517. };