< template >
< view class = "taskList" >
<!-- -- >
< u -navbar
title = "操作详情"
@ leftClick = "leftClick"
: safeAreaInsetTop = "false"
>
< view class = "u-nav-slot" slot = "right" @ click = "show = true" >
...
< / view >
< / u - n a v b a r >
< u -popup :show ="show" mode = "center" class = "specialPop" @close ="close" >
< view >
< u -button type = "primary" size = "small" text = "切换账号" @click ="changeUser" > < / u -button >
< / view >
< / u - p o p u p >
< view style = "margin-top:44px;" >
< view style = "padding:0 24upx;" >
< u -cell -group >
< u -cell size = "large" center title = "炉号" :value ="info.heat_num" :titleStyle ="{color:'#0076F6'}" > < / u - c e l l >
< u -cell size = "large" title = "不良品选项" center
v - show = "contentInfo.rejects!='null'?true:(info.status==3?false:true)"
: disabled = "info.status==3?true:false" @ click = "sheetShow = true" >
< view slot = "value" style = "flex:1;position: relative; " class = "u-slot-value" >
{ { contentInfo . rejects != 'null' ? contentInfo . rejects : '' } }
< u -icon name = "arrow-down" :class ="!contentInfo.rejects?'isEmpty':'notEmpty'"
color = "#333333" size = "21" > < / u - i c o n >
< / view >
< / u - c e l l >
< u -cell size = "large" title = "不良品数量" center >
< view slot = "value" class = "u-slot-value" >
< u - -input
placeholder = "请输入不良品数量"
border = "none"
style = "background: #ffffff;"
: disabled = "info.status==3?true:false"
v - model = "contentInfo.rejects_num"
clearable
> < / u - - i n p u t >
< / view >
< / u - c e l l >
< u -cell size = "large" :key ="index" v-for ="(item,index) in contentInfo.content" :titleStyle="{color:'#E03023'}" class="specialLabel" :title="item.key" center :value="item.value" > < / u -cell >
< u -cell size = "large" title = "待质检数量" :value ="contentInfo.member_num.toString()" center > < / u - c e l l >
< u -cell size = "large" title = "合格数量" center :value ="contentInfo.qualified_num.toString()" > < / u - c e l l >
< u -cell size = "large" title = "不合格数量" center :value ="contentInfo.no_qualified_num.toString()" > < / u - c e l l >
< u -cell size = "large" title = "状态" center :value ="contentInfo.statusName" > < / u - c e l l >
< u -cell size = "large" title = "用时" center :value ="contentInfo.use_time" > < / u - c e l l >
< u -cell size = "large" title = "重要提示" :titleStyle ="{color:'#E03023'}" center v-show ="contentInfo.needing_remake" :value="contentInfo.needing_remake" > < / u -cell >
< u -cell size = "large" title = "附件" center >
< view slot = "value" class = "u-slot-value fujian" @click ="downLoad(contentInfo.file)" style = "display: flex;align-items: center;" >
< image src = "../../static/img.png" v-show ="contentInfo.file_suffix=='png'" mode="" > < / image >
< image src = "../../static/pdf.png" v-show ="contentInfo.file_suffix=='pdf'" mode="" > < / image >
<!-- < text style = "overflow: hidden;width:400upx;text-overflow: ellipsis;" > { { contentInfo . file } } < / text > -- >
< text style = "color:#0076F6;text-decoration: underline;margin-left:10upx;" > 查看 < / text >
< / view >
< / u - c e l l >
< u -cell size = "large" title = "拍照" center class = "img" :border ="false" >
< view slot = "value" class = "u-slot-value" >
< u -upload
: fileList = "fileList"
@ afterRead = "afterRead"
@ delete = "deletePic"
name = "5"
: deletable = "info.status!=3?true:false"
: disabled = "info.status==3?true:false"
: previewFullImage = "true"
multiple
: maxCount = "3"
> < / u - u p l o a d >
< / view >
< / u - c e l l >
< / u - c e l l - g r o u p >
< / view >
< view class = "submitContent" v-if ="info.status!=3" >
< u - -input
placeholder = "请输入完成数量"
border = "surround"
v - model = "num"
: disabled = "info.status==3?true:false"
class = "input"
shape = "circle"
> < / u - - i n p u t >
< u -button
: disabled = "num?false:true"
@ click = "submitHandle" > 确定完成 ( 已用时 { { submitTimesNum } } 秒 ) < / u - b u t t o n >
< / view >
< / view >
< u -popup :show ="sheetShow" mode = "bottom" class = "rejectDialog" @close ="rejectHandle" >
< view >
< u -checkbox -group
v - model = "checkboxValue1"
placement = "row"
@ change = "checkboxChange"
class = "checkboxflex"
>
< u -checkbox
: customStyle = "{marginBottom: '8px'}"
v - for = "(item, index) in checkboxList1"
: key = "index"
: label = "item.name"
: name = "item.name"
>
< / u - c h e c k b o x >
< / u - c h e c k b o x - g r o u p >
< u -button type = "primary" text = "确定" @click.native.stop ="besure" style = "margin-top: 50upx;" > < / u - b u t t o n >
< / view >
< / u - p o p u p >
< u -popup :show ="startVisible" mode = "center" class = "specialPop" :closeOnClickOverlay ="false" >
< view >
< view style = "font-size: 32upx;color:#E03023;text-align: center;" >
重要提示
< / view >
< view style = "font-size: 28upx;color:#333333;margin-top: 30upx;" >
{ { contentInfo . needing _remake } }
< / view >
< u -button type = "primary" size = "small"
@ click = "closeHandle"
: text = "countDownTime <= 0?'关闭':countDownTime+'s后关闭'"
: disabled = "countDownTime <= 0?false:true"
style = "margin-top: 50upx;" > < / u - b u t t o n >
< / view >
< / u - p o p u p >
< / view >
< / template >
< script >
import { getDeails , logout , submitHandle , confirmProcedureHandle } from "@/api/user.js"
export default {
data ( ) {
return {
info : { } ,
show : false ,
contentInfo : {
rejects : '' ,
rejects _num : 0 ,
statusName : null ,
member _num : 0 ,
qualified _num : 0 ,
no _qualified _num : 0 ,
use _time : null ,
content : [ ] ,
needing _remake : "" ,
file _suffix : '' ,
file : ''
} ,
sheetShow : false ,
checkboxValue1 : [ ] ,
checkboxList1 : [ ] ,
fileList : [ ] ,
num : null ,
startVisible : false ,
timer : null ,
countDownTime : 4 ,
submitTimer : null ,
submitTimesNum : 0
} ;
} ,
methods : {
submitHandle ( ) {
console . log ( this . fileList )
let imgs = this . fileList . map ( item => {
return item . path
} )
console . log ( imgs )
let params = {
id : this . info . id ,
num : this . num ,
rejects : this . contentInfo . rejects ,
rejects _num : this . contentInfo . rejects _num ,
imgs : imgs . join ( ',' )
}
console . log ( params )
submitHandle ( params ) . then ( res => {
if ( res . code == 200 ) {
uni . showToast ( {
icon : 'none' ,
mask : true ,
title : '操作成功'
} )
uni . redirectTo ( {
url : '/pages/processList/processList?id=' + this . info . taskId + '&heat_num=' + this . info . heat _num
} )
}
} )
} ,
closeHandle ( ) {
this . startVisible = false ;
this . submitTimer = setInterval ( ( ) => {
this . submitTimesNum ++ ;
} , 1000 )
} ,
uploadFilePromise ( url ) {
return new Promise ( ( resolve , reject ) => {
uni . uploadFile ( {
url : 'http://aps-api.njrzwl.cn/app/uploadFile' ,
filePath : url ,
name : 'file' ,
success : res => {
// 这里res是普通对象,但是res.data为JSON字符串,需要转一下
const result = JSON . parse ( res . data ) ;
resolve ( result ) ;
}
} ) ;
} ) ;
} ,
downLoad ( item ) {
if ( this . contentInfo . file _suffix == 'pdf' ) {
uni . downloadFile ( {
url : item ,
success : ( data ) => {
if ( data . statusCode === 200 ) {
uni . saveFile ( {
tempFilePath : data . tempFilePath ,
success : function ( res ) {
uni . showToast ( {
icon : 'none' ,
mask : true ,
title : '文件已保存' + res . savedFilePath ,
duration : 3000
} ) ;
setTimeout ( ( ) => {
uni . openDocument ( {
filePath : res . savedFilePath ,
success : function ( res ) {
console . log ( '文档打开成功' )
}
} )
} , 3000 )
}
} )
}
} ,
fail : ( ) => {
uni . showToast ( {
icon : 'none' ,
mask : true ,
title : '失败请重新下载'
} )
}
} ) ;
} else {
uni . previewImage ( {
urls : [ item ]
} )
}
} ,
async afterRead ( event ) {
const item = event . file [ 0 ] ;
const url = item . url ;
let result = await this . uploadFilePromise ( url ) ;
this . fileList . push ( { url : result . data . imgUrl , path : result . data . path } )
} ,
deletePic ( e ) {
this . fileList . splice ( e . index , 1 ) ;
} ,
checkboxChange ( n ) {
this . checkboxValue1 = n
console . log ( 'change' , this . checkboxValue1 ) ;
} ,
besure ( ) {
this . contentInfo . rejects = this . checkboxValue1 . join ( "," )
this . sheetShow = false
} ,
rejectHandle ( ) {
this . sheetShow = false
} ,
close ( ) {
this . show = false
} ,
changeUser ( ) {
logout ( ) . then ( res => {
console . log ( res )
uni . redirectTo ( {
url : '/pages/login/login'
} )
uni . removeStorage ( {
key : 'userToken'
} )
this . $store . commit ( 'logout' )
} )
} ,
confirmProcedureHandle ( id ) {
confirmProcedureHandle ( { id : id } ) . then ( res => {
if ( res . code == 200 ) {
this . getDeails ( id )
}
} )
} ,
getDeails ( id ) {
getDeails ( { id : id } ) . then ( res => {
this . contentInfo . rejects _num = res . data . rejects _num ;
this . contentInfo . content = res . data . content
this . contentInfo . member _num = res . data . procedure _member . member _num
this . contentInfo . qualified _num = res . data . procedure _member . qualified _num
this . contentInfo . no _qualified _num = res . data . procedure _member . no _qualified _num
this . contentInfo . file _suffix = res . data . file _suffix
this . contentInfo . file = res . data . file
let status = res . data . procedure _member . status ;
switch ( status ) {
case 0 :
this . contentInfo . statusName = '未开始' ;
break ;
case 1 :
this . contentInfo . statusName = '待质检' ;
break ;
case 2 :
this . contentInfo . statusName = '质检不通过' ;
break ;
case 3 :
this . contentInfo . statusName = '已完成' ;
break ;
}
this . contentInfo . use _time = res . data . procedure _member . use _time
this . contentInfo . needing _remake = res . data . needing _remake
this . checkboxList1 = res . data . rejects _list ;
console . log ( res . data . rejects , "0000" )
if ( res . data . rejects && res . data . rejects != 'null' ) {
res . data . rejects . split ( "," ) . forEach ( item => {
this . checkboxValue1 . push ( item )
} )
}
this . contentInfo . rejects = res . data . rejects
if ( res . data . procedure _member . imgs _url ) {
res . data . procedure _member . imgs _url . forEach ( i => {
this . fileList . push ( { url : i . url , path : i . path } )
} )
}
if ( this . contentInfo . needing _remake && this . info . status != 3 ) {
this . startVisible = true ;
this . timer = setInterval ( ( ) => {
this . countDownTime -- ;
if ( this . countDownTime <= 0 ) {
clearInterval ( this . timer ) ;
}
} , 1000 )
} else {
this . submitTimer = setInterval ( ( ) => {
this . submitTimesNum ++ ;
} , 1000 )
}
console . log ( this . contentInfo )
} )
} ,
leftClick ( ) {
if ( this . info . resource == "navbar" ) {
uni . reLaunch ( {
url : '/pages/allprocess/allprocess?code=' + this . info . code + '&id=' + this . info . taskId + '&heat_num=' + this . info . heat _num
} )
} else {
uni . navigateTo ( {
url : '/pages/processList/processList?code=' + this . info . code + '&id=' + this . info . taskId + '&heat_num=' + this . info . heat _num
} )
}
} ,
} ,
onLoad ( option ) {
if ( uni . getStorageSync ( 'userToken' ) ) {
console . log ( option , "0000" )
this . info = option
this . confirmProcedureHandle ( option . id )
// this.getDeails(option.id)
} else {
uni . redirectTo ( {
url : '/pages/login/login'
} )
}
} ,
destroyed ( ) {
clearInterval ( this . submitTimer )
}
}
< / script >
< style lang = "scss" >
. specialPop {
/deep/ . u - popup _ _content {
border - radius : 20 upx ;
padding : 50 upx 70 upx ;
max - width : 60 % ;
min - width : 30 % ;
}
}
. rejectDialog {
/deep/ . u - popup _ _content {
border - radius : 20 upx ;
padding : 50 upx 70 upx ;
// width: 100%;
}
}
. taskList {
min - height : calc ( 100 vh ) ;
background - color : # ffffff ;
/deep/ . u - cell _ _body _ _content {
flex : none ! important ;
}
/deep/ . u - cell _ _body {
padding : 24 upx 0 px ;
}
/deep/ . u - cell _ _title {
width : 239 upx ;
}
/deep/ . u - cell _ _title - text {
color : # 666666
}
}
. checkboxflex {
display : flex ;
justify - content : space - between ;
}
. img {
/deep/ . u - cell -- center {
align - items : flex - start ;
}
}
. fujian {
image {
width : 50 upx ;
height : 50 upx ;
}
}
. submitContent {
padding : 20 upx 24 upx ;
background : # FFFFFF ;
border : 1 px solid # EAEAEA ;
box - shadow : 0 px - 4 px 18 px 0 px rgba ( 17 , 21 , 38 , 0.06 ) ;
. input {
color : # 999999 ;
font - size : 30 upx ;
/deep/ . uni - input - wrapper {
text - align : center ;
}
}
button {
height : 80 upx ;
line - height : 80 upx ;
background : # 0076 F6 ;
border - radius : 45 upx ;
font - size : 30 upx ;
font - family : Alibaba PuHuiTi ;
font - weight : 400 ;
color : # FFFFFF ;
margin - top : 20 upx ;
}
}
. isEmpty {
position : absolute ;
top : - 11 px ;
right : 0 ;
}
. notEmpty {
position : absolute ;
top : 0 px ;
right : 0 ;
}
. specialLabel / deep / . u - cell _ _value {
color : # E03023
}
< / style >