bonus-ui/src/views/toolsManage/toolsApprove/approveList.vue

214 lines
6.1 KiB
Vue

<template>
<!-- 基础页面 -->
<div class="app-container">
<el-card v-show="showSearch" style="margin-bottom: 20px">
<el-form :model="queryParams" ref="queryForm" size="small" inline @submit.native.prevent>
<el-col :span="5">
<el-form-item label="申请人" prop="createBy" label-width="64px">
<el-input
v-model="queryParams.createBy"
placeholder="请输入申请人"
clearable
@keyup.enter.native="handleQuery"
style="width: 240px"
/>
</el-form-item>
</el-col>
<!-- 日期范围 -->
<el-col :span="5">
<el-form-item label="申请日期">
<el-date-picker
v-model="timeRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
clearable
unlink-panels
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
style="width: 240px"
/>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="审批状态" prop="status">
<el-select
v-model="queryParams.status"
placeholder="请选择审批状态"
clearable
filterable
style="width: 240px"
>
<el-option v-for="item in statusList" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
</el-col>
<!-- 表单按钮 -->
<el-col :span="9" style="text-align: right;">
<el-form-item >
<el-button type="primary" icon="el-icon-search" @click="handleQuery">查询</el-button>
<el-button icon="el-icon-refresh" @click="handleReset">重置</el-button>
</el-form-item>
</el-col>
</el-form>
</el-card>
<el-card class="content-box">
<el-table
v-loading="isLoading"
:data="tableList"
highlight-current-row
border
stripe
height="546"
style="width: 100%"
>
<el-table-column
type="index"
width="55"
label="序号"
align="center"
:index="(index) => (queryParams.pageNum - 1) * queryParams.pageSize + index + 1"
/>
<el-table-column
v-for="(column, index) in tableColumns"
show-overflow-tooltip
:key="index"
:label="column.label"
:prop="column.prop"
align="center"
>
<!-- 插槽 -->
<template v-slot="{ row }" v-if="column.prop == 'status'">
<el-tag v-if="row.status == '1'" type="warning">审批中</el-tag>
<el-tag v-if="row.status == '2'" type="success">已审批</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" align="center">
<template slot-scope="{ row }">
<el-button v-if="row.status == 2" size="mini" type="text" icon="el-icon-zoom-in" @click="handleView(row)"
>查看</el-button
>
<el-button v-if="row.status == 1" size="mini" type="text" @click="handleApprove(row)">审核</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<pagination
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-card>
</div>
</template>
<script>
import { getListReviewApi } from '@/api/toolsManage'
export default {
name: 'ApproveList',
data() {
return {
isLoading: false,
showSearch: true,
timeRange: [],
queryParams: {
pageNum: 1,
pageSize: 10,
status: null,
createBy: null,
startTime: null,
endTime: null,
},
statusList: [
{ label: '审批中', value: '1' },
{ label: '已审批', value: '2' },
],
total: 0, // 总条数
// 表头
tableColumns: [
{ label: '录入单号', prop: 'code' },
{ label: '申请录入数量', prop: 'total' },
{ label: '申请人', prop: 'createBy' },
{ label: '申请时间', prop: 'createTime' },
{ label: '审批状态', prop: 'status' },
{ label: '已通过数量', prop: 'passed' },
{ label: '已驳回数量', prop: 'quantity' },
],
// 表格数据
tableList: [],
}
},
created() {
this.getList()
},
methods: {
// 查询
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
// 重置
handleReset() {
this.queryParams.pageNum = 1
this.queryParams.pageSize = 10
this.queryParams.parentId = '0'
this.queryParams.level = '1'
this.timeRange = []
this.$refs.queryForm.resetFields()
this.getList()
},
// 获取列表
async getList() {
console.log('列表-查询', this.queryParams)
this.isLoading = true
this.queryParams.startTime = this.timeRange && this.timeRange[0] ? this.timeRange[0] : null
this.queryParams.endTime = this.timeRange && this.timeRange[1] ? this.timeRange[1] : null
try {
const params = { ...this.queryParams }
const res = await getListReviewApi(params)
this.tableList = res.rows || []
this.total = res.total || 0
} catch (error) {
this.tableList = []
this.total = 0
} finally {
this.isLoading = false
}
},
// 查看
handleView(row) {
this.$router.push({ path: '/toolsManage/approveToolsDetails', query: { applyId: row.id, isView: true } })
},
// 审核
handleApprove(row) {
this.$router.push({ path: '/toolsManage/approveToolsDetails', query: { applyId: row.id } })
},
},
}
</script>
<style lang="scss" scoped>
.content-box {
border-radius: 8px;
height: calc(100vh - 220px);
display: flex;
flex-direction: column;
overflow: hidden;
::v-deep .el-card__body {
display: flex !important;
flex-direction: column !important;
height: 100% !important;
padding: 20px;
}
}
</style>