Commit 9c7479ae authored by 我在何方's avatar 我在何方
parents 58aebad1 501be120
<template>
<div>
<el-dialog
......@@ -9,12 +8,12 @@
v-bind="$attrs"
>
<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 style="text-align: center">区域</div>
<div style="background-color: #efefef;padding: 10px 10px 0;border: #dcdcdc solid 1px;border-radius: 2px">
<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
class="warehouse-block"
:class="{'warehouse-block-selected': warehouse.selected, 'warehouse-block-active': warehouse.id === activeWarehouse.id}"
......@@ -29,14 +28,25 @@
<div>
<div style="text-align: center">仓位</div>
<div class="position-group">
<div class="position" v-for="(position ,index) in activeWarehouse.positionList" :key="item.id + index ">
<div
class="position-item"
v-for="item in position.children"
@click="handleSelectPosition(item)"
:class="{'position-item-active': item.selected}">
{{ item.code }}
</div>
<div class="position" v-for="position in activeWarehouse.positionList" :key="position.id" @click="handleSelectPosition(position)">
<template v-if="position.children">
<div
class="position-item"
v-for="item in position.children"
:key="item.id"
@click.stop="handleSelectPositionChild(item)"
:class="{'position-item-active': item.selected}">
{{ item.code }}
</div>
</template>
<template v-else>
<div
class="position-item"
:class="{'position-item-active': position.selected}">
{{ position.code }}
</div>
</template>
</div>
</div>
</div>
......@@ -57,7 +67,7 @@
import { getByWarehouseId } from '@/api/ecw/warehouseArea'
export default {
name: 'warehouseLocation',
name: 'WarehouseAreaDialog',
props: {
visible: {
type: Boolean,
......@@ -72,7 +82,7 @@ export default {
warehouseId: {
type: Number,
default: undefined
},
}
},
data() {
......@@ -83,7 +93,8 @@ export default {
activeName: '0',
selectedWarehouse: [],
selectedPosition: [],
activeWarehouse: {}
activeWarehouse: {},
activeWarehouseId: undefined
};
},
......@@ -92,16 +103,17 @@ export default {
if (val) {
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
area.forEach(e => {
// 仓库
e.children.forEach(f => {
e.children?.forEach(f => {
// 区域
f.selected = false
if(f.positionList) f.positionList.forEach(g => {
// 位置
if(g.children)g.children.forEach(k => {
g.selected = false
g.children?.forEach(k => {
// 子位置
k.selected = false
})
......@@ -131,18 +143,25 @@ export default {
this.activeWarehouse = warehouse
if (!!warehouse.selected) {
warehouse.selected = false
} else {
warehouse.selected = true
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
// 区域被选,清空该区域下的位置
if(warehouse.positionList) warehouse.positionList.forEach(g => {
if(g.children)g.children.forEach(k => {
k.selected = false
})
// 区域被选,清空该区域下的位置
if(warehouse.positionList) warehouse.positionList?.forEach(g => {
g.selected = false
g.children?.forEach(k => {
k.selected = false
})
}
})
},
handleSelectPosition(position) {
handleSelectPositionChild(position) {
if (!!position.selected) {
position.selected = false
......@@ -151,9 +170,9 @@ export default {
if (!parentAre.selected) {
// 检查父区域下是否所有位置被反选
let hasSelected = false
parentAre.positionList.forEach(g => {
parentAre.positionList?.forEach(g => {
// 位置
g.children.forEach(k => {
g.children?.forEach(k => {
// 子位置
if (k.selected) hasSelected = true
})
......@@ -167,6 +186,17 @@ export default {
// 选位置时,父区域反选
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 {
selected() {
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)
else if(f.positionList) f.positionList.forEach(g => {
else f.positionList?.forEach(g => {
// 位置
if (g.selected) result.push(k.code)
if(g.children)g.children.forEach(k => {
if (g.selected) result.push(f.code + g.code)
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,33 +231,35 @@ export default {
inputValue(){
const result = []
this.area.forEach(e => {
this.area?.forEach(e => {
// 仓库
e.children.forEach(f => {
e.children?.forEach(f => {
// 区域
if (f.selected) result.push({
orderId: this.orderId,
wareId: f.pid,
areaId: f.id
})
else if(f.positionList) f.positionList.forEach(g => {
// 位置
if (g.selected) result.push({
orderId: this.orderId,
wareId: g.domainId,
areaId: g.areaId,
locationId: g.id
})
else if(g.children)g.children.forEach(k => {
// 子位置
if (k.selected) result.push({
else {
f.positionList?.forEach(g => {
// 位置
if (g.selected) result.push({
orderId: this.orderId,
wareId: k.domainId,
areaId: k.areaId,
locationId: k.id
wareId: g.domainId,
areaId: g.areaId,
locationId: g.id
})
else g.children?.forEach(k => {
// 子位置
if (k.selected) result.push({
orderId: this.orderId,
wareId: k.domainId,
areaId: k.areaId,
locationId: k.id
})
})
})
})
}
})
})
......@@ -272,9 +304,10 @@ export default {
border: 1px #EFEFEF solid;
gap: 1px;
min-height: 64px;
flex-flow: wrap;
}
.position{
width: 20%;
width: calc(20% - 1px);
height: 64px;
display: flex;
flex-direction: column;
......
......@@ -130,7 +130,7 @@
</el-table-column>
<el-table-column :label="$t('状态')" align="center">
<template slot-scope="scope">
{{scope.row.abnormalState!=0?$t('异常'):$t('正常')}}
<dict-tag :type="DICT_TYPE.ORDER_STATUS" :value="scope.row.status"></dict-tag>
</template>
</el-table-column>
</el-table>
......@@ -180,6 +180,7 @@ export default {
},
data() {
return {
DICT_TYPE,
checked:false,
orderData:{},
// 订单异常列表
......
......@@ -67,7 +67,7 @@
<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('储位')">
<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 v-if="type == 2" :label="$t('选择储位')">
<div @click="areaVisible = true" style="color: #0a84ff;cursor: pointer;">{{$t('选择储位')}}</div>
......@@ -383,18 +383,17 @@ export default {
},
watch:{
'params.orderLocationCreateReqVOList'(val){
console.log(val,'123')
console.log(val,'val');
getByWarehouseId().then(r =>{
console.log(r,'仓库')
let obj = [];
val.forEach(item => {
r.data.forEach(itemm => {
if(item.wareId === itemm.id){
itemm.children.forEach(itemmm => {
if(itemmm.id === item.areaId){
if(itemmm.positionList.length > 0){
if(itemmm.positionList && itemmm.positionList.length > 0){
itemmm.positionList.forEach(ic =>{
if(ic.children.length > 0){
if(ic.children && ic.children.length > 0){
ic.children.forEach(icc => {
if(icc.id === item.locationId){
obj.push({
......@@ -412,7 +411,6 @@ export default {
}
})
})
console.log(obj,'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