index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <template>
  2. <div
  3. ref="wareHouseArea"
  4. class="svg-container"
  5. :style="{ background: scssVariables.default }"
  6. v-loading="canvasLoading"
  7. >
  8. <div class="toolbar">
  9. <img
  10. title="旋转90度"
  11. :src="imageBtnSrc"
  12. :style="imageBtnStyle"
  13. alt="旋转"
  14. @click="rotateBtn"
  15. />
  16. <button size="small" @click="saveViewState" class="save-view-btn">
  17. 保存视角
  18. </button>
  19. </div>
  20. <div
  21. v-show="
  22. hoveredInfo.hoveredRowIndex !== null &&
  23. hoveredInfo.hoveredColIndex !== null
  24. "
  25. class="overlay"
  26. >
  27. <template v-if="hoveredSid"> 设备编号: {{ hoveredSid }} <br /> </template>
  28. <template v-if="hoveredInfo.hoveredFloorIndex !== null">
  29. 当前层: {{ hoveredInfo.hoveredFloorIndex }}<br />
  30. </template>
  31. <template v-if="hoveredInfo.hoveredColIndex !== null">
  32. 当前列: {{ hoveredInfo.hoveredColIndex }}<br />
  33. </template>
  34. <template v-if="hoveredInfo.hoveredRowIndex !== null">
  35. 当前行: {{ hoveredInfo.hoveredRowIndex }}<br />
  36. </template>
  37. <template v-if="hoveredInfo.hoveredItemStsName !== null">
  38. 类型: {{ hoveredInfo.hoveredItemStsName }}<br />
  39. </template>
  40. <template v-if="hoveredPalletCode">
  41. <span :style="{ color: 'black', fontWeight: 'bold' }">
  42. 托盘码: {{ hoveredPalletCode }}
  43. </span>
  44. <br />
  45. </template>
  46. </div>
  47. <div
  48. :class="['cell-sel-panel-wrapper', panelPositionClass]"
  49. @dblclick.stop="togglePanelPosition"
  50. >
  51. <CellSelPanel
  52. :selectedItemArr="selectedItemArr"
  53. v-show="cellSelPanelVisible"
  54. class="cell-sel-panel-con"
  55. @changeIsByFloor="setCfgIsByFloor"
  56. @onCellSelItemClick="onCellSelItemClick"
  57. />
  58. </div>
  59. <div
  60. v-show="showContextMenu"
  61. class="context-menu-grid"
  62. :style="{
  63. position: 'fixed',
  64. left: `${contextMenuPosition.x}px`,
  65. top: `${contextMenuPosition.y}px`,
  66. transform: 'translate(0, 0)',
  67. }"
  68. >
  69. <ul>
  70. <!-- <li @click="saveCanvasAsImage">保存为图片</li> -->
  71. <li @click="handleMenuClick('chgPalletCode')">修改托盘码</li>
  72. <li @click="handleMenuClick('copyPalletCode')">复制托盘码</li>
  73. </ul>
  74. </div>
  75. <el-dialog
  76. :visible.sync="showChgPalletCodeDia"
  77. title="修改托盘码"
  78. width="60%"
  79. class="pallet-code-dialog"
  80. >
  81. <el-form :model="chgPalletCodeDiaData" label-width="100px">
  82. <el-form-item label="坐标">
  83. {{ chgPalletCodeDiaData.f }}-{{ chgPalletCodeDiaData.c }}-{{
  84. chgPalletCodeDiaData.r
  85. }}
  86. </el-form-item>
  87. <el-form-item label="托盘码">
  88. <el-input v-model="chgPalletCodeDiaData.pallet_code" />
  89. </el-form-item>
  90. </el-form>
  91. <span slot="footer" class="dialog-footer">
  92. <el-button @click="showChgPalletCodeDia = false">取 消</el-button>
  93. <el-button type="primary" @click="submitChgPalletCode">确 定</el-button>
  94. </span>
  95. </el-dialog>
  96. </div>
  97. </template>
  98. <script>
  99. import gridBaseMixin from "@/mixins/map/gridBaseMixin";
  100. export default {
  101. name: "GridSvg",
  102. mixins: [gridBaseMixin],
  103. };
  104. </script>
  105. <style lang="scss" scoped>
  106. .svg-container {
  107. width: 100%;
  108. height: 100%;
  109. overflow: hidden;
  110. }
  111. .toolbar {
  112. position: absolute;
  113. top: 10px;
  114. right: 10px;
  115. z-index: 100;
  116. display: flex;
  117. gap: 8px;
  118. align-items: center;
  119. img {
  120. width: 24px;
  121. height: 24px;
  122. cursor: pointer;
  123. transition: all 0.3s;
  124. &:hover {
  125. opacity: 0.8;
  126. }
  127. }
  128. .save-view-btn {
  129. background-color: #4caf50;
  130. border: none;
  131. color: #fff;
  132. padding: 5px;
  133. border-radius: 3px;
  134. margin: 0;
  135. cursor: pointer;
  136. display: flex;
  137. align-items: center;
  138. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); // 添加轻微阴影
  139. transition: all 0.2s ease-in-out; // 优化过渡效果
  140. &:hover {
  141. background-color: #45a049; // 稍微暗一点的悬停色
  142. box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  143. }
  144. &:active {
  145. background-color: #3d8b40; // 点击时的颜色
  146. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  147. }
  148. }
  149. }
  150. .overlay {
  151. position: absolute;
  152. bottom: 0;
  153. left: 10px;
  154. background-color: rgba(255, 255, 255, 0.8);
  155. padding: 5px;
  156. font-size: 12px;
  157. pointer-events: none;
  158. }
  159. .cell-sel-panel-wrapper {
  160. position: absolute;
  161. top: 0;
  162. z-index: 100;
  163. &.panel-right {
  164. right: 24px;
  165. }
  166. &.panel-left {
  167. left: 244px;
  168. }
  169. }
  170. .context-menu-grid {
  171. position: fixed;
  172. background: white;
  173. border: 1px solid #dcdfe6;
  174. border-radius: 4px;
  175. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  176. padding: 5px 0;
  177. z-index: 1000;
  178. margin-top: 2px;
  179. margin-left: 2px;
  180. ul {
  181. list-style: none;
  182. margin: 0;
  183. padding: 0;
  184. li {
  185. padding: 8px 16px;
  186. cursor: pointer;
  187. font-size: 14px;
  188. color: #606266;
  189. white-space: nowrap;
  190. &:hover {
  191. background-color: #f5f7fa;
  192. }
  193. }
  194. }
  195. }
  196. </style>