<template>
|
<view class="content">
|
<view class="content_search">
|
<Search @searchInput="searchInput" @submit="submit" @reset="reset" :isShow="true"
|
placeholder="搜索仓库名称/物料名称">
|
<template v-slot:content>
|
<view class="Search_item">
|
<view class="Search_item_label">汇总依据</view>
|
<view class="Search_item_content">
|
<view class="tag">
|
<view
|
class="tag_item"
|
:class="{ tag_active: item.isActive }"
|
v-for="(item, i) in groupTypes"
|
:key="item.id"
|
@click="changeGroup(i)"
|
>
|
{{ item.name }}
|
</view>
|
</view>
|
</view>
|
</view>
|
</template>
|
</Search>
|
</view>
|
<view class="content_total" :style="{top: top}">共{{controlData.total}}条数据</view>
|
<view class="content_list">
|
<scroll-view
|
:refresher-enabled="true"
|
:refresher-triggered="isLoading"
|
@refresherrefresh="onRefresh"
|
refresher-background="#fff"
|
@scrolltolower="getLists"
|
scroll-y
|
:style="{height: height}">
|
<view class="content_list_item" v-for="(item, i) in list" :key="i">
|
<view class="content_list_item_top">
|
<view class="content_list_item_top_left">
|
<text>{{ item.materialName }} | {{ item.materialCode }}</text>
|
</view>
|
<view class="content_list_item_top_right">
|
<text class="created">{{ '库存:' + item.num + item.unitName }}</text>
|
</view>
|
</view>
|
<view class="content_list_item_sx">
|
<text v-if="item.qualityType == 0" class="green">合格 | </text>
|
<text v-if="item.qualityType == 1" class="yellow">不良 | </text>
|
<text v-if="item.qualityType == 2" class="red">报废 | </text>
|
<text> {{ item.procedureName ? item.procedureName : '-' }} |</text>
|
<text> {{ item.batch ? item.batch : '-' }}</text>
|
</view>
|
<!-- item主题信息部分 -->
|
<view class="content_list_item_content">
|
<view class="content_list_item_content_item">
|
<view class="content_list_item_content_item_label">规格:</view>
|
<view class="content_list_item_content_item_nr">
|
{{ item.attr }}
|
</view>
|
</view>
|
<view class="content_list_item_content_item" v-if="data.groupType == '3' || data.groupType == '2'">
|
<view class="content_list_item_content_item_label">仓库:</view>
|
<view class="content_list_item_content_item_nr">
|
{{ item.wareHouseName ? item.wareHouseName : '-' }}
|
</view>
|
</view>
|
<view class="content_list_item_content_item" v-if="data.groupType == '3' || data.groupType == '2'">
|
<view class="content_list_item_content_item_label">货位:</view>
|
<view class="content_list_item_content_item_nr">
|
{{ item.locationName }}
|
</view>
|
</view>
|
</view>
|
</view>
|
</scroll-view>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import Search from '@/components/Search.vue'
|
import { getwStockExtList } from "@/util/api/materialStorage"
|
|
export default {
|
components: {
|
Search
|
},
|
data() {
|
return {
|
height: '',
|
top: '',
|
isLoading: false,
|
controlData: {
|
finished: false,
|
loading: false,
|
total: 0,
|
page: 0,
|
capacity: 10,
|
},
|
groupTypes: [
|
{ name: '默认', id: '3', isActive: true },
|
{ name: '物料', id: '1', isActive: false },
|
{ name: '物料+仓库', id: '2', isActive: false }
|
],
|
data: {
|
materialName: '',
|
groupType: '3'
|
},
|
list: [],
|
refreshing: false
|
};
|
},
|
onReady() {
|
var that = this
|
this.$nextTick(() => {
|
uni.createSelectorQuery().in(this).select('.content_search').boundingClientRect((rect) => {
|
that.height = `calc(100vh - ${rect.height + 80}px)`
|
that.top = `${rect.height}px`
|
}).exec()
|
})
|
},
|
onLoad() {
|
this.getLists()
|
},
|
methods: {
|
onRefresh() {
|
this.isLoading = true
|
this.controlData.page = 0;
|
this.controlData.finished = false;
|
this.list = [];
|
this.getLists()
|
},
|
changeGroup(i) {
|
this.groupTypes[i].isActive = !this.groupTypes[i].isActive;
|
this.data.groupType = this.groupTypes[i].id
|
for (const index in this.groupTypes) {
|
if (index != i) {
|
const item = this.groupTypes[index]
|
item.isActive = false
|
}
|
}
|
},
|
tyepToStr(type) {
|
for (const item of this.orderType) {
|
if (item.id == type) {
|
return item.name
|
}
|
}
|
return '-'
|
},
|
// 跳转
|
jump(item) {
|
uni.navigateTo({
|
url: `/pages/planDetails/planDetails?id=${item.id}`
|
})
|
},
|
// 获取计划列表数据
|
getLists() {
|
if (!this.controlData.finished) {
|
this.controlData.loading = true;
|
this.controlData.page = this.controlData.page += 1;
|
getwStockExtList({
|
capacity: this.controlData.capacity,
|
model: {
|
materialOrBatch: this.data.materialName,
|
groupType: this.data.groupType,
|
greaterZero: 1
|
},
|
page: this.controlData.page,
|
sorts: [
|
{
|
direction: "ASC",
|
property: "publishDate",
|
}
|
]
|
}).then((res) => {
|
this.isLoading = false
|
if (this.refreshing) {
|
this.list = []
|
this.refreshing = false;
|
}
|
this.controlData.loading = false;
|
this.controlData.total = res.data.total;
|
if (res.code === 200) {
|
if (res.data.records.length < this.controlData.capacity) {
|
this.controlData.finished = true;
|
}
|
if (this.controlData.page === 1) {
|
this.list = res.data.records;
|
} else {
|
this.list.push(...res.data.records)
|
}
|
}
|
})
|
.catch((err) => {
|
this.isLoading = false
|
this.controlData.loading = false;
|
this.controlData.finished = true;
|
if (this.refreshing) {
|
this.list = []
|
this.refreshing = false;
|
}
|
})
|
} else {
|
this.isLoading = false
|
}
|
},
|
// 获取头部组件高度
|
getHeight(height) {
|
this.height = height
|
},
|
// 重置
|
reset() {
|
this.controlData.page = 0;
|
this.data.groupType = '3'
|
this.controlData.finished = false;
|
this.groupTypes.forEach((item, index) => {
|
item.isActive = index === 0;
|
})
|
this.data.materialName = ''
|
this.list = [];
|
this.getLists();
|
},
|
// 搜索
|
searchInput(val) {
|
this.data.materialName = val;
|
this.controlData.page = 0;
|
this.controlData.finished = false;
|
this.list = [];
|
this.getLists()
|
},
|
// 搜索弹框提交
|
submit() {
|
this.controlData.page = 0;
|
this.controlData.finished = false;
|
this.list = [];
|
this.getLists();
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.content {
|
.content_search {
|
width: 100%;
|
padding: 30rpx;
|
background: white;
|
position: sticky;
|
top: 0;
|
z-index: 999;
|
box-sizing: border-box;
|
|
.Search_item {
|
margin-bottom: 40rpx;
|
|
.Search_item_label {
|
font-size: 30rpx;
|
font-weight: 500;
|
color: #222222;
|
}
|
|
.Search_item_content {
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
margin-top: 30rpx;
|
|
.tag {
|
display: flex;
|
flex-wrap: wrap;
|
align-items: center;
|
|
.tag_active {
|
background: $nav-color !important;
|
color: #ffffff !important;
|
}
|
|
.tag_item {
|
padding: 22rpx 26rpx;
|
box-sizing: border-box;
|
background: #F2F2F2;
|
border-radius: 8rpx;
|
font-size: 26rpx;
|
font-weight: 400;
|
color: #333333;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
margin-right: 22rpx;
|
margin-bottom: 22rpx;
|
}
|
}
|
|
text {
|
font-size: 26rpx;
|
font-weight: 400;
|
color: #333333;
|
margin: 0 30rpx;
|
}
|
|
.Search_item_content_a {
|
padding: 20rpx 0;
|
flex: 1;
|
background: #F7F7F7;
|
border-radius: 8rpx;
|
border: 1rpx solid #EEEEEE;
|
font-size: 26rpx;
|
font-weight: 400;
|
color: #B2B2B2;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
}
|
}
|
}
|
|
.content_search_x {
|
height: 24rpx;
|
}
|
}
|
|
.content_list {
|
width: 100%;
|
display: flex;
|
flex-direction: column;
|
.content_list_item {
|
background: #ffffff;
|
padding: 30rpx;
|
display: flex;
|
flex-direction: column;
|
border-bottom: 1rpx solid #ececec;
|
.content_list_item_sx {
|
margin-top: 20rpx;
|
}
|
.content_list_item_top {
|
display: flex;
|
align-items: center;
|
justify-content: space-between;
|
.content_list_item_top_left {
|
text {
|
font-size: 32rpx;
|
font-weight: 500;
|
color: #333333;
|
}
|
}
|
.content_list_item_top_right {
|
font-size: 26rpx;
|
font-weight: 400;
|
.created {
|
color: $nav-stateColor1 !important;
|
}
|
.warning {
|
color: $nav-stateColor5 !important;
|
}
|
.green {
|
color: $nav-stateColor6 !important;
|
}
|
.info {
|
color: $nav-stateColor3 !important;
|
}
|
}
|
}
|
.content_list_item_content {
|
padding: 24rpx 30rpx;
|
background: #f7f7f7;
|
border-radius: 16rpx;
|
display: flex;
|
flex-wrap: wrap;
|
justify-content: space-between;
|
margin-top: 32rpx;
|
.content_list_item_content_item {
|
width: 100%;
|
display: flex;
|
margin-top: 24rpx;
|
&:nth-child(1) {
|
margin-top: 0 !important;
|
}
|
.content_list_item_content_item_label {
|
font-size: 24rpx;
|
font-weight: 400;
|
color: #666666;
|
flex-shrink: 0;
|
}
|
.content_list_item_content_item_nr {
|
font-size: 24rpx;
|
font-weight: 400;
|
color: #222222;
|
margin-right: 10rpx;
|
}
|
}
|
}
|
}
|
}
|
|
.content_total {
|
width: 100%;
|
height: 80rpx;
|
padding: 24rpx 30rpx;
|
background: #F7F7F7;
|
font-size: 24rpx;
|
font-weight: 400;
|
box-sizing: border-box;
|
color: #666666;
|
position: sticky;
|
z-index: 99;
|
}
|
}
|
</style>
|