1 |
- "use strict";const t=require("../../common/vendor.js");exports.floatToFixed2=t=>{let e="0.00";if(void 0===t)return e;const r=(t=>{if(void 0===t)return 0;const e="string"==typeof t?parseFloat(t):t;return parseFloat((e/100).toFixed(2))})(t),n=r.toString().split(".")[1];switch(n?n.length:0){case 0:e=r.toString()+".00";break;case 1:e=r.toString()+".0";break;case 2:e=r.toString()}return e},exports.formatDate=function(e,r){return e?(void 0===r&&(r="YYYY-MM-DD HH:mm:ss"),t.dayjs(e).format(r)):""},exports.handleTree=function(t,e="id",r="parentId",n="children",o=0){const i=JSON.parse(JSON.stringify(t)),s=i.filter((t=>{let n=i.filter((n=>t[e]===n[r]));return n.length>0&&(t.children=n),t[r]===o}));return""!==s?s:t},exports.resetPagination=function(t){t.list=[],t.total=0,t.pageNo=1};
|