From 58a2fb721bc8e7bfa094ca493695b3d893b0a09c Mon Sep 17 00:00:00 2001
From: hayu <1604366271@qq.com>
Date: Sun, 16 Nov 2025 20:34:11 +0800
Subject: [PATCH] =?UTF-8?q?=E7=BB=B4=E4=BF=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/equipmentRepair/index.js | 8 +
.../repairApply/SelectToolDialog.vue | 40 ++---
.../equipmentRepair/repairApply/addRepair.vue | 151 ++++++++++++------
.../repairApply/repairList.vue | 20 +--
.../repairAudit/repairAuditList.vue | 8 +-
.../repairAudit/repairDetailsAudit.vue | 2 +-
6 files changed, 133 insertions(+), 96 deletions(-)
diff --git a/src/api/equipmentRepair/index.js b/src/api/equipmentRepair/index.js
index cee22a32..f42fd924 100644
--- a/src/api/equipmentRepair/index.js
+++ b/src/api/equipmentRepair/index.js
@@ -18,6 +18,14 @@ export const addRepairData = (data = {}) => {
})
}
+export const updateRepairData = (data = {}) => {
+ return request({
+ url: '/material-mall/repair/updateRepairData',
+ method: 'POST',
+ data: data,
+ })
+}
+
// 获取维修列表
export const getRepairList = (data) => {
return request({
diff --git a/src/views/equipmentRepair/repairApply/SelectToolDialog.vue b/src/views/equipmentRepair/repairApply/SelectToolDialog.vue
index aebf8cf4..bec770c4 100644
--- a/src/views/equipmentRepair/repairApply/SelectToolDialog.vue
+++ b/src/views/equipmentRepair/repairApply/SelectToolDialog.vue
@@ -38,7 +38,7 @@
:data="tableList"
border stripe
height="550px"
- :row-key="row => `${row.id}-${row.type}`"
+ :row-key="row => row.keyId"
@selection-change="handleSelectionChange"
>
@@ -95,29 +95,12 @@ export default {
},
methods: {
- openDialog(applyId, selectedRows = []) {
+ openDialog(applyId) {
this.applyId = applyId
this.visible = true
-
- // 初始化 selectedMap
- this.selectedMap.clear()
-
- // 添加数据到 selectedMap
- selectedRows.forEach(row => {
- if (row.keyId) {
- this.selectedMap.set(row.keyId, {
- ...row,
- repairNum: row.repairNum || (row.manageMode === '编码管理' ? 1 : 1)
- })
- }
- })
-
- this.getList()
+ this.getList() // 弹窗内部拉取完整数据并恢复勾选
},
-
-
-
setFixNumToTableList(row, val) {
const index = this.tableList.findIndex(x => x.keyId === row.keyId)
if (index !== -1) {
@@ -149,21 +132,26 @@ export default {
const rows = res.data || []
this.tableList = rows.map(item => {
- const selected = item.keyId ? this.selectedMap.get(item.keyId) : null
+ const key = item.keyId
+
+ const selected = this.selectedMap.get(key)
const isCodeManage = item.manageMode === "编码管理"
+
return {
...item,
+ keyId: key, // ⭐ 统一 row-key 与 selectedMap key
repairNum: selected ? selected.repairNum : isCodeManage ? 1 : ""
}
})
-
// 过滤 selectedMap,只保留 tableList 中存在的 keyId
const tableKeys = new Set(this.tableList.map(r => r.keyId))
Array.from(this.selectedMap.keys()).forEach(key => {
if (!tableKeys.has(key)) this.selectedMap.delete(key)
})
+ this.$nextTick(() => {
+ if (this.restoreSelection) this.restoreSelection()
+ })
- this.$nextTick(() => this.restoreSelection())
} finally {
this.loading = false
}
@@ -172,14 +160,12 @@ export default {
restoreSelection() {
if (!this.$refs.multipleTable) return
this.tableList.forEach(row => {
- if (row.keyId && this.selectedMap.has(row.keyId)) {
+ if (this.selectedMap.has(row.keyId)) {
this.$refs.multipleTable.toggleRowSelection(row, true)
}
})
},
-
-
handleQuery() {
this.getList()
},
@@ -194,7 +180,7 @@ export default {
if (row.keyId && !this.selectedMap.has(row.keyId)) {
this.selectedMap.set(row.keyId, { ...row })
}
- })
+ })
this.tableList.forEach(row => {
if (row.keyId && !selection.some(s => s.keyId === row.keyId)) {
diff --git a/src/views/equipmentRepair/repairApply/addRepair.vue b/src/views/equipmentRepair/repairApply/addRepair.vue
index 8756c6dc..4fdfad36 100644
--- a/src/views/equipmentRepair/repairApply/addRepair.vue
+++ b/src/views/equipmentRepair/repairApply/addRepair.vue
@@ -63,7 +63,7 @@
:on-success="handleFileSuccess2"
:auto-upload="true"
>
- 上传
+ 上传
+
+
+
+ {{ scope.row.status }}
+
+
+
-
+
删除
@@ -113,7 +124,7 @@
import { getListByApplyIdApi, deleteToolApi, updateToolApplyApi } from '@/api/toolsManage'
import SelectToolDialog from './SelectToolDialog.vue'
import { getToken } from "@/utils/auth";
-import {addRepairData} from "@/api/equipmentRepair";
+import {addRepairData, getRepairDetailsList, updateRepairData} from "@/api/equipmentRepair";
export default {
name: 'AddEditTools',
@@ -128,7 +139,7 @@ export default {
pageSize: 10,
parentTypeName: null,
typeName: null,
- manageType: null,
+ manageMode: null,
applyId: null,
},
typeList: [
@@ -150,12 +161,7 @@ export default {
{ label: '类目', prop: 'groupName' },
{ label: '名称', prop: 'typeName' },
{ label: '规格型号', prop: 'typeModelName' },
- {
- label: '管理模式',
- prop: 'manageType',
- width: '80',
- render: (h, { row }) => h('span', {}, row.manageType === '0' ? '数量管理' : '编码管理')
- },
+ { label: '管理模式', prop: 'manageMode' },
{ label: '设备编码', prop: 'code' },
{ label: '维修数量', prop: 'repairNum', width: 80 },
{
@@ -163,28 +169,28 @@ export default {
prop: 'isScrap',
width: '120',
render: (h, { row }) =>
- h('el-select', {
- props: { value: row.isScrap || '' },
- on: {
- input: val => {
- this.$set(row, 'isScrap', val)
+ h('el-select', {
+ props: {
+ value: row.isScrap || '',
+ disabled: row.status === '通过' // ⭐ 状态为“通过” → 不可操作
+ },
+ on: {
+ input: val => {
+ this.$set(row, 'isScrap', val)
- // === 新增:处理退役原因禁用/清空 ===
- if (val === '0') {
- // 选“是” → 清空并禁用退役原因
- this.$set(row, 'reasonVal', '')
- this.$set(row, 'reasonDisabled', true)
- } else {
- // 选“否” → 允许填写
- this.$set(row, 'reasonDisabled', false)
- }
+ if (val === '0') {
+ this.$set(row, 'reasonVal', '')
+ this.$set(row, 'reasonDisabled', true)
+ } else {
+ this.$set(row, 'reasonDisabled', false)
}
- },
- style: 'width: 90px'
- }, [
- h('el-option', { props: { label: '是', value: '0' } }),
- h('el-option', { props: { label: '否', value: '1' } }),
- ])
+ }
+ },
+ style: 'width: 90px'
+ }, [
+ h('el-option', { props: { label: '是', value: '0' } }),
+ h('el-option', { props: { label: '否', value: '1' } })
+ ])
},
{
label: '维修日期',
@@ -196,9 +202,12 @@ export default {
type: 'date',
placeholder: '选择日期',
format: 'yyyy-MM-dd',
- 'value-format': 'yyyy-MM-dd'
+ 'value-format': 'yyyy-MM-dd',
+ disabled: row.status === '通过' // ⭐ 禁用
+ },
+ on: {
+ input: val => this.$set(row, 'repairTime', val)
},
- on: { input: val => this.$set(row, 'repairTime', val) },
style: 'width: 140px'
})
},
@@ -207,17 +216,19 @@ export default {
prop: 'reasonVal',
width: '120',
render: (h, { row }) =>
- h('el-select', {
- props: {
- value: row.reasonVal || '',
- disabled: row.reasonDisabled === true // ⭐ 根据维修是否合格禁用
- },
- on: { input: val => this.$set(row, 'reasonVal', val) },
- style: 'width: 90px'
- }, [
- h('el-option', { props: { label: '人为', value: '人为' } }),
- h('el-option', { props: { label: '自然', value: '自然' } })
- ])
+ h('el-select', {
+ props: {
+ value: row.reasonVal || '',
+ disabled: row.reasonDisabled === true || row.status === '通过' // ⭐ 禁用条件合并
+ },
+ on: {
+ input: val => this.$set(row, 'reasonVal', val)
+ },
+ style: 'width: 90px'
+ }, [
+ h('el-option', { props: { label: '人为', value: '人为' } }),
+ h('el-option', { props: { label: '自然', value: '自然' } })
+ ])
},
]
}
@@ -225,10 +236,10 @@ export default {
created() {
this.routerParams = this.$route.query
let title = '新增维修'
- if (this.routerParams.isView) title = '查看工具'
- else if (this.routerParams.isEdit) title = '编辑工具'
+ if (this.routerParams.isView) title = '维修查看'
+ else if (this.routerParams.isEdit) title = '维修编辑'
- this.queryParams.applyId = this.routerParams.applyId || ''
+ this.queryParams.id = this.routerParams.applyId || ''
const obj = Object.assign({}, this.$route, { title })
this.$tab.updatePage(obj)
this.getList()
@@ -253,6 +264,8 @@ export default {
if (!targetRow.bmFileInfos) {
this.$set(targetRow, 'bmFileInfos', [])
}
+ //先清空bmFileInfos
+ targetRow.bmFileInfos=[]
// 将文件对象添加到 bmFileInfos 中
targetRow.bmFileInfos.push(obj)
this.$message.success('文件上传成功')
@@ -287,7 +300,12 @@ export default {
const file = row.bmFileInfos[row.bmFileInfos.length - 1]
console.log('预览文件:', file)
this.dialogImageUrl = file.fileUrl.replaceAll('#', '%23')
- const parts = file.fileName.split('.')
+ // 从URL中提取文件名
+ const urlParts = file.fileUrl.split('/');
+ const fileNameWithParams = urlParts[urlParts.length - 1];
+ // 去除URL参数,获取纯文件名
+ const fileName = fileNameWithParams.split('?')[0];
+ const parts = fileName.split('.')
const extension = parts.pop().toLowerCase()
if (['doc', 'docx', 'pdf'].includes(extension)) {
const windowName = file.fileName
@@ -304,10 +322,31 @@ export default {
async getList() {
this.isLoading = true
try {
- const res = await getListByApplyIdApi({ ...this.queryParams })
- this.tableList = res.rows || []
- this.total = res.total || 0
- } finally { this.isLoading = false }
+ const res = await getRepairDetailsList({ ...this.queryParams })
+ this.tableList = res.data || []
+
+ /** ⭐ 获取列表后同步给弹窗的 selectedMap **/
+ if (this.$refs.addNum && this.$refs.addNum.selectedMap) {
+ const dialog = this.$refs.addNum
+ // 清空旧的
+ dialog.selectedMap.clear()
+ // 将 tableList 里的所有 keyId 放入 selectedMap
+ this.tableList.forEach(row => {
+ dialog.selectedMap.set(row.keyId, row)
+ })
+ // 如果弹窗内还有 tableList,需要保持一致
+ dialog.tableList = [...this.tableList]
+
+ // 让弹窗恢复勾选状态(如果有 restoreSelection 方法)
+ dialog.$nextTick(() => {
+ if (dialog.restoreSelection) dialog.restoreSelection()
+ })
+ }
+
+ this.total = this.tableList.length
+ } finally {
+ this.isLoading = false
+ }
},
handleDelete(row) {
this.$confirm('确定删除该条数据?', '提示', { type: 'warning' }).then(() => {
@@ -322,7 +361,7 @@ export default {
this.$message.success('删除成功')
})
},
- handleNumDialog() { if (this.$refs.addNum) this.$refs.addNum.openDialog(this.queryParams.applyId, this.tableList) },
+ handleNumDialog() { if (this.$refs.addNum) this.$refs.addNum.openDialog(this.queryParams.applyId) },
handleAddFromDialog(rows) {
if (!rows || rows.length === 0) return
const existingKeys = new Set(this.tableList.map(item => item.keyId))
@@ -359,6 +398,7 @@ export default {
}
const payload = {
+ changeId:this.routerParams.applyId,
toBeRepairList: this.tableList
}
@@ -366,7 +406,12 @@ export default {
this.isLoading = true
try {
- const res = await addRepairData(payload)
+ let res;
+ if (this.routerParams.isEdit){
+ res = await updateRepairData(payload)
+ } else {
+ res = await addRepairData(payload)
+ }
if (res.code ==200){
this.$message.success('操作成功!')
this.$tab.closeOpenPage({ path: './repairList' })
diff --git a/src/views/equipmentRepair/repairApply/repairList.vue b/src/views/equipmentRepair/repairApply/repairList.vue
index 5600d3a6..8aa2e8d8 100644
--- a/src/views/equipmentRepair/repairApply/repairList.vue
+++ b/src/views/equipmentRepair/repairApply/repairList.vue
@@ -72,18 +72,12 @@
:prop="column.prop"
align="center"
>
-
-
-
-
-
-
- 查看
- 编辑
- 查看
+ 编辑
+ 删除
@@ -122,9 +116,11 @@ export default {
endTime: null,
},
statusList: [
+ { label: '待审核', value: '待审核' },
{ label: '审核中', value: '审核中' },
- { label: '已审核', value: '已审核' },
- { label: '已驳回', value: '已驳回' },
+ { label: '驳回待处理', value: '驳回待处理' },
+ { label: '全部通过', value: '全部通过' },
+ { label: '全部驳回', value: '全部驳回' },
],
total: 0, // 总条数
// 表头
@@ -185,7 +181,7 @@ export default {
},
// 编辑
handleEdit(row) {
- this.$router.push({ path: '/toolsManage/addTools', query: { applyId: row.id, isEdit: true } })
+ this.$router.push({ path: './addRepair', query: { applyId: row.id, isEdit: true } })
},
// 删除
handleDelete(row) {
diff --git a/src/views/equipmentRepair/repairAudit/repairAuditList.vue b/src/views/equipmentRepair/repairAudit/repairAuditList.vue
index 64b84ec6..1282286e 100644
--- a/src/views/equipmentRepair/repairAudit/repairAuditList.vue
+++ b/src/views/equipmentRepair/repairAudit/repairAuditList.vue
@@ -72,7 +72,7 @@
查看
- 审核
+ 审核
@@ -109,9 +109,11 @@ export default {
endTime: null,
},
statusList: [
+ { label: '待审核', value: '待审核' },
{ label: '审核中', value: '审核中' },
- { label: '已审核', value: '已审核' },
- { label: '已驳回', value: '已驳回' },
+ { label: '驳回待处理', value: '驳回待处理' },
+ { label: '全部通过', value: '全部通过' },
+ { label: '全部驳回', value: '全部驳回' },
],
total: 0, // 总条数
// 表头
diff --git a/src/views/equipmentRepair/repairAudit/repairDetailsAudit.vue b/src/views/equipmentRepair/repairAudit/repairDetailsAudit.vue
index 83c15c88..4d72bf09 100644
--- a/src/views/equipmentRepair/repairAudit/repairDetailsAudit.vue
+++ b/src/views/equipmentRepair/repairAudit/repairDetailsAudit.vue
@@ -188,7 +188,7 @@ export default {
if (res.code == 200) {
this.$message.success('通过成功!')
} else {
- this.$message.error(res.msg || '通过失败')
+ this.$message.error(res.msg)
}
} catch (error) {
this.$message.error('通过失败')