patrolInspectionRate.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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>{{ total }}</span>
  26. <span class="numbers">任务总数</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: '18',
  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/statisticInspectionTaskCompletionRate', 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 typeName = {
  89. 1: '待执行',
  90. 2: '执行中',
  91. 3: '已完成',
  92. 4: '已完成(超时)',
  93. 5: '已逾期'
  94. };
  95. let newData = [];
  96. for (let a in data.datas) {
  97. newData.push({
  98. value: data.datas[a],
  99. name: typeName[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. .modelBlock {
  115. height: 100%;
  116. padding: rem(15) rem(20) rem(20);
  117. background: #171f32;
  118. .model-title {
  119. line-height: rem(30);
  120. display: flex;
  121. justify-content: space-between;
  122. padding-bottom: rem(15);
  123. border-bottom: 1px solid rgba(224, 225, 227, 0.2);
  124. .saveColumn-select {
  125. width: rem(120);
  126. margin-left: rem(20);
  127. /deep/ .el-input__inner {
  128. background: transparent;
  129. color: white;
  130. border-color: rgba(255, 255, 255, 0.2);
  131. }
  132. }
  133. .model-title-text {
  134. color: white;
  135. }
  136. }
  137. .model-content {
  138. height: calc(100% - #{rem(45)});
  139. display: flex;
  140. justify-content: space-between;
  141. font-size: 12px;
  142. position: relative;
  143. .totals {
  144. position: absolute;
  145. right: rem(10);
  146. top: rem(26);
  147. width: rem(120);
  148. height: rem(40);
  149. background: linear-gradient(90deg, rgba(14, 174, 255, 0.5) 0%, rgba(14, 174, 255, 0) 100%);
  150. border-radius: 5px;
  151. font-size: 20px;
  152. padding: rem(8) rem(10);
  153. display: flex;
  154. justify-content: space-between;
  155. .numbers {
  156. font-size: 12px;
  157. opacity: 0.5;
  158. line-height: rem(32);
  159. }
  160. }
  161. }
  162. }
  163. </style>