risk.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. <template>
  2. <view class="page-index">
  3. <view class="status_bar"></view>
  4. <div class="title">
  5. <text class="tab" :class="type==='user'?'active':''" @click="changeTab('user')">我的</text>
  6. <text class="tab" :class="type==='group'?'active':''" @click="changeTab('group')">部门</text>
  7. </div>
  8. <div class="statistics">
  9. <div class="head">任务统计</div>
  10. <div class="container">
  11. <div class="item" @click="changeStuas(1,'待评审')">
  12. <image class="icon" src="/static/index/wait.png" alt=""></image>
  13. <text>待评审{{statistics.review}}个</text>
  14. </div>
  15. <div class="item" @click="changeStuas(2,'待整改')">
  16. <image class="icon" src="/static/index/expire.png" alt=""></image>
  17. <text>待整改{{statistics.rectify}}个</text>
  18. </div>
  19. <div class="item" @click="changeStuas(3,'待验收')">
  20. <image class="icon" src="/static/index/complete.png" alt=""></image>
  21. <text>待验收{{statistics.accept}}个</text>
  22. </div>
  23. <div class="item" @click="changeStuas(4,'已完成')">
  24. <image class="icon" src="/static/index/complete.png" alt=""></image>
  25. <text>已完成{{statistics.complete}}个</text>
  26. </div>
  27. <div class="item" @click="changeStuas(-1,'已撤销')">
  28. <image class="icon" src="/static/index/revocation.png" alt=""></image>
  29. <text>已撤销{{statistics.revocation}}个</text>
  30. </div>
  31. </div>
  32. </div>
  33. <div class="task-list">
  34. <div class="head">{{title}}</div>
  35. <template v-if="items.length>0">
  36. <div class="item" v-for="(item,index) in items" :key="index" @click="linkTo(item)">
  37. <div class="task-title">{{item.hdangerTitle}}</div>
  38. <view class="footer">
  39. <view class="lf">
  40. <div class="time">{{item.dangerDeadline}}</div>
  41. <div class="user">{{item.curAccountName}}</div>
  42. </view>
  43. <div class="status" v-if="item.status===4">完成</div>
  44. <div class="status" v-else>{{item.curActivityTitle}}</div>
  45. </view>
  46. </div>
  47. </template>
  48. <template v-else>
  49. <view class="empty">
  50. <image class="icon-empty" src="/static/icon/empty.png" mode="widthFix"></image>
  51. <p>暂无数据</p>
  52. </view>
  53. </template>
  54. </div>
  55. </view>
  56. </template>
  57. <script>
  58. import { getDangerByList, getDangerByPage } from '@/api/dangerApi'
  59. export default {
  60. data() {
  61. return {
  62. statusBarHeight:0,
  63. type:"user",
  64. title:"待评审",
  65. statistics: {
  66. review:10,
  67. rectify:2,
  68. complete:10,
  69. accept:88,
  70. revocation:2
  71. },
  72. conditions:{
  73. status:1,
  74. accountId:undefined
  75. },
  76. items:[]
  77. }
  78. },
  79. onShow(){
  80. const accountInfo=uni.getStorageSync('accountInfo');
  81. const groupId=accountInfo.groupId
  82. const accountId=accountInfo.userId
  83. this.accountId=accountId
  84. this.groupId=groupId
  85. this.init()
  86. this.getData()
  87. },
  88. methods: {
  89. init(){
  90. let type="AccountId"
  91. let tab_type=this.accountId
  92. if(this.type!=='user'){
  93. type="GroupId"
  94. tab_type=this.groupId
  95. }
  96. getDangerByList().then((res)=>{
  97. this.statistics.review=res.data.filter(item=>item.status==1&&item['review'+type]===tab_type).length
  98. this.statistics.rectify=res.data.filter(item=>item.status==2&&item['rectify'+type]===tab_type).length
  99. this.statistics.accept=res.data.filter(item=>item.status==3&&item['accept'+type]===tab_type).length
  100. this.statistics.complete=res.data.filter(item=>item.status==4&&item['submit'+type]===tab_type).length
  101. this.statistics.revocation=res.data.filter(item=>item.status==-1&&item['submit'+type]===tab_type).length
  102. })
  103. },
  104. onPullDownRefresh (){
  105. this.getData()
  106. },
  107. getData(){
  108. let conditions={status:this.conditions.status}
  109. let statusName="submit"
  110. if(this.conditions.status==1){
  111. statusName="review"
  112. }else if(this.conditions.status==2){
  113. statusName="rectify"
  114. }else if(this.conditions.status==3){
  115. statusName="accept"
  116. }
  117. if(this.type==='user'){
  118. conditions[statusName+"AccountId"]=this.accountId
  119. }else{
  120. conditions[statusName+"GroupId"]=this.groupId
  121. }
  122. getDangerByList(conditions).then((res)=>{
  123. this.items=res.data
  124. })
  125. },
  126. changeTab(type){
  127. this.type=type
  128. this.getData()
  129. },
  130. changeStuas(status,name){
  131. this.conditions.status=status
  132. this.title=name
  133. this.getData()
  134. },
  135. linkTo(item){
  136. if(this.type==='group') return
  137. let url="";
  138. switch(item.curActivityCode){
  139. case "review" ://评审
  140. url='/pages/risk/review/review'
  141. break;
  142. case "submit" ://提交
  143. url='/pages/risk/repeal/repeal'
  144. break;
  145. case "accept" ://验收
  146. url='/pages/risk/check/check'
  147. break;
  148. case "rectify" ://整改
  149. url='/pages/risk/rectify/rectify'
  150. break;
  151. }
  152. uni.setStorageSync('danger-info',item)
  153. uni.navigateTo({
  154. url
  155. })
  156. }
  157. }
  158. }
  159. </script>
  160. <style lang="scss" scoped>
  161. .page-index{
  162. background: linear-gradient(180deg, #4D73FF 0%, rgba(77, 115, 255, 0) 100%);
  163. padding: 0 30upx;
  164. .title{
  165. .tab{
  166. font-size: 34upx;
  167. line-height: 50upx;
  168. margin-right: 32upx;
  169. color: rgba(255, 255, 255, 0.6);
  170. &.active{
  171. color: #fff;
  172. }
  173. }
  174. }
  175. .statistics{
  176. &{
  177. border-radius: 24upx;
  178. background-color: #fff;
  179. padding:36upx 0 0 24upx;
  180. margin-top: 48upx;
  181. }
  182. .head{
  183. font-weight: 900;
  184. font-size: 34upx;
  185. line-height: 50upx;
  186. color: #151515;
  187. }
  188. .container{
  189. display: flex;
  190. align-items: center;
  191. flex-wrap: wrap;
  192. .item{
  193. width: 33.33%;
  194. display: flex;
  195. justify-content: center;
  196. align-items: center;
  197. flex-direction: column;
  198. margin-bottom: 40upx;
  199. .icon{
  200. display: block;
  201. width:88upx;
  202. height: 88upx;
  203. }
  204. text{
  205. font-size: 28upx;
  206. line-height: 42upx;
  207. color: #151515;
  208. padding-top: 18upx;
  209. }
  210. }
  211. }
  212. }
  213. .task-list{
  214. border-radius: 24upx;
  215. background-color: #fff;
  216. margin-top: 24upx;
  217. padding: 36upx 24upx;
  218. .head{
  219. font-weight: 900;
  220. font-size: 34upx;
  221. line-height: 50upx;
  222. color: #151515;
  223. }
  224. .item{
  225. padding: 30upx 40upx 38upx 40upx;
  226. margin-top: 20rpx;
  227. border: 1px solid #F8F9FD;
  228. .task-title{
  229. color: #212121;
  230. font-size: 32upx;
  231. padding-bottom: 24upx;
  232. }
  233. .footer{
  234. display: flex;
  235. justify-content: space-between;
  236. align-items: center;
  237. .lf{
  238. display: flex;
  239. .time{
  240. background-image: url(/static/index/time.png);
  241. background-repeat: no-repeat;
  242. background-position: left center;
  243. background-size: 24upx 24upx;
  244. padding-left: 36upx;
  245. color: #999;
  246. font-size: 24upx;
  247. }
  248. .user{
  249. background-image: url(/static/index/user.png);
  250. background-repeat: no-repeat;
  251. background-position: left center;
  252. background-size: 24upx 24upx;
  253. padding-left: 36upx;
  254. color: #999;
  255. font-size: 24upx;
  256. margin-left: 10rpx;
  257. }
  258. }
  259. .status{
  260. color: #4D73FF;
  261. }
  262. }
  263. }
  264. }
  265. }
  266. .container {
  267. padding: 20px;
  268. font-size: 14px;
  269. line-height: 24px;
  270. }
  271. .empty{
  272. text-align: center;
  273. font-size: 28rpx;
  274. margin-top: 10%;
  275. color: #666;
  276. .icon-empty{
  277. display: block;
  278. width: 100px;
  279. margin: 0 auto;
  280. }
  281. }
  282. </style>