|
@@ -2,44 +2,51 @@ import { MessageBox, Message, Notification } from '@zjlib/element-ui2'
|
|
|
|
|
|
export function addHours(str) {
|
|
|
// 获取当前时间
|
|
|
- var currentDate = new Date(str);
|
|
|
+ var currentDate = new Date(str)
|
|
|
|
|
|
// 增加一小时
|
|
|
- currentDate.setHours(currentDate.getHours() + 1);
|
|
|
+ currentDate.setHours(currentDate.getHours() + 1)
|
|
|
|
|
|
// 转换 "YYYY-MM-DD HH:mm:ss" 格式
|
|
|
- var formattedDate = currentDate.getFullYear() + '-' +
|
|
|
- ('0' + (currentDate.getMonth() + 1)).slice(-2) + '-' +
|
|
|
- ('0' + currentDate.getDate()).slice(-2) + ' ' +
|
|
|
- ('0' + currentDate.getHours()).slice(-2) + ':' +
|
|
|
- ('0' + currentDate.getMinutes()).slice(-2) + ':' +
|
|
|
- ('0' + currentDate.getSeconds()).slice(-2);
|
|
|
+ var formattedDate =
|
|
|
+ currentDate.getFullYear() +
|
|
|
+ '-' +
|
|
|
+ ('0' + (currentDate.getMonth() + 1)).slice(-2) +
|
|
|
+ '-' +
|
|
|
+ ('0' + currentDate.getDate()).slice(-2) +
|
|
|
+ ' ' +
|
|
|
+ ('0' + currentDate.getHours()).slice(-2) +
|
|
|
+ ':' +
|
|
|
+ ('0' + currentDate.getMinutes()).slice(-2) +
|
|
|
+ ':' +
|
|
|
+ ('0' + currentDate.getSeconds()).slice(-2)
|
|
|
|
|
|
return formattedDate
|
|
|
}
|
|
|
|
|
|
export function tableDataParsing(fieldBeans) {
|
|
|
- return fieldBeans.map((item, index) => {
|
|
|
- var tiling =
|
|
|
- item.tiling || item.tiling === null || item.tiling === undefined ? true : false;
|
|
|
- return {
|
|
|
- tiling,
|
|
|
- exportField: item,
|
|
|
- hidden: item.isShow === null ? false : !item.isShow,
|
|
|
- isCopy: item.isCopy || false,
|
|
|
- isTotal: item.isTotal || false,
|
|
|
- sortNum: item.sortNum || 0,
|
|
|
- recordType: item.type,
|
|
|
- columnAttributes: {
|
|
|
- fixed: item.fixed ? item.fixed : false,
|
|
|
- label: item.label || '',
|
|
|
- prop: item.jname,
|
|
|
- width: item.width || 'auto',
|
|
|
- 'min-width': ((label) => label.length * 16 + 64)(item.label || ''),
|
|
|
- align: ~['number', 'amount'].indexOf(item.type) ? 'right' : 'left',
|
|
|
- },
|
|
|
- };
|
|
|
- });
|
|
|
+ return fieldBeans
|
|
|
+ .filter(item => !item.hide && item.noUse !== true)
|
|
|
+ .map((item, index) => {
|
|
|
+ var tiling = item.tiling || item.tiling === null || item.tiling === undefined ? true : false
|
|
|
+ return {
|
|
|
+ tiling,
|
|
|
+ exportField: item,
|
|
|
+ hidden: item.isShow === null ? false : !item.isShow,
|
|
|
+ isCopy: item.isCopy || false,
|
|
|
+ isTotal: item.isTotal || false,
|
|
|
+ sortNum: item.sortNum || 0,
|
|
|
+ recordType: item.type,
|
|
|
+ columnAttributes: {
|
|
|
+ fixed: item.fixed ? item.fixed : false,
|
|
|
+ label: item.label || '',
|
|
|
+ prop: item.jname,
|
|
|
+ width: item.width || 'auto',
|
|
|
+ 'min-width': (label => label.length * 16 + 64)(item.label || ''),
|
|
|
+ align: ~['number', 'amount'].indexOf(item.type) ? 'right' : 'left'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
export const successMsg = msg => {
|
|
@@ -199,17 +206,17 @@ export const debounce = (fn, delay = 1000) => {
|
|
|
}
|
|
|
|
|
|
export function thousands(num) {
|
|
|
- if (num === null) {
|
|
|
- return '';
|
|
|
- }
|
|
|
- var n = Number(num).toFixed(2);
|
|
|
- if (isNaN(n)) {
|
|
|
- return n;
|
|
|
- }
|
|
|
- n = n + '';
|
|
|
- var [a, b] = n.split('.');
|
|
|
- var aq = Number(a).toLocaleString();
|
|
|
- return `${aq}.${b}`;
|
|
|
+ if (num === null) {
|
|
|
+ return ''
|
|
|
+ }
|
|
|
+ var n = Number(num).toFixed(2)
|
|
|
+ if (isNaN(n)) {
|
|
|
+ return n
|
|
|
+ }
|
|
|
+ n = n + ''
|
|
|
+ var [a, b] = n.split('.')
|
|
|
+ var aq = Number(a).toLocaleString()
|
|
|
+ return `${aq}.${b}`
|
|
|
}
|
|
|
|
|
|
export default {
|