distributionSuggestion.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template>
  2. <div class="modelBlock">
  3. <template v-if="permissionFiltering">
  4. <div class="model-title">
  5. <div class="model-title-text">投诉建议类型分布</div>
  6. <div class="model-title-right">
  7. <el-date-picker
  8. value-format="yyyy-MM"
  9. v-model="date"
  10. type="month"
  11. placeholder="选择月"
  12. class="saveColumn-select"
  13. @change="changeTime"
  14. :clearable="false"
  15. >
  16. </el-date-picker>
  17. </div>
  18. </div>
  19. <div class="model-content">
  20. <zz-echart
  21. :option="clientOptions"
  22. class="chart"
  23. ></zz-echart>
  24. <div class="totals">
  25. <span class="size-color">{{ total }}</span>
  26. <span class="numbers size-color">任务总数</span>
  27. </div>
  28. </div>
  29. </template>
  30. <no-permission
  31. v-else
  32. tipsText="投诉建议类型分布"
  33. ></no-permission>
  34. </div>
  35. </template>
  36. <script>
  37. import { GradualChange, ringType } from '../indexOptionChart';
  38. import permissionComponent from '../permissionComponent';
  39. const colors = [
  40. GradualChange('#22D8FF', '#00B2FF'),
  41. GradualChange('#F0646C', '#F4994E'),
  42. GradualChange('#5EEDCC ', '#24C3F1'),
  43. GradualChange('#7178FF', '#D2A4FF'),
  44. GradualChange('#884DD2', '#DF63CC')
  45. ];
  46. export default {
  47. mixins: [permissionComponent],
  48. data () {
  49. return {
  50. defaultModel: {
  51. permissUrl: '17',
  52. titleName: '运维工单'
  53. },
  54. mixins_query: {
  55. communityId: '',
  56. date: '',
  57. },
  58. date: '',
  59. total: 0,
  60. clientOptions: ringType(
  61. colors,
  62. [
  63. { value: 0, name: '扰民投诉' },
  64. { value: 0, name: '物业投诉' },
  65. { value: 0, name: '公共卫生' },
  66. { value: 0, name: '安全建议' },
  67. { value: 0, name: '其他' }
  68. ],
  69. {},
  70. { type: 'number', total: 0 }
  71. )
  72. };
  73. },
  74. methods: {
  75. getData () {
  76. this.$http.get('/sc-community-web/statisticComplaint', this.mixins_query).then(({ data, msg, status }) => {
  77. if (status == 0 && !!data.datas) {
  78. this.clientOptions = ringType(colors, this.eachartObj(data), {}, { type: 'number', total: data.total });
  79. }
  80. })
  81. },
  82. changeTime (v) {
  83. this.mixins_query.date = v + '-01';
  84. this.getData();
  85. },
  86. eachartObj (data) {
  87. this.total = data.total || 0;
  88. let newData = [];
  89. let DataName = {
  90. 1: '扰民投诉',
  91. 2: '物业投诉',
  92. 3: '公共卫生',
  93. 4: '安全建议',
  94. 5: '其他'
  95. }
  96. for (let a in data.datas) {
  97. newData.push({
  98. value: data.datas[a],
  99. name: DataName[a]
  100. });
  101. }
  102. return newData;
  103. }
  104. },
  105. created () {
  106. this.mixins_query.date = this.$moment().format('YYYY-MM') + '-01';
  107. this.date = this.$moment().format('YYYY-MM');
  108. this.getData();
  109. }
  110. };
  111. </script>
  112. <style lang="scss" scoped>
  113. @import '@assets/css/public-style.scss';
  114. .size-color {
  115. color: #fff;
  116. }
  117. .modelBlock {
  118. height: 100%;
  119. padding: rem(15) rem(20) rem(20);
  120. background: #171f32;
  121. .model-title {
  122. line-height: rem(30);
  123. display: flex;
  124. justify-content: space-between;
  125. padding-bottom: rem(15);
  126. border-bottom: 1px solid rgba(224, 225, 227, 0.2);
  127. .saveColumn-select {
  128. width: rem(120);
  129. margin-left: rem(20);
  130. /deep/ .el-input__inner {
  131. background: transparent;
  132. color: white;
  133. border-color: rgba(255, 255, 255, 0.2);
  134. }
  135. }
  136. .model-title-text {
  137. color: white;
  138. }
  139. }
  140. .model-content {
  141. height: calc(100% - #{rem(45)});
  142. display: flex;
  143. justify-content: space-between;
  144. font-size: 12px;
  145. position: relative;
  146. .totals {
  147. position: absolute;
  148. right: rem(10);
  149. top: rem(26);
  150. width: rem(120);
  151. height: rem(40);
  152. background: linear-gradient(90deg, rgba(14, 174, 255, 0.5) 0%, rgba(14, 174, 255, 0) 100%);
  153. border-radius: 5px;
  154. font-size: 20px;
  155. padding: rem(8) rem(10);
  156. display: flex;
  157. justify-content: space-between;
  158. .numbers {
  159. font-size: 12px;
  160. opacity: 0.5;
  161. line-height: rem(32);
  162. }
  163. }
  164. }
  165. }
  166. </style>