| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <template>
- <el-select
- v-model="selected"
- v-bind="$attrs"
- :loading="loading"
- @change="change"
- >
- <el-option
- v-for="item in options"
- :key="item.id"
- :label="item.name"
- :value="item.code"
- >
- <el-row :gutter="20">
- <el-col :span="12">{{ item.code }}</el-col>
- <el-col :span="12" class="text-right">{{ item.name }}</el-col>
- </el-row>
- </el-option>
- </el-select>
- </template>
- <script>
- import { getDepartmentList } from '@/api/wms/incoming/register'
- export default {
- props: {
- value: {
- type: [String, Number],
- default: ''
- },
- inspectionType: {
- type: Number,
- default: 0
- }
- },
- data() {
- return {
- options: [],
- loading: false
- }
- },
- computed: {
- selected: {
- get() {
- return this.value
- },
- set(v) {
- this.$emit('input', v)
- }
- }
- },
- created() {
- this.fetchCustomerList()
- },
- methods: {
- fetchCustomerList() {
- this.loading = true
- const params = {
- pageNo: 1,
- pageSize: 100
- }
- getDepartmentList(params).then(res => {
- const { list = [] } = res.data || {}
- this.options = list
- }).finally(() => {
- this.loading = false
- })
- },
- change(value) {
- const item = this.options.find(item => item.code === value)
- this.$emit('change', item)
- }
- }
- }
- </script>
- <style>
- </style>
|