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

306 lines
9.9 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<!-- 装备流转记录 -->
<div class="app-container">
<div class="query-form-container" style="flex-shrink: 0;">
<el-form ref="queryForm" size="small" inline label-width="auto" :model="queryParams">
<el-form-item prop="keyword">
<el-input
clearable
style="width: 240px"
placeholder="请输入关键字"
v-model.trim="queryParams.keyWord"
/>
</el-form-item>
<el-form-item prop="type">
<el-select
clearable
filterable
style="width: 240px"
v-model="queryParams.type"
placeholder="请选择操作类型"
>
<el-option label="入库" value="1"/>
<el-option label="出库" value="2"/>
<el-option label="退役" value="3"/>
<el-option label="维修" value="4"/>
</el-select>
</el-form-item>
<el-form-item>
<el-date-picker
v-model="dateRange"
type="datetimerange"
range-separator="至"
style="width: 240px"
value-format="yyyy-MM-dd"
end-placeholder="结束日期"
start-placeholder="开始日期"
/>
</el-form-item>
<el-form-item>
<el-button icon="el-icon-refresh" size="mini" @click="onHandleReset">重置</el-button>
<el-button type="primary" icon="el-icon-search" size="mini" @click="onHandleQuery"> 查询</el-button>
</el-form-item>
<el-form-item class="button-group">
<el-button size="mini" @click="onHandleExport" style="background-color:#fff;border: 1px solid #d9d9d9;color:rgba(0,0,0,.65)">
<svg-icon icon-class="download"/> 导出</el-button>
</el-form-item>
</el-form>
</div>
<div style="flex: 1; overflow-y: auto;">
<el-table :data="tableData" style="width: 100%" height="546">
<el-table-column align="center" show-overflow-tooltip type="index" label="序号" width="50"/>
<el-table-column align="center" show-overflow-tooltip prop="createUser" label="操作人"/>
<el-table-column align="center" show-overflow-tooltip prop="type" label="操作类型">
<template slot-scope="scope">
<el-tag size="mini">
{{ typeInfo[scope.row.type] }}
</el-tag>
</template>
</el-table-column>
<el-table-column align="center" show-overflow-tooltip prop="createTime" label="操作时间"/>
<el-table-column align="center" show-overflow-tooltip prop="changeStatus" label="流转前状态">
<template slot-scope="{ row }">
<el-tag v-if="row.changeStatus == 1" size="mini">在库</el-tag>
<el-tag v-if="row.changeStatus == 2" size="mini">自用</el-tag>
<el-tag v-if="row.changeStatus == 3" size="mini">共享</el-tag>
<el-tag v-if="row.changeStatus == 4" size="mini" type="info">退役</el-tag>
<el-tag v-if="row.changeStatus == 5" size="mini" type="danger">维修</el-tag>
</template>
</el-table-column>
<!-- <el-table-column align="center" show-overflow-tooltip prop="status" label="流转后状态">
<template slot-scope="{ row }">
<el-tag v-if="row.status == 1" size="mini">在库</el-tag>
<el-tag v-if="row.status == 2" size="mini">自用</el-tag>
<el-tag v-if="row.status == 3" size="mini">共享</el-tag>
<el-tag v-if="row.status == 4" size="mini" type="info">退役</el-tag>
<el-tag v-if="row.status == 5" size="mini" type="danger">维修</el-tag>
</template>
</el-table-column>-->
<el-table-column align="center" show-overflow-tooltip prop="useUint" label="使用单位"/>
<el-table-column align="center" show-overflow-tooltip prop="proName" label="使用项目"/>
<el-table-column align="center" show-overflow-tooltip prop="proLocation" label="地址"/>
<el-table-column align="center" show-overflow-tooltip prop="devNum" label="装备数量"/>
<el-table-column align="center" show-overflow-tooltip prop="address" label="操作">
<template slot-scope="scope">
<el-button type="text" @click="onHandleOutRecord(scope.row)">
{{ typeInfo[scope.row.type] }}记录单
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-container-fage" style="flex-shrink: 0;">
<pagination
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getRoamRecordList"
/>
</div>
<!-- 出库记录单 -->
<el-dialog title="出库记录单" :visible.sync="outRecordVisible" width="80%" append-to-body>
<el-row>
<el-button size="mini" type="primary" @click="onHandleDownload">下载</el-button>
<el-button size="mini" type="primary" @click="onHandlePrint">打印</el-button>
<el-button size="mini" type="primary" @click="onHandleClose">关闭</el-button>
</el-row>
<el-row class="record-row">
<el-col :span="12">
<div> 流转前使用单位:{{ outRecordParams.changeUnit }}</div>
</el-col>
<el-col :span="8">
<div> 流转后使用单位:{{ outRecordParams.useUint }}</div>
</el-col>
<el-col :span="4">
<div> 流转前使用工程:/</div>
</el-col>
</el-row>
<el-row class="record-row">
<el-col :span="12">
<div> 流转后使用工程: {{ outRecordParams.proName }}</div>
</el-col>
<el-col :span="8">
<div> 装备数量 {{ outRecordParams.devNum }}</div>
</el-col>
</el-row>
<vue-easy-print ref="recordPrintRef" tableShow style="width: 100%">
<el-table :data="outRecordData" style="width: 100%" height="546">
<el-table-column align="center" show-overflow-tooltip type="index" label="序号"/>
<el-table-column align="center" show-overflow-tooltip prop="devName" label="装备名称"/>
<!-- <el-table-column align="center" show-overflow-tooltip prop="createUser" label="装备系列" /> -->
<el-table-column align="center" show-overflow-tooltip prop="devModel" label="规格型号"/>
<el-table-column align="center" show-overflow-tooltip prop="devCode" label="装备编码"/>
</el-table>
</vue-easy-print>
<el-row class="record-row" style="margin-top: 10px">
<el-col :span="24" style="text-align: right">
<div>
操作人
<span style="margin-right: 30px"> {{ outRecordParams.createUser }}</span>
操作时间
{{ outRecordParams.createTime }}
</div>
</el-col>
</el-row>
</el-dialog>
</div>
</template>
<script>
import { getRoamRecordListAPI, getOutRecordListAPI } from '@/api/EquipmentRoamRecord'
import vueEasyPrint from 'vue-easy-print'
export default {
components: {
vueEasyPrint
},
data() {
return {
total: 0,
tableData: [],
dateRange: [],
typeInfo: {
1: '入库',
2: '出库',
3: '退役',
4: '维修'
},
queryParams: {
keyWord: '', // 关键字
type: '', // 操作类型
startTime: '', // 操作时间
endTime: '', // 操作时间
pageNum: 1,
pageSize: 10
},
// 出库记录单
outRecordVisible: false,
outRecordParams: {
changeUnit: '',
useUint: '',
proName: '',
devNum: ''
},
outRecordData: [],
recordId: ''
}
},
created() {
this.getRoamRecordList()
},
methods: {
// 获取流转记录列表
async getRoamRecordList() {
if (this.dateRange.length > 0) {
this.queryParams.startTime = this.dateRange[0]
this.queryParams.endTime = this.dateRange[1]
}
const res = await getRoamRecordListAPI(this.queryParams)
this.tableData = res.rows
this.total = res.total || 0
},
// 出库记录单
async onHandleOutRecord(row) {
const { changeUnit, useUint, proName, devNum, id, createUser, createTime } = row
this.outRecordParams = { changeUnit, useUint, proName, devNum, createUser, createTime }
this.recordId = id
const res = await getOutRecordListAPI({ id })
this.outRecordData = res.data
this.outRecordVisible = true
},
// 查询
onHandleQuery() {
this.getRoamRecordList()
},
// 重置
onHandleReset() {
this.queryParams = { keyWord: '', type: '', startTime: '', endTime: '', pageNum: 1, pageSize: 10 }
this.dateRange = []
this.getRoamRecordList()
},
// 导出数据
onHandleExport() {
// this.downLo
this.download(
'material-mall/decChange/export',
{
...this.queryParams
},
`装备流转记录.xlsx`
)
},
// 下载
onHandleDownload() {
this.download('material-mall/decChange/exportDetails', { id: this.recordId }, `出库记录单.xlsx`)
},
// 打印
onHandlePrint() {
this.$refs.recordPrintRef.print()
},
// 关闭
onHandleClose() {
this.outRecordVisible = false
}
}
}
</script>
<style scoped>
.record-row {
margin-bottom: 10px;
font-size: 16px;
font-weight: 600;
color: #333;
line-height: 40px;
}
.app-container {
background-color: #f5f5f5; /* 设置整体灰色背景 */
display: flex;
flex-direction: column;
}
.query-form-container,
.table-container,
.pagination-container-fage {
background-color: #fff; /* 设置白色背景 */
padding: 10px;
margin-bottom: 20px;
border-radius: 4px;
}
.button-group {
float: right;
margin-left: 10px;
}
.el-form-item--small.el-form-item {
margin-bottom: 0px;
}
.pagination-container {
position: relative;
height: 25px;
margin-bottom: 10px;
margin-top: -16px;
padding: 10px 20px !important;
background:none ;
}
</style>