SmartStorage/pages/testExam/testExamDetails.vue

519 lines
11 KiB
Vue
Raw Normal View History

2024-01-04 15:13:09 +08:00
<template>
2024-03-13 17:55:34 +08:00
<view>
<view
class="single-fetch"
v-for="(fetch, index) in fetchList"
:key="index"
>
<checkbox-group
@change="checkClick(fetch)"
v-show="taskStatus == 46 && ableNum == 1 && fetch.status == '未审核'"
>
<checkbox :checked="fetch.checked" />
</checkbox-group>
<view class="slots">
<view>
<span>类型名称</span>
<h4>{{ fetch.machineTypeName }}</h4>
</view>
<view>
<span>规格型号</span>
<h4>{{ fetch.specificationType }}</h4>
</view>
<view>
<span>设备编号</span>
<h4>{{ fetch.maCode }}</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>
<span>状态</span>
<h4>{{ fetch.status }}</h4>
</view>
</view>
</view>
<!-- <view class="btm-exam">
<view
class="exam"
@click="exam"
>
审核
</view>
</view> -->
<view
class="buy"
style="background-color: #fff;"
v-show="taskStatus == 46 && ableNum == 1"
>
<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-05-31 15:47:02 +08:00
<uni-popup
ref="popup1"
type="center"
:mask-click="false"
>
<view class="popup1">
<view class="pop-top">
<h4>驳回原因</h4>
<uni-icons
style="color: #AAAAAA; font-weight: bold;"
type="closeempty"
@click="closePopup1"
>
</uni-icons>
</view>
<view class="select-area">
<uni-easyinput v-model="rejectReason" maxlength="50" placeholder="请填写驳回原因"></uni-easyinput>
<view class="btn" @click="confirmReject">驳回</view>
</view>
</view>
</uni-popup>
2024-03-13 17:55:34 +08:00
</view>
2024-01-04 15:13:09 +08:00
</template>
<script>
2024-03-13 17:55:34 +08:00
export default {
data() {
return {
fetchList: [
],
allChecked: false,
auditDetailList: [],
taskId: '',
taskIdList: [],
taskStatus: '',
status: '',
ableNum: '',
2024-05-31 15:47:02 +08:00
subObj: {},
rejectReason: ''
2024-03-13 17:55:34 +08:00
}
},
methods: {
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
console.log(this.fetchList);
if (this.allChecked) {
this.fetchList.filter(item => {
return item.checked == true || item.checked == false
}).map(subItem => {
subItem.checked = true
})
/* this.fetchList.map(item => {
item.checked = true
}) */
} else {
this.fetchList.filter(item => {
return item.checked == true || item.checked == false
}).map(subItem => {
subItem.checked = false
})
/* this.fetchList.map(item => {
item.checked = false
}) */
}
},
finishCart () {
let that = this
that.taskIdList = []
that.auditDetailList = that.fetchList.filter((item) => {
return item.checked == true
})
if (that.auditDetailList.length == 0) {
uni.showToast({
icon: 'none',
title: '未选中审核项!'
})
} else {
2024-04-20 14:35:37 +08:00
that.openPopup()
/* uni.showModal({
2024-03-13 17:55:34 +08:00
title: '确认审核',
content: '是否通过审核?',
confirmText: '通过',
// cancelText: '驳回',
success: (res) => {
if (res.confirm) {
console.log(that.taskId);
that.taskIdList.push(that.taskId)
that.subObj = {
checkResult: '通过',
taskIdList: that.taskIdList,
auditDetailList: that.auditDetailList
}
console.log(that.subObj);
that.subInStore(that.subObj)
2024-04-20 14:35:37 +08:00
} else if (res.cancel) {
2024-03-13 17:55:34 +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
}
2024-03-13 17:55:34 +08:00
}
2024-04-20 14:35:37 +08:00
}) */
2024-03-13 17:55:34 +08:00
}
},
subInStore (obj) {
let that = this
// 通过审核或驳回
that.$api.testExam.testExamAudit(obj).then(res => {
console.log(res);
if (res.data.code == 200) {
uni.showToast({
icon: 'none',
title: res.data.msg,
success: () => {
2024-04-20 14:35:37 +08:00
that.closePopup()
2024-05-31 18:20:41 +08:00
that.closePopup1()
2024-03-13 17:55:34 +08:00
uni.navigateBack()
}
})
} else {
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()
},
2024-05-31 15:47:02 +08:00
closePopup1 () {
this.$refs.popup1.close()
},
2024-04-20 14:35:37 +08:00
modalConfirm () {
let that = this
that.taskIdList.push(that.taskId)
that.subObj = {
checkResult: '通过',
taskIdList: that.taskIdList,
auditDetailList: that.auditDetailList
}
console.log(that.subObj);
that.subInStore(that.subObj)
},
modalReject () {
let that = this
that.taskIdList.push(that.taskId)
that.subObj = {
checkResult: '驳回',
taskIdList: that.taskIdList,
auditDetailList: that.auditDetailList
}
2024-05-31 15:47:02 +08:00
that.$refs.popup1.open()
// that.subInStore(that.subObj)
},
confirmReject () {
let that = this
if (that.rejectReason == '') {
uni.showToast({
icon: 'none',
title: '请填写驳回原因!'
})
} else {
2024-05-31 18:20:41 +08:00
that.subObj.remark = that.rejectReason
2024-05-31 15:47:02 +08:00
console.log(that.subObj);
2024-05-31 18:20:41 +08:00
that.subInStore(that.subObj)
2024-05-31 15:47:02 +08:00
}
2024-03-13 17:55:34 +08:00
}
},
onLoad(params) {
let that = this
console.log(params);
// that.status = params.taskStatus
that.taskId = params.taskId
that.taskStatus = params.taskStatus
that.ableNum = params.able
// 获取试验检验审核明细
that.$api.testExam.testExamDetails({
taskId: params.taskId
}).then(res => {
console.log(res);
if (res.data.code == 200) {
for (let i = 0; i < res.data.rows.length; i++) {
if (res.data.rows[i].maCode == null) {
res.data.rows[i].maCode = '暂无'
}
switch (res.data.rows[i].status) {
case '0':
res.data.rows[i].status = '未审核'
break;
case '1':
res.data.rows[i].status = '已审核'
break;
case '2':
res.data.rows[i].status = '驳回'
break;
}
if (res.data.rows[i].status == '未审核') {
res.data.rows[i].checked = false
}
}
that.fetchList = res.data.rows
console.log(that.fetchList);
}
}).catch(err => {
console.log(err);
})
}
}
2024-01-04 15:13:09 +08:00
</script>
<style lang="scss">
2024-03-13 17:55:34 +08:00
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;
}
2024-05-31 15:47:02 +08:00
.popup1{
width: 80vw;
height: 20vh;
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: space-between;
align-items: center;
}
.select-area{
width: 85%;
margin: 40rpx auto;
.btn{
width: 30%;
box-sizing: border-box;
padding: 10rpx 0;
display: flex;
justify-content: center;
align-items: center;
background-color: #3788FF;
color: #fff;
font-size: 14px;
border-radius: 15rpx;
margin: 20rpx auto;
}
}
}
2024-01-04 15:13:09 +08:00
</style>