<template>
|
<view class="page">
|
<view class="production-index-bg" />
|
<u-navbar title="报工产出" :background="background" :border-bottom="false" :title-bold="true" title-color="#000"
|
back-icon-color="#000" />
|
<view class="operation-task-tab">
|
<scroll-view id="tab-bar" class="scroll-h" :scroll-x="true" :show-scrollbar="false" enable-flex>
|
<view v-for="(tab,index) in tabBars" :key="tab.id" class="uni-tab-item" :id="tab.id"
|
:data-current="index" @click="ontabtap">
|
<text class="uni-tab-item-title"
|
:class="tabIndex==index ? 'uni-tab-item-title-active' : ''">{{tab.name}}</text>
|
</view>
|
</scroll-view>
|
</view>
|
<view class="line-h"></view>
|
<view class="wrap" :current="tabIndex" @change="ontabchange">
|
<scroll-view class="operation-task-scroll-list" scroll-y="true" @scrolltolower="loadMore">
|
<u-cell-group class="operation-task-scroll-list-group" :border="false">
|
<div class="tip" style="text-align:center;" v-if="list.length==0">-暂无报工单-</div>
|
<view class="content" v-for="(item, index) in list" :key="item.id" :index="index">
|
<view class="content-header">
|
<view class="content-header-left">
|
<radio :checked="item.isChecked" style="transform:scale(0.6)" @click="choose(item)" />
|
</view>
|
<viem class="content-header-right">
|
<view style="display: flex; justify-content: center; align-items: center;"
|
v-if="item.state == '02submitted'">
|
<image src="/static/custom/operationTask/submit-state-icon.png"
|
style="width: 30rpx; height: 30rpx; margin-right: 5rpx;"></image>
|
<text style="text-align: center; color: #007145;">已提交</text>
|
</view>
|
|
<view style="display: flex; justify-content: center; align-items: center;"
|
v-if="item.state == '01draft'">
|
<image src="/static/custom/operationTask/unsubmit-state-icon.png"
|
style="width: 30rpx; height: 30rpx; margin-right: 5rpx;"></image>
|
<text style="text-align: center; color: #F46F6C;">草稿</text>
|
</view>
|
|
<view style="display: flex; justify-content: center; align-items: center;"
|
v-if="item.state == '04processing'">
|
<image src="/static/custom/operationTask/in-progress-state-icon.png"
|
style="width: 30rpx; height: 30rpx; margin-right: 5rpx;"></image>
|
<text style="text-align: center; color: #c8af3c;">处理中</text>
|
</view>
|
</viem>
|
</view>
|
<view class="content-body" @click="choose(item)">
|
<view class="row-list">
|
<view class="_label">
|
报工单号:
|
</view>
|
<view class="_content">
|
{{ item.productNo }}
|
</view>
|
</view>
|
<view class="row-list">
|
<view class="_label">
|
零件编号:
|
</view>
|
<view class="_content">
|
{{ item.partNo }}
|
</view>
|
</view>
|
<view class="row-list">
|
<view class="_label">
|
零件名称:
|
</view>
|
<view class="_content">
|
<text>{{ item.partName }}</text>
|
</view>
|
</view>
|
<view class="row-list">
|
<view class="_label">
|
SN号:
|
</view>
|
<view class="_content">
|
{{ item.outBatchNo }}
|
</view>
|
</view>
|
<view class="row-list">
|
<view class="_label">
|
载具编号:
|
</view>
|
<view class="_content">
|
{{ item.reelNumber }}
|
</view>
|
</view>
|
<view class="row-list">
|
<view class="_label">
|
起始数量:
|
</view>
|
<view class="_content">
|
{{ item.startMeterMark }}
|
</view>
|
</view>
|
<view class="row-list">
|
<view class="_label">
|
截止数量:
|
</view>
|
<view class="_content">
|
{{ item.endMeterMark }}
|
</view>
|
</view>
|
<view class="row-list">
|
<view class="_label">
|
生产数量:
|
</view>
|
<view class="_content">
|
{{ item.productQty }}
|
</view>
|
</view>
|
<!-- <view class="content-body-collapse">
|
<uni-collapse class="collapse" ref="collapse" v-model="value" @change="change">
|
<uni-collapse-item title="展开" open="false" style="height: 10rpx;">
|
<view class="content">
|
<text
|
class="text">折叠内容主体,这是一段比较长内容。默认折叠主要内容,只显示当前项标题。点击标题展开,才能看到这段文字。再次点击标题,折叠内容。</text>
|
</view>
|
</uni-collapse-item>
|
</uni-collapse>
|
</view> -->
|
</view>
|
<view class="content-footer">
|
<view class="footer-btn">
|
<wu-button :custom-style="customStyleEight" size="small" @click="deleteTracking(item)">
|
<image src="/static/custom/operationTask/red-delete-icon.png"
|
style="width: 30rpx; height: 30rpx; margin-right: 5rpx;"></image>
|
删除
|
</wu-button>
|
</view>
|
<view class="footer-btn">
|
<wu-button :custom-style="customStyleThree" size="small"
|
@click="toEditProductOut(item)">
|
<image src="/static/custom/operationTask/black-edit-icon.png"
|
style="width: 26rpx; height: 26rpx; margin-right: 5rpx;"></image>
|
编辑
|
</wu-button>
|
</view>
|
<view class="footer-btn">
|
<wu-button :custom-style="customStyleSix" size="small" @click="revokeTracking(item)">
|
<image src="/static/custom/operationTask/black-revoke-icon.png"
|
style="width: 30rpx; height: 30rpx; margin-right: 5rpx;"></image>
|
撤销
|
</wu-button>
|
</view>
|
<view class="footer-btn">
|
<wu-button :custom-style="customStyleFour" size="small" @click="submitTracking(item)">
|
<image src="/static/custom/operationTask/blue-submit-icon.png"
|
style="width: 30rpx; height: 30rpx; margin-right: 5rpx;"></image>
|
提交
|
</wu-button>
|
</view>
|
</view>
|
</view>
|
</u-cell-group>
|
<view class="loadmore" @click="loadMore">
|
<u-loadmore :status="loadStatus"></u-loadmore>
|
</view>
|
</scroll-view>
|
<view class="suspend">
|
<wu-button class="suspend-btn" :custom-style="customStyleFive" size="small" @click="toCreateReport">
|
<image src="/static/custom/operationTask/book-icon.png"
|
style="width: 30rpx; height: 30rpx; margin-right: 5rpx;"></image>
|
产出
|
</wu-button>
|
</view>
|
<view class="bottom">
|
<view class="bottom-left">
|
<!-- <radio-group @change="chooseAll" v-model="chooseAllState"> -->
|
<label>
|
<radio :checked="chooseAllState" @click="chooseAll" style="transform:scale(0.6)" />全选
|
</label>
|
<!-- </radio-group> -->
|
</view>
|
<view class="bottom-right">
|
<view class="bottom-btn">
|
<wu-button :custom-style="customStyleOne" shape="circle" size="small" @click="deleteTracking">
|
删除
|
</wu-button>
|
</view>
|
<view class="bottom-btn">
|
<wu-button :custom-style="customStyleTwo" shape="circle" size="small" @click="revokeTracking">
|
撤销
|
</wu-button>
|
</view>
|
|
<view class="bottom-btn">
|
<wu-button :custom-style="customStyleTwo" shape="circle" size="small" @click="submitTracking">
|
提交
|
</wu-button>
|
</view>
|
<view class="bottom-btn">
|
<wu-button :custom-style="customStyleTwo" shape="circle" size="small">
|
交班产出
|
</wu-button>
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
</template>
|
<script>
|
import content_bg from '@/static/custom/product/productBg.png'
|
|
export default {
|
components: {},
|
computed: {
|
customStyleOne() {
|
return {
|
color: '#FFFFFF',
|
background: '#F46F6C',
|
width: '120rpx'
|
}
|
},
|
customStyleTwo() {
|
return {
|
color: '#FFFFFF',
|
background: '#234EED',
|
width: '140rpx'
|
}
|
},
|
customStyleThree() {
|
return {
|
color: '#333333',
|
background: '#FFFFFF',
|
width: '140rpx'
|
}
|
},
|
customStyleFour() {
|
return {
|
color: '#234EED',
|
background: '##FFFFFF',
|
width: '140rpx',
|
}
|
},
|
customStyleFive() {
|
return {
|
color: '#FFFFFF',
|
background: '#234EED',
|
width: '90rpx',
|
height: '120rpx',
|
borderRadius: '100%'
|
}
|
},
|
customStyleSix() {
|
return {
|
color: '#333333',
|
background: '##FFFFFF',
|
width: '120rpx',
|
}
|
},
|
customStyleSeven() {
|
return {
|
color: '#FFFFFF',
|
background: '#0e932e',
|
width: '120rpx'
|
}
|
},
|
customStyleEight() {
|
return {
|
color: '#F46F6C',
|
background: '#FFFFFF',
|
width: '120rpx'
|
}
|
},
|
},
|
data() {
|
return {
|
background: {
|
backgroundImage: `url(${content_bg})`,
|
backgroundAttachment: 'fixed',
|
backgroundSize: '100% auto',
|
backgroundRepeat: 'no-repeat',
|
},
|
newsList: [],
|
cacheTab: [],
|
tabIndex: 0,
|
tabBars: [{
|
name: '按组报工',
|
id: 'group'
|
}, {
|
name: '按人员报工',
|
id: 'person'
|
}],
|
scrollInto: "group",
|
showTips: false,
|
navigateFlag: false,
|
pulling: false,
|
refreshIcon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAMAAABg3Am1AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAB5QTFRFcHBw3Nzct7e39vb2ycnJioqK7e3tpqam29vb////D8oK7wAAAAp0Uk5T////////////ALLMLM8AAABxSURBVHja7JVBDoAgDASrjqj//7CJBi90iyYeOHTPMwmFZrHjYyyFYYUy1bwUZqtJIYVxhf1a6u0R7iUvWsCcrEtwJHp8MwMdvh2amHduiZD3rpWId9+BgPd7Cc2LIkPyqvlQvKxKBJ//Qwq/CacAAwDUv0a0YuKhzgAAAABJRU5ErkJggg==",
|
list: [],
|
array: [],
|
chooseAllState: false,
|
query: {
|
current: 1,
|
size: 10,
|
workstationId: null,
|
operationTaskId: null
|
},
|
workstationInfo: {
|
workstationId: null,
|
workstationNo: null,
|
workstationName: null,
|
workCenter: null
|
},
|
staffs: [],
|
dutyRecordId: null,
|
operationTaskInfo: {},
|
loadStatus: 'loadmore',
|
};
|
},
|
onLoad(option) {
|
if (option.params) {
|
const params = JSON.parse(decodeURIComponent(option.params));
|
if (params.operationTaskId && params.workstationId) {
|
this.query.operationTaskId = params.operationTaskId;
|
this.query.workstationId = params.workstationId;
|
this.operationTaskInfo = params;
|
this.loadList();
|
}
|
}
|
},
|
onShow() {},
|
methods: {
|
loadList() {
|
this.$u.api.outputRegister.getProductMainV1(this.query).then(res => {
|
if (!res.data.records || res.data.records.length == 0) {
|
this.loadStatus = "nomore";
|
return;
|
}
|
this.list = this.list.concat(res.data.records);
|
this.list.forEach(el => {
|
this.$set(el, 'isChecked', false);
|
})
|
this.query.current = res.data.current;
|
this.query.size = res.data.size;
|
this.loadStatus = "loadmore";
|
});
|
},
|
goDetail(item) {
|
if (this.navigateFlag) {
|
return;
|
}
|
this.navigateFlag = true;
|
uni.navigateTo({
|
url: './operationTaskInfo?item=' + encodeURIComponent(JSON.stringify(item))
|
});
|
setTimeout(() => {
|
this.navigateFlag = false;
|
}, 200)
|
},
|
loadMore() {
|
if (this.loadStatus == "nomore") {
|
return
|
}
|
this.loadStatus = "loading";
|
setTimeout(() => {
|
this.query.current += 1;
|
this.loadList();
|
}, 100);
|
},
|
ontabtap(e) {
|
let index = e.target.dataset.current || e.currentTarget.dataset.current;
|
this.switchTab(index);
|
},
|
ontabchange(e) {
|
let index = e.target.current || e.detail.current;
|
this.switchTab(index);
|
},
|
switchTab(index) {
|
if (this.tabIndex === index) {
|
return;
|
}
|
|
// // 清空数据
|
// this.clearTabData();
|
|
// if (this.list.length === 0) {
|
// this.loadList(index);
|
// }
|
|
this.tabIndex = index;
|
this.scrollInto = this.tabBars[index].id;
|
},
|
clearTabData(e) {
|
this.list = [];
|
this.query.state = null;
|
},
|
refreshData() {},
|
onrefresh(e) {
|
var tab = this.list[this.tabIndex];
|
if (!tab.refreshFlag) {
|
return;
|
}
|
tab.refreshing = true;
|
tab.refreshText = "正在刷新...";
|
|
setTimeout(() => {
|
this.refreshData();
|
this.pulling = true;
|
tab.refreshing = false;
|
tab.refreshFlag = false;
|
tab.refreshText = "已刷新";
|
setTimeout(() => { // TODO fix ios和Android 动画时间相反问题
|
this.pulling = false;
|
}, 500);
|
}, 2000);
|
},
|
onpullingdown(e) {
|
var tab = this.list[this.tabIndex];
|
if (tab.refreshing || this.pulling) {
|
return;
|
}
|
if (Math.abs(e.pullingDistance) > Math.abs(e.viewHeight)) {
|
tab.refreshFlag = true;
|
tab.refreshText = "释放立即刷新";
|
} else {
|
tab.refreshFlag = false;
|
tab.refreshText = "下拉可以刷新";
|
}
|
},
|
choose(item) {
|
if (item.isChecked) {
|
item.isChecked = false
|
} else {
|
item.isChecked = true
|
}
|
},
|
|
chooseAll() {
|
if (this.chooseAllState) {
|
this.chooseAllState = false;
|
this.list.forEach(el => {
|
el.isChecked = false;
|
})
|
} else {
|
this.chooseAllState = true;
|
this.list.forEach(el => {
|
el.isChecked = true;
|
})
|
}
|
},
|
|
//提交
|
submitTracking(item) {
|
let initList = [];
|
if (item) {
|
initList.push(item);
|
} else {
|
initList = this.list.filter(item => item.isChecked == true)
|
}
|
if (initList.length == 0) {
|
this.$u.toast('请选择需要【提交】的数据')
|
return
|
}
|
|
const l_index = initList.findIndex((el) => el.state == '02submitted')
|
if (l_index > -1) {
|
this.$u.toast('您选择的对象中存在已提交的数据,请重新选择!')
|
return
|
}
|
|
let outIds = initList.map((item) => {
|
return item.id
|
})
|
|
let queryParam = {
|
event: 'SUBMIT',
|
ids: outIds
|
}
|
this.batchChange(queryParam, "提交")
|
},
|
//撤销
|
revokeTracking(item) {
|
let initList = [];
|
if (item) {
|
initList.push(item);
|
} else {
|
initList = this.list.filter(item => item.isChecked == true)
|
}
|
|
if (initList.length == 0) {
|
this.$u.toast('请选择需要【撤销】的数据')
|
return
|
}
|
|
let l_index = initList.findIndex(
|
(el) => el.state == null || el.state == '01draft'
|
)
|
if (l_index > -1) {
|
this.$u.toast('您选择的对象中存在未提交的数据,请重新选择!')
|
return
|
}
|
|
let outIds = initList.map((item) => {
|
return item.id
|
})
|
|
let queryParam = {
|
event: 'REVOKE',
|
ids: outIds
|
}
|
this.batchChange(queryParam, "撤销")
|
},
|
// 删除
|
deleteTracking(item) {
|
let initList = [];
|
if (item) {
|
initList.push(item);
|
} else {
|
initList = this.list.filter(item => item.isChecked == true)
|
}
|
|
if (initList.length == 0) {
|
this.$u.toast('请选择需要【删除】的数据')
|
return
|
}
|
|
const l_index = initList.findIndex((el) => el.state == '02submitted')
|
if (l_index > -1) {
|
this.$u.toast('您选择的对象中存在已提交的数据,请重新选择!')
|
return
|
}
|
|
let outIds = initList.map((item) => {
|
return item.id
|
})
|
|
this.$u.api.outputRegister.batchCancelProductMain(outIds).then(res => {
|
let _code = res.code
|
let _data = res.data
|
let _msg = res.msg
|
if (_code === 0) {
|
this.$u.toast('删除成功');
|
this.clear();
|
this.loadList();
|
} else {
|
this.$u.toast('删除失败');
|
}
|
});
|
},
|
|
//提交、撤销操作
|
batchChange(queryParam, title) {
|
let that = this
|
that.$u.api.outputRegister.batchChange(queryParam).then(res => {
|
if (res.code == 0) {
|
uni.showModal({
|
title: '提示',
|
content: title + '成功',
|
showCancel: false,
|
success: function() {
|
that.clear();
|
that.loadList();
|
}
|
})
|
} else {
|
uni.showModal({
|
title: '提示',
|
content: title + '失败',
|
showCancel: false,
|
success: function() {}
|
})
|
}
|
})
|
},
|
|
// 编辑
|
toEditProductOut(item) {
|
let initList = [];
|
if (item) {
|
initList.push(item);
|
} else {
|
this.list.filter(item => item.isChecked == true)
|
}
|
|
if (initList.length == 0) {
|
this.$u.toast('请选择需要【编辑】的数据')
|
return
|
}
|
|
//TODO校验报工状态
|
let l_index = initList.findIndex((el) => el.state == '02submitted')
|
if (l_index > -1) {
|
this.$u.toast('您选择的对象中存在已提交的数据,请重新选择!')
|
return
|
}
|
|
uni.navigateTo({
|
url: './editReportWork?item=' + encodeURIComponent(JSON.stringify(
|
initList))
|
})
|
},
|
|
toCreateReport() {
|
this.$set(this.operationTaskInfo, 'type', this.scrollInto);
|
uni.navigateTo({
|
url: './createReportWork?params=' + encodeURIComponent(JSON.stringify(this
|
.operationTaskInfo))
|
});
|
},
|
|
refreshTrackingRecord() {
|
this.clear();
|
this.loadList();
|
},
|
|
clear() {
|
this.query.current = 1;
|
this.list = [];
|
}
|
}
|
};
|
</script>
|
<style lang="scss" scoped>
|
.operation-task-list-search {
|
padding: 10rpx 30rpx 20rpx 30rpx;
|
}
|
|
.operation-task-tab {
|
.scroll-h {
|
width: 750rpx;
|
display: flex;
|
justify-content: space-between;
|
height: 80rpx;
|
white-space: nowrap;
|
|
.uni-tab-item {
|
display: inline-block;
|
padding-left: 55rpx;
|
padding-right: 55rpx;
|
}
|
}
|
}
|
|
.line-h {
|
height: 1rpx;
|
background-color: #cccccc;
|
}
|
|
.uni-tab-item-title {
|
color: #555;
|
font-size: 30rpx;
|
height: 80rpx;
|
line-height: 80rpx;
|
flex-wrap: nowrap;
|
/* #ifndef APP-PLUS */
|
white-space: nowrap;
|
/* #endif */
|
font-weight: bold;
|
}
|
|
.uni-tab-item-title-active {
|
color: #00aaff;
|
}
|
|
.production-index-bg {
|
background-color: #F6F9FF;
|
background-image: url('~@/static/custom/product/productBg.png');
|
// background: linear-gradient(180deg,rgba(206,227,254,1),rgba(206,227,254,1) 20%,rgba(206,227,254,0.5) 40%,rgba(206,227,254,0.25) 60%,rgba(206,227,254,0.08) 80%,rgba(206,227,254,0));
|
padding: 0 20rpx;
|
background-attachment: fixed;
|
background-size: 100% auto;
|
background-repeat: no-repeat;
|
position: fixed;
|
top: 0;
|
bottom: 0;
|
width: 100%;
|
z-index: -1;
|
}
|
|
.operation-task-param {
|
padding: 30rpx 30rpx 0rpx 30rpx;
|
|
.operation-task-param-view {
|
height: 100rpx;
|
background: rgba(255, 255, 255, 0.61);
|
box-shadow: 0rpx 6rpx 8rpx 0rpx rgba(110, 120, 135, 0.09);
|
border-radius: 10rpx;
|
padding: 0rpx 23rpx;
|
margin-bottom: 30rpx;
|
|
.operation-task-param-item {
|
height: 100rpx;
|
border: 1px solid #ADC8E4;
|
line-height: 100rpx;
|
display: flex;
|
justify-content: space-between;
|
border: none;
|
|
.operation-task-param-item-left {
|
.item-one {
|
font-size: 30rpx;
|
color: #4F4F4F;
|
}
|
}
|
|
.operation-task-param-item-right {
|
display: flex;
|
align-items: center;
|
|
.item-one {
|
font-size: 30rpx;
|
color: #333333;
|
margin-right: 6rpx;
|
}
|
|
.item-two {
|
font-size: 30rpx;
|
color: #A6B4CC;
|
margin-right: 6rpx;
|
}
|
|
.item-three {
|
font-size: 30rpx;
|
color: #214DED;
|
margin-right: 6rpx;
|
}
|
|
.scan {
|
background-image: url('~@/static/custom/materialReturn/scan.png');
|
background-size: 100% auto;
|
background-repeat: no-repeat;
|
height: 32rpx;
|
width: 32rpx;
|
}
|
}
|
}
|
|
.param-extra {
|
border-bottom: 1px solid #E8EBEE;
|
}
|
}
|
}
|
|
.wrap .operation-task-scroll-list {
|
height: calc(100vh - var(--window-top) - var(--window-bottom) - 334rpx);
|
width: 100%;
|
}
|
|
.operation-task-scroll-list-group {
|
::v-deep .u-cell-item-box {
|
background-color: rgba(250, 252, 255, 0.36) !important;
|
padding: 0rpx 30rpx;
|
}
|
|
.content {
|
font-size: 12px;
|
background-color: #FFFFFF;
|
box-sizing: border-box;
|
border-radius: 10rpx;
|
margin: 20rpx 0rpx;
|
height: 572rpx;
|
padding: 10rpx 20rpx;
|
box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(127, 127, 127, 0.1) !important;
|
position: relative;
|
|
.content-header {
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
|
.content-header-left {
|
// align-items: center;
|
}
|
|
.content-header-right {
|
// align-items: center;
|
}
|
}
|
|
.content-body {
|
height: 420rpx;
|
background: #F5F9FF;
|
border-radius: 10rpx;
|
padding: 15rpx 13rpx;
|
|
.row-list {
|
height: 50rpx;
|
display: flex;
|
flex-direction: row;
|
padding: 0px;
|
align-items: center;
|
// justify-content: space-between;
|
|
._label {
|
display: flex;
|
color: #666666;
|
font-size: 26rpx;
|
align-items: center;
|
width: 160rpx;
|
margin-right: 20rpx;
|
}
|
|
._content {
|
width: 500rpx;
|
display: flex;
|
// text-align: right;
|
color: #909399;
|
font-size: 24rpx;
|
// margin-top: 30rpx;
|
}
|
}
|
|
.content-body-collapse {
|
.collapse {
|
height: 20rpx;
|
}
|
}
|
}
|
|
.content-footer {
|
display: flex;
|
justify-content: space-between;
|
margin-top: 15rpx;
|
align-items: center;
|
|
.footer-btn {
|
padding-right: 10rpx;
|
}
|
}
|
}
|
}
|
|
.bottom {
|
bottom: 0;
|
height: 100rpx;
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
|
.bottom-left {
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
margin-top: 30rpx;
|
padding-left: 20rpx;
|
}
|
|
.bottom-right {
|
margin-top: 30rpx;
|
padding-right: 20rpx;
|
display: flex;
|
justify-content: flex-end;
|
|
.bottom-btn {
|
margin-right: 10rpx;
|
}
|
}
|
}
|
|
.suspend {
|
position: fixed;
|
right: 10px;
|
bottom: 150rpx;
|
z-index: 1;
|
}
|
|
.scan {
|
width: 60rpx;
|
height: 60rpx;
|
font-size: 60rpx;
|
color: #3281ff;
|
}
|
</style>
|