|
|
@@ -128,7 +128,7 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="打卡结果" align="center" prop="checkResult" width="100">
|
|
|
<template #default="scope">
|
|
|
- <el-tag v-if="scope.row.checkResult" :type="getResultTag(scope.row.checkResult)">{{ scope.row.checkResult }}</el-tag>
|
|
|
+ <el-tag v-if="scope.row.checkResult" :type="getResultTag(scope.row.checkResult)">{{ getResultLabel(scope.row.checkResult) }}</el-tag>
|
|
|
<span v-else>-</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -347,7 +347,7 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="打卡结果" align="center" width="100">
|
|
|
<template #default="scope">
|
|
|
- <el-tag v-if="scope.row.checkResult" :type="getResultTag(scope.row.checkResult)">{{ scope.row.checkResult }}</el-tag>
|
|
|
+ <el-tag v-if="scope.row.checkResult" :type="getResultTag(scope.row.checkResult)">{{ getResultLabel(scope.row.checkResult) }}</el-tag>
|
|
|
<span v-else>-</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -385,7 +385,7 @@
|
|
|
<el-tag :type="getStatusTag(detailForm.recordStatus)">{{ detailForm.recordStatus }}</el-tag>
|
|
|
</el-descriptions-item>
|
|
|
<el-descriptions-item label="打卡结果">
|
|
|
- <el-tag v-if="detailForm.checkResult" :type="getResultTag(detailForm.checkResult)">{{ detailForm.checkResult }}</el-tag>
|
|
|
+ <el-tag v-if="detailForm.checkResult" :type="getResultTag(detailForm.checkResult)">{{ getResultLabel(detailForm.checkResult) }}</el-tag>
|
|
|
<span v-else>-</span>
|
|
|
</el-descriptions-item>
|
|
|
<el-descriptions-item label="打卡地点">{{ detailForm.checkInLocation }}</el-descriptions-item>
|
|
|
@@ -407,7 +407,7 @@
|
|
|
<el-table-column label="巡检内容" prop="itemContent" />
|
|
|
<el-table-column label="巡检结果" prop="checkResult" width="100">
|
|
|
<template #default="scope">
|
|
|
- <el-tag v-if="scope.row.checkResult" :type="getResultTag(scope.row.checkResult)" size="small">{{ scope.row.checkResult }}</el-tag>
|
|
|
+ <el-tag v-if="scope.row.checkResult" :type="getResultTag(scope.row.checkResult)" size="small">{{ getResultLabel(scope.row.checkResult) }}</el-tag>
|
|
|
<span v-else>-</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
@@ -1030,11 +1030,27 @@ const getStatusTag = (s: string): 'primary' | 'success' | 'warning' | 'info' | '
|
|
|
const getResultTag = (r: string): 'primary' | 'success' | 'warning' | 'info' | 'danger' => {
|
|
|
const map: Record<string, 'primary' | 'success' | 'warning' | 'info' | 'danger'> = {
|
|
|
正常: 'success',
|
|
|
- 异常: 'danger'
|
|
|
+ 异常: 'danger',
|
|
|
+ '0': 'success', // 0=正常
|
|
|
+ '1': 'danger' // 1=异常
|
|
|
};
|
|
|
return (map[r] || 'info') as any;
|
|
|
};
|
|
|
|
|
|
+/**
|
|
|
+ * 巡检结果码 → 中文标签
|
|
|
+ * - 后端存储:0=正常 / 1=异常(也兼容直接存"正常"/"异常"的老数据)
|
|
|
+ */
|
|
|
+const getResultLabel = (r: string): string => {
|
|
|
+ const map: Record<string, string> = {
|
|
|
+ '0': '正常',
|
|
|
+ '1': '异常',
|
|
|
+ 正常: '正常',
|
|
|
+ 异常: '异常'
|
|
|
+ };
|
|
|
+ return map[r] || r || '-';
|
|
|
+};
|
|
|
+
|
|
|
onMounted(async () => {
|
|
|
await loadAll();
|
|
|
await loadDeptChainUsers();
|