2024-12-17 09:13:52 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<view>
|
|
|
|
|
|
<!-- 搜索 -->
|
2024-12-18 08:56:39 +08:00
|
|
|
|
<div class="search">
|
|
|
|
|
|
<u-input
|
|
|
|
|
|
v-model="keyWord"
|
|
|
|
|
|
placeholder="请输入搜索内容"
|
|
|
|
|
|
suffixIcon="search"
|
|
|
|
|
|
suffixIconStyle="color: #666"
|
|
|
|
|
|
shape="circle"
|
|
|
|
|
|
@blur="handleSearch"
|
|
|
|
|
|
></u-input>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<!-- 列表 -->
|
|
|
|
|
|
<div class="list-cont" v-for="(item, index) in tableList" :key="index">
|
|
|
|
|
|
<u-row justify="space-between" customStyle="margin-bottom: 10px; padding: 0 15px;">
|
|
|
|
|
|
<u-col span="6">
|
|
|
|
|
|
<div>{{ item.name }}</div>
|
|
|
|
|
|
</u-col>
|
|
|
|
|
|
<u-col span="6">
|
2024-12-18 13:52:12 +08:00
|
|
|
|
<div style="text-align: end; color: #999">{{ item.model }}</div>
|
2024-12-18 08:56:39 +08:00
|
|
|
|
</u-col>
|
|
|
|
|
|
</u-row>
|
|
|
|
|
|
<u-line style="margin-bottom: 5px"></u-line>
|
|
|
|
|
|
<div class="list-item">
|
|
|
|
|
|
<span>材料类型:</span>
|
|
|
|
|
|
<span>{{ item.type }}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="list-item">
|
|
|
|
|
|
<span>库存数量:</span>
|
2024-12-18 13:52:12 +08:00
|
|
|
|
<span style="color: #5ae725">{{ item.kcNum }}</span>
|
2024-12-18 08:56:39 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="list-item">
|
|
|
|
|
|
<span>报废数量:</span>
|
2024-12-18 13:52:12 +08:00
|
|
|
|
<span style="color: #f9ae3d">{{ item.dbfNum }}</span>
|
2024-12-18 08:56:39 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2024-12-18 17:26:55 +08:00
|
|
|
|
<u-loadmore :status="status" line v-if="tableList.length > 10" />
|
2024-12-18 08:56:39 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- 空状态 -->
|
|
|
|
|
|
<u-empty v-if="tableList.length == 0" mode="data"></u-empty>
|
2024-12-17 09:13:52 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2024-12-18 08:56:39 +08:00
|
|
|
|
import { getInventoryList } from '@/api/aqSafety'
|
|
|
|
|
|
|
2024-12-17 09:13:52 +08:00
|
|
|
|
export default {
|
|
|
|
|
|
data() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
keyWord: '',
|
2024-12-18 08:56:39 +08:00
|
|
|
|
status: 'loadmore',
|
|
|
|
|
|
pageNum: 1,
|
|
|
|
|
|
pageSize: 10,
|
|
|
|
|
|
total: 0,
|
2024-12-18 13:52:12 +08:00
|
|
|
|
tableList: []
|
2024-12-17 09:13:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
},
|
2024-12-18 13:52:12 +08:00
|
|
|
|
onLoad() {
|
|
|
|
|
|
this.getList()
|
|
|
|
|
|
},
|
2024-12-17 09:13:52 +08:00
|
|
|
|
methods: {
|
2024-12-18 08:56:39 +08:00
|
|
|
|
handleSearch() {
|
|
|
|
|
|
this.pageSize = 10
|
|
|
|
|
|
this.getList()
|
|
|
|
|
|
},
|
|
|
|
|
|
async getList() {
|
|
|
|
|
|
try {
|
|
|
|
|
|
const params = {
|
2024-12-18 13:52:12 +08:00
|
|
|
|
encryptedData: JSON.stringify({ keyWord: this.keyWord }),
|
2024-12-18 08:56:39 +08:00
|
|
|
|
pageNum: this.pageNum,
|
|
|
|
|
|
pageSize: this.pageSize
|
|
|
|
|
|
}
|
|
|
|
|
|
console.log('🚀 ~ getList ~ params', params)
|
2024-12-18 13:52:12 +08:00
|
|
|
|
const res = await getInventoryList(params)
|
2024-12-18 08:56:39 +08:00
|
|
|
|
console.log('🚀 ~ getList ~ res', res)
|
2024-12-18 13:52:12 +08:00
|
|
|
|
this.tableList = res.data.list
|
|
|
|
|
|
this.total = res.data.total
|
2024-12-18 08:56:39 +08:00
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.log('🚀 ~ getList ~ error', error)
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
onReachBottom() {
|
|
|
|
|
|
console.log('🚀 ~ onReachBottom ~ ')
|
|
|
|
|
|
if (this.total < 10 || this.total == this.tableList.length) {
|
|
|
|
|
|
this.status = 'nomore'
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
this.status = 'loading'
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
this.pageSize += 10
|
|
|
|
|
|
this.getList()
|
|
|
|
|
|
if (this.tableList.length != this.total) this.status = 'loadmore'
|
|
|
|
|
|
else this.status = 'nomore'
|
|
|
|
|
|
}, 500)
|
|
|
|
|
|
console.log('加载..', this.pageSize)
|
2024-12-17 09:13:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
|
|
page {
|
|
|
|
|
|
padding: 15px;
|
2024-12-18 08:56:39 +08:00
|
|
|
|
background-color: #f8f8f8;
|
|
|
|
|
|
}
|
|
|
|
|
|
.search {
|
|
|
|
|
|
margin-bottom: 15px;
|
|
|
|
|
|
}
|
|
|
|
|
|
.list-cont {
|
|
|
|
|
|
padding: 15px 0;
|
|
|
|
|
|
margin-bottom: 15px;
|
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
|
2024-12-17 09:13:52 +08:00
|
|
|
|
|
2024-12-18 08:56:39 +08:00
|
|
|
|
.list-item {
|
|
|
|
|
|
padding: 5px 15px;
|
|
|
|
|
|
}
|
2024-12-17 09:13:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
</style>
|