history.vue 13 KB

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