audit-select-area.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <template>
  2. <div style="width:200px">
  3. <a-select v-model="onValue" placeholder="请选择业务领域" allow-clear @change="selseChange">
  4. <a-select-option v-for="(item, i) in list" :key="i" :value="item.id">{{
  5. item.name
  6. }}</a-select-option>
  7. </a-select>
  8. </div>
  9. </template>
  10. <script>
  11. import components from './_import-components/audit-select-area-import'
  12. import auditMaintainService from '../maintain/audit-maintain-service'
  13. export default {
  14. name: 'AuditSelectArea',
  15. metaInfo: {
  16. title: 'AuditSelectArea',
  17. },
  18. components,
  19. model: {
  20. prop: 'value',
  21. event: 'change',
  22. },
  23. props: {
  24. value: {
  25. type: [String, Number],
  26. default: '',
  27. },
  28. // 是否多选
  29. multiple: {
  30. type: Boolean,
  31. default: false,
  32. },
  33. // 是否禁用
  34. disabled: {
  35. type: Boolean,
  36. default: false,
  37. },
  38. // placeholder
  39. placeholder: {
  40. type: String,
  41. default: '请选择',
  42. },
  43. dataUrl: {
  44. type: String,
  45. default: '',
  46. },
  47. },
  48. data() {
  49. return {
  50. onValue: '',
  51. list: [],
  52. }
  53. },
  54. watch: {
  55. value(val) {
  56. this.onValue = val || undefined
  57. },
  58. },
  59. created() {
  60. this.initAreaList()
  61. this.onValue = this.value || undefined
  62. },
  63. methods: {
  64. initAreaList() {
  65. auditMaintainService.getAreaListAll().then((res) => {
  66. this.list = res.data
  67. })
  68. },
  69. selseChange() {
  70. this.$emit('change', this.onValue)
  71. },
  72. },
  73. }
  74. </script>
  75. <style module lang="scss">
  76. @use '@/common/design' as *;
  77. </style>