SmartStorage/pages/repairTestInStoreDetail/repairTestInStoreDetail.vue

412 lines
8.8 KiB
Vue
Raw Normal View History

2023-12-20 15:15:23 +08:00
<template>
<view>
2023-12-23 11:54:30 +08:00
<view
class="single-fetch"
v-for="(fetch, index) in fetchList"
:key="index"
>
<checkbox-group
@change="checkClick(fetch)"
v-show="status == '入库进行中'"
>
<checkbox :checked="fetch.checked" />
</checkbox-group>
<view class="slots">
<view>
<span>类型名称</span>
<h4>{{ fetch.typeName2 }}</h4>
</view>
<view>
<span>规格型号</span>
<h4>{{ fetch.typeName }}</h4>
</view>
<view>
<span>申请数量</span>
<h4>{{ fetch.repairNum }}</h4>
</view>
<view>
<span>设备编号</span>
<h4>{{ fetch.maCode }}</h4>
</view>
<view>
<span>入库时间</span>
2024-03-13 17:55:34 +08:00
<h4>{{ fetch.status == '已入库' ? fetch.updateTime : fetch.status }}</h4>
2023-12-23 11:54:30 +08:00
</view>
</view>
</view>
<!-- <view class="btm-exam">
<view
class="exam"
@click="exam"
>
审核
</view>
</view> -->
<view
class="buy"
v-show="status == '入库进行中'"
>
<view class="checked">
<checkbox-group @tap="checkAll">
<checkbox :checked="allChecked" />
</checkbox-group>
<text>全选</text>
</view>
<view class="total">
<view class="bill" @click="finishCart">
<text>审核</text>
</view>
</view>
</view>
2024-04-20 14:35:37 +08:00
<uni-popup
ref="popup"
type="center"
:mask-click="false"
>
<view class="popup">
<view class="pop-top">
<h4>审批</h4>
<uni-icons
style="color: #AAAAAA; font-weight: bold;"
type="closeempty"
@click="closePopup"
>
</uni-icons>
</view>
<h4 style="width: 85%; margin: 2vh auto; font-weight: normal; text-align: center;">是否通过审批</h4>
<view class="select-area">
<view @click="modalConfirm">通过</view>
<view @click="modalReject">驳回</view>
<!-- <uni-forms ref="examForm" :modelValue="examFormData" :rules="rules" label-position="top">
<uni-forms-item name="ifPass" required label="是否通过" label-width="150">
<uni-data-select
v-model="examFormData.ifPass"
:localdata="ifPassRange"
:clear="false"
@change="ifPassChange"
></uni-data-select>
</uni-forms-item>
<uni-forms-item required v-show="examFormData.ifPass == '1'" name="noPassReason" label="不通过原因" label-width="150">
<uni-easyinput type="textarea" v-model="examFormData.noPassReason" placeholder="请输入内容"></uni-easyinput>
</uni-forms-item>
<button class="submit-btn" @click="formSubmit">确认</button>
</uni-forms> -->
</view>
</view>
</uni-popup>
2024-07-01 10:50:02 +08:00
<u-loading-page :loading="showLoading" color="#000" loading-text="提交中,请稍后..."></u-loading-page>
2023-12-20 15:15:23 +08:00
</view>
</template>
<script>
export default {
data() {
return {
2024-07-01 10:50:02 +08:00
showLoading: false,
2023-12-23 11:54:30 +08:00
fetchList: [
],
allChecked: false,
inStoreList: [],
taskId: '',
status: ''
2023-12-20 15:15:23 +08:00
}
},
methods: {
2023-12-23 11:54:30 +08:00
checkClick(item) {
item.checked = !item.checked
if (!item.checked) {
this.allChecked = false
} else {
// 判断每一个商品是否是被选择的状态
const goods = this.fetchList.every(item => {
return item.checked === true
})
if (goods) {
this.allChecked = true
} else {
this.allChecked = false
}
}
},
//全选、全不选
checkAll() {
this.allChecked = !this.allChecked
if (this.allChecked) {
this.fetchList.map(item => {
item.checked = true
})
} else {
this.fetchList.map(item => {
item.checked = false
})
}
},
finishCart () {
let that = this
that.inStoreList = that.fetchList.filter((item) => {
return item.checked == true
}).map((subItem) => {
return {
taskId: that.taskId,
id: subItem['id'],
type: subItem['manageType'],
maId: subItem['maId'],
typeId: subItem['typeId'],
remark: subItem['remark'],
repairNum: subItem['repairNum']
}
})
if (that.inStoreList.length == 0) {
uni.showToast({
icon: 'none',
title: '未选中审核项!'
})
} else {
2024-04-20 14:35:37 +08:00
that.openPopup()
/* uni.showModal({
2023-12-23 11:54:30 +08:00
title: '确认审核',
content: '是否通过审核?',
confirmText: '通过',
2024-04-20 14:35:37 +08:00
cancelText: '驳回',
2023-12-23 11:54:30 +08:00
success: (res) => {
if (res.confirm) {
that.inStoreList.forEach((item) => {
item.checkType = 1
})
console.log(that.inStoreList);
that.subInStore(that.inStoreList)
2024-04-20 14:35:37 +08:00
} else if (res.cancel) {
2023-12-23 11:54:30 +08:00
that.inStoreList.forEach((item) => {
item.checkType = 2
})
console.log(that.inStoreList);
that.subInStore(that.inStoreList)
2024-04-20 14:35:37 +08:00
}
2023-12-23 11:54:30 +08:00
}
2024-04-20 14:35:37 +08:00
}) */
2023-12-23 11:54:30 +08:00
}
},
subInStore (obj) {
let that = this
2024-07-01 10:50:02 +08:00
that.showLoading = true
2023-12-23 11:54:30 +08:00
// 通过审核或驳回
that.$api.repairTestInStore.processOrReject({
params: JSON.stringify(obj)
}).then(res => {
console.log(res);
if (res.data.code == 200) {
2024-07-01 10:50:02 +08:00
that.showLoading = false
2023-12-23 11:54:30 +08:00
uni.showToast({
icon: 'none',
title: res.data.msg,
success: () => {
2024-04-20 14:35:37 +08:00
that.closePopup()
2023-12-23 11:54:30 +08:00
/* uni.redirectTo({
url: '/pages/repairTestInStore/repairTestInStore'
}) */
uni.navigateBack()
}
})
} else {
2024-07-01 10:50:02 +08:00
that.showLoading = false
2023-12-23 11:54:30 +08:00
uni.showToast({
icon: 'none',
title: res.data.msg
})
}
})
2024-04-20 14:35:37 +08:00
},
openPopup () {
this.$refs.popup.open()
},
closePopup () {
this.$refs.popup.close()
},
modalConfirm () {
this.inStoreList.forEach(item => {
item.checkType = 1
})
console.log(this.inStoreList);
this.subInStore(this.inStoreList)
},
modalReject () {
this.inStoreList.forEach(item => {
item.checkType = 2
})
console.log(this.inStoreList);
this.subInStore(this.inStoreList)
2023-12-23 11:54:30 +08:00
}
},
onLoad(params) {
let that = this
console.log(params);
that.status = params.taskStatus
that.taskId = params.taskId
// 获取修试入库明细
that.$api.repairTestInStore.repairTestInStoreDetail({
taskId: params.taskId
}, null).then(res => {
if (res.data.code == 200) {
for (let i = 0; i < res.data.data.length; i++) {
res.data.data[i].checked = false
2024-03-13 17:55:34 +08:00
if (res.data.data[i].maCode == null) {
res.data.data[i].maCode = '暂无'
}
2023-12-23 11:54:30 +08:00
}
that.fetchList = res.data.data
console.log(that.fetchList);
}
}).catch(err => {
2024-04-20 14:35:37 +08:00
console.log(err);
2023-12-23 11:54:30 +08:00
})
2023-12-20 15:15:23 +08:00
}
}
</script>
2023-12-23 11:54:30 +08:00
<style lang="scss">
body{
box-sizing: border-box;
padding-bottom: 10vh;
}
.single-fetch{
width: 100%;
box-sizing: border-box;
padding: 20rpx 35rpx;
display: flex;
align-items: center;
border-bottom: 1px solid #DDDDDD;
.slots{
display: flex;
flex-direction: column;
margin-left: 30rpx;
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-exam{
position: fixed;
left: 0;
bottom: 0;
width: 100%;
box-sizing: border-box;
padding: 20rpx 40rpx;
display: flex;
justify-content: flex-end;
border-top: 2px solid #F6F8FF;
.exam{
box-sizing: border-box;
padding: 10rpx 50rpx;
border-radius: 30rpx;
background-color: #3788FF;
font-size: 14px;
color: #fff;
}
}
.buy {
display: flex;
align-items: center;
justify-content: space-between;
position: fixed;
left: 50%;
bottom: 0;
width: 95%;
transform: translate(-50%, 0);
}
.buy .checked {
display: flex;
align-items: center;
}
.buy .checked text {
font-size: 25rpx;
color: #000;
padding: 0 12rpx;
}
.buy .total {
display: flex;
align-items: center;
justify-content: space-between;
}
.buy .total .price {
padding-right: 20rpx;
}
.buy .total .price text {
font-size: 27rpx;
color: #C8C7CC;
display: inline-block;
}
.buy .total .price text:last-child {
color: red;
font-weight: bold;
}
.buy .total .bill text {
font-size: 25rpx;
color: #fff;
display: inline-block;
background-color: red;
line-height: 70rpx;
width: 150rpx;
text-align: center;
}
2024-04-20 14:35:37 +08:00
.popup{
width: 80vw;
height: 20vh;
background-color: #fff;
border-radius: 15rpx;
overflow: hidden;
background: linear-gradient(#D9E7FE, #fff, #fff, #fff);
}
.popup>.pop-top{
width: 100%;
height: 5vh;
box-sizing: border-box;
padding: 0 25rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.popup>.select-area{
width: 85%;
margin: 40rpx auto;
display: flex;
justify-content: space-around;
align-items: center;
}
.popup>.select-area>view{
box-sizing: border-box;
font-size: 30rpx;
padding: 12rpx 24rpx;
background-color: #3788FF;
color: #fff;
border-radius: 20rpx;
}
2023-12-20 15:15:23 +08:00
</style>