187 lines
4.8 KiB
Vue
187 lines
4.8 KiB
Vue
<template>
|
|
<div class="container">
|
|
<div class="tip">
|
|
<el-select
|
|
v-model="searchInfo.type"
|
|
placeholder="变更类型"
|
|
clearable style="width: 240px;" @clear="init()">
|
|
<el-option
|
|
v-for="(item,key) in typeMapping"
|
|
:key="key"
|
|
:label="item"
|
|
:value="key"
|
|
/>
|
|
</el-select>
|
|
<el-select
|
|
v-model="searchStatus.type"
|
|
placeholder="上传状态"
|
|
clearable style="width: 240px;margin: 0 10px" @clear="init()">
|
|
<el-option
|
|
v-for="(item,key) in uploadStatus"
|
|
:key="key"
|
|
:label="item"
|
|
:value="key"
|
|
/>
|
|
</el-select>
|
|
<el-select
|
|
v-model="in_out_obj.type"
|
|
placeholder="进货,退货"
|
|
clearable style="width: 240px;margin: 0 10px" @clear="init()">
|
|
<el-option
|
|
v-for="(item,key) in in_out"
|
|
:key="key"
|
|
:label="item"
|
|
:value="key"
|
|
/>
|
|
</el-select>
|
|
<el-button type="primary" style="margin-left: 10px" @click="change_search">搜索</el-button>
|
|
</div>
|
|
<div class="content">
|
|
<el-table :data="tableData" style="width: 100%;height: 100%">
|
|
<el-table-column prop="number" label="进货,退货数量" show-overflow-tooltip>
|
|
<template #default="{row}">
|
|
<el-icon v-if="row.number<0" style="font-size: 9px"><Minus /></el-icon>
|
|
<el-icon v-if="row.number>0" style="font-size: 9px"><Plus /></el-icon>
|
|
<span>
|
|
<template v-if="row.number!=0">
|
|
{{Math.abs(row.number)}}
|
|
</template>
|
|
</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="uploadStatus" label="状态">
|
|
<template #default="{row}">
|
|
{{ uploadStatus[row.uploadStatus as keyof typeof uploadStatus] }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="uploadMessage" label="上传状态信息" show-overflow-tooltip/>
|
|
<el-table-column prop="uploadDatetime" label="最近上传时间">
|
|
<template #default="{row}">
|
|
{{ formatDate(row.uploadDatetime) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="type" label="库存变更类型">
|
|
<template #default="{row}">
|
|
{{ typeMapping[row.type as keyof typeof typeMapping] }}
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</div>
|
|
<div class="bottom">
|
|
<el-pagination
|
|
background
|
|
layout="prev, pager, next"
|
|
:page-size="pageSize"
|
|
:current-page="currentPage"
|
|
:total="total"
|
|
@current-change="changePage"
|
|
/>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<script setup lang="ts">
|
|
import {ref, computed, onMounted} from 'vue'
|
|
import { ElInput, ElTable, ElTableColumn, ElPagination } from 'element-plus'
|
|
import {post} from "@/utils/request.ts";
|
|
import {Minus, Plus} from "@element-plus/icons-vue";
|
|
|
|
// 模拟数据
|
|
const tableData = ref([])
|
|
|
|
// 搜索相关
|
|
const searchInfo=ref({
|
|
type:'',
|
|
keyword: '',
|
|
})
|
|
const searchStatus=ref({
|
|
type:'',
|
|
keyword: '',
|
|
})
|
|
const in_out_obj=ref({
|
|
type:'',
|
|
keyword: '',
|
|
})
|
|
// 定义 type 与 typeName 的映射关系
|
|
const typeMapping = {
|
|
101: '调拨入库',
|
|
102: '调拨出库',
|
|
103: '盘盈',
|
|
104: '盘损',
|
|
105: '销毁',
|
|
106: '其他入库',
|
|
107: '其他出库',
|
|
108: '初始化入库'
|
|
}
|
|
const uploadStatus = {
|
|
0: '未上传',
|
|
1: '已上传',
|
|
2: '异常',
|
|
}
|
|
const in_out = {
|
|
106: '进货',
|
|
107: '退货',
|
|
}
|
|
|
|
// 分页相关
|
|
const currentPage = ref(1)
|
|
const pageSize = ref(10)
|
|
const total= ref(0)
|
|
onMounted(()=>{
|
|
init()
|
|
})
|
|
let init = ()=>{
|
|
const query = {
|
|
page: 1,
|
|
pageSize: 20,
|
|
type:searchInfo.value.type||in_out_obj.value.type||'',
|
|
uploadStatus:searchStatus.value.type||'',
|
|
}
|
|
post("social/upload/get3503List",{query: query}).then((res:any)=>{
|
|
tableData.value = res.list
|
|
})
|
|
}
|
|
let changePage = (value: number) => {
|
|
currentPage.value = value
|
|
const query = {
|
|
pageNum: value,
|
|
pageSize: pageSize.value,
|
|
}
|
|
post("social/upload/get3503List",{query: query}).then((res:any)=>{
|
|
tableData.value = res.list
|
|
total.value = res.total_count
|
|
})
|
|
}
|
|
let change_search=()=>{
|
|
init()
|
|
}
|
|
// 转成YYYY-MM-DD格式
|
|
const formatDate = (isoStr:any) => {
|
|
console.log(isoStr,"isoStr")
|
|
const date = new Date(isoStr);
|
|
return `${date.getFullYear()}-${(date.getMonth()+1).toString().padStart(2,'0')}-${date.getDate().toString().padStart(2,'0')}`;
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
@use "@/assets/scss/base.scss";
|
|
.container {
|
|
height: 100%;
|
|
display: flex;
|
|
flex-direction: column;
|
|
|
|
.top {
|
|
height: 60px;
|
|
}
|
|
.content {
|
|
flex: 1;
|
|
min-height: 0;
|
|
}
|
|
.bottom {
|
|
height: 60px;
|
|
display: flex;
|
|
align-items: center;
|
|
background: base.$background-color-base;
|
|
|
|
}
|
|
}
|
|
</style> |