You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

360 lines
8.4 KiB

12 months ago
<template>
<view class="">
<jobFilter ref="filter" buttontType="issue" @switchChangeToday="switchChangeToday"
@switchChangeWait="switchChangeWait" @scanAsN="scanAsN" @scanAppro="scanAppro" :checkedToday="checkedToday"
:checkedWaitTask="checkedWaitTask">
</jobFilter>
<com-empty-view v-if="issueList.length==0"></com-empty-view>
<uni-swipe-action ref="swipeAction">
<view v-for="(item, index) in issueList" :key="index">
<uni-swipe-action-item
:right-options="item.status=='2'?detailGiveupOptions:detailOptions"
@click="swipeClick($event,item)">
<com-issue-job-card :dataContent="item" @click='openJobDetail(item)'></com-issue-job-card>
</uni-swipe-action-item>
</view>
</uni-swipe-action>
<uni-load-more :status="loadingType" v-if="issueList.length>0" />
<winScanAsnNumber ref="scanAsnNumber" title="ASN" @getScanCode='getByAsnNumber'></winScanAsnNumber>
<winScanJobNumber ref="scanNumber" title="任务编号" @getScanCode='getByNumber'></winScanJobNumber>
<comMessage ref="comMessage"></comMessage>
<job-info-popup ref='jobInfoPopup'></job-info-popup>
</view>
</template>
<script>
import {
getIssueJobList,
cancelTakeIssueJob,
getIssueByCode
} from '@/api/request.js';
import {
goHome,
getCurrDate
} from '@/common/basic.js';
import {
getDetailOption,
getDetailGiveupOption
} from '@/common/array.js';
import comEmptyView from '@/mycomponents/common/comEmptyView.vue'
import comMessage from '@/mycomponents/common/comMessage.vue'
import jobFilter from '@/mycomponents/job/jobFilter.vue'
import comIssueJobCard from '@/pages/issue/coms/comIssueJobCard.vue'
import winScanJobNumber from "@/mycomponents/scan/winScanJobNumber.vue"
import winScanAsnNumber from "@/mycomponents/scan/winScanAsnNumber.vue"
import jobCard from '@/mycomponents/job/jobCard.vue';
import jobInfoPopup from '@/mycomponents/job/jobInfoPopup.vue'
export default {
name: 'issue',
components: {
comEmptyView,
comMessage,
jobFilter,
comIssueJobCard,
winScanJobNumber,
winScanAsnNumber,
jobCard,
jobInfoPopup
},
data() {
return {
issueList: [],
contentText: {
contentdown: '上拉加载更多',
contentrefresh: '加载中',
contentnomore: '没有更多'
},
pageSize: this.$pageSize,
pageIndex: 1,
totalCount: 0,
loadingType: "nomore",
checkedToday: false,
checkedWaitTask: false,
status: "",
creationTimeStart: "",
creationTimeEnd: "",
detailOptions: [],
detailGiveupOptions: []
};
},
onShow() {
this.getList('refresh');
},
onReady() {
const rightButtonEle2 = document.getElementsByClassName('uni-page-head-btn')[2]
this.detailOptions = getDetailOption();
this.detailGiveupOptions = getDetailGiveupOption();
},
onReachBottom() {
//避免多次触发
if (this.loadingType == 'loading' || this.loadingType == 'nomore') {
return;
}
this.getList("more");
},
onPullDownRefresh() {
this.getList('refresh');
},
//后退按钮
onBackPress(options) {
if (options.from === 'navigateBack') {
uni.navigateBack({
delta: 1
})
return false;
}
},
//返回首页
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
} else if (e.index == 1) {
this.$refs.filter.openFilter();
}
},
methods: {
updateTitle() {
var title = ""
if (this.totalCount > 0) {
title = "发料任务(" + this.totalCount + ")";
} else {
title = "发料任务"
}
uni.setNavigationBarTitle({
title: title
})
},
getList(type) {
let that = this;
uni.showLoading({
title: "加载中­....",
mask: true
});
this.loadingType = "loading";
if (type === "refresh") {
this.pageIndex = 1;
this.issueList = [];
}
var params = {
status: this.status,
CreationTimeStart: this.CreationTimeStart,
CreationTimeEnd: this.CreationTimeEnd,
page: that.pageIndex,
size: that.pageSize,
}
getIssueJobList(params).then(res => {
uni.hideLoading();
if (type === "refresh") {
uni.stopPullDownRefresh();
}
var list = res.data.list;
this.totalCount = res.data.total
this.loadingType = "loadmore";
if (list == null || list.length == 0) {
this.loadingType = "nomore";
return;
}
that.issueList = type === "refresh" ? list : this.issueList.concat(list);
that.pageIndex++;
this.updateTitle();
}).catch(error => {
this.loadingType = "";
uni.hideLoading();
if (type === "refresh") {
uni.stopPullDownRefresh();
}
that.showMessage(error)
})
},
getByAsnNumber(code) {
let that = this;
uni.showLoading({
title: "加载中....",
mask: true
});
getPurchasereceiptByAsnNumber(code).then(res => {
uni.hideLoading();
if (res.data.total == 0) {
that.showMessage('未查找到' + '【' + code + '】的收货任务');
} else if (res.data.total == 1) {
this.$refs.scanAsnNumber.closeScanPopup();
that.openJobDetail(res.data.list[0]);
} else {
this.$refs.scanAsnNumber.closeScanPopup();
that.showItemList(res.data.list);
}
}).catch(error => {
uni.hideLoading();
that.showMessage(error);
})
},
getByNumber(code) {
let that = this;
uni.showLoading({
title: "加载中....",
mask: true
});
getJobNewCountByNumber(code).then(res => {
uni.hideLoading();
if (res.data.total == 0) {
that.showMessage('未查找到' + '【' + code + '】的收货任务');
} else if (res.data.total == 1) {
this.$refs.scanNumber.closeScanPopup();
that.openJobDetail(res.data.list[0]);
}
}).catch(error => {
uni.hideLoading();
that.showMessage(error);
})
},
openJobDetail(item) {
uni.navigateTo({
url: './issueDetail?id=' + item.id + '&status=' + item.status
});
},
showItemList(itemList) {
this.$refs.scanList.openPopup(itemList);
},
selectedItem(item) {
this.openJobDetail(item);
},
swipeClick(e, dataContent) {
if (e.content.text == "详情") {
this.openjobInfoPopup(dataContent);
} else if (e.content.text == "放弃") {
this.$refs.comMessage.showQuestionMessage("确定要放弃当前任务?",
res => {
if (res) {
var id = dataContent.id
this.cancleJob(id);
}
});
}
},
openjobInfoPopup(item) {
let dataList = [{
title: "申请单号",
content: item.requestNumber
},
{
title: "车间代码",
content: item.workshopCode
},
{
title: "允许修改库位",
content: item.allowModifyLocation == 1 ? "是" : "否"
},
{
title: "允许修改数量",
content: item.allowModifyQty == 1 ? "是" : "否"
},
{
title: "允许大于推荐数量",
content: item.allowBiggerQty == 1 ? "是" : "否"
},
{
title: "允许小于推荐数量",
content: item.allowSmallerQty == 1 ? "是" : "否"
},
{
title: "允许修改库存状态",
content: item.allowModifyInventoryStatus == 1 ? "是" : "否"
},
{
title: "允许连续扫描",
content: item.allowContinuousScanning == 1 ? "是" : "否"
},
{
title: "允许部分完成",
content: item.allowPartialComplete == 1 ? "是" : "否"
},
{
title: "允许修改批次",
content: item.allowModifyBach == 1 ? "是" : "否"
}
]
this.$refs.jobInfoPopup.openPopup(item, dataList)
},
cancleJob(id) {
cancelTakeIssueJob(id).then(res => {
this.getList("refresh")
}).catch(res => {
this.$refs.comMessage.showErrorMessages(message, res => {
if (res) {
}
});
})
},
switchChangeToday(state) {
this.checkedToday = state;
if (this.checkedToday) {
this.creationTimeStart = getCurrDate();
this.creationTimeEnd = getCurrDate();
} else {
this.creationTimeStart = "";
this.creationTimeEnd = "";
}
this.getList('refresh');
uni.showToast({
title: "只看今天" + state,
})
},
switchChangeWait(state) {
this.checkedWaitTask = state;
if (this.checkedWaitTask) {
this.status = "1";
} else {
this.status = "";
}
this.getList('refresh');
},
showMessage(message) {
this.$refs.comMessage.showMessage(message, res => {
if (res) {
}
});
},
}
}
</script>
<style scoped lang="scss">
</style>