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/operationInstruction.vue | 86 +++++++++++++++++++++++++++---------------
1 files changed, 55 insertions(+), 31 deletions(-)
diff --git a/src/views/CNAS/resourceDemand/device/component/operationInstruction.vue b/src/views/CNAS/resourceDemand/device/component/operationInstruction.vue
index c373600..fbf1483 100644
--- a/src/views/CNAS/resourceDemand/device/component/operationInstruction.vue
+++ b/src/views/CNAS/resourceDemand/device/component/operationInstruction.vue
@@ -17,11 +17,12 @@
<el-table-column label="璁惧缂栧彿" min-width="150" prop="deviceNumber"></el-table-column>
<el-table-column label="璁惧鍨嬪彿" min-width="150" prop="deviceModel"></el-table-column>
<el-table-column label="鏂囦欢缂栧彿" min-width="150" prop="documentNumber"></el-table-column>
- <el-table-column label="鏂囦欢鍚嶅瓧" min-width="150" prop="fileName"></el-table-column>
+ <el-table-column label="鏂囦欢鍚嶇О" min-width="150" prop="fileName"></el-table-column>
<el-table-column label="鏂囨。璇存槑" min-width="150" prop="documentNote"></el-table-column>
<el-table-column label="涓婁紶浜�" min-width="150" prop="uploaderName"></el-table-column>
- <el-table-column label="涓婁紶鏃堕棿" min-width="150" prop="updateTime"></el-table-column>
- <el-table-column label="鐢熸晥鏃堕棿" min-width="150" prop="entryIntoForceTime"></el-table-column>
+ <el-table-column label="涓婁紶鏃堕棿" min-width="150" prop="updateTime" :formatter="formatDateCell"></el-table-column>
+ <el-table-column label="鐢熸晥鏃堕棿" min-width="150" prop="entryIntoForceTime"
+ :formatter="formatDateCell"></el-table-column>
<el-table-column label="瀹℃壒浜�" min-width="150" prop="approverName"></el-table-column>
<el-table-column label="瀹℃壒鐘舵��" min-width="150" prop="status">
<template v-slot="scope">
@@ -31,14 +32,16 @@
<el-table-column label="鎿嶄綔" min-width="180" fixed="right" prop="name">
<template v-slot="scope">
<el-button link type="primary" size="small" @click="downloadFile(scope.row.fileSystemName)">涓嬭浇</el-button>
- <el-button link type="primary" size="small" style="color: red;"
+ <el-button link type="primary" size="small" style="color: red;" :disabled="scope.row.status === true"
@click="deleteHomeworkGuidebook(scope.row)">鍒犻櫎</el-button>
- <el-button link type="primary" size="small" @click="instructionEditFun(scope.row)">缂栬緫</el-button>
- <el-button link type="primary" size="small" @click="approval(scope.row)">瀹℃壒</el-button>
+ <el-button link type="primary" size="small" :disabled="scope.row.status === true"
+ @click="instructionEditFun(scope.row)">缂栬緫</el-button>
+ <el-button link type="primary" size="small" :disabled="scope.row.status === true"
+ @click="approval(scope.row)">瀹℃壒</el-button>
</template>
</el-table-column>
</el-table>
- <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="1"
+ <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="search.current"
:page-sizes="[10, 20, 30, 50, 100]" :page-size="search.size" layout="->,total, sizes, prev, pager, next, jumper"
:total="search.total" background>
</el-pagination>
@@ -82,7 +85,7 @@
<el-table :data="documentTableData" border style="width: 100%;" tooltip-effect="dark" :row-key="getRowKey"
@selection-change="handleSelectionChange" height="29em">
- <el-table-column type="selection" width="55%">
+ <el-table-column type="selection" width="55">
</el-table-column>
<el-table-column label="搴忓彿" prop="id" type="index" width="60"></el-table-column>
<el-table-column label="璁惧鍚嶇О" prop="deviceName" show-overflow-tooltip min-width="125"></el-table-column>
@@ -91,7 +94,8 @@
<el-table-column label="鏂囨。缂栧彿" prop="documentNumber" show-overflow-tooltip min-width="125"></el-table-column>
<el-table-column label="鏂囦欢鍚嶇О" prop="fileName" show-overflow-tooltip min-width="125"></el-table-column>
<el-table-column label="涓婁紶浜�" prop="author" show-overflow-tooltip min-width="125"></el-table-column>
- <el-table-column label="涓婁紶鏃堕棿" prop="updateTime" show-overflow-tooltip min-width="125"></el-table-column>
+ <el-table-column label="涓婁紶鏃堕棿" prop="updateTime" show-overflow-tooltip min-width="125"
+ :formatter="formatDateCell"></el-table-column>
<el-table-column min-width="100" label="鎿嶄綔" fixed="right">
<template v-slot="scope">
<el-button link type="primary" size="small" @click="downloadFile(scope.row.fileSystemName)">涓嬭浇</el-button>
@@ -188,6 +192,7 @@
pageByPageQueryOfHomeworkInstructions,
selectDeviceParameter,
} from '@/api/cnas/resourceDemand/device.js'
+import { formatListDate } from './dateFormat'
export default {
props: {
clickNodeVal: {
@@ -266,6 +271,9 @@
}
},
methods: {
+ formatDateCell(row, column, cellValue) {
+ return formatListDate(cellValue)
+ },
approval(row) {
this.$confirm('鏄惁瀹℃壒閫氳繃锛�', '鎻愮ず', {
confirmButtonText: '閫氳繃',
@@ -273,8 +281,11 @@
type: 'warning'
}).then(() => {
this.approvalFun(row.id, true)
- }).catch(() => {
- this.approvalFun(row.id, false)
+ }).catch((action) => {
+ // 鍙湁鐐瑰嚮鈥滀笉閫氳繃鈥濇墠鎻愪氦椹冲洖锛岀偣鍙充笂瑙掑叧闂�/Esc 瑙嗕负鏀惧純鎿嶄綔
+ if (action === 'cancel') {
+ this.approvalFun(row.id, false)
+ }
});
},
approvalFun(id, status) {
@@ -329,9 +340,9 @@
homeworkGuidebookEditor({ instructionId: row.instructionId }).then(res => {
if (res.code == 200) {
this.instructionForm = res.data.instruction;
- if (this.instructionForm.fileSystemName) {
- this.fileList1.push({ name: this.instructionForm.fileName })
- }
+ this.fileList1 = this.instructionForm.fileSystemName
+ ? [{ name: this.instructionForm.fileName }]
+ : []
this.documentTableData = res.data.list;
// 鍒犻櫎鐢�
this.documentTableData.forEach((v, k) => {
@@ -402,6 +413,7 @@
this.$message.success('淇敼鎴愬姛');
console.log('this.documentTableData---edit', this.documentTableData[this.tableDataIndex])
} else {
+ this.form.index = this.getNextRowIndex();
this.documentTableData.push(this.form);
this.dialogVisible1 = false;
this.$message.success('娣诲姞鎴愬姛');
@@ -423,12 +435,17 @@
editFun(row, index) {
this.form = { ...row }
this.tableDataIndex = index;
- console.log('this.tableDataIndex', this.tableDataIndex)
- // 鍥炴樉鍒楄〃
+ // 鍥炴樉鍒楄〃鍓嶅厛娓呯┖锛岄伩鍏嶉噸澶嶆樉绀轰笂涓�娆$殑闄勪欢
+ this.fileList = []
if (this.form.fileSystemName) {
this.fileList.push({ name: this.form.fileName })
}
this.dialogVisible1 = true
+ },
+ getNextRowIndex() {
+ return this.documentTableData.reduce((max, item) => {
+ return typeof item.index === 'number' && item.index > max ? item.index : max
+ }, -1) + 1
},
closeDia() {
this.dialogVisible1 = false
@@ -443,22 +460,24 @@
this.$message.error('璇烽�夋嫨瑕佸垹闄ょ殑閫夐」');
return;
}
- // 鍒犻櫎淇濆瓨濂界殑鏁版嵁
- let ids = this.selectedRow
+ const selectedIndexes = this.selectedRow.map(item => item.index);
+ // 鍒犻櫎宸蹭繚瀛樼殑鏁版嵁锛涙湰娆℃柊鍔犮�佸皻鏈惤搴撶殑琛屾病鏈� id锛屼笉璋冩帴鍙�
+ const ids = this.selectedRow
.filter(item => item.id !== undefined)
.map(item => item.id).join(',');
- //鏈夐敊璇�
- const res = await deleteHomeworkGuidebook({ ids });
- if (res.code === 200) {
- // 鍒犻櫎瑙嗗浘鐨勬暟鎹�
- for (const resKey in this.selectedRow) {
- this.documentTableData = this.documentTableData.filter(item => item.index === this.selectedRow[resKey].index)
+ if (ids) {
+ const res = await deleteHomeworkGuidebook({ ids });
+ if (res.code !== 200) {
+ return;
}
- this.$message.success({
- message: '鍒犻櫎鎴愬姛',
- type: 'success'
- });
}
+ // 涓�娆℃�ц繃婊ゆ帀鎵�鏈夐�変腑琛岋紝淇濈暀鍏朵綑鏁版嵁
+ this.documentTableData = this.documentTableData.filter(item => !selectedIndexes.includes(item.index))
+ this.selectedRow = []
+ this.$message.success({
+ message: '鍒犻櫎鎴愬姛',
+ type: 'success'
+ });
},
onSuccess(response, file, fileList) {
this.form.fileName = file.name;
@@ -476,8 +495,8 @@
this.form.fileSystemName = ''
},
handleRemove1(file, fileList) {
- this.form.fileName = ''
- this.form.fileSystemName = ''
+ this.instructionForm.fileName = ''
+ this.instructionForm.fileSystemName = ''
},
beforeRemove(file) {
return this.$confirm(`纭畾绉婚櫎 ${file.name}锛焋)
@@ -486,7 +505,12 @@
this.$message.warning(`褰撳墠闄愬埗閫夋嫨 1 涓枃浠讹紝鏈閫夋嫨浜� ${files.length} 涓枃浠躲�俙);
},
getList() {
- pageByPageQueryOfHomeworkInstructions({ ...this.search }).then(res => {
+ const params = { ...this.search }
+ // 閫変腑鍏蜂綋璁惧鏃跺彧鏌ヨ璁惧鐨勪綔涓氭寚瀵间功
+ if (this.clickNodeVal && this.clickNodeVal.value) {
+ params.deviceId = this.clickNodeVal.value
+ }
+ pageByPageQueryOfHomeworkInstructions(params).then(res => {
if (res.code == 200) {
this.tableData = res.data.records;
this.search.total = res.data.total
--
Gitblit v1.9.3