history.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. <template>
  2. <view class="history-container">
  3. <view class="tabs">
  4. <template v-if="isAccount!==0">
  5. <view class="tab" :class="tabIdx===1?'active':''" @click="tabclick(1)">安全巡检</view>
  6. <view class="tab" :class="tabIdx===2?'active':''" @click="tabclick(2)">隐患记录</view>
  7. <!-- <view class="tab" :class="tabIdx===4?'active':''" @click="tabclick(4)">危险源</view> -->
  8. </template>
  9. <view class="tab" :class="tabIdx===5?'active':''" @click="tabclick(5)">问题反馈</view>
  10. <view class="tab" :class="tabIdx===3?'active':''" @click="tabclick(3)">满意度评价</view>
  11. </view>
  12. <view class="back" @click="back" v-if="showback">返回</view>
  13. <view class="item-list-wrap" v-if="total>0">
  14. <view class="item-list basics" v-if="tabIdx===1||tabIdx===4">
  15. <view class="basics-item" v-for="(item,idx) in items" :key="idx" @click="showDetail(item)">
  16. <view class="basics-title">{{item.checklistTitle}}</view>
  17. <view class="basics-body">
  18. <view class="lf">
  19. <text class="time">{{item.recordTime}}</text>
  20. <text class="user">{{item.accountName||'微信用户'}}</text>
  21. </view>
  22. <view class="status">{{checklistStatus(item.status)}}</view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="item-list basics" v-if="tabIdx===5">
  27. <view class="basics-item" v-for="(item,idx) in items" :key="idx" @click="showDetail(item)">
  28. <view class="basics-title">{{item.snapshotContent}}</view>
  29. <view class="basics-body">
  30. <view class="lf">
  31. <text class="time">{{item.submitTime}}</text>
  32. <template>
  33. <text class="user" v-if="item.handleAccountId > 0">{{ item.handleAccountName }}</text>
  34. <text class="user" v-else>{{item.wxName||'--'}}</text>
  35. </template>
  36. </view>
  37. <view class="status">{{snapshotStatus(item.status)}}</view>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="item-list basics danger" v-if="tabIdx===2">
  42. <view class="basics-item" v-for="(danger,dangerIdx) in items" :key="dangerIdx">
  43. <view class="basics-item-sceneIcon">
  44. <img @click="showImg([danger.scenePhoto])" class="icon" :src="danger.sceneIcon" v-if="danger.sceneIcon" />
  45. </view>
  46. <view class="basics-item-info" @click="linkTo(danger)">
  47. <view class="basics-title">{{danger.dangerTitle}}</view>
  48. <view class="basics-body">
  49. <view class="lf">
  50. <view class="user">{{danger.curAccountName}}</view>
  51. <view class="time">{{danger.dangerDeadLine}}</view>
  52. </view>
  53. <view class="status">{{dangerStatus(danger.status)}}</view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="item-list satisfaction" v-if="tabIdx===3">
  59. <view class="uni-table">
  60. <view class="uni-table-tr">
  61. <view class="uni-table-th">姓名</view>
  62. <view class="uni-table-th" style="80px;text-align:right;">评分</view>
  63. </view>
  64. <view class="uni-table-tr" v-for="(item,index) in items" :key="index" @click="showDetail(item)">
  65. <view class="uni-table-td">{{item.accountName||'微信用户'}}</view>
  66. <view class="uni-table-td" style="80px;text-align:right;">{{item.score===null?'--':item.score}}</view>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. <template v-else>
  72. <view class="isEmpty" >
  73. <p class="word">没有数据 ^_^ </p>
  74. </view>
  75. </template>
  76. </view>
  77. </template>
  78. <script>
  79. import {getDangerByPage} from '@/api/aqpt/dangerApi.js'
  80. import { getchecklistByPage} from '@/api/aqpt/checklistPoint.js'
  81. import { getSnapshotByPage} from '@/api/aqpt/snapshotApi.js'
  82. import { getcompletedchecklistByPage} from '@/api/aqpt/checklist.js'
  83. export default {
  84. data() {
  85. return {
  86. conditions:{
  87. page:1,
  88. limit:15,
  89. },
  90. total:0,
  91. items:[],
  92. tabIdx:1,
  93. isAccount:undefined,
  94. showback:window.android?true:false
  95. }
  96. },
  97. onShow() {
  98. this.init()
  99. },
  100. onLoad() {
  101. uni.$on('type',(tabIdx)=>{
  102. if(tabIdx){
  103. this.tabIdx=tabIdx
  104. // this.tabclick(tabIdx)
  105. }
  106. })
  107. },
  108. methods: {
  109. dangerStatus(i) {
  110. if (i >= 0) {
  111. const strs = ['待提交','待评审','待整改','待验收','已完成']
  112. return strs[i]
  113. } else {
  114. return '已撤销'
  115. }
  116. },
  117. checklistStatus(val){
  118. if(val===-1)return "巡检异常"
  119. const strs = ['未开始','未完成','完成']
  120. return strs[val]
  121. },
  122. dangerLevelFilter(val){
  123. let levels=['未知','一般隐患','重大隐患'];
  124. return levels[val]
  125. },
  126. snapshotStatus(val){
  127. if (val >= 0) {
  128. const strs = [
  129. '待处理',
  130. '已处理'
  131. ]
  132. return strs[val]
  133. } else {
  134. return '已撤销'
  135. }
  136. },
  137. init(){
  138. this.items=[]
  139. this.total=0
  140. this.conditions={
  141. limit:15,
  142. page:1
  143. }
  144. this.getData()
  145. this.clearDetail()
  146. this.isAccount=uni.getStorageSync('isAccount')
  147. },
  148. tabclick(tabIdx){
  149. this.tabIdx=tabIdx
  150. this.init()
  151. },
  152. back(){
  153. if(window.android){
  154. window.android.webExit()
  155. }
  156. },
  157. getData(){
  158. let qrcode=uni.getStorageSync('qrcode')
  159. let targetType=qrcode.targetType
  160. let targetId=qrcode.targetId
  161. if(this.tabIdx===2){
  162. getDangerByPage({
  163. ...this.conditions,
  164. riskPointId:targetId
  165. }).then((res)=>{
  166. let items=JSON.parse(JSON.stringify(this.items))
  167. this.items=items.concat(res.data)
  168. this.total=res.total
  169. })
  170. }
  171. if(this.tabIdx===1||this.tabIdx===3||this.tabIdx===4){
  172. let checklistTypeId=undefined;
  173. let enums={1:2,3:3,4:1}
  174. let params={
  175. ...this.conditions,
  176. targetType,
  177. targetId,
  178. }
  179. if(this.tabIdx!==1){params.checklistTypeId=enums[this.tabIdx]}
  180. let getchecklist=this.tabIdx===1?getcompletedchecklistByPage:getchecklistByPage
  181. getchecklist(params).then((res)=>{
  182. let items=JSON.parse(JSON.stringify(this.items))
  183. this.items=items.concat(res.data)
  184. this.total=res.total
  185. })
  186. }
  187. if(this.tabIdx===5){
  188. getSnapshotByPage({
  189. ...this.conditions,
  190. targetType,
  191. targetId
  192. }).then((res)=>{
  193. let items=JSON.parse(JSON.stringify(this.items))
  194. this.items=items.concat(res.data)
  195. this.total=res.total
  196. })
  197. }
  198. },
  199. changePageNumber({type,current}){
  200. this.conditions.page=current
  201. this.getData()
  202. },
  203. clearDetail(){
  204. if(uni.getStorageSync('detail-info')){
  205. uni.removeStorageSync('detail-info')
  206. }
  207. },
  208. linkTo(item){
  209. uni.setStorageSync('detail-info',item)
  210. uni.navigateTo({
  211. url:'/pages/history/detail/detail'
  212. })
  213. },
  214. showDetail(item){
  215. let pageUrl="";
  216. if(this.tabIdx===1){
  217. if(item.checklistTypeId===1){
  218. pageUrl="/pages/app_views/hazard/index/index"
  219. }else{
  220. pageUrl="/pages/app_views/checkList/index/index"
  221. }
  222. }
  223. if(this.tabIdx===3){
  224. pageUrl="/pages/app_views/satisfaction_evaluation/satisfaction_evaluation"
  225. }
  226. if(this.tabIdx===4){
  227. pageUrl="/pages/app_views/hazard/index/index"
  228. }
  229. if(this.tabIdx===5){
  230. pageUrl="/pages/app_views/problem_feedback/record/record"
  231. uni.navigateTo({
  232. url:`${pageUrl}?id=${item.snapshotId}`
  233. })
  234. return
  235. }
  236. uni.navigateTo({
  237. url:`${pageUrl}?type=history&id=${item.checklistId}&recordId=${item.recordId}`
  238. })
  239. },
  240. showImg(urls){
  241. uni.previewImage({
  242. urls
  243. })
  244. },
  245. isEmpty(val){
  246. if(val!=="undefined"&&val!==undefined&&val!==""&&val!==null){
  247. return false
  248. }
  249. return true
  250. }
  251. },
  252. onUnload() {
  253. uni.$off('type')
  254. },
  255. onPullDownRefresh() {
  256. this.init()
  257. uni.stopPullDownRefresh()
  258. },
  259. onReachBottom() {
  260. if(this.total>=this.conditions.page*this.conditions.limit){
  261. this.conditions.page++
  262. this.getData()
  263. }
  264. }
  265. }
  266. </script>
  267. <style lang="scss" scoped>
  268. .history-container{
  269. padding-bottom: 100rpx;
  270. min-height: 100vh;
  271. box-sizing: border-box;
  272. background-color: #F5F6F8;
  273. .tabs{
  274. overflow-x: auto;
  275. display: flex;
  276. background-color: #fff;
  277. border-radius: 16rpx;
  278. .tab{
  279. height: 88rpx;
  280. line-height: 88rpx;
  281. display: inline-block;
  282. padding: 0 32rpx;
  283. flex-shrink: 0;
  284. font-size: 28rpx;
  285. color: #35364F;
  286. &.active{
  287. font-size: 34rpx;
  288. color: #4D73FF;
  289. font-weight: 700;
  290. }
  291. }
  292. }
  293. .back{
  294. width: 100rpx;
  295. height: 100rpx;
  296. background-color: #4D73FF;
  297. color: #fff;
  298. font-size: 32rpx;
  299. text-align: center;
  300. line-height: 100rpx;
  301. box-shadow:1px 2px 8px rgba(0,0,0,0.5);
  302. position: fixed;
  303. right: 20rpx;
  304. top: 40%;
  305. z-index: 999;
  306. border-radius: 50%;
  307. }
  308. }
  309. .isEmpty{
  310. width: 100%;
  311. height: 100vh;
  312. background-image: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNzkgODYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxkZWZzPjxsaW5lYXJHcmFkaWVudCBpZD0iYSIgeDE9IjM4Ljg1JS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N2wxNS40MDcgNy4xODQgMTUuNjQ2LS40MjctMTUuNDA3LTcuMTg1eiIvPjxwYXRoIGZpbGw9InVybCgjYikiIGQ9Ik0xMyA0NWg0MHYzNkgxM3oiLz48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSg1MyA0NSkiPjxtYXNrIGlkPSJkIiBmaWxsPSIjZmZmIj48dXNlIHhsaW5rOmhyZWY9IiNjIi8+PC9tYXNrPjx1c2UgZmlsbD0iI0UwRTNFOSIgdHJhbnNmb3JtPSJtYXRyaXgoLTEgMCAwIDEgMTcgMCkiIHhsaW5rOmhyZWY9IiNjIi8+PHBhdGggZmlsbD0iI0Q1RDdERSIgbWFzaz0idXJsKCNkKSIgdHJhbnNmb3JtPSJtYXRyaXgoLTEgMCAwIDEgMjQgMCkiIGQ9Ik03IDBoMTdsLTQgMTgtMjAtMnoiLz48L2c+PHBhdGggZmlsbD0iI0Y4RjlGQiIgZD0iTTcwIDQ1SDUzbDkgMTNoMTd6Ii8+PC9nPjwvc3ZnPg==);
  313. background-size: contain;
  314. background-repeat: no-repeat;
  315. position: relative;
  316. background-color: #fff;
  317. /* #ifndef MP-WEIXIN */
  318. height: calc( 100vh - 100px);
  319. /* #endif */
  320. .word{
  321. width: 100%;
  322. text-align: center;
  323. position: absolute;
  324. top: 80vh;
  325. left: 0;
  326. color: #999;
  327. font-size: 28rpx;
  328. letter-spacing: 2rpx;
  329. }
  330. }
  331. .item-list-wrap{
  332. padding: 0 20rpx;
  333. background-color: #F5F6F8;
  334. margin-top: 18rpx;
  335. .item-list{
  336. background-color: #fff;
  337. border-radius: 16rpx;
  338. overflow: hidden;
  339. .chat-custom-right{
  340. .chat-custom-text{
  341. font-size: 24rpx;
  342. font-family: PingFang SC;
  343. font-weight: 400;
  344. line-height: 28rpx;
  345. color: #666666;
  346. }
  347. .bottom{
  348. text-align: right;
  349. padding-top: 10rpx;
  350. .status{
  351. font-size: 28rpx;
  352. line-height: 1;
  353. display: inline-block;
  354. border: 1px solid #13ce66;
  355. color: #13ce66;
  356. padding: 8rpx 10rpx;
  357. border-radius: 4rpx;
  358. }
  359. .level{
  360. line-height: 1;
  361. display: inline-block;
  362. font-size: 28rpx;
  363. color: #666666;
  364. margin-left: 10rpx;
  365. border: 1px solid transparent;
  366. padding: 8rpx 10rpx;
  367. border-radius: 4rpx;
  368. &-1{
  369. color:#13ce66 ;
  370. border-color: #13ce66;
  371. }
  372. &-2{
  373. color: red;
  374. border-color: red;
  375. }
  376. }
  377. }
  378. }
  379. &.basics{
  380. background-color: #F5F6F8;
  381. .basics-item{
  382. padding:30rpx 40rpx ;
  383. border-radius: 16rpx;
  384. margin-bottom: 20rpx;
  385. background-color: #fff;
  386. .basics-title{
  387. font-size: 32rpx;
  388. line-height: 48rpx;
  389. font-weight: 500;
  390. color: #212121;
  391. }
  392. .basics-body{
  393. display: flex;
  394. align-items: center;
  395. padding-top: 32rpx;
  396. .lf{
  397. flex: 1;
  398. .time{
  399. font-size: 24rpx;
  400. line-height: 48rpx;
  401. color: #999999;
  402. padding-left: 34rpx;
  403. background-position: center left;
  404. background-repeat: no-repeat;
  405. background-size: 24rpx 24rpx;
  406. background-image: url('/static/time.png');
  407. }
  408. .user{
  409. margin-left:24rpx ;
  410. font-size: 24rpx;
  411. line-height: 48rpx;
  412. color: #999999;
  413. padding-left: 34rpx;
  414. background-position: center left;
  415. background-repeat: no-repeat;
  416. background-size: 24rpx 24rpx;
  417. background-image: url('/static/user.png');
  418. }
  419. }
  420. .status{
  421. font-size: 28rpx;
  422. line-height: 48rpx;
  423. color: #4D73FF;
  424. }
  425. }
  426. }
  427. }
  428. &.satisfaction{
  429. padding: 10rpx 24rpx;
  430. &::v-deep{
  431. .uni-table-td,.uni-table-th{
  432. border: 0;
  433. }
  434. }
  435. }
  436. &.danger{
  437. .basics-item{
  438. display: flex;
  439. align-items: flex-start;
  440. .basics-item-sceneIcon{
  441. width:100rpx ;
  442. height: 100rpx;
  443. background-color: #f5f5f5;
  444. border-radius: 10rpx;
  445. overflow: hidden;
  446. .icon{
  447. display: block;
  448. width:100rpx ;
  449. height: 100rpx;
  450. }
  451. }
  452. .basics-item-info{
  453. flex: 1;
  454. padding-left: 16rpx;
  455. .basics-body{
  456. .lf{
  457. .user{
  458. margin-left: 0;
  459. }
  460. }
  461. }
  462. }
  463. }
  464. }
  465. }
  466. }
  467. .custom-item-footer{
  468. .name{
  469. font-size: 30rpx;
  470. color: #333;
  471. text-align: right;
  472. }
  473. .status{
  474. font-size: 26rpx;
  475. color: #666;
  476. text-align: right;
  477. padding-top: 10rpx;
  478. }
  479. }
  480. </style>