<template>
  <div>
    <el-button size="small" type="text" @click="onShow(visible = true)">编 辑</el-button>
    <el-drawer
      append-to-body
      title="新建"
      :visible.sync="visible"
      direction="rtl"
      size="500px"
      @close="cancelDrawer">
      <div class="drawer__panel">
         <el-row :gutter="20">
          <el-form :model="form" ref="form" label-width="85px" label-position="right" size="mini">
            <el-col :span="24">
              <el-form-item label="企业名称:">
                <el-input v-model="form.abbreviation" readonly placeholder="输入企业名称"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="快递100ID:" prop="kd100id">
                <el-input v-model="form.kd100id" placeholder="输入快递100ID"></el-input>
              </el-form-item>
            </el-col>
          </el-form>
        </el-row>
      </div>
      <div class="fixed__btn__panel">
        <el-button size="small" @click="visible = false" class="normal-btn-width">取 消</el-button>
        <el-button size="small" type="primary" @click="onSubmit" class="normal-btn-width">确 定</el-button>
      </div>
    </el-drawer>
  </div>
</template>

<script>
export default {
  props:['data'],
  components:{
  },
  data () {
    return {
      visible:false,
      popover:false,
      form:{
        "sa_logiscompid":0,//传0时新增
        "sys_enterpriseid": 0,//传0时新增
        "kd100id": "",
        "province":"",
        "city":"",
        "county":"",
        "address":"",
        "enterprisename":"",
        "abbreviation":"",
        "taxno":"",
        "grade":1,
        "industry":"",
        "contact":"",
        "phonenumber":""
      }
    }
  },
  methods:{
    onShow () {
      this.form = Object.assign({},this.form,this.data)
    },
    cascaderChange (val) {
      if (val.length === 1) 
        return this.form = Object.assign({},this.form,{province:val[0],city:'',county:''})

      this.form = Object.assign({},this.form,{province:val[0],city:val[1],county:val[2]})
      
    },
    rowClick (row) {
      this.form = Object.assign({},this.form,row)
    },
    cancelDrawer () {
      this.form = {}
    },
    async onSubmit () {
      const res = await this.$api.requested({
        "id": "20221121135704",
        "content": this.form
      })
      this.tool.showMessage(res,()=>{
        this.visible = false
        this.$emit('onSuccess')
      })
    }
   
  }
}

</script>
<style>
</style>