<template>
  <vxe-modal v-model="dialogVisible" width="600" title="选择目标船只">
    <template #default>
      <el-row class="query_wrapper">
        <el-row>
          <el-button size="small" style="float: right;margin-bottom: 5px;margin-right: 5px;" type="success"
                     @click="saveByDcch">保存
          </el-button>
        </el-row>
      </el-row>
      <div class="mytable">
        <vxe-table
          ref="tableRef"
          auto-resize
          show-header-overflow
          show-overflow
          height="300"
          :row-config="{isHover: true}"
          :column-config="{resizable: true}"
          :data="selectMbch.no_tlt_ch">
          <vxe-column type="seq" width="50"></vxe-column>
          <vxe-column field="dcCh" title="船号" width="150"></vxe-column>
          <vxe-column align="center" field="dcCh1" title="目标船号" width="300">
            <template #default="{ row }">
              <vxe-select v-model="row.dcCh1" style="width: 80%;height: 30px;margin-bottom: 2px" transfer>
                <vxe-option
                  v-for="item in haveTltBoms"
                  :key="item.dcch"
                  :value="item.dcch"
                  :label="item.dcch"
                />
              </vxe-select>
            </template>
          </vxe-column>
        </vxe-table>
      </div>
    </template>
  </vxe-modal>
</template>

<script>
import {saveByDcch} from "@/api/jhzx/sygd";

export default {
  name:'SelectShipModal',
  data(){
    return{
      dialogVisible:false,
      title:'',
      selectMbch:[],
      haveTltBoms:[],
    }
  },
  methods:{
    saveByDcch() {
      saveByDcch(this.selectMbch).then((res) => {
        this.list = res.data
        if (this.$refs.xGrid) {
          this.$refs.xGrid.loadData(this.list)
        }
      })
      this.dialogVisible = false;
    },
  }
}
</script>
