Compare commits
2 Commits
4ff8b0b7a0
...
a05dc15f69
Author | SHA1 | Date | |
---|---|---|---|
a05dc15f69 | |||
cc8bd92569 |
Binary file not shown.
BIN
XNSimHtml/assets/icons/png/cancel_b.png
Normal file
BIN
XNSimHtml/assets/icons/png/cancel_b.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.4 KiB |
BIN
XNSimHtml/assets/icons/png/complete_b.png
Normal file
BIN
XNSimHtml/assets/icons/png/complete_b.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
File diff suppressed because it is too large
Load Diff
@ -1247,18 +1247,30 @@ function addTodo(todoData) {
|
||||
// 打开数据库连接
|
||||
const db = new Database(dbPath);
|
||||
|
||||
// 获取当前本地时间
|
||||
const now = new Date();
|
||||
const year = now.getFullYear();
|
||||
const month = String(now.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(now.getDate()).padStart(2, '0');
|
||||
const hours = String(now.getHours()).padStart(2, '0');
|
||||
const minutes = String(now.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(now.getSeconds()).padStart(2, '0');
|
||||
const localDateTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
|
||||
const result = db.prepare(`
|
||||
INSERT INTO todos (
|
||||
project, subproject, title, text, adduser,
|
||||
completed, created_at, sche_time
|
||||
) VALUES (?, ?, ?, ?, ?, 0, CURRENT_TIMESTAMP, ?)
|
||||
exeuser, completed, created_at, sche_time
|
||||
) VALUES (?, ?, ?, ?, ?, ?, 0, ?, ?)
|
||||
`).run(
|
||||
todoData.project || '其它',
|
||||
todoData.subproject || '其它',
|
||||
todoData.title,
|
||||
todoData.text || '',
|
||||
todoData.adduser || '系统',
|
||||
todoData.sche_time || new Date().toISOString()
|
||||
todoData.exeuser || null,
|
||||
localDateTime,
|
||||
todoData.sche_time || localDateTime
|
||||
);
|
||||
|
||||
db.close();
|
||||
@ -1294,6 +1306,16 @@ function updateTodoStatus(id, completed, exeuser, title, text, sche_time) {
|
||||
// 打开数据库连接
|
||||
const db = new Database(dbPath);
|
||||
|
||||
// 获取当前本地时间
|
||||
const now = new Date();
|
||||
const year = now.getFullYear();
|
||||
const month = String(now.getMonth() + 1).padStart(2, '0');
|
||||
const day = String(now.getDate()).padStart(2, '0');
|
||||
const hours = String(now.getHours()).padStart(2, '0');
|
||||
const minutes = String(now.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(now.getSeconds()).padStart(2, '0');
|
||||
const localDateTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||
|
||||
const result = db.prepare(`
|
||||
UPDATE todos
|
||||
SET completed = ?,
|
||||
@ -1301,7 +1323,7 @@ function updateTodoStatus(id, completed, exeuser, title, text, sche_time) {
|
||||
title = ?,
|
||||
text = ?,
|
||||
sche_time = ?,
|
||||
complete_time = CASE WHEN ? = 1 THEN CURRENT_TIMESTAMP ELSE complete_time END
|
||||
complete_time = CASE WHEN ? = 1 THEN ? ELSE complete_time END
|
||||
WHERE id = ?
|
||||
`).run(
|
||||
completed ? 1 : 0,
|
||||
@ -1310,6 +1332,7 @@ function updateTodoStatus(id, completed, exeuser, title, text, sche_time) {
|
||||
text || '',
|
||||
sche_time || null,
|
||||
completed ? 1 : 0,
|
||||
completed ? localDateTime : null,
|
||||
id
|
||||
);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user