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.
258 lines
6.4 KiB
258 lines
6.4 KiB
<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="detailOptions" @click="swipeClick($event,item)">
|
|
<comInspectRequestCard :dataContent="item" @click='openRequestDetail(item)'>
|
|
</comInspectRequestCard>
|
|
</uni-swipe-action-item>
|
|
</view>
|
|
</uni-swipe-action>
|
|
<uni-load-more :status="loadingType" v-if="requestList.length>0" />
|
|
<request-info-popup ref='requestInfoPopup'></request-info-popup>
|
|
</view>
|
|
<comMessage ref="comMessage"></comMessage>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import requestFilter from '@/mycomponents/request/requestFilter.vue'
|
|
import comEmptyView from '@/mycomponents/common/comEmptyView.vue'
|
|
import comMessage from '@/mycomponents/common/comMessage.vue'
|
|
import comInspectRequestCard from '@/pages/inspect/coms/comInspectRequestCard.vue'
|
|
import requestInfoPopup from '@/pages/inspect/coms/requestInfoPopup.vue'
|
|
import {
|
|
goHome,
|
|
updateTitle
|
|
} from '@/common/basic.js';
|
|
import {
|
|
getInspectRequestList,
|
|
} from '@/api/request2.js';
|
|
|
|
import {
|
|
getDetailOption,
|
|
getDetailAndApproveOption,
|
|
getDetailAndApprovePassAndApproveNoOption,
|
|
getDetailAndHandleOption,
|
|
getDetailAndCloseOption
|
|
} from '@/common/array.js';
|
|
|
|
|
|
export default {
|
|
components: {
|
|
comEmptyView,
|
|
requestFilter,
|
|
comMessage,
|
|
comInspectRequestCard,
|
|
requestInfoPopup,
|
|
},
|
|
data() {
|
|
return {
|
|
requestList: [],
|
|
pageNo: 1,
|
|
pageSize: 10,
|
|
status: "",
|
|
totalCount: 0,
|
|
checkedWaitTask: false,
|
|
detailOptions: [],
|
|
detailAndApproveOptions: [],
|
|
detailAndApprovePassAndApproveNoOption: [],
|
|
detailAndHandleOption: [],
|
|
detailAndCloseOption: [],
|
|
showOptions: [],
|
|
fromType: "requestType",
|
|
loadingType: "nomore",
|
|
|
|
};
|
|
},
|
|
onReady() {
|
|
this.detailOptions = getDetailOption();
|
|
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: {
|
|
openRequestDetail(item) {
|
|
uni.navigateTo({
|
|
url: './inspectRequestDetail?id=' + item.id
|
|
});
|
|
},
|
|
|
|
openRequestInfoPopup(item) {
|
|
this.$refs.requestInfoPopup.openPopup(item)
|
|
},
|
|
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 {
|
|
this.showOptions = this.detailOptions;
|
|
}
|
|
return this.showOptions
|
|
},
|
|
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,
|
|
}
|
|
getInspectRequestList(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();
|
|
}
|
|
this.loadingType = "";
|
|
updateTitle("检验单申请");
|
|
uni.hideLoading();
|
|
that.showMessage(error)
|
|
})
|
|
},
|
|
|
|
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("关闭")
|
|
}
|
|
},
|
|
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,
|
|
}
|
|
getInspectRequestList(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) {
|
|
|
|
}
|
|
});
|
|
},
|
|
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
</style>
|
|
|