detail.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. <template>
  2. <view class="index-detail-page">
  3. <view class="container">
  4. <view class="tab-cont">
  5. <view class="part" v-if="type==='task'">
  6. <view class="tab">
  7. <view class="tab-item" :class="activeTab===1?'active':''" @click="tabChange(0,1)">待处理</view>
  8. <view class="tab-item" :class="activeTab===2?'active':''" @click="tabChange(1,2)">已完成</view>
  9. <view class="tab-item" :class="activeTab===3?'active':''" @click="tabChange(-1,3)">已撤销</view>
  10. </view>
  11. <view class="part-cont">
  12. <view class="item" v-for="(item,taskIdx) in items" :key="item.taskId" @click="handle('task',item)">
  13. <view class="index">
  14. {{taskIdx+1}}
  15. </view>
  16. <view class="title">
  17. <view class="name">{{item.taskTitle}}</view>
  18. <view class="state">{{taskStatus(item.status)}}</view>
  19. </view>
  20. <view class="tags">
  21. <text class="tag">{{taskPriority(item.taskPriority)}}</text>
  22. <text class="tag">{{item.taskCatTitle}}</text>
  23. <text class="tag">{{taskType(item.taskTypeId)}}</text>
  24. </view>
  25. <view class="time">
  26. 预期结束时间:{{item.expectedEndTime}}
  27. </view>
  28. <view class="bottom">
  29. <view class="user">
  30. <image class="avatar" src="/static/index/user.png" mode="widthFix"></image>
  31. 处理人:{{item.handleAccountName}}
  32. </view>
  33. <view class="hand-time">
  34. {{item.launchTime}}
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="part" v-if="type==='warn'">
  41. <view class="tab">
  42. <view class="tab-item" :class="activeTab===1?'active':''" @click="tabChange(0,1)">待处理</view>
  43. <view class="tab-item" :class="activeTab===2?'active':''" @click="tabChange(1,2)">已处理</view>
  44. <view class="tab-item" :class="activeTab===3?'active':''" @click="tabChange(-1,3)">已撤销</view>
  45. </view>
  46. <view class="part-cont">
  47. <view class="item" v-for="(item,warnIdx) in items" :key="item.warnId" @click="handle('warn',item)">
  48. <view class="index">
  49. {{warnIdx+1}}
  50. </view>
  51. <view class="title">
  52. <view class="name">{{item.warnTitle}}</view>
  53. <view class="state">{{warningStatus(item.status)}}</view>
  54. </view>
  55. <view class="tags">
  56. <text class="tag">{{alertLevel(item.warnLevel)}}</text>
  57. </view>
  58. <view class="time">
  59. 发生时间:{{item.warnTime}}
  60. </view>
  61. <view class="bottom" v-if="item.handleAccountName">
  62. <view class="user">
  63. <image class="avatar" src="/static/index/user.png" mode="widthFix"></image>
  64. 处理人:{{item.handleAccountName}}
  65. </view>
  66. <view class="hand-time">
  67. {{item.handleTime}}
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. <view class="part" v-if="type==='alert'">
  74. <view class="tab">
  75. <view class="tab-item" :class="activeTab===1?'active':''" @click="tabChange(0,1)">活动</view>
  76. <view class="tab-item" :class="activeTab===2?'active':''" @click="tabChange(1,2)">已解除</view>
  77. <view class="tab-item" :class="activeTab===3?'active':''" @click="tabChange(-1,3)">已撤销</view>
  78. </view>
  79. <view class="part-cont">
  80. <view class="item" v-for="(item,alertIdx) in items" :key="item.alertId">
  81. <view class="index">
  82. {{alertIdx+1}}
  83. </view>
  84. <view class="title">
  85. <view class="name">{{item.alertTitle}}</view>
  86. <view class="state">{{alertStatus(item.status)}}</view>
  87. </view>
  88. <view class="tags">
  89. <text class="tag">{{alertLevel(item.alertLevel)}}</text>
  90. </view>
  91. <view class="time">
  92. 发生时间:{{item.alertTime}}
  93. </view>
  94. <view class="bottom" v-if="item.clearTime">
  95. <view class="hand-time">
  96. 解除时间:{{item.clearTime}}
  97. </view>
  98. </view>
  99. <view class="bottom" v-if="item.alertContent">
  100. <view class="alertContent">
  101. 内容:{{item.alertContent}}
  102. </view>
  103. </view>
  104. </view>
  105. </view>
  106. </view>
  107. <view class="part" v-if="type==='danger'">
  108. <view class="tab">
  109. <view class="tab-item" :class="activeTab===1?'active':''" @click="tabChange(0,1)">待处理</view>
  110. <view class="tab-item" :class="activeTab===2?'active':''" @click="tabChange(1,2)">我提交</view>
  111. <view class="tab-item" :class="activeTab===3?'active':''" @click="tabChange(2,3)">我处理</view>
  112. <view class="tab-item" :class="activeTab===4?'active':''" @click="tabChange(-1,4)">我撤销</view>
  113. </view>
  114. <view class="part-cont">
  115. <view class="item" v-for="(item,dangerIdx) in items" :key="item.dangerId" @click="handle('danger',item)">
  116. <view class="index">
  117. {{dangerIdx+1}}
  118. </view>
  119. <view class="title">
  120. <view class="name">{{item.dangerTitle}}</view>
  121. <view class="state">{{dangerStatus(item.status)}}</view>
  122. </view>
  123. <view class="tags">
  124. <text class="tag">{{dangerLevel(item.dangerLevel)}}</text>
  125. <text class="tag">{{item.dangerCatTitle}}</text>
  126. </view>
  127. <view class="time">
  128. 预期结束时间:{{item.dangerDeadLine}}
  129. </view>
  130. <view class="supervise">
  131. <span class="supervise-item">督办部门:{{item.superviseGroupName}}</span>
  132. <span class="supervise-item">督办人员:{{item.superviseAccountName}}</span>
  133. </view>
  134. <view class="bottom">
  135. <view class="user">
  136. <image class="avatar" src="/static/index/user.png" mode="widthFix"></image>
  137. 处理人:{{item.curAccountName}}
  138. </view>
  139. <view class="hand-time">
  140. {{item.submitTime}}
  141. </view>
  142. </view>
  143. </view>
  144. </view>
  145. </view>
  146. </view>
  147. </view>
  148. <template v-if="total<1">
  149. <view class="isEmpty" >
  150. <p class="word">没有数据 ^_^ </p>
  151. </view>
  152. </template>
  153. </view>
  154. </template>
  155. <script>
  156. import { getAlertByPage } from '@/api/aqpt/alertApi.js';
  157. import { getDangerByPage } from '@/api/aqpt/dangerApi.js';
  158. import { getTaskByPage } from '@/api/aqpt/taskApi.js';
  159. import { getWarningByPage } from '@/api/aqpt/warning.js';
  160. import { handleCheckTask } from '@/api/aqpt/checkTaskApi'
  161. import{
  162. taskStatus,taskPriority,taskType,
  163. alertLevel,alertStatus,
  164. dangerStatus,dangerLevel,
  165. warningLevel,warningStatus
  166. } from '@/libs/enum.js';
  167. export default {
  168. data() {
  169. return {
  170. type:undefined,
  171. activeTab:1,
  172. user:{},
  173. conditions: {
  174. page: 1,
  175. limit: 10,
  176. status:0
  177. },
  178. total:0,
  179. items:[]
  180. }
  181. },
  182. onLoad({type,name}) {
  183. this.type=type
  184. let user=uni.getStorageSync('accountInfo');
  185. this.user=user
  186. uni.setNavigationBarTitle({
  187. title:`${name||'详情'}`
  188. })
  189. this.tabChange(0,1)
  190. },
  191. methods: {
  192. taskStatus,taskPriority,taskType,
  193. alertLevel,alertStatus,
  194. dangerStatus,dangerLevel,
  195. warningLevel,warningStatus,
  196. getData(){
  197. if(this.type==='task'){
  198. this.getTaskByPage()
  199. }
  200. if(this.type==='danger'){
  201. delete this.conditions.status
  202. this.getDangerByPage()
  203. }
  204. if(this.type==='alert'){
  205. this.getAlertByPage()
  206. }
  207. if(this.type==='warn'){
  208. this.getWarningByPage()
  209. }
  210. },
  211. getWarningByPage(){
  212. let items=JSON.parse(JSON.stringify(this.items))
  213. getWarningByPage(this.conditions).then((res)=>{
  214. this.items=items.concat(res.data)
  215. this.total=res.total
  216. })
  217. },
  218. getAlertByPage(){
  219. let items=JSON.parse(JSON.stringify(this.items))
  220. getAlertByPage(this.conditions).then((res)=>{
  221. this.items=items.concat(res.data)
  222. this.total=res.total
  223. })
  224. },
  225. getDangerByPage(){
  226. let items=JSON.parse(JSON.stringify(this.items))
  227. getDangerByPage(this.conditions).then((res)=>{
  228. this.items=items.concat(res.data)
  229. this.total=res.total
  230. })
  231. },
  232. getTaskByPage(){
  233. let items=JSON.parse(JSON.stringify(this.items))
  234. getTaskByPage(this.conditions).then((res)=>{
  235. this.items=items.concat(res.data)
  236. this.total=res.total
  237. })
  238. },
  239. tabChange(value,index){
  240. this.activeTab=index
  241. this.total=0,
  242. this.items=[]
  243. this.conditions= {page: 1,limit: 10}
  244. if(this.type==='task'||this.type==='alert'||this.type==='warn'){
  245. this.conditions.status=value
  246. }
  247. if(this.type==='danger'){
  248. if (index === 1) {
  249. this.conditions.curAccountId = this.user.userId
  250. } else if (index === 2) {
  251. this.conditions.submitAccountId = this.user.userId
  252. } else if (index === 3) {
  253. this.conditions.handleAccountId = this.user.userId
  254. } else if (index === 4) {
  255. this.conditions.submitAccountId = this.user.userId
  256. this.conditions.status = -1
  257. }
  258. }
  259. this.getData()
  260. },
  261. handle(type,item){
  262. let url=""
  263. if(type==='danger'){
  264. uni.navigateTo({
  265. url:`/pages/webview/webview?href=${this.$h5}/danger/views/detail.html&dangerId=539241&name=隐患处理`
  266. })
  267. return
  268. }
  269. if(type==='task'){this.handTask(item);return};
  270. if(type==='warn'){
  271. if(this.conditions.status!==0) return;
  272. if(item.handleAccountId!==this.user.userId) return;
  273. url=`/pages/index/handle/warning/warning?id=${item.warnId}`
  274. }
  275. uni.navigateTo({
  276. url
  277. })
  278. },
  279. handTask(item){
  280. if(item.handleAccountId!==this.user.userId) return;
  281. if(this.conditions.status!==0) return;
  282. handleCheckTask(item.taskId).then((res)=>{
  283. const { checklistId, checklistTypeId } = res.data //recordId-taskId
  284. if (checklistTypeId === 1) {// HazardRecordView
  285. uni.navigateTo({
  286. url:`/pages/index/handle/task/hazardRecord/hazardRecord?rid=${item.taskId}&cid=${checklistId}&title=${item.taskTitle}`
  287. })
  288. } else if (checklistTypeId === 2) {// PointRecordView
  289. uni.navigateTo({
  290. url:`/pages/index/handle/task/task?rid=${item.taskId}&cid=${checklistId}&title=${item.taskTitle}`
  291. })
  292. } else if (checklistTypeId === 3) {// ScoreRecordView
  293. uni.navigateTo({
  294. url:`/pages/index/handle/task/task?rid=${item.taskId}&cid=${checklistId}&title=${item.taskTitle}`
  295. })
  296. }
  297. })
  298. },
  299. onPullDownRefresh() {
  300. this.tabChange(this.conditions.status||0,this.activeTab)
  301. uni.stopPullDownRefresh()
  302. },
  303. onReachBottom() {
  304. if(this.total>=this.conditions.page*this.conditions.limit){
  305. this.conditions.page++
  306. this.getData()
  307. }
  308. }
  309. }
  310. }
  311. </script>
  312. <style lang="scss" scoped>
  313. .index-detail-page {
  314. min-height: 100vh;
  315. padding-bottom: 100rpx;
  316. background-color: rgba(245, 246, 248, 1);
  317. .container{
  318. .tab-cont{
  319. .part{
  320. .tab{
  321. display: flex;
  322. align-items: center;
  323. justify-content: center;
  324. overflow-x: auto;
  325. background-color: #fff;
  326. padding:32rpx;
  327. .tab-item{
  328. display: inline-block;
  329. padding: 0 36rpx;
  330. background-color: #fff;
  331. text-align: center;
  332. flex-shrink: 0;
  333. line-height: 1;
  334. font-size: 32rpx;
  335. color: #333;
  336. box-sizing: border-box;
  337. border-bottom: 4rpx solid transparent;
  338. &.active{
  339. // background-color: #1e80ff;
  340. // color: #fff;
  341. // border-color: #1e80ff;
  342. color: #1e80ff;
  343. font-weight: 800;
  344. }
  345. }
  346. }
  347. .part-cont{
  348. padding: 0 32rpx;
  349. .item{
  350. background-color: #fff;
  351. border-radius: 12rpx;
  352. margin-top: 16rpx;
  353. padding: 24rpx 20rpx 24rpx 55rpx;
  354. position: relative;
  355. .index{
  356. width: 44rpx;
  357. height: 44rpx;
  358. display: flex;
  359. align-items: center;
  360. justify-content: center;
  361. border-radius: 50%;
  362. color:#ea8259;
  363. background-color:#fbf1ed;
  364. font-size:18rpx;
  365. position: absolute;
  366. left: 4rpx;
  367. top: 26rpx;
  368. word-break: break-all;
  369. }
  370. .title{
  371. display: flex;
  372. justify-content: space-between;
  373. align-items: center;
  374. .name{
  375. font-size: 32rpx;
  376. color: rgba(0, 0, 0, 0.8);
  377. }
  378. .state{
  379. font-size: 30rpx;
  380. color: rgba(250, 139, 55, 1);
  381. }
  382. }
  383. .tags{
  384. padding-top: 24rpx;
  385. .tag{
  386. background: rgba(245, 246, 248, 1);
  387. font-size: 20rpx;
  388. margin-left: 10rpx;
  389. padding: 10rpx 20rpx;
  390. &:nth-child(1){
  391. color: rgba(234, 130, 89, 1);
  392. background: rgba(251, 241, 237, 1);
  393. }
  394. }
  395. }
  396. .time{
  397. padding-top: 20rpx;
  398. font-size: 28rpx;
  399. color:rgba(241, 57, 57, 0.8);
  400. }
  401. .supervise{
  402. font-size: 24rpx;
  403. color: rgba(0, 0, 0, 1);
  404. padding: 10rpx 0;
  405. .supervise-item{
  406. padding-right: 10rpx;
  407. }
  408. }
  409. .bottom{
  410. display: flex;
  411. justify-content: space-between;
  412. align-items: center;
  413. padding-top: 20rpx;
  414. .user{
  415. display: flex;
  416. align-items: center;
  417. font-size: 24rpx;
  418. color: rgba(0, 0, 0, 1);
  419. .avatar{
  420. width: 44rpx;
  421. margin-right: 10rpx;
  422. }
  423. }
  424. .hand-time{
  425. font-size: 24rpx;
  426. color: rgba(0, 0, 0, 1);
  427. }
  428. }
  429. .alertContent{
  430. font-size: 26rpx;
  431. color: #666;
  432. line-height: 1.5;
  433. text-overflow: ellipsis;
  434. overflow: hidden;
  435. word-break: break-all;
  436. display: -webkit-box;
  437. -webkit-box-orient: vertical;
  438. -webkit-line-clamp: 2;
  439. }
  440. }
  441. }
  442. }
  443. }
  444. }
  445. .isEmpty{
  446. width: 100%;
  447. height: 100vh;
  448. background-image: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNzkgODYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxkZWZ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PHBhdGggZmlsbD0iI0Y4RjlGQiIgZD0iTTE1LjcwNSA2LjczN2wxNS40MDcgNy4xODQgMTUuNjQ2LS40MjctMTUuNDA3LTcuMTg1eiIvPjxwYXRoIGZpbGw9InVybCgjYikiIGQ9Ik0xMyA0NWg0MHYzNkgxM3oiLz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSg1MyA0NSkiPjxtYXNrIGlkPSJkIiBmaWxsPSIjZmZmIj48dXNlIHhsaW5rOmhyZWY9IiNjIi8+PC9tYXNrPjx1c2UgZmlsbD0iI0UwRTNFOSIgdHJhbnNmb3JtPSJtYXRyaXgoLTEgMCAwIDEgMTcgMCkiIHhsaW5rOmhyZWY9IiNjIi8+PHBhdGggZmlsbD0iI0Q1RDdERSIgbWFzaz0idXJsKCNkKSIgdHJhbnNmb3JtPSJtYXRyaXgoLTEgMCAwIDEgMjQgMCkiIGQ9Ik03IDBoMTdsLTQgMTgtMjAtMnoiLz48L2c+PHBhdGggZmlsbD0iI0Y4RjlGQiIgZD0iTTcwIDQ1SDUzbDkgMTNoMTd6Ii8+PC9nPjwvc3ZnPg==);
  449. background-size: contain;
  450. background-repeat: no-repeat;
  451. position: relative;
  452. background-color: #fff;
  453. /* #ifndef MP-WEIXIN */
  454. height: calc( 100vh - 100px);
  455. /* #endif */
  456. .word{
  457. width: 100%;
  458. text-align: center;
  459. position: absolute;
  460. top: 80vh;
  461. left: 0;
  462. color: #999;
  463. font-size: 28rpx;
  464. letter-spacing: 2rpx;
  465. }
  466. }
  467. }
  468. </style>