424 lines
12 KiB
Vue
424 lines
12 KiB
Vue
<template>
|
||
<view>
|
||
<navbar-back :autoBack="false" title="样重复核" @leftClick="customBack"></navbar-back>
|
||
<u-row class="content-title" gutter="16">
|
||
<u-col span="4">
|
||
<view class="content-title-name">
|
||
<text>任务列表</text>
|
||
</view>
|
||
<u-gap height="5" bg-color="#0055A2"></u-gap>
|
||
</u-col>
|
||
<u-col span="8">
|
||
<view class="content-title-name">
|
||
<text>样品列表</text>
|
||
</view>
|
||
<u-gap height="5" bg-color="#0055A2"></u-gap>
|
||
</u-col>
|
||
</u-row>
|
||
<u-row class="content-main-height" gutter="16" align="top">
|
||
<u-col span="4">
|
||
<scroll-view
|
||
scroll-y
|
||
scroll-with-animation
|
||
class="content-main-height content-main-left"
|
||
:scroll-top="scrollTop"
|
||
>
|
||
<view
|
||
v-for="(task, index) in taskList"
|
||
:key="index"
|
||
class="u-tab-item"
|
||
:class="[current == index ? 'u-tab-item-active' : '']"
|
||
:data-current="index"
|
||
@tap.stop="swichTask(index)"
|
||
>
|
||
<u-row style="width: 100%">
|
||
<u-col span="2" style="text-align: center">
|
||
<u-icon name="tags-fill" size="34"></u-icon>
|
||
</u-col>
|
||
<u-col span="10">
|
||
<view>
|
||
<text style="font-size: 42rpx">{{ task.taskNo }}</text>
|
||
</view>
|
||
<view style="margin-top: 20rpx">
|
||
<text>{{ task.taskName }}</text>
|
||
</view>
|
||
<view class="x-f" style="margin-top: 20rpx">
|
||
<u-icon name="clock"></u-icon>
|
||
<text style="margin-left: 10rpx">{{ task.taskOperTime }}</text>
|
||
</view>
|
||
</u-col>
|
||
</u-row>
|
||
</view>
|
||
</scroll-view>
|
||
</u-col>
|
||
<u-col span="8">
|
||
<view class="content-main-height">
|
||
<scroll-view scroll-y scroll-with-animation class="content-main-right">
|
||
<u-checkbox-group @change="checkboxGroupChange" style="width: 100%">
|
||
<block v-for="(sample, index) in sampleList" :key="index">
|
||
<view style="width: 100%; padding: 10rpx; font-size: 36rpx">
|
||
<u-row>
|
||
<u-col span="2" style="text-align: center">
|
||
<view>
|
||
<text>【{{ sample.sort }}】</text>
|
||
</view>
|
||
</u-col>
|
||
<u-col span="4">
|
||
<view>
|
||
<text style="padding-left: 20rpx">{{ sample.sampleCode }}</text>
|
||
</view>
|
||
<view>
|
||
<text style="padding-left: 20rpx"
|
||
>{{ sample.dataSourceType | getDataSourceTypeShow }}{{ sample.sampleName }}</text
|
||
>
|
||
</view>
|
||
<view>
|
||
<text v-if="sample.sampleWeight" style="padding-left: 20rpx">{{ sample.sampleWeight }} g</text>
|
||
</view>
|
||
</u-col>
|
||
<u-col span="4">
|
||
<view>
|
||
<text style="padding-left: 20rpx">{{ sample.cupNum }}号杯</text>
|
||
</view>
|
||
<view>
|
||
<text style="padding-left: 20rpx">{{ sample.remarks }}</text>
|
||
</view>
|
||
<view>
|
||
<text style="padding-left: 20rpx">{{ sample.measureTime | getWeightTimeShow }}</text>
|
||
</view>
|
||
</u-col>
|
||
<u-col span="2">
|
||
<view>
|
||
<u-checkbox
|
||
@change="checkboxChange"
|
||
v-model="sample.checked"
|
||
:label="sample.id"
|
||
:name="sample.id"
|
||
>
|
||
</u-checkbox>
|
||
<!-- <block v-if="sample.reviewCount > 0 && sample.weightSubmitStatus == 0">
|
||
<u-button
|
||
type="warning"
|
||
@click="recovery(sample.id)"
|
||
>恢复</u-button>
|
||
</block>
|
||
<block v-else>
|
||
<u-button
|
||
type="default"
|
||
@click="review(sample.id)"
|
||
>复核</u-button>
|
||
</block> -->
|
||
</view>
|
||
</u-col>
|
||
</u-row>
|
||
<u-line style="padding: 10rpx" color="#bbb" />
|
||
</view>
|
||
</block>
|
||
</u-checkbox-group>
|
||
</scroll-view>
|
||
<view class="content-main-right-operation">
|
||
<u-row>
|
||
<u-col span="4"><!-- <u-button class="btn-operation" type="primary">原始记录单打印</u-button> --></u-col>
|
||
<u-col span="4"
|
||
><!-- <u-button class="btn-operation" :disabled="reviewNum > 0" type="success" >数据上报</u-button> --></u-col
|
||
>
|
||
<u-col span="4">
|
||
<!-- <u-button class="btn-operation" :disabled="reviewNum == 0" type="warning" @click="taskReview">任务单退回复核</u-button> -->
|
||
<u-button class="btn-operation" :disabled="reviewList.length <= 0" type="warning" @click="taskReviewAll"
|
||
>任务单退回复核</u-button
|
||
>
|
||
</u-col>
|
||
</u-row>
|
||
</view>
|
||
</view>
|
||
</u-col>
|
||
</u-row>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
scrollTop: 0, //tab标题的滚动条位置
|
||
current: 0, // 预设当前项的值
|
||
menuHeight: 0, // 左边菜单的高度
|
||
menuItemHeight: 0, // 左边菜单item的高度
|
||
currentTaskId: '', //当前选择的任务单id
|
||
currentTaskNo: '', //当前选中的任务编号
|
||
reviewNum: 0, //复核数
|
||
reviewList: [],
|
||
taskList: [],
|
||
sampleList: []
|
||
}
|
||
},
|
||
onLoad(param) {
|
||
if (param.currentTaskNo) {
|
||
this.currentTaskNo = param.currentTaskNo
|
||
}
|
||
//获取任务列表
|
||
this.getAssayTask()
|
||
},
|
||
methods: {
|
||
//返回上一页
|
||
customBack() {
|
||
uni.redirectTo({
|
||
url: '/pages/analysis/sample/sample-report'
|
||
})
|
||
},
|
||
//开始秤样
|
||
startWeighSample() {
|
||
uni.navigateTo({
|
||
url: '/pages/auncel/auncel-weigh'
|
||
})
|
||
},
|
||
//切换任务
|
||
async swichTask(index) {
|
||
if (index == this.current) return
|
||
this.current = index
|
||
// 如果为0,意味着尚未初始化
|
||
if (this.menuHeight == 0 || this.menuItemHeight == 0) {
|
||
await this.getElRect('menu-scroll-view', 'menuHeight')
|
||
await this.getElRect('u-tab-item', 'menuItemHeight')
|
||
}
|
||
// 将菜单菜单活动item垂直居中
|
||
this.scrollTop = index * this.menuItemHeight + this.menuItemHeight / 2 - this.menuHeight / 2
|
||
|
||
//获取任务详情
|
||
this.currentTaskNo = this.taskList[index].taskNo
|
||
this.currentTaskId = this.taskList[index].id
|
||
this.getAssayTaskDetail(this.currentTaskNo)
|
||
},
|
||
// 获取一个目标元素的高度
|
||
getElRect(elClass, dataVal) {
|
||
new Promise((resolve, reject) => {
|
||
const query = uni.createSelectorQuery().in(this)
|
||
query
|
||
.select('.' + elClass)
|
||
.fields({ size: true }, res => {
|
||
// 如果节点尚未生成,res值为null,循环调用执行
|
||
if (!res) {
|
||
setTimeout(() => {
|
||
this.getElRect(elClass)
|
||
}, 10)
|
||
return
|
||
}
|
||
this[dataVal] = res.height
|
||
})
|
||
.exec()
|
||
})
|
||
},
|
||
getAssayTask() {
|
||
//显示loading
|
||
uni.showLoading({
|
||
title: '加载中...'
|
||
})
|
||
// this.$u.api
|
||
// .getAssayTaskListBy({taskStatus:2})
|
||
const param = {
|
||
operateType: 'review',
|
||
taskNo: this.currentTaskNo
|
||
}
|
||
this.$u.api
|
||
.getAssayTaskList(param)
|
||
.then(res => {
|
||
this.taskList = res.result
|
||
this.currentTaskNo = this.taskList[0].taskNo
|
||
this.currentTaskId = this.taskList[0].id
|
||
this.getAssayTaskDetail(this.currentTaskNo)
|
||
uni.hideLoading()
|
||
})
|
||
.catch(err => {
|
||
uni.hideLoading()
|
||
console.log(err)
|
||
})
|
||
},
|
||
getAssayTaskDetail(taskNo) {
|
||
this.reviewNum = 0
|
||
this.$u.api
|
||
.getAssayTaskDetailListByTaskNo({ taskNo: taskNo })
|
||
.then(res => {
|
||
this.sampleList = res.result
|
||
this.showLoading = false
|
||
|
||
//统计需要复核的数量
|
||
this.sampleList.forEach(item => {
|
||
if (item.reviewCount > 0 && item.weightSubmitStatus == 0) {
|
||
item.checked = true
|
||
this.reviewNum += 1
|
||
}
|
||
})
|
||
})
|
||
.catch(err => {
|
||
this.showLoading = false
|
||
console.log(err)
|
||
})
|
||
},
|
||
review(id) {
|
||
this.$u.api
|
||
.assayTaskDetailReview(id)
|
||
.then(res => {
|
||
this.getAssayTaskDetail(this.currentTaskNo)
|
||
this.showLoading = false
|
||
})
|
||
.catch(err => {
|
||
this.showLoading = false
|
||
console.log(err)
|
||
})
|
||
},
|
||
recovery(id) {
|
||
this.$u.api
|
||
.assayTaskDetailRecovery(id)
|
||
.then(res => {
|
||
this.getAssayTaskDetail(this.currentTaskNo)
|
||
this.showLoading = false
|
||
})
|
||
.catch(err => {
|
||
this.showLoading = false
|
||
console.log(err)
|
||
})
|
||
},
|
||
//任务单退回复核
|
||
taskReview() {
|
||
this.$u.api
|
||
.assayTaskReview(this.currentTaskId)
|
||
.then(res => {
|
||
this.showLoading = false
|
||
|
||
uni.redirectTo({
|
||
url: '/pages/sample/sample-report'
|
||
})
|
||
})
|
||
.catch(err => {
|
||
this.showLoading = false
|
||
console.log(err)
|
||
})
|
||
},
|
||
//任务单及样品退回复核
|
||
taskReviewAll() {
|
||
uni.showModal({
|
||
title: '提示',
|
||
content: '确定复核当前选中的样品?',
|
||
cancelColor: '#0055A2',
|
||
confirmColor: '#0055A2',
|
||
success: res => {
|
||
if (res.cancel) {
|
||
console.log('用户点击取消')
|
||
return
|
||
}
|
||
console.log('确定。。。')
|
||
//显示loading
|
||
uni.showLoading({
|
||
title: '退回中...'
|
||
})
|
||
this.$u.api
|
||
.reviewWeightTaskByTaskIdAndSampleIds(this.currentTaskId, this.reviewList.join(','))
|
||
.then(res => {
|
||
uni.hideLoading()
|
||
uni.redirectTo({
|
||
url: '/pages/sample/sample-report'
|
||
})
|
||
})
|
||
.catch(err => {
|
||
uni.hideLoading()
|
||
console.log(err)
|
||
})
|
||
}
|
||
})
|
||
},
|
||
checkboxGroupChange(v) {
|
||
this.reviewList = v
|
||
this.reviewNum = v.length
|
||
//console.log('group change', v);
|
||
},
|
||
checkboxChange(e) {
|
||
/* if(e.value) {
|
||
this.review(e.name);
|
||
} else {
|
||
this.recovery(e.name);
|
||
} */
|
||
}
|
||
},
|
||
filters: {
|
||
getWeightTimeShow(time) {
|
||
if (time == null) return ''
|
||
return time.split(' ')[1]
|
||
},
|
||
getDataSourceTypeShow(val) {
|
||
if (val == 2) return '【筛上】'
|
||
if (val == 3) return '【筛下】'
|
||
return ''
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.content-title {
|
||
height: 110rpx;
|
||
width: 100%;
|
||
font-size: 46rpx;
|
||
font-weight: 300;
|
||
}
|
||
|
||
.content-title-name {
|
||
padding: 20rpx;
|
||
text-align: center;
|
||
}
|
||
|
||
.content-main-height {
|
||
height: calc(100vh - 250rpx);
|
||
}
|
||
|
||
.content-main-left {
|
||
background-color: #f6f6f6;
|
||
}
|
||
|
||
.u-tab-item {
|
||
padding: 10rpx;
|
||
height: 200rpx;
|
||
background: #f6f6f6;
|
||
box-sizing: border-box;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
font-size: 36rpx;
|
||
color: #444;
|
||
font-weight: 400;
|
||
line-height: 1;
|
||
border-width: 4rpx;
|
||
border-bottom: dotted;
|
||
}
|
||
|
||
.u-tab-item-active {
|
||
position: relative;
|
||
color: #0055a2;
|
||
font-size: 36rpx;
|
||
font-weight: 600;
|
||
background: #fff;
|
||
}
|
||
|
||
.u-tab-item-active::before {
|
||
content: '';
|
||
position: absolute;
|
||
|
||
height: 32rpx;
|
||
left: 0;
|
||
top: 39rpx;
|
||
}
|
||
|
||
.content-main-right {
|
||
height: calc(100vh - 410rpx);
|
||
}
|
||
|
||
.content-main-right-operation {
|
||
height: 160rpx;
|
||
padding-top: 30rpx;
|
||
}
|
||
|
||
.btn-operation {
|
||
height: 100rpx;
|
||
font-size: 36rpx;
|
||
}
|
||
</style>
|