diff --git a/src/components.d.ts b/src/components.d.ts
index 62bf65d..2b768aa 100644
--- a/src/components.d.ts
+++ b/src/components.d.ts
@@ -26,7 +26,6 @@ declare module 'vue' {
ElDropdown: typeof import('element-plus/es')['ElDropdown']
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
- ElEmpty: typeof import('element-plus/es')['ElEmpty']
ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElHeader: typeof import('element-plus/es')['ElHeader']
diff --git a/src/components/PatrolMission/FillTaskDialog.vue b/src/components/PatrolMission/FillTaskDialog.vue
index c49bdf5..75ce093 100644
--- a/src/components/PatrolMission/FillTaskDialog.vue
+++ b/src/components/PatrolMission/FillTaskDialog.vue
@@ -56,8 +56,9 @@
{{ table.title }}
{{ table.title }}
+
+
-
-
- {{ scope.row[column.prop] }}
+ {{ scope.row[column.prop] }}
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ option }}
+
+
+
+
+
+
+
-
-
-
- 樣板查證
-
- {{ activeSchema.verification.title }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -248,7 +252,6 @@ const activeSchema = computed(() => {
...schema,
sections: schema.sections?.filter(s => s.showInFill !== false) || [],
tables: schema.tables?.filter(t => t.showInFill !== false) || [],
- verification: schema.verification, // 查證始終顯示
};
});
@@ -257,6 +260,14 @@ const dialogTitle = computed(() => {
return props.taskData?.taskName || "填寫任務";
});
+// 查證欄位配置 (從樣板的 verification 表格資料中獲取)
+const verificationFields = computed(() => {
+ if (!props.taskData || !props.taskData.tables || !props.taskData.tables.verification) {
+ return [];
+ }
+ return props.taskData.tables.verification || [];
+});
+
// 判斷是否為可輸入的數值欄位 (非系統、設備、項目、單位欄位)
const isValueColumn = (prop) => {
const infoColumns = ['index', 'system1', 'system2', 'deviceId', 'item', 'unit'];
@@ -282,10 +293,17 @@ watch(
// 如果任務已有填寫資料,載入已填寫的資料
if (newTaskData.fillData) {
Object.assign(dynamicFields, newTaskData.fillData.fields || {});
- Object.assign(dynamicTableData, newTaskData.fillData.tables || initializeTableData(schema));
+ Object.assign(dynamicTableData, newTaskData.fillData.tables || {});
} else {
- // 否則初始化空白表格
- Object.assign(dynamicTableData, initializeTableData(schema));
+ // 從樣板配置中載入巡檢表和其他表格資料
+ // 優先使用 taskData.tables (從 API 返回的樣板配置)
+ if (newTaskData.tables) {
+ // 直接使用從後端獲取的表格資料
+ Object.assign(dynamicTableData, JSON.parse(JSON.stringify(newTaskData.tables)));
+ } else {
+ // 如果沒有則使用 schema 的預設資料 (通常不會執行到這裡)
+ Object.assign(dynamicTableData, initializeTableData(schema));
+ }
}
},
{ immediate: true }
diff --git a/src/components/PatrolMission/PendingTasks.vue b/src/components/PatrolMission/PendingTasks.vue
index 526db47..7cbdb53 100644
--- a/src/components/PatrolMission/PendingTasks.vue
+++ b/src/components/PatrolMission/PendingTasks.vue
@@ -128,7 +128,7 @@ const pageSize = ref(10);
// 篩選條件
const filterFactory = ref("");
const filterCategory = ref("");
-// table 資料
+// table 資料 (模擬從 API 獲取的完整樣板配置)
const allTableData = ref([
{
index: 1,
@@ -137,6 +137,43 @@ const allTableData = ref([
templateType: "1", // 對應 templateSchemas 的 key
taskName: "四磺子坪1.2MW地熱能ORC發電機",
dispatchDate: "2025-11-01",
+ // 從後端 API 返回的樣板配置
+ tables: {
+ inspection: [
+ {
+ index: 1,
+ system1: "熱源系統",
+ system2: "#2生產井",
+ deviceId: "TE_1004",
+ item: "#2地熱井溫度",
+ unit: "°C",
+ lowerLimit: 80,
+ upperLimit: 120,
+ dcsValue: 100,
+ },
+ {
+ index: 2,
+ system1: "熱源系統",
+ system2: "#2生產井",
+ deviceId: "TG_1004",
+ item: "#2地熱井溫度表",
+ unit: "°C",
+ lowerLimit: 80,
+ upperLimit: 120,
+ dcsValue: 98,
+ },
+ // 更多巡檢項目...
+ ],
+ verification: [
+ { index: 1, fieldName: "現場", type: "數值輸入" },
+ {
+ index: 2,
+ fieldName: "比對結果",
+ type: "單一選擇",
+ options: ["符合", "不符合"],
+ },
+ ],
+ },
},
{
index: 2,
@@ -145,6 +182,30 @@ const allTableData = ref([
templateType: "1",
taskName: "四磺子坪1.2MW先導地熱能ORC發電機",
dispatchDate: "2025-11-01",
+ tables: {
+ inspection: [
+ {
+ index: 1,
+ system1: "熱源系統",
+ system2: "#3生產井",
+ deviceId: "TE_1005",
+ item: "#3地熱井溫度",
+ unit: "°C",
+ lowerLimit: 80,
+ upperLimit: 120,
+ dcsValue: 98,
+ },
+ ],
+ verification: [
+ { index: 1, fieldName: "現場", type: "數值輸入" },
+ {
+ index: 2,
+ fieldName: "比對結果",
+ type: "單一選擇",
+ options: ["符合", "不符合"],
+ },
+ ],
+ },
},
{
index: 3,
@@ -153,6 +214,11 @@ const allTableData = ref([
templateType: "2",
taskName: "廠房01維修工程",
dispatchDate: "2025-11-02",
+ tables: {
+ checkItems: [
+ // 點檢項目...
+ ],
+ },
},
]);
@@ -188,6 +254,8 @@ const currentTask = ref(null);
// 打開填寫對話框
const handleFillTask = (task) => {
+ console.log("task", task);
+
currentTask.value = task;
fillDialogVisible.value = true;
};
diff --git a/src/components/PatrolSetting/AddTemplateDialog.vue b/src/components/PatrolSetting/AddTemplateDialog.vue
index 279c5da..c7fa0ea 100644
--- a/src/components/PatrolSetting/AddTemplateDialog.vue
+++ b/src/components/PatrolSetting/AddTemplateDialog.vue
@@ -47,14 +47,6 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
@@ -191,49 +182,6 @@
-
-
-
- 樣板查證
-
- {{ activeSchema.verification.title }}
-
- {{ activeSchema.verification.addButtonText }}
-
-
-
-
-
-
-
- 修改
-
- 刪除
-
-
-
-
-
@@ -270,9 +218,8 @@ const activeSchema = computed(() => {
// 過濾只顯示於樣板的內容
return {
...schema,
- sections: schema.sections?.filter(s => s.showInTemplate !== false) || [],
- tables: schema.tables?.filter(t => t.showInTemplate !== false) || [],
- verification: schema.verification, // 查證始終顯示
+ sections: schema.sections?.filter((s) => s.showInTemplate !== false) || [],
+ tables: schema.tables?.filter((t) => t.showInTemplate !== false) || [],
};
});
diff --git a/src/components/PatrolSetting/TemplateManager.vue b/src/components/PatrolSetting/TemplateManager.vue
index a4a8868..d7a0cb8 100644
--- a/src/components/PatrolSetting/TemplateManager.vue
+++ b/src/components/PatrolSetting/TemplateManager.vue
@@ -122,7 +122,6 @@ const addTemplateForm = ref({
template: "",
templateName: "",
isParent: "",
- remark: "",
});
function resetAddTemplateForm() {
@@ -131,7 +130,6 @@ function resetAddTemplateForm() {
template: "",
templateName: "",
isParent: "",
- remark: "",
};
showDialog.value = false;
}
diff --git a/src/components/PatrolSetting/VerificationOptionDialog.vue b/src/components/PatrolSetting/VerificationOptionDialog.vue
new file mode 100644
index 0000000..878860a
--- /dev/null
+++ b/src/components/PatrolSetting/VerificationOptionDialog.vue
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+ 取消
+ 確定
+
+
+
+
+
+
+
diff --git a/src/components/PatrolSetting/VerificationSettingDialog.vue b/src/components/PatrolSetting/VerificationSettingDialog.vue
index 672eaee..08cc987 100644
--- a/src/components/PatrolSetting/VerificationSettingDialog.vue
+++ b/src/components/PatrolSetting/VerificationSettingDialog.vue
@@ -2,12 +2,12 @@
-
+
@@ -16,29 +16,153 @@
+
+
+
+
+ 選項設定
+ 單一選擇
+
+ 新增選項
+
+
+
+
+
+
+
+
+ 修改
+
+
+ 刪除
+
+
+
+
+
取消
加入
+
+
+
+
-
+
+
diff --git a/src/constants/templateSchemas.js b/src/constants/templateSchemas.js
index b920d35..35172bf 100644
--- a/src/constants/templateSchemas.js
+++ b/src/constants/templateSchemas.js
@@ -16,6 +16,7 @@ export const templateSchemas = {
{ key: "shift", label: "班別", span: 12 },
{ key: "weather", label: "天氣", span: 12 },
{ key: "temperature", label: "環境溫度/濕度", span: 12 },
+ { key: "remark", label: "備註", type: "textarea", span: 24 },
],
},
],
@@ -58,6 +59,9 @@ export const templateSchemas = {
usePagination: true,
showInTemplate: true, // 新增樣板時顯示
showInFill: true, // 填寫任務時顯示
+ allowAdd: false, // 填寫時不顯示新增按鈕
+ allowEdit: false, // 填寫時不顯示編輯按鈕
+ useVerification: true, // 使用查證欄位
columns: [
{ prop: "index", label: "項次", width: "60" },
{ prop: "system1", label: "系統1" },
@@ -65,6 +69,9 @@ export const templateSchemas = {
{ prop: "deviceId", label: "設備編號" },
{ prop: "item", label: "項目" },
{ prop: "unit", label: "單位" },
+ { prop: "lowerLimit", label: "下限" },
+ { prop: "upperLimit", label: "上限" },
+ { prop: "dcsValue", label: "DCS" },
],
defaultData: [
{
@@ -189,20 +196,33 @@ export const templateSchemas = {
},
],
},
+ {
+ key: "verification",
+ title: "查證",
+ addButtonText: "新增查證項目",
+ dialogType: "verification",
+ usePagination: true,
+ showInTemplate: true, // 新增樣板時顯示
+ showInFill: false, // 填寫任務時顯示
+ columns: [
+ { prop: "index", label: "項次", width: "60" },
+ { prop: "fieldName", label: "欄位名稱" },
+ { prop: "type", label: "類型" },
+ ],
+ defaultData: [
+ {
+ index: 1,
+ fieldName: "現場",
+ label: "數值輸入",
+ },
+ {
+ index: 2,
+ fieldName: "比對結果",
+ label: "單一選擇",
+ },
+ ],
+ },
],
- 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: [
@@ -226,7 +246,7 @@ export const templateSchemas = {
showInTemplate: true, // 新增樣板時顯示
showInFill: true, // 填寫任務時顯示
columns: [
- { prop: "index", label: "設備"},
+ { prop: "index", label: "設備" },
{ prop: "item", label: "項目" },
{ prop: "content", label: "內容" },
{ prop: "resultMorning", label: "檢查結果 (早)" },
@@ -237,17 +257,6 @@ export const templateSchemas = {
],
},
],
- verification: {
- enabled: true,
- title: "查證",
- addButtonText: "新增查證設定",
- dialogType: "verification",
- columns: [
- { prop: "index", label: "項次", width: "60" },
- { prop: "fieldName", label: "欄位名稱" },
- { prop: "type", label: "類型" },
- ],
- },
},
3: {
sections: [
@@ -298,17 +307,6 @@ export const templateSchemas = {
],
},
],
- verification: {
- enabled: true,
- title: "查證",
- addButtonText: "新增查證設定",
- dialogType: "verification",
- columns: [
- { prop: "index", label: "項次", width: "60" },
- { prop: "fieldName", label: "欄位名稱" },
- { prop: "type", label: "類型" },
- ],
- },
},
4: {
sections: [
@@ -344,17 +342,6 @@ export const templateSchemas = {
],
},
],
- verification: {
- enabled: true,
- title: "查證",
- addButtonText: "新增查證設定",
- dialogType: "verification",
- columns: [
- { prop: "index", label: "項次", width: "60" },
- { prop: "fieldName", label: "欄位名稱" },
- { prop: "type", label: "類型" },
- ],
- },
},
5: {
sections: [
@@ -402,17 +389,6 @@ export const templateSchemas = {
],
},
],
- verification: {
- enabled: true,
- title: "查證",
- addButtonText: "新增查證設定",
- dialogType: "verification",
- columns: [
- { prop: "index", label: "項次", width: "60" },
- { prop: "fieldName", label: "欄位名稱" },
- { prop: "type", label: "類型" },
- ],
- },
},
6: {
sections: [
@@ -471,17 +447,6 @@ export const templateSchemas = {
],
},
],
- verification: {
- enabled: true,
- title: "查證",
- addButtonText: "新增查證設定",
- dialogType: "verification",
- columns: [
- { prop: "index", label: "項次", width: "60" },
- { prop: "fieldName", label: "欄位名稱" },
- { prop: "type", label: "類型" },
- ],
- },
},
7: {
sections: [
@@ -544,17 +509,6 @@ export const templateSchemas = {
],
},
],
- verification: {
- enabled: true,
- title: "查證",
- addButtonText: "新增查證設定",
- dialogType: "verification",
- columns: [
- { prop: "index", label: "項次", width: "60" },
- { prop: "fieldName", label: "欄位名稱" },
- { prop: "type", label: "類型" },
- ],
- },
},
};
@@ -590,13 +544,6 @@ export function initializeTableData(schema) {
});
}
- // 初始化驗證表格
- if (schema.verification?.enabled) {
- tableData.verification = schema.verification.defaultData
- ? JSON.parse(JSON.stringify(schema.verification.defaultData))
- : [];
- }
-
return tableData;
}