import pick from 'lodash.pick'
export const setwarehouse = {
  mounted() {
    this.SetWarehouse()
  },
  methods: {
    SetWarehouse() {
      let warehouse = this.$store.state.user.warehouse
      if (Object.keys(warehouse).length > 0) {
        if (this.$refs.phtml) {
          this.$refs.phtml.$refs.gridform.form.setFieldsValue(
            pick(warehouse, 'warehouseId', 'warehouseCode', 'warehouseName')
          )
        } else if (this.$refs.search) {
          this.$refs.search.form.setFieldsValue(pick(warehouse, 'warehouseId', 'warehouseCode', 'warehouseName'))
        } else if(this.$refs.searchTable) {
          this.$refs.searchTable.$refs.searchForm.$refs.formTarget.form.setFieldsValue(pick(warehouse, 'warehouseId', 'warehouseCode', 'warehouseName'))
        }
      }
    }
  }
}
