index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <div class="basic-component-button">
  3. <el-button
  4. :type="config.customize.type"
  5. :round="config.customize.isRound"
  6. :plain="config.customize.isPlain"
  7. :loading="config.customize.isLoading"
  8. :style="{
  9. backgroundColor: config.customize.type ? null : config.customize.backgroundColor,
  10. borderColor: config.customize.borderStyle.borderColor,
  11. borderWidth: config.customize.borderStyle.borderWidth + 'px',
  12. borderStyle: config.customize.borderStyle.borderStyle,
  13. borderRadius: config.customize.borderStyle.borderRadius + 'px'
  14. }"
  15. :icon="config.customize.icon.position === 'left' ? config.customize.icon.name : ''"
  16. @click="handleClick"
  17. >
  18. <span :style="{ color: config.customize.fontColor, fontSize: config.customize.fontSize + 'px', }">
  19. {{ config.title }}
  20. <i
  21. v-if="config.customize.icon.position === 'right' && config.customize.icon.name"
  22. :class="config.customize.icon.name"
  23. />
  24. </span>
  25. </el-button>
  26. </div>
  27. </template>
  28. <script>
  29. import commonMixins from 'data-room-ui/js/mixins/commonMixins'
  30. import linkageMixins from 'data-room-ui/js/mixins/linkageMixins'
  31. import { mapState } from 'vuex'
  32. export default {
  33. name: 'BasicComponentButton',
  34. mixins: [commonMixins, linkageMixins],
  35. computed: {
  36. ...mapState({
  37. chartList: state => state.bigScreen.pageInfo.chartList
  38. })
  39. },
  40. props: {
  41. // 卡片的属性
  42. config: {
  43. type: Object,
  44. default: () => ({})
  45. },
  46. predefineThemeColors: {
  47. type: Array,
  48. default: () => {
  49. return [
  50. '#007aff',
  51. '#1aa97b',
  52. '#ff4d53',
  53. '#1890FF',
  54. '#DF0E1B',
  55. '#0086CC',
  56. '#2B74CF',
  57. '#00BC9D',
  58. '#ED7D32'
  59. ]
  60. }
  61. }
  62. },
  63. mounted () {
  64. // this.chartInit()
  65. },
  66. methods: {
  67. handleClick () {
  68. const bindComponentData = {}
  69. this.chartList.forEach(chart => {
  70. this.config.dataSource.dimensionFieldList.forEach(code => {
  71. if (chart.code === code) {
  72. bindComponentData[chart.code] = chart.customize.value
  73. }
  74. })
  75. })
  76. this.linkage(bindComponentData)
  77. }
  78. }
  79. }
  80. </script>
  81. <style lang="scss" scoped>
  82. .basic-component-button {
  83. width: 100%;
  84. height: 100%;
  85. .el-button {
  86. width: 100%;
  87. height: 100%;
  88. }
  89. }
  90. </style>