progressStatistics.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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. this.$forceUpdate();
  102. }
  103. this.getData(start,currentDate)
  104. },
  105. getData(start,end){
  106. dzfQuestionService.getProgressStatistics(start,end).then(({data}) =>{
  107. this.finish = data.finish
  108. this.unfinish = data.unfinish
  109. this.finishAccount = data.finishAcount
  110. this.unfinishAccount = data.unAcount
  111. })
  112. },
  113. maskClick(e){
  114. this.getData(e[0],e[1]);
  115. },
  116. goInfo(e){
  117. uni.navigateTo({
  118. url: `/pages/progress/ProgressQuestionList?w=${e}`
  119. })
  120. }
  121. }
  122. }
  123. </script>
  124. <style>
  125. .custom-header {
  126. display: flex;
  127. align-items: center;
  128. justify-content: center;
  129. padding: 10px;
  130. width: 100%;
  131. height: 40px;
  132. }
  133. .is-back {
  134. position: relative;
  135. }
  136. .back-container {
  137. position: absolute;
  138. left: 10px;
  139. cursor: pointer;
  140. }
  141. .back-text {
  142. color: white; /* 返回按钮文本颜色 */
  143. }
  144. /* 背景颜色 */
  145. .bg-blue {
  146. background-color: #4285f4; /* 假设这是一个蓝色背景 */
  147. }
  148. .content-container {
  149. flex: 1;
  150. text-align: center;
  151. }
  152. .content-text {
  153. color: white; /* 标题文本颜色 */
  154. font-weight: bold;
  155. }
  156. .alarmList {
  157. font-size: 14px;
  158. height: 100%;
  159. margin-top: 20rpx;
  160. }
  161. .alarmList .switchHead {
  162. height: 30px;
  163. display: flex;
  164. justify-content: space-around;
  165. align-items: center;
  166. }
  167. .alarmList .switchHead .boxList {
  168. height: 100%;
  169. }
  170. .alarmList .switchHead .activeCss {
  171. border-bottom: 2px solid #36A7F3;
  172. color: #36A7F3;
  173. }
  174. .progress_list {
  175. margin: 20rpx;
  176. }
  177. .progress_list view {
  178. margin-top: 10px;
  179. }
  180. .progress_section_1 {
  181. display: inline;
  182. border-left: 2px solid red;
  183. border-radius: 2px;
  184. height: 5px;
  185. background-color: red;
  186. margin-right: 10px;
  187. }
  188. .progress_section_2 {
  189. display: inline;
  190. border-left: 2px solid #36A7F3;
  191. border-radius: 2px;
  192. height: 5px;
  193. background-color: #36A7F3;
  194. margin-right: 10px;
  195. }
  196. .progress_num {
  197. font-size: 20px;
  198. color: #000;
  199. margin-right: 10rpx;
  200. }
  201. .progress_account {
  202. font-size: 10px;
  203. }
  204. </style>