优化页面使用

This commit is contained in:
liuhanqing
2026-01-18 10:09:52 +08:00
parent 39654c4d3b
commit 93c3019eb1
38 changed files with 1038 additions and 604 deletions

View File

@@ -57,58 +57,6 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="常用编码" prop="parentId">
<el-input
v-model="queryParams.parentId"
placeholder="请输入常用编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="供应代号" prop="supplierId">
<el-input
v-model="queryParams.supplierId"
placeholder="请输入供应商代号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="供应名称" prop="supplierName">
<el-input
v-model="queryParams.supplierName"
placeholder="请输入供应商名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<!-- <el-form-item label="物料编码" prop="productId">
<el-input
v-model="queryParams.productId"
placeholder="请输入物料编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<!-- <el-form-item label="入库单号" prop="stockinId">
<el-input
v-model="queryParams.stockinId"
placeholder="请输入入库单号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="单价" prop="price">
<el-input
v-model="queryParams.price"
placeholder="请输入单价"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item label="合同号" prop="orderId">
<el-input
v-model="queryParams.orderId"
@@ -156,7 +104,61 @@
</el-form-item>
</el-form>
<el-table
v-loading="loading"
:data="managementList"
@row-click="handleMasterRowClick"
highlight-current-row
max-height="650"
>
<el-table-column label="仓库名称" align="center" prop="warehouseName"/>
<!-- <el-table-column label="库存编码" align="center" prop="stockId" width="160"/>-->
<el-table-column label="库位" align="center" prop="cargoSpaceId" />
<el-table-column label="托盘" align="center" prop="trayCode"/>
<el-table-column label="巷道" align="center" prop="roadwayId"/>
<el-table-column label="排" align="center" prop="thePlatoon"/>
<el-table-column label="列" align="center" prop="theColumn"/>
<el-table-column label="层" align="center" prop="theFloor"/>
<el-table-column label="重量" align="center" prop="theType"/>
<el-table-column label="部门" align="center" prop="model">
<template slot-scope="scope">
<dict-tag :options="getDeptDictOptions(scope.row)" :value="scope.row.model"/>
</template>
</el-table-column>
<el-table-column width=120 label="操作" align="center" class-name="small-padding fixed-width"> <!-- 操作 -->
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdateDept(scope.row)"
v-hasPermi="['stock:management:edit']"
>转运部门</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:stock:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
@@ -179,30 +181,12 @@
v-hasPermi="['stock:management:remove']"
>删除 <!-- 删除 --></el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['stock:management:export']"
>导出 <!-- 导出 --></el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="managementList" @selection-change="handleSelectionChange" max-height="650">
<el-table v-loading="detailLoading" :data="detailList" @selection-change="handleSelectionChange" max-height="650">
<el-table-column type="selection" align="center" />
<el-table-column label="仓库名称" align="center" prop="warehouseName"/>
<el-table-column label="库存编码" align="center" prop="stockId" width="160"/>
<!-- <el-table-column label="套账" align="center" prop="spare3">
<template slot-scope="scope">
<dict-tag :options="dict.type.account_type" :value="scope.row.spare3"/>
</template>
</el-table-column>-->
<!-- <el-table-column label="仓库编码" align="center" prop="warehouseId"/>-->
<el-table-column label="库位" align="center" prop="cargoSpaceId" width="160"/>
<el-table-column label="托盘" align="center" prop="trayCode" width="160"/>
<el-table-column label="合同号" align="center" prop="orderId"/>
@@ -218,25 +202,6 @@
</template>
</el-table-column>
<el-table-column label="数量" align="center" prop="quantity"/>
<!-- <el-table-column label="单价" align="center" prop="price"/>-->
<!-- <el-table-column label="金额" align="center" prop="spare6"/>-->
<!-- <el-table-column label="产品状态" align="center" prop="productType">
<template slot-scope="scope">
<dict-tag :options="dict.type.product_type" :value="scope.row.productType"/>
</template>
</el-table-column>-->
<!-- <el-table-column label="单位" align="center" prop="unit"/>-->
<!-- <el-table-column label="图号" align="center" prop="cargoNo"/>-->
<!-- <el-table-column label="质量" align="center" prop="spare8">-->
<!-- <template slot-scope="scope">-->
<!-- <dict-tag :options="dict.type.quality_type" :value="scope.row.spare8"/>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column label="常用编码" align="center" prop="parentId"/>-->
<!-- -->
<!-- <el-table-column label="供应商编码" align="center" prop="supplierId" width="160"/>-->
<!-- <el-table-column label="供应商名称" align="center" prop="supplierName" width="160"/>-->
<el-table-column label="重量" align="center" prop="netWeight" width="160"/>
<el-table-column label="入库单号" align="center" prop="stockinId" width="160"/>
<el-table-column label="首次入库时间" align="center" prop="inDate" width="160"/>
@@ -248,16 +213,6 @@
</el-table-column>
<el-table-column label="盘点时间" align="center" prop="backDate" width="160"/>
<el-table-column label="备注" align="center" prop="remark"/>
<!-- <el-table-column label="来源" align="center" prop="spare4">
<template slot-scope="scope">
<dict-tag :options="dict.type.origin_type" :value="scope.row.spare4"/>
</template>
</el-table-column>
<el-table-column label="用途" align="center" prop="spare1">
<template slot-scope="scope">
<dict-tag :options="dict.type.purpose_type" :value="scope.row.spare1"/>
</template>
</el-table-column>-->
<el-table-column width=120 label="操作" align="center" class-name="small-padding fixed-width"> <!-- 操作 -->
<template slot-scope="scope">
<el-button
@@ -279,22 +234,33 @@
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
v-show="detailTotal>0"
:total="detailTotal"
:page.sync="detailQueryParams.pageNum"
:limit.sync="detailQueryParams.pageSize"
@pagination="getDetailList"
/>
<!-- 添加或修改库存信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<!-- <el-form-item label="库存ID" prop="stockId"> &lt;!&ndash; 库存id &ndash;&gt;-->
<!-- <el-input v-model="form.stockId" placeholder="请输入库存ID" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="货位ID" prop="cargoSpaceId"> &lt;!&ndash; 货位id &ndash;&gt;-->
<!-- <el-input v-model="form.cargoSpaceId" placeholder="请输入货位ID" />-->
<!-- </el-form-item>-->
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
<div v-if="currentMasterRow" class="master-info">
<div class="master-info-title">主表信息</div>
<el-row :gutter="10">
<el-col :span="12">
<span class="master-info-label">仓库:</span>
<span>{{ currentMasterRow.warehouseName }}</span>
</el-col>
<el-col :span="12">
<span class="master-info-label">库位:</span>
<span>{{ currentMasterRow.cargoSpaceId }}</span>
</el-col>
<el-col :span="12" style="margin-top: 4px">
<span class="master-info-label">托盘:</span>
<span>{{ currentMasterRow.trayCode }}</span>
</el-col>
</el-row>
</div>
<el-form ref="form" :model="form" :rules="rules" label-width="90px">
<el-form-item label="物料" prop="productId"> <!-- 物料 -->
<el-input
@@ -346,6 +312,32 @@
</div>
</el-dialog>
<el-dialog :title="titleDept" :visible.sync="openDept" width="500px" append-to-body>
<el-form ref="form" :model="deptForm" label-width="80px">
<el-form-item label="托盘条码" prop="trayCode">
<el-input v-model="deptForm.trayCode" placeholder="请输入托盘条码" />
</el-form-item>
<el-form-item label="部门" prop="model">
<el-select v-model="deptForm.model" placeholder="请选择部门">
<el-option
v-for="dict in getDeptDictOptions(deptForm)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFormDept">确定 <!-- 确定 --></el-button>
<el-button @click="cancelDept">取消 <!-- 取消 --></el-button>
</div>
</el-dialog>
<!-- 物料选择对话框 -->
<el-dialog title="选择物料" :visible.sync="productSelectVisible" width="800px" append-to-body>
<el-form :model="productQueryParams" ref="productQueryForm" size="small" :inline="true" label-width="68px">
@@ -469,14 +461,21 @@
</template>
<script>
import {addManagement, delManagement, getManagement, stockManagementList, updateManagement} from "@/api/stock/management"
import {
addManagement,
delManagement,
getManagement,
stockManagementList,
stockSummaryManagementList,
updateManagement, updateStockDept
} from "@/api/stock/management"
import {listWarehouse} from "@/api/bas/warehouse"
import {listBasProduct} from "@/api/bas/BasProduct"
import {listCargoSpace} from "@/api/bas/cargoSpace"
export default {
name: "Management",
dicts: ['product_status','check_flag', 'stock_status','cargo_space_status','cargo_space_lock_status','product_type','origin_type','account_type','turnover_type','purpose_type','quality_type'],
dicts: ['product_status','check_flag', 'stock_status','cargo_space_status','cargo_space_lock_status','product_type','origin_type','account_type','turnover_type','purpose_type','quality_type','sl_dept','el_dept'],
data() {
return {
// 遮罩层
@@ -491,14 +490,21 @@ export default {
showSearch: true,
// 总条数
total: 0,
// 子表总条数
detailTotal: 0,
// 库存信息表格数据
managementList: [],
// 库存信息子表数据
detailList: [],
currentMasterRow: null,
// 仓库选项
warehouseOptions: [],
// 弹出层标题
title: "",
titleDept: "",
// 是否显示弹出层
open: false,
openDept:false,
// 查询参数
queryParams: {
pageNum: 1,
@@ -531,12 +537,21 @@ export default {
theFloor: null,
cargoSpaceStockStatus:2
},
// 子表查询参数
detailQueryParams: {
pageNum: 1,
pageSize: 10,
trayCode: null,
warehouseId: null
},
queryWarehouse: {
pageNum:1,
pageSize: 99
},
// 表单参数
form: {},
//部门转运表单
deptForm:{},
// 表单校验
rules: {
/*stockId: [
@@ -567,7 +582,9 @@ export default {
cargoSpaceName: null,
warehouseId: null
},
selectedCargoSpace: null
selectedCargoSpace: null,
// 子表加载状态
detailLoading: false
}
},
created() {
@@ -575,6 +592,16 @@ export default {
this.getWarehouseList();
},
methods: {
getDeptDictOptions(row) {
const wid = String(row && row.warehouseId != null ? row.warehouseId : "").padStart(2, "0")
if (wid === "01") {
return this.dict.type.sl_dept || []
}
if (wid === "02") {
return this.dict.type.el_dept || []
}
return this.dict.type.sl_dept || []
},
/** 获取仓库列表 */
getWarehouseList() {
listWarehouse(this.queryWarehouse).then(response => {
@@ -584,10 +611,16 @@ export default {
/** 查询库存信息列表 */
getList() {
this.loading = true
stockManagementList(this.queryParams).then(response => {
stockSummaryManagementList(this.queryParams).then(response => {
this.managementList = response.rows
this.total = response.total
this.loading = false
if (this.managementList && this.managementList.length > 0) {
this.handleMasterRowClick(this.managementList[0])
} else {
this.detailList = []
this.detailTotal = 0
}
})
},
// 取消按钮
@@ -595,6 +628,10 @@ export default {
this.open = false
this.reset()
},
cancelDept() {
this.openDept = false
this.reset()
},
// 表单重置
reset() {
this.form = {
@@ -626,6 +663,11 @@ export default {
spare5: null,
spare6: null
}
this.deptForm = {
trayCode: null,
warehouseId: null,
model:null
}
this.resetForm("form")
},
/** 搜索按钮操作 */
@@ -646,9 +688,45 @@ export default {
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 主表行点击,联动查询子表 */
handleMasterRowClick(row) {
if (!row) {
this.detailList = []
this.detailTotal = 0
return
}
this.currentMasterRow = row
this.detailQueryParams.trayCode = row.trayCode
this.detailQueryParams.warehouseId = row.warehouseId
this.detailQueryParams.pageNum = 1
this.getDetailList()
},
/** 查询子表库存明细列表 */
getDetailList() {
if (!this.detailQueryParams.trayCode || !this.detailQueryParams.warehouseId) {
this.detailList = []
this.detailTotal = 0
return
}
this.detailLoading = true
stockManagementList(this.detailQueryParams).then(response => {
this.detailList = response.rows
this.detailTotal = response.total
this.detailLoading = false
}).catch(() => {
this.detailLoading = false
})
},
/** 新增按钮操作 */
handleAdd() {
if (!this.currentMasterRow) {
this.$modal.msgError("请先在上方选择主表数据")
return
}
this.reset()
this.form.trayCode = this.currentMasterRow.trayCode
this.form.warehouseId = this.currentMasterRow.warehouseId
this.form.cargoSpaceId = this.currentMasterRow.cargoSpaceId
this.open = true
this.title = "添加库存信息" // 添加库存信息
},
@@ -662,6 +740,19 @@ export default {
this.title = "修改库存信息" // 修改库存信息
})
},
handleUpdateDept(row) {
this.reset()
const trayCode = row.trayCode
this.deptForm = {
trayCode: row.trayCode,
warehouseId: row.warehouseId,
model:row.model
}
console.log(this.deptForm)
this.openDept = true
this.titleDept = "托盘转运部门"
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
@@ -682,6 +773,24 @@ export default {
}
})
},
submitFormDept() {
if (!this.deptForm.trayCode){
this.$modal.msgError("请输入托盘")
return
}
if (!this.deptForm.warehouseId){
this.$modal.msgError("请输入仓库")
return
}
if (!this.deptForm.model){
this.$modal.msgError("请输入部门")
}
updateStockDept(this.deptForm).then(response => {
this.$modal.msgSuccess("修改成功") // 修改成功
this.openDept = false
this.getList()
})
},
/** 删除按钮操作 */
handleDelete(row) {
const stockIds = row.stockId || this.ids
@@ -790,4 +899,19 @@ export default {
.no-wrap {
white-space: nowrap;
}
.master-info {
margin-bottom: 10px;
padding: 10px 12px;
background-color: #f5f7fa;
border-radius: 4px;
font-size: 12px;
}
.master-info-title {
margin-bottom: 6px;
color: #606266;
font-weight: 500;
}
.master-info-label {
color: #909399;
}
</style>