Commit 03cf1515 authored by 黄卓's avatar 黄卓

储位选择弹窗 交互

parent 3a60611b
...@@ -130,6 +130,8 @@ ...@@ -130,6 +130,8 @@
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['ecw:order:update']">编辑</el-button> v-hasPermi="['ecw:order:update']">编辑</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="$router.push('/order/warehousing?id=' + scope.row.orderId)"
v-hasPermi="['ecw:order:update']">入仓</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['ecw:order:update']">退仓</el-button> v-hasPermi="['ecw:order:update']">退仓</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
......
...@@ -6,16 +6,16 @@ ...@@ -6,16 +6,16 @@
width="600px" width="600px"
:before-close="handleClose()" :before-close="handleClose()"
> >
<el-tabs v-model="activeName" type="card"> <el-tabs v-model="activeName" type="card" @tab-click="activeWarehouse = {}">
<el-tab-pane :label="item.name" :name="'' + index" v-for="(item, index) in area" :key="index"> <el-tab-pane :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="10"> <el-row :gutter="20">
<el-col :span="12" v-for="(warehouse, i) in item.children" :key="i"> <el-col :span="12" v-for="(warehouse, i) in item.children" :key="i">
<div <div
class="warehouse-block warehouse-block-selected" class="warehouse-block"
:class="{active: selected.find(domain => domain.pid === warehouse.id)}" :class="{'warehouse-block-selected': warehouse.selected, 'warehouse-block-active': warehouse.id === activeWarehouse.id}"
@click="handleSelectWarehouse(warehouse)" @click="handleSelectWarehouse(warehouse)"
> >
{{ warehouse.name }} {{ warehouse.name }}
...@@ -26,10 +26,20 @@ ...@@ -26,10 +26,20 @@
</div> </div>
<div> <div>
<div style="text-align: center">仓位</div> <div style="text-align: center">仓位</div>
<div class="position-group">
<div class="position" v-for="position in activeWarehouse.positionList" :key="item.id">
<div
class="position-item"
v-for="item in position.children"
@click="handleSelectPosition(item)"
:class="{'position-item-active': item.selected}">
{{ item.code }}
</div>
</div>
</div>
</div> </div>
<el-divider></el-divider> <el-divider></el-divider>
已选择: 已选择:{{ selected.join(', ') }}
<el-divider></el-divider> <el-divider></el-divider>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
...@@ -58,9 +68,12 @@ export default { ...@@ -58,9 +68,12 @@ export default {
opened: false, opened: false,
key: 0, key: 0,
orderId: '',
area: [], area: [],
activeName: '0', activeName: '0',
selected: [] selectedWarehouse: [],
selectedPosition: [],
activeWarehouse: {}
}; };
}, },
...@@ -82,7 +95,46 @@ export default { ...@@ -82,7 +95,46 @@ export default {
methods: { methods: {
handleClose() {}, handleClose() {},
handleSelectWarehouse(warehouse) { handleSelectWarehouse(warehouse) {
console.log(warehouse) this.activeWarehouse = warehouse
if (!!warehouse.selected) {
warehouse.selected = false
} else {
warehouse.selected = true
// 区域被选,清空该区域下的位置
warehouse.positionList.forEach(g => {
g.children.forEach(k => {
k.selected = false
})
})
}
},
handleSelectPosition(position) {
if (!!position.selected) {
position.selected = false
// 反选位置时,检查父区域下是否所有位置被反选,若是,选父区域
const parentAre = this.area.find(e => e.id === position.domainId).children.find(f => f.id === position.areaId)
if (!parentAre.selected) {
// 检查父区域下是否所有位置被反选
let hasSelected = false
parentAre.positionList.forEach(g => {
// 位置
g.children.forEach(k => {
// 子位置
if (k.selected) hasSelected = true
})
})
// 所有子位置被反选,选父区域
if (!hasSelected) parentAre.selected = true
}
} else {
position.selected = true
// 选位置时,父区域反选
this.area.find(e => e.id === position.domainId).children.find(f => f.id === position.areaId).selected = false
}
} }
}, },
...@@ -92,9 +144,48 @@ export default { ...@@ -92,9 +144,48 @@ export default {
} }
getByWarehouseId().then(r => { getByWarehouseId().then(r => {
this.area = r.data const area = r.data
area.forEach(e => {
// 仓库
e.children.forEach(f => {
// 区域
f.selected = false
f.positionList.forEach(g => {
// 位置
g.children.forEach(k => {
// 子位置
k.selected = false
})
})
})
})
this.area = area
}) })
}, },
computed: {
selected() {
const result = []
this.area.forEach(e => {
// 仓库
e.children.forEach(f => {
// 区域
if (f.selected) result.push(f.code)
f.positionList.forEach(g => {
// 位置
g.children.forEach(k => {
// 子位置
if (k.selected) result.push(k.code)
})
})
})
})
return result
}
}
} }
</script> </script>
...@@ -105,14 +196,58 @@ export default { ...@@ -105,14 +196,58 @@ export default {
height: 42px; height: 42px;
line-height: 42px; line-height: 42px;
text-align: center; text-align: center;
margin-bottom: 10px; margin-bottom: 15px;
cursor: pointer; cursor: pointer;
transition: 0.5s;
box-shadow: #bfbfbf 3px 3px 14px 0;
} }
.warehouse-block:hover, .warehouse-block .active{ .warehouse-block:hover{
color: #ffffff; opacity: 0.9;
background-color: #388fe5; transition: 0.5s;
transform: scale(1.02);
box-shadow: #8f8f8f 7px 5px 14px 0;
}
.warehouse-block-active{
box-shadow: #7e9dbd 7px 5px 14px 0;
transform: scale(1.04);
} }
.warehouse-block-selected{ .warehouse-block-selected{
border: #388fe5 solid 5px; color: #ffffff;
background-color: #4085e3;
}
.position-group{
display: flex;
background-color: #EFEFEF;
border: 1px #EFEFEF solid;
gap: 1px;
min-height: 64px;
}
.position{
width: 20%;
height: 64px;
display: flex;
flex-direction: column;
gap: 1px;
}
.position-item{
width: 100%;
background-color: #FFFFFF;
flex: 1;
cursor: pointer;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
}
.position-item:hover{
background-color: #d7dbe3;
}
.position-item-active{
background-color: #4085e3;
color: white;
}
.position-item-active:hover{
background-color: #4085e3;
opacity: 0.8;
} }
</style> </style>
<template> <template>
<div class="app-container"> <div class="app-container">
<h2>入仓操作-NC1231231N</h2> <h2>入仓操作-{{ order.orderNo }}</h2>
<order-base-info :order="order"></order-base-info> <order-base-info :order="order"></order-base-info>
<div style="margin-top: 10px"> <div style="margin-top: 20px">
<span>储位:</span><el-button type="primary" size="mini">选择</el-button> <span>储位:</span><el-button type="primary" size="mini" @click="areaVisible = true">选择</el-button>
</div> </div>
<h2>货物信息</h2> <h2>货物信息</h2>
...@@ -154,6 +154,8 @@ ...@@ -154,6 +154,8 @@
<el-button type="primary">完成入仓</el-button> <el-button type="primary">完成入仓</el-button>
</div> </div>
</el-form> </el-form>
<warehouse-area-dialog :visible.sync="areaVisible"></warehouse-area-dialog>
</div> </div>
</template> </template>
...@@ -161,20 +163,26 @@ ...@@ -161,20 +163,26 @@
import {getCurrencyList} from "@/api/ecw/currency" import {getCurrencyList} from "@/api/ecw/currency"
import {getOrder} from "@/api/ecw/order" import {getOrder} from "@/api/ecw/order"
import orderBaseInfo from "@/views/ecw/order/warehousing/components/orderBaseInfo" import orderBaseInfo from "@/views/ecw/order/warehousing/components/orderBaseInfo"
import WarehouseAreaDialog from '@/views/ecw/order/warehousing/components/warehouse-area-dialog'
export default { export default {
name: "Warehousing", name: "Warehousing",
components: { components: {
orderBaseInfo orderBaseInfo,
WarehouseAreaDialog
}, },
mounted() { mounted() {
if(this.$route.query.id){
this.orderId = this.$route.query.id
getOrder(this.orderId).then(r => this.order = r.data)
}
getCurrencyList().then(res => this.currencyList = res.data) getCurrencyList().then(res => this.currencyList = res.data)
getOrder(15).then(r => this.order = r.data)
}, },
data() { data() {
return { return {
areaVisible: false,
form: { form: {
a: '', a: '',
b: 3 b: 3
......
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