From 0a40c5890d13d9f2de5c3ab663876afecbfbefbe Mon Sep 17 00:00:00 2001
From: 吴羡 <16976746+Xian-TT3@user.noreply.gitee.com>
Date: 星期三, 28 十月 2026 17:57:46 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
src/views/CNAS/resourceDemand/device/component/equipmentMaintenancePlan.vue | 858 +++++++++++++++++++++++++++++++++-----------------------
1 files changed, 501 insertions(+), 357 deletions(-)
diff --git a/src/views/CNAS/resourceDemand/device/component/equipmentMaintenancePlan.vue b/src/views/CNAS/resourceDemand/device/component/equipmentMaintenancePlan.vue
index bce0d25..2eea398 100644
--- a/src/views/CNAS/resourceDemand/device/component/equipmentMaintenancePlan.vue
+++ b/src/views/CNAS/resourceDemand/device/component/equipmentMaintenancePlan.vue
@@ -1,399 +1,423 @@
<template>
+ <!-- 璁惧淇濆吇璁″垝-->
<div>
- <div>
- <div style="margin: 10px 0;text-align: right">
- <el-button size="small" type="primary" @click="getYearTableDetailData">鍒锋柊</el-button>
- <el-button size="small" type="primary" @click="handleForm('add')">鏂板</el-button>
+ <div style="margin: 10px 0 14px;">
+ <div class="plan-top">
+ <div class="plan-top-left">
+ <span class="title" style="margin-bottom: 0;">{{ planInfo.planName || (planYear + '骞村害璁惧淇濆吇璁″垝') }}</span>
+ <el-select v-model="planYear" size="small" style="width: 110px; margin-left: 16px;" @change="handleYearChange">
+ <el-option v-for="y in yearOptions" :key="y" :label="y" :value="y"></el-option>
+ </el-select>
+ </div>
+ <div>
+ <el-button size="small" type="primary" @click="loadYearOptions(true)">鍒锋柊</el-button>
+ <el-button size="small" type="primary" :loading="outLoading" @click="handleDownOne">瀵煎嚭</el-button>
+ </div>
</div>
- <div>
- <el-table ref="yearTable" v-loading="yearTableDetailDataLoading" :data="yearTableDetailData"
- border
- height="calc(100vh - 18em)" style="width: 100% ;">
- <!-- 琛ㄦ牸鍒� -->
- <el-table-column align="center" header-align="center" label="搴忓彿" prop="prop" type="index"
- width="70"></el-table-column>
- <el-table-column label="骞翠唤" min-width="80" prop="planYear"></el-table-column>
- <el-table-column label="缂栧埗浜�" min-width="120" prop="compiler"></el-table-column>
- <el-table-column label="缂栧埗鏃堕棿" min-width="160" prop="datePreparation"></el-table-column>
- <el-table-column label="瀹℃牳浜�" min-width="150" prop="audit"></el-table-column>
- <el-table-column label="瀹℃牳鏃堕棿" min-width="180" prop="auditDate"></el-table-column>
- <el-table-column label="瀹℃牳鐘舵��" min-width="180" prop="status">
- <template #default="scope">
- <el-tag v-if="scope.row.status === 1" type="success">閫� 杩�</el-tag>
- <el-tag v-if="scope.row.status === 0" type="danger">涓嶉�氳繃</el-tag>
- </template>
- </el-table-column>
- <!-- 鎿嶄綔鎸夐挳 -->
- <el-table-column align="center" fixed="right" label="鎿嶄綔" min-width="260">
- <template #default="scope">
- <el-button :disabled="scope.row.status === 1" size="small" link type="primary"
- @click="handleForm('edit', scope.row)">缂栬緫</el-button>
- <el-button size="small" link type="primary" @click="handleForm('view', scope.row)">鏌ョ湅</el-button>
- <el-button :disabled="scope.row.status === 1" size="small" link type="primary"
- @click="tellApprove(scope.row.maintenancePlanId)">瀹℃牳閫氱煡</el-button>
- <el-button :disabled="scope.row.status === 1 || userId != scope.row.auditId" size="small" link type="primary"
- @click="handleForm('check', scope.row)">瀹℃牳</el-button>
- <el-button size="small" link type="primary" @click="handleDownOne(scope.row.maintenancePlanId)">瀵煎嚭</el-button>
- <el-button :disabled="scope.row.status === 1" size="small" link type="danger"
- @click="deleteFun(scope.row.maintenancePlanId)">鍒犻櫎</el-button>
- </template>
- </el-table-column>
- </el-table>
- <el-pagination :current-page="1" :page-size="pagination1.size" :page-sizes="[10, 20, 30, 50, 100]"
- :total="pagination1.total" layout="->,total, sizes, prev, pager, next, jumper" background
- @size-change="handleSizeChange1" @current-change="handleCurrentChange1">
- </el-pagination>
+ <div class="plan-info-bar">
+ <span>缂栧埗浜猴細{{ planInfo.compiler || '鈥�' }}</span>
+ <span>缂栧埗鏃ユ湡锛歿{ planInfo.datePreparationStr || '鈥�' }}</span>
+ <span v-if="planInfo.status === 1">瀹℃牳鐘舵�侊細<el-tag type="success">閫� 杩�</el-tag></span>
+ <span v-else-if="planInfo.status === 0">瀹℃牳鐘舵�侊細<el-tag type="danger">涓嶉�氳繃</el-tag></span>
+ <span v-if="planInfo.auditRemark">瀹℃牳淇℃伅锛歿{ planInfo.auditRemark }}</span>
+ <span v-if="isAudited && planInfo.audit">瀹℃牳浜猴細{{ planInfo.audit }}</span>
+ <span v-if="isAudited && planInfo.auditDateStr">瀹℃牳鏃堕棿锛歿{ planInfo.auditDateStr }}</span>
</div>
</div>
- <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" v-model="applicationForm"
- title="璁惧淇濆吇璁″垝琛�" width="80%" @close="closeDialog">
- <div style="display: flex;align-items: center;">
- <el-button v-if="operationType === 'edit' || operationType === 'add'" size="small" type="primary" @click="addTableRow">娣诲姞</el-button>
- <span style="width: 60px;margin-left: 10px">骞翠唤锛�</span>
- <el-date-picker v-model="form.planYear" type="year" value-format="YYYY" clearable size="small" format="YYYY"
- placeholder="閫夋嫨骞�" :disabled="operationType !== 'edit' && operationType !== 'add'">
- </el-date-picker>
+ <div class="search">
+ <div>
+ <el-form :model="searchForm" ref="searchForm" size="small" :inline="true">
+ <el-form-item label="璁惧鍚嶇О" prop="deviceName">
+ <el-input v-model="searchForm.deviceName" clearable @keyup.enter="handleQuery"
+ size="small"></el-input>
+ </el-form-item>
+ <el-form-item label="璁惧缂栧彿" prop="deviceNumber">
+ <el-input v-model="searchForm.deviceNumber" @keyup.enter="handleQuery" clearable
+ size="small"></el-input>
+ </el-form-item>
+ <el-form-item>
+ <el-button type="primary" size="small" @click="handleQuery">鏌ヨ</el-button>
+ <el-button size="small" @click="reset">閲嶇疆</el-button>
+ </el-form-item>
+ </el-form>
</div>
- <div style="margin: 10px 0">
- <el-table ref="yearTable" :data="deviceMaintenancePlanDetails" id="templateParamTable" row-key="deviceId"
- border
- height="560px" style="width: 100% ;">
- <el-table-column align="center" header-align="center" label="搴忓彿" type="index" width="60"></el-table-column>
- <el-table-column label="璁惧鍚嶇О" min-width="170" prop="deviceName">
- <template #default="scope">
- <el-input v-model="scope.row.deviceName" :disabled="operationType !== 'edit' && operationType !== 'add'" clearable
- size="small"></el-input>
- </template>
+ </div>
+ <div>
+ <el-table ref="yearTable" v-loading="tableLoading" :data="tableData" border
+ :row-class-name="tableRowClassName" :height="'calc(100vh - 29em)'" style="width: 100%;">
+ <el-table-column align="center" header-align="center" label="搴忓彿" prop="prop" type="index"
+ width="70"></el-table-column>
+ <el-table-column label="璁惧鍚嶇О" min-width="150" prop="deviceName" show-overflow-tooltip></el-table-column>
+ <el-table-column label="璁惧鍨嬪彿" min-width="130" prop="specificationModel" show-overflow-tooltip></el-table-column>
+ <el-table-column label="璁惧缂栧彿" min-width="140" prop="deviceNumber"></el-table-column>
+ <el-table-column label="瀛樻斁鐐�" min-width="120" prop="storagePoint"></el-table-column>
+ <el-table-column align="center" header-align="center" label="瀹℃牳鏃ユ湡" min-width="110">
+ <template #default="scope">{{ formatReviewDate(scope.row) }}</template>
+ </el-table-column>
+ <el-table-column align="center" header-align="center" label="缁存姢淇濆吇鍐呭">
+ <el-table-column v-for="item in checkColumns" :key="item.prop" align="center" header-align="center"
+ :label="item.label" width="110">
+ <template #default="scope">{{ scope.row[item.prop] || '鈥�' }}</template>
</el-table-column>
- <el-table-column label="璁惧缂栧彿" min-width="140" prop="deviceNumber">
- <template #default="scope">
- <el-input v-model="scope.row.deviceNumber" :disabled="operationType !== 'edit' && operationType !== 'add'" clearable
- size="small"></el-input>
- </template>
- </el-table-column>
- <el-table-column label="褰掑睘瀹為獙瀹�" min-width="120" prop="storagePoint">
- <template #default="scope">
- <el-input v-model="scope.row.storagePoint" :disabled="operationType !== 'edit' && operationType !== 'add'" clearable
- size="small"></el-input>
- </template>
- </el-table-column>
- <el-table-column label="淇濆吇鍏抽敭閮ㄤ綅" min-width="120" prop="maintenanceSite">
- <template #default="scope">
- <el-input v-model="scope.row.maintenanceSite" :disabled="operationType !== 'edit' && operationType !== 'add'" clearable size="small"
- type="textarea"></el-input>
- </template>
- </el-table-column>
- <el-table-column label="淇濆吇鍐呭" min-width="120" prop="maintenanceContent">
- <template #default="scope">
- <el-input v-model="scope.row.maintenanceContent" :disabled="operationType !== 'edit' && operationType !== 'add'" clearable
- size="small" type="textarea"></el-input>
- </template>
- </el-table-column>
- <el-table-column label="淇濆吇鍛ㄦ湡" min-width="90" prop="maintenanceIntervals">
- <template #default="scope">
- <el-input v-model="scope.row.maintenanceIntervals" :disabled="operationType !== 'edit' && operationType !== 'add'" clearable
- size="small"></el-input>
- </template>
- </el-table-column>
- <el-table-column label="鎿嶄綔" width="80" align="center" v-if="operationType === 'edit' || operationType === 'add'">
- <template #default="scope">
- <el-button link type="danger" @click="deleteRow(scope.$index)">鍒犻櫎</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <template #footer><span class="dialog-footer">
- <el-button @click="closeDialog">鍙� 娑�</el-button>
- <el-button v-if="operationType === 'edit' || operationType === 'add'" :loading="submitFormLoading" type="primary" @click="submitForm">纭�
- 璁�</el-button>
- <el-button v-if="operationType === 'check'" :loading="submitFormLoading" type="primary"
- @click="checkStatus(0)">涓嶉�氳繃</el-button>
- <el-button v-if="operationType === 'check'" :loading="submitFormLoading" type="primary"
- @click="checkStatus(1)">閫�
- 杩�</el-button>
- </span></template>
- </el-dialog>
- <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" v-model="addEquipDia" title="娣诲姞璁惧"
- width="50%">
- <el-table ref="multipleTable" :data="equipOptions" tooltip-effect="dark" height="500" style="width: 100%"
- border
- @selection-change="handleSelectionChange">
- <el-table-column type="selection" width="55"></el-table-column>
- <el-table-column label="璁惧鍚嶇О" prop="label" width="190"></el-table-column>
- <el-table-column prop="value" label="璁惧缂栧彿" width="130"></el-table-column>
- <el-table-column prop="managementNumber" label="褰掑睘瀹為獙瀹�"></el-table-column>
+ </el-table-column>
+ <el-table-column align="center" header-align="center" label="缁存姢浜�" min-width="100">
+ <template #default="scope">{{ scope.row.maintenanceUserName || '鈥�' }}</template>
+ </el-table-column>
+ <el-table-column label="瀹℃牳鐘舵��" min-width="100">
+ <template #default="scope">
+ <el-tag v-if="!scope.row.recordStatus" type="info" disable-transitions>鏈紑濮�</el-tag>
+ <el-tag v-else-if="scope.row.recordStatus === 1" type="warning" disable-transitions>寰呭鏍�</el-tag>
+ <el-tag v-else-if="scope.row.recordStatus === 2" type="success" disable-transitions>閫氳繃</el-tag>
+ <el-tag v-else-if="scope.row.recordStatus === 3" type="danger" disable-transitions>涓嶉�氳繃</el-tag>
+ </template>
+ </el-table-column>
+ <el-table-column label="澶囨敞" min-width="140" show-overflow-tooltip>
+ <template #default="scope">{{ scope.row.recordRemark || '鈥�' }}</template>
+ </el-table-column>
+ <el-table-column align="center" fixed="right" label="鎿嶄綔" min-width="300">
+ <template #default="scope">
+ <el-button size="small" link type="primary"
+ :disabled="scope.row.recordStatus === 2 || scope.row.recordStatus === 3"
+ @click="handleForm('edit', scope.row)">缂栬緫</el-button>
+ <el-button size="small" link type="primary" :disabled="!scope.row.recordId"
+ @click="handleForm('view', scope.row)">鏌ョ湅</el-button>
+ <el-button v-if="scope.row.recordStatus === 0 || scope.row.recordStatus === 1"
+ size="small" link type="primary" :disabled="!scope.row.maintenanceUserName"
+ @click="handleReview(scope.row)">瀹℃牳</el-button>
+ <el-button v-if="scope.row.recordStatus !== 2"
+ size="small" link type="danger" @click="deleteRow(scope.row)">鍒犻櫎</el-button>
+ </template>
+ </el-table-column>
</el-table>
- <template #footer><span class="dialog-footer">
- <el-button @click="addEquipDia = false">鍙� 娑�</el-button>
- <el-button v-if="operationType === 'edit' || operationType === 'add'" :loading="submitFormLoading" type="primary"
- @click="changeMachineName">纭�
- 璁�</el-button>
- </span></template>
- </el-dialog>
- <el-dialog v-model="notificationDia" title="鎻愪氦瀹℃牳" width="30%" @close="closeNotificationDia">
- <span style="margin-top: 10px;display: inline-block">
- 璇烽�夋嫨瀹℃牳浜猴細
- <el-select v-model="auditId" clearable filterable size="small" style="width: 90%;">
- <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.id">
- </el-option>
- </el-select>
- </span>
- <template #footer><span class="dialog-footer">
- <el-button :loading="notificationLoading" @click="closeNotificationDia">鍙� 娑�</el-button>
- <el-button :loading="notificationLoading" type="primary" @click="notification">鎻� 浜�</el-button>
+ <el-pagination :current-page="pagination1.current" :page-size="pagination1.size"
+ :page-sizes="[10, 20, 30, 50, 100]" background :total="pagination1.total"
+ layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange1"
+ @current-change="handleCurrentChange1">
+ </el-pagination>
+ </div>
+ <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" v-model="dialogVisible"
+ :title="dialogTitle" width="880px" @close="resetForm">
+ <el-form ref="modelForm" :model="form" :rules="rules" label-width="150px" size="small">
+ <el-row>
+ <el-col :span="12">
+ <el-form-item label="璁惧鍚嶇О锛�">
+ <el-input v-model="form.deviceName" disabled></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="璁惧鍨嬪彿锛�">
+ <el-input v-model="form.specificationModel" disabled></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="璁惧缂栧彿锛�">
+ <el-input v-model="form.deviceNumber" disabled></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="瀛樻斁鐐癸細">
+ <el-input v-model="form.storagePoint" disabled></el-input>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="缁存姢鏃ユ湡锛�" prop="maintenanceDate">
+ <el-date-picker v-model="form.maintenanceDate" :disabled="!isEdit" clearable
+ format="YYYY-MM-DD" placeholder="閫夋嫨鏃ユ湡" style="width: 100%" type="date"
+ value-format="YYYY-MM-DD"></el-date-picker>
+ </el-form-item>
+ </el-col>
+ <el-col :span="12">
+ <el-form-item label="缁存姢浜猴細" prop="maintenanceUserId">
+ <el-select v-model="form.maintenanceUserId" :disabled="!isEdit" clearable filterable
+ placeholder="璇烽�夋嫨" style="width: 100%">
+ <el-option v-for="item in maintainerOptions" :key="item.id" :label="item.name"
+ :value="item.id"></el-option>
+ </el-select>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <div class="form-section-title">缁存姢淇濆吇鍐呭</div>
+ <el-row>
+ <el-col v-for="item in checkColumns" :key="item.prop" :span="12">
+ <el-form-item :label="item.label + '锛�'" :prop="item.prop">
+ <el-radio-group v-model="form[item.prop]" :disabled="!isEdit">
+ <el-radio value="鈭�">鈭�</el-radio>
+ <el-radio value="脳">脳</el-radio>
+ </el-radio-group>
+ </el-form-item>
+ </el-col>
+ </el-row>
+ <el-form-item label="淇濆吇澶囨敞锛�">
+ <el-input v-model="form.remark" :disabled="!isEdit" :rows="2" placeholder="鍙~鍐欎繚鍏诲娉�"
+ type="textarea"></el-input>
+ </el-form-item>
+ <el-form-item v-if="operationType === 'review'" label="瀹℃牳澶囨敞锛�">
+ <el-input v-model="form.reviewRemark" :rows="2" placeholder="鍙~鍐欏鏍告剰瑙�"
+ type="textarea"></el-input>
+ </el-form-item>
+ <div class="check-note">澶囨敞锛氭甯搞�佽壇濂芥墦鈥溾垰鈥濓紝涓嶆甯稿強鍚︽墦鈥溍椻�濄��</div>
+ <div v-if="cycleNote" class="check-note">{{ cycleNote }}</div>
+ </el-form>
+ <template #footer><span class="dialog-footer">
+ <el-button @click="resetForm">鍙� 娑�</el-button>
+ <template v-if="operationType === 'review'">
+ <el-button :loading="reviewLoading" @click="submitReview(0)">涓嶉�氳繃</el-button>
+ <el-button :loading="reviewLoading" type="primary" @click="submitReview(1)">閫� 杩�</el-button>
+ </template>
+ <el-button v-else-if="operationType === 'edit'" :loading="submitFormLoading" type="primary"
+ @click="submitForm">纭� 璁�</el-button>
</span></template>
</el-dialog>
</div>
</template>
<script>
-import Sortable from "sortablejs";
import {
- selectDeviceMaintenancePlanByPage,
- submitReviewMaintenancePlanStatus,
- getMaintenancePlanDetail,
- addMaintenancePlan,
- updateMaintenancePlan,
+ getMaintenancePlanYears,
+ getMaintenancePlanByYear,
+ pageMaintenancePlanDetail,
+ deleteMaintenancePlanDetail,
exportDeviceMaintenancePlan,
- deleteMaintenancePlan,
- deviceScopeSearch,
+ addDeviceMaintenance,
+ reviewDeviceMaintenance,
} from '@/api/cnas/resourceDemand/device.js'
-import { selectUserCondition } from "@/api/business/inspectionTask";
-import { mapGetters } from "@/utils/store-compat";
+import { selectUserCondition } from '@/api/system/user'
+import dayjs from 'dayjs'
+import { formatDateOnly } from './dateFormat'
+import { saveBlobOrShowError } from '@/utils/saveBlob'
+
+// 缁存姢淇濆吇妫�鏌ラ」锛屼笌浠櫒璁惧缁存姢淇濆吇璁板綍琛ㄤ竴鑷�
+const CHECK_ITEMS = [
+ { label: '澶栬鏄惁鑹ソ', prop: 'appearanceGood' },
+ { label: '鏄惁鍙互姝e父浣跨敤', prop: 'normalUse' },
+ { label: '鏄惁娓呮磥浠櫒琛ㄩ潰', prop: 'surfaceClean' },
+ { label: '鏍囪瘑鏄惁瀹屽ソ', prop: 'labelIntact' },
+ { label: '鏄剧ず鍣ㄧ伅鏄惁姝e父', prop: 'displayLightNormal' },
+ { label: '浠櫒鏄惁鐢熼攬', prop: 'noRust' },
+ { label: '鏍″噯鏄惁姝e父', prop: 'calibrationNormal' },
+ { label: '閰嶄欢鏄惁闇�瑕佹洿鎹�', prop: 'partsReplace' },
+ { label: '缁存姢缁撴灉鏄惁姝e父', prop: 'resultNormal' },
+]
+
export default {
name: "equipment-maintenance-plan",
- // import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
- components: {},
props: {
clickNodeVal: {
type: Object,
default: () => {
+ return {};
}
}
},
data() {
- // 杩欓噷瀛樻斁鏁版嵁
+ const rules = {
+ maintenanceDate: [{ required: true, message: '璇烽�夋嫨缁存姢鏃ユ湡', trigger: 'change' }],
+ maintenanceUserId: [{ required: true, message: '璇烽�夋嫨缁存姢浜�', trigger: 'change' }],
+ }
return {
+ planYear: '',
+ yearOptions: [],
+ planInfo: {},
+ searchForm: {
+ deviceName: '',
+ deviceNumber: '',
+ },
+ tableData: [],
+ tableLoading: false,
pagination1: {
size: 10,
current: 1,
total: 0,
},
- yearTableDetailDataLoading: false,
- yearTableDetailData: [],
- deviceMaintenancePlanDetails: [],
- selectionRows: [],
- deviceIds: [],
- applicationForm: false,
- submitFormLoading: false,
+ checkColumns: CHECK_ITEMS.map(item => ({ ...item })),
+ dialogVisible: false,
operationType: '',
- equipOptions: [],
- form: {
- planYear: '',
- deviceMaintenancePlanDetails: []
- },
- addEquipDia: false,
- responsibleOptions: [],
- notificationDia: false,
- notificationLoading: false,
- auditId: '',
- maintenancePlanId: ''
+ form: {},
+ rules,
+ submitFormLoading: false,
+ outLoading: false,
+ reviewLoading: false,
+ userOptions: [],
}
},
mounted() {
- this.getYearTableDetailData()
+ this.loadYearOptions()
+ this.getUserList()
},
- // 鏂规硶闆嗗悎
methods: {
- // 鏌ヨ
- getYearTableDetailData() {
- this.yearTableDetailDataLoading = true
- selectDeviceMaintenancePlanByPage({
- current: this.pagination1.current,
- size: this.pagination1.size,
- }).then(res => {
- if (res.code == 200) {
- this.yearTableDetailData = res.data.records
- this.pagination1.total = res.data.total
+ // 骞翠唤涓嬫媺锛氬彧鍒楀嚭鏈夋槑缁嗙殑骞翠唤锛堢┖骞翠唤璁″垝鐢卞悗绔垹闄わ級锛岄粯璁ゆ樉绀烘湰骞村害锛堟湰骞村害鏃犺鍒掓椂閫�鍥炴渶鏂板勾浠斤級
+ loadYearOptions(preserveYear = false) {
+ const currentYear = String(new Date().getFullYear())
+ const finish = (years) => {
+ let list = [...new Set(years.map(y => String(y)).filter(Boolean))]
+ list.sort((a, b) => b.localeCompare(a))
+ if (!list.length) {
+ list = [currentYear]
}
- this.yearTableDetailDataLoading = false
- }).catch(err => {
- this.yearTableDetailDataLoading = false
+ this.yearOptions = list
+ const keep = preserveYear && this.planYear && list.includes(String(this.planYear))
+ this.planYear = keep ? String(this.planYear) : (list.includes(currentYear) ? currentYear : list[0])
+ this.loadPlan()
+ }
+ getMaintenancePlanYears().then(res => {
+ finish(res.code == 200 ? (res.data || []) : [])
+ }).catch(() => {
+ finish([])
})
},
- // 鎵撳紑鎻愪氦鎵瑰噯寮规
- tellApprove(maintenancePlanId) {
- this.getUserList()
- this.notificationDia = true
- this.maintenancePlanId = maintenancePlanId
+ // 鍒囨崲骞翠唤
+ handleYearChange() {
+ this.pagination1.current = 1
+ this.loadPlan()
},
- // 鍏抽棴鎻愪氦鎵瑰噯寮规
- closeNotificationDia() {
- this.notificationDia = false
- this.auditId = ''
+ // 鏌ヨ骞翠唤璁″垝锛堜笉瀛樺湪鑷姩鍒涘缓骞惰ˉ鍏ㄥ埌鐐规槑缁嗭級锛岄殢鍚庡埛鏂版槑缁�
+ loadPlan() {
+ getMaintenancePlanByYear({ planYear: this.planYear }).then(res => {
+ if (res.code == 200) {
+ this.planInfo = res.data || {}
+ }
+ this.getTableList()
+ }).catch(() => {
+ this.planInfo = {}
+ this.tableData = []
+ this.pagination1.total = 0
+ this.tableLoading = false
+ })
},
- // 鎻愪氦鎵瑰噯閫氱煡
- notification() {
- if (!this.auditId) {
- this.$message.warning('璇烽�夋嫨瀹℃牳浜�')
+ // 鏌ヨ鏉′欢鍙樺寲鍚庝粠绗竴椤靛紑濮嬫煡
+ handleQuery() {
+ this.pagination1.current = 1
+ this.getTableList()
+ },
+ // 鏄庣粏-鏌ヨ
+ getTableList() {
+ if (!this.planInfo.maintenancePlanId) {
return
}
- this.notificationLoading = true
- submitReviewMaintenancePlanStatus({
- auditId: this.auditId,
- maintenancePlanId: this.maintenancePlanId,
+ this.tableLoading = true
+ pageMaintenancePlanDetail({
+ current: this.pagination1.current,
+ size: this.pagination1.size,
+ planId: this.planInfo.maintenancePlanId,
+ deviceName: this.searchForm.deviceName,
+ deviceNumber: this.searchForm.deviceNumber,
}).then(res => {
- this.notificationLoading = false
if (res.code == 200) {
- this.closeNotificationDia()
- this.getYearTableDetailData()
+ this.tableData = res.data.records
+ this.pagination1.total = res.data.total
}
- }).catch(err => {
- this.notificationLoading = false
+ this.tableLoading = false
+ }).catch(() => {
+ this.tableLoading = false
})
},
- // 鎵撳紑鏂板鍜岀紪杈戝脊妗�
- handleForm(type, row) {
- this.operationType = type
- this.applicationForm = true
- this.form = {
- planYear: '',
- deviceMaintenancePlanDetails: [],
+ // 鏈鏍告樉绀鸿鍒掍繚鍏绘椂闂达紱瀹℃牳閫氳繃鍚庢樉绀哄鏍稿綋澶╋紙涓庢牳鏌ヨ鍒掍竴鑷达級
+ formatReviewDate(row) {
+ const date = row.reviewStatus === 1 ? row.reviewTime : row.maintenanceDate
+ return formatDateOnly(date) || '鈥�'
+ },
+ tableRowClassName({ row }) {
+ return row.redFlag === 1 ? 'red-row' : ''
+ },
+ reset() {
+ this.searchForm = {
+ deviceName: '',
+ deviceNumber: '',
}
- this.deviceMaintenancePlanDetails = []
- if (row) {
- this.maintenancePlanId = row.maintenancePlanId
- getMaintenancePlanDetail({ maintenancePlanId: this.maintenancePlanId }).then(res => {
- if (res.code === 200) {
- this.form = res.data
- this.deviceMaintenancePlanDetails = this.form.deviceMaintenancePlanDetails
- }
- }).catch(error => {
- console.error(error)
- })
- }
- this.getEquipOptions()
- },
- // 娣诲姞璁惧
- addTableRow() {
- this.addEquipDia = true
- this.getEquipOptions()
- },
- handleSelectionChange(selection) {
- this.selectionRows = selection
- },
- // 璧嬪�间华鍣ㄧ紪鍙�
- changeMachineName() {
- this.deviceMaintenancePlanDetails = []
- this.selectionRows.map(val => {
- this.deviceMaintenancePlanDetails.push({ deviceId: val.id, deviceName: val.label, deviceNumber: val.value, storagePoint: val.storagePoint })
- })
- this.addEquipDia = false
- this.rowDrop()
- },
- rowDrop() {
- const that = this
- const tbody = document.querySelector(
- '#templateParamTable .el-table__body-wrapper tbody'
- )
- if (!this.sortTable) {
- this.sortTable = Sortable.create(tbody, {
- animation: 200, //鍔ㄧ敾鏃堕暱
- handle: ".el-table__row", //鍙嫋鎷藉尯鍩焎lass
- //鎷栨嫿涓簨浠�
- onMove: ({ dragged, related }) => {
- const oldRow = that.deviceMaintenancePlanDetails[dragged.rowIndex] //鏃т綅缃暟鎹�
- const newRow = that.deviceMaintenancePlanDetails[related.rowIndex] //琚嫋鎷界殑鏂版暟鎹�
- },
- //鎷栨嫿缁撴潫浜嬩欢
- onEnd: evt => {
- const curRow = that.deviceMaintenancePlanDetails.splice(evt.oldIndex, 1)[0];
- that.deviceMaintenancePlanDetails.splice(evt.newIndex, 0, curRow);
- }
- })
- }
- },
- // 鍒犻櫎琛ㄦ牸琛�
- deleteRow(index) {
- this.deviceMaintenancePlanDetails.splice(index, 1)
- },
- // 鎻愪氦鏂板鍜屼慨鏀�
- submitForm() {
- this.form.deviceMaintenancePlanDetails = this.HaveJson(this.deviceMaintenancePlanDetails)
- this.submitFormLoading = true
- if (this.operationType === 'add') {
- addMaintenancePlan(this.form).then(res => {
- if (res.code == 200) {
- this.$message.success('鏂板鎴愬姛')
- this.applicationForm = false
- this.getYearTableDetailData()
- }
- this.submitFormLoading = false
- }).catch(err => {
- this.submitFormLoading = false
- })
- } else {
- updateMaintenancePlan(this.form).then(res => {
- if (res.code == 200) {
- this.$message.success('淇敼鎴愬姛')
- this.applicationForm = false
- this.getYearTableDetailData()
- }
- this.submitFormLoading = false
- }).catch(err => {
- this.submitFormLoading = false
- })
- }
- },
- // 鎻愪氦瀹℃牳
- checkStatus(status) {
- const params = {
- status: status,
- maintenancePlanId: this.maintenancePlanId
- }
- addMaintenancePlan(params).then(res => {
- if (res.code == 200) {
- this.$message.success('瀹℃牳鎴愬姛')
- this.applicationForm = false
- this.getYearTableDetailData()
- }
- this.submitFormLoading = false
- }).catch(err => {
- this.submitFormLoading = false
- })
- },
- closeDialog() {
- this.applicationForm = false
- this.getYearTableDetailData()
+ this.pagination1.current = 1
+ this.getTableList()
},
// 鍒嗛〉
handleSizeChange1(val) {
this.pagination1.size = val
- this.getYearTableDetailData()
+ this.getTableList()
},
// 鍒嗛〉
handleCurrentChange1(val) {
this.pagination1.current = val
- this.getYearTableDetailData()
+ this.getTableList()
},
- handleDownOne(id) {
- this.outLoading = true
- exportDeviceMaintenancePlan({ maintenancePlanId: id }).then(res => {
- this.outLoading = false
- const blob = new Blob([res], { type: 'application/octet-stream' });
- this.$download.saveAs(blob, '璁惧缁存姢淇濆吇璁板綍.doc')
+ // 鎵撳紑鏄庣粏寮规锛歟dit 濉啓/淇敼淇濆吇璁板綍锛寁iew 鏌ョ湅锛宺eview 瀹℃牳
+ handleForm(type, row) {
+ this.operationType = type
+ this.form = this.buildForm(row)
+ this.dialogVisible = true
+ this.$nextTick(() => {
+ if (this.$refs.modelForm) {
+ this.$refs.modelForm.clearValidate()
+ }
})
},
- // 鍒犻櫎
- deleteFun(id) {
- this.$confirm('姝ゆ搷浣滃皢姘镐箙鍒犻櫎璇ユ枃浠�, 鏄惁缁х画?', '鎻愮ず', {
+ buildForm(row) {
+ const form = {
+ id: row.recordId || null,
+ maintenancePlanDetailId: row.maintenancePlanDetailId,
+ deviceId: row.deviceId,
+ deviceName: row.deviceName,
+ specificationModel: row.specificationModel,
+ deviceNumber: row.deviceNumber,
+ storagePoint: row.storagePoint,
+ // 宸叉湁璁板綍鐢ㄨ褰曟棩鏈燂紱杩樻病璁板綍鏃堕粯璁や粖澶╋紝閬垮厤鎶婅鍒掓棩鏈熷綋鎴愬疄闄呬繚鍏绘棩鏈�
+ maintenanceDate: row.recordId
+ ? formatDateOnly(row.recordMaintenanceDate)
+ : dayjs().format('YYYY-MM-DD'),
+ maintenanceCycle: row.maintenanceCycle || row.maintenanceIntervals || '',
+ maintenanceUserId: row.maintenanceUserId || '',
+ maintenanceUserName: row.maintenanceUserName || '',
+ remark: row.recordRemark || '',
+ reviewRemark: '',
+ }
+ this.checkColumns.forEach(item => {
+ form[item.prop] = row[item.prop] || ''
+ })
+ return form
+ },
+ // 淇濆瓨淇濆吇璁板綍锛堟柊澧炴垨淇敼鍚庤繘鍏ュ緟瀹℃牳锛�
+ submitForm() {
+ this.$refs.modelForm.validate(valid => {
+ if (!valid) {
+ return
+ }
+ this.submitFormLoading = true
+ const payload = {
+ maintenancePlanDetailId: this.form.maintenancePlanDetailId,
+ deviceId: this.form.deviceId,
+ maintenanceDate: this.form.maintenanceDate,
+ maintenanceUserId: this.form.maintenanceUserId,
+ remark: this.form.remark,
+ }
+ if (this.form.id) {
+ payload.id = this.form.id
+ }
+ this.checkColumns.forEach(item => {
+ payload[item.prop] = this.form[item.prop]
+ })
+ addDeviceMaintenance(payload).then(res => {
+ this.submitFormLoading = false
+ if (res.code == 200) {
+ this.$message.success(this.form.id ? '淇敼鎴愬姛' : '淇濆瓨鎴愬姛')
+ this.dialogVisible = false
+ this.loadPlan()
+ }
+ }).catch(() => {
+ this.submitFormLoading = false
+ })
+ })
+ },
+ resetForm() {
+ this.dialogVisible = false
+ },
+ // 鏄庣粏-鍒犻櫎
+ deleteRow(row) {
+ this.$confirm('鍒犻櫎鍚庯紝璇ヨ鐨勪繚鍏昏褰曪紙鏈鏍告垨瀹℃牳涓嶉�氳繃锛変細涓�骞跺垹闄わ紝鏄惁缁х画?', '鎻愮ず', {
confirmButtonText: '纭畾',
cancelButtonText: '鍙栨秷',
type: 'warning'
}).then(() => {
- deleteMaintenancePlan({ maintenancePlanId: id }).then(res => {
+ deleteMaintenancePlanDetail({ maintenancePlanDetailId: row.maintenancePlanDetailId }).then(() => {
this.$message.success('鍒犻櫎鎴愬姛锛�');
- this.getYearTableDetailData();
+ // 鍒犲畬鍙兘鏄骞翠唤鏈�鍚庝竴鏉★紝閲嶆柊鍙栧勾浠斤紝绌哄勾浠戒細涓�骞舵竻鎺�
+ this.loadYearOptions(true)
});
}).catch(() => {
this.$message({
@@ -402,54 +426,174 @@
});
});
},
- // 鑾峰彇鎵�鏈夎澶�
- getEquipOptions() {
- this.equipOptions = []
- deviceScopeSearch({ status: 0 }).then(res => {
- if (res.code === 200 && res.data) {
- this.equipOptions = res.data.map(m => {
- m.value = m.managementNumber
- m.label = m.deviceName
- return m
- })
- }
- }).catch(error => {
- console.error(error)
+ // 瀵煎嚭
+ handleDownOne() {
+ this.outLoading = true
+ exportDeviceMaintenancePlan({ maintenancePlanId: this.planInfo.maintenancePlanId }).then(res => {
+ this.outLoading = false
+ saveBlobOrShowError(res, '璁惧淇濆吇璁″垝琛�.docx', 'application/msword')
+ }).catch(() => {
+ this.outLoading = false
})
},
- // 鑾峰彇璐熻矗浜轰俊鎭帴鍙�
- getUserList() {
- selectUserCondition().then(res => {
+ // 鎵撳紑淇濆吇璁板綍瀹℃牳寮规
+ handleReview(row) {
+ this.handleForm('review', row)
+ },
+ // 鎻愪氦瀹℃牳缁撴灉锛�1 閫氳繃锛�0 涓嶉�氳繃
+ submitReview(status) {
+ this.reviewLoading = true
+ reviewDeviceMaintenance({
+ maintenancePlanDetailId: this.form.maintenancePlanDetailId,
+ reviewStatus: status,
+ reviewRemark: this.form.reviewRemark,
+ }).then(res => {
+ this.reviewLoading = false
if (res.code == 200) {
- this.responsibleOptions = res.data
+ this.$message.success(status === 1 ? '瀹℃牳閫氳繃' : '瀹℃牳涓嶉�氳繃')
+ this.dialogVisible = false
+ // 瀹℃牳閫氳繃鍚庢槑缁嗕細褰掑埌瀹℃牳骞翠唤鐨勮鍒掞紝閲嶆柊鍙栧勾浠介伩鍏嶅仠鍦ㄤ笉瀛樺湪鐨勫勾浠�
+ this.loadYearOptions(true)
}
- });
- }
- },
- watch: {
- // 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊
- clickNodeVal(newVal) {
- if (newVal.value) {
- this.getYearTableDetailData();
- }
+ }).catch(() => {
+ this.reviewLoading = false
+ })
+ },
+ // 缁存姢浜轰笅鎷�
+ getUserList() {
+ selectUserCondition({ type: 2 }).then(res => {
+ if (res.code == 200) {
+ this.userOptions = res.data || []
+ }
+ })
},
},
computed: {
- ...mapGetters(["userId"]),
+ // 鏄惁宸插畬鎴愬鏍革紙閫氳繃/涓嶉�氳繃锛�
+ isAudited() {
+ return this.planInfo.status === 0 || this.planInfo.status === 1;
+ },
+ // 浠呯紪杈戠姸鎬佸彲濉啓琛ㄥ崟
+ isEdit() {
+ return this.operationType === 'edit'
+ },
+ // 鎸夎澶囨。妗堢殑淇濆吇鍛ㄦ湡锛堟湀锛夌敓鎴愬簳閮ㄨ鏄�
+ cycleNote() {
+ const months = parseInt((this.form && this.form.maintenanceCycle) || '', 10)
+ if (!months || months <= 0) {
+ return ''
+ }
+ if (months === 1) {
+ return '姝よ澶囩淮鎶や繚鍏绘瘡鏈� 1 娆°��'
+ }
+ if (months === 3) {
+ return '姝よ澶囩淮鎶や繚鍏绘瘡瀛e害 1 娆°��'
+ }
+ if (months === 6) {
+ return '姝よ澶囩淮鎶や繚鍏绘瘡鍗婂勾 1 娆°��'
+ }
+ if (months === 12) {
+ return '姝よ澶囩淮鎶や繚鍏绘瘡骞� 1 娆°��'
+ }
+ if (months % 12 === 0) {
+ return `姝よ澶囩淮鎶や繚鍏绘瘡 ${months / 12} 骞� 1 娆°�俙
+ }
+ return `姝よ澶囩淮鎶や繚鍏绘瘡 ${months} 涓湀 1 娆°�俙
+ },
+ dialogTitle() {
+ if (this.operationType === 'view') {
+ return '鏌ョ湅淇濆吇璁板綍'
+ }
+ if (this.operationType === 'review') {
+ return '淇濆吇璁板綍瀹℃牳'
+ }
+ return '缂栬緫淇濆吇璁板綍'
+ },
+ // 宸查�夌淮鎶や汉涓嶅湪褰撳墠浜哄憳鍒楄〃鏃惰ˉ涓�鏉★紝淇濊瘉涓嬫媺鑳芥樉绀哄鍚�
+ maintainerOptions() {
+ const list = this.userOptions.slice()
+ const form = this.form || {}
+ if (form.maintenanceUserId && !list.some(item => item.id === form.maintenanceUserId)) {
+ list.unshift({
+ id: form.maintenanceUserId,
+ name: form.maintenanceUserName || String(form.maintenanceUserId),
+ })
+ }
+ return list
+ },
},
}
</script>
<style scoped>
.title {
+ position: relative;
+ font-size: 16px;
+ color: var(--lims-text);
+ font-weight: 400;
+ padding-left: 10px;
+ margin-bottom: 10px;
+}
+
+.title::before {
+ position: absolute;
+ left: 0;
+ top: 4px;
+ content: '';
+ width: 4px;
+ height: 16px;
+ background-color: var(--el-color-primary);
+ border-radius: 2px;
+}
+
+.plan-top {
display: flex;
+ align-items: center;
justify-content: space-between;
+ flex-wrap: wrap;
+}
+
+.plan-top-left {
+ display: flex;
align-items: center;
}
-.title-search {
+.plan-info-bar {
display: flex;
align-items: center;
- margin: 10px 0;
+ flex-wrap: wrap;
+ gap: 32px;
+ background: #f5f7fa;
+ border-radius: 4px;
+ padding: 10px 16px;
+ margin-top: 14px;
+ font-size: 14px;
+ color: #606266;
+}
+
+.search {
+ display: flex;
+ justify-content: space-between;
+ margin-bottom: 10px;
+}
+
+.form-section-title {
+ font-size: 14px;
+ font-weight: 600;
+ color: var(--lims-text);
+ margin: 4px 0 16px;
+ padding-left: 8px;
+ border-left: 4px solid var(--el-color-primary);
+}
+
+.check-note {
+ font-size: 13px;
+ color: #909399;
+ line-height: 22px;
+ padding-left: 150px;
+}
+
+:deep(.red-row td) {
+ background: #ffcccc !important;
}
</style>
--
Gitblit v1.9.3