You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

237 lines
4.9 KiB

<template>
<!-- 设备报修 -->
<view class="container">
<u-navbar back-icon-color='#fff' :background="{ background: '#409eff'}" back-text="" title-color='#fff'
title="设备报修">
<template v-slot:right>
<u-icon name="plus" color="#fff" size="36" style="padding-right: 30rpx;" @click="addForm"></u-icon>
</template>
</u-navbar>
<!-- <Search @search='search' @screen='screen' :isShowScreen='false'/> -->
<view class="list">
<view class="item" v-for="(item,index) in list" :key="index" @click="itemClick(item,index)">
<view class="title">
<view class="title-txt">
{{item.describes}}
</view>
<view class="time">
<!-- 2023-12-12 08:00:00 -->
{{`${$time.formatDate(item.createTime)}`}}
</view>
</view>
<view class="dec">
报修单号:<span>{{item.number}}</span>
</view>
<view class="dec">
{{`${params.type=='DEVICE'?'设备' : '模具'}`}}编号:<span>{{item.deviceNumber}}</span>
</view>
<view class="dec">
{{`${params.type=='DEVICE'?'设备' : '模具'}`}}名称:<span>{{item.name}}</span>
</view>
<view class="dec">
所属厂区:<span>{{item.factoryAreaName}}</span>
</view>
<view class="bottom">
<view class="status">
10 months ago
<u-tag :text="item.result" bg-color='rgba(255,255,255,0)' color='#2ba471'
border-color='#2ba471' type="primary" shape='circle' />
</view>
<view class="button">
<u-button shape="circle" type="primary" size="mini" style="min-width: 120rpx;"
v-if="item.isCancel == 0" @click="cancle(item)">撤销</u-button>
</view>
</view>
</view>
</view>
<view style="height: 94rpx;padding-top: 30rpx;">
<u-loadmore :status="status" v-if="status != 'loadmore'" />
</view>
<view style="height: constant(safe-area-inset-bottom); height: env(safe-area-inset-bottom);"></view>
</view>
</template>
<script>
import * as deviceApi from "@/api/device.js"
export default {
data() {
return {
params: {
pageNo: 1,
pageSize: 10,
type: ''
},
status: 'loadmore', //是否显示没有更多了
list: [],
}
},
methods: {
// 筛选
screen() {
this.$tab.navigateTo(`/pages/deviceReport/screen?type=${this.type}`)
},
addForm() {
this.$tab.navigateTo(`/pages/deviceReport/addForm?type=${this.params.type}`)
},
// 获取设备保修列表
async getList() {
if (this.status == 'nomore') return;
this.status = 'loading';
this.$modal.loading('加载中')
await deviceApi.deviceRepairPage(this.params).then((res) => {
this.$modal.closeLoading()
if (res.data.list.length > 0) {
this.list = this.list.concat(res.data.list);
this.params.pageNo++;
this.status = 'loadmore'
} else {
this.status = 'nomore'
}
})
},
// 撤销
cancle(item) {
this.$modal.confirm('确定撤销报修吗?').then(() => {
this.$modal.loading('加载中')
deviceApi.rejected(item.id).then(async (res) => {
this.$modal.closeLoading()
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
await this.getList()
this.$modal.showLoading('撤销成功')
})
})
}
},
onLoad(option) {
if (option.type) this.params.type = option.type;
},
onShow() {
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
this.getList()
},
onReachBottom() {
this.getList()
}
}
</script>
<style lang="scss" scoped>
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
10 months ago
height: 90rpx;
}
}
}
.list {
background: #f5f5f5;
margin-top: 20rpx;
.item {
padding: 30rpx 30rpx 0px 30rpx;
margin-top: 20rpx;
background: white;
.title {
display: flex;
align-items: center;
padding-bottom: 20rpx;
.title-txt {
color: #409eff;
font-weight: bold;
font-size: 36rpx;
width: 0px;
flex: 1;
}
.time {
color: #919191;
}
}
.dec {
padding-bottom: 20rpx;
span {
color: #999999;
}
}
.last {
padding-bottom: 30rpx;
}
.bottom {
display: flex;
justify-content: space-between;
align-items: center;
border-top: 1px solid #E4E4E4;
padding: 20rpx 0px;
position: relative;
.status {
flex: 1;
}
.button {
position: absolute;
right: 0rpx;
}
}
}
}
</style>