risk.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  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="conditions.status===1?'item active':'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="conditions.status===2?'item active':'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="conditions.status===3?'item active':'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="conditions.status===4?'item active':'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="conditions.status===-1?'item active':'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||type==='group'">详情</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(item.status===4||this.type==='group'){
  147. uni.navigateTo({
  148. url:`/pages/risk/histroy/histroy?hdangerId=${item.hdangerId}`
  149. })
  150. return
  151. }
  152. let url="";
  153. switch(item.curActivityCode){
  154. case "review" ://评审
  155. url='/pages/risk/review/review'
  156. break;
  157. case "submit" ://提交
  158. url='/pages/risk/repeal/repeal'
  159. break;
  160. case "accept" ://验收
  161. url='/pages/risk/check/check'
  162. break;
  163. case "rectify" ://整改
  164. url='/pages/risk/rectify/rectify'
  165. break;
  166. }
  167. uni.setStorageSync('danger-info',item)
  168. uni.navigateTo({
  169. url
  170. })
  171. }
  172. }
  173. }
  174. </script>
  175. <style lang="scss" scoped>
  176. .page-index{
  177. background: linear-gradient(180deg, #4D73FF 0%, rgba(77, 115, 255, 0) 100%);
  178. padding: 0 30upx;
  179. .title{
  180. .tab{
  181. font-size: 34upx;
  182. line-height: 50upx;
  183. margin-right: 32upx;
  184. color: rgba(255, 255, 255, 0.6);
  185. &.active{
  186. color: #fff;
  187. }
  188. }
  189. }
  190. .statistics{
  191. &{
  192. border-radius: 24upx;
  193. background-color: #fff;
  194. padding:36upx 0 0 24upx;
  195. margin-top: 48upx;
  196. }
  197. .head{
  198. font-weight: 900;
  199. font-size: 34upx;
  200. line-height: 50upx;
  201. color: #151515;
  202. }
  203. .container{
  204. display: flex;
  205. align-items: center;
  206. flex-wrap: wrap;
  207. padding: 20rpx 20rpx 0 20rpx;
  208. font-size: 14px;
  209. line-height: 24px;
  210. .item{
  211. width: 33.33%;
  212. display: flex;
  213. justify-content: center;
  214. align-items: center;
  215. flex-direction: column;
  216. padding-bottom: 20rpx;
  217. margin-bottom: 20rpx;
  218. &.active{
  219. background-image: url('/static/icon/selectEd.png');
  220. background-size: 32rpx 20rpx;
  221. background-repeat: no-repeat;
  222. background-position: center bottom;
  223. }
  224. .icon{
  225. display: block;
  226. width:88upx;
  227. height: 88upx;
  228. }
  229. text{
  230. font-size: 28upx;
  231. line-height: 42upx;
  232. color: #151515;
  233. padding-top: 18upx;
  234. }
  235. }
  236. }
  237. }
  238. .task-list{
  239. border-radius: 24upx;
  240. background-color: #fff;
  241. margin-top: 24upx;
  242. padding: 36upx 24upx;
  243. .head{
  244. font-weight: 900;
  245. font-size: 34upx;
  246. line-height: 50upx;
  247. color: #151515;
  248. }
  249. .item{
  250. padding: 30upx 40upx 38upx 40upx;
  251. margin-top: 20rpx;
  252. border: 1px solid #F8F9FD;
  253. .task-title{
  254. color: #212121;
  255. font-size: 32upx;
  256. padding-bottom: 24rpx;
  257. }
  258. .goafName{
  259. color: #666;
  260. font-weight: normal;
  261. font-size: 28rpx;
  262. word-break: break-all;
  263. padding-bottom: 16rpx;
  264. }
  265. .footer{
  266. display: flex;
  267. justify-content: space-between;
  268. align-items: center;
  269. .lf{
  270. display: flex;
  271. .time{
  272. background-image: url(/static/index/time.png);
  273. background-repeat: no-repeat;
  274. background-position: left center;
  275. background-size: 24upx 24upx;
  276. padding-left: 36upx;
  277. color: #999;
  278. font-size: 24upx;
  279. }
  280. .user{
  281. background-image: url(/static/index/user.png);
  282. background-repeat: no-repeat;
  283. background-position: left center;
  284. background-size: 24upx 24upx;
  285. padding-left: 36upx;
  286. color: #999;
  287. font-size: 24upx;
  288. margin-left: 10rpx;
  289. }
  290. }
  291. .status{
  292. color: #4D73FF;
  293. }
  294. }
  295. }
  296. }
  297. }
  298. .empty{
  299. text-align: center;
  300. font-size: 28rpx;
  301. margin-top: 10%;
  302. color: #666;
  303. .icon-empty{
  304. display: block;
  305. width: 100px;
  306. margin: 0 auto;
  307. }
  308. }
  309. </style>