<template>
|
<view class="edc-sampling-wrap">
|
<view class="edc-sampling-main">
|
<view class="edc-sampling-card" v-for="(item,index) in edcList" :key="index">
|
<view class="edc-sampling-line">
|
<h1>{{item.carNo}}</h1>
|
<view class="status" :class="statusClassComputed(item.status)" v-if="item.status">{{statusComputed(item.status)}}</view>
|
</view>
|
<view class="edc-sampling-line">
|
<h2>供应商:{{item.customerName}}</h2>
|
</view>
|
<view class="edc-sampling-btn-box">
|
<!-- checkId 没有值 创建EDC质检单显示 -->
|
<view class="watch" v-if="!item.checkId">
|
<u-button @click.native.stop="handleEDCClick(item)" type="primary">创建EDC质检单</u-button>
|
</view>
|
|
<view class="watch" v-else>
|
<u-button @click.native.stop="handleWatchClick(item)" type="primary">查看</u-button>
|
</view>
|
</view>
|
</view>
|
<view class="isOver" v-if="flag">------我是有底线的------</view>
|
<!-- <view class="edc-sampling-card">-->
|
<!-- <view class="edc-sampling-line">-->
|
<!-- <h1>冀DE9Y75</h1>-->
|
<!-- <view class="status yellow">待质检</view>-->
|
<!-- </view>-->
|
<!-- <view class="edc-sampling-line">-->
|
<!-- <h2>供应商:冀中无人值守</h2>-->
|
<!-- </view>-->
|
<!-- <view class="edc-sampling-btn-box">-->
|
<!-- <view class="watch">-->
|
<!-- <u-button type="primary">创建EDC质检单</u-button>-->
|
<!-- </view>-->
|
<!--<!– <view class="watch">–>-->
|
<!--<!– <u-button type="primary" :plain="true">查看</u-button>–>-->
|
<!--<!– </view>–>-->
|
<!-- </view>-->
|
<!-- </view>-->
|
<!-- <view class="edc-sampling-card">-->
|
<!-- <view class="edc-sampling-line">-->
|
<!-- <h1>冀DE9Y75</h1>-->
|
<!-- <view class="status">待质检</view>-->
|
<!-- </view>-->
|
<!-- <view class="edc-sampling-line">-->
|
<!-- <h2>供应商:冀中无人值守</h2>-->
|
<!-- </view>-->
|
<!-- <view class="edc-sampling-btn-box">-->
|
<!-- <view class="watch">-->
|
<!-- <u-button type="primary">创建EDC质检单</u-button>-->
|
<!-- </view>-->
|
<!--<!– <view class="watch">–>-->
|
<!--<!– <u-button type="primary" :plain="true">查看</u-button>–>-->
|
<!--<!– </view>–>-->
|
<!-- </view>-->
|
<!-- </view>-->
|
</view>
|
</view>
|
</template>
|
|
<script>
|
export default {
|
name: "edc-sampling",
|
data() {
|
return {
|
edcList:[],
|
size:10,
|
current:1,
|
total:0,
|
flag:false,
|
productId:'1791273012817821697', // EDC传productId:1791273012817821697
|
}
|
},
|
onShow() {
|
this.edcList = []
|
this.current = 1
|
this.getPageList()
|
},
|
methods: {
|
statusComputed(status) {
|
if(status == 1) {
|
return '已取样'
|
}else if(status == 2) {
|
return '质检中'
|
}else if(status == 3) {
|
return '待复核'
|
}else if(status == 4) {
|
return '复核中'
|
}else if(status == 5) {
|
return '待审定'
|
}else if(status == 6) {
|
return '审定中'
|
}else if(status == 7) {
|
return '已完成'
|
}else {
|
return ''
|
}
|
},
|
statusClassComputed(status) {
|
if(status == 1) {
|
return 'blue'
|
}else if(status == 2) {
|
return 'red'
|
}else if(status == 3) {
|
return 'red'
|
}else if(status == 4) {
|
return 'red'
|
}else if(status == 5) {
|
return 'red'
|
}else if(status == 6) {
|
return 'red'
|
}else if(status == 7) {
|
return 'black'
|
}else {
|
return ''
|
}
|
},
|
async getPageList(callBack) {
|
uni.showLoading({
|
title: "加载中"
|
})
|
// this.$reqGet('pageList').then(res => {
|
// console.log(res,'原盐钙镁----')
|
// if(res.code == 0) {
|
// uni.hideLoading()
|
// this.edcList = [...this.edcList,...res.data.records]
|
// }else {
|
// uni.hideLoading()
|
// }
|
// })
|
try{
|
const res = await this.$reqGet('getTaskCoalOfNoDetection',{current:this.current,size:this.size,productId:this.productId})
|
uni.hideLoading()
|
this.edcList = [...this.edcList,...res.data.records]
|
this.total = res.data.total
|
callBack && callBack()
|
}catch (err) {
|
uni.hideLoading()
|
console.log(err,'err')
|
}
|
},
|
onReachBottom() { //上拉加载
|
console.log('上拉加载------')
|
if(this.edcList.length < this.current*this.size) return this.flag = true
|
this.current ++;
|
this.getPageList()
|
},
|
onPullDownRefresh() { //下拉刷新
|
console.log()
|
this.current = 1
|
this.edcList = []
|
setTimeout(() => {
|
this.getPageList(() => {
|
uni.stopPullDownRefresh()
|
})
|
},1000)
|
},
|
handleWatchClick(item) { //查看详情
|
console.log(item,'item=====')
|
uni.navigateTo({
|
url: '/pages/quality-inspection-page/edc-sampling/edc-sampling-form/edc-sampling-form?checkId='+item.checkId
|
})
|
},
|
handleEDCClick(item) { //创建EDC质检单
|
uni.showLoading({
|
title: "加载中"
|
})
|
uni.showModal({
|
title: '确认',
|
content: '确认创建EDC质检单吗',
|
success: (res) => {
|
if(res.confirm) {
|
//调用接口
|
this.$reqPost('edcSampling',item,'json').then(res => {
|
console.log(res,'res=====-----')
|
if(res.code == 0) {
|
uni.hideLoading()
|
this.$u.toast('创建成功');
|
this.edcList = []
|
this.getPageList()
|
}
|
})
|
|
}else if(res.cancel){
|
uni.hideLoading()
|
return true
|
}
|
}
|
})
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
@mixin commonBtn($h:62rpx){
|
background-image: linear-gradient(to right,#497bfb,#2467fd);
|
height: $h!important;
|
box-shadow: 0 0 10px rgba(43,98,239,0.5);
|
}
|
.edc-sampling-wrap{
|
width: 100%;
|
.edc-sampling-main{
|
width: 100%;
|
display: flex;
|
flex-direction: column;
|
padding: 20rpx;
|
box-sizing: border-box;
|
.edc-sampling-card{
|
width: 100%;
|
border-radius: 20rpx;
|
background: #fff;
|
box-shadow: 0 0 25px rgba(73,120,240,0.15);
|
padding: 30rpx;
|
box-sizing: border-box;
|
margin-top: 20rpx;
|
.edc-sampling-line{
|
width: 100%;
|
display: flex;
|
justify-content: space-between;
|
align-items: baseline;
|
h1{
|
font-size: 34rpx;
|
color: #1c1c1c;
|
font-weight: 550;
|
line-height: 2;
|
}
|
h2{
|
font-size: 30rpx;
|
color: #515151;
|
line-height: 2;
|
}
|
.status{
|
color: #184edd;
|
border: 1px solid #184edd;
|
border-radius: 10rpx;
|
font-size: 28rpx;
|
padding: 0 10rpx;
|
display: flex;
|
align-self: baseline;
|
}
|
.blue{
|
color: #184edd;
|
border: 1px solid #184edd;
|
}
|
.red{
|
color: #f56c6c;
|
border: 1px solid #f56c6c;
|
}
|
.black{
|
color: black;
|
border: 1px solid black;
|
}
|
.yellow{
|
color: #fcbd20;
|
border: 1px solid #fcbd20;
|
}
|
}
|
.edc-sampling-btn-box{
|
display: flex;
|
justify-content: flex-end;
|
margin-top:20rpx;
|
::v-deep{
|
.u-button{
|
border-radius: 50rpx;
|
margin: 0 10rpx;
|
padding: 0 40rpx;
|
@include commonBtn;
|
}
|
}
|
.watch{
|
margin: 0 15rpx;
|
}
|
}
|
}
|
}
|
}
|
|
|
</style>
|