|
|
|
<template>
|
|
|
|
<view>
|
|
|
|
<com-empty-view v-if="requestList.length==0"></com-empty-view>
|
|
|
|
<request-filter ref="filter" @switchChangeWait="switchChangeWait" @onScanNumber="getScanNumber"
|
|
|
|
:checkedWaitTask="checkedWaitTask">
|
|
|
|
</request-filter>
|
|
|
|
<view v-if="requestList.length>0">
|
|
|
|
<uni-swipe-action ref="swipeAction">
|
|
|
|
<view v-for="(item, index) in requestList" :key="index">
|
|
|
|
<uni-swipe-action-item :right-options="item.options" @click="swipeClick($event,item)">
|
|
|
|
<com-issue-request-card :dataContent="item" @click='openRequestDetail(item)'>
|
|
|
|
</com-issue-request-card>
|
|
|
|
</uni-swipe-action-item>
|
|
|
|
</view>
|
|
|
|
</uni-swipe-action>
|
|
|
|
<uni-load-more :status="loadingType" />
|
|
|
|
|
|
|
|
<requestIssInfoPopup ref='requestInfoPopup'></requestIssInfoPopup>
|
|
|
|
</view>
|
|
|
|
<requestButton @goScan='openScanDetailPopup'></requestButton>
|
|
|
|
</view>
|
|
|
|
<comMessage ref="comMessage"></comMessage>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import requestFilter from '@/mycomponents/request/requestFilter.vue'
|
|
|
|
import comEmptyView from '@/mycomponents/common/comEmptyView.vue'
|
|
|
|
import requiredLocation from '@/mycomponents/location/requiredLocation.vue'
|
|
|
|
import comMessage from '@/mycomponents/common/comMessage.vue'
|
|
|
|
import comIssueRequestCard from '@/pages/unPlanned/coms/comIssueRequestCard.vue'
|
|
|
|
import requestIssInfoPopup from '@/pages/unPlanned/coms/requestIssInfoPopup.vue'
|
|
|
|
import requestButton from '@/mycomponents/button/requestButton.vue'
|
|
|
|
|
|
|
|
import {
|
|
|
|
goHome,
|
|
|
|
updateTitle,
|
|
|
|
clearTirmAndWrap
|
|
|
|
} from '@/common/basic.js';
|
|
|
|
|
|
|
|
import {
|
|
|
|
getUnPlannedIssueRequestList,
|
|
|
|
unPlannedIssueRequestApprove,
|
|
|
|
unPlannedIssueRequestClose,
|
|
|
|
unPlannedIssueRequestApproveAgree,
|
|
|
|
unPlannedIssueRequestApproveRefused,
|
|
|
|
unPlannedIssueRequestHandle,
|
|
|
|
unPlannedIssueRequestAddAgain
|
|
|
|
} from '@/api/request2.js';
|
|
|
|
import {
|
|
|
|
getDetailOption,
|
|
|
|
getDetailAndApproveOption,
|
|
|
|
getDetailAndApprovePassAndApproveNoOption,
|
|
|
|
getDetailAndHandleOption,
|
|
|
|
getDetailAndCloseOption,
|
|
|
|
getAddAgainOption
|
|
|
|
} from '@/common/array.js';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
comEmptyView,
|
|
|
|
requestFilter,
|
|
|
|
requiredLocation,
|
|
|
|
comMessage,
|
|
|
|
comIssueRequestCard,
|
|
|
|
requestIssInfoPopup,
|
|
|
|
requestButton,
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
requestList: [],
|
|
|
|
pageNo: 1,
|
|
|
|
pageSize: 10,
|
|
|
|
status: "",
|
|
|
|
totalCount: 0,
|
|
|
|
checkedWaitTask: false,
|
|
|
|
detailOptions: [],
|
|
|
|
detailAndApproveOptions: [],
|
|
|
|
detailAndApprovePassAndApproveNoOption: [],
|
|
|
|
detailAndHandleOption: [],
|
|
|
|
detailAndCloseOption: [],
|
|
|
|
addAgainOption:[],
|
|
|
|
showOptions: [],
|
|
|
|
fromType: "requestType",
|
|
|
|
loadingType: "nomore",
|
|
|
|
|
|
|
|
};
|
|
|
|
},
|
|
|
|
onReady() {
|
|
|
|
this.detailOptions = getDetailOption();
|
|
|
|
this.addAgainOption = getAddAgainOption();
|
|
|
|
this.detailAndApproveOptions = getDetailAndApproveOption()
|
|
|
|
this.detailAndApprovePassAndApproveNoOption = getDetailAndApprovePassAndApproveNoOption(),
|
|
|
|
this.detailAndHandleOption = getDetailAndHandleOption()
|
|
|
|
this.detailAndCloseOption = getDetailAndCloseOption()
|
|
|
|
|
|
|
|
},
|
|
|
|
onReachBottom() {
|
|
|
|
//避免多次触发
|
|
|
|
if (this.loadingType == 'loading' || this.loadingType == 'nomore') {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
this.getList("more");
|
|
|
|
},
|
|
|
|
|
|
|
|
onPullDownRefresh() {
|
|
|
|
this.getList('refresh');
|
|
|
|
},
|
|
|
|
onShow() {
|
|
|
|
this.getList('refresh');
|
|
|
|
},
|
|
|
|
//返回首页
|
|
|
|
onNavigationBarButtonTap(e) {
|
|
|
|
if (e.index === 0) {
|
|
|
|
goHome();
|
|
|
|
} else if (e.index == 1) {
|
|
|
|
this.$refs.filter.openFilter();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
requestConfirm(action, item) {},
|
|
|
|
|
|
|
|
openRequestDetail(item) {
|
|
|
|
uni.navigateTo({
|
|
|
|
url: './issueRequestDetail?id=' + item.id
|
|
|
|
});
|
|
|
|
},
|
|
|
|
openRequestInfoPopup(item) {
|
|
|
|
this.$refs.requestInfoPopup.openPopup(item)
|
|
|
|
},
|
|
|
|
getList(type) {
|
|
|
|
let that = this;
|
|
|
|
uni.showLoading({
|
|
|
|
title: "加载中....",
|
|
|
|
mask: true
|
|
|
|
});
|
|
|
|
this.loadingType = "loading";
|
|
|
|
if (type === "refresh") {
|
|
|
|
this.pageNo = 1;
|
|
|
|
this.requestList = [];
|
|
|
|
}
|
|
|
|
var filters = []
|
|
|
|
if (this.checkedWaitTask) {
|
|
|
|
filters.push({
|
|
|
|
column: "status",
|
|
|
|
action: "==",
|
|
|
|
value: this.status
|
|
|
|
})
|
|
|
|
}
|
|
|
|
var params = {
|
|
|
|
filters: filters,
|
|
|
|
pageNo: this.pageNo,
|
|
|
|
pageSize: this.pageSize,
|
|
|
|
}
|
|
|
|
|
|
|
|
getUnPlannedIssueRequestList(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;
|
|
|
|
}
|
|
|
|
list.forEach(res => {
|
|
|
|
var options = this.updateOptions(res.status);
|
|
|
|
res.options = options;
|
|
|
|
})
|
|
|
|
this.requestList = type === "refresh" ? list : this.requestList.concat(list);
|
|
|
|
|
|
|
|
this.pageNo++;
|
|
|
|
updateTitle("计划外出库申请(" + this.totalCount + ")");
|
|
|
|
|
|
|
|
}).catch(error => {
|
|
|
|
if (type === "refresh") {
|
|
|
|
uni.stopPullDownRefresh();
|
|
|
|
}
|
|
|
|
updateTitle("计划外出库申请");
|
|
|
|
this.loadingType = "";
|
|
|
|
uni.hideLoading();
|
|
|
|
that.showMessage(error)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
updateOptions(status) {
|
|
|
|
if (status == "1") {
|
|
|
|
this.showOptions = this.detailAndApproveOptions;
|
|
|
|
} else if (status == "2") {
|
|
|
|
this.showOptions = this.detailAndApprovePassAndApproveNoOption;
|
|
|
|
} else if (status == "3") {
|
|
|
|
this.showOptions = this.detailAndHandleOption;
|
|
|
|
} else if (status == "4") {
|
|
|
|
this.showOptions = this.detailAndCloseOption;
|
|
|
|
} else if(status == "5"){
|
|
|
|
this.showOptions = this.addAgainOption;
|
|
|
|
}else {
|
|
|
|
this.showOptions = this.detailOptions;
|
|
|
|
}
|
|
|
|
return this.showOptions
|
|
|
|
},
|
|
|
|
|
|
|
|
openScanDetailPopup() {
|
|
|
|
uni.navigateTo({
|
|
|
|
url: "./issueRequestCreate?fromType=" + this.fromType
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
swipeClick(e, dataContent) {
|
|
|
|
var text = clearTirmAndWrap(e.content.text)
|
|
|
|
if (text == "详情") {
|
|
|
|
this.openRequestInfoPopup(dataContent);
|
|
|
|
} else if (text == "处理") {
|
|
|
|
this.showQuestionMessage("确定要处理当前申请吗?",res=>{
|
|
|
|
this.unPlannedIssueRequestHandle(dataContent.id)
|
|
|
|
})
|
|
|
|
} else if (text == "提交审批") {
|
|
|
|
this.showQuestionMessage("确定要审批当前申请吗?",res=>{
|
|
|
|
this.unPlannedIssueRequestApprove(dataContent.id)
|
|
|
|
})
|
|
|
|
} else if (text == "审批通过") {
|
|
|
|
this.showQuestionMessage("确定要审批通过当前申请吗?",res=>{
|
|
|
|
this.unPlannedIssueRequestApproveAgree(dataContent.id)
|
|
|
|
})
|
|
|
|
} else if (text == "审批驳回") {
|
|
|
|
this.showQuestionMessage("确定要审批驳回当前申请吗?",res=>{
|
|
|
|
this.unPlannedIssueRequestApproveRefused(dataContent.id)
|
|
|
|
})
|
|
|
|
} else if (text == "关闭") {
|
|
|
|
this.showQuestionMessage("确定要关闭当前申请吗?",res=>{
|
|
|
|
this.unPlannedIssueRequestClose(dataContent.id)
|
|
|
|
})
|
|
|
|
}else if(text == "重新添加"){
|
|
|
|
this.showQuestionMessage("确定要重新添加当前申请吗?",res=>{
|
|
|
|
this.unPlannedIssueRequestAddAgain(dataContent.id)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
showQuestionMessage(hint,callBack){
|
|
|
|
this.$refs.comMessage.showQuestionMessage(hint,
|
|
|
|
res => {
|
|
|
|
if (res) {
|
|
|
|
callBack()
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
switchChangeWait(state, jobStatus) {
|
|
|
|
this.checkedWaitTask = state;
|
|
|
|
this.status = jobStatus;
|
|
|
|
this.getList("refresh");
|
|
|
|
},
|
|
|
|
|
|
|
|
getScanNumber(code) {
|
|
|
|
this.getDataListByType(code)
|
|
|
|
},
|
|
|
|
|
|
|
|
getDataListByType(code) {
|
|
|
|
let that = this;
|
|
|
|
uni.showLoading({
|
|
|
|
title: "加载中....",
|
|
|
|
mask: true
|
|
|
|
});
|
|
|
|
var filters = []
|
|
|
|
filters.push({
|
|
|
|
column: "number",
|
|
|
|
action: "==",
|
|
|
|
value: code
|
|
|
|
})
|
|
|
|
|
|
|
|
var params = {
|
|
|
|
filters: filters,
|
|
|
|
pageNo: 1,
|
|
|
|
pageSize: 100,
|
|
|
|
}
|
|
|
|
getUnPlannedIssueRequestList(params).then(res => {
|
|
|
|
uni.hideLoading();
|
|
|
|
if (res.data.list.length == 0) {
|
|
|
|
that.showMessage('未查找到' + '【' + code + '】的收货任务');
|
|
|
|
} else if (res.data.list.length == 1) {
|
|
|
|
that.openRequestDetail(res.data.list[0]);
|
|
|
|
}
|
|
|
|
}).catch(error => {
|
|
|
|
uni.hideLoading();
|
|
|
|
that.showMessage(error);
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
showMessage(message) {
|
|
|
|
this.$refs.comMessage.showMessage(message, res => {
|
|
|
|
if (res) {
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
unPlannedIssueRequestApprove(id) {
|
|
|
|
unPlannedIssueRequestApprove(id).then(res => {
|
|
|
|
if (res.data) {
|
|
|
|
uni.showToast({
|
|
|
|
title: "申请提交审批成功"
|
|
|
|
})
|
|
|
|
this.getList("refresh")
|
|
|
|
} else {
|
|
|
|
this.showMessage("申请提交审批失败")
|
|
|
|
}
|
|
|
|
|
|
|
|
}).catch(error => {
|
|
|
|
this.showMessage(error)
|
|
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
unPlannedIssueRequestClose(id) {
|
|
|
|
unPlannedIssueRequestClose(id).then(res => {
|
|
|
|
if (res.data) {
|
|
|
|
uni.showToast({
|
|
|
|
title: "申请关闭成功"
|
|
|
|
})
|
|
|
|
this.getList("refresh")
|
|
|
|
|
|
|
|
} else {
|
|
|
|
this.showMessage("申请关闭失败")
|
|
|
|
}
|
|
|
|
|
|
|
|
}).catch(error => {
|
|
|
|
this.showMessage(error)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
unPlannedIssueRequestApproveAgree(id) {
|
|
|
|
unPlannedIssueRequestApproveAgree(id).then(res => {
|
|
|
|
if (res.data) {
|
|
|
|
uni.showToast({
|
|
|
|
title: "申请审批通过成功"
|
|
|
|
})
|
|
|
|
this.getList("refresh")
|
|
|
|
|
|
|
|
} else {
|
|
|
|
this.showMessage("申请审批通过失败")
|
|
|
|
}
|
|
|
|
|
|
|
|
}).catch(error => {
|
|
|
|
this.showMessage(error)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
unPlannedIssueRequestApproveRefused(id) {
|
|
|
|
unPlannedIssueRequestApproveRefused(id).then(res => {
|
|
|
|
if (res.data) {
|
|
|
|
uni.showToast({
|
|
|
|
title: "申请审批驳回成功"
|
|
|
|
})
|
|
|
|
this.getList("refresh")
|
|
|
|
} else {
|
|
|
|
this.showMessage("申请审批驳回失败")
|
|
|
|
}
|
|
|
|
|
|
|
|
}).catch(error => {
|
|
|
|
this.showMessage(error)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
unPlannedIssueRequestHandle(id) {
|
|
|
|
unPlannedIssueRequestHandle(id).then(res => {
|
|
|
|
if (res.data) {
|
|
|
|
uni.showToast({
|
|
|
|
title: "申请处理成功"
|
|
|
|
})
|
|
|
|
this.getList("refresh")
|
|
|
|
} else {
|
|
|
|
this.showMessage("申请处理失败")
|
|
|
|
}
|
|
|
|
|
|
|
|
}).catch(error => {
|
|
|
|
this.showMessage(error)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
unPlannedIssueRequestAddAgain(id) {
|
|
|
|
unPlannedIssueRequestAddAgain(id).then(res => {
|
|
|
|
if (res.data) {
|
|
|
|
uni.showToast({
|
|
|
|
title: "申请重新添加成功"
|
|
|
|
})
|
|
|
|
this.getList("refresh")
|
|
|
|
} else {
|
|
|
|
this.showMessage("申请重新添加失败")
|
|
|
|
}
|
|
|
|
|
|
|
|
}).catch(error => {
|
|
|
|
this.showMessage(error)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
</style>
|