rentalAndSaleRate.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <div :class="valueClass == 1 ? 'modelBlock' : 'modelBlock enlarge'">
  3. <template v-if="permissionFiltering">
  4. <div class="model-title">
  5. <div class="model-title-text">房屋租售率</div>
  6. </div>
  7. <div class="model-content">
  8. <zz-echart
  9. :option="clientOptions"
  10. class="chart"
  11. ></zz-echart>
  12. <div class="totals">
  13. <span>{{ total }}</span>
  14. <span class="numbers">房屋总数</span>
  15. </div>
  16. </div>
  17. </template>
  18. <no-permission
  19. v-else
  20. tipsText="房屋租售率"
  21. ></no-permission>
  22. </div>
  23. </template>
  24. <script>
  25. import { ringType, ringTypeEnlarge } from './indexOptionChart';
  26. import permissionComponent from './permissionComponent';
  27. let defaultTitle = {
  28. text: `{a|租售率}`,
  29. left: 'center',
  30. top: '35%',
  31. left: '18%',
  32. subtextStyle: {
  33. rich: {
  34. b: {
  35. fontSize: 20,
  36. color: '#fff'
  37. }
  38. }
  39. },
  40. textStyle: {
  41. color: '#ccc',
  42. rich: {
  43. a: {
  44. fontSize: 12,
  45. color: '#858892',
  46. padding: [0, 0, 0, 3]
  47. }
  48. }
  49. }
  50. };
  51. let defaultTitleEnlarge = {
  52. text: `{a|租售率}`,
  53. left: 'center',
  54. top: '40%',
  55. left: '19%',
  56. subtextStyle: {
  57. rich: {
  58. b: {
  59. fontSize: 20,
  60. color: '#fff'
  61. }
  62. }
  63. },
  64. textStyle: {
  65. color: '#ccc',
  66. rich: {
  67. a: {
  68. fontSize: 14,
  69. color: '#858892',
  70. padding: [0, 0, 0, 3]
  71. }
  72. }
  73. }
  74. };
  75. export default {
  76. mixins: [permissionComponent],
  77. data () {
  78. return {
  79. valueClass: '',
  80. mixins_query: {
  81. communityId: ''
  82. },
  83. defaultModel: {
  84. permissUrl: '11',
  85. titleName: '房产管理'
  86. },
  87. total: 0,
  88. defaultTitle: {
  89. text: `{a|租售率}`,
  90. left: 'center',
  91. top: '35%',
  92. left: '18%',
  93. subtextStyle: {
  94. rich: {
  95. b: {
  96. fontSize: 20,
  97. color: '#fff'
  98. }
  99. }
  100. },
  101. textStyle: {
  102. color: '#ccc',
  103. rich: {
  104. a: {
  105. fontSize: 12,
  106. color: '#858892',
  107. padding: [0, 0, 0, 3]
  108. }
  109. }
  110. }
  111. },
  112. clientOptions: ringType(
  113. [],
  114. [
  115. { name: '待租售', value: 0 },
  116. { name: '已售', value: 0 },
  117. { name: '已租', value: 0 }
  118. ],
  119. { subtext: `{b|0%}`, ...defaultTitle }
  120. )
  121. };
  122. },
  123. methods: {
  124. getData () {
  125. this.$http.get('/sc-community/statisticsaleRate', this.mixins_query).then(({ data, msg, status }) => {
  126. if (status == 0) {
  127. if (window.screen.width == 1920 || window.screen.width < 1920) {
  128. this.clientOptions = ringType([], this.eachartObj(data), {
  129. subtext: `{b|${parseInt(((data.datas[1] + data.datas[2]) / data.total).toFixed(2) * 100) || 0 * 100}%}`,
  130. ...defaultTitle
  131. });
  132. } else if (window.screen.width == 2560 || window.screen.width > 1920) {
  133. this.clientOptions = ringTypeEnlarge([], this.eachartObj(data), {
  134. subtext: `{b|${parseInt(((data.datas[1] + data.datas[2]) / data.total).toFixed(2) * 100) || 0 * 100}%}`,
  135. ...defaultTitleEnlarge
  136. });
  137. }
  138. }
  139. });
  140. },
  141. eachartObj (data) {
  142. this.total = data.total;
  143. let typeName = {
  144. 0: '待租售',
  145. 1: '已售',
  146. 2: '已租'
  147. };
  148. let newData = [];
  149. for (let a in data.datas) {
  150. newData.push({
  151. value: data.datas[a],
  152. name: typeName[a]
  153. });
  154. }
  155. return newData;
  156. }
  157. },
  158. created () {
  159. // this.mixins_query.date = this.$moment().format('YYYY');
  160. if (window.screen.width == 1920 || window.screen.width < 1920) {
  161. this.valueClass = 1;
  162. this.clientOptions = ringType([],
  163. [
  164. { name: '待租售', value: 0 },
  165. { name: '已售', value: 0 },
  166. { name: '已租', value: 0 }
  167. ],
  168. { subtext: `{b|0%}`, ...defaultTitle })
  169. } else if (window.screen.width == 2560 || window.screen.width > 1920) {
  170. this.valueClass = 2;
  171. this.clientOptions = ringTypeEnlarge([],
  172. [
  173. { name: '待租售', value: 0 },
  174. { name: '已售', value: 0 },
  175. { name: '已租', value: 0 }
  176. ],
  177. { subtext: `{b|0%}`, ...defaultTitleEnlarge });
  178. }
  179. this.getData();
  180. }
  181. };
  182. </script>
  183. <style scoped lang="scss">
  184. @import './style.scss';
  185. @import './stylePc.scss';
  186. </style>