bonus-ui/src/views/EquipmentEntryApply/index.vue

219 lines
6.0 KiB
Vue
Raw Normal View History

2025-09-14 22:15:53 +08:00
<template>
2025-09-22 09:59:47 +08:00
<div class="app-container">
2025-09-22 18:52:41 +08:00
<template>
<el-form
:model="queryParams"
ref="queryFormRef"
inline
label-width="auto"
size="small"
>
2025-09-22 09:59:47 +08:00
<!-- 表单搜索 -->
2025-09-14 22:15:53 +08:00
<el-row>
2025-09-22 09:59:47 +08:00
<el-col :span="5">
<el-form-item label="审批状态" prop="status">
<el-select
clearable
style="width: 100%"
placeholder="请选择审批状态"
v-model="queryParams.status"
>
<el-option label="待审批" value="0"/>
<el-option label="已审批" value="2"/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="申请时间" prop="applyTime">
<el-date-picker
type="date"
style="width: 100%"
value-format="YYYY-MM-DD"
placeholder="请选择申请时间"
v-model="queryParams.applyTime"
2025-09-22 18:52:41 +08:00
/>
2025-09-22 09:59:47 +08:00
</el-form-item>
</el-col>
2025-09-22 18:52:41 +08:00
<el-col :span="5" style="float:right;">
<el-form-item>
<el-button class="primary-lease" type="primary" @click="getEquipmentApplyList">
2025-09-22 09:59:47 +08:00
查询
</el-button>
2025-09-22 18:52:41 +08:00
<el-button class="primary-lease" type="primary" @click="resetForm">
2025-09-22 09:59:47 +08:00
重置
</el-button>
<el-button
class="primary-lease"
type="primary"
2025-09-22 18:52:41 +08:00
@click="showEquipmentInput()"
2025-09-22 09:59:47 +08:00
>
装备录入
</el-button>
</el-form-item>
</el-col>
2025-09-14 22:15:53 +08:00
</el-row>
2025-09-22 09:59:47 +08:00
<!-- 表格 -->
<el-table :data="tableData">
<el-table-column label="序号" align="center" width="55" type="index"/>
<el-table-column prop="createUser" label="申请人" align="center"/>
<el-table-column prop="createTime" label="申请时间" align="center"/>
<el-table-column prop="devCount" label="设备数量" align="center"/>
<el-table-column prop="status" align="center" label="审批状态">
<template slot-scope="{ row }">
<el-tag v-if="row.status == 0" size="small" type="info">待审批</el-tag>
<el-tag v-if="row.status == 1" size="small" type="warning">已审批</el-tag>
<el-tag v-if="row.status == 3" size="small" type="success">草稿</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="{ row }">
2025-09-22 18:52:41 +08:00
<el-button type="primary" size="small" @click="showEquipmentInput(row.id, true)">
2025-09-22 09:59:47 +08:00
查看
</el-button>
<el-button
type="primary"
size="small"
2025-09-22 18:52:41 +08:00
@click="showEquipmentInput(row.id, false)"
v-if="row.status == '3'"
2025-09-22 09:59:47 +08:00
>
编辑
</el-button>
2025-09-22 18:52:41 +08:00
<!-- <el-button type="primary" size="small" v-if="row.status == '0'" @click="deleteItem(row)">
2025-09-22 09:59:47 +08:00
删除
2025-09-22 18:52:41 +08:00
</el-button>-->
2025-09-22 09:59:47 +08:00
</template>
</el-table-column>
</el-table>
2025-09-22 18:52:41 +08:00
<!-- 分页 -->
2025-09-22 09:59:47 +08:00
<pagination
:total="total"
@pagination="handlePageChange"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
/>
</el-form>
</template>
2025-09-22 18:52:41 +08:00
<EquipmentEntryDialog
:is-visible.sync="isVisible"
:order-id="orderId"
:is-add-visible="isAddVisible"
:is-approval-visible="true"
@submit="getEquipmentApplyList"
/>
2025-09-22 09:59:47 +08:00
</div>
2025-09-14 22:15:53 +08:00
</template>
<script>
2025-09-22 09:59:47 +08:00
import { getEquipmentApplyListApi, equipmentDelApiNew } from '@/api/EquipmentEntryApply/index'
2025-09-22 18:52:41 +08:00
import EquipmentEntryDialog from '@/views/EquipmentEntryApply/equipmentInput/index1.vue'
2025-09-22 09:59:47 +08:00
2025-09-14 22:15:53 +08:00
export default {
2025-09-22 09:59:47 +08:00
components: {
2025-09-22 18:52:41 +08:00
EquipmentEntryDialog
2025-09-22 09:59:47 +08:00
},
data() {
return {
total: 0,
2025-09-22 18:52:41 +08:00
orderId: '',
isVisible: false,
isAddVisible: false,
2025-09-22 09:59:47 +08:00
queryParams: {
status: '',
applyTime: '',
pageNum: 1,
pageSize: 10
},
tableData: []
}
},
mounted() {
this.getEquipmentApplyList()
},
methods: {
2025-09-22 18:52:41 +08:00
/**
* 获取装备申请列表
*/
2025-09-22 09:59:47 +08:00
getEquipmentApplyList() {
2025-09-22 18:52:41 +08:00
getEquipmentApplyListApi(this.queryParams)
.then(res => {
this.tableData = res.data.rows
this.total = res.data.total
})
.catch(error => {
console.error('获取装备申请列表失败:', error)
})
2025-09-22 09:59:47 +08:00
},
2025-09-22 18:52:41 +08:00
/**
* 分页变化处理
*/
handlePageChange() {
2025-09-22 09:59:47 +08:00
this.getEquipmentApplyList()
2025-09-14 22:15:53 +08:00
},
2025-09-22 09:59:47 +08:00
2025-09-22 18:52:41 +08:00
/**
* 重置表单
*/
resetForm() {
2025-09-22 09:59:47 +08:00
this.$refs.queryFormRef.resetFields()
2025-09-22 18:52:41 +08:00
this.queryParams.pageNum = 1
2025-09-22 09:59:47 +08:00
this.getEquipmentApplyList()
2025-09-14 22:15:53 +08:00
},
2025-09-22 09:59:47 +08:00
2025-09-22 18:52:41 +08:00
/**
* 显示装备录入/编辑/查看界面
*/
showEquipmentInput(orderId, isAddVisible) {
this.orderId = orderId
this.isVisible = true
this.isAddVisible = isAddVisible
2025-09-22 09:59:47 +08:00
},
2025-09-22 18:52:41 +08:00
/**
* 删除项目
*/
deleteItem(row) {
2025-09-22 09:59:47 +08:00
this.$confirm('是否确定删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
2025-09-22 18:52:41 +08:00
})
.then(() => equipmentDelApiNew({ id: row.id }))
.then(res => {
2025-09-22 09:59:47 +08:00
if (res.code === 200) {
2025-09-22 18:52:41 +08:00
this.$message.success('删除成功')
2025-09-22 09:59:47 +08:00
this.getEquipmentApplyList()
} else {
2025-09-22 18:52:41 +08:00
this.$message.error('删除失败')
}
})
.catch(error => {
if (error !== 'cancel') { // 排除取消操作的错误
console.error('删除失败:', error)
this.$message.error('删除失败,请重试')
2025-09-22 09:59:47 +08:00
}
})
}
2025-09-22 18:52:41 +08:00
2025-09-22 09:59:47 +08:00
}
2025-09-14 22:15:53 +08:00
}
</script>
2025-09-22 09:59:47 +08:00
<style scoped lang="scss">
.app-container {
padding: 20px;
}
::v-deep .el-pagination {
margin-top: 15px;
text-align: right;
}
::v-deep .el-button {
margin-right: 8px;
}
</style>