库存管理开发完成

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) { export function addOaOutWarehouse(data) {
return request({ return request({
url: '/oa/oaOutWarehouse', url: '/oa/oaOutWarehouse/insertOutBatch',
method: 'post', method: 'post',
data: data data: data
}) })

View File

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