progressStatistics.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <view style="background-color: #fff;height: 100vh;">
  3. <cu-custom bgColor="bg-blue" :isBack="true" >
  4. <block slot="backText">返回</block>
  5. <block slot="content">{{title}}</block>
  6. </cu-custom>
  7. <uni-datetime-picker v-model="range" v-show="activeIndex == 0" type="daterange" @change="maskClick" />
  8. <uni-datetime-picker v-model="year" v-show="activeIndex == 1" type="daterange" @change="maskClick" />
  9. <view class="alarmList">
  10. <view class="switchHead">
  11. <view v-for="(item,index) in tabTitleData" class="boxList" :class="{activeCss:activeIndex==index}"
  12. :key="index">
  13. <text @click="clickTab(index)">{{item.name}}</text>
  14. </view>
  15. </view>
  16. <view class="progress_list">
  17. <uni-row :gutter="5">
  18. <uni-col :span="12">
  19. <view @click="goInfo(1)">
  20. <uni-card margin="5px" shadow="0px 0px 3px 1px #36A7F3">
  21. <view class="progress_section_1"></view><text>未办结问题数</text>
  22. <view><text class="progress_num">{{unfinish}}</text>个</view>
  23. <view class="progress_account">占比<text
  24. style="color: red;margin-left: 5px;">{{unfinishAccount}}%</text></view>
  25. </uni-card>
  26. </view>
  27. </uni-col>
  28. <uni-col :span="12">
  29. <view @click="goInfo(2)">
  30. <uni-card margin="5px" shadow="0px 0px 3px 1px #36A7F3">
  31. <view class="progress_section_2"></view><text>办结问题数</text>
  32. <view><text class="progress_num">{{finish}}</text>个</view>
  33. <view class="progress_account">占比<text
  34. style="color: #36A7F3;margin-left: 5px;">{{finishAccount}}%</text></view>
  35. </uni-card>
  36. </view>
  37. </uni-col>
  38. </uni-row>
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import dzfQuestionService from '@/api/question/dzfQuestionService.js'
  45. export default {
  46. data() {
  47. return {
  48. title:"进度统计",
  49. isBack: true, // 是否显示返回按钮
  50. bgColor: 'bg-blue', // 背景颜色
  51. range: ['2021-02-1', '2021-3-28'],
  52. year:['',''],
  53. datetimerange: [],
  54. start: Date.now() - 1000000000,
  55. end: Date.now() + 1000000000,
  56. activeIndex: '0',
  57. tabTitleData: [{
  58. name: '当月累计'
  59. },
  60. {
  61. name: '当年累计'
  62. }
  63. ],
  64. finish: 0,
  65. unfinish: 0,
  66. finishAccount: 0,
  67. unfinishAccount: 0
  68. }
  69. },
  70. onShow() {
  71. var date = new Date();
  72. var year = date.getFullYear(); // 年份
  73. var month = date.getMonth() + 1; // 月份,返回值为0-11,所以需要加1
  74. var day = date.getDate(); // 日期
  75. // 对月份和日期进行补零
  76. month = month < 10 ? '0' + month : month.toString();
  77. day = day < 10 ? '0' + day : day.toString();
  78. var currentDate = year + '-' + month + '-' + day;
  79. var start = year + '-' + month + '-01'
  80. this.range[0] = start
  81. this.range[1] = currentDate
  82. this.year[0] = year + '-01-01'
  83. this.year[1] = currentDate
  84. this.getData(start,currentDate)
  85. },
  86. methods: {
  87. clickTab(index) {
  88. this.activeIndex = index;
  89. var date = new Date();
  90. var year = date.getFullYear(); // 年份
  91. var month = date.getMonth() + 1; // 月份,返回值为0-11,所以需要加1
  92. var day = date.getDate(); // 日期
  93. // 对月份和日期进行补零
  94. month = month < 10 ? '0' + month : month.toString();
  95. day = day < 10 ? '0' + day : day.toString();
  96. var currentDate = year + '-' + month + '-' + day;
  97. var start = year + '-' + month + '-01'
  98. this.range[1] = currentDate
  99. if(index == 1){
  100. this.range[0] = year + '-01-01'
  101. start = year + '-01-01'
  102. this.$forceUpdate();
  103. }
  104. this.getData(start,currentDate)
  105. },
  106. getData(start,end){
  107. dzfQuestionService.getProgressStatistics(start,end).then(({data}) =>{
  108. this.finish = data.finish
  109. this.unfinish = data.unfinish
  110. this.finishAccount = data.finishAcount
  111. this.unfinishAccount = data.unAcount
  112. })
  113. },
  114. maskClick(e){
  115. this.getData(e[0],e[1]);
  116. },
  117. goInfo(e){
  118. uni.navigateTo({
  119. url: `/pages/progress/ProgressQuestionList?w=${e}&date=${this.range}`
  120. })
  121. }
  122. }
  123. }
  124. </script>
  125. <style>
  126. .custom-header {
  127. display: flex;
  128. align-items: center;
  129. justify-content: center;
  130. padding: 10px;
  131. width: 100%;
  132. height: 40px;
  133. }
  134. .is-back {
  135. position: relative;
  136. }
  137. .back-container {
  138. position: absolute;
  139. left: 10px;
  140. cursor: pointer;
  141. }
  142. .back-text {
  143. color: white; /* 返回按钮文本颜色 */
  144. }
  145. /* 背景颜色 */
  146. .bg-blue {
  147. background-color: #4285f4; /* 假设这是一个蓝色背景 */
  148. }
  149. .content-container {
  150. flex: 1;
  151. text-align: center;
  152. }
  153. .content-text {
  154. color: white; /* 标题文本颜色 */
  155. font-weight: bold;
  156. }
  157. .alarmList {
  158. font-size: 14px;
  159. height: 100%;
  160. margin-top: 20rpx;
  161. }
  162. .alarmList .switchHead {
  163. height: 30px;
  164. display: flex;
  165. justify-content: space-around;
  166. align-items: center;
  167. }
  168. .alarmList .switchHead .boxList {
  169. height: 100%;
  170. }
  171. .alarmList .switchHead .activeCss {
  172. border-bottom: 2px solid #36A7F3;
  173. color: #36A7F3;
  174. }
  175. .progress_list {
  176. margin: 20rpx;
  177. }
  178. .progress_list view {
  179. margin-top: 10px;
  180. }
  181. .progress_section_1 {
  182. display: inline;
  183. border-left: 2px solid red;
  184. border-radius: 2px;
  185. height: 5px;
  186. background-color: red;
  187. margin-right: 10px;
  188. }
  189. .progress_section_2 {
  190. display: inline;
  191. border-left: 2px solid #36A7F3;
  192. border-radius: 2px;
  193. height: 5px;
  194. background-color: #36A7F3;
  195. margin-right: 10px;
  196. }
  197. .progress_num {
  198. font-size: 20px;
  199. color: #000;
  200. margin-right: 10rpx;
  201. }
  202. .progress_account {
  203. font-size: 10px;
  204. }
  205. </style>