From c6e96cdb8b1cfb51e9a45bf86c38d1353e983127 Mon Sep 17 00:00:00 2001
From: 吴羡 <16976746+Xian-TT3@user.noreply.gitee.com>
Date: 星期一, 19 十月 2026 15:19:48 +0800
Subject: [PATCH] 设备模块业务完善及前序页面优化
---
src/views/CNAS/resourceDemand/device/component/applicationForm.vue | 42 ++++++++++++++++++++++++++++--------------
1 files changed, 28 insertions(+), 14 deletions(-)
diff --git a/src/views/CNAS/resourceDemand/device/component/applicationForm.vue b/src/views/CNAS/resourceDemand/device/component/applicationForm.vue
index 744f2ee..6adbb02 100644
--- a/src/views/CNAS/resourceDemand/device/component/applicationForm.vue
+++ b/src/views/CNAS/resourceDemand/device/component/applicationForm.vue
@@ -8,7 +8,7 @@
<el-step title="璁¢噺瀹ゆ剰瑙�" @click="setStep(2)"></el-step>
<el-step title="鎵瑰噯浜�" @click="setStep(3)"></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="unitName">
<el-input v-model="form.unitName" :disabled="currentStep !== 0" clearable size="small"></el-input>
@@ -102,7 +102,7 @@
</el-form>
<template #footer><span class="dialog-footer">
<el-button @click="resetForm">鍙� 娑�</el-button>
- <el-button v-if="currentStep !== 4" :loading="submitFormLoading" type="primary" @click="submitForm">纭�
+ <el-button v-if="currentStep !== 4 && canOperate" :loading="submitFormLoading" type="primary" @click="submitForm">纭�
璁�</el-button>
</span></template>
</el-dialog>
@@ -115,17 +115,17 @@
addDeviceExternalApply,
} from '@/api/cnas/resourceDemand/device.js'
import { selectUserCondition } from "@/api/business/inspectionTask";
-import draftSave from '@/mixins/draftSave'
+import { mapGetters } from "@/utils/store-compat";
export default {
name: "applicationForm",
// import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
components: {},
- mixins: [draftSave],
data() {
// 杩欓噷瀛樻斁鏁版嵁
return {
dialogVisible: false,
submitFormLoading: false,
+ canOperate: true,
form: {
externalApplyId: '',
unitName: '',
@@ -163,21 +163,17 @@
// 鎵撳紑寮规
openDialog(id) {
this.dialogVisible = true
+ this.canOperate = true
this.form.externalApplyId = id
this.getUserList()
if (this.form.externalApplyId) {
this.searchInfo()
- } else {
- this.$nextTick(() => {
- this.draftRestore('applicationForm', 'form', '', 'dialogVisible')
- })
}
},
// 鏌ヨ璇︽儏
searchInfo() {
getDeviceExternalApply({ externalApplyId: this.form.externalApplyId }).then(res => {
if (res.code === 200) {
- const externalApplyId = this.form.externalApplyId
this.form = { ...res.data }
if (res.data.isFinish === 0) {
if (this.form.departmentHeadUserId) {
@@ -196,13 +192,29 @@
this.currentStep = 4
this.showStep = 3
}
- this.$nextTick(() => {
- this.draftRestore('applicationForm', 'form', externalApplyId, 'dialogVisible')
- })
+ this.applyPermission()
}
}).catch(error => {
console.error(error)
})
+ },
+ // 闈炲綋鍓嶇幆鑺傝矗浠讳汉鍙厑璁告煡鐪�
+ applyPermission() {
+ if (this.form.isFinish === 1 || this.currentStep >= 4) {
+ this.canOperate = false
+ return
+ }
+ const responsibleList = [
+ this.form.applicantUser,
+ this.form.departmentHeadUser,
+ this.form.meteringRoomUser,
+ this.form.approverUser,
+ ]
+ const responsible = responsibleList[this.currentStep]
+ this.canOperate = !responsible || responsible === this.nickName
+ if (!this.canOperate) {
+ this.$message.warning('褰撳墠鐜妭璐d换浜轰负锛�' + responsible + '锛屾偍鍙兘鏌ョ湅')
+ }
},
setStep(step) {
this.showStep = step
@@ -212,10 +224,10 @@
this.form.flowType = this.currentStep
this.$refs.modelForm.validate((valid) => {
if (valid) {
+ this.submitFormLoading = true
addDeviceExternalApply(this.form).then(res => {
if (res.code == 200) {
this.$message.success('鏂板鎴愬姛')
- this.draftClear('applicationForm')
this.resetForm()
}
this.submitFormLoading = false
@@ -227,7 +239,6 @@
},
// 鍏抽棴寮规
resetForm() {
- this.draftStop('applicationForm')
this.dialogVisible = false
this.$emit('closeDialog')
},
@@ -237,6 +248,9 @@
})
},
},
+ computed: {
+ ...mapGetters(["nickName"]),
+ },
}
</script>
--
Gitblit v1.9.3