<template>
|
<view class="content">
|
<view class="list" v-for="(item,index) in listData" :key="index">
|
<uni-card :title="'工单号:'+item.HICMOBillNo" :extra="'日期:'+item.计划日期" style="margin: 10px;" @tap="edit(item)">
|
<view class="card-detail">
|
<view class="detail" v-if="item.HMaterName" style="width: 100%;">
|
<text>产品名称:</text>{{item.HMaterName}}
|
</view>
|
<view class="detail" v-if="item.HModel" style="width: 100%;">
|
<text>产品型号:</text>{{item.HModel}}
|
</view>
|
<view class="detail">
|
<text>计划数量:</text>{{item.HDatePlanQty?item.HDatePlanQty:0}}
|
</view>
|
<view class="detail">
|
<text>汇报总数:</text>{{item.HDateFinishQty?item.HDateFinishQty:0}}
|
</view>
|
<view class="detail" v-if="item.HICMOStatus">
|
<text>当前状态:</text>{{item.HICMOStatus}}
|
</view>
|
<view class="detail" v-if="item.领料状态">
|
<text>领料状态:</text>{{item.领料状态}}
|
</view>
|
<view class="detail" style="width: 100%;display: flex;align-items: center;">
|
<text>生产进度:</text>
|
<zui-progress-bar :value="item.percent" :width="220" type="follow-left"/>
|
</view>
|
</view>
|
</uni-card>
|
</view>
|
<uni-popup ref="popup" background-color="#fff">
|
<view class="popup-content">
|
<view class="tit">异常类型</view>
|
<view class="item" v-for="(item,index) in popList" :key="index" @tap="toAbnm(item)">{{item}}</view>
|
</view>
|
</uni-popup>
|
<view class="over" v-if="listData.length == 0">暂无数据</view>
|
<view class="over" v-if="listData.length != 0">已到底</view>
|
</view>
|
</template>
|
|
<script>
|
import { getUserInfo } from "@/utils/auth.js";
|
export default {
|
data() {
|
return {
|
userInfo:getUserInfo(),
|
serverUrl: uni.getStorageSync('serverUrl')||'http://47.96.97.237/API',
|
HSourceID:'',
|
HSourceName:'',
|
number:1,
|
listData:[],
|
chooseIt:'',
|
popList:['人员原因', '设备原因', '材料原因', '工艺原因', '模具原因', '测试原因', '环境原因'],
|
}
|
},
|
onLoad(e) {
|
console.log(e)
|
uni.showLoading({
|
title:'加载中...'
|
})
|
this.HSourceName=e.HSourceName
|
this.HSourceID=e.HSourceID
|
this.getList(e.HSourceID)
|
},
|
onShow() {
|
},
|
onPullDownRefresh: function() {
|
this.getList(this.HSourceID)
|
setTimeout(()=>{
|
uni.stopPullDownRefresh();
|
}, 1000);
|
},
|
methods: {
|
getList(e){
|
uni.request({
|
url: this.serverUrl + '/ReportPlatForm/SearchGetWorkBillList',
|
data: { "HSourceID": e },
|
success: (res) => {
|
if(res.data.count == 1){
|
console.log(res.data.data.h_p_JIT_GetWorkBillListInfoBySource)
|
this.listData = res.data.data.h_p_JIT_GetWorkBillListInfoBySource
|
for(var i=0;i<this.listData.length;i++){
|
this.listData[i].percent = (this.listData[i].HDateFinishQty / this.listData[i].HDatePlanQty).toFixed(4)
|
}
|
setTimeout(()=>{
|
uni.hideLoading()
|
}, 1000);
|
}else{
|
setTimeout(()=>{
|
uni.hideLoading()
|
}, 1000);
|
uni.showToast({
|
title:'获取列表出错!',
|
icon:'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
setTimeout(()=>{
|
uni.hideLoading()
|
}, 1000);
|
uni.showToast({
|
title:'获取列表接口请求失败',
|
icon:'none'
|
})
|
},
|
});
|
},
|
toAbnm(item){
|
console.log(item,this.chooseIt)
|
this.$refs.popup.close()
|
uni.navigateTo({
|
url:'./abnormal?HICMOBillNo=' + this.chooseIt.HICMOBillNo
|
+'&HSourceName=' + this.HSourceName
|
+'&HSourceBillNo=' + this.chooseIt.HSourceBillNo
|
+'&HType=' + item
|
+'&OperationType=4&linterid=&HSouceBillType='
|
})
|
},
|
edit(item){
|
console.log(item)
|
var lists = ['开工', '汇报', '完工', '停工', '异常反馈']
|
this.chooseIt = item
|
var upData = {
|
HBillType: item.HBillType,
|
HSourceInterID: item.HSourceInterID,
|
HSourceEntryID: item.HSourceEntryID,
|
HSourceBillNo: item.HSourceBillNo,
|
HSourceBillType: item.HSourceBillType,
|
user: uni.getStorageSync('HUserName')
|
}
|
uni.showActionSheet({
|
itemList: lists,
|
success: (res)=> {
|
// console.log('选中了第' + (res.tapIndex + 1) + '个按钮');
|
if(res.tapIndex == 0){
|
var urls = '/Sc_MESBeginWorkBill/FastBeginWorkBill'
|
this.WorkStaus(this.HSourceID, item.HICMOBillNo, item.HSourceInterID, lists[res.tapIndex],item.HMaterName,urls,upData)
|
}else if(res.tapIndex == 1){
|
var sWhere = { "HSourceID": this.HSourceID, "HICMOBillNo": item.HICMOBillNo, "HInterID": item.HSourceInterID,"type": "汇报"}
|
uni.request({
|
url: this.serverUrl + '/Sc_MESBeginWorkBill/GetMESBeginWorkBillStaus',
|
type: "GET",
|
data: { "sWhere": JSON.stringify(sWhere) },
|
dataType: "json",//数据类型可以为 text xml json script jsonp
|
async: false,
|
success: (res) => {
|
console.log(1,res.data);
|
if (res.data.count > 0) {
|
uni.navigateTo({
|
url:'./form?HBillType=' + item.HBillType
|
+'&HSourceInterID=' + item.HSourceInterID
|
+'&HSourceEntryID=' + item.HSourceEntryID
|
+'&HSourceBillNo=' + item.HSourceBillNo
|
+'&HSourceBillType=' + item.HSourceBillType
|
})
|
}
|
else {
|
uni.showToast({
|
title:res.data.Message,
|
icon:'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.hideLoading()
|
uni.showToast({
|
title:'接口请求失败',
|
icon:'none'
|
})
|
},
|
});
|
}else if(res.tapIndex == 2){
|
var urls = '/Sc_MESEndWorkBill/FastEndWorkBill'
|
this.WorkStaus(this.HSourceID, item.HICMOBillNo, item.HSourceInterID, lists[res.tapIndex],item.HMaterName,urls,upData)
|
}else if(res.tapIndex == 3){
|
var urls = '/Sc_MESStopWorkBill/FastStopWorkBill'
|
this.WorkStaus(this.HSourceID, item.HICMOBillNo, item.HSourceInterID, lists[res.tapIndex],item.HMaterName,urls,upData)
|
}else if(res.tapIndex == 4){
|
var sWhere = { "HSourceID": this.HSourceID, "HICMOBillNo": item.HICMOBillNo, "HInterID": item.HSourceInterID,"type": "异常反馈"}
|
uni.request({
|
url: this.serverUrl + '/Sc_MESBeginWorkBill/GetMESBeginWorkBillStaus',
|
type: "GET",
|
data: { "sWhere": JSON.stringify(sWhere) },
|
dataType: "json",//数据类型可以为 text xml json script jsonp
|
async: false,
|
success: (res) => {
|
console.log(1,res.data);
|
if (res.data.count > 0) {
|
this.$refs.popup.open('center')
|
}
|
else {
|
uni.showToast({
|
title:res.data.Message,
|
icon:'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.hideLoading()
|
uni.showToast({
|
title:'接口请求失败',
|
icon:'none'
|
})
|
},
|
});
|
}
|
},
|
fail: function (res) {
|
console.log(res.errMsg);
|
}
|
});
|
},
|
upWork(urls,upData){
|
uni.showLoading({
|
title:'请稍后...'
|
})
|
console.log(upData)
|
uni.request({
|
url: this.serverUrl + urls,
|
data:upData,
|
success: (res) => {
|
console.log(1,res);
|
if(res.data.count == 1){
|
this.getList(this.HSourceID)
|
}else{
|
uni.hideLoading()
|
}
|
uni.showToast({
|
title:res.data.Message,
|
icon:'none'
|
})
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.hideLoading()
|
uni.showToast({
|
title:'接口请求失败',
|
icon:'none'
|
})
|
},
|
});
|
},
|
WorkStaus(HSourceID1, workcode, HSourceInterID, btn,HMaterName, urls ,upData,) {
|
var sWhere = ""
|
sWhere = { "HSourceID": HSourceID1, "HICMOBillNo": workcode, "HInterID": HSourceInterID,"type": btn}
|
console.log(JSON.stringify(sWhere))
|
uni.request({
|
url: this.serverUrl + '/Sc_MESBeginWorkBill/GetMESBeginWorkBillStaus',
|
type: "GET",
|
data: { "sWhere": JSON.stringify(sWhere) },
|
dataType: "json",//数据类型可以为 text xml json script jsonp
|
async: false,
|
success: (res) => {
|
console.log(1,res.data);
|
if (res.data.count > 0) {
|
uni.showModal({
|
title: btn + '确认',
|
content: '设备编号:' + this.HSourceName + '; 工单号:' + workcode + '; 产品名称:' + HMaterName ,
|
success: (res) => {
|
if (res.confirm) {
|
console.log('用户点击确定');
|
this.upWork(urls,upData)
|
} else if (res.cancel) {
|
console.log('用户点击取消');
|
}
|
}
|
});
|
}
|
else {
|
uni.showToast({
|
title:res.data.Message,
|
icon:'none'
|
})
|
}
|
},
|
fail: (res) => {
|
console.log(res);
|
uni.hideLoading()
|
uni.showToast({
|
title:'接口请求失败',
|
icon:'none'
|
})
|
},
|
});
|
},
|
changeTab(e){
|
this.number = e
|
if(e==1){
|
this.listData = this.listData1
|
}else{
|
this.listData = this.listData2
|
}
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.list{
|
width: 100%;
|
.card-detail{
|
width: 100%;
|
display: flex;
|
flex-wrap: wrap;
|
justify-content: space-between;
|
line-height: 120%;
|
.detail{
|
width: 46%;
|
font-size: 26rpx;
|
margin-bottom: 12rpx;
|
color: #555;
|
margin-right: 20rpx;
|
text{
|
color: #999;
|
font-size: 26rpx;
|
}
|
}
|
}
|
.more{
|
color: #888;
|
font-size: 24rpx;
|
display: flex;
|
border-top: 1px solid #eee;
|
padding-top: 20rpx;
|
.part{
|
width: 50%;
|
text-align: center;
|
}
|
}
|
}
|
|
.popup-content{
|
width: 500rpx;
|
border-radius: 20rpx;
|
text-align: center;
|
padding-bottom: 20rpx;
|
.tit{
|
height: 120rpx;
|
line-height: 120rpx;
|
font-size: 34rpx;
|
color: #222;
|
font-weight: bold;
|
}
|
.item{
|
height: 88rpx;
|
line-height: 88rpx;
|
border-top: 1px solid #eee;
|
font-size: 32rpx;
|
color: #444;
|
}
|
}
|
</style>
|