445 lines
12 KiB
Vue
445 lines
12 KiB
Vue
<template>
|
|
<view>
|
|
<view class="topTab">
|
|
<tabHeader title="设备领用" @filter="filter" @addDevice="addDevice" filte="true" add="true"></tabHeader>
|
|
</view>
|
|
|
|
<view class="page-content">
|
|
<!-- 设备列表 -->
|
|
<view class="list-box">
|
|
<u-list @scrolltolower="scrolltolower" height="88vh">
|
|
<view style="width: 100%;position: absolute;top:40%;font-size: 40rpx;text-align: center;color: #999;" v-if="listData.length==0">暂无数据...</view>
|
|
<u-list-item v-for="(item, index) in listData" :key="index">
|
|
<view class="list-item">
|
|
<view class="item-header">
|
|
<text style="margin-left: 20rpx;">{{item.departName}}</text>
|
|
</view>
|
|
<view class="item-content">
|
|
<view class="content-box">
|
|
<view class="item-text">
|
|
<text class="label">工程名称:</text>
|
|
<text class="info">{{item.proName}}</text>
|
|
</view>
|
|
<view class="item-text">
|
|
<text class="label">所属班组:</text>
|
|
<text class="info">{{item.teamName}}</text>
|
|
</view>
|
|
<view class="item-text">
|
|
<text class="label">设备类型:</text>
|
|
<text class="info">{{item.deviceTypeName}}</text>
|
|
</view>
|
|
<view class="item-text">
|
|
<text class="label">设备名称:</text>
|
|
<text class="info">{{item.devName}}</text>
|
|
</view>
|
|
<view class="item-text">
|
|
<text class="label">领用时间:</text>
|
|
<text class="info">{{item.lyTime}}</text>
|
|
</view>
|
|
<view class="item-text" v-if="item.ghTime">
|
|
<text class="label">归还时间:</text>
|
|
<text class="info">{{item.ghTime}}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="item-footer">
|
|
<view class="foot-btn" @click="backDevice(item)" v-if="!item.ghTime">归还</view>
|
|
<view class="foot-status2" v-if="item.ghTime">已归还</view>
|
|
</view>
|
|
</view>
|
|
</u-list-item>
|
|
</u-list>
|
|
</view>
|
|
<!-- 筛选表单 -->
|
|
<u-popup :show="showPopup" mode="right" @close="close">
|
|
<view>
|
|
<view style="width: 100%;height: 100%;">
|
|
<u--form class="visitor-form" :model="filterForm" ref="vForm">
|
|
<view class="visitor-input-box">
|
|
<u-form-item prop='proName' style="width:100%;height: 100%;" >
|
|
<u--input
|
|
v-model="filterForm.proName"
|
|
type="text" placeholder="工程名称"
|
|
maxlength="15" border="surround"
|
|
clearable></u--input>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="visitor-input-box">
|
|
<u-form-item prop='powerName' style="width:100%;height: 100%;" >
|
|
<u--input
|
|
v-model="filterForm.powerName"
|
|
type="text" placeholder="杆塔编号"
|
|
maxlength="15" border="surround"
|
|
clearable></u--input>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="visitor-input-box">
|
|
<u-form-item prop='teamName' style="width:100%;height: 100%;" >
|
|
<u--input
|
|
v-model="filterForm.teamName"
|
|
type="text" placeholder="领用班组"
|
|
maxlength="15" border="surround"
|
|
clearable></u--input>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="visitor-input-box">
|
|
<u-form-item prop='devType' style="width:100%;height: 100%;" >
|
|
<searchSelect
|
|
v-model="filterForm.devType" :localdata="options"
|
|
dataKey="name" dataValue="id" placeholder="请选择设备类型"
|
|
clearable="true" :filterable="true" ></searchSelect>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="visitor-input-box">
|
|
<u-form-item prop='devName' style="width:100%;height: 100%;" >
|
|
<u--input
|
|
v-model="filterForm.devName"
|
|
type="text" placeholder="设备名称"
|
|
maxlength="15" border="surround"
|
|
clearable></u--input>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="visitor-input-box">
|
|
<u-form-item prop='devCode' style="width:100%;height: 100%;" >
|
|
<u--input
|
|
v-model="filterForm.devCode"
|
|
type="text" placeholder="设备编码"
|
|
maxlength="15" border="surround"
|
|
clearable></u--input>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="visitor-input-box">
|
|
<u-form-item prop='isLy' style="width:100%;height: 100%;" >
|
|
<searchSelect
|
|
v-model="filterForm.isLy" :localdata="lyList"
|
|
dataKey="name" dataValue="id" placeholder="是否在用"
|
|
clearable="true" :filterable="true" ></searchSelect>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="visitor-input-box ">
|
|
<u-form-item prop='lyTime' style="width:100%;height: 100%;" >
|
|
<!-- <u--input
|
|
v-model="filterForm.lyTime"
|
|
type="text" placeholder="领用时间"
|
|
maxlength="15" border="surround"
|
|
clearable></u--input> -->
|
|
<uni-datetime-picker type="date" placeholder="领用时间" :clear-icon="true" v-model="filterForm.lyTime"/>
|
|
</u-form-item>
|
|
</view>
|
|
<view class="visitor-input-box ">
|
|
<u-form-item prop='ghTime' style="width:100%;height: 100%;" >
|
|
<uni-datetime-picker type="date" placeholder="归还时间" :clear-icon="true" v-model="filterForm.ghTime"/>
|
|
<!-- <u--input
|
|
v-model="filterForm.ghTime"
|
|
type="text" placeholder="归还时间"
|
|
maxlength="15" border="surround"
|
|
clearable></u--input> -->
|
|
</u-form-item>
|
|
</view>
|
|
<view class="submit-box">
|
|
<u-button type="primary" shape="circle" class="submit-btn" @click="filterList">查 询</u-button>
|
|
<u-button shape="circle" class="submit-btn" @click="resetFilter">重置</u-button>
|
|
</view>
|
|
</u--form>
|
|
|
|
</view>
|
|
</view>
|
|
</u-popup>
|
|
|
|
<!-- 确认归还 -->
|
|
<u-modal :show="showModal" :title="modalTitle" width="450rpx"
|
|
@cancel="cancel" @confirm="confirm" :content='content'
|
|
:showCancelButton="true" :buttonReverse="true"></u-modal>
|
|
|
|
</view>
|
|
</view>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
import { getDicts,listEquipmentReq,returnDevice } from '@/service/url.js';
|
|
import tabHeader from '@/components/tab-Header.vue';
|
|
import searchSelect from '@/components/search-select.vue';
|
|
import AES from "@/utils/cryptoJs/aes.js";
|
|
export default {
|
|
components: {
|
|
tabHeader,
|
|
searchSelect
|
|
},
|
|
data() {
|
|
return {
|
|
showPopup: false,
|
|
showModal: false,
|
|
lyList:[{id:'0',name:'在用'},{id:'1',name:'归还'}],
|
|
backItem: {},
|
|
modalTitle:'设备归还确认',
|
|
content:'确定该设备已归还?',
|
|
listData:[],
|
|
page:1,
|
|
filterForm: {
|
|
proName:'',
|
|
powerName:'',
|
|
teamName: '',
|
|
devType: '',
|
|
devName: '',
|
|
devCode: '',
|
|
isLy:'',
|
|
lyTime:'',
|
|
ghTime: '',
|
|
},
|
|
options: [],
|
|
};
|
|
},
|
|
onLoad() {
|
|
this.getDicts()
|
|
},
|
|
onShow() {
|
|
this.page = 1;
|
|
this.loadmore()
|
|
},
|
|
methods: {
|
|
getDicts(){
|
|
let obj = {
|
|
"id":"sys_device_type",//设备类型
|
|
}
|
|
this.$http.get(getDicts,obj).then(res => {
|
|
if (res) {
|
|
if(res.code == 200){
|
|
this.options=res.data
|
|
}
|
|
}
|
|
}).catch(error => {
|
|
console.log(error)
|
|
// this.$utils.showHttpError(error)
|
|
})
|
|
},
|
|
//滚动加载
|
|
scrolltolower() {
|
|
this.page += 1;
|
|
this.loadmore()
|
|
},
|
|
//加载列表
|
|
loadmore() {
|
|
let obj = {
|
|
"proName":this.filterForm.proName,
|
|
"powerName":this.filterForm.powerName,
|
|
"teamName":this.filterForm.teamName,
|
|
"devType":this.filterForm.devType,
|
|
"devName":this.filterForm.devName,
|
|
"devCode":this.filterForm.devCode,
|
|
"lyTime":this.filterForm.lyTime,
|
|
"ghTime":this.filterForm.ghTime,
|
|
"pageNum":this.page,
|
|
"pageSize":"10"
|
|
}
|
|
this.$http.get(listEquipmentReq,obj).then(res => {
|
|
if (res) {
|
|
if(res.code == 200){
|
|
if(res.data?.length>0){
|
|
if(this.page == 1){
|
|
this.listData = res.data;
|
|
}else{
|
|
this.listData = [...this.listData, ...res.data];
|
|
}
|
|
}else{
|
|
console.log("没有更多了")
|
|
}
|
|
}
|
|
}
|
|
}).catch(error => {
|
|
console.log(error)
|
|
// this.$utils.showHttpError(error)
|
|
})
|
|
},
|
|
//侧边筛选打开
|
|
filter(){
|
|
this.showPopup = true;
|
|
console.log("筛选")
|
|
},
|
|
//侧边筛选关闭
|
|
close() {
|
|
this.showPopup = false
|
|
console.log('close');
|
|
},
|
|
//侧边筛选-查询
|
|
filterList(){
|
|
this.showPopup = false
|
|
this.listData=[]
|
|
this.page = 1;
|
|
this.loadmore()
|
|
},
|
|
//侧边筛选-查询
|
|
resetFilter(){
|
|
this.filterForm={
|
|
proName:'',
|
|
powerName:'',
|
|
teamName: '',
|
|
devType: '',
|
|
devName: '',
|
|
devCode: '',
|
|
isLy: '',
|
|
lyTime:'',
|
|
ghTime: '',
|
|
}
|
|
this.filterList();
|
|
},
|
|
//新增按钮触发
|
|
addDevice(){
|
|
console.log("新增")
|
|
uni.navigateTo({
|
|
url: "/pages/devices/addDevices"
|
|
})
|
|
},
|
|
//确认归还modal
|
|
backDevice(item){
|
|
this.showModal = true;
|
|
this.backItem=item;
|
|
},
|
|
cancel() {
|
|
this.showModal = false
|
|
},
|
|
//确认归还
|
|
confirm() {
|
|
console.log('确认归还');
|
|
let obj = {
|
|
"id": this.backItem.id,
|
|
"devId": this.backItem.devId,
|
|
"devType": this.backItem.devType,
|
|
"devCode": this.backItem.devCode
|
|
}
|
|
let option = {contentType:'form'}
|
|
// console.log(obj)
|
|
this.$http.post(returnDevice,obj,false,option).then(res => {
|
|
if (res) {
|
|
if(res.code == 200){
|
|
this.page = 1;
|
|
this.loadmore()
|
|
this.showModal = false
|
|
}
|
|
}
|
|
}).catch(error => {})
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.page-content{
|
|
width: 100%;
|
|
height: 90vh;
|
|
position: absolute;
|
|
top:5vh;
|
|
padding: 40rpx 0;
|
|
|
|
.list-box{
|
|
width: 94%;
|
|
height: auto;
|
|
// border: 1px solid #000;
|
|
margin: 40rpx auto;
|
|
margin-top: 40rpx;
|
|
|
|
.list-item{
|
|
width: 100%;
|
|
height: auto;
|
|
background-color: #fff;
|
|
border-radius: 10rpx;
|
|
margin: 20rpx 0;
|
|
|
|
.item-header{
|
|
width: 100%;
|
|
min-height: 72rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
font-size: 28rpx;
|
|
border: 1px dashed #E3E9FA;
|
|
}
|
|
|
|
.item-content{
|
|
width: 100%;
|
|
height: auto;
|
|
border: 1px dashed #E3E9FA;
|
|
font-size: 24rpx;
|
|
.content-box{
|
|
width: 94%;
|
|
height: auto;
|
|
margin: 20rpx;
|
|
background-color: #F8F9FC;
|
|
padding: 20rpx 0;
|
|
|
|
.item-text{
|
|
margin-left: 20rpx;
|
|
margin-top: 15rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
.label{
|
|
width: 130rpx;
|
|
color: rgba(10,38,64,0.5);
|
|
}
|
|
.info{
|
|
width: 500rpx;
|
|
color: #0A2640;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.item-footer{
|
|
width: 100%;
|
|
height: 72rpx;
|
|
position: relative;
|
|
.foot-btn{
|
|
width: 100rpx;
|
|
height: 40rpx;
|
|
line-height: 40rpx;
|
|
text-align: center;
|
|
position: absolute;
|
|
right: 5%;
|
|
top: 20%;
|
|
background: rgba(0,133,255,0.05);
|
|
border-radius: 32rpx;
|
|
border: 1px solid rgba(0,133,255,0.8);
|
|
color: #0085FF;
|
|
font-size: 20rpx;
|
|
}
|
|
.foot-status2{
|
|
width: 100rpx;
|
|
height: 40rpx;
|
|
line-height: 40rpx;
|
|
text-align: center;
|
|
position: absolute;
|
|
right: 5%;
|
|
top: 20%;
|
|
background: #DDEFFF;
|
|
border-radius: 10rpx;
|
|
color: #007DEB;
|
|
font-size: 20rpx;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.visitor-form{
|
|
width: auto;
|
|
padding: 80rpx 20rpx;
|
|
}
|
|
.visitor-input-box{
|
|
|
|
}
|
|
.submit-box {
|
|
margin-top: 86rpx;
|
|
margin-bottom: 80rpx;
|
|
.submit-btn {
|
|
width: 95%;
|
|
margin: 0 auto;
|
|
height: 66rpx;
|
|
font-size: 26rpx;
|
|
// background: linear-gradient( 90deg, #5193FE 0%, #00EEF0 100%);
|
|
box-shadow: 0px 4px 2px 0px rgba(81,147,254,0.15);
|
|
border-radius: 32rpx;
|
|
margin-bottom: 40rpx;
|
|
}
|
|
}
|
|
</style>
|