| | |
| | | return;
|
| | | }
|
| | | const parsedData = JSON.parse(response.data);
|
| | | if (parsedData.display && parsedData.display.frameNumber) {
|
| | | if (parsedData.display && parsedData.frameNumber) {
|
| | | showJiaHao.value = parsedData.display.frameNumber;
|
| | | }
|
| | | if (parsedData.display && parsedData.display.orderNumber) {
|
| | | if (parsedData.display && parsedData.orderNumber) {
|
| | | showProcessId.value = parsedData.display.orderNumber;
|
| | | }
|
| | | if (parsedData.display) {
|
| | |
| | | document.body.removeChild(contextMenu);
|
| | | });
|
| | |
|
| | | const mirrorXItem = document.createElement('div');
|
| | | mirrorXItem.textContent = 'X镜像';
|
| | | mirrorXItem.style.cursor = 'pointer';
|
| | | mirrorXItem.addEventListener('click', () => {
|
| | | mirrorLayoutX(layoutIndex);
|
| | | document.body.removeChild(contextMenu);
|
| | | });
|
| | |
|
| | | const mirrorYItem = document.createElement('div');
|
| | | mirrorYItem.textContent = 'Y镜像';
|
| | | mirrorYItem.style.cursor = 'pointer';
|
| | | mirrorYItem.addEventListener('click', () => {
|
| | | mirrorLayoutY(layoutIndex);
|
| | | document.body.removeChild(contextMenu);
|
| | | });
|
| | |
|
| | | contextMenu.appendChild(rotateItem);
|
| | | contextMenu.appendChild(moveUpAndRotateItem);
|
| | | contextMenu.appendChild(moveDownAndRotateItem);
|
| | |
| | | contextMenu.appendChild(moveRightItem);
|
| | | contextMenu.appendChild(deleteItem);
|
| | | contextMenu.appendChild(addItem);
|
| | | contextMenu.appendChild(mirrorXItem);
|
| | | contextMenu.appendChild(mirrorYItem);
|
| | |
|
| | | document.body.appendChild(contextMenu);
|
| | | };
|
| | |
| | | document.body.removeChild(contextMenu);
|
| | | });
|
| | |
|
| | | const mirrorXItem = document.createElement('div');
|
| | | mirrorXItem.textContent = 'X镜像';
|
| | | mirrorXItem.style.cursor = 'pointer';
|
| | | mirrorXItem.addEventListener('click', () => {
|
| | | mirrorLayoutX(layoutIndex);
|
| | | document.body.removeChild(contextMenu);
|
| | | });
|
| | |
|
| | | const mirrorYItem = document.createElement('div');
|
| | | mirrorYItem.textContent = 'Y镜像';
|
| | | mirrorYItem.style.cursor = 'pointer';
|
| | | mirrorYItem.addEventListener('click', () => {
|
| | | mirrorLayoutY(layoutIndex);
|
| | | document.body.removeChild(contextMenu);
|
| | | });
|
| | |
|
| | | contextMenu.appendChild(addItem);
|
| | | contextMenu.appendChild(mirrorXItem);
|
| | | contextMenu.appendChild(mirrorYItem);
|
| | |
|
| | | document.body.appendChild(contextMenu);
|
| | | };
|
| | |
| | |
|
| | | rect.x = Math.round(rect.x);
|
| | | rect.y = Math.round(rect.y);
|
| | | //adjustAlignmentPosition(layoutIndex, rectIndex);
|
| | | adjustAlignmentPosition(layoutIndex, rectIndex);
|
| | | adjustGrayRectangles(layoutIndex);
|
| | | }
|
| | |
|
| | |
| | | // 调整后重新计算灰色余料
|
| | | adjustGrayRectangles(layoutIndex);
|
| | | };
|
| | |
|
| | |
|
| | | const mergeAdjacentGrayRects = (rects) => {
|
| | | const grayRects = rects.filter(r => r.isRemain);
|
| | |
| | |
|
| | | otherRects.forEach(otherRect => {
|
| | | if (checkOverlap(rect, otherRect)) {
|
| | | isValidRotation = false }
|
| | | isValidRotation = false;
|
| | | }
|
| | | });
|
| | |
|
| | | if (rect.x + rect.w > layout.width || rect.y + rect.h > layout.height) {
|
| | |
| | | }
|
| | | };
|
| | |
|
| | | const mirrorLayoutX = (layoutIndex) => {
|
| | | const layout = layouts.value[layoutIndex];
|
| | | const width = layout.width;
|
| | | const rects = [...layout.rects]; // 创建副本避免直接修改
|
| | |
|
| | | rects.forEach(rect => {
|
| | | // 计算X镜像后的坐标
|
| | | const newX = width - rect.x - rect.w;
|
| | | const newY = rect.y;
|
| | |
|
| | | // 更新矩形位置
|
| | | rect.x = newX;
|
| | | rect.y = newY;
|
| | | });
|
| | |
|
| | | // 更新布局
|
| | | layout.rects = rects;
|
| | | adjustGrayRectangles(layoutIndex);
|
| | | };
|
| | |
|
| | | const mirrorLayoutY = (layoutIndex) => {
|
| | | const layout = layouts.value[layoutIndex];
|
| | | const height = layout.height;
|
| | | const rects = [...layout.rects]; // 创建副本避免直接修改
|
| | |
|
| | | rects.forEach(rect => {
|
| | | // 计算Y镜像后的坐标
|
| | | const newX = rect.x;
|
| | | const newY = height - rect.y - rect.h;
|
| | |
|
| | | // 更新矩形位置
|
| | | rect.y = newY;
|
| | | });
|
| | |
|
| | | // 更新布局
|
| | | layout.rects = rects;
|
| | | adjustGrayRectangles(layoutIndex);
|
| | | };
|
| | |
|
| | | onMounted(() => {
|
| | | fetchSettings(username);
|
| | | setTimeout(updateLayout, 500);
|
| | | updateLayout();
|
| | |
|
| | | selectedLayoutIndex.value = 0;
|
| | |
|
| | |
| | | document.addEventListener('keyup', handleKeyUp);
|
| | | });
|
| | |
|
| | |
|
| | |
|
| | | onUnmounted(() => {
|
| | | rectsElements.value = {};
|
| | | if (clickEventListener) {
|
| | |
| | | document.removeEventListener('keydown', handleKeyDown);
|
| | | document.removeEventListener('keyup', handleKeyUp);
|
| | | });
|
| | |
|
| | | </script>
|
| | |
|
| | |
|
| | | <style scoped>
|
| | | .layout-wrapper {
|
| | |
| | | }
|
| | |
|
| | | .rect-content {
|
| | | display: grid;
|
| | | grid-template-columns: 1fr;
|
| | | grid-template-rows: 1fr;
|
| | | display: flex;
|
| | | flex-direction: column;
|
| | | align-items: flex-start;
|
| | | padding: 5px;
|
| | | min-width: 60px;
|
| | | min-height: 20px;
|
| | | white-space: normal;
|
| | | overflow-wrap: break-word;
|
| | | }
|
| | |
|
| | | .size {
|
| | | grid-row: 1;
|
| | | grid-column: 1;
|
| | | color: #444;
|
| | | font-size: 12px;
|
| | | color: #444;
|
| | | white-space: normal;
|
| | | word-wrap: break-word;
|
| | | }
|
| | |
|
| | | .jia-hao, .liuchengka {
|
| | | grid-row: 2;
|
| | | grid-column: 1;
|
| | | margin: auto;
|
| | | font-size: 14px;
|
| | | font-weight: bold;
|
| | | white-space: normal;
|
| | | word-wrap: break-word;
|
| | | }
|
| | |
|
| | | .sidebar-item {
|