detail.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  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="bottom">
  131. <view class="user">
  132. <image class="avatar" src="/static/index/user.png" mode="widthFix"></image>
  133. 处理人:{{item.curAccountName}}
  134. </view>
  135. <view class="hand-time">
  136. {{item.submitTime}}
  137. </view>
  138. </view>
  139. </view>
  140. </view>
  141. </view>
  142. </view>
  143. </view>
  144. <template v-if="total<1">
  145. <view class="isEmpty" >
  146. <p class="word">没有数据 ^_^ </p>
  147. </view>
  148. </template>
  149. </view>
  150. </template>
  151. <script>
  152. import { getAlertByPage } from '@/api/aqpt/alertApi.js';
  153. import { getDangerByPage } from '@/api/aqpt/dangerApi.js';
  154. import { getTaskByPage } from '@/api/aqpt/taskApi.js';
  155. import { getWarningByPage } from '@/api/aqpt/warning.js';
  156. import { handleCheckTask } from '@/api/aqpt/checkTaskApi'
  157. import{
  158. taskStatus,taskPriority,taskType,
  159. alertLevel,alertStatus,
  160. dangerStatus,dangerLevel,
  161. warningLevel,warningStatus
  162. } from '@/libs/enum.js';
  163. export default {
  164. data() {
  165. return {
  166. type:undefined,
  167. activeTab:1,
  168. user:{},
  169. conditions: {
  170. page: 1,
  171. limit: 10,
  172. status:0
  173. },
  174. total:0,
  175. items:[]
  176. }
  177. },
  178. onLoad({type,name}) {
  179. this.type=type
  180. let user=uni.getStorageSync('accountInfo');
  181. this.user=user
  182. uni.setNavigationBarTitle({
  183. title:`${name||'详情'}`
  184. })
  185. this.tabChange(0,1)
  186. },
  187. methods: {
  188. taskStatus,taskPriority,taskType,
  189. alertLevel,alertStatus,
  190. dangerStatus,dangerLevel,
  191. warningLevel,warningStatus,
  192. getData(){
  193. if(this.type==='task'){
  194. this.getTaskByPage()
  195. }
  196. if(this.type==='danger'){
  197. delete this.conditions.status
  198. this.getDangerByPage()
  199. }
  200. if(this.type==='alert'){
  201. this.getAlertByPage()
  202. }
  203. if(this.type==='warn'){
  204. this.getWarningByPage()
  205. }
  206. },
  207. getWarningByPage(){
  208. let items=JSON.parse(JSON.stringify(this.items))
  209. getWarningByPage(this.conditions).then((res)=>{
  210. this.items=items.concat(res.data)
  211. this.total=res.total
  212. })
  213. },
  214. getAlertByPage(){
  215. let items=JSON.parse(JSON.stringify(this.items))
  216. getAlertByPage(this.conditions).then((res)=>{
  217. this.items=items.concat(res.data)
  218. this.total=res.total
  219. })
  220. },
  221. getDangerByPage(){
  222. let items=JSON.parse(JSON.stringify(this.items))
  223. getDangerByPage(this.conditions).then((res)=>{
  224. this.items=items.concat(res.data)
  225. this.total=res.total
  226. })
  227. },
  228. getTaskByPage(){
  229. let items=JSON.parse(JSON.stringify(this.items))
  230. getTaskByPage(this.conditions).then((res)=>{
  231. this.items=items.concat(res.data)
  232. this.total=res.total
  233. })
  234. },
  235. tabChange(value,index){
  236. this.activeTab=index
  237. this.total=0,
  238. this.items=[]
  239. this.conditions= {page: 1,limit: 10}
  240. if(this.type==='task'||this.type==='alert'||this.type==='warn'){
  241. this.conditions.status=value
  242. }
  243. if(this.type==='danger'){
  244. if (index === 1) {
  245. this.conditions.curAccountId = this.user.userId
  246. } else if (index === 2) {
  247. this.conditions.submitAccountId = this.user.userId
  248. } else if (index === 3) {
  249. this.conditions.handleAccountId = this.user.userId
  250. } else if (index === 4) {
  251. this.conditions.submitAccountId = this.user.userId
  252. this.conditions.status = -1
  253. }
  254. }
  255. this.getData()
  256. },
  257. handle(type,item){
  258. let url=""
  259. if(type==='danger'){
  260. uni.navigateTo({
  261. url:`/pages/webview/webview?href=${this.$h5}/danger/views/detail.html&dangerId=539241&name=隐患处理`
  262. })
  263. return
  264. }
  265. if(type==='task'){this.handTask(item);return};
  266. if(type==='warn'){
  267. if(this.conditions.status!==0) return;
  268. if(item.handleAccountId!==this.user.userId) return;
  269. url=`/pages/index/handle/warning/warning?id=${item.warnId}`
  270. }
  271. uni.navigateTo({
  272. url
  273. })
  274. },
  275. handTask(item){
  276. if(item.handleAccountId!==this.user.userId) return;
  277. if(this.conditions.status!==0) return;
  278. handleCheckTask(item.taskId).then((res)=>{
  279. const { checklistId, checklistTypeId } = res.data //recordId-taskId
  280. if (checklistTypeId === 1) {// HazardRecordView
  281. uni.navigateTo({
  282. url:`/pages/index/handle/task/hazardRecord/hazardRecord?rid=${item.taskId}&cid=${checklistId}&title=${item.taskTitle}`
  283. })
  284. } else if (checklistTypeId === 2) {// PointRecordView
  285. uni.navigateTo({
  286. url:`/pages/index/handle/task/task?rid=${item.taskId}&cid=${checklistId}&title=${item.taskTitle}`
  287. })
  288. } else if (checklistTypeId === 3) {// ScoreRecordView
  289. uni.navigateTo({
  290. url:`/pages/index/handle/task/task?rid=${item.taskId}&cid=${checklistId}&title=${item.taskTitle}`
  291. })
  292. }
  293. })
  294. },
  295. onPullDownRefresh() {
  296. this.tabChange(this.conditions.status||0,this.activeTab)
  297. uni.stopPullDownRefresh()
  298. },
  299. onReachBottom() {
  300. if(this.total>=this.conditions.page*this.conditions.limit){
  301. this.conditions.page++
  302. this.getData()
  303. }
  304. }
  305. }
  306. }
  307. </script>
  308. <style lang="scss" scoped>
  309. .index-detail-page {
  310. min-height: 100vh;
  311. padding-bottom: 100rpx;
  312. background-color: rgba(245, 246, 248, 1);
  313. .container{
  314. .tab-cont{
  315. .part{
  316. .tab{
  317. display: flex;
  318. align-items: center;
  319. justify-content: center;
  320. overflow-x: auto;
  321. background-color: #fff;
  322. padding:32rpx;
  323. .tab-item{
  324. display: inline-block;
  325. padding: 0 36rpx;
  326. background-color: #fff;
  327. text-align: center;
  328. flex-shrink: 0;
  329. line-height: 1;
  330. font-size: 32rpx;
  331. color: #333;
  332. box-sizing: border-box;
  333. border-bottom: 4rpx solid transparent;
  334. &.active{
  335. // background-color: #1e80ff;
  336. // color: #fff;
  337. // border-color: #1e80ff;
  338. color: #1e80ff;
  339. font-weight: 800;
  340. }
  341. }
  342. }
  343. .part-cont{
  344. padding: 0 32rpx;
  345. .item{
  346. background-color: #fff;
  347. border-radius: 12rpx;
  348. margin-top: 16rpx;
  349. padding: 24rpx 20rpx 24rpx 55rpx;
  350. position: relative;
  351. .index{
  352. width: 44rpx;
  353. height: 44rpx;
  354. display: flex;
  355. align-items: center;
  356. justify-content: center;
  357. border-radius: 50%;
  358. color:#ea8259;
  359. background-color:#fbf1ed;
  360. font-size:18rpx;
  361. position: absolute;
  362. left: 4rpx;
  363. top: 26rpx;
  364. word-break: break-all;
  365. }
  366. .title{
  367. display: flex;
  368. justify-content: space-between;
  369. align-items: center;
  370. .name{
  371. font-size: 32rpx;
  372. color: rgba(0, 0, 0, 0.8);
  373. }
  374. .state{
  375. font-size: 30rpx;
  376. color: rgba(250, 139, 55, 1);
  377. }
  378. }
  379. .tags{
  380. padding-top: 24rpx;
  381. .tag{
  382. background: rgba(245, 246, 248, 1);
  383. font-size: 20rpx;
  384. margin-left: 10rpx;
  385. padding: 10rpx 20rpx;
  386. &:nth-child(1){
  387. color: rgba(234, 130, 89, 1);
  388. background: rgba(251, 241, 237, 1);
  389. }
  390. }
  391. }
  392. .time{
  393. padding-top: 20rpx;
  394. font-size: 28rpx;
  395. color:rgba(241, 57, 57, 0.8);
  396. }
  397. .bottom{
  398. display: flex;
  399. justify-content: space-between;
  400. align-items: center;
  401. padding-top: 20rpx;
  402. .user{
  403. display: flex;
  404. align-items: center;
  405. font-size: 24rpx;
  406. color: rgba(0, 0, 0, 1);
  407. .avatar{
  408. width: 44rpx;
  409. margin-right: 10rpx;
  410. }
  411. }
  412. .hand-time{
  413. font-size: 24rpx;
  414. color: rgba(0, 0, 0, 1);
  415. }
  416. }
  417. .alertContent{
  418. font-size: 26rpx;
  419. color: #666;
  420. line-height: 1.5;
  421. text-overflow: ellipsis;
  422. overflow: hidden;
  423. word-break: break-all;
  424. display: -webkit-box;
  425. -webkit-box-orient: vertical;
  426. -webkit-line-clamp: 2;
  427. }
  428. }
  429. }
  430. }
  431. }
  432. }
  433. .isEmpty{
  434. width: 100%;
  435. height: 100vh;
  436. background-image: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNzkgODYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxkZWZzPjxsaW5lYXJHcmFkaWVudCBpZD0iYSIgeDE9IjM4Ljg1JSIgeTE9IjAlIiB4Mj0iNjEuMTUlIiB5Mj0iMTAwJSI+PHN0b3Agc3RvcC1jb2xvcj0iI0ZDRkNGRCIgb2Zmc2V0PSIwJSIvPjxzdG9wIHN0b3AtY29sb3I9IiNFRUVGRjMiIG9mZnNldD0iMTAwJS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kiPjxtYXNrIGlkPSJkIiBmaWxsPSIjZmZmIj48dXNlIHhsaW5rOmhyZWY9IiNjIi8+PC9tYXNrPjx1c2UgZmlsbD0iI0UwRTNFOSIgdHJhbnNmb3JtPSJtYXRyaXgoLTEgMCAwIDEgMTcgMCkiIHhsaW5rOmhyZWY9IiNjIi8+PHBhdGggZmlsbD0iI0Q1RDdERSIgbWFzaz0idXJsKCNkKSIgdHJhbnNmb3JtPSJtYXRyaXgoLTEgMCAwIDEgMjQgMCkiIGQ9Ik03IDBoMTdsLTQgMTgtMjAtMnoiLz48L2c+PHBhdGggZmlsbD0iI0Y4RjlGQiIgZD0iTTcwIDQ1SDUzbDkgMTNoMTd6Ii8+PC9nPjwvc3ZnPg==);
  437. background-size: contain;
  438. background-repeat: no-repeat;
  439. position: relative;
  440. background-color: #fff;
  441. /* #ifndef MP-WEIXIN */
  442. height: calc( 100vh - 100px);
  443. /* #endif */
  444. .word{
  445. width: 100%;
  446. text-align: center;
  447. position: absolute;
  448. top: 80vh;
  449. left: 0;
  450. color: #999;
  451. font-size: 28rpx;
  452. letter-spacing: 2rpx;
  453. }
  454. }
  455. }
  456. </style>