This commit is contained in:
hayu 2025-11-16 00:52:02 +08:00
parent 2136e199fe
commit a8ed93b1c8
6 changed files with 97 additions and 19 deletions

View File

@ -44,3 +44,12 @@ export const deleteRepairList = (data) => {
data: data,
})
}
//审核
export const auditData = (data = {}) => {
return request({
url: '/material-mall/repair/auditData',
method: 'POST',
data: data,
})
}

View File

@ -336,6 +336,9 @@ export default {
this.total = this.tableList.length
},
submit() {
if (this.tableList.length <= 0) {
return this.$message.warning(`请先添加数据`)
}
this.$confirm('是否确定提交申请?', '提示', { type: 'warning' }).then(async () => {
//
for (const row of this.tableList) {

View File

@ -122,9 +122,9 @@ export default {
endTime: null,
},
statusList: [
{ label: '审批中', value: '0' },
{ label: '已通过', value: '1' },
{ label: '已驳回', value: '2' },
{ label: '审核中', value: '审核中' },
{ label: '已审核', value: '已审核' },
{ label: '已驳回', value: '已驳回' },
],
total: 0, //
//

View File

@ -59,6 +59,16 @@
<span v-else></span>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status" width="90">
<template #default="scope">
<el-tag
:type="scope.row.status === '通过' ? 'success' : scope.row.status === '驳回' ? 'danger' : 'warning'"
size="small"
>
{{ scope.row.status }}
</el-tag>
</template>
</el-table-column>
</el-table>
</el-card>

View File

@ -109,9 +109,9 @@ export default {
endTime: null,
},
statusList: [
{ label: '审批中', value: '0' },
{ label: '已通过', value: '1' },
{ label: '已驳回', value: '2' },
{ label: '审核中', value: '审核中' },
{ label: '已审核', value: '已审核' },
{ label: '已驳回', value: '已驳回' },
],
total: 0, //
//

View File

@ -27,6 +27,7 @@
type="selection"
width="55"
align="center"
:selectable="checkSelectable"
/>
<!-- 序号列 -->
@ -71,7 +72,16 @@
<span v-else></span>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status" width="90">
<template #default="scope">
<el-tag
:type="scope.row.status === '通过' ? 'success' : scope.row.status === '驳回' ? 'danger' : 'warning'"
size="small"
>
{{ scope.row.status }}
</el-tag>
</template>
</el-table-column>
</el-table>
</el-card>
@ -83,7 +93,7 @@
</template>
<script>
import { getRepairDetailsList } from "@/api/equipmentRepair";
import {addRepairData, auditData, getRepairDetailsList} from "@/api/equipmentRepair";
export default {
name: 'ViewRepairListNoPagination',
@ -149,6 +159,10 @@ export default {
try {
const res = await getRepairDetailsList({ ...this.queryParams })
this.tableList = res.data || []
//
this.tableList.forEach(item => {
if (!item.auditStatus) item.auditStatus = ''
})
} finally {
this.isLoading = false
}
@ -156,23 +170,65 @@ export default {
handleSelectionChange(val) {
this.selectedRows = val
},
handleApprove() {
if (this.selectedRows.length === 0) {
this.$message.warning('请至少选择一条数据')
return
}
// TODO:
console.log('通过的行:', this.selectedRows)
this.$message.success('已通过选中数据')
checkSelectable(row) {
//
return row.status === '待审核'
},
handleReject() {
async handleApprove() {
if (this.selectedRows.length === 0) {
this.$message.warning('请至少选择一条数据')
return
}
// TODO:
this.selectedRows.forEach(row => {
row.auditStatus = '1'
})
this.tableList = [...this.tableList]
console.log('通过的行:', this.selectedRows)
const payload = {
toBeRepairList: this.selectedRows
}
this.isLoading = true
try {
const res = await auditData(payload)
if (res.code == 200) {
this.$message.success('通过成功!')
} else {
this.$message.error(res.msg || '通过失败')
}
} catch (error) {
this.$message.error('通过失败')
} finally {
this.isLoading = false
this.getList()
}
},
async handleReject() {
if (this.selectedRows.length === 0) {
this.$message.warning('请至少选择一条数据')
return
}
this.selectedRows.forEach(row => {
row.auditStatus = '2'
})
this.tableList = [...this.tableList]
console.log('驳回的行:', this.selectedRows)
this.$message.error('已驳回选中数据')
const payload = {
toBeRepairList: this.selectedRows
}
this.isLoading = true
try {
const res = await auditData(payload)
if (res.code == 200) {
this.$message.success('驳回成功!')
} else {
this.$message.error(res.msg || '驳回失败')
}
} catch (error) {
this.$message.error('驳回失败')
} finally {
this.isLoading = false
this.getList()
}
},
//
picturePreview(row) {