refactor(仓库管理): 优化复合架功能并移除无用代码
- 将CoilSelector默认标签页改为'my' - 为WarehouseBird和WarehouseInterlaced组件添加id属性传递 - 实现复合架功能的条件渲染和权限控制 - 移除废弃的category相关代码和视图 - 在coil/merge.vue中使用WarehouseSelect组件替代原下拉框
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询通用分类列表
|
||||
export function listCategory(query) {
|
||||
return request({
|
||||
url: '/wms/category/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询通用分类详细
|
||||
export function getCategory(categoryId) {
|
||||
return request({
|
||||
url: '/wms/category/' + categoryId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增通用分类
|
||||
export function addCategory(data) {
|
||||
return request({
|
||||
url: '/wms/category',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改通用分类
|
||||
export function updateCategory(data) {
|
||||
return request({
|
||||
url: '/wms/category',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除通用分类
|
||||
export function delCategory(categoryId) {
|
||||
return request({
|
||||
url: '/wms/category/' + categoryId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
@@ -165,7 +165,7 @@ export default {
|
||||
dataType: 1 // 只查询当前数据,不查询历史数据
|
||||
},
|
||||
columns: defaultColumns,
|
||||
currentTab: 'all',
|
||||
currentTab: 'my',
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// import { listCategory } from '@/api/wms/category';
|
||||
// import { listBomItem } from '@/api/wms/bomItem';
|
||||
// import { listProduct } from '@/api/wms/product';
|
||||
// import { listRawMaterial } from '@/api/wms/rawMaterial';
|
||||
@@ -15,7 +14,6 @@ const listProduct = (params) => veilReq({
|
||||
});
|
||||
|
||||
const state = {
|
||||
categoryList: [],
|
||||
productMap: {},
|
||||
rawMaterialMap: {},
|
||||
productList: [],
|
||||
|
||||
@@ -1,279 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="分类类型" prop="categoryType">
|
||||
<el-select v-model="queryParams.categoryType" placeholder="请选择分类类型" clearable>
|
||||
<el-option v-for="dict in dict.type.category_type" :key="dict.value" :label="dict.label"
|
||||
:value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="分类名称" prop="categoryName">
|
||||
<el-input v-model="queryParams.categoryName" placeholder="请输入分类名称" clearable
|
||||
@keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否启用" prop="isEnabled">
|
||||
<el-select v-model="queryParams.isEnabled" placeholder="请选择是否启用" clearable>
|
||||
<el-option v-for="dict in dict.type.common_swicth" :key="dict.value" :label="dict.label"
|
||||
:value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<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-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single"
|
||||
@click="handleUpdate">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple"
|
||||
@click="handleDelete">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<KLPTable v-loading="loading" :data="categoryList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="分类类型" align="center" prop="categoryType">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.category_type" :value="scope.row.categoryType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="分类编码" align="center" prop="categoryCode" />
|
||||
<el-table-column label="分类名称" align="center" prop="categoryName" />
|
||||
<el-table-column label="分类描述" align="center" prop="categoryDesc" />
|
||||
<el-table-column label="备注" align="center" prop="remark" />
|
||||
<el-table-column label="是否启用" align="center" prop="isEnabled">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.common_swicth" :value="scope.row.isEnabled" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</KLPTable>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
|
||||
<!-- 添加或修改通用分类对话框 -->
|
||||
<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="分类类型" prop="categoryType">
|
||||
<el-select v-model="form.categoryType" placeholder="请选择分类类型">
|
||||
<el-option v-for="dict in dict.type.category_type" :key="dict.value" :label="dict.label"
|
||||
:value="dict.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="分类编码" prop="categoryCode">
|
||||
<el-input v-model="form.categoryCode" placeholder="请输入分类编码" />
|
||||
</el-form-item>
|
||||
<el-form-item label="分类名称" prop="categoryName">
|
||||
<el-input v-model="form.categoryName" placeholder="请输入分类名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="分类描述" prop="categoryDesc">
|
||||
<el-input v-model="form.categoryDesc" placeholder="请输入分类描述" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
<el-form-item label="是否启用" prop="isEnabled">
|
||||
<el-select v-model="form.isEnabled" placeholder="请选择是否启用">
|
||||
<el-option v-for="dict in dict.type.common_swicth" :key="dict.value" :label="dict.label"
|
||||
:value="parseInt(dict.value)"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listCategory, getCategory, delCategory, addCategory, updateCategory } from "@/api/wms/category";
|
||||
|
||||
export default {
|
||||
name: "Category",
|
||||
dicts: ['common_swicth', 'category_type'],
|
||||
data() {
|
||||
return {
|
||||
// 按钮loading
|
||||
buttonLoading: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 通用分类表格数据
|
||||
categoryList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
categoryType: undefined,
|
||||
categoryCode: undefined,
|
||||
categoryName: undefined,
|
||||
categoryDesc: undefined,
|
||||
isEnabled: undefined,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
categoryType: [
|
||||
{ required: true, message: "分类类型不能为空", trigger: "change" }
|
||||
],
|
||||
categoryCode: [
|
||||
{ required: true, message: "分类编码不能为空", trigger: "blur" }
|
||||
],
|
||||
categoryName: [
|
||||
{ required: true, message: "分类名称不能为空", trigger: "blur" }
|
||||
],
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询通用分类列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listCategory(this.queryParams).then(response => {
|
||||
this.categoryList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
categoryId: undefined,
|
||||
categoryType: undefined,
|
||||
categoryCode: undefined,
|
||||
categoryName: undefined,
|
||||
categoryDesc: undefined,
|
||||
remark: undefined,
|
||||
isEnabled: undefined,
|
||||
delFlag: undefined,
|
||||
createTime: undefined,
|
||||
createBy: undefined,
|
||||
updateTime: undefined,
|
||||
updateBy: undefined
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.categoryId)
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加通用分类";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.loading = true;
|
||||
this.reset();
|
||||
const categoryId = row.categoryId || this.ids
|
||||
getCategory(categoryId).then(response => {
|
||||
this.loading = false;
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改通用分类";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
this.buttonLoading = true;
|
||||
if (this.form.categoryId != null) {
|
||||
updateCategory(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
} else {
|
||||
addCategory(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
}).finally(() => {
|
||||
this.buttonLoading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const categoryIds = row.categoryId || this.ids;
|
||||
this.$modal.confirm('是否确认删除通用分类编号为"' + categoryIds + '"的数据项?').then(() => {
|
||||
this.loading = true;
|
||||
return delCategory(categoryIds);
|
||||
}).then(() => {
|
||||
this.loading = false;
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
}).finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('wms/category/export', {
|
||||
...this.queryParams
|
||||
}, `category_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -183,11 +183,11 @@
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="逻辑库区">
|
||||
<el-select v-model="targetCoil.warehouseId" placeholder="请选择逻辑库区" style="width: 100%" filterable
|
||||
:disabled="readonly">
|
||||
<el-option v-for="warehouse in warehouseList" :key="warehouse.warehouseId"
|
||||
:label="warehouse.warehouseName" :value="warehouse.warehouseId" />
|
||||
</el-select>
|
||||
<WarehouseSelect
|
||||
v-model="targetCoil.warehouseId"
|
||||
placeholder="请选择逻辑库区"
|
||||
:disabled="readonly"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="真实库区">
|
||||
<actual-warehouse-select v-model="targetCoil.actualWarehouseId" placeholder="请选择" style="width: 100%"
|
||||
@@ -227,6 +227,7 @@ import CoilSelector from '@/components/CoilSelector';
|
||||
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
|
||||
import RawMaterialSelector from "@/components/KLPService/RawMaterialSelect";
|
||||
import ProductSelector from "@/components/KLPService/ProductSelect";
|
||||
import WarehouseSelect from "@/components/KLPService/WarehouseSelect";
|
||||
|
||||
|
||||
export default {
|
||||
@@ -235,7 +236,8 @@ export default {
|
||||
CoilSelector,
|
||||
ActualWarehouseSelect,
|
||||
RawMaterialSelector,
|
||||
ProductSelector
|
||||
ProductSelector,
|
||||
WarehouseSelect
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
@@ -48,7 +48,11 @@
|
||||
<div class="empty-text">该分类下暂无库位数据</div>
|
||||
<el-button type="primary" icon="el-icon-plus" @click="openInitDialog">初始化库位</el-button>
|
||||
</div>
|
||||
<warehouse-interlaced v-else="warehouseList.length" :columns="columns" @split-warehouse="handleSplitWarehouse" @merge-warehouse="handleMergeWarehouse" />
|
||||
<warehouse-interlaced
|
||||
v-else="warehouseList.length"
|
||||
:id="id" :columns="columns"
|
||||
@split-warehouse="handleSplitWarehouse"
|
||||
@merge-warehouse="handleMergeWarehouse" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -64,6 +68,10 @@ export default {
|
||||
warehouseList: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
id: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<template>
|
||||
<div class="multi-layer-grid" ref="gridContainer">
|
||||
<el-alert v-if="!isComposite" type="warning" title="当前库区不支持复合架" show-icon></el-alert>
|
||||
<!-- 列标尺区域 - 添加切换按钮 -->
|
||||
<div class="col-ruler" :style="{ '--cell-width': `${cellWidth}px` }">
|
||||
<div class="ruler-empty"></div>
|
||||
@@ -8,6 +9,7 @@
|
||||
<span class="column-number">{{ col }}</span>
|
||||
<!-- 拆分/合并切换按钮 -->
|
||||
<button class="split-merge-toggle"
|
||||
v-if="isComposite"
|
||||
:class="{ 'is-split': getColumnLevel(col) === 4, 'is-merge': getColumnLevel(col) === 3 }"
|
||||
@click.stop="handleColumnToggle(col)" :title="getColumnLevel(col) === 3 ? '点击切换为小卷状态' : '点击切换为大卷状态'">
|
||||
<i class="el-icon-s-tools"></i>
|
||||
@@ -107,10 +109,23 @@ export default {
|
||||
type: Object,
|
||||
required: true,
|
||||
default: () => ({})
|
||||
},
|
||||
id: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// id转换位复合架规则,如果不包含在内则不可使用复合架
|
||||
compositeRules: {
|
||||
// 测试库区
|
||||
'2002207449418686465': {
|
||||
big: 19 * 5,
|
||||
small: 29 * 5,
|
||||
rows: [1, 2, 3, 4, 5]
|
||||
},
|
||||
},
|
||||
dialogOpen: false,
|
||||
currentWarehouse: null,
|
||||
containerWidth: 0,
|
||||
@@ -122,6 +137,11 @@ export default {
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 当前的库区是否支持复合架
|
||||
isComposite() {
|
||||
// 如果存在id则支持,不存在
|
||||
return this.compositeRules[this.id];
|
||||
},
|
||||
sortedColumnKeys() {
|
||||
return Object.keys(this.columns)
|
||||
.map(key => Number(key))
|
||||
@@ -212,6 +232,11 @@ export default {
|
||||
},
|
||||
// 处理列拆分/合并状态切换
|
||||
handleColumnToggle(column) {
|
||||
// 检查当前ID是否被包含在复合架规则中
|
||||
if (!this.compositeRules[this.id]) {
|
||||
this.$message.error('当前库位不支持复合架操作');
|
||||
return;
|
||||
}
|
||||
const currentLevel = this.getColumnLevel(column);
|
||||
// 切换level:3↔4
|
||||
const newLevel = currentLevel === 3 ? 4 : 3;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<!-- 导出所有二维码 -->
|
||||
<!-- <button buttonLoading type="primary" @click="exportAllQrcodes">导出二维码</button> -->
|
||||
<WarehouseBird
|
||||
:id="selectedNodeId"
|
||||
:warehouse-list="warehouseList"
|
||||
@open-init-dialog="openInitDialog"
|
||||
@split-warehouse="handleSplitWarehouse"
|
||||
|
||||
Reference in New Issue
Block a user