IndustrySelector.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <selector-card
  3. class="industry-selector"
  4. :cardType="selectorType"
  5. @onConfirm="onConfirm"
  6. @onCancel="onCancel"
  7. >
  8. <div slot="header" :class="{ 's-header': selectorType === 'line' }">
  9. <slot name="header">选择行业分类</slot>
  10. </div>
  11. <IndustrySelectorContent
  12. ref="content"
  13. @onChange="onChange"
  14. :dataType="dataType"
  15. :selectorType="selectorType"
  16. :initIndustry="initIndustry"
  17. />
  18. </selector-card>
  19. </template>
  20. <script>
  21. import SelectorCard from '@/components/selector/SelectorCard.vue'
  22. import IndustrySelectorContent from '@/components/selector/IndustrySelectorContent.vue'
  23. export default {
  24. name: 'industry-selector',
  25. components: {
  26. SelectorCard,
  27. IndustrySelectorContent
  28. },
  29. props: {
  30. selectorType: {
  31. type: String,
  32. default: 'card'
  33. },
  34. dataType: {
  35. type: String,
  36. default: 'industry'
  37. },
  38. initIndustry: {
  39. type: Object,
  40. default () {
  41. return {}
  42. }
  43. }
  44. },
  45. data () {
  46. return {}
  47. },
  48. created () {},
  49. methods: {
  50. setIndustryState (data) {
  51. return this.$refs.content.setIndustryState(data)
  52. },
  53. getSelected () {
  54. return this.$refs.content.getSelected()
  55. },
  56. onCancel () {
  57. this.$emit('onCancel')
  58. },
  59. onConfirm () {
  60. const selected = this.getSelected()
  61. this.$emit('onConfirm', selected)
  62. },
  63. onChange (selected) {
  64. this.$emit('onChange', selected)
  65. }
  66. }
  67. }
  68. </script>
  69. <style lang="scss" scoped>
  70. </style>