risk.vue 7.5 KB

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