| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <template>
- <el-select
- :value="value"
- filterable
- remote
- placeholder="请输入关键词"
- :loading="loading"
- :remote-method="remoteMethod"
- clearable
- @change="onChange"
- >
- <el-option
- v-for="item in options"
- :key="item.id"
- :label="item.acceptorName"
- :value="item.id"
- />
- </el-select>
- </template>
- <script>
- import { acceptorSearchApi } from '@/api/contracts'
- export default {
- name: 'AcceptorSelect',
- props: {
- value: {
- type: [String, Number, Array],
- default: undefined
- }
- },
- data() {
- return {
- filter: {
- status:1, // 已删除的承兑人不展示
- pageIndex: 1,
- pageSize: 100
- },
- options: [],
- loading: false
- }
- },
- mounted() {
- this.loadData()
- },
- methods: {
- loadData(filter = {}) {
- const params = {
- ...this.filter,
- ...filter
- }
- this.loading = true
- acceptorSearchApi(params).then(res => {
- const result = res.data.result
- this.options = result
- this.loading = false
- console.log(res)
- }).catch(err => {
- console.log(err)
- this.loading = false
- })
- },
- remoteMethod(query) {
- this.loadData({ name: query })
- },
- onChange(value) {
- this.emitInput(value)
- },
- emitInput(value) {
- const exist = this.options.find((o) => o.id === value)
- this.$emit('input', value)
- this.$emit('change', value, exist)
- }
- }
- }
- </script>
|