SmartStorage/pages/fixDetail/fixDetail.vue

284 lines
5.9 KiB
Vue
Raw Normal View History

2023-12-20 15:15:23 +08:00
<template>
<view>
<view
class="single-fetch"
v-for="(fetch, index) in fetchList"
:key="index"
@click="seeDetail(fetch)"
>
<view>
<span>类型名称</span>
<h4>{{ fetch.typeName }}</h4>
</view>
<view>
<span>规格型号</span>
<h4>{{ fetch.type }}</h4>
</view>
<view>
<span>申请数量</span>
<h4>{{ fetch.repairNum }}</h4>
</view>
<view>
<span>已维修数量</span>
<h4>{{ fetch.repairedNum }}</h4>
</view>
<view>
<span>报废数量</span>
<h4>{{ fetch.scrapNum }}</h4>
</view>
<view v-show="fetch.code != ''">
<span>设备编号</span>
<h4>{{ fetch.code }}</h4>
</view>
<view>
<span>维修时间</span>
<h4>{{ fetch.updateTime }}</h4>
</view>
</view>
<view class="btm-sub">
<button
@click="finishFix"
:disabled="!btnStatus"
>
维修完成
</button>
</view>
<uni-popup
ref="popup"
type="center"
:mask-click="false"
>
<view class="popup">
<view class="pop-top">
<uni-icons
style="color: #AAAAAA; font-weight: bold;"
type="closeempty"
size="32"
@click="closePopup"
>
</uni-icons>
</view>
<h5 style="width: 85%; margin: 2vh auto; font-weight: normal; text-align: center;">请选择维修类型</h5>
<view class="select-area">
<uni-data-checkbox
v-model="fixType"
:localdata="fixRange"
></uni-data-checkbox>
</view>
<view class="btn-area">
<view
style="border: 1px solid #E7E7E7;"
@click="closePopup"
>
取消
</view>
<view
style="background-color: #3988FF; color: #fff;"
@click="confirmType"
>
确认
</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
import { basePath } from '../../public';
export default {
data() {
return {
fetchList: [],
fixType: '',
fixRange: [
{ text: '内部维修', value: '1' },
{ text: '返厂维修', value: '2' },
{ text: '待报废', value: '3' }
],
id: '',
taskId: '',
maId: '',
typeId: '',
ifNo: '',
btnStatus: '',
2024-03-13 17:55:34 +08:00
idList: [],
initTaskId: ''
2023-12-20 15:15:23 +08:00
}
},
methods: {
seeDetail (info) {
console.log(info);
2024-03-13 17:55:34 +08:00
if (Number(info.repairedNum) + Number(info.scrapNum) != Number(info.repairNum)) {
this.$refs.popup.open()
this.id = info.id
this.taskId = info.taskId
this.maId = info.maId
this.typeId = info.typeId
if (info.code == '' || info.code == null) {
this.ifNo = 0
} else {
this.ifNo = 1
}
2023-12-20 15:15:23 +08:00
}
},
closePopup () {
this.$refs.popup.close()
},
confirmType () {
console.log(this.fixType);
switch (this.fixType) {
case '1':
this.jumpUrl('innerFix', this.id, this.taskId, this.maId, this.typeId, this.ifNo)
break;
case '2':
this.jumpUrl('returnFix', this.id, this.taskId, this.maId, this.typeId, this.ifNo)
break;
case '3':
this.jumpUrl('waitCrash', this.id, this.taskId, this.maId, this.typeId, this.ifNo)
break;
}
},
jumpUrl (path, id, taskId, maId, typeId, ifNo) {
uni.navigateTo({
url: `/pages/${path}/${path}?id=${id}&taskId=${taskId}&maId=${maId}&typeId=${typeId}&ifNo=${ifNo}`
})
this.closePopup()
this.fixType = ''
},
finishFix () {
let that = this
that.idList = []
for (let i = 0; i < that.fetchList.length; i++) {
that.idList.push(that.fetchList[i].id)
}
// 维修完成
2024-01-02 13:26:42 +08:00
that.$api.fix.completeFix(that.idList).then(res => {
console.log(res);
2024-03-13 17:55:34 +08:00
if (res.data.code == 200) {
uni.showToast({
icon: 'none',
title: res.data.msg
})
}
}).catch(err => {
console.log(err);
})
},
initFixList (taskId) {
let that = this
that.$api.fix.fixDetail({
taskId
}).then(res => {
console.log(res);
if (res.data.code == 200) {
2024-03-21 15:42:08 +08:00
if (res.data.data.length == 0) {
that.btnStatus = false
uni.showToast({
icon: 'none',
title: '未查询到相关数据!'
})
} else {
that.fetchList = res.data.data
// 判断按钮是否启用
that.btnStatus = that.fetchList.every(item => item.repairNum == item.repairedNum + item.scrapNum)
console.log(!that.btnStatus);
}
} else {
that.btnStatus = false
uni.showToast({
icon: 'none',
title: res.data.msg
})
2024-03-13 17:55:34 +08:00
}
2024-01-02 13:26:42 +08:00
}).catch(err => {
console.log(err);
2023-12-20 15:15:23 +08:00
})
}
},
onLoad(params) {
let that = this
console.log(params.id);
2024-03-13 17:55:34 +08:00
that.initTaskId = params.id
2023-12-20 15:15:23 +08:00
// 获取维修任务机具列表
2024-03-13 17:55:34 +08:00
},
onShow() {
this.initFixList(this.initTaskId)
2023-12-20 15:15:23 +08:00
}
}
</script>
<style lang="scss">
body{
box-sizing: border-box;
padding-bottom: 10vh;
}
.single-fetch{
width: 100%;
box-sizing: border-box;
padding: 20rpx 35rpx;
border-bottom: 1px solid #DDDDDD;
view{
display: flex;
align-items: center;
margin-bottom: 25rpx;
span{
color: #A7A7A7;
padding-right: 20rpx;
}
h4{
font-size: 14px;
font-weight: normal;
}
}
view:last-child{
margin-bottom: 0;
}
}
.btm-sub{
position: fixed;
left: 0;
bottom: 0;
width: 100%;
box-sizing: border-box;
padding: 20rpx 40rpx;
}
.popup{
2024-03-13 17:55:34 +08:00
width: 90vw;
2023-12-20 15:15:23 +08:00
height: 30vh;
background-color: #fff;
border-radius: 15rpx;
overflow: hidden;
background: linear-gradient(#D9E7FE, #fff, #fff, #fff);
.pop-top{
width: 100%;
height: 5vh;
box-sizing: border-box;
padding: 0 25rpx;
display: flex;
justify-content: flex-end;
align-items: center;
}
.select-area{
width: 95%;
margin: 3vh auto;
.uni-data-checklist .checklist-group[data-v-84d5d996]{
justify-content: center;
}
}
.btn-area{
width: 60%;
display: flex;
margin: 0 auto;
justify-content: space-around;
align-items: center;
view{
box-sizing: border-box;
padding: 10rpx 30rpx;
border-radius: 15rpx;
font-size: 14px;
}
}
}
</style>