Commit ea91fcfc authored by dcy's avatar dcy

仓库调整

parent bd4920ef
<template> <template>
<div> <div>
<el-dialog <el-dialog
...@@ -9,12 +8,12 @@ ...@@ -9,12 +8,12 @@
v-bind="$attrs" v-bind="$attrs"
> >
<el-tabs v-model="activeName" type="card" @tab-click="activeWarehouse = {}"> <el-tabs v-model="activeName" type="card" @tab-click="activeWarehouse = {}">
<el-tab-pane v-if="item.warehouseId === warehouseId" :label="item.name" :name="'' + index" v-for="(item, index) in area" :key="item.id + index"> <el-tab-pane v-if="item.warehouseId === warehouseId" :label="item.name" :name="'' + index" v-for="(item, index) in area" :key="index">
<div> <div>
<div style="text-align: center">区域</div> <div style="text-align: center">区域</div>
<div style="background-color: #efefef;padding: 10px 10px 0;border: #dcdcdc solid 1px;border-radius: 2px"> <div style="background-color: #efefef;padding: 10px 10px 0;border: #dcdcdc solid 1px;border-radius: 2px">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12" v-for="(warehouse, i) in item.children" :key="warehouse.id + i"> <el-col :span="12" v-for="warehouse in item.children" :key="warehouse.id">
<div <div
class="warehouse-block" class="warehouse-block"
:class="{'warehouse-block-selected': warehouse.selected, 'warehouse-block-active': warehouse.id === activeWarehouse.id}" :class="{'warehouse-block-selected': warehouse.selected, 'warehouse-block-active': warehouse.id === activeWarehouse.id}"
...@@ -29,14 +28,25 @@ ...@@ -29,14 +28,25 @@
<div> <div>
<div style="text-align: center">仓位</div> <div style="text-align: center">仓位</div>
<div class="position-group"> <div class="position-group">
<div class="position" v-for="(position ,index) in activeWarehouse.positionList" :key="item.id + index "> <div class="position" v-for="position in activeWarehouse.positionList" :key="position.id" @click="handleSelectPosition(position)">
<template v-if="position.children">
<div <div
class="position-item" class="position-item"
v-for="item in position.children" v-for="item in position.children"
@click="handleSelectPosition(item)" :key="item.id"
@click.stop="handleSelectPositionChild(item)"
:class="{'position-item-active': item.selected}"> :class="{'position-item-active': item.selected}">
{{ item.code }} {{ item.code }}
</div> </div>
</template>
<template v-else>
<div
class="position-item"
:class="{'position-item-active': position.selected}">
{{ position.code }}
</div>
</template>
</div> </div>
</div> </div>
</div> </div>
...@@ -57,7 +67,7 @@ ...@@ -57,7 +67,7 @@
import { getByWarehouseId } from '@/api/ecw/warehouseArea' import { getByWarehouseId } from '@/api/ecw/warehouseArea'
export default { export default {
name: 'warehouseLocation', name: 'WarehouseAreaDialog',
props: { props: {
visible: { visible: {
type: Boolean, type: Boolean,
...@@ -72,7 +82,7 @@ export default { ...@@ -72,7 +82,7 @@ export default {
warehouseId: { warehouseId: {
type: Number, type: Number,
default: undefined default: undefined
}, }
}, },
data() { data() {
...@@ -83,7 +93,8 @@ export default { ...@@ -83,7 +93,8 @@ export default {
activeName: '0', activeName: '0',
selectedWarehouse: [], selectedWarehouse: [],
selectedPosition: [], selectedPosition: [],
activeWarehouse: {} activeWarehouse: {},
activeWarehouseId: undefined
}; };
}, },
...@@ -92,16 +103,17 @@ export default { ...@@ -92,16 +103,17 @@ export default {
if (val) { if (val) {
this.opened = true this.opened = true
getByWarehouseId({cityId: this.cityId,}).then(r => { if (this.area.length === 0) getByWarehouseId({cityId: this.cityId,warehouseId: this.warehouseId }).then(r => {
const area = r.data const area = r.data
area.forEach(e => { area.forEach(e => {
// 仓库 // 仓库
e.children.forEach(f => { e.children?.forEach(f => {
// 区域 // 区域
f.selected = false f.selected = false
if(f.positionList) f.positionList.forEach(g => { if(f.positionList) f.positionList.forEach(g => {
// 位置 // 位置
if(g.children)g.children.forEach(k => { g.selected = false
g.children?.forEach(k => {
// 子位置 // 子位置
k.selected = false k.selected = false
}) })
...@@ -131,18 +143,25 @@ export default { ...@@ -131,18 +143,25 @@ export default {
this.activeWarehouse = warehouse this.activeWarehouse = warehouse
if (!!warehouse.selected) { if (!!warehouse.selected) {
warehouse.selected = false warehouse.selected = false
} else { return
} else if(this.activeWarehouseId !== warehouse.id) {
this.activeWarehouseId = warehouse.id
console.log(this.inputValue.find(e => e.areaId === warehouse.id), warehouse.id)
if (this.inputValue.find(e => e.areaId === warehouse.id)){
return
}
}
warehouse.selected = true warehouse.selected = true
// 区域被选,清空该区域下的位置 // 区域被选,清空该区域下的位置
if(warehouse.positionList) warehouse.positionList.forEach(g => { if(warehouse.positionList) warehouse.positionList?.forEach(g => {
if(g.children)g.children.forEach(k => { g.selected = false
g.children?.forEach(k => {
k.selected = false k.selected = false
}) })
}) })
}
}, },
handleSelectPosition(position) { handleSelectPositionChild(position) {
if (!!position.selected) { if (!!position.selected) {
position.selected = false position.selected = false
...@@ -151,9 +170,9 @@ export default { ...@@ -151,9 +170,9 @@ export default {
if (!parentAre.selected) { if (!parentAre.selected) {
// 检查父区域下是否所有位置被反选 // 检查父区域下是否所有位置被反选
let hasSelected = false let hasSelected = false
parentAre.positionList.forEach(g => { parentAre.positionList?.forEach(g => {
// 位置 // 位置
g.children.forEach(k => { g.children?.forEach(k => {
// 子位置 // 子位置
if (k.selected) hasSelected = true if (k.selected) hasSelected = true
}) })
...@@ -167,6 +186,17 @@ export default { ...@@ -167,6 +186,17 @@ export default {
// 选位置时,父区域反选 // 选位置时,父区域反选
this.area.find(e => e.id === position.domainId).children.find(f => f.id === position.areaId).selected = false this.area.find(e => e.id === position.domainId).children.find(f => f.id === position.areaId).selected = false
}
},
handleSelectPosition(position) {
if (!!position.selected) {
position.selected = false
} else {
position.selected = true
// 选位置时,父区域反选
this.area.find(e => e.id === position.domainId).children.find(f => f.id === position.areaId).selected = false
} }
} }
}, },
...@@ -180,17 +210,17 @@ export default { ...@@ -180,17 +210,17 @@ export default {
selected() { selected() {
const result = [] const result = []
this.area.forEach(e => { this.area?.forEach(e => {
// 仓库 // 仓库
e.children.forEach(f => { e.children?.forEach(f => {
// 区域 // 区域
if (f.selected) result.push(f.code) if (f.selected) result.push(f.code)
else if(f.positionList) f.positionList.forEach(g => { else f.positionList?.forEach(g => {
// 位置 // 位置
if (g.selected) result.push(k.code) if (g.selected) result.push(f.code + g.code)
if(g.children)g.children.forEach(k => { else if(g.children) g.children?.forEach(k => {
// 子位置 // 子位置
if (k.selected) result.push(k.code) if (k.selected) result.push(f.code + k.code)
}) })
}) })
}) })
...@@ -201,16 +231,17 @@ export default { ...@@ -201,16 +231,17 @@ export default {
inputValue(){ inputValue(){
const result = [] const result = []
this.area.forEach(e => { this.area?.forEach(e => {
// 仓库 // 仓库
e.children.forEach(f => { e.children?.forEach(f => {
// 区域 // 区域
if (f.selected) result.push({ if (f.selected) result.push({
orderId: this.orderId, orderId: this.orderId,
wareId: f.pid, wareId: f.pid,
areaId: f.id areaId: f.id
}) })
else if(f.positionList) f.positionList.forEach(g => { else {
f.positionList?.forEach(g => {
// 位置 // 位置
if (g.selected) result.push({ if (g.selected) result.push({
orderId: this.orderId, orderId: this.orderId,
...@@ -218,7 +249,7 @@ export default { ...@@ -218,7 +249,7 @@ export default {
areaId: g.areaId, areaId: g.areaId,
locationId: g.id locationId: g.id
}) })
else if(g.children)g.children.forEach(k => { else g.children?.forEach(k => {
// 子位置 // 子位置
if (k.selected) result.push({ if (k.selected) result.push({
orderId: this.orderId, orderId: this.orderId,
...@@ -228,6 +259,7 @@ export default { ...@@ -228,6 +259,7 @@ export default {
}) })
}) })
}) })
}
}) })
}) })
...@@ -272,9 +304,10 @@ export default { ...@@ -272,9 +304,10 @@ export default {
border: 1px #EFEFEF solid; border: 1px #EFEFEF solid;
gap: 1px; gap: 1px;
min-height: 64px; min-height: 64px;
flex-flow: wrap;
} }
.position{ .position{
width: 20%; width: calc(20% - 1px);
height: 64px; height: 64px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<el-descriptions style="margin-top: 20px" :column="4" border> <el-descriptions style="margin-top: 20px" :column="4" border>
<el-descriptions-item :label="$t('集运仓库')">{{ warehouseDetails && warehouseDetails.warehouseOutName ? warehouseDetails.warehouseOutName : '' }}</el-descriptions-item> <el-descriptions-item :label="$t('集运仓库')">{{ warehouseDetails && warehouseDetails.warehouseOutName ? warehouseDetails.warehouseOutName : '' }}</el-descriptions-item>
<el-descriptions-item :label="$t('储位')"> <el-descriptions-item :label="$t('储位')">
<div v-for="item in storageSpaceList" style="display: flex;"><div>{{item.warehouseName ? item.warehouseName : ''}}</div><div>{{item.warehouseName ? item.regionName :''}} {{$t('区')}}</div> <div>{{item.code}}</div></div> <div v-for="item in storageSpaceList" style="display: flex;"><div>{{item.warehouseName ? item.warehouseName : ''}}{{$t('仓')}}</div><div>{{item.warehouseName ? item.regionName :''}} {{$t('区')}}</div> <div>{{item.code}}</div></div>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item v-if="type == 2" :label="$t('选择储位')"> <el-descriptions-item v-if="type == 2" :label="$t('选择储位')">
<div @click="areaVisible = true" style="color: #0a84ff;cursor: pointer;">{{$t('选择储位')}}</div> <div @click="areaVisible = true" style="color: #0a84ff;cursor: pointer;">{{$t('选择储位')}}</div>
...@@ -383,18 +383,17 @@ export default { ...@@ -383,18 +383,17 @@ export default {
}, },
watch:{ watch:{
'params.orderLocationCreateReqVOList'(val){ 'params.orderLocationCreateReqVOList'(val){
console.log(val,'123') console.log(val,'val');
getByWarehouseId().then(r =>{ getByWarehouseId().then(r =>{
console.log(r,'仓库')
let obj = []; let obj = [];
val.forEach(item => { val.forEach(item => {
r.data.forEach(itemm => { r.data.forEach(itemm => {
if(item.wareId === itemm.id){ if(item.wareId === itemm.id){
itemm.children.forEach(itemmm => { itemm.children.forEach(itemmm => {
if(itemmm.id === item.areaId){ if(itemmm.id === item.areaId){
if(itemmm.positionList.length > 0){ if(itemmm.positionList && itemmm.positionList.length > 0){
itemmm.positionList.forEach(ic =>{ itemmm.positionList.forEach(ic =>{
if(ic.children.length > 0){ if(ic.children && ic.children.length > 0){
ic.children.forEach(icc => { ic.children.forEach(icc => {
if(icc.id === item.locationId){ if(icc.id === item.locationId){
obj.push({ obj.push({
...@@ -412,7 +411,6 @@ export default { ...@@ -412,7 +411,6 @@ export default {
} }
}) })
}) })
console.log(obj,'obj')
this.storageSpaceList = obj; this.storageSpaceList = obj;
}) })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment