hyingbo
5 天以前 57ec2038f86f47a87db6b73c0c6eb27c1c25b08e
src/views/tms/WarehouseList.vue
@@ -267,6 +267,25 @@
      this.$bus.$off('getCurrSelected', this.handleGetCurrSelected);
    },
    methods: {
      handleAdd: function () {
        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;
      },
      handleStatus(record) {
        getAction(this.url.list, { parentId: record.id }).then((res) => {
          if (res.success) {