customerService.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <a-select
  3. :size="size"
  4. :value="bizUserSnVal"
  5. :placeholder="placeholder"
  6. style="width: 100%"
  7. :filter-option="false"
  8. :not-found-content="fetching ? undefined : null"
  9. :dropdownMatchSelectWidth="false"
  10. @change="handleChange"
  11. allowClear
  12. :disabled="disabled"
  13. notFoundContent="暂无数据"
  14. >
  15. <a-spin v-if="fetching" slot="notFoundContent" size="small" />
  16. <a-select-option v-for="item in customerData" :key="item.id" :value="item.bizUserSn">
  17. {{ item.userName }}
  18. </a-select-option>
  19. </a-select>
  20. </template>
  21. <script>
  22. import { queryUnderlingKf } from '@/api/bizuser'
  23. export default {
  24. props: {
  25. value: {
  26. type: [String, Array],
  27. defatut: ''
  28. },
  29. size: {
  30. type: String,
  31. default: 'default'
  32. },
  33. placeholder: {
  34. type: String,
  35. default: '请选择客服名称'
  36. },
  37. disabled: {
  38. type: Boolean,
  39. default: false
  40. }
  41. },
  42. data () {
  43. return {
  44. customerData: [],
  45. bizUserSnVal: this.value,
  46. fetching: false
  47. }
  48. },
  49. mounted () {
  50. this.getListData()
  51. },
  52. watch: {
  53. value (newValue, oldValue) {
  54. this.bizUserSnVal = newValue
  55. }
  56. },
  57. methods: {
  58. getListData () {
  59. queryUnderlingKf({}).then(res => {
  60. this.customerData = res.data ? res.data : []
  61. this.$store.state.app.isShowCustomerSearch = res.data && res.data.length > 0
  62. })
  63. },
  64. handleChange (value) {
  65. this.bizUserSnVal = value
  66. this.$emit('change', value)
  67. this.$emit('input', value)
  68. },
  69. resetForm () {
  70. this.bizUserSnVal = undefined
  71. }
  72. }
  73. }
  74. </script>