From d6a78806fe449f82c26855228fe6d022d14df88a Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 17 八月 2020 19:06:33 +0800 Subject: [PATCH] 2020-08-17 --- src/tabviews/zshare/normalTable/index.jsx | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/tabviews/zshare/normalTable/index.jsx b/src/tabviews/zshare/normalTable/index.jsx index 52f16c6..86ac880 100644 --- a/src/tabviews/zshare/normalTable/index.jsx +++ b/src/tabviews/zshare/normalTable/index.jsx @@ -299,9 +299,17 @@ if (item.field && record.hasOwnProperty(item.field)) { content = `${record[item.field]}` } - - content = content ? (item.prefix || '') + content + (item.postfix || '') : '' + if (content !== '') { + if (item.format === 'YYYY-MM-DD' && /^[1-9]\d{3}(-|\/)(0[1-9]|1[0-2])(-|\/)(0[1-9]|[1-2][0-9]|3[0-1])/.test(content)) { + content = `${content.substr(0, 4)}-${content.substr(5, 2)}-${content.substr(8, 2)}` + } else if (item.format === 'YYYY-MM-DD HH:mm:ss' && /^[1-9]\d{3}(-|\/)(0[1-9]|1[0-2])(-|\/)(0[1-9]|[1-2][0-9]|3[0-1]).([0-1][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]/.test(content)) { + content = `${content.substr(0, 4)}-${content.substr(5, 2)}-${content.substr(8, 2)} ${content.substr(11, 2)}:${content.substr(14, 2)}:${content.substr(17, 2)}` + } + + content = (item.prefix || '') + content + (item.postfix || '') + } + if (item.marks) { let result = this.getMark(record, item.marks) @@ -566,6 +574,12 @@ let content = record[col.field] if (content !== '') { + if (col.format === 'YYYY-MM-DD' && /^[1-9]\d{3}(-|\/)(0[1-9]|1[0-2])(-|\/)(0[1-9]|[1-2][0-9]|3[0-1])/.test(content)) { + content = `${content.substr(0, 4)}-${content.substr(5, 2)}-${content.substr(8, 2)}` + } else if (col.format === 'YYYY-MM-DD HH:mm:ss' && /^[1-9]\d{3}(-|\/)(0[1-9]|1[0-2])(-|\/)(0[1-9]|[1-2][0-9]|3[0-1]).([0-1][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]/.test(content)) { + content = `${content.substr(0, 4)}-${content.substr(5, 2)}-${content.substr(8, 2)} ${content.substr(11, 2)}:${content.substr(14, 2)}:${content.substr(17, 2)}` + } + content = (col.prefix || '') + record[col.field] + (col.postfix || '') } -- Gitblit v1.8.0