bonus-ui/src/views/search/lease/index.vue

630 lines
18 KiB
Vue

<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-card class="search-box">
<el-row>
<el-col :span="20">
<el-form-item prop="deviceName">
<el-input
v-model="queryParams.deviceName"
placeholder="装备名称"
clearable
@keyup.enter.native="handleQuery"
maxlength="20"
/>
</el-form-item>
<el-form-item prop="code">
<el-input
v-model="queryParams.code"
placeholder="装备编码"
clearable
@keyup.enter.native="handleQuery"
maxlength="20"
/>
</el-form-item>
<el-form-item prop="maStatus">
<el-select
style="width: 100%"
v-model="queryParams.maStatus"
clearable
placeholder="请选择装备状态"
>
<el-option label="草稿状态" value="0"></el-option>
<el-option label="上架" value="2"></el-option>
<el-option label="下架" value="1"></el-option>
<el-option label="在租" value="3"></el-option>
</el-select>
</el-form-item>
<el-form-item prop="rentNum">
<el-input
v-model="queryParams.rentNum"
placeholder="共享次数"
type="number"
clearable
@keyup.enter.native="handleQuery"
maxlength="20"
/>
</el-form-item>
<el-form-item prop="dateRange">
<el-date-picker
style="width: 100%"
v-model="dateRange"
type="daterange"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="更新开始日期"
end-placeholder="更新结束日期"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="4" style="text-align: right;">
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-col>
</el-row>
</el-card>
</el-form>
<!-- <el-row :gutter="10" class="mb8">
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> -->
<el-card class="content-box">
<div class="table-container">
<el-table v-loading="loading" :data="tableData" border stripe height="100%">
<el-table-column label="序号" align="center" width="80" type="index">
<template slot-scope="scope">
<span>{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}</span>
</template>
</el-table-column>
<el-table-column label="装备名称" align="center" prop="deviceName" sortable/>
<el-table-column label="装备编码" align="center" prop="code" sortable>
<template slot-scope="scope">
<span style="color:blue">{{ scope.row.code}}</span>
</template>
</el-table-column>
<el-table-column label="装备类目" align="center" prop="typeName" width="250px" sortable>
<template slot-scope="scope">
<span
>{{ scope.row.firstName }} <span v-show="scope.row.firstName">></span>
{{ scope.row.secondName }}<span v-show="scope.row.secondName">></span
>{{ scope.row.thirdName }}</span
>
</template>
</el-table-column>
<el-table-column label="共享次数" align="center" prop="rentNum" sortable/>
<el-table-column label="装备状态" align="center" prop="maStatus" sortable>
<template slot-scope="scope">
<el-tag v-if="scope.row.maStatus == 0" size="small" type="info">草稿状态</el-tag>
<el-tag v-if="scope.row.maStatus == 1" size="small" type="warning">下架</el-tag>
<el-tag v-if="scope.row.maStatus == 2" size="small" type="success">上架</el-tag>
<el-tag v-if="scope.row.maStatus == 3" size="small" type="danger">在租</el-tag>
</template>
</el-table-column>
<el-table-column label="更新时间" align="center" prop="updateTime" sortable/>
<el-table-column label="操作" align="center" width="180">
<template slot-scope="scope" >
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleDetail(scope.row)"
>
共享详情
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination-wrapper">
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
</el-card>
<!-- 查看共享详情弹窗 -->
<el-dialog :title="title" :visible.sync="showDevice" width="1300px" height="1000px" append-to-body>
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;">
<div style="width:30%">
<span >装备编号:{{ deviceCode }}</span>
</div>
<div style="width: 30%">
<span >装备名称:{{ deviceName }}</span>
</div>
<div style="width: 30%">
<span >装备状态:{{ deviceStatus }}</span>
</div>
</div>
<el-form :model="queryDevice" ref="queryFormDevice" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-row>
<el-col :span="20">
<el-form-item label="订单编号" prop="orderCode">
<el-input
v-model="queryDevice.orderCode"
placeholder="请输入订单编号"
clearable
@keyup.enter.native="handleQueryRent"
maxlength="20"
/>
</el-form-item>
<el-form-item label="共享周期" prop="dateRangeRent">
<el-date-picker
style="width: 100%"
v-model="dateRangeRent"
type="daterange"
value-format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
>
</el-date-picker>
</el-form-item>
</el-col>
<el-col :span="4" style="text-align: right;">
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQueryRent">查询</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQueryRent">重置</el-button>
</el-col>
</el-row>
</el-form>
<el-table v-loading="loadingTwo" :data="deviceList" width="800px" height = "600px" border stripe>
<el-table-column label="序号" align="center" width="80" type="index">
<!-- <template slot-scope="scope">
<span>{{ (queryDevice.pageNum - 1) * queryDevice.pageSize + scope.$index + 1 }}</span>
</template> -->
</el-table-column>
<el-table-column label="订单编号" align="center" prop="orderCode" sortable/>
<el-table-column label="共享周期" align="center" prop="rentTime" sortable/>
<el-table-column label="订单状态" align="center" prop="idCard" width="110px" sortable>
<template slot-scope="scope">
<el-tag v-if="scope.row.orderStatus == 0" size="small" >未下单</el-tag>
<el-tag v-if="scope.row.orderStatus == 1" size="small">待确认</el-tag>
<el-tag v-if="scope.row.orderStatus == 2" size="small" >已确认</el-tag>
<!-- <el-tag v-if="scope.row.orderStatus == 3" size="small" >待收货</el-tag>-->
<!-- <el-tag v-if="scope.row.orderStatus == 4" size="small" >共享中</el-tag>-->
<!-- <el-tag v-if="scope.row.orderStatus == 5" size="small" >已退租</el-tag>-->
<!-- <el-tag v-if="scope.row.orderStatus == 10" size="small" >已检修</el-tag>-->
<!-- <el-tag v-if="scope.row.orderStatus == 15" size="small" >已结算</el-tag>-->
<!-- <el-tag v-if="scope.row.orderStatus == 20" size="small" >已完成</el-tag>-->
<!-- <el-tag v-if="scope.row.orderStatus == 99" size="small" >已取消</el-tag>-->
</template>
</el-table-column>
<el-table-column label="共享费用(元)" align="center" prop="rentCost" sortable width="130px"/>
<el-table-column label="丢失费用(元)" align="center" prop="lossCost" sortable width="130px"/>
<el-table-column label="退租检修费用(元)" align="center" prop="repairCost" width="130px"/>
<el-table-column label="总费用(元)" align="center" prop="cost" />
<el-table-column label="承租公司" align="center" prop="rentCompany" />
<el-table-column label="承租人" align="center" prop="rentPerson" />
<el-table-column label="下单时间" align="center" prop="orderTime" width="130px"/>
</el-table>
<pagination
v-show="totalTwo>0"
:total="totalTwo"
:page.sync="queryDevice.pageNum"
:limit.sync="queryDevice.pageSize"
@pagination="getListDetail"
/>
</el-dialog>
</div>
</template>
<script>
import { getEquipmentTypeApi,getEquipmentListApi,getRentDetailApi,} from "@/api/search/equipment";
export default {
name: "lease",
data() {
return {
// 遮罩层
loading: true,
loadingTwo: false,
// 是否显示项目部Id
showName: false,
// 是否显示施工预警信息
showWarn: false,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
showDevice: false,
// 总条数
total: 0,
totalTwo : 0,
// 共享详情表格数据
deviceList: [],
title: "",
// 是否显示弹出层
open: false,
// 日期选择器
dateRange: [],
//共享周期选择器
dateRangeRent: [],
//装备类型
deviceTypeList:[],
//装备类型树
deviceTypeTree:[],
//树形结构
partTypeTreeProps: {
children: 'children',
label: 'name',
multiple: false,
value: 'id',
},
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
deviceName: undefined,
code: undefined,
typeId: undefined,
maStatus: undefined,
rentNum: undefined,
startTime: '',
endTime: '',
},
//表单数据
tableData: [],
// 查询参数
queryDevice: {
pageNum: 1,
pageSize: 10,
startTime: '',
endTime: '',
orderCode: undefined,
maId: undefined,
},
// 表单参数
form: {},
//装备id
deviceId: undefined,
//装备编号
deviceCode:undefined,
//装备名称
deviceName:undefined,
//装备状态
deviceStatus:undefined,
};
},
created() {
this.getTypeTreeData();
this.getList();
},
methods: {
/** 查询树形列表 */
getTypeTreeData() {
getEquipmentTypeApi().then(response => {
this.deviceTypeTree = response.data;
});
},
/** 查询装备信息列表 */
async getList() {
this.loading = true;
if(this.dateRange.length > 0){
this.queryParams.startTime = this.dateRange[0]
this.queryParams.endTime = this.dateRange[1]
}
await getEquipmentListApi(this.queryParams).then(response => {
console.log('11111',response)
this.tableData = response.data.rows;
this.total = response.data.total;
this.loading = false;
});
},
// 取消按钮
// cancel() {
// this.open = false;
// this.reset();
// },
// 表单重置
// reset() {
// this.form = {
// appnum: undefined,
// projectDepartName: undefined,
// projectHeadName: undefined,
// contactInformation: undefined,
// projectHeadName: undefined,
// remarks: undefined
// };
// this.resetForm("form");
// },
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.dateRange = [];
this.deviceTypeList = []
this.queryParams.startTime=''
this.queryParams.endTime=''
this.handleQuery();
},
//装备类目-change
deviceTypeChange(val) {
console.log('2222222222',val)
if (val.length > 0) {
this.queryParams.typeId = val[3]
} else {
this.queryParams.typeId = ''
}
},
//共享详情
handleDetail(row){
this.deviceId = row.maId;
this.deviceCode = row.code;
this.deviceName = row.deviceName;
if(row.maStatus == '1'){
this.deviceStatus = '下架';
}else if(row.maStatus == '2'){
this.deviceStatus = '上架';
}else if(row.maStatus == '3'){
this.deviceStatus = '在租';
}else if(row.maStatus == '0'){
this.deviceStatus = '草稿状态';
}
this.title = "装备共享详情"
this.showDevice = true;
this.getListDetail(row);
},
//查询共享详情
getListDetail(row){
this.loadingTwo = true;
getRentDetailApi(row).then(response => {
console.log('11111',response)
this.deviceList = response.data.rows;
console.log('2222',this.deviceList)
this.totalTwo = response.data.total;
this.loadingTwo = false;
});
},
//查询共享详情
handleQueryRent(){
this.queryDevice.maId = this.deviceId;
if(this.dateRangeRent.length > 0){
this.queryDevice.startTime = this.dateRangeRent[0]
this.queryDevice.endTime = this.dateRangeRent[1]
}
this.getListDetail(this.queryDevice)
},
// 重置按钮操作
resetQueryRent() {
this.resetForm("queryFormDevice");
this.dateRangeRent = [];
this.queryDevice.startTime=''
this.queryDevice.endTime=''
this.handleQueryRent();
}
}
};
</script>
<style lang="scss" scoped>
.uploadImg {
padding-top: 20px;
display: flex;
align-items: center;
justify-content: center;
}
.deviceCode {
margin-top: 10px;
padding-bottom: 20px;
font-size: 18px;
}
::v-deep.el-table .fixed-width .el-button--mini {
width: 60px !important;
margin-bottom: 10px;
}
//隐藏图片上传框的css
::v-deep.disabled {
.el-upload--picture-card {
display: none;
}
}
.search-box {
margin-bottom: 20px;
border-radius: 8px;
padding: 0;
.el-form-item--small.el-form-item {
margin-bottom: 0px;
}
}
.el-form-item--small.el-form-item {
margin-bottom: 0px;
}
.content-box {
border-radius: 8px;
height: calc(100vh - 210px);
display: flex;
flex-direction: column;
overflow: hidden;
::v-deep .el-card__body {
display: flex !important;
flex-direction: column !important;
height: 100% !important;
padding: 20px;
}
.el-row:first-child {
margin-bottom: 16px;
flex-shrink: 0;
.el-col {
display: flex;
justify-content: flex-end;
align-items: center;
gap: 12px;
}
}
.table-container {
flex: 1;
overflow: hidden;
margin-bottom: 0;
min-height: 0;
display: flex;
flex-direction: column;
}
.pagination-wrapper {
flex-shrink: 0;
padding-top: 6px;
margin-top: auto;
::v-deep .pagination-container {
padding: 0px 20px !important;
margin-bottom: 30px;
}
}
::v-deep .el-table {
// 启用斑马纹
&.el-table--striped .el-table__body {
tr.el-table__row--striped td {
background-color: #F6FBFA !important; // 浅紫色
}
}
.el-table__header {
background: #E9F0EE;
th {
background: #E9F0EE !important;
color: #606266;
font-weight: 600;
height: 50px;
}
}
&.el-table--striped .el-table__body tr.el-table__row:hover>td.el-table__cell {
background-color: #CCF1E9 !important;
}
}
}
.dialog-table {
border-radius: 6px;
overflow: hidden;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
::v-deep .el-table {
border-radius: 6px;
overflow: hidden;
// 启用斑马纹
&.el-table--striped .el-table__body {
tr.el-table__row--striped td {
background-color: #F6FBFA !important;
}
}
.el-table__header {
background: #E9F0EE;
th {
background: #E9F0EE !important;
color: #606266;
font-weight: 600;
height: 45px;
font-size: 14px;
border-bottom: 2px solid #e4e7ed;
}
}
.el-table__body {
tr {
transition: all 0.2s ease;
&:hover {
background-color: #f8f9fa;
}
td {
padding: 12px 8px;
font-size: 13px;
border-bottom: 1px solid #f0f2f5;
}
}
}
&.el-table--striped .el-table__body tr.el-table__row:hover>td.el-table__cell {
background-color: #CCF1E9 !important;
}
// 表格边框优化
&::before {
display: none;
}
&::after {
display: none;
}
}
}
::v-deep .el-table {
// 启用斑马纹
&.el-table--striped .el-table__body {
tr.el-table__row--striped td {
background-color: #F6FBFA !important; // 浅紫色
}
}
.el-table__header {
background: #E9F0EE;
th {
background: #E9F0EE !important;
color: #606266;
font-weight: 600;
height: 50px;
}
}
&.el-table--striped .el-table__body tr.el-table__row:hover>td.el-table__cell {
background-color: #CCF1E9 !important;
}
}
</style>