diff --git a/src/api/attendance/statistical.js b/src/api/attendance/statistical.js index 0892515..e7762be 100644 --- a/src/api/attendance/statistical.js +++ b/src/api/attendance/statistical.js @@ -35,3 +35,11 @@ export function updateStatistical(data) { data: data }) } + + +export function getAttendanceOper(id){ + return request({ + url: '/attendance/statistical/oper/' + id, + method: 'get' + }) +} \ No newline at end of file diff --git a/src/plugins/DateUtils.js b/src/plugins/DateUtils.js index 4e7ad3d..3105e85 100644 --- a/src/plugins/DateUtils.js +++ b/src/plugins/DateUtils.js @@ -11,5 +11,47 @@ export default{ lastDay.setMonth(lastDay.getMonth() + 1, 0); // 设置日期为下个月的第一天的前一天,即当前月的最后一天 // 格式化日期为YYYY-MM-DD格式 return lastDay.toISOString().slice(0, 10); - } + }, + + formatDate(date, pattern){ + // 如果是时间戳,先转换为 Date 对象 + if (typeof date === 'number') { + date = new Date(date); + } + // 如果是字符串,尝试转换为 Date 对象 + if (typeof date === 'string') { + date = new Date(date.replace(/-/g, '/')); // 处理 Safari 兼容性 + } + + const options = { + year: 'numeric', + month: '2-digit', + day: '2-digit', + hour: '2-digit', + minute: '2-digit', + second: '2-digit', + hour12: false // 24小时制 + }; + + // 简单格式直接返回 + if (pattern === 'yyyy-MM-dd HH:mm:ss') { + return date.toLocaleString('zh-CN', options).replace(/\//g, '-'); + } + + // 自定义格式解析(示例支持 yyyy、MM、dd、HH、mm、ss) + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const day = String(date.getDate()).padStart(2, '0'); + const hour = String(date.getHours()).padStart(2, '0'); + const minute = String(date.getMinutes()).padStart(2, '0'); + const second = String(date.getSeconds()).padStart(2, '0'); + + return pattern.replace('yyyy', year) + .replace('MM', month) + .replace('dd', day) + .replace('HH', hour) + .replace('mm', minute) + .replace('ss', second); + + } } \ No newline at end of file diff --git a/src/views/attendance/statistical/DataComparison/index.vue b/src/views/attendance/statistical/DataComparison/index.vue new file mode 100644 index 0000000..8be38bf --- /dev/null +++ b/src/views/attendance/statistical/DataComparison/index.vue @@ -0,0 +1,69 @@ + + + + diff --git a/src/views/attendance/statistical/index.vue b/src/views/attendance/statistical/index.vue index efb375c..9fe7846 100644 --- a/src/views/attendance/statistical/index.vue +++ b/src/views/attendance/statistical/index.vue @@ -6,6 +6,7 @@ + 修改 + 操作记录 @@ -362,11 +370,30 @@ + +
+ + + +
+ 数据修改人: {{activity.operationAccount}} +
+ +
+
+
+
+
+