cuijian
2023-10-25 fa921a7f2a42a4215299b79a995aad18a6225f74
src/views/eam/modules/equipmentScrap/EquipmentScrapForm.vue
@@ -23,6 +23,7 @@
              <a-input
                v-model="model.num"
                placeholder="将由系统自动生成"
                disabled
              ></a-input>
            </a-form-model-item>
          </a-col>
@@ -455,17 +456,8 @@
    })
  },
  created() {
    this.initNum()
  },
  methods: {
    initNum() {
      getAction(this.url.getNum, { type: 'EquipmentScrap', length: '4' }).then((res) => {
        if (res.success) {
          this.model.num = res.message
        }
      })
    },
    //选择设备
    selectEquipmentList() {
@@ -530,6 +522,12 @@
      if (this.model.id) {
        let params = { equipmentChangeId: this.model.id }
        this.requestSubTableData(this.url.equipmentScrapDetail.list, params, this.equipmentScrapDetailTable)
      }else{
        getAction(this.url.getNum, { type: 'EquipmentScrap', length: '4' }).then((res) => {
          if (res.success) {
            this.model.num = res.message
          }
        })
      }
    },
    //校验所有一对一子表表单
@@ -608,39 +606,39 @@
      target.removeRows(rowId)
    },
    // 重写add  方法 默认不增加一行
    add(num = 0, forceScrollToBottom = false) {
      if (num < 1) return
      // let timestamp = new Date().getTime()
      let rows = this.rows
      let row
      for (let i = 0; i < num; i++) {
        rows = this.push({}, false, rows)
        row = rows[rows.length - 1]
      }
      this.rows = rows
    // add(num = 0, forceScrollToBottom = false) {
    //   if (num < 1) return
    //   // let timestamp = new Date().getTime()
    //   let rows = this.rows
    //   let row
    //   for (let i = 0; i < num; i++) {
    //     rows = this.push({}, false, rows)
    //     row = rows[rows.length - 1]
    //   }
    //   this.rows = rows
      this.$nextTick(() => {
        this.updateFormValues()
      })
      // 触发add事件
      this.$emit('added', {
        row: (() => {
          let r = Object.assign({}, row)
          r.id = this.getCleanId(r.id)
          return r
        })(),
        target: this
      })
      // 设置滚动条位置
      let tbody = this.getElement('tbody')
      let offsetHeight = tbody.offsetHeight
      let realScrollTop = tbody.scrollTop + offsetHeight
      if (forceScrollToBottom) {
        this.$nextTick(() => {
          this.resetScrollTop(this.$refs.scrollView.scrollHeight)
        })
      }
    }
    //   this.$nextTick(() => {
    //     this.updateFormValues()
    //   })
    //   // 触发add事件
    //   this.$emit('added', {
    //     row: (() => {
    //       let r = Object.assign({}, row)
    //       r.id = this.getCleanId(r.id)
    //       return r
    //     })(),
    //     target: this
    //   })
    //   // 设置滚动条位置
    //   let tbody = this.getElement('tbody')
    //   let offsetHeight = tbody.offsetHeight
    //   let realScrollTop = tbody.scrollTop + offsetHeight
    //   if (forceScrollToBottom) {
    //     this.$nextTick(() => {
    //       this.resetScrollTop(this.$refs.scrollView.scrollHeight)
    //     })
    //   }
    // }
  }
}