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.

242 lines
5.1 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">
<u-tag text="已报修" v-if="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 workOrderList from '@/components/workOrderList/index.vue'
import * as deviceApi from "@/api/device.js"
export default {
components: {
workOrderList
},
data() {
return {
params: {
pageNo: 1,
pageSize: 10,
type: ''
},
status: 'loadmore', //是否显示没有更多了
list: [],
}
},
methods: {
// 筛选
screen() {
this.$tab.navigateTo(`/pages/deviceReport/screen?type=${this.type}`)
},
itemClick(item, index) {
this.$tab.navigateTo(`/pages/workOrderList/detail?type=${this.type}`)
},
addForm() {
this.$tab.navigateTo(`/pages/deviceReport/addForm?type=${this.params.type}`)
},
// 获取设备保修列表
getList() {
if (this.status == 'nomore') return;
this.status = 'loading';
this.$modal.loading('加载中')
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((res) => {
this.$modal.closeLoading()
this.params.pageNo = 1
this.list = []
this.status = 'loadmore'
this.getList()
})
})
}
},
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;
}
}
}
.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>