|
@@ -28,54 +28,159 @@
|
|
|
<div
|
|
|
v-for="(tag, tagIndex) in scope.row.health_status"
|
|
|
:key="tagIndex"
|
|
|
+ >
|
|
|
+ <!-- <el-input
|
|
|
+ v-if="
|
|
|
+ editingCell.row == scope.$index &&
|
|
|
+ editingCell.column == `health_status-${tagIndex}`
|
|
|
+ "
|
|
|
+ v-model="scope.row.health_status[tagIndex]"
|
|
|
+ @blur="() => saveEdit(scope.row, `health_status-${tagIndex}`)"
|
|
|
+ @keyup.enter="
|
|
|
+ () => saveEdit(scope.row, `health_status-${tagIndex}`)
|
|
|
+ "
|
|
|
+ class="custom-time-input"
|
|
|
+ /> -->
|
|
|
+ <div class="tag-col-no-border">
|
|
|
+ {{ tag }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="警告内容" align="center">
|
|
|
+ <template v-slot="scope">
|
|
|
+ <div
|
|
|
+ v-for="(tag, tagIndex) in scope.row.warning_message"
|
|
|
+ :key="tagIndex"
|
|
|
>
|
|
|
<el-input
|
|
|
v-if="
|
|
|
- editingCell.row === scope.$index &&
|
|
|
- editingCell.column === `repairResource-${tagIndex}`
|
|
|
+ editingCell.row == scope.$index &&
|
|
|
+ editingCell.column == `warning_message-${tagIndex}`
|
|
|
"
|
|
|
- v-model="scope.row.repairResource[tagIndex]"
|
|
|
- @blur="() => saveEdit(scope.row, `repairResource-${tagIndex}`)"
|
|
|
+ v-model="scope.row.warning_message[tagIndex]"
|
|
|
+ @blur="() => saveEdit(scope.row, `warning_message-${tagIndex}`)"
|
|
|
@keyup.enter="
|
|
|
- () => saveEdit(scope.row, `repairResource-${tagIndex}`)
|
|
|
+ () => saveEdit(scope.row, `warning_message-${tagIndex}`)
|
|
|
"
|
|
|
- class="tag-col-input"
|
|
|
+ class="custom-time-input"
|
|
|
/>
|
|
|
<div
|
|
|
v-else
|
|
|
class="tag-col"
|
|
|
- @dblclick="editCell(scope.$index, `repairResource-${tagIndex}`)"
|
|
|
+ @dblclick="
|
|
|
+ editCell(scope.$index, `warning_message-${tagIndex}`)
|
|
|
+ "
|
|
|
>
|
|
|
{{ tag }}
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="警告内容" align="center">
|
|
|
- <template v-slot="scope">
|
|
|
- <div>
|
|
|
- <div class="tag-col">{{ scope.row.strategy }}</div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
<el-table-column label="维修时间" align="center">
|
|
|
<template v-slot="scope">
|
|
|
- <div>
|
|
|
- <div class="tag-col">{{ scope.row.strategy }}</div>
|
|
|
+ <div
|
|
|
+ v-for="(tag, tagIndex) in scope.row.suggested_maintenance_time"
|
|
|
+ :key="tagIndex"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-if="
|
|
|
+ editingCell.row == scope.$index &&
|
|
|
+ editingCell.column == `suggested_maintenance_time-${tagIndex}`
|
|
|
+ "
|
|
|
+ v-model="scope.row.suggested_maintenance_time[tagIndex]"
|
|
|
+ @blur="
|
|
|
+ () =>
|
|
|
+ saveEdit(
|
|
|
+ scope.row,
|
|
|
+ `suggested_maintenance_time-${tagIndex}`
|
|
|
+ )
|
|
|
+ "
|
|
|
+ @keyup.enter="
|
|
|
+ () =>
|
|
|
+ saveEdit(
|
|
|
+ scope.row,
|
|
|
+ `suggested_maintenance_time-${tagIndex}`
|
|
|
+ )
|
|
|
+ "
|
|
|
+ class="custom-time-input"
|
|
|
+ />
|
|
|
+ <div
|
|
|
+ v-else
|
|
|
+ class="tag-col"
|
|
|
+ @dblclick="
|
|
|
+ editCell(
|
|
|
+ scope.$index,
|
|
|
+ `suggested_maintenance_time-${tagIndex}`
|
|
|
+ )
|
|
|
+ "
|
|
|
+ >
|
|
|
+ {{ tag }}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="维修方法" align="center">
|
|
|
<template v-slot="scope">
|
|
|
- <div>
|
|
|
- <div class="tag-col">{{ scope.row.strategy }}</div>
|
|
|
+ <div
|
|
|
+ v-for="(tag, tagIndex) in scope.row.maintenance_method"
|
|
|
+ :key="tagIndex"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-if="
|
|
|
+ editingCell.row == scope.$index &&
|
|
|
+ editingCell.column == `maintenance_method-${tagIndex}`
|
|
|
+ "
|
|
|
+ v-model="scope.row.maintenance_method[tagIndex]"
|
|
|
+ @blur="
|
|
|
+ () => saveEdit(scope.row, `maintenance_method-${tagIndex}`)
|
|
|
+ "
|
|
|
+ @keyup.enter="
|
|
|
+ () => saveEdit(scope.row, `maintenance_method-${tagIndex}`)
|
|
|
+ "
|
|
|
+ class="custom-time-input"
|
|
|
+ />
|
|
|
+ <div
|
|
|
+ v-else
|
|
|
+ class="tag-col"
|
|
|
+ @dblclick="
|
|
|
+ editCell(scope.$index, `maintenance_method-${tagIndex}`)
|
|
|
+ "
|
|
|
+ >
|
|
|
+ {{ tag }}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="维修资源" align="center">
|
|
|
<template v-slot="scope">
|
|
|
- <div>
|
|
|
- <div class="tag-col">{{ scope.row.strategy }}</div>
|
|
|
+ <div
|
|
|
+ v-for="(tag, tagIndex) in scope.row.required_resources"
|
|
|
+ :key="tagIndex"
|
|
|
+ >
|
|
|
+ <el-input
|
|
|
+ v-if="
|
|
|
+ editingCell.row == scope.$index &&
|
|
|
+ editingCell.column == `required_resources-${tagIndex}`
|
|
|
+ "
|
|
|
+ v-model="scope.row.required_resources[tagIndex]"
|
|
|
+ @blur="
|
|
|
+ () => saveEdit(scope.row, `required_resources-${tagIndex}`)
|
|
|
+ "
|
|
|
+ @keyup.enter="
|
|
|
+ () => saveEdit(scope.row, `required_resources-${tagIndex}`)
|
|
|
+ "
|
|
|
+ class="custom-time-input"
|
|
|
+ />
|
|
|
+ <div
|
|
|
+ v-else
|
|
|
+ class="tag-col"
|
|
|
+ @dblclick="
|
|
|
+ editCell(scope.$index, `required_resources-${tagIndex}`)
|
|
|
+ "
|
|
|
+ >
|
|
|
+ {{ tag }}
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -125,7 +230,7 @@ import { downloadFile } from "@/utils/utils";
|
|
|
// 基础路由
|
|
|
const router = useRouter();
|
|
|
const route = useRoute(); // 获取当前路由对象
|
|
|
-import { fileList, repairDetailDel } from "@/api/index";
|
|
|
+import { fileList, warnSetUpdate } from "@/api/index";
|
|
|
const { proxy } = getCurrentInstance()!;
|
|
|
// pages
|
|
|
import {
|
|
@@ -150,94 +255,95 @@ const fetchDataFunction = async (
|
|
|
// ...queryParams.value,
|
|
|
});
|
|
|
proxy.$loading.stop();
|
|
|
- let resultData= [
|
|
|
- {
|
|
|
- "name": "右DE",
|
|
|
- "association_ids": "2|3|4",
|
|
|
- "health_status": "轻微异常|故障|严重故障",
|
|
|
- "warning_message": "燃油系统压力低|冷却水温度过高|船舶导航系统故障",
|
|
|
- "suggested_maintenance_time": "每季度|每月|每周",
|
|
|
- "maintenance_method": "更换磨损零件|深度清洁和校准|全面检查",
|
|
|
- "required_resources": "新零件|清洁剂和校准工具|检查工具"
|
|
|
- },
|
|
|
- {
|
|
|
- "name": "右GT燃气轮机",
|
|
|
- "association_ids": "6|7|8",
|
|
|
- "health_status": "轻微异常|故障|严重故障",
|
|
|
- "warning_message": "推进系统异常振动|通信系统失效|舱室水浸传感器报警",
|
|
|
- "suggested_maintenance_time": "每季度|每月|每周",
|
|
|
- "maintenance_method": "更换磨损零件|深度清洁和校准|全面检查",
|
|
|
- "required_resources": "新零件|清洁剂和校准工具|检查工具"
|
|
|
- },
|
|
|
- {
|
|
|
- "name": "右齿轮箱",
|
|
|
- "association_ids": "10|11|12",
|
|
|
- "health_status": "轻微异常|故障|严重故障",
|
|
|
- "warning_message": "液压系统压力异常|自动舵系统失灵|主发动机润滑油压力低",
|
|
|
- "suggested_maintenance_time": "每季度|每月|每周",
|
|
|
- "maintenance_method": "更换磨损零件|深度清洁和校准|全面检查",
|
|
|
- "required_resources": "新零件|清洁剂和校准工具|检查工具"
|
|
|
- },
|
|
|
- {
|
|
|
- "name": "右调距桨",
|
|
|
- "association_ids": "14|15|16",
|
|
|
- "health_status": "轻微异常|故障|严重故障",
|
|
|
- "warning_message": "发电机组冷却水温度高|排气温度过高|火灾报警系统激活",
|
|
|
- "suggested_maintenance_time": "每季度|每月|每周",
|
|
|
- "maintenance_method": "更换磨损零件|深度清洁和校准|全面检查",
|
|
|
- "required_resources": "新零件|清洁剂和校准工具|检查工具"
|
|
|
- },
|
|
|
- {
|
|
|
- "name": "左DE",
|
|
|
- "association_ids": "18|19|20",
|
|
|
- "health_status": "轻微异常|故障|严重故障",
|
|
|
- "warning_message": "燃油系统压力低|冷却水温度过高|船舶导航系统故障",
|
|
|
- "suggested_maintenance_time": "每季度|每月|每周",
|
|
|
- "maintenance_method": "更换磨损零件|深度清洁和校准|全面检查",
|
|
|
- "required_resources": "新零件|清洁剂和校准工具|检查工具"
|
|
|
- },
|
|
|
- {
|
|
|
- "name": "左GT燃气轮机",
|
|
|
- "association_ids": "22|23|24",
|
|
|
- "health_status": "轻微异常|故障|严重故障",
|
|
|
- "warning_message": "推进系统异常振动|通信系统失效|舱室水浸传感器报警",
|
|
|
- "suggested_maintenance_time": "每季度|每月|每周",
|
|
|
- "maintenance_method": "更换磨损零件|深度清洁和校准|全面检查",
|
|
|
- "required_resources": "新零件|清洁剂和校准工具|检查工具"
|
|
|
- },
|
|
|
- {
|
|
|
- "name": "左齿轮箱",
|
|
|
- "association_ids": "26|27|28",
|
|
|
- "health_status": "轻微异常|故障|严重故障",
|
|
|
- "warning_message": "液压系统压力异常|自动舵系统失灵|主发动机润滑油压力低",
|
|
|
- "suggested_maintenance_time": "每季度|每月|每周",
|
|
|
- "maintenance_method": "更换磨损零件|深度清洁和校准|全面检查",
|
|
|
- "required_resources": "新零件|清洁剂和校准工具|检查工具"
|
|
|
- },
|
|
|
- {
|
|
|
- "name": "左调距桨",
|
|
|
- "association_ids": "30|31|32",
|
|
|
- "health_status": "轻微异常|故障|严重故障",
|
|
|
- "warning_message": "发电机组冷却水温度高|排气温度过高|火灾报警系统激活1",
|
|
|
- "suggested_maintenance_time": "每季度|每月|每周",
|
|
|
- "maintenance_method": "更换磨损零件|深度清洁和校准|全面检查",
|
|
|
- "required_resources": "新零件|清洁剂和校准工具|检查工具"
|
|
|
- }
|
|
|
- ]
|
|
|
- let resultSend=resultData.map(item=>{
|
|
|
- return {
|
|
|
- "name": item.name,
|
|
|
- "association_ids": item.association_ids.split('|'),
|
|
|
- "health_status":item.health_status.split('|'),
|
|
|
- "warning_message": item.warning_message.split('|'),
|
|
|
- "suggested_maintenance_time":item.suggested_maintenance_time.split('|'),
|
|
|
- "maintenance_method": item.maintenance_method.split('|'),
|
|
|
- "required_resources": item.required_resources.split('|')
|
|
|
- }
|
|
|
- })
|
|
|
+ let resultData=response.data
|
|
|
+// let resultData = [
|
|
|
+// {
|
|
|
+// name: "右DE",
|
|
|
+// association_ids: "2|3|4",
|
|
|
+// health_status: "轻微异常|故障|严重故障",
|
|
|
+// warning_message: "燃油系统压力低|冷却水温度过高|船舶导航系统故障",
|
|
|
+// suggested_maintenance_time: "每季度|每月|每周",
|
|
|
+// maintenance_method: "更换磨损零件|深度清洁和校准|全面检查",
|
|
|
+// required_resources: "新零件|清洁剂和校准工具|检查工具",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// name: "右GT燃气轮机",
|
|
|
+// association_ids: "6|7|8",
|
|
|
+// health_status: "轻微异常|故障|严重故障",
|
|
|
+// warning_message: "推进系统异常振动|通信系统失效|舱室水浸传感器报警",
|
|
|
+// suggested_maintenance_time: "每季度|每月|每周",
|
|
|
+// maintenance_method: "更换磨损零件|深度清洁和校准|全面检查",
|
|
|
+// required_resources: "新零件|清洁剂和校准工具|检查工具",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// name: "右齿轮箱",
|
|
|
+// association_ids: "10|11|12",
|
|
|
+// health_status: "轻微异常|故障|严重故障",
|
|
|
+// warning_message: "液压系统压力异常|自动舵系统失灵|主发动机润滑油压力低",
|
|
|
+// suggested_maintenance_time: "每季度|每月|每周",
|
|
|
+// maintenance_method: "更换磨损零件|深度清洁和校准|全面检查",
|
|
|
+// required_resources: "新零件|清洁剂和校准工具|检查工具",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// name: "右调距桨",
|
|
|
+// association_ids: "14|15|16",
|
|
|
+// health_status: "轻微异常|故障|严重故障",
|
|
|
+// warning_message: "发电机组冷却水温度高|排气温度过高|火灾报警系统激活",
|
|
|
+// suggested_maintenance_time: "每季度|每月|每周",
|
|
|
+// maintenance_method: "更换磨损零件|深度清洁和校准|全面检查",
|
|
|
+// required_resources: "新零件|清洁剂和校准工具|检查工具",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// name: "左DE",
|
|
|
+// association_ids: "18|19|20",
|
|
|
+// health_status: "轻微异常|故障|严重故障",
|
|
|
+// warning_message: "燃油系统压力低|冷却水温度过高|船舶导航系统故障",
|
|
|
+// suggested_maintenance_time: "每季度|每月|每周",
|
|
|
+// maintenance_method: "更换磨损零件|深度清洁和校准|全面检查",
|
|
|
+// required_resources: "新零件|清洁剂和校准工具|检查工具",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// name: "左GT燃气轮机",
|
|
|
+// association_ids: "22|23|24",
|
|
|
+// health_status: "轻微异常|故障|严重故障",
|
|
|
+// warning_message: "推进系统异常振动|通信系统失效|舱室水浸传感器报警",
|
|
|
+// suggested_maintenance_time: "每季度|每月|每周",
|
|
|
+// maintenance_method: "更换磨损零件|深度清洁和校准|全面检查",
|
|
|
+// required_resources: "新零件|清洁剂和校准工具|检查工具",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// name: "左齿轮箱",
|
|
|
+// association_ids: "26|27|28",
|
|
|
+// health_status: "轻微异常|故障|严重故障",
|
|
|
+// warning_message: "液压系统压力异常|自动舵系统失灵|主发动机润滑油压力低",
|
|
|
+// suggested_maintenance_time: "每季度|每月|每周",
|
|
|
+// maintenance_method: "更换磨损零件|深度清洁和校准|全面检查",
|
|
|
+// required_resources: "新零件|清洁剂和校准工具|检查工具",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// name: "左调距桨",
|
|
|
+// association_ids: "30|31|32",
|
|
|
+// health_status: "轻微异常|故障|严重故障",
|
|
|
+// warning_message: "发电机组冷却水温度高|排气温度过高|火灾报警系统激活1",
|
|
|
+// suggested_maintenance_time: "每季度|每月|每周",
|
|
|
+// maintenance_method: "更换磨损零件|深度清洁和校准|全面检查",
|
|
|
+// required_resources: "新零件|清洁剂和校准工具|检查工具",
|
|
|
+// },
|
|
|
+// ];
|
|
|
+ let resultSend = resultData.map((item) => {
|
|
|
+ return {
|
|
|
+ name: item.name,
|
|
|
+ association_ids: item.association_ids.split("|"),
|
|
|
+ health_status: item.health_status.split("|"),
|
|
|
+ warning_message: item.warning_message.split("|"),
|
|
|
+ suggested_maintenance_time: item.suggested_maintenance_time.split("|"),
|
|
|
+ maintenance_method: item.maintenance_method.split("|"),
|
|
|
+ required_resources: item.required_resources.split("|"),
|
|
|
+ };
|
|
|
+ });
|
|
|
return {
|
|
|
// data: response.data.records,
|
|
|
- data:resultSend,
|
|
|
+ data: resultSend,
|
|
|
total: response.data.total,
|
|
|
};
|
|
|
};
|
|
@@ -252,13 +358,20 @@ const editingCell = ref({ row: null, column: null });
|
|
|
|
|
|
const editCell = (rowIndex: number, column: string) => {
|
|
|
editingCell.value = { row: rowIndex, column: column };
|
|
|
- debugger
|
|
|
};
|
|
|
|
|
|
const saveEdit = (row, column) => {
|
|
|
console.log("Saving data:", row, column);
|
|
|
// 在这里处理保存逻辑,例如发送请求到服务器
|
|
|
editingCell.value = { row: null, column: null };
|
|
|
+ const name = column.split("-")[0];
|
|
|
+ const index = column.split("-")[1];
|
|
|
+ warnSetUpdate({
|
|
|
+ [name]: row[name][index],
|
|
|
+ association_id: row.association_ids[index],
|
|
|
+ }).then((its) => {
|
|
|
+ ElMessage.success("操作成功!");
|
|
|
+ });
|
|
|
};
|
|
|
</script>
|
|
|
|
|
@@ -277,6 +390,16 @@ const saveEdit = (row, column) => {
|
|
|
justify-content: center;
|
|
|
text-align: center;
|
|
|
}
|
|
|
+.tag-col-no-border {
|
|
|
+ height: 30px;
|
|
|
+ padding: 10px;
|
|
|
+ margin: 10px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ cursor: pointer;
|
|
|
+ justify-content: center;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
.maintenance-strategy-assistance {
|
|
|
color: #fff;
|
|
|
}
|