main.vue 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <template>
  2. <div class="nt-charts" :class="{'van-charts-null': chartOptions.data.status != 2}">
  3. <!--type有19中loading模式(01-19)-->
  4. <nt-loading
  5. :class="chartOptions.class"
  6. v-if="chartOptions.data.status == 0"
  7. :type="'05'"
  8. />
  9. <div v-else-if="chartOptions.data.status == 2" style="height: 100%;">
  10. <div v-if="!!chartTitle" :style="titleStyle" :class="titleClass">{{chartTitle}}</div>
  11. <f2-extend-charts v-if="webUIType == 'f2'" :chartData="chartOptions.data"></f2-extend-charts>
  12. <nt-map-charts v-else-if="webUIType == 'map'" :chartData="chartOptions.data"></nt-map-charts>
  13. <nt-extend-charts v-else :options="chartOptions" :chartData="chartOptions.data" :className="className" :chartsId="chartsId"></nt-extend-charts>
  14. <slot name="botton"></slot>
  15. </div>
  16. <div class="nt-message" :class="chartOptions.class" v-else>{{chartOptions.data.message || '暂无数据!'}}</div>
  17. <slot name="legend"></slot>
  18. </div>
  19. </template>
  20. <script>
  21. import NtLoading from "@/components/thrid/em-element-ui/packages/loading"
  22. import { NtExtendCharts, F2ExtendCharts, NtMapCharts } from "./index.js";
  23. export default {
  24. name: "ntCharts",
  25. components: { NtLoading, NtExtendCharts, F2ExtendCharts, NtMapCharts },
  26. provide() {
  27. return {
  28. chart: this
  29. }
  30. },
  31. props: {
  32. className: {
  33. type: String,
  34. default: 'chart'
  35. },
  36. chartsId: {
  37. type: String,
  38. default: 'chart'
  39. },
  40. webUIType: {
  41. type: String,
  42. default: "f2"
  43. },
  44. chartTitle: {
  45. type: String,
  46. default: ''
  47. },
  48. titleStyle: {
  49. type: String,
  50. default: ''
  51. },
  52. titleClass: {
  53. type: String,
  54. default: ''
  55. },
  56. chartOptions: {
  57. type: Object,
  58. default: function() {
  59. return {};
  60. }
  61. },
  62. autoResize: {
  63. type: Boolean,
  64. default: true
  65. },
  66. dropdown: {
  67. type: Object,
  68. default: function() {
  69. return {};
  70. }
  71. }
  72. }
  73. };
  74. </script>
  75. <style lang="scss">
  76. .nt-charts, .nt-f2-charts{
  77. height: 100%;
  78. width: 100%;
  79. }
  80. .nt-message{
  81. display: flex;
  82. align-items: center;
  83. justify-content: center;
  84. height: inherit;
  85. color: #333;
  86. opacity: 0.5;
  87. font-size: 1.6rem;
  88. }
  89. </style>