From 6ae6ee885f0acb59f4c8b2d2439fb58a0a345701 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期一, 19 十月 2026 16:29:14 +0800
Subject: [PATCH] feat: support formatted inspection values
---
src/views/CNAS/resourceDemand/device/component/accidentForm.vue | 39 +++++++++++++++++++++++++++++----------
1 files changed, 29 insertions(+), 10 deletions(-)
diff --git a/src/views/CNAS/resourceDemand/device/component/accidentForm.vue b/src/views/CNAS/resourceDemand/device/component/accidentForm.vue
index 12a8797..74524d7 100644
--- a/src/views/CNAS/resourceDemand/device/component/accidentForm.vue
+++ b/src/views/CNAS/resourceDemand/device/component/accidentForm.vue
@@ -9,7 +9,7 @@
<el-step title="鎶�鏈礋璐d汉鎰忚" @click="setStep(3)"></el-step>
<el-step title="涓讳换鎰忚" @click="setStep(4)"></el-step>
</el-steps>
- <el-form ref="modelForm" :model="form" :rules="rules" label-width="160px">
+ <el-form ref="modelForm" :model="form" :rules="rules" label-width="160px" :disabled="!canOperate">
<el-col v-if="showStep === 0" :span="12">
<el-form-item label="鍦扮偣锛�" prop="address">
<el-input v-model="form.address" :disabled="currentStep !== 0" clearable size="small"></el-input>
@@ -87,7 +87,7 @@
</el-form>
<template #footer><span class="dialog-footer">
<el-button @click="resetForm">鍙� 娑�</el-button>
- <el-button v-if="currentStep !== 5" :loading="submitFormLoading" type="primary" @click="submitForm">纭�
+ <el-button v-if="currentStep !== 5 && canOperate" :loading="submitFormLoading" type="primary" @click="submitForm">纭�
璁�</el-button>
</span></template>
</el-dialog>
@@ -96,21 +96,21 @@
<script>
import { selectUserCondition } from "@/api/business/inspectionTask";
+import { mapGetters } from "@/utils/store-compat";
import {
getDeviceAccidentReport,
addDeviceAccidentReport,
} from '@/api/cnas/resourceDemand/device.js'
-import draftSave from '@/mixins/draftSave'
export default {
name: "accident-form",
// import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
components: {},
- mixins: [draftSave],
data() {
// 杩欓噷瀛樻斁鏁版嵁
return {
dialogVisible: false,
submitFormLoading: false,
+ canOperate: true,
form: {
accidentReportId: '',
address: '',
@@ -147,22 +147,19 @@
// 鎵撳紑寮规
openDialog(id, deviceId) {
this.dialogVisible = true
+ this.canOperate = true
this.form.accidentReportId = id
this.form.deviceId = deviceId
this.getUserList()
if (this.form.accidentReportId) {
this.searchInfo()
- } else {
- this.draftRestore('accidentForm', 'form', this.form.deviceId, 'dialogVisible')
}
},
// 鏌ヨ璇︽儏
searchInfo() {
getDeviceAccidentReport({ accidentReportId: this.form.accidentReportId }).then(res => {
if (res.code === 200) {
- const id = this.form.accidentReportId
this.form = { ...res.data }
- this.draftRestore('accidentForm', 'form', id, 'dialogVisible')
if (res.data.isFinish === 0) {
if (this.form.assessorUserId) {
this.currentStep = 1
@@ -184,10 +181,30 @@
this.currentStep = 5
this.showStep = 4
}
+ this.applyPermission()
}
}).catch(error => {
console.error(error)
})
+ },
+ // 闈炲綋鍓嶇幆鑺傝矗浠讳汉鍙厑璁告煡鐪�
+ applyPermission() {
+ if (this.form.isFinish === 1 || this.currentStep >= 5) {
+ this.canOperate = false
+ return
+ }
+ const responsibleList = [
+ this.form.reportUser,
+ this.form.assessorUser,
+ this.form.departmentHeadUser,
+ this.form.technicalDirectorUser,
+ this.form.directorHeadUser,
+ ]
+ const responsible = responsibleList[this.currentStep]
+ this.canOperate = !responsible || responsible === this.nickName
+ if (!this.canOperate) {
+ this.$message.warning('褰撳墠鐜妭璐d换浜轰负锛�' + responsible + '锛屾偍鍙兘鏌ョ湅')
+ }
},
setStep(step) {
this.showStep = step
@@ -197,10 +214,10 @@
this.form.flowType = this.currentStep
this.$refs.modelForm.validate((valid) => {
if (valid) {
+ this.submitFormLoading = true
addDeviceAccidentReport(this.form).then(res => {
if (res.code == 200) {
this.$message.success('鏂板鎴愬姛')
- this.draftClear('accidentForm')
this.resetForm()
}
this.submitFormLoading = false
@@ -212,7 +229,6 @@
},
// 鍏抽棴寮规
resetForm() {
- this.draftStop('accidentForm')
this.dialogVisible = false
this.$emit('closeDialog')
},
@@ -222,6 +238,9 @@
})
},
},
+ computed: {
+ ...mapGetters(["nickName"]),
+ },
}
</script>
--
Gitblit v1.9.3