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/state.vue | 109 +++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 75 insertions(+), 34 deletions(-)
diff --git a/src/views/CNAS/resourceDemand/device/component/state.vue b/src/views/CNAS/resourceDemand/device/component/state.vue
index 15f53ba..b739fdf 100644
--- a/src/views/CNAS/resourceDemand/device/component/state.vue
+++ b/src/views/CNAS/resourceDemand/device/component/state.vue
@@ -13,7 +13,7 @@
</el-form-item>
</el-form>
<div>
- <el-button size="small" type="primary" @click="dialogVisible = true">鏂板缓</el-button>
+ <el-button size="small" type="primary" @click="handleAddClick">鏂板缓</el-button>
<el-button :loading="outLoading" size="small" type="primary" @click="handleDown">瀵煎嚭Excel</el-button>
</div>
</div>
@@ -33,7 +33,8 @@
</el-table-column>
<el-table-column label="鍋滅敤/鍚敤鐞嗙敱" min-width="180" prop="reason"></el-table-column>
<el-table-column label="鎻愪氦浜�" min-width="130" prop="createUser"></el-table-column>
- <el-table-column label="鎻愪氦鏃ユ湡" min-width="150" prop="createTime"></el-table-column>
+ <el-table-column label="鎻愪氦鏃ユ湡" min-width="150" prop="createTime"
+ :formatter="formatDateCell"></el-table-column>
<el-table-column label="褰撳墠鐘舵��" min-width="130" prop="currentState"></el-table-column>
<el-table-column label="褰撳墠璐d换浜�" min-width="180" prop="currentResponsible"></el-table-column>
<!-- 鎿嶄綔鎸夐挳 -->
@@ -45,7 +46,7 @@
</template>
</el-table-column>
</el-table>
- <el-pagination :current-page="1" :page-size="search.size" :page-sizes="[10, 20, 30, 50, 100]"
+ <el-pagination :current-page="search.current" :page-size="search.size" :page-sizes="[10, 20, 30, 50, 100]"
:total="search.total" layout="->,total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange"
@current-change="handleCurrentChange" background>
</el-pagination>
@@ -56,7 +57,7 @@
<el-step v-for="(v, i) in steps" :key="i" :title="v" style="cursor:pointer"
@click="choiceStep(i)"></el-step>
</el-steps>
- <el-form ref="form" :model="form" :rules="rules" label-width="130px">
+ <el-form ref="form" :model="form" :rules="rules" label-width="130px" :disabled="!canOperate">
<div v-show="currentStepClick === 0">
<el-card style="margin-top: 1em; height: 42vh; overflow-y: scroll;">
<!-- 鍗$墖 -->
@@ -220,10 +221,10 @@
</div>
</el-form>
<template #footer><span class="dialog-footer">
- <el-button v-if="currentStep !== 0 && currentStep !== 4" :loading="sumbitLoading1"
+ <el-button v-if="currentStep !== 0 && currentStep !== 4 && canOperate" :loading="sumbitLoading1"
@click="submitForm('3reject')">椹冲洖</el-button>
- <el-button v-if="currentStep === 0" :loading="sumbitLoading2" @click="submitForm('2save')">淇濆瓨</el-button>
- <el-button v-if="currentStep !== 4" :loading="sumbitLoading3" type="primary" @click="submitForm('1submit')">
+ <el-button v-if="currentStep === 0 && canOperate" :loading="sumbitLoading2" @click="submitForm('2save')">淇濆瓨</el-button>
+ <el-button v-if="currentStep !== 4 && canOperate" :loading="sumbitLoading3" type="primary" @click="submitForm('1submit')">
{{ currentStep === 0 ? '鎻愪氦' : '閫氳繃' }}
</el-button>
</span></template>
@@ -242,6 +243,8 @@
import { selectUserCondition } from "@/api/business/inspectionTask";
import { dateFormat } from '@/utils/date'
import { mapGetters } from "@/utils/store-compat";
+import { formatListDate } from './dateFormat'
+import { saveBlobOrShowError } from '@/utils/saveBlob'
export default {
props: {
clickNodeVal: {
@@ -258,6 +261,7 @@
return {
outLoading: false, // 瀵煎嚭loading
dialogVisible: false,
+ canOperate: true,
form: {},
currentStep: 0, // 姝ラ鏉℃樉绀虹鍑犳
currentStepClick: 0, // 鐐瑰嚮姝ラ鏉″彉鍖�
@@ -282,6 +286,9 @@
this.getDeviceStatePage(this.clickNodeVal.value)
},
methods: {
+ formatDateCell(row, column, cellValue) {
+ return formatListDate(cellValue)
+ },
// 鍒嗛〉
handleSizeChange(val) {
this.search.size = val
@@ -341,22 +348,40 @@
default:
break
}
- // 鑾峰彇褰撳墠鐜妭璐熻矗浜�
- switch (saveState === '3reject' ? this.currentStep - 1 : this.currentStep) {
- case 0:
- this.form.currentResponsible = this.form.submitOperatingPersonnel
- break
- case 1:
- this.form.currentResponsible = this.form.departmentOperatingPersonnel
- break
- case 2:
- this.form.currentResponsible = this.form.measuringRoomOperatingPersonnel
- break
- case 3:
- this.form.currentResponsible = this.form.approvalOperatingPersonnel
- break
- default:
- break
+ // 鑾峰彇褰撳墠鐜妭璐熻矗浜猴細椹冲洖鍥炲埌涓婁竴鐜妭鎿嶄綔浜猴紝淇濆瓨鐣欑粰鑷繁锛屾彁浜�/閫氳繃杩涘叆涓嬩竴鐜妭璐d换浜�
+ if (saveState === '3reject') {
+ switch (this.currentStep - 1) {
+ case 0:
+ this.form.currentResponsible = this.form.submitOperatingPersonnel
+ break
+ case 1:
+ this.form.currentResponsible = this.form.departmentOperatingPersonnel
+ break
+ case 2:
+ this.form.currentResponsible = this.form.measuringRoomOperatingPersonnel
+ break
+ default:
+ break
+ }
+ } else if (saveState === '2save') {
+ this.form.currentResponsible = this.form.submitOperatingPersonnel
+ } else {
+ switch (this.currentStep) {
+ case 0:
+ this.form.currentResponsible = this.form.submitNextPesponsible
+ break
+ case 1:
+ this.form.currentResponsible = this.form.departmentNextPesponsible
+ break
+ case 2:
+ this.form.currentResponsible = this.form.measuringRoomNextPesponsible
+ break
+ case 3:
+ this.form.currentResponsible = this.form.approvalNextPesponsible
+ break
+ default:
+ break
+ }
}
// 鑾峰彇褰撳墠鐘舵��
this.form.currentState = currentStepAction === 4 ? '鍏抽棴' : this.steps[currentStepAction]
@@ -406,24 +431,43 @@
}
})
},
+ // 鏂板缓
+ handleAddClick() {
+ this.canOperate = true
+ this.dialogVisible = true
+ },
// 鏌ョ湅
handleViewClick(row) {
this.form = { ...row }
// 濡傛灉绱㈠紩涓�6琛ㄧず鍏ㄩ儴閫氳繃
this.currentStep = this.steps.indexOf(this.form.currentState) === -1 ? 4 : this.steps.indexOf(this.form.currentState)
this.currentStepClick = this.currentStep === 4 ? 0 : this.currentStep
- this.$nextTick(() => {
- this.$refs['form'].clearValidate()
- })
+ this.applyPermission()
this.dialogVisible = true
+ this.$nextTick(() => {
+ this.$refs['form'] && this.$refs['form'].clearValidate()
+ })
+ },
+ // 闈炲綋鍓嶇幆鑺傝矗浠讳汉鍙厑璁告煡鐪�
+ applyPermission() {
+ if (this.currentStep === 4) {
+ this.canOperate = false
+ return
+ }
+ const responsible = this.form.currentResponsible
+ this.canOperate = !responsible || responsible === this.nickName
+ if (!this.canOperate) {
+ this.$message.warning('褰撳墠鐜妭璐d换浜轰负锛�' + responsible + '锛屾偍鍙兘鏌ョ湅')
+ }
},
// 瀵煎嚭
handleDownOne(row) {
this.outLoading = true
exportDeviceStatus({ deviceId: row.deviceId, processNumber: row.processNumber }).then(res => {
this.outLoading = false
- const blob = new Blob([res], { type: 'application/octet-stream' });
- this.$download.saveAs(blob, '璁惧鍋�/鍚敤.doc')
+ saveBlobOrShowError(res, '璁惧鍋�/鍚敤.doc', 'application/msword')
+ }).catch(() => {
+ this.outLoading = false
})
},
// 鍒犻櫎
@@ -454,9 +498,8 @@
processNumber: this.search.processNumber
}).then(res => {
this.outLoading = false
- const blob = new Blob([res], { type: 'application/octet-stream' });
- this.$download.saveAs(blob, '璁惧鍋滅敤/鍚敤.xlsx')
- }).finally(() => {
+ saveBlobOrShowError(res, '璁惧鍋滅敤/鍚敤.xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
+ }).catch(() => {
this.outLoading = false
})
},
@@ -482,8 +525,6 @@
// 鐩戝惉鐐瑰嚮el-tree鐨勬暟鎹紝杩涜鏁版嵁鍒锋柊
clickNodeVal(newVal) {
if (newVal.value) {
- this.componentData.entity.deviceId = this.clickNodeVal.value
- this.entityCopy = this.HaveJson(this.componentData.entity)
this.getDeviceStatePage(newVal.value)
}
},
@@ -494,7 +535,7 @@
this.closeLoading()
this.currentStep = 0 // 姝ラ鏉℃樉绀虹鍑犳
this.currentStepClick = 0 // 鐐瑰嚮姝ラ鏉″彉鍖�
- this.$refs['form'].clearValidate()
+ this.$refs['form'] && this.$refs['form'].clearValidate()
}
}
},
--
Gitblit v1.9.3