|
|
@@ -0,0 +1,847 @@
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
+ <el-form-item label="装置" prop="plant">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.plant"
|
|
|
+ placeholder="请输入装置"
|
|
|
+ clearable
|
|
|
+ size="small"
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="设备名称" prop="devName">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.devName"
|
|
|
+ placeholder="请输入设备名称"
|
|
|
+ clearable
|
|
|
+ size="small"
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="设备位号" prop="devTag">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.devTag"
|
|
|
+ placeholder="请输入设备位号"
|
|
|
+ clearable
|
|
|
+ size="small"
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="部件名称" prop="compoName">
|
|
|
+ <el-input
|
|
|
+ v-model="queryParams.compoName"
|
|
|
+ placeholder="请输入部件名称"
|
|
|
+ clearable
|
|
|
+ size="small"
|
|
|
+ @keyup.enter.native="handleQuery"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="维修类型" prop="maintType">
|
|
|
+ <el-select v-model="queryParams.maintType" placeholder="请选择维修类型" clearable size="small">
|
|
|
+ <el-option label="检查" value="1" />
|
|
|
+ <el-option label="维修" value="2" />
|
|
|
+ <el-option label="更换" value="3" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="维修状态" prop="recordStatus">
|
|
|
+ <el-select v-model="queryParams.recordStatus" placeholder="请选择维修状态" clearable size="small">
|
|
|
+ <el-option label="删除申请中" value="-1" />
|
|
|
+ <el-option label="新增申请中" value="0" />
|
|
|
+ <el-option label="待完成" value="1" />
|
|
|
+ <el-option label="已完成" value="2" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
+ <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
+
|
|
|
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-table v-loading="loading" :data="rel_maint_recordList" @selection-change="handleSelectionChange" :height="clientHeight" border>
|
|
|
+ <el-table-column type="selection" width="55" align="center" />
|
|
|
+ <el-table-column label="装置" align="center" prop="plant" :show-overflow-tooltip="true"/>
|
|
|
+ <el-table-column label="设备名称" align="center" prop="devName" :show-overflow-tooltip="true"/>
|
|
|
+ <el-table-column label="设备位号" align="center" prop="devTag" :show-overflow-tooltip="true"/>
|
|
|
+ <el-table-column label="部件名称" align="center" prop="compoName" :show-overflow-tooltip="true"/>
|
|
|
+ <el-table-column label="维修类型" align="center" width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span v-if="scope.row.maintType === '1'">检查</span>
|
|
|
+ <span v-else-if="scope.row.maintType === '2'">维修</span>
|
|
|
+ <span v-else-if="scope.row.maintType === '3'">更换</span>
|
|
|
+ <span v-else>{{ scope.row.maintType || '-' }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="维修人" align="center" width="120">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ getStaffNameById(scope.row.responsible) || '-' }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="维修状态" align="center" width="120">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-tag v-if="scope.row.recordStatus === -1 || scope.row.recordStatus === '-1'" type="danger" size="small">删除申请中</el-tag>
|
|
|
+ <el-tag v-else-if="scope.row.recordStatus === 0 || scope.row.recordStatus === '0'" type="warning" size="small">新增申请中</el-tag>
|
|
|
+ <el-tag v-else-if="scope.row.recordStatus === 1 || scope.row.recordStatus === '1'" type="info" size="small">待完成</el-tag>
|
|
|
+ <el-tag v-else-if="scope.row.recordStatus === 2 || scope.row.recordStatus === '2'" type="success" size="small">已完成</el-tag>
|
|
|
+ <span v-else>{{ scope.row.recordStatus || '-' }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="维修计划" align="center" width="120">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-link
|
|
|
+ v-if="scope.row.maintPlan && scope.row.maintPlan.planTime && scope.row.maintPlan.planId"
|
|
|
+ type="primary"
|
|
|
+ :underline="false"
|
|
|
+ style="font-size: 14px;"
|
|
|
+ @click="handleViewPlan(scope.row.maintPlan.planId)">
|
|
|
+ {{ parseTime(scope.row.maintPlan.planTime, '{y}-{m}-{d}') }}
|
|
|
+ <i class="el-icon-view" style="margin-right: 4px;"></i>
|
|
|
+ </el-link>
|
|
|
+ <span v-else>-</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="检查内容" align="center" prop="inspectContent" :show-overflow-tooltip="true"/>
|
|
|
+ <el-table-column label="检查时间" align="center" prop="inspectTime" width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ parseTime(scope.row.inspectTime, '{y}-{m}-{d}') }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
+ <el-table-column label="维修部门" align="center" prop="maintDept" :show-overflow-tooltip="true"/>
|
|
|
+ <el-table-column label="维修内容" align="center" prop="maintContent" :show-overflow-tooltip="true"/>
|
|
|
+ <el-table-column label="维修结果" align="center" prop="maintResult" :show-overflow-tooltip="true"/>
|
|
|
+ <el-table-column label="维修时间" align="center" prop="maintTime" width="100">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{ parseTime(scope.row.maintTime, '{y}-{m}-{d}') }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="维修费用" align="center" prop="maintCost" :show-overflow-tooltip="true"/>
|
|
|
+ <el-table-column label="维修时长" align="center" prop="maintDuration" :show-overflow-tooltip="true"/>
|
|
|
+ <el-table-column label="工艺损失" align="center" prop="processLoss" :show-overflow-tooltip="true"/>
|
|
|
+ <el-table-column label="附件" align="center" prop="attachments" :show-overflow-tooltip="true"/>
|
|
|
+
|
|
|
+ <el-table-column label="备注" align="center" prop="remarks" :show-overflow-tooltip="true"/>
|
|
|
+ <el-table-column label="操作" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ @click="handleProcess(scope.row)"
|
|
|
+ :disabled="scope.row.recordStatus === 2 || scope.row.recordStatus === '2'"
|
|
|
+ >处理</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <pagination
|
|
|
+ v-show="total>0"
|
|
|
+ :total="total"
|
|
|
+ :page.sync="queryParams.pageNum"
|
|
|
+ :limit.sync="queryParams.pageSize"
|
|
|
+ @pagination="getList"
|
|
|
+ />
|
|
|
+
|
|
|
+ <!-- 处理检查任务对话框 -->
|
|
|
+ <el-dialog title="处理检查任务" :visible.sync="processInspectOpen" width="900px" append-to-body>
|
|
|
+ <el-form ref="processInspectForm" :model="processForm" :rules="processRules" label-width="120px" style="margin-top: 0;">
|
|
|
+ <!-- 基本信息 - 只读显示 -->
|
|
|
+ <div class="info-section">
|
|
|
+ <el-divider content-position="left" style="margin: 10px 0;">
|
|
|
+ <span style="font-size: 16px; font-weight: bold; color: #303133;">基本信息</span>
|
|
|
+ </el-divider>
|
|
|
+ <el-descriptions :column="2" border style="margin-top: 5px;">
|
|
|
+ <el-descriptions-item label="装置">{{ processForm.plant || '-' }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="设备名称">{{ processForm.devName || '-' }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="设备位号">{{ processForm.devTag || '-' }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="部件名称">{{ processForm.compoName || '-' }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="维修类型">{{ getMaintTypeText(processForm.maintType) }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="负责人">{{ getStaffNameById(processForm.responsible) || '-' }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="计划时间" v-if="processForm.maintPlan && processForm.maintPlan.planTime">
|
|
|
+ {{ parseTime(processForm.maintPlan.planTime, '{y}-{m}-{d}') || '-' }}
|
|
|
+ </el-descriptions-item>
|
|
|
+ <el-descriptions-item label="责任人" v-if="processForm.maintPlan && processForm.maintPlan.responsible">
|
|
|
+ {{ getStaffNameById(processForm.maintPlan.responsible) || '-' }}
|
|
|
+ </el-descriptions-item>
|
|
|
+ </el-descriptions>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 处理信息 - 可填写 -->
|
|
|
+ <div style="margin-top: 30px;">
|
|
|
+ <el-divider content-position="left">
|
|
|
+ <span style="font-size: 16px; font-weight: bold; color: #303133;">处理信息</span>
|
|
|
+ </el-divider>
|
|
|
+ <el-form-item label="检查时间" prop="inspectTime">
|
|
|
+ <el-date-picker
|
|
|
+ clearable
|
|
|
+ style="width: 100%"
|
|
|
+ v-model="processForm.inspectTime"
|
|
|
+ type="date"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ placeholder="选择检查时间">
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="检查内容" prop="inspectContent">
|
|
|
+ <el-input v-model="processForm.inspectContent" type="textarea" :rows="5" placeholder="请输入检查内容" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="是否需要维修/更换">
|
|
|
+ <el-checkbox v-model="processForm.needMaintOrReplace">发现需要维修或更换</el-checkbox>
|
|
|
+ </el-form-item>
|
|
|
+ <template v-if="processForm.needMaintOrReplace">
|
|
|
+ <el-form-item label="维修类型" prop="newMaintType">
|
|
|
+ <el-select v-model="processForm.newMaintType" placeholder="请选择维修类型" clearable style="width: 100%">
|
|
|
+ <el-option label="维修" value="2" />
|
|
|
+ <el-option label="更换" value="3" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="负责人" prop="newResponsible">
|
|
|
+ <el-select
|
|
|
+ v-model="processForm.newResponsible"
|
|
|
+ placeholder="请选择负责人"
|
|
|
+ style="width: 100%"
|
|
|
+ clearable
|
|
|
+ filterable>
|
|
|
+ <el-option
|
|
|
+ v-for="staff in staffOptions"
|
|
|
+ :key="staff.staffid"
|
|
|
+ :label="staff.name"
|
|
|
+ :value="staff.staffid">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <el-form-item label="附件" prop="attachments">
|
|
|
+ <el-input v-model="processForm.attachments" placeholder="请输入附件" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="备注" prop="remarks">
|
|
|
+ <el-input v-model="processForm.remarks" type="textarea" :rows="3" placeholder="请输入备注" />
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="submitProcessForm">提 交</el-button>
|
|
|
+ <el-button @click="cancelProcess">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <!-- 处理维修/更换任务对话框 -->
|
|
|
+ <el-dialog title="处理维修任务" :visible.sync="processMaintOpen" width="900px" append-to-body>
|
|
|
+ <el-form ref="processMaintForm" :model="processForm" :rules="processRules" label-width="120px" style="margin-top: 0;">
|
|
|
+ <!-- 基本信息 - 只读显示 -->
|
|
|
+ <div class="info-section">
|
|
|
+ <el-divider content-position="left" style="margin: 10px 0;">
|
|
|
+ <span style="font-size: 16px; font-weight: bold; color: #303133;">基本信息</span>
|
|
|
+ </el-divider>
|
|
|
+ <el-descriptions :column="2" border style="margin-top: 5px;">
|
|
|
+ <el-descriptions-item label="装置">{{ processForm.plant || '-' }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="设备名称">{{ processForm.devName || '-' }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="设备位号">{{ processForm.devTag || '-' }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="部件名称">{{ processForm.compoName || '-' }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="维修类型">{{ getMaintTypeText(processForm.maintType) }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="负责人">{{ getStaffNameById(processForm.responsible) || '-' }}</el-descriptions-item>
|
|
|
+ <el-descriptions-item label="计划时间" v-if="processForm.maintPlan && processForm.maintPlan.planTime">
|
|
|
+ {{ parseTime(processForm.maintPlan.planTime, '{y}-{m}-{d}') || '-' }}
|
|
|
+ </el-descriptions-item>
|
|
|
+ <el-descriptions-item label="责任人" v-if="processForm.maintPlan && processForm.maintPlan.responsible">
|
|
|
+ {{ getStaffNameById(processForm.maintPlan.responsible) || '-' }}
|
|
|
+ </el-descriptions-item>
|
|
|
+ </el-descriptions>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- 处理信息 - 可填写 -->
|
|
|
+ <div style="margin-top: 30px;">
|
|
|
+ <el-divider content-position="left">
|
|
|
+ <span style="font-size: 16px; font-weight: bold; color: #303133;">处理信息</span>
|
|
|
+ </el-divider>
|
|
|
+ <el-form-item label="无法维修/更换">
|
|
|
+ <el-checkbox v-model="processForm.cannotMaintOrReplace">无法维修或更换</el-checkbox>
|
|
|
+ </el-form-item>
|
|
|
+ <template v-if="processForm.cannotMaintOrReplace">
|
|
|
+ <el-form-item label="备忘原因" prop="memoReason">
|
|
|
+ <el-input v-model="processForm.memoReason" type="textarea" :rows="3" placeholder="请输入备忘原因" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="备忘时间" prop="memoTime">
|
|
|
+ <el-date-picker
|
|
|
+ clearable
|
|
|
+ style="width: 100%"
|
|
|
+ v-model="processForm.memoTime"
|
|
|
+ type="date"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ placeholder="选择备忘时间">
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <el-form-item label="维修内容" prop="maintContent">
|
|
|
+ <el-input v-model="processForm.maintContent" type="textarea" :rows="5" placeholder="请输入维修内容" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="维修结果" prop="maintResult">
|
|
|
+ <el-input v-model="processForm.maintResult" type="textarea" :rows="3" placeholder="请输入维修结果" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="维修时间" prop="maintTime">
|
|
|
+ <el-date-picker
|
|
|
+ clearable
|
|
|
+ style="width: 100%"
|
|
|
+ v-model="processForm.maintTime"
|
|
|
+ type="date"
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
+ placeholder="选择维修时间">
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="维修费用" prop="maintCost">
|
|
|
+ <el-input-number
|
|
|
+ v-model="processForm.maintCost"
|
|
|
+ :min="0"
|
|
|
+ :precision="1"
|
|
|
+ :step="0.1"
|
|
|
+ style="width: 100%"
|
|
|
+ placeholder="请输入维修费用" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="维修时长" prop="maintDuration">
|
|
|
+ <el-input-number
|
|
|
+ v-model="processForm.maintDuration"
|
|
|
+ :min="0"
|
|
|
+ :precision="1"
|
|
|
+ :step="1"
|
|
|
+ style="width: 100%"
|
|
|
+ placeholder="请输入维修时长(小时)" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="工艺损失" prop="processLoss">
|
|
|
+ <el-input-number
|
|
|
+ v-model="processForm.processLoss"
|
|
|
+ :min="0"
|
|
|
+ :precision="1"
|
|
|
+ :step="0.1"
|
|
|
+ style="width: 100%"
|
|
|
+ placeholder="请输入工艺损失" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </template>
|
|
|
+ <el-form-item label="附件" prop="attachments">
|
|
|
+ <el-input v-model="processForm.attachments" placeholder="请输入附件" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="备注" prop="remarks">
|
|
|
+ <el-input v-model="processForm.remarks" type="textarea" :rows="3" placeholder="请输入备注" />
|
|
|
+ </el-form-item>
|
|
|
+ </div>
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button type="primary" @click="submitProcessForm">提 交</el-button>
|
|
|
+ <el-button @click="cancelProcess">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 维修计划详情对话框 -->
|
|
|
+ <maint-plan-detail
|
|
|
+ :visible.sync="planDetailVisible"
|
|
|
+ :plan-id="planDetailId"
|
|
|
+ @close="planDetailVisible = false"
|
|
|
+ />
|
|
|
+
|
|
|
+
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { listMyRel_maint_record, getRel_maint_record, delRel_maint_record, updateRel_maint_record, exportRel_maint_record, importTemplate} from "@/api/reliability/rel_maint_record";
|
|
|
+import { treeselect } from "@/api/system/dept";
|
|
|
+import { getToken } from "@/utils/auth";
|
|
|
+import { listStaffmgrAll } from "@/api/plant/staffmgr";
|
|
|
+import Treeselect from "@riophae/vue-treeselect";
|
|
|
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
+import MaintPlanDetail from "@/views/reliability/rel_maint_plan/MaintPlanDetail";
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: "MyRecord",
|
|
|
+ components: { Treeselect, MaintPlanDetail },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 遮罩层
|
|
|
+ loading: true,
|
|
|
+ // 选中数组
|
|
|
+ ids: [],
|
|
|
+ // 非单个禁用
|
|
|
+ single: true,
|
|
|
+ // 非多个禁用
|
|
|
+ multiple: true,
|
|
|
+ // 显示搜索条件
|
|
|
+ showSearch: false,
|
|
|
+ // 总条数
|
|
|
+ total: 0,
|
|
|
+ // 部件维修记录表格数据
|
|
|
+ rel_maint_recordList: [],
|
|
|
+ // 弹出层标题
|
|
|
+ title: "",
|
|
|
+ // 部门树选项
|
|
|
+ deptOptions: undefined,
|
|
|
+ clientHeight:300,
|
|
|
+ // 是否显示弹出层
|
|
|
+ open: false,
|
|
|
+ // 处理对话框相关
|
|
|
+ processInspectOpen: false, // 检查类型处理对话框
|
|
|
+ processMaintOpen: false, // 维修/更换类型处理对话框
|
|
|
+ processForm: {},
|
|
|
+ processRules: {},
|
|
|
+ // 维修计划详情对话框
|
|
|
+ planDetailVisible: false,
|
|
|
+ planDetailId: null,
|
|
|
+ // 用户导入参数
|
|
|
+ upload: {
|
|
|
+ // 是否显示弹出层(用户导入)
|
|
|
+ open: false,
|
|
|
+ // 弹出层标题(用户导入)
|
|
|
+ title: "",
|
|
|
+ // 是否禁用上传
|
|
|
+ isUploading: false,
|
|
|
+ // 是否更新已经存在的用户数据
|
|
|
+ updateSupport: 0,
|
|
|
+ // 设置上传的请求头部
|
|
|
+ headers: { Authorization: "Bearer " + getToken() },
|
|
|
+ // 上传的地址
|
|
|
+ url: process.env.VUE_APP_BASE_API + "/reliability/rel_maint_record/importData"
|
|
|
+ },
|
|
|
+ // 查询参数
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 20,
|
|
|
+ plant: null,
|
|
|
+ devName: null,
|
|
|
+ devTag: null,
|
|
|
+ compoName: null,
|
|
|
+ compoId: null,
|
|
|
+ maintType: null,
|
|
|
+ maintDept: null,
|
|
|
+ inspector: null,
|
|
|
+ inspectContent: null,
|
|
|
+ inspectTime: null,
|
|
|
+ responsible: null,
|
|
|
+ maintContent: null,
|
|
|
+ maintResult: null,
|
|
|
+ maintTime: null,
|
|
|
+ maintCost: null,
|
|
|
+ maintDuration: null,
|
|
|
+ processLoss: null,
|
|
|
+ attachments: null,
|
|
|
+ createrCode: null,
|
|
|
+ createdate: null,
|
|
|
+ updaterCode: null,
|
|
|
+ updatedate: null,
|
|
|
+ deptId: null,
|
|
|
+ remarks: null,
|
|
|
+ recordStatus: null
|
|
|
+ },
|
|
|
+ // 表单参数
|
|
|
+ form: {},
|
|
|
+ // 表单校验
|
|
|
+ rules: {
|
|
|
+ },
|
|
|
+ // 所有人员选项
|
|
|
+ staffOptions: []
|
|
|
+ };
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ // 根据名称筛选部门树
|
|
|
+ deptName(val) {
|
|
|
+ this.$refs.tree.filter(val);
|
|
|
+ },
|
|
|
+ // 监听是否需要维修/更换,自动填充负责人
|
|
|
+ 'processForm.needMaintOrReplace'(newVal) {
|
|
|
+ if (newVal && this.processForm.compo && this.processForm.compo.fixer) {
|
|
|
+ // 使用部件信息中的维修更换人(fixer)作为负责人
|
|
|
+ this.processForm.newResponsible = this.processForm.compo.fixer;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ //设置表格高度对应屏幕高度
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.clientHeight = document.body.clientHeight -250
|
|
|
+ })
|
|
|
+ this.getList();
|
|
|
+ this.getTreeselect();
|
|
|
+ this.getStaffList();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ /** 查询我的维修任务列表 */
|
|
|
+ getList() {
|
|
|
+ this.loading = true;
|
|
|
+ listMyRel_maint_record(this.queryParams).then(response => {
|
|
|
+ this.rel_maint_recordList = response.rows;
|
|
|
+ this.total = response.total;
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 查询部门下拉树结构 */
|
|
|
+ getTreeselect() {
|
|
|
+ treeselect().then(response => {
|
|
|
+ this.deptOptions = response.data;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 查询人员列表 */
|
|
|
+ getStaffList() {
|
|
|
+ listStaffmgrAll().then(response => {
|
|
|
+ this.staffOptions = response.rows || response.data || [];
|
|
|
+ }).catch(error => {
|
|
|
+ console.error('加载人员数据失败:', error);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 根据员工ID获取姓名 */
|
|
|
+ getStaffNameById(staffid) {
|
|
|
+ if (!staffid) return '';
|
|
|
+ const staff = this.staffOptions.find(s => s.staffid === staffid);
|
|
|
+ return staff ? staff.name : '';
|
|
|
+ },
|
|
|
+ /** 获取维修状态文本 */
|
|
|
+ getRecordStatusText(status) {
|
|
|
+ if (status === -1 || status === '-1') return '删除申请中';
|
|
|
+ if (status === 0 || status === '0') return '新增申请中';
|
|
|
+ if (status === 1 || status === '1') return '待完成';
|
|
|
+ if (status === 2 || status === '2') return '已完成';
|
|
|
+ return status != null ? status : '-';
|
|
|
+ },
|
|
|
+ /** 获取维修类型文本 */
|
|
|
+ getMaintTypeText(type) {
|
|
|
+ if (type === '1') return '检查';
|
|
|
+ if (type === '2') return '维修';
|
|
|
+ if (type === '3') return '更换';
|
|
|
+ return type || '-';
|
|
|
+ },
|
|
|
+ /** 获取审批状态文本 */
|
|
|
+ getApprovalStatusText(status) {
|
|
|
+ if (status === '0') return '待审批';
|
|
|
+ if (status === '1') return '已通过';
|
|
|
+ if (status === '-1') return '未通过';
|
|
|
+ return status || '-';
|
|
|
+ },
|
|
|
+ /** 获取完成状态文本 */
|
|
|
+ getCompletionStatusText(status) {
|
|
|
+ if (status === '0') return '未完成';
|
|
|
+ if (status === '1') return '已完成';
|
|
|
+ return status || '-';
|
|
|
+ },
|
|
|
+ /** 处理按钮操作 */
|
|
|
+ handleProcess(row) {
|
|
|
+ this.resetProcessForm();
|
|
|
+ const recordId = row.recordId;
|
|
|
+ getRel_maint_record(recordId).then(response => {
|
|
|
+ this.processForm = response.data;
|
|
|
+ // 初始化新增的字段
|
|
|
+ this.processForm.needMaintOrReplace = false;
|
|
|
+ this.processForm.newMaintType = null;
|
|
|
+ this.processForm.newResponsible = null;
|
|
|
+ this.processForm.cannotMaintOrReplace = false;
|
|
|
+ this.processForm.memoReason = null;
|
|
|
+ this.processForm.memoTime = null;
|
|
|
+ // 将数字字段的 null 值转换为 undefined,并确保是数字类型,以便 el-input-number 正常工作
|
|
|
+ if (this.processForm.maintCost === null || this.processForm.maintCost === '' || this.processForm.maintCost === undefined) {
|
|
|
+ this.processForm.maintCost = undefined;
|
|
|
+ } else {
|
|
|
+ this.processForm.maintCost = Number(this.processForm.maintCost);
|
|
|
+ }
|
|
|
+ if (this.processForm.maintDuration === null || this.processForm.maintDuration === '' || this.processForm.maintDuration === undefined) {
|
|
|
+ this.processForm.maintDuration = undefined;
|
|
|
+ } else {
|
|
|
+ this.processForm.maintDuration = Number(this.processForm.maintDuration);
|
|
|
+ }
|
|
|
+ if (this.processForm.processLoss === null || this.processForm.processLoss === '' || this.processForm.processLoss === undefined) {
|
|
|
+ this.processForm.processLoss = undefined;
|
|
|
+ } else {
|
|
|
+ this.processForm.processLoss = Number(this.processForm.processLoss);
|
|
|
+ }
|
|
|
+ // 根据维修类型打开对应的对话框
|
|
|
+ if (this.processForm.maintType === '1') {
|
|
|
+ this.processInspectOpen = true;
|
|
|
+ } else if (this.processForm.maintType === '2' || this.processForm.maintType === '3') {
|
|
|
+ this.processMaintOpen = true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 重置处理表单 */
|
|
|
+ resetProcessForm() {
|
|
|
+ this.processForm = {
|
|
|
+ recordId: null,
|
|
|
+ plant: null,
|
|
|
+ devName: null,
|
|
|
+ devTag: null,
|
|
|
+ compoName: null,
|
|
|
+ maintType: null,
|
|
|
+ responsible: null,
|
|
|
+ inspector: null,
|
|
|
+ inspectTime: null,
|
|
|
+ inspectContent: null,
|
|
|
+ maintDept: null,
|
|
|
+ maintContent: null,
|
|
|
+ maintResult: null,
|
|
|
+ maintTime: null,
|
|
|
+ maintCost: null,
|
|
|
+ maintDuration: null,
|
|
|
+ processLoss: null,
|
|
|
+ attachments: null,
|
|
|
+ remarks: null,
|
|
|
+ needMaintOrReplace: false,
|
|
|
+ newMaintType: null,
|
|
|
+ newResponsible: null,
|
|
|
+ cannotMaintOrReplace: false,
|
|
|
+ memoReason: null,
|
|
|
+ memoTime: null
|
|
|
+ };
|
|
|
+ if (this.$refs.processInspectForm) {
|
|
|
+ this.$refs.processInspectForm.resetFields();
|
|
|
+ }
|
|
|
+ if (this.$refs.processMaintForm) {
|
|
|
+ this.$refs.processMaintForm.resetFields();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /** 取消处理 */
|
|
|
+ cancelProcess() {
|
|
|
+ this.processInspectOpen = false;
|
|
|
+ this.processMaintOpen = false;
|
|
|
+ this.resetProcessForm();
|
|
|
+ },
|
|
|
+ /** 提交处理表单 */
|
|
|
+ submitProcessForm() {
|
|
|
+ // 根据维修类型动态设置验证规则
|
|
|
+ const rules = {};
|
|
|
+ let formRef = null;
|
|
|
+
|
|
|
+ if (this.processForm.maintType === '1') {
|
|
|
+ // 检查类型:验证检查时间必填
|
|
|
+ rules.inspectTime = [{ required: true, message: "检查时间不能为空", trigger: "change" }];
|
|
|
+ // 如果选择了需要维修/更换,验证维修类型和负责人
|
|
|
+ if (this.processForm.needMaintOrReplace) {
|
|
|
+ rules.newMaintType = [{ required: true, message: "请选择维修类型", trigger: "change" }];
|
|
|
+ rules.newResponsible = [{ required: true, message: "请选择负责人", trigger: "change" }];
|
|
|
+ }
|
|
|
+ formRef = this.$refs.processInspectForm;
|
|
|
+ } else if (this.processForm.maintType === '2' || this.processForm.maintType === '3') {
|
|
|
+ // 维修/更换类型:验证维修时间必填(如果未选择无法维修/更换)
|
|
|
+ if (!this.processForm.cannotMaintOrReplace) {
|
|
|
+ rules.maintTime = [{ required: true, message: "维修时间不能为空", trigger: "change" }];
|
|
|
+ }
|
|
|
+ // 如果选择了无法维修/更换,验证备忘原因和备忘时间
|
|
|
+ if (this.processForm.cannotMaintOrReplace) {
|
|
|
+ rules.memoReason = [{ required: true, message: "备忘原因不能为空", trigger: "change" }];
|
|
|
+ rules.memoTime = [{ required: true, message: "备忘时间不能为空", trigger: "change" }];
|
|
|
+ }
|
|
|
+ formRef = this.$refs.processMaintForm;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 动态添加验证规则
|
|
|
+ Object.keys(rules).forEach(key => {
|
|
|
+ this.processRules[key] = rules[key];
|
|
|
+ });
|
|
|
+
|
|
|
+ if (!formRef) {
|
|
|
+ this.$message.error("无法确定表单引用");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ formRef.validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ // 更新维修状态为已完成
|
|
|
+ this.processForm.recordStatus = 2;
|
|
|
+ // 将是否需要创建新记录的信息传递给后端
|
|
|
+ updateRel_maint_record(this.processForm).then(response => {
|
|
|
+ // 如果检查任务中选择了需要维修/更换,后端会自动创建新记录
|
|
|
+ if (this.processForm.maintType === '1' && this.processForm.needMaintOrReplace && this.processForm.newMaintType && this.processForm.newResponsible) {
|
|
|
+ this.msgSuccess("处理成功,已创建新的维修/更换任务");
|
|
|
+ } else {
|
|
|
+ this.msgSuccess("处理成功");
|
|
|
+ }
|
|
|
+ this.processInspectOpen = false;
|
|
|
+ this.processMaintOpen = false;
|
|
|
+ this.getList();
|
|
|
+ }).catch(error => {
|
|
|
+ this.msgError("处理失败:" + (error.message || "未知错误"));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 取消按钮
|
|
|
+ cancel() {
|
|
|
+ this.open = false;
|
|
|
+ this.reset();
|
|
|
+ },
|
|
|
+ // 表单重置
|
|
|
+ reset() {
|
|
|
+ this.form = {
|
|
|
+ recordId: null,
|
|
|
+ plant: null,
|
|
|
+ devName: null,
|
|
|
+ devTag: null,
|
|
|
+ compoName: null,
|
|
|
+ compoId: null,
|
|
|
+ maintType: null,
|
|
|
+ maintDept: null,
|
|
|
+ inspector: null,
|
|
|
+ inspectContent: null,
|
|
|
+ inspectTime: null,
|
|
|
+ responsible: null,
|
|
|
+ maintContent: null,
|
|
|
+ maintResult: null,
|
|
|
+ maintTime: null,
|
|
|
+ maintCost: null,
|
|
|
+ maintDuration: null,
|
|
|
+ processLoss: null,
|
|
|
+ attachments: null,
|
|
|
+ delFlag: null,
|
|
|
+ createrCode: null,
|
|
|
+ createdate: null,
|
|
|
+ updaterCode: null,
|
|
|
+ updatedate: null,
|
|
|
+ deptId: null,
|
|
|
+ remarks: null,
|
|
|
+ recordStatus: null
|
|
|
+ };
|
|
|
+ this.resetForm("form");
|
|
|
+ },
|
|
|
+ /** 搜索按钮操作 */
|
|
|
+ handleQuery() {
|
|
|
+ this.queryParams.pageNum = 1;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ /** 重置按钮操作 */
|
|
|
+ resetQuery() {
|
|
|
+ this.resetForm("queryForm");
|
|
|
+ this.handleQuery();
|
|
|
+ },
|
|
|
+ // 多选框选中数据
|
|
|
+ handleSelectionChange(selection) {
|
|
|
+ this.ids = selection.map(item => item.recordId)
|
|
|
+ this.single = selection.length!==1
|
|
|
+ this.multiple = !selection.length
|
|
|
+ },
|
|
|
+ /** 新增按钮操作 */
|
|
|
+ handleAdd() {
|
|
|
+ this.reset();
|
|
|
+ this.open = true;
|
|
|
+ this.title = "添加部件维修记录";
|
|
|
+ },
|
|
|
+ /** 修改按钮操作 */
|
|
|
+ handleUpdate(row) {
|
|
|
+ this.reset();
|
|
|
+ const recordId = row.recordId || this.ids
|
|
|
+ getRel_maint_record(recordId).then(response => {
|
|
|
+ this.form = response.data;
|
|
|
+ this.open = true;
|
|
|
+ this.title = "修改部件维修记录";
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 提交按钮 */
|
|
|
+ submitForm() {
|
|
|
+ this.$refs["form"].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ if (this.form.recordId != null) {
|
|
|
+ updateRel_maint_record(this.form).then(response => {
|
|
|
+ this.msgSuccess("修改成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ addRel_maint_record(this.form).then(response => {
|
|
|
+ this.msgSuccess("新增成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 删除按钮操作 */
|
|
|
+ handleDelete(row) {
|
|
|
+ const recordIds = row.recordId || this.ids;
|
|
|
+ this.$confirm('是否确认删除?', "警告", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(function() {
|
|
|
+ return delRel_maint_record(recordIds);
|
|
|
+ }).then(() => {
|
|
|
+ this.getList();
|
|
|
+ this.msgSuccess("删除成功");
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /** 导出按钮操作 */
|
|
|
+ handleExport() {
|
|
|
+ const queryParams = this.queryParams;
|
|
|
+ this.$confirm('是否确认导出所有部件维修记录数据项?', "警告", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(function() {
|
|
|
+ return exportRel_maint_record(queryParams);
|
|
|
+ }).then(response => {
|
|
|
+ this.download(response.msg);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /** 导入按钮操作 */
|
|
|
+ handleImport() {
|
|
|
+ this.upload.title = "用户导入";
|
|
|
+ this.upload.open = true;
|
|
|
+ },
|
|
|
+ /** 下载模板操作 */
|
|
|
+ importTemplate() {
|
|
|
+ importTemplate().then(response => {
|
|
|
+ this.download(response.msg);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 文件上传中处理
|
|
|
+ handleFileUploadProgress(event, file, fileList) {
|
|
|
+ this.upload.isUploading = true;
|
|
|
+ },
|
|
|
+ // 文件上传成功处理
|
|
|
+ handleFileSuccess(response, file, fileList) {
|
|
|
+ this.upload.open = false;
|
|
|
+ this.upload.isUploading = false;
|
|
|
+ this.$refs.upload.clearFiles();
|
|
|
+ this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ // 提交上传文件
|
|
|
+ submitFileForm() {
|
|
|
+ this.$refs.upload.submit();
|
|
|
+ },
|
|
|
+ /** 查看维修计划详情 */
|
|
|
+ handleViewPlan(planId) {
|
|
|
+ this.planDetailId = planId;
|
|
|
+ this.planDetailVisible = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.info-section {
|
|
|
+ margin-bottom: 20px;
|
|
|
+ margin-top: 0;
|
|
|
+}
|
|
|
+
|
|
|
+::v-deep .el-dialog__body {
|
|
|
+ padding-top: 15px;
|
|
|
+}
|
|
|
+
|
|
|
+::v-deep .el-form {
|
|
|
+ padding-top: 0;
|
|
|
+}
|
|
|
+</style>
|