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.

227 lines
5.5 KiB

12 months ago
<template>
<view class="">
<view class="" v-if="jobList.length>0">
12 months ago
<uni-swipe-action ref="swipeAction">
<view v-for="(item, index) in jobList" :key="index">
<uni-swipe-action-item :right-options="item.options" @click="swipeClick($event,item)">
<com-repleinsh-request-card :dataContent="item" @click='openRequestDetail(item)'>
</com-repleinsh-request-card>
</uni-swipe-action-item>
</view>
</uni-swipe-action>
<uni-load-more :status="loadingType" />
<request-info-popup ref='requestInfoPopup'></request-info-popup>
12 months ago
</view>
12 months ago
<requestButton @goScan='openScanDetailPopup' ></requestButton>
12 months ago
</view>
<comMessage ref="comMessage"></comMessage>
</template>
<script>
import requiredLocation from '@/mycomponents/location/requiredLocation.vue'
import comMessage from '@/mycomponents/common/comMessage.vue'
import comRepleinshRequestCard from '@/pages/repleinsh/coms/comRepleinshRequestCard.vue'
import requestInfoPopup from '@/pages/repleinsh/coms/requestInfoPopup.vue'
import requestButton from '@/mycomponents/button/requestButton.vue'
12 months ago
12 months ago
import {
getBusinessType,
} from '@/common/record.js';
12 months ago
12 months ago
import {
goHome,
updateTitle
} from '@/common/basic.js';
12 months ago
12 months ago
import {
getRepleinshRequestList,
} from '@/api/request2.js';
import {
getDetailOption,
getDetailAndApproveOption,
getDetailAndApprovePassAndApproveNoOption,
getDetailAndHandleOption,
11 months ago
getDetailAndAddAndCloseOption
12 months ago
} from '@/common/array.js';
export default {
components: {
requiredLocation,
comMessage,
comRepleinshRequestCard,
requestInfoPopup,
requestButton,
},
data() {
return {
jobList: [],
pageNo: 1,
pageSize: 10,
businessType: "",
fromlocationTypeList: [],
tolocationTypeList: [],
toLocationCode: '',
status: [],
creationTimeStart: "",
creationTimeEnd: "",
totalCount: 0,
detailOptions: [],
detailAndApproveOptions: [],
detailAndApprovePassAndApproveNoOption: [],
detailAndHandleOption: [],
11 months ago
detailAndAddAndCloseOption: [],
12 months ago
showOptions: [],
12 months ago
fromType: "requestType",
12 months ago
loadingType: "nomore",
};
},
onReady() {
this.detailOptions = getDetailOption();
this.detailAndApproveOptions = getDetailAndApproveOption()
this.detailAndApprovePassAndApproveNoOption = getDetailAndApprovePassAndApproveNoOption(),
12 months ago
this.detailAndHandleOption = getDetailAndHandleOption()
11 months ago
this.detailAndAddAndCloseOption = getDetailAndAddAndCloseOption()
12 months ago
},
onReachBottom() {
//避免多次触发
if (this.loadingType == 'loading' || this.loadingType == 'nomore') {
return;
}
this.getList("more");
},
12 months ago
12 months ago
onPullDownRefresh() {
this.getList('refresh');
},
onShow() {
this.getList('refresh');
},
//返回首页
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
}
},
mounted() {
},
methods: {
openRequestDetail(item) {
uni.navigateTo({
url: './repleinshRequestDetail?id=' + item.id
});
},
openRequestInfoPopup(item) {
this.$refs.requestInfoPopup.openPopup(item)
},
getList(type) {
let that = this;
12 months ago
uni.showLoading({
title: "加载中­....",
mask: true
});
12 months ago
this.loadingType = "loading";
if (type === "refresh") {
this.pageNo = 1;
this.jobList = [];
}
12 months ago
var params = {
// filters: [{
// column: "status",
// action: "in",
// value: "1,2"
// }],
pageNo: this.pageNo,
pageSize: this.pageSize,
}
12 months ago
getRepleinshRequestList(params).then(res => {
uni.hideLoading();
if (type === "refresh") {
uni.stopPullDownRefresh();
}
12 months ago
12 months ago
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.jobList = type === "refresh" ? list : this.jobList.concat(list);
12 months ago
12 months ago
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") {
11 months ago
this.showOptions = this.detailAndAddAndCloseOption;
12 months ago
} else {
this.showOptions = this.detailOptions;
}
return this.showOptions
},
openScanDetailPopup() {
uni.navigateTo({
12 months ago
url: "../record/repleinshRecord?fromType=" + this.fromType
12 months ago
})
},
swipeClick(e, dataContent) {
if (e.content.text == "详情") {
console.log("详情", dataContent.id)
this.openRequestInfoPopup(dataContent);
} else if (e.content.text == "处理") {
console.log("处理")
} else if (e.content.text == "审批") {
console.log("审批")
} else if (e.content.text == "审批通过") {
console.log("审批通过")
} else if (e.content.text == "审批驳回") {
console.log("审批驳回")
} else if (e.content.text == "关闭") {
console.log("关闭")
}
},
showMessage(message) {
this.$refs.comMessage.showMessage(message, res => {
if (res) {
}
});
},
}
}
</script>
<style>
</style>