chenlu
12 小时以前 33dbc6a161554f3a897f9e9273feb4f2c1b47381
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/OptimizationRect.vue
@@ -2,15 +2,79 @@
  <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
          v-for="(layout, layoutIndex) in layouts"
          :key="layoutIndex"
          class="sidebar-item"
          @click="selectLayout(layoutIndex)"
          :class="{ 'selected': selectedLayoutIndex === layoutIndex }"    style="margin-bottom: 5px;"
      >
        {{ layout.realWidth }} × {{ layout.realHeight }} × {{ layout.quantity }}
      <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"
            class="sidebar-item"
            @click="selectLayout(layoutIndex)"
            :class="{ 'selected': selectedLayoutIndex === layoutIndex }"            style="margin-bottom: 5px;"
          >
            {{ 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>