+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查詢
+
+
+
+
+
新增任務
@@ -26,16 +63,10 @@
@@ -57,11 +88,15 @@ import { ref, computed } from "vue";
import { templateList } from "../../constants/templateList.js";
import PaginatedTable from "../Common/PaginatedTable.vue";
import AddTaskDialog from "./AddTaskDialog.vue";
-import { Plus, Delete, Edit } from "@element-plus/icons-vue";
+import { Plus, Delete, Edit, Search } from "@element-plus/icons-vue";
const currentPage = ref(1);
const pageSize = ref(10);
-const tableData = [
+// 篩選條件
+const filterFactory = ref("");
+const filterCategory = ref("");
+
+const tableData = ref([
{
index: 1,
factory: "四磺子坪",
@@ -172,24 +207,23 @@ const tableData = [
creator: "管理員03",
createdAt: "2025-11-13 17:14:05",
},
-];
-// 篩選選項
-const factoryFilters = computed(() =>
- Array.from(new Set(tableData.map((item) => item.factory))).map((factory) => ({
- text: factory,
- value: factory,
- }))
-);
-const categoryFilters = computed(() =>
- Array.from(new Set(tableData.map((item) => item.category))).map(
- (category) => ({
- text: category,
- value: category,
- })
- )
-);
-const filterFactory = (value, row) => row.factory === value;
-const filterCategory = (value, row) => row.category === value;
+]);
+
+const filteredData = computed(() => {
+ let result = tableData.value;
+
+ // 過濾電廠
+ if (filterFactory.value) {
+ result = result.filter((item) => item.factory === filterFactory.value);
+ }
+
+ // 過濾類別
+ if (filterCategory.value) {
+ result = result.filter((item) => item.category === filterCategory.value);
+ }
+
+ return result;
+});
// dialog 狀態與表單
const showDialog = ref(false);
@@ -215,15 +249,23 @@ function resetTaskForm() {
}
function handleAddTask() {
+ // 根據 templateName 判斷 category
+ let category = "";
+ if (taskForm.value.templateName) {
+ if (taskForm.value.templateName.includes("點檢表")) {
+ category = "點檢表";
+ } else if (taskForm.value.templateName.includes("巡檢表")) {
+ category = "巡檢表";
+ } else {
+ category = taskForm.value.templateName;
+ }
+ }
+
// 新增到 tableData
- tableData.push({
- index: tableData.length + 1,
+ tableData.value.push({
+ index: tableData.value.length + 1,
factory: taskForm.value.factory,
- category: taskForm.value.templateName
- ? taskForm.value.templateName.split("每日").length > 1
- ? "點檢表"
- : "巡檢表"
- : "",
+ category: category,
taskName: taskForm.value.taskName,
frequency: taskForm.value.frequency,
count: taskForm.value.count,
@@ -234,6 +276,24 @@ function handleAddTask() {
resetTaskForm();
}
-// 樣板選擇由 AddTaskDialog 內部處理
+// 查詢按鈕處理
+const handleSearch = () => {
+ console.log("搜尋條件:", {
+ factory: filterFactory.value,
+ template: filterCategory.value,
+ });
+ // 篩選邏輯已經在 computed filteredData 中自動執行
+};
-
+
diff --git a/src/components/PatrolSetting/TemplateManager.vue b/src/components/PatrolSetting/TemplateManager.vue
index c1e456c..a4a8868 100644
--- a/src/components/PatrolSetting/TemplateManager.vue
+++ b/src/components/PatrolSetting/TemplateManager.vue
@@ -1,19 +1,53 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 查詢
+
+
+
+
+
+
新增樣板
+
@@ -31,16 +65,10 @@
prop="factory"
label="電廠"
width="200"
- :filters="factoryFilters"
- :filter-method="filterFactory"
- filter-placement="bottom-end"
/>
@@ -75,11 +103,16 @@ import {
Edit,
CopyDocument,
View,
+ Search,
} from "@element-plus/icons-vue";
import PaginatedTable from "../Common/PaginatedTable.vue";
import AddTemplateDialog from "./AddTemplateDialog.vue";
import { templateList } from "../../constants/templateList.js";
+// 篩選條件
+const filterFactory = ref("");
+const filterTemplate = ref("");
+
// 對話框顯示
const showDialog = ref(false);
@@ -89,6 +122,7 @@ const addTemplateForm = ref({
template: "",
templateName: "",
isParent: "",
+ remark: "",
});
function resetAddTemplateForm() {
@@ -97,139 +131,61 @@ function resetAddTemplateForm() {
template: "",
templateName: "",
isParent: "",
+ remark: "",
};
showDialog.value = false;
}
-function handleAddTemplate() {
+function handleAddTemplate(templateData) {
// 可依需求推入 tableData 或呼叫 API
+ console.log("新增樣板資料:", templateData);
+ // TODO: 呼叫 API 儲存樣板
resetAddTemplateForm();
}
-// 假資料:巡檢表
-const inspectionTableData = ref([
- {
- index: 1,
- system1: "熱源系統",
- system2: "#2生產井",
- deviceId: "TE_1004",
- item: "#2地熱井溫度",
- unit: "°C",
- },
- {
- index: 2,
- system1: "熱源系統",
- system2: "#2生產井",
- deviceId: "TG_1004",
- item: "#2地熱井溫度表",
- unit: "°C",
- },
- {
- index: 3,
- system1: "熱源系統",
- system2: "#2生產井",
- deviceId: "PT_1004",
- item: "#2地熱井壓力",
- unit: "bar",
- },
- {
- index: 4,
- system1: "熱源系統",
- system2: "#2生產井",
- deviceId: "PG_1004",
- item: "#2地熱井壓力表",
- unit: "kg/cm2",
- },
- {
- index: 5,
- system1: "熱源系統",
- system2: "#2生產井",
- deviceId: "",
- item: "H2S洩漏偵測",
- unit: "ppm",
- },
- {
- index: 6,
- system1: "熱源系統",
- system2: "#3生產井",
- deviceId: "TE_1005",
- item: "#3地熱井溫度",
- unit: "°C",
- },
- {
- index: 7,
- system1: "熱源系統",
- system2: "#3生產井",
- deviceId: "TG_1005",
- item: "#3地熱井溫度表",
- unit: "°C",
- },
- {
- index: 8,
- system1: "熱源系統",
- system2: "#3生產井",
- deviceId: "PT_1005",
- item: "#3地熱井壓力",
- unit: "bar",
- },
- {
- index: 9,
- system1: "熱源系統",
- system2: "#3生產井",
- deviceId: "PG_1005",
- item: "#3地熱井壓力表",
- unit: "kg/cm2",
- },
- {
- index: 10,
- system1: "熱源系統",
- system2: "#3生產井",
- deviceId: "",
- item: "H2S洩漏偵測",
- unit: "ppm",
- },
-]);
-
-// 值班日誌 table 資料
-const dutyLogTableData = ref([
- { index: 1, change: "", continue: "", result: "", remark: "" },
-]);
-
-// 交接事項 table 資料
-const handoverTableData = ref([
- { index: 1, content: "", continue: "", result: "", remark: "" },
-]);
-
-// 查證 table 資料
-const verificationTableData = ref([
- { index: 1, fieldName: "現場", type: "數值輸入" },
- { index: 2, fieldName: "比對結果", type: "單一選擇" },
-]);
-
// 分頁狀態
const currentPage = ref(1);
const pageSize = ref(10);
// 樣板列表資料(共用)
-const tableData = templateList;
+const allTableData = templateList;
-// 篩選選項
-const factoryFilters = computed(() =>
- Array.from(new Set(tableData.map((item) => item.factory))).map((factory) => ({
- text: factory,
- value: factory,
- }))
-);
+// 篩選後的資料
+const tableData = computed(() => {
+ let result = allTableData;
-const templateFilters = computed(() =>
- Array.from(new Set(tableData.map((item) => item.template))).map(
- (template) => ({ text: template, value: template })
- )
-);
+ // 過濾電廠
+ if (filterFactory.value) {
+ result = result.filter((item) => item.factory === filterFactory.value);
+ }
-// 篩選方法
-const filterFactory = (value, row) => row.factory === value;
-const filterTemplate = (value, row) => row.template === value;
+ // 過濾模板
+ if (filterTemplate.value) {
+ result = result.filter((item) => item.template === filterTemplate.value);
+ }
+
+ return result;
+});
+
+// 查詢按鈕處理
+const handleSearch = () => {
+ console.log("搜尋條件:", {
+ factory: filterFactory.value,
+ template: filterTemplate.value,
+ });
+ // 篩選邏輯已經在 computed tableData 中自動執行
+};
-
+
diff --git a/src/components/PlantInfo/OperationFormDialog.vue b/src/components/PlantInfo/OperationFormDialog.vue
new file mode 100644
index 0000000..77bd235
--- /dev/null
+++ b/src/components/PlantInfo/OperationFormDialog.vue
@@ -0,0 +1,172 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/PlantInfo/OperationRecordTable.vue b/src/components/PlantInfo/OperationRecordTable.vue
new file mode 100644
index 0000000..682f69a
--- /dev/null
+++ b/src/components/PlantInfo/OperationRecordTable.vue
@@ -0,0 +1,242 @@
+
+
+
+
+
+
+
+
+
+
+ {{ scope.row.status }}
+
+
+
+
+
+
+ {{
+ scope.row.plan
+ }}
+ {{ scope.row.plan }}
+
+
+
+
+
+ 無照片
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ scope.row.formNo }}
+
+
+
+ 填寫表單
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/Report/ReportFilter.vue b/src/components/Report/ReportFilter.vue
index 7f4796b..cccdd12 100644
--- a/src/components/Report/ReportFilter.vue
+++ b/src/components/Report/ReportFilter.vue
@@ -61,7 +61,7 @@
查詢
- 查詢
+ 匯出
diff --git a/src/constants/templateSchemas.js b/src/constants/templateSchemas.js
new file mode 100644
index 0000000..b920d35
--- /dev/null
+++ b/src/constants/templateSchemas.js
@@ -0,0 +1,620 @@
+/**
+ * 模板配置文件
+ * 定義每個模板類型的欄位結構和表格配置
+ */
+
+export const templateSchemas = {
+ 1: {
+ sections: [
+ {
+ title: "表單內容",
+ showInTemplate: false, // 新增樣板時不顯示
+ showInFill: true, // 填寫任務時顯示
+ fields: [
+ { key: "siteName", label: "案場名稱", span: 24 },
+ { key: "dutyPerson", label: "值班人員", span: 12 },
+ { key: "shift", label: "班別", span: 12 },
+ { key: "weather", label: "天氣", span: 12 },
+ { key: "temperature", label: "環境溫度/濕度", span: 12 },
+ ],
+ },
+ ],
+ tables: [
+ {
+ key: "dutyLog",
+ title: "值班日誌",
+ addButtonText: "新增日誌項目",
+ dialogType: "dutyLog",
+ showInTemplate: false, // 新增樣板時不顯示
+ showInFill: true, // 填寫任務時顯示
+ columns: [
+ { prop: "index", label: "項次", width: "60" },
+ { prop: "change", label: "變更內容" },
+ { prop: "continue", label: "持續" },
+ { prop: "result", label: "結案" },
+ { prop: "remark", label: "備註" },
+ ],
+ },
+ {
+ key: "handover",
+ title: "交接事項",
+ addButtonText: "新增交接事項",
+ dialogType: "handover",
+ showInTemplate: false, // 新增樣板時不顯示
+ showInFill: true, // 填寫任務時顯示
+ columns: [
+ { prop: "index", label: "項次", width: "60" },
+ { prop: "content", label: "工作內容" },
+ { prop: "continue", label: "持續" },
+ { prop: "result", label: "結案" },
+ { prop: "remark", label: "備註" },
+ ],
+ },
+ {
+ key: "inspection",
+ title: "巡檢表",
+ addButtonText: "新增巡檢項目",
+ dialogType: "inspection",
+ usePagination: true,
+ showInTemplate: true, // 新增樣板時顯示
+ showInFill: true, // 填寫任務時顯示
+ columns: [
+ { prop: "index", label: "項次", width: "60" },
+ { prop: "system1", label: "系統1" },
+ { prop: "system2", label: "系統2" },
+ { prop: "deviceId", label: "設備編號" },
+ { prop: "item", label: "項目" },
+ { prop: "unit", label: "單位" },
+ ],
+ defaultData: [
+ {
+ index: 1,
+ system1: "熱源系統",
+ system2: "#2生產井",
+ deviceId: "TE_1004",
+ item: "#2地熱井溫度",
+ unit: "°C",
+ },
+ {
+ index: 2,
+ system1: "熱源系統",
+ system2: "#2生產井",
+ deviceId: "TG_1004",
+ item: "#2地熱井溫度表",
+ unit: "°C",
+ },
+ {
+ index: 3,
+ system1: "熱源系統",
+ system2: "#2生產井",
+ deviceId: "PT_1004",
+ item: "#2地熱井壓力",
+ unit: "bar",
+ },
+ {
+ index: 4,
+ system1: "熱源系統",
+ system2: "#2生產井",
+ deviceId: "PG_1004",
+ item: "#2地熱井壓力表",
+ unit: "kg/cm2",
+ },
+ {
+ index: 5,
+ system1: "熱源系統",
+ system2: "#2生產井",
+ deviceId: "",
+ item: "H2S洩漏偵測",
+ unit: "ppm",
+ },
+ {
+ index: 6,
+ system1: "熱源系統",
+ system2: "#3生產井",
+ deviceId: "TE_1005",
+ item: "#3地熱井溫度",
+ unit: "°C",
+ },
+ {
+ index: 7,
+ system1: "熱源系統",
+ system2: "#3生產井",
+ deviceId: "TG_1005",
+ item: "#3地熱井溫度表",
+ unit: "°C",
+ },
+ {
+ index: 8,
+ system1: "熱源系統",
+ system2: "#3生產井",
+ deviceId: "PT_1005",
+ item: "#3地熱井壓力",
+ unit: "bar",
+ },
+ {
+ index: 9,
+ system1: "熱源系統",
+ system2: "#3生產井",
+ deviceId: "PG_1005",
+ item: "#3地熱井壓力表",
+ unit: "kg/cm2",
+ },
+ {
+ index: 10,
+ system1: "熱源系統",
+ system2: "#3生產井",
+ deviceId: "",
+ item: "H2S洩漏偵測",
+ unit: "ppm",
+ },
+ {
+ index: 11,
+ system1: "熱源系統",
+ system2: "#4生產井",
+ deviceId: "TE_1006",
+ item: "#4地熱井溫度",
+ unit: "°C",
+ },
+ {
+ index: 12,
+ system1: "熱源系統",
+ system2: "#4生產井",
+ deviceId: "TG_1006",
+ item: "#4地熱井溫度表",
+ unit: "°C",
+ },
+ {
+ index: 13,
+ system1: "熱源系統",
+ system2: "#4生產井",
+ deviceId: "PT_1006",
+ item: "#4地熱井壓力",
+ unit: "bar",
+ },
+ {
+ index: 14,
+ system1: "熱源系統",
+ system2: "#4生產井",
+ deviceId: "PG_1006",
+ item: "#4地熱井壓力表",
+ unit: "kg/cm2",
+ },
+ {
+ index: 15,
+ system1: "熱源系統",
+ system2: "#4生產井",
+ deviceId: "",
+ item: "H2S洩漏偵測",
+ unit: "ppm",
+ },
+ ],
+ },
+ ],
+ verification: {
+ enabled: true,
+ showInTemplate: true, // 新增樣板時顯示
+ showInFill: false, // 填寫任務時不顯示
+ title: "查證",
+ addButtonText: "新增查證設定",
+ dialogType: "verification",
+ columns: [
+ { prop: "index", label: "項次", width: "60" },
+ { prop: "fieldName", label: "欄位名稱" },
+ { prop: "type", label: "類型" },
+ ],
+ },
+ },
+ 2: {
+ sections: [
+ {
+ title: "樣板內容",
+ showInTemplate: false, // 新增樣板時不顯示
+ showInFill: true, // 填寫任務時顯示
+ fields: [
+ { key: "siteName", label: "案場名稱", span: 12 },
+ { key: "inspectionDate", label: "點檢日期", span: 12 },
+ ],
+ },
+ ],
+ tables: [
+ {
+ key: "checkItems",
+ title: "點檢項目",
+ addButtonText: "新增點檢項目",
+ dialogType: "checkItems",
+ usePagination: true,
+ showInTemplate: true, // 新增樣板時顯示
+ showInFill: true, // 填寫任務時顯示
+ columns: [
+ { prop: "index", label: "設備"},
+ { prop: "item", label: "項目" },
+ { prop: "content", label: "內容" },
+ { prop: "resultMorning", label: "檢查結果 (早)" },
+ { prop: "resultNoon", label: "檢查結果 (中)" },
+ { prop: "resultAfternoon", label: "檢查結果 (下)" },
+ { prop: "resultEvening", label: "檢查結果 (晚)" },
+ { prop: "remark", label: "備註" },
+ ],
+ },
+ ],
+ verification: {
+ enabled: true,
+ title: "查證",
+ addButtonText: "新增查證設定",
+ dialogType: "verification",
+ columns: [
+ { prop: "index", label: "項次", width: "60" },
+ { prop: "fieldName", label: "欄位名稱" },
+ { prop: "type", label: "類型" },
+ ],
+ },
+ },
+ 3: {
+ sections: [
+ {
+ title: "樣板內容",
+ showInTemplate: false,
+ showInFill: true,
+ fields: [
+ { key: "siteName", label: "案場名稱", span: 24 },
+ { key: "inspector", label: "檢查人員", span: 12 },
+ { key: "checkDate", label: "檢查日期", span: 12 },
+ { key: "weather", label: "天氣狀況", span: 12 },
+ { key: "temperature", label: "環境溫度", span: 12 },
+ ],
+ },
+ ],
+ tables: [
+ {
+ key: "dailyCheck",
+ title: "每日檢查項目",
+ addButtonText: "新增檢查項目",
+ dialogType: "dailyCheck",
+ usePagination: true,
+ showInTemplate: true,
+ showInFill: true,
+ columns: [
+ { prop: "index", label: "項次", width: "60" },
+ { prop: "equipment", label: "設備名稱" },
+ { prop: "checkItem", label: "檢查項目" },
+ { prop: "standard", label: "判定基準" },
+ { prop: "result", label: "檢查結果" },
+ { prop: "remark", label: "備註" },
+ ],
+ },
+ {
+ key: "abnormal",
+ title: "異常記錄",
+ addButtonText: "新增異常記錄",
+ dialogType: "abnormal",
+ showInTemplate: false,
+ showInFill: true,
+ columns: [
+ { prop: "index", label: "項次", width: "60" },
+ { prop: "time", label: "發現時間" },
+ { prop: "equipment", label: "設備名稱" },
+ { prop: "description", label: "異常描述" },
+ { prop: "action", label: "處理措施" },
+ ],
+ },
+ ],
+ verification: {
+ enabled: true,
+ title: "查證",
+ addButtonText: "新增查證設定",
+ dialogType: "verification",
+ columns: [
+ { prop: "index", label: "項次", width: "60" },
+ { prop: "fieldName", label: "欄位名稱" },
+ { prop: "type", label: "類型" },
+ ],
+ },
+ },
+ 4: {
+ sections: [
+ {
+ title: "樣板內容",
+ showInTemplate: false,
+ showInFill: true,
+ fields: [
+ { key: "siteName", label: "案場名稱", span: 24 },
+ { key: "inspector", label: "檢查人員", span: 12 },
+ { key: "checkMonth", label: "檢查月份", span: 12 },
+ { key: "supervisor", label: "督導人員", span: 12 },
+ { key: "approver", label: "核准人員", span: 12 },
+ ],
+ },
+ ],
+ tables: [
+ {
+ key: "monthlyCheck",
+ title: "每月檢查項目",
+ addButtonText: "新增檢查項目",
+ dialogType: "monthlyCheck",
+ usePagination: true,
+ showInTemplate: true,
+ showInFill: true,
+ columns: [
+ { prop: "index", label: "項次", width: "60" },
+ { prop: "category", label: "檢查類別" },
+ { prop: "equipment", label: "設備名稱" },
+ { prop: "checkItem", label: "檢查項目" },
+ { prop: "standard", label: "判定基準" },
+ { prop: "result", label: "檢查結果" },
+ ],
+ },
+ ],
+ verification: {
+ enabled: true,
+ title: "查證",
+ addButtonText: "新增查證設定",
+ dialogType: "verification",
+ columns: [
+ { prop: "index", label: "項次", width: "60" },
+ { prop: "fieldName", label: "欄位名稱" },
+ { prop: "type", label: "類型" },
+ ],
+ },
+ },
+ 5: {
+ sections: [
+ {
+ title: "申請資訊",
+ showInTemplate: false,
+ showInFill: true,
+ fields: [
+ { key: "applicant", label: "申請人", span: 12 },
+ { key: "applyDate", label: "申請日期", span: 12 },
+ { key: "workLocation", label: "作業地點", span: 24 },
+ { key: "workContent", label: "作業內容", span: 24, type: "textarea" },
+ { key: "startTime", label: "開始時間", span: 12 },
+ { key: "endTime", label: "結束時間", span: 12 },
+ ],
+ },
+ ],
+ tables: [
+ {
+ key: "safetyMeasures",
+ title: "安全措施",
+ addButtonText: "新增安全措施",
+ dialogType: "safetyMeasures",
+ showInTemplate: true,
+ showInFill: true,
+ columns: [
+ { prop: "index", label: "項次", width: "60" },
+ { prop: "measure", label: "措施項目" },
+ { prop: "responsible", label: "負責人" },
+ { prop: "checkResult", label: "確認結果" },
+ ],
+ },
+ {
+ key: "personnel",
+ title: "作業人員",
+ addButtonText: "新增人員",
+ dialogType: "personnel",
+ showInTemplate: true,
+ showInFill: true,
+ columns: [
+ { prop: "index", label: "項次", width: "60" },
+ { prop: "name", label: "姓名" },
+ { prop: "role", label: "職務" },
+ { prop: "certNumber", label: "證照編號" },
+ ],
+ },
+ ],
+ verification: {
+ enabled: true,
+ title: "查證",
+ addButtonText: "新增查證設定",
+ dialogType: "verification",
+ columns: [
+ { prop: "index", label: "項次", width: "60" },
+ { prop: "fieldName", label: "欄位名稱" },
+ { prop: "type", label: "類型" },
+ ],
+ },
+ },
+ 6: {
+ sections: [
+ {
+ title: "申請資訊",
+ showInTemplate: false,
+ showInFill: true,
+ fields: [
+ { key: "applicant", label: "申請人", span: 12 },
+ { key: "applyDate", label: "申請日期", span: 12 },
+ { key: "confinedSpace", label: "俺限空間名稱", span: 24 },
+ { key: "workContent", label: "作業內容", span: 24, type: "textarea" },
+ { key: "startTime", label: "開始時間", span: 12 },
+ { key: "endTime", label: "結束時間", span: 12 },
+ ],
+ },
+ {
+ title: "環境檢測",
+ showInTemplate: false,
+ showInFill: true,
+ fields: [
+ { key: "oxygenLevel", label: "氧氣濃度 (%)", span: 12 },
+ { key: "toxicGas", label: "有毒氣體 (ppm)", span: 12 },
+ { key: "combustibleGas", label: "可燃性氣體 (%LEL)", span: 12 },
+ { key: "testTime", label: "檢測時間", span: 12 },
+ ],
+ },
+ ],
+ tables: [
+ {
+ key: "safetyEquipment",
+ title: "安全設備",
+ addButtonText: "新增設備",
+ dialogType: "safetyEquipment",
+ showInTemplate: true,
+ showInFill: true,
+ columns: [
+ { prop: "index", label: "項次", width: "60" },
+ { prop: "equipment", label: "設備名稱" },
+ { prop: "quantity", label: "數量" },
+ { prop: "checkResult", label: "檢查結果" },
+ ],
+ },
+ {
+ key: "personnel",
+ title: "作業人員與監視人",
+ addButtonText: "新增人員",
+ dialogType: "personnel",
+ showInTemplate: true,
+ showInFill: true,
+ columns: [
+ { prop: "index", label: "項次", width: "60" },
+ { prop: "name", label: "姓名" },
+ { prop: "role", label: "角色" },
+ { prop: "training", label: "教育訓練" },
+ ],
+ },
+ ],
+ verification: {
+ enabled: true,
+ title: "查證",
+ addButtonText: "新增查證設定",
+ dialogType: "verification",
+ columns: [
+ { prop: "index", label: "項次", width: "60" },
+ { prop: "fieldName", label: "欄位名稱" },
+ { prop: "type", label: "類型" },
+ ],
+ },
+ },
+ 7: {
+ sections: [
+ {
+ title: "申請資訊",
+ showInTemplate: false,
+ showInFill: true,
+ fields: [
+ { key: "applicant", label: "申請人", span: 12 },
+ { key: "applyDate", label: "申請日期", span: 12 },
+ { key: "fireLocation", label: "動火地點", span: 24 },
+ { key: "fireType", label: "動火類型", span: 12 },
+ { key: "workContent", label: "作業內容", span: 24, type: "textarea" },
+ { key: "startTime", label: "開始時間", span: 12 },
+ { key: "endTime", label: "結束時間", span: 12 },
+ ],
+ },
+ ],
+ tables: [
+ {
+ key: "fireSafety",
+ title: "消防安全措施",
+ addButtonText: "新增措施",
+ dialogType: "fireSafety",
+ showInTemplate: true,
+ showInFill: true,
+ columns: [
+ { prop: "index", label: "項次", width: "60" },
+ { prop: "measure", label: "措施項目" },
+ { prop: "checkPoint", label: "檢查重點" },
+ { prop: "checkResult", label: "確認結果" },
+ ],
+ },
+ {
+ key: "fireEquipment",
+ title: "消防器材",
+ addButtonText: "新增器材",
+ dialogType: "fireEquipment",
+ showInTemplate: true,
+ showInFill: true,
+ columns: [
+ { prop: "index", label: "項次", width: "60" },
+ { prop: "equipment", label: "器材名稱" },
+ { prop: "quantity", label: "數量" },
+ { prop: "location", label: "放置位置" },
+ ],
+ },
+ {
+ key: "firePersonnel",
+ title: "動火作業人員",
+ addButtonText: "新增人員",
+ dialogType: "personnel",
+ showInTemplate: true,
+ showInFill: true,
+ columns: [
+ { prop: "index", label: "項次", width: "60" },
+ { prop: "name", label: "姓名" },
+ { prop: "role", label: "職務" },
+ { prop: "certNumber", label: "證照編號" },
+ ],
+ },
+ ],
+ verification: {
+ enabled: true,
+ title: "查證",
+ addButtonText: "新增查證設定",
+ dialogType: "verification",
+ columns: [
+ { prop: "index", label: "項次", width: "60" },
+ { prop: "fieldName", label: "欄位名稱" },
+ { prop: "type", label: "類型" },
+ ],
+ },
+ },
+};
+
+/**
+ * 根據模板類型獲取對應的 schema
+ * @param {string} templateType - 模板類型
+ * @returns {object|null} 對應的 schema 或 null
+ */
+export function getTemplateSchema(templateType) {
+ const schema = templateSchemas[templateType];
+ if (!schema) return null;
+
+ return schema;
+}
+
+/**
+ * 初始化模板表格資料
+ * @param {object} schema - 模板 schema
+ * @returns {object} 包含所有表格初始資料的物件
+ */
+export function initializeTableData(schema) {
+ if (!schema) return {};
+
+ const tableData = {};
+
+ // 初始化一般表格
+ if (schema.tables) {
+ schema.tables.forEach((table) => {
+ // 如果有預設資料,使用深拷貝避免引用問題
+ tableData[table.key] = table.defaultData
+ ? JSON.parse(JSON.stringify(table.defaultData))
+ : [];
+ });
+ }
+
+ // 初始化驗證表格
+ if (schema.verification?.enabled) {
+ tableData.verification = schema.verification.defaultData
+ ? JSON.parse(JSON.stringify(schema.verification.defaultData))
+ : [];
+ }
+
+ return tableData;
+}
+
+/**
+ * 初始化模板欄位資料
+ * @param {object} schema - 模板 schema
+ * @returns {object} 包含所有欄位初始值的物件
+ */
+export function initializeFieldData(schema) {
+ if (!schema || !schema.sections) return {};
+
+ const fieldData = {};
+
+ schema.sections.forEach((section) => {
+ section.fields.forEach((field) => {
+ fieldData[field.key] = "";
+ });
+ });
+
+ return fieldData;
+}
diff --git a/src/views/PatrolMission.vue b/src/views/PatrolMission.vue
index 016ae7a..97eec51 100644
--- a/src/views/PatrolMission.vue
+++ b/src/views/PatrolMission.vue
@@ -9,28 +9,10 @@
-
-
- 保存PNG
- 保存JPEG
- 清除
- 返回
-
-
+
-
- 已完成任務列表
+
@@ -38,43 +20,11 @@