|
@@ -1,21 +1,102 @@
|
|
|
<template>
|
|
|
- <div></div>
|
|
|
+ <van-nav-bar
|
|
|
+ title="仓库维护"
|
|
|
+ left-text=""
|
|
|
+ left-arrow
|
|
|
+ @click-left="onClickLeft"
|
|
|
+ @click-right="onClickRight"
|
|
|
+ >
|
|
|
+ <template #right>
|
|
|
+ 添加
|
|
|
+ </template>
|
|
|
+ </van-nav-bar>
|
|
|
+ <van-search v-model="req.keyword" placeholder="请输入搜索关键词" @search="onRefresh" />
|
|
|
+ <van-pull-refresh v-model="loading" @refresh="onRefresh" >
|
|
|
+
|
|
|
+ <div class="list">
|
|
|
+ <van-list
|
|
|
+ v-model:loading="loading"
|
|
|
+ :finished="finished"
|
|
|
+ finished-text="没有更多了"
|
|
|
+ @load="onLoad"
|
|
|
+ style="margin-bottom:60px"
|
|
|
+ >
|
|
|
+ <commonList :data="listData" @onClick="toDtl" :config="listConfig"></commonList>
|
|
|
+ </van-list>
|
|
|
+ </div>
|
|
|
+ </van-pull-refresh>
|
|
|
</template>
|
|
|
-
|
|
|
<script setup>
|
|
|
-const { proxy } = getCurrentInstance();
|
|
|
-const queryData = reactive({
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
- keyword: "",
|
|
|
- type: "2", // 2为手动出库
|
|
|
-});
|
|
|
-const getList = async () => {
|
|
|
- const data = await proxy.post("/stockJournal/page", queryData);
|
|
|
- console.log(data, "as");
|
|
|
-};
|
|
|
-getList();
|
|
|
+import { ref, getCurrentInstance, onMounted } from 'vue'
|
|
|
+import commonList from '@/components/common-list.vue'
|
|
|
+import { useRoute } from 'vue-router'
|
|
|
+const loading = ref(false)
|
|
|
+const router = useRoute()
|
|
|
+const req = ref({
|
|
|
+ pageNum:1,
|
|
|
+ keyword:null
|
|
|
+})
|
|
|
+const finished = ref(false);
|
|
|
+const proxy = getCurrentInstance().proxy
|
|
|
+const listData = ref([])
|
|
|
+
|
|
|
+
|
|
|
+const listConfig = ref([
|
|
|
+ {
|
|
|
+ label: '仓库名称',
|
|
|
+ prop: 'name',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '仓库类型',
|
|
|
+ prop: 'type',
|
|
|
+ }
|
|
|
+])
|
|
|
+const onRefresh = () => {
|
|
|
+ req.value.pageNum = 1
|
|
|
+ finished.value = false
|
|
|
+ getList('refresh')
|
|
|
+}
|
|
|
+const onLoad = () => {
|
|
|
+ getList()
|
|
|
+}
|
|
|
+
|
|
|
+const onClickLeft = () => proxy.$router.push('/main/working')
|
|
|
+
|
|
|
+const onClickRight = () => {
|
|
|
+ proxy.$router.push('/main/warehouseConfigAdd')
|
|
|
+}
|
|
|
+
|
|
|
+const toDtl = (row) => {
|
|
|
+ console.log(row)
|
|
|
+ proxy.$router.push({
|
|
|
+ path: 'warehouseConfigAdd',
|
|
|
+ query: row
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+const getList = (type) => {
|
|
|
+ loading.value = true
|
|
|
+ proxy.post('/warehouse/page',req.value).then(res => {
|
|
|
+
|
|
|
+ console.log(req.value)
|
|
|
+ listData.value = type === 'refresh' ? res.data.rows : listData.value.concat(res.data.rows)
|
|
|
+ if(req.value.pageNum * 10 >= res.data.total) {
|
|
|
+ finished.value = true
|
|
|
+ }
|
|
|
+ req.value.pageNum++
|
|
|
+ loading.value = false
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }).catch(err => {
|
|
|
+ loading.value = false
|
|
|
+ })
|
|
|
+}
|
|
|
+getList()
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
+.list {
|
|
|
+ min-height: 70vh;
|
|
|
+}
|
|
|
</style>
|