307 lines
10 KiB
Vue
307 lines
10 KiB
Vue
<template>
|
|
<!-- 基础页面 -->
|
|
<div class="app-container">
|
|
<el-card v-show="showSearch" style="margin-bottom: 20px">
|
|
<el-form :model="queryParams" ref="queryForm" inline label-width="auto">
|
|
<el-form-item label="需求单位" prop="useUnit">
|
|
<el-select
|
|
v-model="queryParams.useUnit"
|
|
placeholder="请选择需求单位"
|
|
clearable
|
|
filterable
|
|
style="width: 240px"
|
|
>
|
|
<el-option
|
|
v-for="item in propertyUnitList"
|
|
:key="item.id"
|
|
:label="item.label"
|
|
:value="item.id"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="项目名称" prop="proCode">
|
|
<el-select
|
|
style="width: 240px"
|
|
clearable
|
|
filterable
|
|
placeholder="请选择项目名称"
|
|
popper-class="my-select-dropdown"
|
|
v-model="queryParams.proCode"
|
|
>
|
|
<el-option
|
|
:key="item.proCode"
|
|
:label="item.proName"
|
|
:value="item.proCode"
|
|
v-for="item in useProjectList"
|
|
>
|
|
<el-tooltip
|
|
effect="dark"
|
|
:content="item.proName"
|
|
placement="right"
|
|
>
|
|
<span class="option-text">{{ item.proName }}</span>
|
|
</el-tooltip>
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
|
|
<el-form-item label="任务状态" prop="taskStatus">
|
|
<el-select
|
|
v-model="queryParams.taskStatus"
|
|
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-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-form-item style="float: right">
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">查询</el-button>
|
|
<el-button icon="el-icon-refresh" size="mini" @click="handleReset">重置</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-card>
|
|
|
|
<el-card>
|
|
<el-row :gutter="10" class="mb8" justify="end">
|
|
<el-col :span="4">
|
|
<span style="font-size: 20px; font-weight: 800">退库申请列表</span>
|
|
</el-col>
|
|
<el-col :span="20" style="display: flex; justify-content: flex-end">
|
|
<el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd">新建申请</el-button>
|
|
</el-col>
|
|
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" /> -->
|
|
</el-row>
|
|
|
|
<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 label="退库单号" align="center" prop="code" :show-overflow-tooltip="true"/>
|
|
<el-table-column label="需求单位" align="center" prop="useUnit" :show-overflow-tooltip="true"/>
|
|
|
|
<el-table-column label="项目名称" align="center" prop="proName" :show-overflow-tooltip="true"/>
|
|
<el-table-column label="退库装备数" align="center" prop="devNum" :show-overflow-tooltip="true" width="120px"/>
|
|
<el-table-column label="退库工具数" align="center" prop="toolNum" :show-overflow-tooltip="true"/>
|
|
<el-table-column label="任务状态" align="center" prop="taskStatus" :show-overflow-tooltip="true">
|
|
<template slot-scope="scope">
|
|
<el-tag v-if="scope.row.taskStatus == '0'" type="info" @click="openDialog(scope.row)" style="cursor: pointer">待审批</el-tag>
|
|
<el-tag v-if="scope.row.taskStatus == '1'" type="warning" @click="openDialog(scope.row)" style="cursor: pointer">审批中</el-tag>
|
|
<el-tag v-if="scope.row.taskStatus == '2'" type="success" @click="openDialog(scope.row)" style="cursor: pointer">已审批</el-tag>
|
|
<el-tag v-if="scope.row.taskStatus == '3'" type="danger" @click="openDialog(scope.row)" style="cursor: pointer">审批驳回</el-tag>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="申请人" align="center" prop="createBy" :show-overflow-tooltip="true" width="140px"/>
|
|
<el-table-column label="申请时间" align="center" prop="createTime" width="160px"/>
|
|
<el-table-column label="操作" align="center">
|
|
<template slot-scope="{ row }">
|
|
<el-button size="mini" type="text" icon="el-icon-zoom-in" @click="handleView(row)">查看</el-button>
|
|
<el-button v-if="row.taskStatus != 1" size="mini" type="text" icon="el-icon-edit" @click="handleEdit(row)">
|
|
编辑
|
|
</el-button>
|
|
<el-button v-if="row.taskStatus != 1" size="mini" type="text" icon="el-icon-delete"
|
|
@click="handleDelete(row)" style="color: red"
|
|
>删除
|
|
</el-button
|
|
>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
|
|
<!-- 分页 -->
|
|
<pagination
|
|
|
|
:total="total"
|
|
:page.sync="queryParams.pageNum"
|
|
:limit.sync="queryParams.pageSize"
|
|
@pagination="getList"
|
|
/>
|
|
</el-card>
|
|
|
|
<ApproveDialog ref="approveDialog" />
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { getList } from '@/api/business/warehouse'
|
|
import {
|
|
getUseProjectListAPI
|
|
} from '@/api/EquipmentLedger/equ-out'
|
|
import { deptTreeSelect } from '@/api/system/user'
|
|
import { deleteApplyApi } from '@/api/business'
|
|
import ApproveDialog from '@/views/business/components/ApproveDialog'
|
|
|
|
export default {
|
|
name: 'ApplyList',
|
|
components: {
|
|
ApproveDialog
|
|
},
|
|
data() {
|
|
return {
|
|
propertyUnitList: [],
|
|
isLoading: false,
|
|
showSearch: true,
|
|
timeRange: [],
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
taskStatus: null,
|
|
createBy: null,
|
|
startTime: null,
|
|
endTime: null,
|
|
useUnit: null
|
|
},
|
|
statusList: [
|
|
{ label: '待审批', value: '0' },
|
|
{ label: '审批中', value: '1' },
|
|
{ label: '已审批', value: '2' },
|
|
{ label: '审批驳回', value: '3' },
|
|
],
|
|
total: 0, // 总条数
|
|
// 表格数据
|
|
tableList: [],
|
|
useProjectList: [] // 使用项目下拉选
|
|
}
|
|
},
|
|
created() {
|
|
this.getUseProjectList()
|
|
this.getList()
|
|
this.getDeptTreeSelect()
|
|
},
|
|
methods: {
|
|
getDeptTreeSelect() {
|
|
deptTreeSelect().then((res) => {
|
|
this.propertyUnitList = this.filterTree(res.data)
|
|
console.log('🚀 ~ getDeptTreeSelect ~ this.propertyUnitList:', this.propertyUnitList)
|
|
})
|
|
},
|
|
filterTree(nodes) {
|
|
return nodes
|
|
.map(node => {
|
|
if (node.children) {
|
|
node.children = this.filterTree(node.children)
|
|
}
|
|
return node
|
|
})
|
|
.filter(node => node.status !== '1')
|
|
},
|
|
// 获取使用项目的下拉选
|
|
async getUseProjectList() {
|
|
const res = await getUseProjectListAPI()
|
|
this.useProjectList = res.data
|
|
},
|
|
|
|
// 查询
|
|
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.queryParams.taskStatus = null
|
|
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 getList(params)
|
|
this.tableList = res.data.rows || []
|
|
this.total = res.data.total || 0
|
|
} catch (error) {
|
|
this.tableList = []
|
|
this.total = 0
|
|
} finally {
|
|
this.isLoading = false
|
|
}
|
|
},
|
|
// 新增
|
|
handleAdd() {
|
|
this.$router.push({ path: '/business/warehouse/details',query: {isEdit: true } })
|
|
},
|
|
// 查看
|
|
handleView(row) {
|
|
this.$router.push({ path: '/business/warehouse/details', query: { id: row.id, isView: true } })
|
|
},
|
|
// 编辑
|
|
handleEdit(row) {
|
|
this.$router.push({ path: '/business/warehouse/details', query: { id: row.id, isEdit: true } })
|
|
},
|
|
// 删除
|
|
handleDelete(row) {
|
|
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(async() => {
|
|
this.isLoading = true
|
|
try {
|
|
await deleteApplyApi({ id: row.id })
|
|
// 提示
|
|
this.$message({
|
|
type: 'success',
|
|
message: '删除成功!'
|
|
})
|
|
this.getList()
|
|
} catch (error) {
|
|
console.log('🚀 ~ error:', error)
|
|
} finally {
|
|
this.isLoading = false
|
|
}
|
|
})
|
|
},
|
|
openDialog(row) {
|
|
this.$refs.approveDialog.openDialog(row.id, 'EQUIPMENT_RETURN')
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.el-form-item {
|
|
margin-bottom: 0; /* 取消form-item的默认下边距 */
|
|
}
|
|
</style>
|