BusinessScopeSelector.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <selector-card
  3. class="business-scope-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. <BusinessScopeSelectorContent
  12. ref="content"
  13. :selectorType="selectorType"
  14. :initList="initList"
  15. @onChange="onChange"
  16. />
  17. </selector-card>
  18. </template>
  19. <script>
  20. import SelectorCard from '@/components/selector/SelectorCard.vue'
  21. import BusinessScopeSelectorContent from '@/components/selector/BusinessScopeSelectorContent.vue'
  22. export default {
  23. name: 'business-scope-selector',
  24. components: {
  25. SelectorCard,
  26. BusinessScopeSelectorContent
  27. },
  28. props: {
  29. selectorType: {
  30. type: String,
  31. default: 'line'
  32. },
  33. initList: {
  34. type: Array,
  35. default () {
  36. return []
  37. }
  38. }
  39. },
  40. data () {
  41. return {}
  42. },
  43. watch: {
  44. initList () {
  45. this.$nextTick(() => {
  46. this.$refs.content.init()
  47. })
  48. }
  49. },
  50. created () {},
  51. methods: {
  52. setState (data) {
  53. return this.$refs.content.setState(data)
  54. },
  55. getState () {
  56. return this.$refs.content.getState()
  57. },
  58. onCancel () {
  59. this.$emit('onCancel')
  60. },
  61. onConfirm () {
  62. const state = this.getState()
  63. this.$emit('onConfirm', state)
  64. },
  65. onChange (state) {
  66. this.$emit('onChange', state)
  67. }
  68. }
  69. }
  70. </script>