aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/park-editor.html29
1 files changed, 19 insertions, 10 deletions
diff --git a/scripts/park-editor.html b/scripts/park-editor.html
index 7648121..89ba668 100644
--- a/scripts/park-editor.html
+++ b/scripts/park-editor.html
@@ -561,8 +561,9 @@ function corruptLabel(inp) {
return `${name} / ${label}: ${inp.value}`;
}
+const PARK_EXPORT_HEAD = ["番号", "確認", "メモ", "公園名", "住所", "Googleマップ"];
const PARK_EXPORT_KEYS = [
- "公園名", "住所", "町名", "種別", "面積㎡", "設置者", "状態",
+ "町名", "種別", "面積㎡", "設置者", "状態",
"トイレ", "水飲み場", "ベンチ・椅子", "テーブル", "シェルター等",
"草地広場", "多目的広場", "築山", "じゃぶじゃぶ池",
"防災用具", "ボール遊び", "遊具", "時計", "駐車場", "その他設備", "備考",
@@ -578,10 +579,10 @@ function csvCell(value) {
// 確認・メモの列を先頭に置き、外出先で入力しやすくする。
function exportUncheckedCsv() {
const targets = [];
- rows.forEach((row) => {
+ rows.forEach((row, r) => {
const props = isFC ? row.properties || {} : row;
if (isChecked(currentId, rowKey(props, currentId))) return;
- targets.push({ row, props });
+ targets.push({ r, row, props });
});
if (!targets.length) {
statusEl.textContent = "未確認の行はありません。";
@@ -591,20 +592,28 @@ function exportUncheckedCsv() {
let headers;
let toCells;
if (currentId === "parks") {
- headers = ["確認", "メモ", ...PARK_EXPORT_KEYS, "地図"];
- toCells = ({ row, props }) => [
- "", "",
- ...PARK_EXPORT_KEYS.map((key) => props[key] ?? ""),
+ headers = [...PARK_EXPORT_HEAD, ...PARK_EXPORT_KEYS];
+ toCells = ({ row, props }, no) => [
+ no, "", "",
+ props["公園名"] ?? "",
+ props["住所"] ?? "",
mapsUrl(row, props),
+ ...PARK_EXPORT_KEYS.map((key) => props[key] ?? ""),
];
} else {
const cols = fields.filter((field) => !field.toy);
- headers = [...cols.map((field) => field.label.replace(/<[^>]+>/g, "")), "地図"];
- toCells = ({ row, props }) => [...cols.map((field) => props[field.key] ?? ""), mapsUrl(row, props)];
+ headers = ["番号", ...cols.map((field) => field.label.replace(/<[^>]+>/g, "")), "Googleマップ"];
+ toCells = ({ row, props }, no) => [
+ no,
+ ...cols.map((field) => props[field.key] ?? ""),
+ mapsUrl(row, props),
+ ];
}
const lines = [headers.map(csvCell).join(",")];
- for (const target of targets) lines.push(toCells(target).map(csvCell).join(","));
+ targets.forEach((target, index) => {
+ lines.push(toCells(target, index + 1).map(csvCell).join(","));
+ });
const csv = "\uFEFF" + lines.join("\r\n") + "\r\n";
const blob = new Blob([csv], { type: "text/csv;charset=utf-8" });
const url = URL.createObjectURL(blob);