newCreateAndDistribute #2

Merged
liangzhou merged 8 commits from newCreateAndDistribute into main 2026-02-02 10:42:19 +08:00
Showing only changes of commit 9d45a883fb - Show all commits

View File

@ -16,20 +16,9 @@
</el-autocomplete>
<el-input v-model="vehicleIdQuery" style="width: 196px; margin-right: 10px;" placeholder="箱号"
:suffix-icon="Search"/>
<el-input v-model="locationIdQuery" style="width: 196px; margin-right: 10px;" placeholder="库位"
:suffix-icon="Search"/>
<el-select-v2 v-model="goodsTypeQuery" style="width: 158px; margin-right: 10px;" placeholder="物料类型"
:options="goodsTypeOptions" @change="search()"></el-select-v2>
<el-select-v2 v-model="stockStatusQuery" style="width: 158px; margin-right: 10px;" placeholder="库存状态"
:options="stockStatusSearchOptions" @change="search()"></el-select-v2>
<el-date-picker v-model="createTimeQuery" type="date" placeholder="选择上架日期" :shortcuts="shortcuts"
style="width: 158px; margin-right: 10px;" clearable/>
<el-button type="primary" @click="search()">搜索</el-button>
<el-button type="warning" @click="reset()">重置</el-button>
</el-row>
<el-row>
<el-button type="success" @click="exportExcel()">导出</el-button>
</el-row>
</div>
<br/>
<el-table id="stock-table" :data="displayStocks" stripe border v-loading="loading" class="table-class"
@ -88,8 +77,6 @@ import {ElMessage} from 'element-plus'
<script>
export default {
name: 'stockFroInv',
props: ['selStock'],
emits: ['update:selStock'],
data() {
return {
displayStocks: [],
@ -100,10 +87,6 @@ export default {
isAsc: true,
goodsIdQuery: '',
vehicleIdQuery: '',
locationIdQuery: '',
goodsTypeQuery: '',
stockStatusQuery: -99,
createTimeQuery: null,
shortcuts: [
{
text: '今天',
@ -120,116 +103,7 @@ export default {
],
loading: true,
stockId: '',
stockFormRef: ref(),
stockFormEntity: reactive({}),
rules: reactive({}),
labelPosition: 'top',
dialogVisible: false,
goodsStatusOptions: [
{
value: 0,
label: '合格'
},
{
value: 1,
label: '不合格'
},
{
value: 2,
label: '延期'
},
{
value: 3,
label: '过期'
},
{
value: 5,
label: '长时间未使用'
}
],
stockStatusOptions: [
{
value: 0,
label: '库存正常'
},
{
value: 1,
label: '出库中'
},
{
value: 2,
label: '盘点中'
},
{
value: 3,
label: '移库中'
},
{
value: 4,
label: '拣选中'
},
{
value: 5,
label: '回库中'
},
{
value: 9,
label: '库存锁定'
}
],
stockStatusSearchOptions: [
{
value: -99,
label: '全部'
},
{
value: 0,
label: '库存正常'
},
{
value: 1,
label: '出库中'
},
{
value: 2,
label: '盘点中'
},
{
value: 3,
label: '移库中'
},
{
value: 4,
label: '拣选中'
},
{
value: 5,
label: '回库中'
},
{
value: 6,
label: '已出库'
},
{
value: 9,
label: '库存锁定'
}
],
goodsList: [],
goodsTypeOptions: [
{
value: "",
label: '全部'
},
{
value: "直接物料",
label: '直接物料'
},
{
value: "间接物料",
label: '间接物料'
}
],
}
},
mounted() {
@ -346,10 +220,6 @@ export default {
isAsc: this.isAsc,
goodsId: this.goodsIdQuery.trim(),
vehicleId: this.vehicleIdQuery.trim(),
locationId: this.locationIdQuery.trim(),
goodsType: this.goodsTypeQuery.trim(),
stockStatus: this.stockStatusQuery == -99 ? null : this.stockStatusQuery,
createTime: timeFormatter(this.createTimeQuery),
userName: store.getters.getUserName
}
getAllStocks(request).then(res => {
@ -369,98 +239,11 @@ export default {
reset() {
this.goodsIdQuery = ''
this.vehicleIdQuery = ''
this.locationIdQuery = ''
this.goodsTypeQuery = ''
this.stockStatusQuery = -99
this.createTimeQuery = null
this.search()
},
getCurrentRow(row) {
this.stockId = row.stockId
this.$emit('update:selStock', row)
},
exportExcel() {
const params = {
goodsId: this.goodsIdQuery.trim(),
vehicleId: this.vehicleIdQuery.trim(),
locationId: this.locationIdQuery.trim(),
goodsType: this.goodsTypeQuery.trim(),
stockStatus: this.stockStatusQuery == -99 ? null : this.stockStatusQuery,
createTime: timeFormatter(this.createTimeQuery),
userName: store.getters.getUserName
}
downloadStockExcel(params).then(res => {
const link = document.createElement('a');//a
try {
// let blob = new Blob([res.data],{type: 'application/vnd.ms-excel'}); //blobblobtypexls
let blob = res.data //blob
// let _fileName = res.headers['content-disposition'].split(';')[1].split('=')[1]; //
let _fileName = "库存报表" + dateFormatter(new Date) + ".xlsx"
link.style.display = 'none'//
// URL
const url = window.URL || window.webkitURL || window.moxURL
link.href = url.createObjectURL(blob)
link.setAttribute('download', _fileName.substring(_fileName.lastIndexOf('_') + 1))
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
url.revokeObjectURL(link.href)//url
} catch (e) {
console.log(e)
errorBox('下载文件失败')
}
}).catch(err => {
console.log(err)
errorBox('导出失败')
})
},
editCurrentRowStock(row) {
this.stockFormEntity = {
stockId: row.stockId,
locationId: row.locationId,
vehicleId: row.vehicleId,
stockStatus: row.stockStatus,
createTime: row.createTime,
lastUpdateTime: row.lastUpdateTime,
lastUpdateUser: row.lastUpdateUser,
isInventory: row.isInventory,
inventoryTaskId: row.inventoryTaskId,
noUseDays: row.noUseDays,
goodsId: row.goodsId,
goodsName: row.goodsName,
goodsStatus: row.goodsStatus,
remainNum: row.remainNum,
totalNum: row.totalNum,
goodsType: row.goodsType == "间接物料" ? "间接物料" : "直接物料",
}
this.dialogVisible = true
},
submitStockInfo() {
const request = {
stockId: this.stockFormEntity.stockId,
locationId: this.stockFormEntity.locationId,
vehicleId: this.stockFormEntity.vehicleId,
stockStatus: this.stockFormEntity.stockStatus,
goodsId: this.stockFormEntity.goodsId,
goodsStatus: this.stockFormEntity.goodsStatus,
remainNum: this.stockFormEntity.remainNum,
userName: store.getters.getUserName,
goodsType: this.stockFormEntity.goodsType,
}
updateStockInfo(request).then(res => {
if (res.data.code == 0) {
this.dialogVisible = false
ElMessage.success('更新库存成功')
this.search()
} else {
errorBox(res.data.message)
}
}).catch(err => {
console.log(err)
errorBox('更新库存失败')
})
}
},
}
</script>