enterpriseDistribution.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <!--
  2. * @Author: your name
  3. * @Date: 2022-10-10 12:24:37
  4. * @LastEditTime: 2022-10-10 14:30:18
  5. * @LastEditors: D4THYL3
  6. * @Description: In User Settings Edit
  7. * @FilePath: \commandCenter\src\views\industrialInvestment\assembly\enterpriseDistribution.vue
  8. -->
  9. <template>
  10. <div :class="valueClass == 1 ? 'modelBlock' : 'modelBlock enlarge'">
  11. <div class="model-title">
  12. <div class="model-title-text">企业类型分布</div>
  13. </div>
  14. <div class="model-content">
  15. <zz-echart
  16. :option="clientOptions"
  17. class="chart"
  18. ></zz-echart>
  19. <div class="totals">
  20. <span class="fonst-color">{{ total }}</span>
  21. <span class="numbers fonst-color">企业总数</span>
  22. </div>
  23. </div>
  24. </div>
  25. </template>
  26. <script>
  27. import { ringType, ringTypeEnlarge } from './indexOptionChart';
  28. import index from './allcommunit';
  29. export default {
  30. mixins: [index],
  31. data () {
  32. return {
  33. mixins_query: {
  34. communityId: ''
  35. },
  36. valueClass: "",
  37. total: 0,
  38. clientOptions: ringType(
  39. [],
  40. [
  41. { value: 0, name: '餐饮业' },
  42. { value: 0, name: '互联网' },
  43. { value: 0, name: '金融业' },
  44. { value: 0, name: '服务业' },
  45. ],
  46. {},
  47. { type: '', total: 0 }
  48. )
  49. };
  50. },
  51. methods: {
  52. getData () {
  53. this.$http.get('/sc-community/statisticEnterpriseType', this.mixins_query).then(({ data, msg, status }) => {
  54. if (status == 0) {
  55. // this.clientOptions = ringType([], this.eachartObj(data), {}, { type: '', total: data.total });
  56. if (window.screen.width == 1920 || window.screen.width < 1920) {
  57. this.clientOptions = ringType([], this.eachartObj(data), {}, { type: '', total: data.total });
  58. } else if (window.screen.width == 2560 || window.screen.width > 1920) {
  59. this.clientOptions = ringTypeEnlarge([], this.eachartObj(data), {}, { type: '', total: data.total });
  60. }
  61. }
  62. });
  63. },
  64. eachartObj (data) {
  65. this.total = data.total;
  66. let typeName = {
  67. 1: '互联网',
  68. 2: '其他',
  69. 3: '政府/事业单位',
  70. 4: '服务业',
  71. 5: '餐饮业'
  72. };
  73. let newData = [];
  74. for (let a in data.datas) {
  75. newData.push({
  76. value: data.datas[a],
  77. name: a
  78. });
  79. }
  80. return newData;
  81. }
  82. },
  83. created () {
  84. if (window.screen.width == 1920 || window.screen.width < 1920) {
  85. this.valueClass = 1;
  86. this.clientOptions = ringType(
  87. [],
  88. [
  89. { value: 0, name: '餐饮业' },
  90. { value: 0, name: '互联网' },
  91. { value: 0, name: '金融业' },
  92. { value: 0, name: '服务业' },
  93. ],
  94. {},
  95. { type: '', total: 0 }
  96. );
  97. } else if (window.screen.width == 2560 || window.screen.width > 1920) {
  98. this.valueClass = 2;
  99. this.clientOptions = ringTypeEnlarge(
  100. [],
  101. [
  102. { value: 0, name: '餐饮业' },
  103. { value: 0, name: '互联网' },
  104. { value: 0, name: '金融业' },
  105. { value: 0, name: '服务业' },
  106. ],
  107. {},
  108. { type: '', total: 0 }
  109. );
  110. }
  111. this.getData();
  112. }
  113. };
  114. </script>
  115. <style lang="scss" scoped>
  116. @import '../style.scss';
  117. @import '../stylePc.scss';
  118. .fonst-color {
  119. color: #fff;
  120. }
  121. </style>