中兴实强
1.bom加一个引用功能,
2.工艺路线需要修改,bom不必填,选了bom就带入bom信息
已修改1个文件
63 ■■■■ 文件已修改
src/views/productionManagement/productStructure/Detail/index.vue 63 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productionManagement/productStructure/Detail/index.vue
@@ -121,12 +121,17 @@
              </el-table-column>
              <el-table-column label="操作"
                               fixed="right"
                               width="200">
                               width="260">
                <template #default="{ row, $index }">
                  <el-button v-if="dataValue.isEdit && !dataValue.dataList.some(item => (item as any).tempId === row.tempId)"
                  <el-button v-if="dataValue.isEdit"
                             type="danger"
                             text
                             @click="removeItem(row.tempId)">删除
                  </el-button>
                  <el-button v-if="dataValue.isEdit"
                             type="primary"
                             text
                             @click="quoteItem(row.tempId)">引用
                  </el-button>
                  <el-button v-if="dataValue.isEdit"
                             type="primary"
@@ -221,7 +226,6 @@
  ]);
  const openDialog = (tempId: any) => {
    console.log(tempId, "tempId");
    dataValue.currentRowName = tempId;
    dataValue.showProductDialog = true;
  };
@@ -236,14 +240,15 @@
      const { data } = await queryList(routeId.value);
      dataValue.dataList = (data as any) || [];
      // 为所有项及其子项设置name属性
      const setNameRecursively = (items: any[]) => {
      const setNameRecursively = (items: any[], parent: any = null) => {
        items.forEach((item: any) => {
          item.tempId = item.id;
          item.parentTempId = parent?.tempId || "";
          item.processName =
            dataValue.processOptions.find(option => option.id === item.processId)
              ?.name || "";
          if (item.children && item.children.length > 0) {
            setNameRecursively(item.children);
            setNameRecursively(item.children, item);
          }
        });
      };
@@ -426,6 +431,48 @@
      }
    });
  };
  const createTempId = () => new Date().getTime() + Math.floor(Math.random() * 1000);
  const cloneItem = (item: any, parentTempId = "", parentId = item.parentId || "") => {
    const tempId = createTempId();
    return {
      ...item,
      id: undefined,
      parentId,
      tempId,
      parentTempId,
      children: [],
    };
  };
  const quoteItem = (tempId: string) => {
    const topIndex = dataValue.dataList.findIndex(item => item.tempId === tempId);
    if (topIndex !== -1) {
      const currentItem = dataValue.dataList[topIndex];
      dataValue.dataList.splice(
        topIndex + 1,
        0,
        cloneItem(currentItem, currentItem.parentTempId || "")
      );
      return;
    }
    const quoteChildItem = (items: any[], currentTempId: string) => {
      for (let i = 0; i < items.length; i++) {
        const item = items[i];
        if (item.tempId === currentTempId) {
          items.splice(i + 1, 0, cloneItem(item, item.parentTempId || ""));
          return true;
        }
        if (item.children && item.children.length > 0) {
          if (quoteChildItem(item.children, currentTempId)) {
            return true;
          }
        }
      }
      return false;
    };
    quoteChildItem(dataValue.dataList, tempId);
  };
  const addItem2 = tempId => {
    dataValue.dataList.map(item => {
      if (item.tempId === tempId) {
@@ -441,7 +488,7 @@
          productModelId: undefined,
          processId: "",
          processName: "",
          unitQuantity: 0,
          unitQuantity: 1,
          demandedQuantity: 0,
          unit: "",
          children: [],
@@ -467,7 +514,7 @@
        model: undefined,
        productModelId: undefined,
        processId: "",
        unitQuantity: 0,
        unitQuantity: 1,
        demandedQuantity: 0,
        children: [],
        unit: "",
@@ -518,4 +565,4 @@
    await fetchProcessOptions();
    await fetchData();
  });
</script>
</script>