history.vue 13 KB

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