bonus-ui/src/views/business-examine/direct-rotation-apply/index.vue

204 lines
7.5 KiB
Vue

<template>
<!-- 直转审核页面 -->
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" inline>
<el-form-item label="申请日期" prop="timeRange">
<el-date-picker
clearable
type="daterange"
v-model="timeRange"
range-separator="至"
format="yyyy-MM-dd"
style="width: 240px"
start-placeholder="开始日期"
end-placeholder="结束日期"
value-format="yyyy-MM-dd"
/>
</el-form-item>
<el-form-item label="关键字" prop="keyWord">
<el-input
clearable
placeholder="请输入关键字"
v-model="queryParams.keyWord"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="审核状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择审核状态" clearable>
<el-option
:key="item.value"
:label="item.label"
:value="item.value"
v-for="item in statusOptions"
/>
</el-select>
</el-form-item>
<!-- 表单按钮 -->
<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-form>
<el-table :data="tableList" fit highlight-current-row style="width: 100%">
<!-- 多选 -->
<!-- <el-table-column type="selection" width="55" align="center" @selection-change="selectionChange" /> -->
<el-table-column
type="index"
width="55"
label="序号"
align="center"
:index="indexContinuation(queryParams.pageNum, queryParams.pageSize)"
/>
<el-table-column
v-for="column in tableColumns"
:show-overflow-tooltip="column.showTooltip"
:key="column.prop"
:label="column.label"
:prop="column.prop"
:width="column.width"
align="center"
>
<!-- 插槽 -->
<template v-slot="scope" v-if="column.prop == 'flowStatus'">
<el-tag v-if="scope.row.flowStatus == '0'" type="warning" size="mini">待审核</el-tag>
<el-tag v-else-if="scope.row.flowStatus == '1'" size="mini">审核中</el-tag>
<el-tag v-else-if="scope.row.flowStatus == '2'" type="success" size="mini">已通过</el-tag>
<el-tag v-else-if="scope.row.flowStatus == '3'" type="error" size="mini">已驳回</el-tag>
</template>
</el-table-column>
<!-- 操作 -->
<el-table-column label="操作" align="center">
<template slot-scope="scope">
<el-button
type="text"
size="mini"
icon="el-icon-edit"
v-if="auditingShow(scope.row)"
@click="handleEdit(scope.row, 2)"
>
审核
</el-button>
<el-button
type="text"
size="mini"
icon="el-icon-search"
@click="handleEdit(scope.row, 1)"
v-if="scope.row.flowStatus == 2 || scope.row.flowStatus == 3"
>
查看
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<pagination
:total="total"
v-show="total > 0"
@pagination="getList"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
/>
</div>
</template>
<script>
import { getDirectAuditListApi } from '@/api/business/index'
export default {
name: 'Direct-rotation-apply',
data() {
return {
userId: '',
timeRange: [],
// 表格数据
tableList: [],
queryParams: {
pageNum: 1,
pageSize: 10,
keyWord: '', // 关键字
status: '' // 审核状态
},
// 状态
statusOptions: [
{ label: '待审核', value: '0' },
{ label: '审核中', value: '1' },
{ label: '已完成', value: '2' },
{ label: '已驳回', value: '3' }
],
total: 0, // 总条数
// 表头
tableColumns: [
{ label: '申请时间', prop: 'createTime', showToolTip: true, width: '100' },
{ label: '申请人', prop: 'leaseMan', showToolTip: true, width: '80' },
{ label: '转出单位', prop: 'backUnitName', showToolTip: false },
{ label: '转出工程', prop: 'backProName', showToolTip: false },
{ label: '转入单位', prop: 'leaseUnitName', showToolTip: false },
{ label: '转入工程', prop: 'leaseProName', showToolTip: false },
{ label: '状态', prop: 'flowStatus', showToolTip: true, width: '80' }
]
}
},
created() {
this.userId = sessionStorage.getItem('userId')
this.getList()
},
methods: {
// 查询
handleQuery() {
this.getList()
},
// 重置
handleReset() {
this.timeRange = []
this.queryParams.pageNum = 1
this.queryParams.pageSize = 10
this.$refs.queryForm.resetFields()
this.getList()
},
// 获取列表
async getList() {
try {
const params = {
...this.queryParams,
startTime: this.timeRange ? this.timeRange[0] : '',
endTime: this.timeRange ? this.timeRange[1] : ''
}
const res = await getDirectAuditListApi(params)
this.tableList = res.rows
this.total = res.total || 0
} catch (error) {
this.tableList = []
this.total = 0
}
},
// 多选
selectionChange(val) {},
// 编辑
handleEdit(row, type) {
// ----type---- 1. 查看 2. 审核
// 跳转审核详情页面
this.$router.push({
name: 'direct-rotation-apply',
query: {
id: row.id,
flowId: row.flowId,
taskId: row.taskId,
type: type === 1 ? 'detail' : 'edit',
nodeId: row.nodeId
}
})
},
// 判断审核按钮显示隐藏
auditingShow(row) {
if (row.configValue) {
return (row.flowStatus == 1 || row.flowStatus == 0) && row.configValue.includes(this.userId)
}
}
}
}
</script>