Commit 9c7479ae authored by 我在何方's avatar 我在何方
parents 58aebad1 501be120
<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)">
<div <template v-if="position.children">
class="position-item" <div
v-for="item in position.children" class="position-item"
@click="handleSelectPosition(item)" v-for="item in position.children"
:class="{'position-item-active': item.selected}"> :key="item.id"
{{ item.code }} @click.stop="handleSelectPositionChild(item)"
</div> :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> </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
warehouse.selected = true } 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(warehouse.positionList) warehouse.positionList?.forEach(g => {
if(g.children)g.children.forEach(k => { g.selected = false
k.selected = false g.children?.forEach(k => {
}) 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,33 +231,35 @@ export default { ...@@ -201,33 +231,35 @@ 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({ // 位置
orderId: this.orderId, if (g.selected) result.push({
wareId: g.domainId,
areaId: g.areaId,
locationId: g.id
})
else if(g.children)g.children.forEach(k => {
// 子位置
if (k.selected) result.push({
orderId: this.orderId, orderId: this.orderId,
wareId: k.domainId, wareId: g.domainId,
areaId: k.areaId, areaId: g.areaId,
locationId: k.id 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 { ...@@ -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;
......
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
</el-table-column> </el-table-column>
<el-table-column :label="$t('状态')" align="center"> <el-table-column :label="$t('状态')" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.row.abnormalState!=0?$t('异常'):$t('正常')}} <dict-tag :type="DICT_TYPE.ORDER_STATUS" :value="scope.row.status"></dict-tag>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -180,6 +180,7 @@ export default { ...@@ -180,6 +180,7 @@ export default {
}, },
data() { data() {
return { return {
DICT_TYPE,
checked:false, checked:false,
orderData:{}, orderData:{},
// 订单异常列表 // 订单异常列表
......
...@@ -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