// import { warehouseDetails } from '@/api/stockManagement/warehouseDefinition'
// import user from '@/api/main/user';
export default {
  data() {
    return {
      id: ''
    };
  },
  created() {
    this.id = this.$route.query.id;
    if (this.id) {
      this.isEdit = true;
      this.ownerNameDisabled = false;
      this.areaDisabled = false;
      this.addressDisabled = false;
      this.getDetails();
    }
  },
  methods: {
    getDetails() {
      let res = warehouseDetails({ id: this.id });
      if (res.success) {
        for (var i in this.form) {
          if (i === 'status' || i === 'inventoryType') {
            res.data.warehouse[i] = res.data.warehouse[i].toString();
          }
          this.$set(this.form, i, res.data.warehouse[i]);
        }
        console.log(this.form.departmentCode);
        this.areaForm.warehouseAreasSaveList = res.data.warehouseAreaList;
        this.areaForm.areaGoodsshelvesList =
          res.data.warehouseAreaGoodsshelvesList;
        this.areaForm.allocationReqList = res.data.allocationList;
        if (this.form.departmentCode) this.getUserInfo();
      }
    },
    getUserInfo() {
      let res = user.user({ deptCode: this.form.departmentCode });
      this.staffList = res.data;
    }
  }
};
