不理解的请备注

效果图:

视频不太清楚

1、安装vue-grid-layout

npm install vue-grid-layout --save

2、安装splitPane

npm install vue - splitpane --save

3、代码块分布

4、PositionsList代码

<!-- 文件管理 -->
<template><a-card><a-row type="flex" justify="center"><a-col :span="3" :order="1"><a-form-item label="长:" :labelCol="{ span: 7 }" :wrapperCol="{ span: 17 }"><span><a-input type="number" @change="getLong" :disabled="disabled" v-model="form.longs" placeholder="请输入"/></span></a-form-item></a-col><a-col :span="3" :order="2"><a-form-item label="宽:" :labelCol="{ span: 7 }" :wrapperCol="{ span: 17 }"><span><a-input type="number" :disabled="disabled" @change="getLong" v-model="form.wides" placeholder="请输入"/></span></a-form-item></a-col><a-col :span="3" :order="2"><a-form-item label="高:" :labelCol="{ span: 7 }" :wrapperCol="{ span: 17 }"><span><a-input type="number" @change="getLong" v-model="form.heigts" placeholder="请输入"/></span></a-form-item></a-col><a-col :span="3" :order="4"><a-form-item label="层数:" :labelCol="{ span: 7 }" :wrapperCol="{ span: 17 }"><span><a-input placeholder="请输入"/></span></a-form-item></a-col><a-col :span="3" :order="5"><a-form-item label="行数:" :labelCol="{ span: 7 }" :wrapperCol="{ span: 17 }"><span><a-input placeholder="请输入"/></span></a-form-item></a-col><a-col :span="4" :order="6"><a-form-item label="缩放大小:" :labelCol="{ span: 7 }" :wrapperCol="{ span: 17 }" class="flexble"><a-slider id="test" v-model="scaleRadios" :default-value="scaleRadios" @change="getZoom" /></a-form-item></a-col><a-col :span="4" :order="7" style="margin-left:30px"><a-space style="margin-top:5px"><a-button type="primary" @click="generate" v-if="!disabled" :disabled="disabled">生成仓位图</a-button><a-button type="primary" @click="getreset" v-else>重置</a-button><a-button type="primary">生成区位图</a-button></a-space></a-col></a-row><!-- 仓位图 --><positchart ref="positForm" :scaleRadio="scaleRadio" :round="form" /></a-card>
</template><script>
import positchart from '@views/erp/housing/modules/positchart'
export default {components: {positchart},name: 'PositionsList',data() {return {form: {long: 13,longs: 13,wide: 10,wides: 10,heigt: 50,heigts: 50},disabled: false,scaleRadios: 100,scaleRadio: 1}},methods: {generate() {let that = thisthat.disabled = truethat.$refs.positForm.handl()},getLong() {this.form.long = this.form.longs - 0this.form.wide = this.form.wides - 0this.form.heigt = this.form.heigts - 0},getreset() {let that = thisthat.disabled = falsethat.form = {long: 13,longs: 13,wide: 10,wides: 10,heigt: 50,heigts: 50}that.$refs.positForm.handfe()},getZoom() {this.scaleRadio = this.scaleRadios / 100 - 0}}
}
</script>
<style></style>

6、positchart代码块

