1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- import { pickUpLogisticsList } from '@/api/pickUp'
- const LogisticsCompany = {
- template: `
- <a-select
- :placeholder="placeholder"
- :id="id"
- allowClear
- :value="defaultVal"
- :showSearch="true"
- @change="handleChange"
- option-filter-prop="children"
- :filter-option="filterOption">
- <a-select-option v-for="item in list" :key="item.id" :value="item.logisticsCompany">
- {{ item.logisticsCompany }}
- </a-select-option>
- </a-select>
- `,
- props: {
- value: {
- type: String,
- defatut: ''
- },
- id: {
- type: String,
- default: ''
- },
- placeholder: {
- type: String,
- default: '请选择物流公司'
- },
- },
- data() {
- return {
- defaultVal: this.value,
- list: []
- };
- },
- mounted() {
- this.getList()
- },
- watch: {
- value(newValue, oldValue) {
- this.defaultVal = newValue
- },
- },
- methods: {
- filterOption (input, option) {
- return (
- option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
- )
- },
- handleChange(value) {
- this.defaultVal = value;
- const row = this.list.find(item => item.logisticsCompany == value)
- this.$emit('change', value, row);
- this.$emit('input', value);
- },
- getList () {
- pickUpLogisticsList({}).then(res => {
- if (res.status == 200) {
- this.list = res.data
- } else {
- this.list = []
- }
- })
- },
- getPoint(v){
- const row = this.list.find(item => item.logisticsCompany == v)
- return row ? row.logisticsPointList : []
- }
- },
- };
- export default LogisticsCompany
|