库存管理开发完成

This commit is contained in:
2024-11-06 16:59:14 +08:00
parent 660b2ca640
commit 69150eaa18
2 changed files with 125 additions and 71 deletions

View File

@@ -37,7 +37,7 @@ export function queryOutWarehouseByProjectId(id) {
// 新增仓库出库
export function addOaOutWarehouse(data) {
return request({
url: '/oa/oaOutWarehouse',
url: '/oa/oaOutWarehouse/insertOutBatch',
method: 'post',
data: data
})

View File

@@ -24,7 +24,8 @@
size="mini"
@click="handleAdd"
v-hasPermi="['oa:oaOutWarehouse:add']"
>新增</el-button>
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@@ -35,7 +36,8 @@
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['oa:oaOutWarehouse:remove']"
>删除</el-button>
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@@ -45,7 +47,8 @@
size="mini"
@click="handleExport"
v-hasPermi="['oa:oaOutWarehouse:export']"
>导出</el-button>
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@@ -64,7 +67,8 @@
icon="el-icon-search"
@click="handleSearch(scope.row)"
v-hasPermi="['oa:oaOutWarehouse:remove']"
>查看详情</el-button>
>查看详情
</el-button>
</template>
</el-table-column>
</el-table>
@@ -97,25 +101,38 @@
<el-form-item
v-for="(item, index) in form.outWareHouseList"
:label="'出库物料' + index"
:key="item.key"
:key="item.warehouseId"
:prop="'outWareHouseList.' + index + '.warehouseId'"
>
<el-row>
<el-col :span="8">物料名</el-col>
<el-col :span="4">当前库存</el-col>
<el-col :span="8">出库数量</el-col>
<el-col :span="8">操作</el-col>
<el-col :span="4">操作</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-autocomplete
class="inline-input"
v-model="item.warehouseName"
:fetch-suggestions="querySearch"
placeholder="请输入物料名"
:trigger-on-focus="false"
@select="handleSelect(item,index)"
></el-autocomplete>
<el-select
v-model="item.warehouseId"
filterable
remote
reserve-keyword
@change="(e)=>handleGetInventory(e,index)"
placeholder="请输入关键词"
:remote-method="remoteMethod"
:loading="loading">
<el-option
v-for="item in oaWarehouseList"
:key="item.id"
:label="item.name"
:value="item.id">
</el-option>
</el-select>
</el-col>
<el-col :span="4">
<el-tag type="info" v-if="item.inventory===undefined">请选择物料</el-tag>
<el-tag type="info" v-else>{{item.inventory}}</el-tag>
</el-col>
<el-col :span="8">
<el-input-number v-model="item.amount" :min="1" :max="item.inventory"></el-input-number>
@@ -164,7 +181,8 @@
size="mini"
@click="handleAdd"
v-hasPermi="['oa:oaOutWarehouse:add']"
>新增</el-button>
>新增
</el-button>
<el-table v-loading="loading" :data="oaOutWarehouseList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
@@ -181,7 +199,8 @@
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['oa:oaOutWarehouse:remove']"
>删除</el-button>
>删除
</el-button>
</template>
</el-table-column>
</el-table>
@@ -192,8 +211,17 @@
</template>
<script>
import { listOaOutWarehouse, getOaOutWarehouse, delOaOutWarehouse, addOaOutWarehouse, updateOaOutWarehouse, outWareList,queryOutWarehouseByProjectId} from "@/api/oa/oaOutWarehouse";
import {
listOaOutWarehouse,
getOaOutWarehouse,
delOaOutWarehouse,
addOaOutWarehouse,
updateOaOutWarehouse,
outWareList,
queryOutWarehouseByProjectId
} from "@/api/oa/oaOutWarehouse";
import {listProject} from "@/api/oa/project";
import {listOaWarehouse} from "../../../api/oa/oaWarehouse";
export default {
name: "OaOutWarehouse",
@@ -220,12 +248,19 @@ export default {
oaOutWarehouseList: [],
// 项目列表
projectList: [],
// 库存数据
oaWarehouseList: [],
// 弹出层标题
title: "",
// 选择对象
searchItem: {},
// 是否显示弹出层
open: false,
// 库存查询参数
warehouseParams: {
pageSize: 999,
pageNum: 1
},
// 查询参数
queryParams: {
pageNum: 1,
@@ -257,6 +292,7 @@ export default {
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
@@ -276,6 +312,7 @@ export default {
updateTime: undefined,
updateBy: undefined,
delFlag: undefined,
selectLoading: false,
outWareHouseList: []
};
this.resetForm("form");
@@ -373,21 +410,38 @@ export default {
}
},
handleGetInventory(e,index){
this.form.outWareHouseList[index].inventory = this.oaWarehouseList[this.oaWarehouseList.findIndex(item=>item.id===e)].inventory
console.log(this.form.outWareHouseList[index])
},
querySearch(queryString, cb) {
var oaWarehouseList = this.oaWarehouseList;
var results = queryString ? oaWarehouseList.filter(this.createFilter(queryString)) : oaWarehouseList;
// 调用 callback 返回建议列表的数据
sys_oa_contract
cb(results);
},
createFilter(queryString) {
return (restaurant) => {
// console.log(restaurant)
// console.log(restaurant.name.toLowerCase().indexOf(queryString.toLowerCase()))
return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
};
},
handleSelect(item,index) {
this.form.oaOutWarehouseList[index] = item
remoteMethod(query) {
this.warehouseParams.name = query
this.selectLoading = true;
listOaWarehouse(this.warehouseParams).then(res => {
this.oaWarehouseList = res.rows.filter(item => {
return item.name.toLowerCase()
.indexOf(query.toLowerCase()) > -1;
});
this.selectLoading = false;
})
},
// 查看出库详情