<template>
  <eagle-scheme class="p-3" :list="schemeList" :option="{ $http: $axios, url: '/overseas/price/sale', showActionBtnDelete: false }" @selection="handleSelection">
    <template #search-enableFlag="{ model }">
      <eagle-select v-model="model.enableFlag" :dataSource="[{ label: '正常', value: true }, { label: '禁用', value: false }]"></eagle-select>
    </template>
    <el-table-column type="selection" width="50"></el-table-column>
    <template #action-btn-new>
      <el-button>按钮</el-button>
    </template>
    <template #form-label-code="{ label }">
      修改 - {{ label }}
    </template>
    <!-- <template #table-operation-btn-edit>
      <el-button class="eagle-scheme__table-btn" type="text">测试</el-button>
    </template> -->
    <template #table-append>
      <el-table-column prop="createTime" label="创建时间" min-width="180"></el-table-column>
      <el-table-column prop="createUser" label="创建人" min-width="160" show-overflow-tooltip></el-table-column>
      <el-table-column prop="modifyTime" label="修改时间" min-width="180"></el-table-column>
      <el-table-column prop="modifyUser" label="修改人" min-width="160" show-overflow-tooltip></el-table-column>
    </template>
  </eagle-scheme>
</template>

<script>
export default {
  name: 'basicStore',
  data() {
    return {
      schemeList: [
        { type: 'el-input', label: 'ID', key: 'id', include: 'form', visible: (model, { formMode } = {}) => { return formMode == 'edit' }, show: false,
          props: { disabled: true },
        },
        { type: 'el-input', label: '编码', key: 'code', default: '1231231321231',
          rules: [{ required: true, message: '编码不能为空', trigger: 'blur' }],
          props: { placeholder: '编码', disabled: (model, { formMode } = {}) => { return formMode == 'edit' } },
        },
        { type: 'el-input', label: '产品', key: 'productCode', agentKey: 'productName',
          rules: [{ required: true, message: '产品不能为空', trigger: 'blur' }],
          props: { url: '/overseas/product/select' },
        },
        { type: 'el-input-number', label: '价格', key: 'price', exclude: 'search',
          rules: [{ required: true, message: '价格不能为空', trigger: 'blur' }],
          props: { placeholder: '价格' },
        },
        { type: 'el-input', label: '价格说明', key: 'note', exclude: 'search',
          props: { placeholder: '价格说明' },
        },
        { type: 'el-input', label: '出发城市', key: 'fromCity', exclude: 'search',
          rules: [{ required: true, message: '出发城市不能为空', trigger: 'change' }],
          props: { dictionaryCode: 'FROM_CITY_LIST' },
        },
        { type: 'el-input', label: '目的地', key: 'toCountry', exclude: 'search',
          rules: [{ required: true, message: '目的地不能为空', trigger: 'change' }],
          props: { dictionaryCode: 'TO_COUNTRY' },
        },
        { type: 'el-input', label: '状态', key: 'enableFlag', span: 24, searchScheme: { span: 6 },
          formatter: (r, c, v) => v ? '正常' : '禁用'
        },
        { type: 'el-date-picker', label: '生效时间', key: 'enabledTime', exclude: 'search', minWidth: '180',
          rules: [{ required: true, message: '生效时间不能为空', trigger: 'change' }],
          props: { type: 'datetime', placeholder: '生效时间', 'value-format': 'yyyy-MM-dd HH:mm:ss' },
        },
        { type: 'el-date-picker', label: '禁用时间', key: 'disabledTime', exclude: 'search', minWidth: '180',
          rules: [{ required: true, message: '禁用时间不能为空', trigger: 'change' }],
          props: { type: 'datetime', placeholder: '禁用时间', 'value-format': 'yyyy-MM-dd HH:mm:ss' },
        },
      ],
    }
  },
  methods: {
    handleSelection(selection) {
      console.log(selection);
    }
  }
}
</script>