ModalRepoFormStore.js 695 Bytes
import { observable, useStrict, action } from 'mobx'

useStrict(true)

class ModalRepoFormStore {
  @observable elements = [
    { id: 1, name: "药库", initialPos: {x: 80, y: 70}, target_type: 'RegionalDesign::Repo' },
    { id: 2, name: "药架", initialPos: {x: 80, y: 70 + 60}, target_type: 'RegionalDesign::DrugRepo' },
    { id: 3, name: "药架格", initialPos: {x: 80, y: 70 + 60 * 2}, target_type: 'RegionalDesign::DrugBrandreth' }
  ]

  @action cloneElement(element) {
    this.elements.push(element)
  }

  @action deleteElement(element) {
    this.elements.remove(element)
  }

  @action deleteLastElement() {
    this.elements.pop()
  }
}

export default new ModalRepoFormStore()