<template>
  <div class="oYeWarehouse">
    <div class="search">
      <el-button type="primary" @click="insert">新增</el-button>
    </div>
    <div class="table">
      <dilTable v-bind.sync="options"></dilTable>
    </div>
    <div class="dialog">
      <el-dialog append-to-body title="新增" :visible.sync="dialogVisible">
        <el-form>
          <el-form-item label="厂外库大类" prop="warehouseArea">
            <el-input v-model="insertForm.warehouseArea"></el-input>
          </el-form-item>
          <el-form-item label="具体仓库" prop="warehouseArea">
            <el-input v-model="insertForm.warehouseName"></el-input>
          </el-form-item>
          <el-form-item label="承运商" prop="warehouseArea">
            <el-input
              v-model="insertForm.carrierName"
              placeholder="请复制承运商名称"
            ></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="makeSureInsertForm"
              >确定</el-button
            >
          </el-form-item>
        </el-form>
      </el-dialog>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      dialogVisible: false,
      options: {
        requestUrl: '/api/v1/ams/getOyeWarehouse?apiId=532'
      },
      con: '',
      insertForm: {
        warehouseArea: '欧冶库',
        warehouseName: ''
      }
    }
  },
  methods: {
    insert() {
      this.dialogVisible = true
    },
    makeSureInsertForm() {
      console.log(this.insertForm, 'insertForm')
      this.axios
        .post('/api/v1/ams/insertOyeWarehouse', this.insertForm)
        .then(res => {
          if (res.data.status == 'succeed') {
            this.dialogVisible = false
            this.$message.success('新增成功')
            this.options.requestUrl =
              '/api/v1/ams/getOyeWarehouse?apiId=532&i=' + new Date()
          } else {
            this.$message.error('新增失败')
          }
        })
      // this.dialogVisible = false
    }
  }
}
</script>
<style lang="scss" scoped>
.oYeWarehouse {
  .search {
    margin-left: 10px;
    margin-top: 10px;
  }
  .table {
    margin-left: 10px;
    margin-top: 10px;
  }
}
</style>
