<template>
  <SimpleList ref="list" v-bind="$attrs" :params="queryParams" :queryMethod="listDetail()" @change="$emit('change', $event)">
    <template slot="header">
      <el-input
        v-model="queryParams.cargoInfo"
        style="margin-bottom: 10px;"
        placeholder="搜索货物名称"
        clearable
        @keyup.enter.native="handleSearch"
      >
        <el-button slot="append" icon="el-icon-search" @click="handleSearch" />
      </el-input>
    </template>
    <el-table-column label="货物名称" prop="cargoInfo" align="center" />
    <el-table-column label="重量(吨)" prop="cargoWeight" align="center" >
    </el-table-column>
  </SimpleList>
</template>

<script>
import { pageListCargo } from "@/api/order/cargo";
import SimpleList from '@/views/tm/components/SimpleList'

export default {
  name: 'CarriageCargoList',
  components: { SimpleList },
  props: {
    orderId: [String, Number]
  },
  data() {
    return {
      queryParams: {
        cargoInfo: '',
        orderId: '',
      }
    }
  },
  watch: {
    orderId: {
      handler(val) {
        this.queryParams.orderId = val;
      },
      immediate: true
    }
  },
  methods: {
    listDetail() {
      return pageListCargo
    },
    handleSearch(e) {
      this.$refs.list.handleSearch(e)
    },
    clearSelection() {
      this.$refs.list.clearSelection();
    }
  }
}
</script>
<style scoped lang="scss">
</style>
