库存管理开发完成

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

@@ -1,16 +1,16 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<!-- <el-form-item label="项目名" prop="projectId">--> <!-- <el-form-item label="项目名" prop="projectId">-->
<!-- <el-input--> <!-- <el-input-->
<!-- v-model="queryParams.projectId"--> <!-- v-model="queryParams.projectId"-->
<!-- placeholder="请输入项目名"--> <!-- placeholder="请输入项目名"-->
<!-- clearable--> <!-- clearable-->
<!-- @keyup.enter.native="handleQuery"--> <!-- @keyup.enter.native="handleQuery"-->
<!-- />--> <!-- />-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<el-form-item> <el-form-item>
<!-- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>--> <!-- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>-->
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
@@ -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,16 +47,17 @@
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>
<el-table v-loading="loading" :data="projectList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="projectList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center"/>
<el-table-column label="序号" align="center" type="index" /> <el-table-column label="序号" align="center" type="index"/>
<el-table-column label="项目名" align="center" prop="projectName" /> <el-table-column label="项目名" align="center" prop="projectName"/>
<el-table-column label="创建时间" align="center" prop="createtime" /> <el-table-column label="创建时间" align="center" prop="createtime"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
@@ -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,32 +101,45 @@
<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>
</el-col> </el-col>
<el-col :span="4"> <el-col :span="4">
<el-button @click.prevent="removeDomain(item)">删除</el-button> <el-button @click.prevent="removeDomain(item)">删除</el-button>
</el-col> </el-col>
</el-row> </el-row>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
@@ -141,38 +158,39 @@
title="我是标题" title="我是标题"
:visible.sync="drawer" :visible.sync="drawer"
:with-header="false"> :with-header="false">
<!-- <el-form :model="query" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">--> <!-- <el-form :model="query" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">-->
<!-- <el-form-item label="项目名" prop="projectId">--> <!-- <el-form-item label="项目名" prop="projectId">-->
<!-- <el-input--> <!-- <el-input-->
<!-- v-model="query.name"--> <!-- v-model="query.name"-->
<!-- placeholder="请输入物料名"--> <!-- placeholder="请输入物料名"-->
<!-- clearable--> <!-- clearable-->
<!-- @keyup.enter.native="handleQuery"--> <!-- @keyup.enter.native="handleQuery"-->
<!-- />--> <!-- />-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<!-- <el-form-item>--> <!-- <el-form-item>-->
<!-- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>--> <!-- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>-->
<!-- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>--> <!-- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<!-- </el-form>--> <!-- </el-form>-->
<el-button <el-button
style="margin: 25px" style="margin: 25px"
type="primary" type="primary"
plain plain
icon="el-icon-plus" icon="el-icon-plus"
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"/>
<el-table-column label="序号" align="center" type="index" /> <el-table-column label="序号" align="center" type="index"/>
<el-table-column label="物料名" align="center" prop="warehouseName" /> <el-table-column label="物料名" align="center" prop="warehouseName"/>
<el-table-column label="出库数量" align="center" prop="amount" /> <el-table-column label="出库数量" align="center" prop="amount"/>
<el-table-column label="出库时间" align="center" prop="createTime" /> <el-table-column label="出库时间" align="center" prop="createTime"/>
<el-table-column label="备注" align="center" prop="remark" /> <el-table-column label="备注" align="center" prop="remark"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
@@ -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,15 +211,24 @@
</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",
data() { data() {
return { return {
// 抽屉 // 抽屉
drawer:false, drawer: false,
// 按钮loading // 按钮loading
buttonLoading: false, buttonLoading: false,
@@ -219,13 +247,20 @@ 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,
@@ -237,10 +272,10 @@ export default {
// 表单校验 // 表单校验
rules: { rules: {
amount: [ amount: [
{ required: true, message: "出库数量不能为空", trigger: "blur" } {required: true, message: "出库数量不能为空", trigger: "blur"}
], ],
warehouseId: [ warehouseId: [
{ required: true, message: "出库对象id不能为空", trigger: "blur" } {required: true, message: "出库对象id不能为空", trigger: "blur"}
], ],
} }
}; };
@@ -257,6 +292,7 @@ export default {
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
}); });
}, },
// 取消按钮 // 取消按钮
cancel() { cancel() {
@@ -276,7 +312,8 @@ export default {
updateTime: undefined, updateTime: undefined,
updateBy: undefined, updateBy: undefined,
delFlag: undefined, delFlag: undefined,
outWareHouseList:[] selectLoading: false,
outWareHouseList: []
}; };
this.resetForm("form"); this.resetForm("form");
}, },
@@ -293,7 +330,7 @@ export default {
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id) this.ids = selection.map(item => item.id)
this.single = selection.length!==1 this.single = selection.length !== 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
@@ -373,25 +410,42 @@ 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;
})
}, },
// 查看出库详情 // 查看出库详情
handleSearch(item){ handleSearch(item) {
this.loading = true this.loading = true
this.searchItem = item; this.searchItem = item;
this.form.projectId = item.projectId this.form.projectId = item.projectId