<template><div v-if="layeshow" class="box"><splitPane:max-percent="100":default-percent="defaultPercentOne":min-percent="11"split="vertical"class="splitpanes__pane"style="height: 650px;"><template slot="paneL"><!-- <button @click="fullScreenAndExit()">全屏和退出</button> --><lb-card title="操作区" size="default" style="padding:0px;margin:0px;height:650px;"><div @drag="drag" @dragend="dragend('operate')" class="operate" draggable="true" unselectable="on">操作</div><div @drag="drag" @dragend="dragend('workbench')" class="workbench" draggable="true" unselectable="on">工作台</div><div @drag="drag" @dragend="dragend('Shelves')" class="Shelves" draggable="true" unselectable="on">货架</div><div @drag="drag" @dragend="dragend('passage')" class="passage" draggable="true" unselectable="on">通道</div></lb-card></template><template slot="paneR"><div class="penclass"><a-icon type="bug" style="color:#fff;font-size: 10px;" /></div><split-pane :max-percent="100" :default-percent="defaultPercentwe" :min-percent="10" split="vertical"><template slot="paneL"><lb-card title="显示区" size="default" style="padding:0px;margin:0px;height: 650px;"><div id="content" class="layoutBox" :style="`zoom:${scaleRadio ? scaleRadio : 1}`"><grid-layoutref="gridlayout":layout.sync="layout":col-num="round.long":row-height="round.heigt":responsive="false":vertical-compact="false":prevent-collision="true":use-css-transforms="true":is-draggable="true":is-resizable="true"class="grid_cals"><!-- 背景框 --><myGridItemPreview :itemData="backgroundData" /><grid-item:key="item.i"v-for="item in layout":x="item.x":y="item.y":w="item.w":h="item.h":i="item.i":style="{ background: getColor(item.text) }"><div class="clmodule" @click="getEdit(item)"><span>{{ item.text }}</span></div></grid-item></grid-layout></div></lb-card></template><template slot="paneR"><div class="penclass"><a-icon type="bug" style="color:#fff;font-size: 10px;" /></div><div style="margin-top: -5px;"><a-tabs type="card" @change="callback" size="small"><a-tab-pane v-for="item in tabPane" :key="item.key" :tab="item.title"><positdation ref="dationForm" :jectDation="jectDation" v-if="showpane == 1" /><positgoods v-if="showpane == 2" /><positshelves v-if="showpane == 3" /></a-tab-pane></a-tabs></div></template></split-pane></template></splitPane></div>
</template>
<script>
import VueDragResize from 'vue-drag-resize'
import { GridLayout, GridItem } from 'vue-grid-layout'
import splitPane from 'vue-splitpane'
import LbCard from '@views/Acom/LbCard'
// 基础信息
import positdation from '@views/erp/housing/modals/positdation'
// 货品
import positgoods from '@views/erp/housing/modals/positgoods'
// 货架信息
import positshelves from '@views/erp/housing/modals/positshelves'
import uuid from 'uuid'
let mouseXY = { x: null, y: null }
let DragPos = { x: null, y: null, w: 1, h: 1, i: null }
import myGridItemPreview from '@views/erp/housing/modules/itemPreview'
export default {components: {GridLayout,GridItem,myGridItemPreview,splitPane,LbCard,positgoods,VueDragResize,positdation,positshelves},props: {round: {type: Object,required: true},scaleRadio: {type: Number}},data() {return {// tabsjectDation: {},tabPane: [{title: '基础信息',key: 1},{title: '货品信息',key: 2},{title: '货架详情',key: 3}],showpane: 0,layout: [{x: 0,y: 0,w: 1,h: 2,i: '0',id: '0',text: '货架',name: '0-001',warehouse: '1层',client: '云数联客户',type: '货架',attribute: '塔型货架',MaxLength: 2,width: 1}],backgroundData: [],defaultPercentOne: 11,layeshow: false,defaultPercentwe: 80}},beforeCreate() {// 屏幕高度this.screenHeight = document.documentElement.clientHeight},mounted() {document.addEventListener('dragover',function(e) {mouseXY.x = e.clientXmouseXY.y = e.clientY},false)},beforeDestroy() {},methods: {// tabscallback(key) {let that = thisthat.showpane = key},// 显示handl() {let that = thisthis.initPreviewData()that.layeshow = trueconsole.log(this.round)},// 隐藏handfe() {let that = thisthat.layeshow = false},initPreviewData() {this.backgroundData = []for (let i = 0; i < this.round.long; i++) {for (let j = 0; j < this.round.wide; j++) {this.backgroundData.push({x: i,y: j,w: 1,h: 1,i: uuid // 防止 key 重复})}}},getEdit(item) {console.log(item)let that = thisthat.showpane = 1that.jectDation = item},drag(e) {let parentRect = document.getElementById('content').getBoundingClientRect()let mouseInGrid = falseif (mouseXY.x > parentRect.left &&mouseXY.x < parentRect.right &&mouseXY.y > parentRect.top &&mouseXY.y < parentRect.bottom) {mouseInGrid = true}if (mouseInGrid === true && this.layout.findIndex(item => item.i === 'drop') === -1) {this.layout.push({x: (this.layout.length * 2) % (this.colNum || this.round.long),y: this.layout.length + (this.colNum || this.round.long), // puts it at the bottomw: 1,h: 1,i: 'drop'})}let index = this.layout.findIndex(item => item.i === 'drop')if (index !== -1) {try {// this.$refs.gridlayout.$children[this.layout.length].$refs.item.style.display = 'none'} catch {}let el = this.$refs.gridlayout.$children[index]el.dragging = { top: mouseXY.y - parentRect.top, left: mouseXY.x - parentRect.left }let new_pos = el.calcXY(mouseXY.y - parentRect.top, mouseXY.x - parentRect.left)if (mouseInGrid === true) {this.$refs.gridlayout.dragEvent('dragstart', 'drop', new_pos.x, new_pos.y, 1, 1)DragPos.i = String(index)DragPos.x = this.layout[index].xDragPos.y = this.layout[index].y}if (mouseInGrid === false) {this.$refs.gridlayout.dragEvent('dragend', 'drop', new_pos.x, new_pos.y, 1, 1)this.layout = this.layout.filter(obj => obj.i !== 'drop')}}},dragend(text) {let obj = {}if (text == 'operate') {obj.text = '操作'obj.h = 1}if (text == 'workbench') {obj.text = '工作台'obj.h = 1}if (text == 'Shelves') {obj.text = '货架'obj.h = 2}if (text == 'passage') {obj.text = '通道'obj.h = 3}let parentRect = document.getElementById('content').getBoundingClientRect()let mouseInGrid = falseif (mouseXY.x > parentRect.left &&mouseXY.x < parentRect.right &&mouseXY.y > parentRect.top &&mouseXY.y < parentRect.bottom) {mouseInGrid = true}if (mouseInGrid === true) {this.layout = this.layout.filter(obj => obj.i !== 'drop')this.layout.push({x: DragPos.x,y: DragPos.y,w: 1,h: obj.h,i: DragPos.i,moved: true,text: obj.text,type: obj.text,name: obj.h + DragPos.i,id: '0-' + obj.h + DragPos.i,warehouse: '1层',client: '云数联客户',attribute: '塔型货架',MaxLength: obj.h,width: 1})console.log(this.layout)try {this.$refs.gridLayout.$children[this.layout.length].$refs.item.style.display = 'block'} catch {}}},closeItemHandle(item) {// 预览与正式数据公用一个 item 因此,需两者都清除数据this.layout.splice(this.layout.findIndex(i => i.i == item.i))this.backgroundData.splice(this.backgroundData.findIndex(i => i.i == item.i))},// 颜色getColor(text) {let color = ''if (text == '操作') color = 'green'if (text == '工作台') color = 'red'if (text == '货架') color = 'blue'if (text == '通道') color = 'orange'return color},// 全屏// 点击事件fullScreenAndExit() {const el = document.querySelector('.box')this.toggleFullScreen(el)},/*** 切换全屏* @param {HTMLElement} element dom元素*/toggleFullScreen(element) {if (!this.isFullScreen) {this.fullScreen(element)} else {this.exitFullScreen()}this.isFullScreen = !this.isFullScreen},/*** 全屏* @param {HTMLElement} element dom元素*/fullScreen(element) {const requestMethod =element.requestFullScreen ||element.webkitRequestFullScreen ||element.mozRequestFullScreen ||element.msRequestFullScreenif (requestMethod) {requestMethod.call(element)}if (typeof window.ActiveXObject !== 'undefined') {let wscript = new ActiveXObject('WScript.Shell')if (wscript !== null) {wscript.SendKeys('{F11}')}}},/*** 退出全屏*/exitFullScreen() {const documentElement = documentconst cfs =documentElement.cancelFullScreen ||documentElement.webkitCancelFullScreen ||documentElement.mozCancelFullScreen ||documentElement.exitFullScreenif (cfs) {cfs.call(documentElement)} else if (typeof window.ActiveXObject !== 'undefined') {// for IE,这里和fullScreen相同,模拟按下F11键退出全屏const wscript = new ActiveXObject('WScript.Shell')if (wscript != null) {wscript.SendKeys('{F11}')}}}}
}
</script><style lang="less" scoped>
.penclass {position: absolute;background: blue;top: 40%;left: -5px;width: 10px;height: 45px;display: flex;justify-content: center;align-self: center;align-items: center;border-radius: 10px;
}
// 操作区
.operate {height: 60px;background: green;margin: 10px 0;padding: 10px;display: flex;justify-content: center;align-items: center;color: #fff;
}
// 货架版
.Shelves {height: 120px;background: blue;margin: 10px 0;padding: 10px;display: flex;justify-content: center;align-items: center;color: #fff;
}
// 工作台
.workbench {height: 60px;background: red;margin: 10px 0;padding: 10px;display: flex;justify-content: center;align-items: center;color: #fff;
}
// 通道版
.passage {height: 180px;background: orange;margin: 10px 0;padding: 10px;display: flex;justify-content: center;align-items: center;color: #fff;
}
.clmodule {display: flex;justify-content: center;align-items: center;align-self: center;height: 100%;color: #fff;
}
.vue-grid-item .no-drag {height: 100%;width: 100%;
}
.vue-grid-item .minMax {font-size: 12px;
}
.vue-grid-item .add {cursor: pointer;
}.layoutBox {width: 100%;height: 100%;
}
// .grid_cals {
//   width: 100%;
//   overflow-x: auto;
//   display: -webkit-box;
//   -webkit-overflow-scrolling: touch;
//   min-height: 600px;
// }
// .grid_cals::-webkit-scrollbar {
//   display: none;
// }
</style>

7、itemPreview代码块

<template><div><grid-itemv-for="item in itemData":x="item.x":y="item.y":w="item.w":h="item.h":i="item.i":key="item.i":is-draggable="false":is-resizable="false"class="grid-item"/></div>
</template><script>
import { GridItem } from 'vue-grid-layout'
export default {name: 'VueLayoutItem',props: ['itemData'],components: { GridItem }
}
</script><style lang="less" scoped>
.grid-item {// border-top: 2px solid rgba(1, 153, 209, 0.5);border: #999 dashed 1px;display: flex;justify-content: center;align-items: center;color: #fff;
}
</style>

8、positdation代码块

<!-- 基础信息 -->
<template><div><span v-if="Object.keys(parent).length == 0"><a-emptyimage="https://gw.alipayobjects.com/mdn/miniapp_social/afts/img/A*pevERLJC9v0AAAAAAAAAAABjAQAAAQ/original"/></span><a-row v-else><a-col :span="24"><a-form-model-item label="库位编号:" :labelCol="{ span: 6 }" :wrapperCol="{ span: 15 }"><a-input placeholder="" v-model="parent.name" /></a-form-model-item></a-col><a-col :span="24"><a-form-model-item label="所在仓库:" :labelCol="{ span: 6 }" :wrapperCol="{ span: 15 }"><a-input placeholder="" v-model="parent.warehouse" /></a-form-model-item></a-col><a-col :span="24"><a-form-model-item label="所属客户:" :labelCol="{ span: 6 }" :wrapperCol="{ span: 15 }"><a-input placeholder="" v-model="parent.client" /></a-form-model-item></a-col><a-col :span="24"><a-form-model-item label="库位类型:" :labelCol="{ span: 6 }" :wrapperCol="{ span: 15 }"><a-input placeholder="" v-model="parent.type" /></a-form-model-item></a-col><a-col :span="24"><a-form-model-item label="库位属性:" :labelCol="{ span: 6 }" :wrapperCol="{ span: 15 }"><a-input placeholder="" v-model="parent.attribute" /></a-form-model-item></a-col><a-col :span="24"><a-form-model-item label="最大长度:" :labelCol="{ span: 6 }" :wrapperCol="{ span: 15 }"><a-input placeholder="" v-model="parent.MaxLength" /></a-form-model-item></a-col><a-col :span="24"><a-form-model-item label="最大宽度:" :labelCol="{ span: 6 }" :wrapperCol="{ span: 15 }"><a-input placeholder="" v-model="parent.width" /></a-form-model-item></a-col><a-col :span="12" style="margin-top: 50px;"><span style="display: flex;justify-content: center;"><a-button type="primary">修改</a-button></span></a-col><a-col :span="12" style="margin-top: 50px;"><span style="display: flex;justify-content: center;"><a-button type="primary">确定</a-button></span></a-col></a-row></div>
</template>
<script>
export default {name: 'positdation',data() {return {parent: {}}},props: {jectDation: {type: Object,required: true}},watch: {jectDation: {immediate: true,handler(val) {let that = thisthat.parent = val}}},methods: {// 传递过来的参数getDation(item) {let that = thisthat.parent = {}that.parent = item}}
}
</script>
<style lang="less" scoped></style>

9、positgoods和positshelves为空文件

仓管平面图(自定义布局)相关推荐

  1. ViewGroup1——自定义布局

    平时开发时,系统提供的几个布局基本就能满足我们的需求了.如果系统提供的布局无法满足需求,我们可以扩展ViewGroup类来实现自定义布局控件.先看下ViewGroup的继承图 由上图可知,ViewGr ...

  2. UICollectionView自定义布局(二)

    这是UICollectionView自定义布局的第二篇,实现类似UltravisualApp的视差效果,同样这篇文章的教程来自Ray家的Swift Expanding Cells in iOS Col ...

  3. iOS开发学无止境 - UICollectionView自定义布局之风火轮[译]

    现在有许多极具创造力的网站,几周前我碰巧浏览到一个名为Form Follows Function的网站,上面有各种交互动画.其中最吸引我的是网站上的导航转轮,转轮由各种交互体验海报组成. 原文:UIC ...

  4. 从自定义TagLayout看自定义布局的一般步骤[手动加精]

    从自定义TagLayout看自定义布局的一般步骤[手动加精] 我们常用的布局有LinearLayout,FrameLayout,RelativeLayout,大多数情况下都能满足我们的需求,但是也有很 ...

  5. Swift - 使用网格(UICollectionView)的自定义布局实现复杂页面

    网格UICollectionView除了使用流布局,还可以使用自定义布局.实现自定义布局需要继承UICollectionViewLayout,同时还要重载下面的三个方法: 1 2 3 4 5 6 7 ...

  6. 【Android 性能优化】布局渲染优化 ( 过渡绘制 | 背景设置产生的过度绘制 | Android 系统的渲染优化 | 自定义布局渲染优化 )

    文章目录 一. 背景设置产生的过度绘制 二. Android 系统的渲染优化 1. 透明组件数据传递 2. GPU 存储机制 3. Android 7.0 之后的优化机制 三. 自定义布局渲染优化 一 ...

  7. android 前台服务自定义布局不显示_Android自定义LinearLayout布局显示不完整的解决方法...

    发现问题 原需求,在一个伸缩列表中,自定义LinearLayout继承LinearLayout动态添加布局. 然而实现的时候:一共遍历了30条数据,却只显示了一条 断点查看代码:遍历addView() ...

  8. 【教程】如何在标签打印工具TFORMer Designer中自定义布局?

    TEC-IT的在线标签生成器TFORMer Designer提供标签打印服务,并提供即用型行业标签模板作为Web服务.使用此软件,您可以在几秒钟内创建您自己的标签和表格或在工业和物流业中使用即时可用的 ...

  9. re管理器Java_自定义布局管理器-FormLayout

    第二部分:自定义布局管理器 在java.awt包与javax.swing包下有许多现成的布局类,比如BorderLayout.FlowLayout,还有较为复杂的.用于精确定位的布局类GridBagL ...

  10. android dialog 自定义布局,如何设置AlertDialog的自定义布局?

    调用我的对话框:alertDialog = showInfoDialog(message = "$wrongPasscodeMessage\n$retryMessage") 方法如 ...

最新文章

  1. Python Qt GUI设计:QSpinBox计数器类(基础篇—15)
  2. 想学单片机怎么入手?学单片机前先学什么?
  3. WatchDog工作原理
  4. win10开机慢怎么解决_细说Win10启动慢怎么办
  5. lunix mysql 8小时_MySQL 8.0 首个自适应参数横空出世
  6. 泸州田家炳中学2021高考成绩查询,2021年泸州中考线出来了吗
  7. SaltStack实战之远程执行-Modules
  8. [转]优秀的女孩是没有性生活的
  9. 图灵好书推荐——数学+物理+宇宙
  10. c语言实验编码sdut,C语言实验一(1)
  11. vue PC端项目页面做rem布局(大屏展示)
  12. 免安装mysql_免安装版的Mysql
  13. 国内比较好的云服务提供商有哪些?
  14. STM32CUBEIDE配置FreeRTOS
  15. “攻城狮” 需要了解的密码知识
  16. 华为:编程实现联想输入法 输入联想功能是非常实用的一个功能,请编程实现类似功能
  17. springboot单文件下载和多文件压缩zip下载
  18. 近期Java高级开发岗面试总结
  19. 内存卡数据恢复软件哪个好?看看谁才是恢复软件中的MVP
  20. 将一个C类网络(192.168.1.0/24)划分为4个子网,每个子网至少可容纳30台主机,如何划分?

热门文章

  1. python——每日一题
  2. 数据级的权限管理和功能级的权限管理的区别,不使用框架(shiro,springsecurity)做权限设计的思考
  3. 【flask】 搭建图片服务器以便浏览器查看
  4. 航空公司规定退改签查询-机票退改签查询接口
  5. 农民的致富之路-大自然的珍贵野生植物
  6. lzg_ad:在WES中添加语音识别功能
  7. 面向制造商的实用电子产品(N的第一部分)
  8. 分享3个文字配音软件,帮助你们轻松制作短视频
  9. go linux 界面,Go与GUI——GO语言的图形界面Walk
  10. 出口退税率文库2020B