distributionSuggestion.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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. debugger
  88. this.total = data.total || 0;
  89. let newData = [];
  90. let DataName = {
  91. 1: '扰民投诉',
  92. 2: '物业投诉',
  93. 3: '公共卫生',
  94. 4: '安全建议',
  95. 5: '其他'
  96. }
  97. for (let a in data.datas) {
  98. newData.push({
  99. value: data.datas[a],
  100. name: DataName[a]
  101. });
  102. }
  103. return newData;
  104. }
  105. },
  106. created () {
  107. this.mixins_query.date = this.$moment().format('YYYY-MM') + '-01';
  108. this.date = this.$moment().format('YYYY-MM');
  109. this.getData();
  110. }
  111. };
  112. </script>
  113. <style lang="scss" scoped>
  114. @import '@assets/css/public-style.scss';
  115. .size-color {
  116. color: #fff;
  117. }
  118. .modelBlock {
  119. height: 100%;
  120. padding: rem(15) rem(20) rem(20);
  121. background: #171f32;
  122. .model-title {
  123. line-height: rem(30);
  124. display: flex;
  125. justify-content: space-between;
  126. padding-bottom: rem(15);
  127. border-bottom: 1px solid rgba(224, 225, 227, 0.2);
  128. .saveColumn-select {
  129. width: rem(120);
  130. margin-left: rem(20);
  131. /deep/ .el-input__inner {
  132. background: transparent;
  133. color: white;
  134. border-color: rgba(255, 255, 255, 0.2);
  135. }
  136. }
  137. .model-title-text {
  138. color: white;
  139. }
  140. }
  141. .model-content {
  142. height: calc(100% - #{rem(45)});
  143. display: flex;
  144. justify-content: space-between;
  145. font-size: 12px;
  146. position: relative;
  147. .totals {
  148. position: absolute;
  149. right: rem(10);
  150. top: rem(26);
  151. width: rem(120);
  152. height: rem(40);
  153. background: linear-gradient(90deg, rgba(14, 174, 255, 0.5) 0%, rgba(14, 174, 255, 0) 100%);
  154. border-radius: 5px;
  155. font-size: 20px;
  156. padding: rem(8) rem(10);
  157. display: flex;
  158. justify-content: space-between;
  159. .numbers {
  160. font-size: 12px;
  161. opacity: 0.5;
  162. line-height: rem(32);
  163. }
  164. }
  165. }
  166. }
  167. </style>