diff --git a/src/layout/stockForInv.vue b/src/layout/stockForInv.vue
index 435ee42..399ef77 100644
--- a/src/layout/stockForInv.vue
+++ b/src/layout/stockForInv.vue
@@ -16,20 +16,9 @@
-
-
-
-
搜索
重置
-
- 导出
-
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'}); //如果后台返回的不是blob对象类型,先定义成blob对象格式,该type导出为xls格式,
- 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('更新库存失败')
- })
- }
},
}