hyingbo
5 天以前 57ec2038f86f47a87db6b73c0c6eb27c1c25b08e
src/views/tms/WarehouseList.vue
@@ -268,7 +268,20 @@
    },
    methods: {
      handleAdd: function () {
        const nextSeq = Number(this.dataSource[this.dataSource.length - 1].seq) + 1
        let nextSeq = 0;
        // 安全的写法
        if (this.dataSource && this.dataSource.length > 0) {
          const lastItem = this.dataSource[this.dataSource.length - 1];
          if (lastItem && lastItem.seq !== undefined) {
            nextSeq = Number(lastItem.seq) + 1;
          } else {
            // 处理最后一个元素不存在seq的情况
            nextSeq = 0; // 或其他默认值
          }
        } else {
          // 处理数组为空的情况
          nextSeq = 0; // 或其他默认值
        }
        this.$refs.modalForm.add(nextSeq);
        this.$refs.modalForm.title = "新增";
        this.$refs.modalForm.disableSubmit = false;