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

238 lines
8.4 KiB
Vue

<template>
<!-- 业务办理审核 -- 领料审核 -->
<div class="app-container">
<el-form v-show="showSearch" :model="queryParams" ref="queryForm" size="small" inline>
<el-form-item label="申请日期" prop="timeRange">
<el-date-picker
clearable
type="daterange"
range-separator="至"
value-format="yyyy-MM-dd"
end-placeholder="结束日期"
start-placeholder="开始日期"
v-model="queryParams.timeRange"
/>
</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="taskStatus">
<el-select v-model="queryParams.taskStatus" 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
width="55"
type="index"
label="序号"
align="center"
:index="indexContinuation(queryParams.pageNum, queryParams.pageSize)"
/>
<el-table-column
align="center"
:key="column.prop"
:prop="column.prop"
:label="column.label"
show-overflow-tooltip
v-for="column in tableColumns"
>
<!-- 插槽 -->
<template v-slot="scope" v-if="column.prop == 'taskStatus'">
<el-tag v-if="scope.row.taskStatus == '0'" type="warning" size="mini">待审核</el-tag>
<el-tag v-else-if="scope.row.taskStatus == '1'" size="mini">审核中</el-tag>
<el-tag v-else-if="scope.row.taskStatus == '2'" type="success" size="mini">已完成</el-tag>
</template>
</el-table-column>
<!-- 操作 -->
<el-table-column label="操作" align="center" width="180">
<template slot-scope="scope">
<el-button
type="text"
size="mini"
icon="el-icon-edit"
v-if="auditingShow(scope.row)"
@click="handleAuditing(scope.row, 1)"
>
审核
</el-button>
<el-button
type="text"
size="mini"
icon="el-icon-search"
v-if="scope.row.taskStatus == 2"
@click="handleAuditing(scope.row, 2)"
>
查看
</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 { getReceiveApplyApi } from '@/api/receive-apply/index.js'
import { getLeaseTaskList, deleteLeaseTask } from '@/api/business/index'
export default {
data() {
return {
showSearch: true,
userId: '',
queryParams: {
pageNum: 1,
pageSize: 10,
keyWord: '', // 关键字
taskStatus: '', // 审核状态
timeRange: [] // 日期范围
},
// 考勤状态
statusOptions: [
{ label: '待审核', value: '1' },
{ label: '审核中', value: '2' },
{ label: '已完成', value: '3' }
],
total: 0, // 总条数
// 表头
tableColumns: [
{ label: '申请时间', prop: 'createTime' },
{ label: '申请人', prop: 'createBy' },
{ label: '领用单位', prop: 'leaseUnit' },
{ label: '领用工程', prop: 'leaseProject' },
{ label: '领料物资类型', prop: 'maTypeNames' },
{ label: '协议号', prop: 'agreementCode' },
{ label: '业务单号', prop: 'code' },
{ label: '领料人', prop: 'leasePerson' },
{ label: '领料人电话', prop: 'phone' },
{ label: '状态', prop: 'taskStatus' }
],
// 表格数据
tableList: []
}
},
created() {
this.userId = sessionStorage.getItem('userId')
this.getList()
},
methods: {
// 查询
handleQuery() {
this.getList()
},
// 重置
handleReset() {
this.queryParams.pageNum = 1
this.queryParams.pageSize = 10
this.$refs.queryForm.resetFields()
this.getList()
},
// 获取列表
async getList() {
try {
const params = {
...this.queryParams,
startTime: this.queryParams.timeRange[0] || '',
endTime: this.queryParams.timeRange[1] || ''
}
const res = await getReceiveApplyApi(params)
this.tableList = res.data.rows
this.total = res.data.total || 0
} catch (error) {
this.tableList = []
this.total = 0
}
},
// 多选
selectionChange(val) {
console.log('selectionChange', val)
},
handleAdd() {
console.log('领料申请')
this.$router.push({ path: '/business/businessHandling/index' })
},
// 审核按钮
handleAuditing(row, type) {
this.$router.push({
name: 'receive-apply-details',
query: {
id: row.id,
taskId: row.taskId,
type,
nodeId: row.nodeId
}
}) // 跳转审核详情页面
},
// 删除
handleDelete(row) {
console.log('删除', row)
this.$confirm('是否删除该数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
const res = await deleteLeaseTask(row.id)
console.log('🚀 ~ 删除 ~ res:', res)
this.getList()
this.$message({
type: 'success',
message: '删除成功!'
})
})
},
// 导出数据
handleExport() {
try {
let fileName = `数据_${new Date().getTime()}.xLsx`
let url = ''
const params = { ...this.queryParams }
console.log('🚀 ~ 导出 ~ params:', params)
// this.derive(url, params, fileName)
} catch (error) {
console.log('导出数据失败', error)
}
},
// 判断审核按钮显示隐藏
auditingShow(row) {
console.log('row.configValues', row.configValue)
if (row.configValue) {
return row.status != 1 && row.configValue.includes(this.userId)
}
}
}
}
</script>
<style lang="scss" scoped></style>