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

245 lines
6.8 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">
<template v-if="!isEquipmentInputShow">
<el-form :model="queryParams" ref="queryFormRef" inline label-width="auto" size="small">
<!-- 表单搜索 -->
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="keyWord">
<el-input
clearable
style="width: 100%"
placeholder="请输入关键字"
v-model.trim="queryParams.keyWord"
/>
</el-form-item>
</el-col>
<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="1" />
</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"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item prop="code">
<el-button class="primary-lease" type="primary" @click="onHandleSQuery()">
查询
</el-button>
<el-button class="primary-lease" type="primary" @click="onHandleReset()">
重置
</el-button>
<el-button
class="primary-lease"
type="primary"
@click="onHandleBatchImport()"
>
批量导入
</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 }">
<el-button type="primary" size="small" @click="onHandleView(row)">
查看
</el-button>
<el-button type="primary" size="small" @click="onHandleAuditing(row)">
审批
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
:total="total"
@pagination="handlePageChange"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
/>
</el-form>
</template>
<!-- <EquipmentInput :order-ids="orderIds" :is-view="isView" v-else @backList="onHandleBackList" />-->
</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-14 22:15:53 +08:00
export default {
2025-09-22 09:59:47 +08:00
components: {
/* EquipmentInput */
},
data() {
return {
total: 0,
orderIds: '',
isView: false,
isEquipmentInputShow: false,
queryParams: {
keyWord: '',
status: '0',
applyTime: '',
pageNum: 1,
pageSize: 10,
},
tableData: []
}
},
mounted() {
this.getEquipmentApplyList()
},
methods: {
// 获取装备申请列表
getEquipmentApplyList() {
getEquipmentApplyListApi(this.queryParams).then((res) => {
console.log('获取装备申请列表***', res)
this.tableData = res.data.rows
this.total = res.data.total
}).catch(error => {
console.error('获取装备申请列表失败:', error)
})
},
// 分页处理
handlePageChange(pageNum) {
this.queryParams.pageNum = pageNum
this.getEquipmentApplyList()
},
handleSizeChange(pageSize) {
this.queryParams.pageSize = pageSize
this.getEquipmentApplyList()
},
onHandleSQuery() {
console.log('查询')
this.getEquipmentApplyList()
},
onHandleReset() {
console.log('重置')
this.queryParams = {
keyWord: '',
status: '0',
applyTime: '',
pageNum: 1,
pageSize: 10,
}
this.$refs.queryFormRef.resetFields()
this.getEquipmentApplyList()
},
onHandleEquipmentInput() {
this.orderIds = ''
this.isView = false
this.isEquipmentInputShow = true
2025-09-14 22:15:53 +08:00
},
2025-09-22 09:59:47 +08:00
onHandleBatchImport() {
console.log('批量导入')
},
onHandleView(row) {
console.log('查看', row)
this.orderIds = row.id
this.isView = true
this.isEquipmentInputShow = true
},
onHandleAuditing(row) {
this.orderIds = row.id
this.isView = false
this.isEquipmentInputShow = true
console.log('审批', row)
},
onHandleDelete(row) {
this.$confirm('是否确定删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
console.log('删除', row)
equipmentDelApiNew({ id: row.id }).then((res) => {
console.log('删除结果', res)
if (res.code === 200) {
this.$message({
type: 'success',
message: '删除成功',
duration: 1000,
})
this.getEquipmentApplyList()
} else {
this.$message({
type: 'error',
message: '删除失败',
duration: 1000,
})
}
}).catch(error => {
console.error('删除失败:', error)
this.$message.error('删除失败,请重试')
})
}).catch(() => {
// 取消删除
})
2025-09-14 22:15:53 +08:00
},
2025-09-22 09:59:47 +08:00
onHandleBackList() {
this.isEquipmentInputShow = false
this.getEquipmentApplyList()
}
}
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>