<%*
// 1. 输入类型
const type = await tp.system.prompt("分类", "");
// 2. 扫描 Projects/ 计算当前 type 的最大序号
const existing = app.vault.getFiles()
.filter(f => f.path.startsWith("4.Projects/II.tasks") && f.name.startsWith(type + "-"));
let maxNum = 0;
for (const f of existing) {
const escapedType = type.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
const m = f.name.match(new RegExp(`^${type}-(\\d+)-`));
if (m) maxNum = Math.max(maxNum, parseInt(m[1]));
}
const seq = String(maxNum + 1).padStart(3, "0");
// 3. 输入短标题
const shortTitle = await tp.system.prompt("标题 (short-title)");
// 4. 组合文件名并移动
const filename = `${type}-${seq}-${shortTitle}`;
await tp.file.move("4.Projects/II.tasks/" + filename);
-%>
---
project:
sub-project: 子项目-<% shortTitle %>
type: sub-project
seq: <% seq %>
date: <% tp.date.now("YYYY-MM-DD") %>
completion:
mood:
status:
- 进行中
tags:
- task
详情:
check:
try:
---
try
const rows = (dv.current().try || [])
.filter(b => b && b["做了什么/没做的话为什么/想法"]?.trim())
.map(b => [b.日期, b.完成度, b.心情, b["做了什么/没做的话为什么/想法"]]);
if (rows.length > 0) {
dv.table(["日期", "完成度", "心情", "内容"], rows);
}
任务列表