|
@@ -0,0 +1,400 @@
|
|
|
|
+<template>
|
|
|
|
+ <div class="maintenance-strategy-assistance">
|
|
|
|
+ <div class="header">
|
|
|
|
+ <div class="title customTitle">
|
|
|
|
+ <s-title titleText="警告信息与维修建议设置"></s-title>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <div class="records">
|
|
|
|
+ <el-table
|
|
|
|
+ :data="tableData"
|
|
|
|
+ style="width: 100%"
|
|
|
|
+ align="center"
|
|
|
|
+ class="custom-table"
|
|
|
|
+ >
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="name"
|
|
|
|
+ label="设备名称"
|
|
|
|
+ align="center"
|
|
|
|
+ ></el-table-column>
|
|
|
|
+ <el-table-column
|
|
|
|
+ prop="name"
|
|
|
|
+ label="健康程度"
|
|
|
|
+ width="260"
|
|
|
|
+ align="center"
|
|
|
|
+ >
|
|
|
|
+ <template v-slot="scope">
|
|
|
|
+ <div
|
|
|
|
+ v-for="(tag, tagIndex) in scope.row.health_status"
|
|
|
|
+ :key="tagIndex"
|
|
|
|
+ >
|
|
|
|
+ <el-input
|
|
|
|
+ v-if="
|
|
|
|
+ editingCell.row === scope.$index &&
|
|
|
|
+ editingCell.column === `repairResource-${tagIndex}`
|
|
|
|
+ "
|
|
|
|
+ v-model="scope.row.repairResource[tagIndex]"
|
|
|
|
+ @blur="() => saveEdit(scope.row, `repairResource-${tagIndex}`)"
|
|
|
|
+ @keyup.enter="
|
|
|
|
+ () => saveEdit(scope.row, `repairResource-${tagIndex}`)
|
|
|
|
+ "
|
|
|
|
+ class="tag-col-input"
|
|
|
|
+ />
|
|
|
|
+ <div
|
|
|
|
+ v-else
|
|
|
|
+ class="tag-col"
|
|
|
|
+ @dblclick="editCell(scope.$index, `repairResource-${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>
|
|
|
|
+ </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>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="pagination custom-page">
|
|
|
|
+ <el-pagination
|
|
|
|
+ background
|
|
|
|
+ layout="prev, pager, next"
|
|
|
|
+ :total="totalItems"
|
|
|
|
+ :page-size="recordsPerPage"
|
|
|
|
+ v-model:current-page="currentPage"
|
|
|
|
+ ></el-pagination>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ <!-- 删除 -->
|
|
|
|
+ <ModalComponent
|
|
|
|
+ v-model:visible="delVisible"
|
|
|
|
+ customClass="custom-modal"
|
|
|
|
+ width="730px"
|
|
|
|
+ title="维修策略删除警告"
|
|
|
|
+ >
|
|
|
|
+ <!-- 模态框内容插槽 -->
|
|
|
|
+ <div class="custom-box custom-time-input">
|
|
|
|
+ <div class="confirmText">确认删除该数据吗?</div>
|
|
|
|
+ <div class="footer">
|
|
|
|
+ <div class="btnFooter cancel" @click="delVisible = false">取消</div>
|
|
|
|
+ <div class="btnFooter btnFooter-big" @click="deleteRecord(form)">
|
|
|
|
+ 确认
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ </ModalComponent>
|
|
|
|
+</template>
|
|
|
|
+
|
|
|
|
+<script lang="ts" setup>
|
|
|
|
+import { ref, computed, getCurrentInstance, onMounted } from "vue";
|
|
|
|
+import { ElMessage } from "element-plus";
|
|
|
|
+import sTitle from "@/components/StructTitle/index.vue";
|
|
|
|
+import { Filter } from "@element-plus/icons-vue";
|
|
|
|
+import { Search } from "@element-plus/icons-vue";
|
|
|
|
+import { useRoute, useRouter } from "vue-router";
|
|
|
|
+import ModalComponent from "@/components/ModalComponent/index.vue";
|
|
|
|
+import { downloadDeviceRepair } from "@/api/index";
|
|
|
|
+import { downloadFile } from "@/utils/utils";
|
|
|
|
+
|
|
|
|
+// 基础路由
|
|
|
|
+const router = useRouter();
|
|
|
|
+const route = useRoute(); // 获取当前路由对象
|
|
|
|
+import { fileList, repairDetailDel } from "@/api/index";
|
|
|
|
+const { proxy } = getCurrentInstance()!;
|
|
|
|
+// pages
|
|
|
|
+import {
|
|
|
|
+ useServerPagination,
|
|
|
|
+ PaginationResponse,
|
|
|
|
+} from "@/utils/useServerPagination";
|
|
|
|
+// table逻辑
|
|
|
|
+interface DataItem {
|
|
|
|
+ id: number;
|
|
|
|
+ name: string;
|
|
|
|
+ remark: string;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const fetchDataFunction = async (
|
|
|
|
+ page: number,
|
|
|
|
+ pageSize: number
|
|
|
|
+): Promise<PaginationResponse<DataItem>> => {
|
|
|
|
+ proxy.$loading.start();
|
|
|
|
+ const response = await fileList({
|
|
|
|
+ current: page,
|
|
|
|
+ size: 9,
|
|
|
|
+ // ...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('|')
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ return {
|
|
|
|
+ // data: response.data.records,
|
|
|
|
+ data:resultSend,
|
|
|
|
+ total: response.data.total,
|
|
|
|
+ };
|
|
|
|
+};
|
|
|
|
+const pagination = useServerPagination<DataItem>(fetchDataFunction);
|
|
|
|
+let { tableData, currentPage, pageSize, totalItems, loading, fetchData } =
|
|
|
|
+ pagination;
|
|
|
|
+const searchClick = fetchData();
|
|
|
|
+const queryParams = ref({
|
|
|
|
+ name: "",
|
|
|
|
+});
|
|
|
|
+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 };
|
|
|
|
+};
|
|
|
|
+</script>
|
|
|
|
+
|
|
|
|
+<style scoped>
|
|
|
|
+.tag-col {
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
+ border: 1px solid rgba(131, 187, 255, 0.4);
|
|
|
|
+ background: rgba(0, 122, 255, 0.1);
|
|
|
|
+ /* line-height: 30px; */
|
|
|
|
+ height: 30px;
|
|
|
|
+ padding: 10px;
|
|
|
|
+ margin: 10px;
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ cursor: pointer;
|
|
|
|
+ justify-content: center;
|
|
|
|
+ text-align: center;
|
|
|
|
+}
|
|
|
|
+.maintenance-strategy-assistance {
|
|
|
|
+ color: #fff;
|
|
|
|
+}
|
|
|
|
+::v-deep .customTitle .right-line {
|
|
|
|
+ width: 586px;
|
|
|
|
+}
|
|
|
|
+.header {
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: space-between;
|
|
|
|
+ align-items: center;
|
|
|
|
+ margin-bottom: 20px;
|
|
|
|
+}
|
|
|
|
+.records {
|
|
|
|
+ margin-top: 20px;
|
|
|
|
+}
|
|
|
|
+.title {
|
|
|
|
+ font-size: 24px;
|
|
|
|
+ color: #fff;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.ace-sear {
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: space-between;
|
|
|
|
+ align-items: center;
|
|
|
|
+}
|
|
|
|
+.back {
|
|
|
|
+ padding-left: 20px;
|
|
|
|
+ width: 60px;
|
|
|
|
+ height: 40px;
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: space-between;
|
|
|
|
+ align-items: center;
|
|
|
|
+ color: rgb(0, 139, 250);
|
|
|
|
+ cursor: pointer;
|
|
|
|
+}
|
|
|
|
+.back:hover {
|
|
|
|
+ text-decoration-line: underline;
|
|
|
|
+}
|
|
|
|
+.search {
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: flex-end;
|
|
|
|
+ align-items: center;
|
|
|
|
+}
|
|
|
|
+.search-input {
|
|
|
|
+ width: 300px;
|
|
|
|
+}
|
|
|
|
+.ace-sel {
|
|
|
|
+ width: 160px;
|
|
|
|
+ margin-right: 20px;
|
|
|
|
+}
|
|
|
|
+.line-select {
|
|
|
|
+ margin: 0 10px;
|
|
|
|
+ width: 30px;
|
|
|
|
+ height: 2px;
|
|
|
|
+ background: rgba(131, 187, 255, 0.65);
|
|
|
|
+}
|
|
|
|
+.btns {
|
|
|
|
+ color: #4faffc;
|
|
|
|
+}
|
|
|
|
+.btns-warn {
|
|
|
|
+ color: #f80102;
|
|
|
|
+}
|
|
|
|
+.pagination {
|
|
|
|
+ margin-top: 20px;
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: center;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/* 弹窗删除样式 */
|
|
|
|
+.btnFooter {
|
|
|
|
+ width: 22%;
|
|
|
|
+ margin: 5px 0;
|
|
|
|
+ padding: 5px;
|
|
|
|
+ height: 40px;
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
+ background: rgba(0, 122, 255, 0.25);
|
|
|
|
+ color: rgba(255, 255, 255, 0.45);
|
|
|
|
+ text-align: center;
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: center;
|
|
|
|
+ align-items: center;
|
|
|
|
+ border: none;
|
|
|
|
+ cursor: pointer;
|
|
|
|
+ border-radius: 20px;
|
|
|
|
+ border: 2px solid rgb(0, 122, 255);
|
|
|
|
+}
|
|
|
|
+.btnFooter:hover {
|
|
|
|
+ color: #fff;
|
|
|
|
+}
|
|
|
|
+.btnFooter-big,
|
|
|
|
+.cancel {
|
|
|
|
+ width: 200px;
|
|
|
|
+}
|
|
|
|
+.btnFooter-big {
|
|
|
|
+ background-color: rgb(0, 122, 255);
|
|
|
|
+ color: #fff;
|
|
|
|
+}
|
|
|
|
+.footer {
|
|
|
|
+ position: absolute;
|
|
|
|
+ bottom: 0px;
|
|
|
|
+ left: 15%;
|
|
|
|
+ width: 70%;
|
|
|
|
+ display: flex;
|
|
|
|
+ justify-content: space-between;
|
|
|
|
+ margin: 30px auto;
|
|
|
|
+}
|
|
|
|
+.modal-bot {
|
|
|
|
+ padding-bottom: 100px;
|
|
|
|
+}
|
|
|
|
+.el-input__icon {
|
|
|
|
+ cursor: pointer;
|
|
|
|
+}
|
|
|
|
+.confirmText {
|
|
|
|
+ font-size: 20px;
|
|
|
|
+ text-align: center;
|
|
|
|
+ line-height: 180px;
|
|
|
|
+ color: rgba(255, 255, 255, 0.85);
|
|
|
|
+ width: 100%;
|
|
|
|
+}
|
|
|
|
+/* 弹窗删除样式结束 */
|
|
|
|
+</style>
|