zhangwencui
10 小时以前 f0e3b394502281cee53b4095fc637452204bf726
src/views/productionManagement/productStructure/Detail/index.vue
@@ -57,7 +57,7 @@
                  </el-form-item>
                </template>
              </el-table-column>
              <el-table-column prop="processId"
              <el-table-column prop="processName"
                               label="消耗工序">
                <template #default="{ row, $index }">
                  <el-form-item v-if="dataValue.isEdit"
@@ -242,6 +242,9 @@
      const setNameRecursively = items => {
        items.forEach(item => {
          item.tempId = item.id;
          item.processName =
            dataValue.processOptions.find(option => option.id === item.processId)
              ?.name || "";
          if (item.children && item.children.length > 0) {
            setNameRecursively(item.children);
          }
@@ -249,103 +252,6 @@
      };
      setNameRecursively(dataValue.dataList);
      console.log(dataValue.dataList, "dataValue.dataList");
      // dataValue.dataList = [
      //   {
      //     id: 30,
      //     productModelId: 220,
      //     processId: 42,
      //     unitQuantity: 0.0,
      //     demandedQuantity: 0.0,
      //     unit: "30",
      //     tenantId: 100,
      //     bomId: 5,
      //     processName: "测试1",
      //     productName: "1111",
      //     productId: 264,
      //     model: "1112233",
      //     productStructureList: null,
      //     children: [
      //       {
      //         id: 300,
      //         productModelId: 220,
      //         processId: 42,
      //         unitQuantity: 0.0,
      //         demandedQuantity: 0.0,
      //         unit: "300",
      //         tenantId: 100,
      //         bomId: 5,
      //         processName: "测试1",
      //         productName: "1111",
      //         productId: 264,
      //         model: "1112233",
      //         productStructureList: null,
      //         children: [
      //           {
      //             id: 3000,
      //             productModelId: 220,
      //             processId: 42,
      //             unitQuantity: 0.0,
      //             demandedQuantity: 0.0,
      //             unit: "3000",
      //             tenantId: 100,
      //             bomId: 5,
      //             processName: "测试1",
      //             productName: "1111",
      //             productId: 264,
      //             model: "1112233",
      //             productStructureList: null,
      //           },
      //           {
      //             id: 3200,
      //             productModelId: 221,
      //             processId: 43,
      //             unitQuantity: 0.0,
      //             demandedQuantity: 0.0,
      //             unit: "3200",
      //             tenantId: 100,
      //             bomId: 5,
      //             processName: "测试2",
      //             productName: "xxx",
      //             productId: 266,
      //             model: "xxx",
      //             productStructureList: null,
      //           },
      //         ],
      //       },
      //       {
      //         id: 320,
      //         productModelId: 221,
      //         processId: 43,
      //         unitQuantity: 0.0,
      //         demandedQuantity: 0.0,
      //         unit: "320",
      //         tenantId: 100,
      //         bomId: 5,
      //         processName: "测试2",
      //         productName: "xxx",
      //         productId: 266,
      //         model: "xxx",
      //         productStructureList: null,
      //       },
      //     ],
      //   },
      //   {
      //     id: 32,
      //     productModelId: 221,
      //     processId: 43,
      //     unitQuantity: 0.0,
      //     demandedQuantity: 0.0,
      //     unit: "32",
      //     tenantId: 100,
      //     bomId: 5,
      //     processName: "测试2",
      //     productName: "xxx",
      //     productId: 266,
      //     model: "xxx",
      //     productStructureList: null,
      //   },
      // ];
    }
  };
@@ -476,6 +382,7 @@
      model: undefined,
      productModelId: undefined,
      processId: "",
      processName: "",
      unitQuantity: 0,
      demandedQuantity: 0,
      unit: "",
@@ -524,6 +431,7 @@
          model: undefined,
          productModelId: undefined,
          processId: "",
          processName: "",
          unitQuantity: 0,
          demandedQuantity: 0,
          unit: "",
@@ -580,10 +488,11 @@
  const cancelEdit = () => {
    dataValue.isEdit = false;
    dataValue.dataList = dataValue.dataList.filter(item => item.id !== undefined);
    // dataValue.dataList = dataValue.dataList.filter(item => item.id !== undefined);
    fetchData();
  };
  onMounted(() => {
  onMounted(async () => {
    // 从路由参数回显数据
    tableData[0].productName = routeProductName.value;
    tableData[0].model = routeProductModelName.value;
@@ -594,7 +503,8 @@
      dataValue.isEdit = false;
    }
    fetchData();
    fetchProcessOptions();
    // 先加载工序选项,再加载数据,确保el-select能够正确回显
    await fetchProcessOptions();
    await fetchData();
  });
</script>