schedule_plan.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  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. console.log(showList);
  113. const baseLedgerTree = createNewPathTree('base', {
  114. id: 'ledger_id',
  115. pid: 'ledger_pid',
  116. order: 'order',
  117. level: 'level',
  118. rootId: -1,
  119. fullPath: 'full_path',
  120. calcFields: calcList,
  121. calcFun: function (node) {
  122. node.dgn_price = ZhCalc.round(ZhCalc.div(node.total_price, node.dgn_qty1), 2);
  123. }
  124. });
  125. const newLedgerList = setMonthToLedger(data.bills, data.slm);
  126. baseLedgerTree.loadDatas(newLedgerList);
  127. treeCalc.calculateAll(baseLedgerTree);
  128. console.log(baseLedgerTree);
  129. for (const d of baseLedgerTree.nodes) {
  130. if (!d.b_code) {
  131. const one = _.find(selectedLedgerList, function (item) {
  132. return item === d.ledger_id;
  133. });
  134. if(one) {
  135. ledgerTree.addData(d, showList);
  136. }
  137. }
  138. }
  139. // console.log(ledgerTree);
  140. ledgerTree.sortTreeNode(true);
  141. treeCalc.calculateAll(ledgerTree);
  142. console.log(ledgerTree);
  143. SpreadJsObj.loadSheetData(ledgerSpread.getActiveSheet(), SpreadJsObj.DataType.Tree, ledgerTree);
  144. }, null, true);
  145. const ledgerSpreadObj = {
  146. refreshTree: function (sheet, data) {
  147. SpreadJsObj.massOperationSheet(sheet, function () {
  148. const tree = sheet.zh_tree;
  149. // 处理删除
  150. if (data.delete) {
  151. data.delete.sort(function (x, y) {
  152. return y.deleteIndex - x.deleteIndex;
  153. });
  154. for (const d of data.delete) {
  155. sheet.deleteRows(d.deleteIndex, 1);
  156. }
  157. }
  158. // 处理新增
  159. if (data.create) {
  160. const newNodes = data.create;
  161. if (newNodes) {
  162. newNodes.sort(function (a, b) {
  163. return a.index - b.index;
  164. });
  165. for (const node of newNodes) {
  166. sheet.addRows(node.index, 1);
  167. SpreadJsObj.reLoadRowData(sheet, tree.nodes.indexOf(node), 1);
  168. }
  169. }
  170. }
  171. // 处理更新
  172. if (data.update) {
  173. const rows = [];
  174. for (const u of data.update) {
  175. rows.push(tree.nodes.indexOf(u));
  176. }
  177. SpreadJsObj.reLoadRowsData(sheet, rows);
  178. }
  179. // 处理展开
  180. if (data.expand) {
  181. const expanded = [];
  182. for (const e of data.expand) {
  183. if (expanded.indexOf(e) === -1) {
  184. const posterity = tree.getPosterity(e);
  185. for (const p of posterity) {
  186. sheet.setRowVisible(tree.nodes.indexOf(p), p.visible);
  187. expanded.push(p);
  188. }
  189. }
  190. }
  191. }
  192. });
  193. },
  194. editEnded: function (e, info) {
  195. if (info.sheet.zh_setting) {
  196. const select = SpreadJsObj.getSelectObject(info.sheet);
  197. const col = info.sheet.zh_setting.cols[info.col];
  198. let validText = is_numeric(info.editingText) ? parseFloat(info.editingText) : (info.editingText ? trimInvalidChar(info.editingText) : null);
  199. const orgValue = select[col.field];
  200. if (orgValue == validText || ((!orgValue || orgValue === '') && (validText === ''))) {
  201. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  202. return;
  203. }
  204. if (isNaN(validText)) {
  205. toastr.error('不能输入其它非数字类型字符');
  206. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  207. return;
  208. }
  209. const yearmonth = col.field.split('_')[0];
  210. const mode = col.field.split('_')[1];
  211. let plan_gcl = 0;
  212. let plan_tp = 0;
  213. // 判断输入位数,提示
  214. if (mode === 'tp') {
  215. const reg = new RegExp('^([-]?)\\d+$');
  216. if (validText !== null && (!reg.test(validText))) {
  217. // toastr.error('输入金额请为整数');
  218. // SpreadJsObj.reLoadRowData(info.sheet, info.row);
  219. // return;
  220. validText = ZhCalc.round(validText, 0);
  221. }
  222. plan_gcl = select.dgn_price && select.dgn_price !== 0 ? ZhCalc.round(ZhCalc.div(validText, select.dgn_price), 3) : 0;
  223. plan_tp = validText;
  224. } else {
  225. const reg = new RegExp('^([-]?)\\d+$');
  226. if (validText !== null && (!reg.test(validText))) {
  227. // toastr.error('输入工程量小数位数不能大于3位');
  228. // SpreadJsObj.reLoadRowData(info.sheet, info.row);
  229. // return;
  230. validText = ZhCalc.round(validText, 3);
  231. }
  232. plan_gcl = validText;
  233. plan_tp = select.dgn_price && select.dgn_price !== 0 ? ZhCalc.round(ZhCalc.mul(validText, select.dgn_price), 0) : 0;
  234. }
  235. select[col.field] = validText;
  236. const updateData = {
  237. lid: select.ledger_id,
  238. yearmonth,
  239. plan_gcl,
  240. plan_tp,
  241. };
  242. console.log(updateData);
  243. postData(window.location.pathname + '/save', {type: 'ledger_edit', postData: updateData}, function (result) {
  244. if (mode === 'tp') {
  245. select[yearmonth + '_gcl'] = plan_gcl;
  246. } else {
  247. select[yearmonth + '_tp'] = plan_tp;
  248. }
  249. const nodes = treeCalc.calculateParent(info.sheet.zh_tree, select);
  250. const refreshNode = ledgerTree.loadPostData({update: nodes});
  251. ledgerSpreadObj.refreshTree(info.sheet, refreshNode);
  252. },function () {
  253. select[col.field] = orgValue;
  254. const nodes = treeCalc.calculateParent(info.sheet.zh_tree, select);
  255. const refreshNode = ledgerTree.loadPostData({update: nodes});
  256. ledgerSpreadObj.refreshTree(info.sheet, refreshNode);
  257. })
  258. }
  259. },
  260. deletePress: function (sheet) {
  261. return;
  262. },
  263. clipboardPasted(e, info) {
  264. const hint = {
  265. cellError: {type: 'error', msg: '粘贴内容超出了表格范围'},
  266. numberExpr: {type: 'error', msg: '不能粘贴其它非数字类型字符'},
  267. };
  268. const range = info.cellRange;
  269. if (range.rowCount > 1 || range.colCount > 1) {
  270. toastMessageUniq(hint.cellError);
  271. SpreadJsObj.reLoadSheetHeader(ledgerSpread.getActiveSheet());
  272. SpreadJsObj.reLoadSheetData(ledgerSpread.getActiveSheet());
  273. return;
  274. }
  275. const select = SpreadJsObj.getSelectObject(info.sheet);
  276. const col = info.sheet.zh_setting.cols[range.col];
  277. let validText = is_numeric(info.pasteData.text) ? parseFloat(info.pasteData.text) : (info.pasteData.text ? trimInvalidChar(info.pasteData.text) : null);
  278. const orgValue = select[col.field];
  279. if (orgValue == validText || ((!orgValue || orgValue === '') && (validText === ''))) {
  280. SpreadJsObj.reLoadRowData(info.sheet, info.row);
  281. return;
  282. }
  283. if (isNaN(validText)) {
  284. toastr.error('不能粘贴其它非数字类型字符');
  285. SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
  286. return;
  287. }
  288. const yearmonth = col.field.split('_')[0];
  289. const mode = col.field.split('_')[1];
  290. let plan_gcl = 0;
  291. let plan_tp = 0;
  292. // 判断输入位数,提示
  293. if (mode === 'tp') {
  294. const reg = new RegExp('^([-]?)\\d+$');
  295. if (validText !== null && (!reg.test(validText))) {
  296. // toastr.error('粘贴的金额小数位数不能大于0位');
  297. // SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
  298. // return;
  299. validText = ZhCalc.round(validText, 0);
  300. }
  301. plan_gcl = select.dgn_price && select.dgn_price !== 0 ? ZhCalc.round(ZhCalc.div(validText, select.dgn_price), 3) : 0;
  302. plan_tp = validText;
  303. } else {
  304. // const reg = new RegExp('^([-]?)\\d+(\\.\\d{0,3})?$');
  305. const reg = new RegExp('^([-]?)\\d+$');
  306. if (validText !== null && (!reg.test(validText))) {
  307. // toastr.error('粘贴的工程量小数位数不能大于3位');
  308. // SpreadJsObj.reLoadRowData(info.sheet, info.cellRange.row, info.cellRange.rowCount);
  309. // return;
  310. validText = ZhCalc.round(validText, 3);
  311. }
  312. plan_gcl = validText;
  313. plan_tp = select.dgn_price && select.dgn_price !== 0 ? ZhCalc.round(ZhCalc.mul(validText, select.dgn_price), 0) : 0;
  314. }
  315. select[col.field] = validText;
  316. const updateData = {
  317. lid: select.ledger_id,
  318. yearmonth,
  319. plan_gcl,
  320. plan_tp,
  321. };
  322. postData(window.location.pathname + '/save', {type: 'ledger_edit', postData: updateData}, function (result) {
  323. if (mode === 'tp') {
  324. select[yearmonth + '_gcl'] = plan_gcl;
  325. } else {
  326. select[yearmonth + '_tp'] = plan_tp;
  327. }
  328. const nodes = treeCalc.calculateParent(info.sheet.zh_tree, select);
  329. const refreshNode = ledgerTree.loadPostData({update: nodes});
  330. ledgerSpreadObj.refreshTree(info.sheet, refreshNode);
  331. },function () {
  332. select[col.field] = orgValue;
  333. const nodes = treeCalc.calculateParent(info.sheet.zh_tree, select);
  334. const refreshNode = ledgerTree.loadPostData({update: nodes});
  335. ledgerSpreadObj.refreshTree(info.sheet, refreshNode);
  336. })
  337. },
  338. };
  339. ledgerSpread.bind(spreadNS.Events.EditEnded, ledgerSpreadObj.editEnded);
  340. SpreadJsObj.addDeleteBind(ledgerSpread, ledgerSpreadObj.deletePress);
  341. ledgerSpread.bind(spreadNS.Events.ClipboardPasted, ledgerSpreadObj.clipboardPasted);
  342. // 进度计算方式选择
  343. $('.mode-select').on('click', function () {
  344. const _self = $(this);
  345. postData(window.location.pathname + '/save', {type: 'mode', postData: $(this).data('mode')}, function (result) {
  346. _self.addClass('disabled').attr('disabled', true);
  347. _self.parents('.col-6').siblings('.col-6').find('button').removeClass('disabled').removeAttr('disabled');
  348. $('#mode-tips').show();
  349. $('#mode-cancel').show();
  350. $('#mode').modal('hide');
  351. schedule.mode = _self.data('mode');
  352. SpreadJsObj.reLoadSheetData(ledgerSpread.getActiveSheet());
  353. })
  354. });
  355. // 月份添加
  356. $('#add-month').click(function () {
  357. const range = $('#month-range').val();
  358. if(range === '') {
  359. toastr.error('请选择计划周期时间');
  360. return;
  361. }
  362. const addMonthList = [];
  363. const cycle = range.split(' ~ ');
  364. if(cycle.length === 1) {
  365. addMonthList.push(cycle[0]);
  366. } else {
  367. // 多个月份
  368. const back_year = parseInt(cycle[1].split('-')[0]);
  369. const back_month = parseInt(cycle[1].split('-')[1]);
  370. const front_year = parseInt(cycle[0].split('-')[0]);
  371. const front_month = parseInt(cycle[0].split('-')[1]);
  372. if(back_year > front_year) {
  373. const num = getDistanceMonth(cycle[0], cycle[1]);
  374. let j = 1;
  375. for (let i = 0; i <= num; i++) {
  376. if(front_month + i > 12*j) {
  377. j = j + 1;
  378. }
  379. const m = (front_month + i)%12 === 0 ? 12 : (front_month + i)%12;
  380. addMonthList.push((front_year + (j-1)) + '-' + (m < 10 ? '0' + m : m));
  381. }
  382. } else if (back_year === front_year) {
  383. // 小于1年并没有跨年
  384. for (let i = front_month; i <= back_month; i++) {
  385. addMonthList.push(back_year + '-' + (i < 10 ? '0' + i : i));
  386. }
  387. }
  388. }
  389. // 判断是否已添加本月份
  390. if (addMonthList.length > 0) {
  391. const hadmonth = [];
  392. for (const m of addMonthList) {
  393. const one = _.find(scheduleMonth, { yearmonth: m });
  394. console.log(one, m);
  395. if (one) {
  396. hadmonth.push(m);
  397. }
  398. }
  399. if (hadmonth.length > 0) {
  400. let html = '';
  401. for (const hm of hadmonth) {
  402. html += `<div class="alert alert-danger">${hm} 已创建</div>`;
  403. }
  404. $('#add-month-error-list').html(html);
  405. $('#add-month-error-list').show();
  406. return;
  407. }
  408. } else {
  409. toastr.error('请选择计划周期时间');
  410. return;
  411. }
  412. $('#add-month-error-list').html('');
  413. $('#add-month-error-list').hide();
  414. const _self = $(this);
  415. postData(window.location.pathname + '/save', {type: 'addmonth', postData: addMonthList}, function (result) {
  416. _self.addClass('disabled').attr('disabled', true);
  417. toastr.success('新增成功');
  418. setTimeout(function () {
  419. window.location.reload();
  420. }, 500)
  421. })
  422. });
  423. $('#month-table input[type="checkbox"]').click(function () {
  424. const selectedMonth = [];
  425. $('#month-table input:checkbox:checked').each(function () {
  426. selectedMonth.push('「' + $(this).parents('td').siblings('td').text() + '」');
  427. });
  428. if(selectedMonth.length > 0) {
  429. $('#del-month-list').text(selectedMonth.join(''));
  430. $('#del-month-list').parent().show();
  431. $('#del-month').removeAttr('disabled');
  432. } else {
  433. $('#del-month-list').parent().hide();
  434. $('#del-month').attr('disabled', true);
  435. }
  436. });
  437. $('#del-month').click(function () {
  438. const selectedMonth = [];
  439. $('#month-table input:checkbox:checked').each(function () {
  440. selectedMonth.push($(this).parents('td').siblings().text());
  441. });
  442. if (selectedMonth.length === 0) {
  443. toastr.error('请选择删除的计划周期');
  444. return;
  445. }
  446. const _self = $(this);
  447. postData(window.location.pathname + '/save', {type: 'delmonth', postData: selectedMonth}, function (result) {
  448. _self.addClass('disabled').attr('disabled', true);
  449. toastr.success('删除成功');
  450. setTimeout(function () {
  451. window.location.reload();
  452. }, 500)
  453. })
  454. });
  455. $.subMenu({
  456. menu: '#sub-menu', miniMenu: '#sub-mini-menu', miniMenuList: '#mini-menu-list',
  457. toMenu: '#to-menu', toMiniMenu: '#to-mini-menu',
  458. key: 'menu.1.0.0',
  459. miniHint: '#sub-mini-hint', hintKey: 'menu.hint.1.0.1',
  460. callback: function (info) {
  461. if (info.mini) {
  462. $('.panel-title').addClass('fluid');
  463. $('#sub-menu').removeClass('panel-sidebar');
  464. } else {
  465. $('.panel-title').removeClass('fluid');
  466. $('#sub-menu').addClass('panel-sidebar');
  467. }
  468. ledgerSpread.refresh();
  469. autoFlashHeight();
  470. }
  471. });
  472. });
  473. // 月份间隔
  474. function getDistanceMonth(startTime,endTime){
  475. startTime = new Date(startTime);
  476. endTime = new Date(endTime);
  477. var dateToMonth = 0;
  478. var startDate=startTime.getDate() + startTime.getHours()/24 + startTime.getMinutes()/24/60;
  479. var endDate=endTime.getDate() +endTime.getHours()/24 + endTime.getMinutes()/24/60;
  480. if(endDate >= startDate){
  481. dateToMonth = 0;
  482. }else{
  483. dateToMonth = -1;
  484. }
  485. let yearToMonth = (endTime.getYear() - startTime.getYear()) * 12;
  486. let monthToMonth = endTime.getMonth() - startTime.getMonth();
  487. return yearToMonth + monthToMonth + dateToMonth;
  488. }
  489. function setLeafData(tree) {
  490. const newtree = [];
  491. for (const t of tree) {
  492. const child = _.find(tree, { 'ledger_pid': t.ledger_id });
  493. if (!child && !t.is_leaf) {
  494. t.is_leaf = true;
  495. }
  496. newtree.push(t);
  497. }
  498. return newtree;
  499. }
  500. function setMonthToLedger(ledgerList, slm) {
  501. if (slm.length > 0) {
  502. for(const s of slm) {
  503. const index = _.findIndex(ledgerList, { 'ledger_id': s.lid });
  504. if (index && index !== -1) {
  505. ledgerList[index][s.yearmonth + '_tp'] = s.plan_tp;
  506. ledgerList[index][s.yearmonth + '_gcl'] = s.plan_gcl;
  507. }
  508. }
  509. }
  510. return ledgerList;
  511. }
  512. const is_numeric = (value) => {
  513. if (typeof(value) === 'object') {
  514. return false;
  515. } else {
  516. return !Number.isNaN(Number(value)) && value.toString().trim() !== '';
  517. }
  518. };