于杰
8 小时以前 121ef0e477b9ab0e3a610de08a92f08eb955d556
实现临时小片侧边栏添加功能,实现外部接口接收临时优化json功能
2个文件已修改
128 ■■■■■ 已修改文件
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/OptimizationRect.vue 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/controller/pp/GlassOptimizeController.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/OptimizationRect.vue
@@ -2,6 +2,20 @@
  <div style="display: flex; height: 90vh;">
    <!-- Sidebar -->
    <div class="sidebar" style="width: 200px; background: #f4f4f4; padding: 10px; height: 93%; overflow-y: auto; max-height: 90vh; border-radius: 8px;">
      <div class="folder">
        <div
          class="folder-header"          style="padding: 8px; background: #e0e0e0; margin-bottom: 5px; border-radius: 4px; user-select: none; display: flex; justify-content: space-between; align-items: center;"
        >
          <span @click="toggleFolder('pending')" style="flex: 1; cursor: pointer;">待切割原片</span>
          <button
            @click="toggleFolder('pending')"            style="background: none; border: none; cursor: pointer; font-size: 14px; padding: 2px 5px; border-radius: 3px;"
            :title="openFolders.pending ? '收起' : '展开'"
          >
            <el-icon v-if="openFolders.pending"><ArrowUp /></el-icon>
            <el-icon v-else><ArrowDown /></el-icon>
          </button>
        </div>
        <div v-show="openFolders.pending" class="folder-content" style="padding-left: 15px;">
      <div
          v-for="(layout, layoutIndex) in layouts"
          :key="layoutIndex"
@@ -11,6 +25,56 @@
      >
        {{ layout.realWidth }} × {{ layout.realHeight }} × {{ layout.quantity }}
      </div>
        </div>
      </div>
<!-- 待补片队列文件夹 -->
      <div class="folder">
        <div
          class="folder-header"          style="padding: 8px; background: #e0e0e0; margin-bottom: 5px; border-radius: 4px; user-select: none; display: flex; justify-content: space-between; align-items: center;"
        >
          <span @click="toggleFolder('patchQueue')" style="flex: 1; cursor: pointer;">待补片队列</span>
          <button
            @click="toggleFolder('patchQueue')"            style="background: none; border: none; cursor: pointer; font-size: 14px; padding: 2px 5px; border-radius: 3px;"
            :title="openFolders.patchQueue ? '收起' : '展开'"
          >
            <el-icon v-if="openFolders.patchQueue"><ArrowUp /></el-icon>
            <el-icon v-else><ArrowDown /></el-icon>
          </button>
        </div>
        <div v-show="openFolders.patchQueue" class="folder-content" style="padding-left: 15px;">
          <div style="padding: 10px; color: #666; font-style: italic;">
            暂无补片任务
          </div>
        </div>
      </div>
      <!-- 添加自定义尺寸文件夹 -->
      <div class="folder">
        <div
          class="folder-header"          style="padding: 8px; background: #e0e0e0; margin-bottom: 5px; border-radius: 4px; user-select: none; display: flex; justify-content: space-between; align-items: center;"
        >
          <span @click="toggleFolder('customSize')" style="flex: 1; cursor: pointer;">添加自定义尺寸</span>
          <button
            @click="toggleFolder('customSize')"            style="background: none; border: none; cursor: pointer; font-size: 14px; padding: 2px 5px; border-radius: 3px;"
            :title="openFolders.customSize ? '收起' : '展开'"
          >
            <el-icon v-if="openFolders.customSize"><ArrowUp /></el-icon>
            <el-icon v-else><ArrowDown /></el-icon>
          </button>
        </div>
        <div v-show="openFolders.customSize" class="folder-content" style="padding-left: 15px;">
          <div style="padding: 10px;">
            <button
              @click="showAddCustomSizeDialog"              style="width: 100%; padding: 8px; background: #409eff; color: white; border: none; border-radius: 4px; cursor: pointer;"
            >
              + 添加自定义尺寸
            </button>
          </div>
        </div>
      </div>
    </div>
    <!-- Main Layout Panel -->
@@ -76,6 +140,7 @@
<script setup>
import { ref, reactive, onMounted, onUnmounted } from 'vue';
import { useRouter } from 'vue-router';
import { ArrowUp, ArrowDown } from '@element-plus/icons-vue'
import request from "@/utils/request";
const router = useRouter();
import { useI18n } from "vue-i18n";
@@ -148,6 +213,30 @@
      ElMessage.warning(res.msg);
    }
  });
};
const openFolders = ref({
  pending: true,  // 默认展开"待切割原片"文件夹
   patchQueue: false,   // 默认收起"待补片队列"文件夹
  customSize: false   // 默认收起"添加自定义尺寸"文件夹
});
// 切换文件夹展开/收起状态
const toggleFolder = (folderName) => {
  openFolders.value[folderName] = !openFolders.value[folderName];
};
const showAddCustomSizeDialog = () => {
  // 检查是否选择了版图
  if (selectedLayoutIndex.value === null || layouts.value.length === 0) {
    ElMessage.warning('请先选择一个版图');
    return;
  }
  // 使用现有的添加成品逻辑,传入当前选中的版图索引
  showAddDialog(selectedLayoutIndex.value);
};
//查询设置的基础信息架号,矩形颜色,订单序号等
@@ -1408,4 +1497,17 @@
.context-menu div:hover {
  background-color: #f0f0f0;
}
.folder-header {
  font-weight: bold;
}
.folder-header:hover {
  background-color: #d0d0d0 !important;
}
.folder-content {
  border-left: 2px solid #ccc;
  margin-left: 5px;
}
</style>
north-glass-erp/src/main/java/com/example/erp/controller/pp/GlassOptimizeController.java
@@ -24,6 +24,7 @@
import java.nio.file.Path;
import java.nio.file.Paths;
import java.sql.Date;
import java.util.HashMap;
import java.util.Map;
@RestController
@@ -227,6 +228,31 @@
    }
    @PostMapping("/calculate")
    public ResponseEntity<Map<String, Object>> receiveOptimizeRequest(
            @RequestBody Map<String, Object> requestData) {
        Map<String, Object> response = new HashMap<>();
        try {
            // 立即返回接收成功的响应
            response.put("code", "200");
            response.put("msg", "success");
            response.put("data", "");
            // 异步处理计算任务
//            glassOptimizeService.processExternalOptimizeRequest(requestData);
            System.out.println(requestData);
            return ResponseEntity.ok(response);
        } catch (Exception e) {
            response.put("code", 201);
            response.put("msg", "false: " + e.getMessage());
            response.put("data", "");
            return ResponseEntity.status(500).body(response);
        }
    }