history.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  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. getchecklistByPage({
  167. ...this.conditions,
  168. targetType,
  169. targetId,
  170. checklistTypeId:enums[this.tabIdx]
  171. }).then((res)=>{
  172. let items=JSON.parse(JSON.stringify(this.items))
  173. this.items=items.concat(res.data)
  174. this.total=res.total
  175. })
  176. }
  177. if(this.tabIdx===5){
  178. getSnapshotByPage({
  179. ...this.conditions,
  180. targetType,
  181. targetId
  182. }).then((res)=>{
  183. let items=JSON.parse(JSON.stringify(this.items))
  184. this.items=items.concat(res.data)
  185. this.total=res.total
  186. })
  187. }
  188. },
  189. changePageNumber({type,current}){
  190. this.conditions.page=current
  191. this.getData()
  192. },
  193. clearDetail(){
  194. if(uni.getStorageSync('detail-info')){
  195. uni.removeStorageSync('detail-info')
  196. }
  197. },
  198. linkTo(item){
  199. uni.setStorageSync('detail-info',item)
  200. uni.navigateTo({
  201. url:'/pages/history/detail/detail'
  202. })
  203. },
  204. showDetail(item){
  205. let pageUrl="";
  206. if(this.tabIdx===1){
  207. pageUrl="/pages/app_views/checkList/index/index"
  208. }
  209. if(this.tabIdx===3){
  210. pageUrl="/pages/app_views/satisfaction_evaluation/satisfaction_evaluation"
  211. }
  212. if(this.tabIdx===4){
  213. pageUrl="/pages/app_views/hazard/index/index"
  214. }
  215. if(this.tabIdx===5){
  216. pageUrl="/pages/app_views/problem_feedback/record/record"
  217. uni.navigateTo({
  218. url:`${pageUrl}?id=${item.snapshotId}`
  219. })
  220. return
  221. }
  222. uni.navigateTo({
  223. url:`${pageUrl}?type=history&id=${item.checklistId}&recordId=${item.recordId}`
  224. })
  225. },
  226. showImg(urls){
  227. uni.previewImage({
  228. urls
  229. })
  230. },
  231. isEmpty(val){
  232. if(val!=="undefined"&&val!==undefined&&val!==""&&val!==null){
  233. return false
  234. }
  235. return true
  236. }
  237. },
  238. onUnload() {
  239. uni.$off('type')
  240. },
  241. onPullDownRefresh() {
  242. this.init()
  243. uni.stopPullDownRefresh()
  244. },
  245. onReachBottom() {
  246. if(this.total>=this.conditions.page*this.conditions.limit){
  247. this.conditions.page++
  248. this.getData()
  249. }
  250. }
  251. }
  252. </script>
  253. <style lang="scss" scoped>
  254. .history-container{
  255. padding-bottom: 100rpx;
  256. min-height: 100vh;
  257. box-sizing: border-box;
  258. background-color: #F5F6F8;
  259. .tabs{
  260. overflow-x: auto;
  261. display: flex;
  262. background-color: #fff;
  263. border-radius: 16rpx;
  264. .tab{
  265. height: 88rpx;
  266. line-height: 88rpx;
  267. display: inline-block;
  268. padding: 0 32rpx;
  269. flex-shrink: 0;
  270. font-size: 28rpx;
  271. color: #35364F;
  272. &.active{
  273. font-size: 34rpx;
  274. color: #4D73FF;
  275. font-weight: 700;
  276. }
  277. }
  278. }
  279. }
  280. .isEmpty{
  281. width: 100%;
  282. height: 100vh;
  283. background-image: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNzkgODYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxkZWZzPjxsaW5lYXJHcmFkaWVudCBpZD0iYSIgeDE9IjM4Ljg1JSIgeTE9IjAlIiB4Mj0iNjEuMTUlIiB5Mj0iMTAwJSI+PHN0b3Agc3RvcC1jb2xvcj0iI0ZDRkNGRCIgb2Zmc2V0PSIwJSIvPjxzdG9wIHN0b3AtY29sb3I9IiNFRUVGRjMiIG9mZnNldD0iMTAwJSIvPjwvbGluZWFyR3JhZGllbnQ+PGxpbmVhckdyYWRpZW50IGlkPSJiIiB4MT0iMCUiIHkxPSI5LjUlIiB5Mj0iOTAuNSUiPjxzdG9wIHN0b3AtY29sb3I9IiNGQ0ZDRkQiIG9mZnNldD0iMCUiLz48c3RvcCBzdG9wLWNvbG9yPSIjRTlFQkVGIiBvZmZzZXQ9IjEwMCUiLz48L2xpbmVhckdyYWRpZW50PjxwYXRoIGlkPSJjIiBkPSJNMCAwaDE3djM2SDB6Ii8+PC9kZWZzPjxnIGZpbGw9Im5vbmUiIGZpbGwtcn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dGggZmlsbD0iI0Y4RjlGQiIgZD0iTTcwIDQ1SDUzbDkgMTNoMTd6Ii8+PC9nPjwvc3ZnPg==);
  284. background-size: contain;
  285. background-repeat: no-repeat;
  286. position: relative;
  287. background-color: #fff;
  288. /* #ifndef MP-WEIXIN */
  289. height: calc( 100vh - 100px);
  290. /* #endif */
  291. .word{
  292. width: 100%;
  293. text-align: center;
  294. position: absolute;
  295. top: 80vh;
  296. left: 0;
  297. color: #999;
  298. font-size: 28rpx;
  299. letter-spacing: 2rpx;
  300. }
  301. }
  302. .item-list-wrap{
  303. padding: 0 20rpx;
  304. background-color: #F5F6F8;
  305. margin-top: 18rpx;
  306. .item-list{
  307. background-color: #fff;
  308. border-radius: 16rpx;
  309. overflow: hidden;
  310. .chat-custom-right{
  311. .chat-custom-text{
  312. font-size: 24rpx;
  313. font-family: PingFang SC;
  314. font-weight: 400;
  315. line-height: 28rpx;
  316. color: #666666;
  317. }
  318. .bottom{
  319. text-align: right;
  320. padding-top: 10rpx;
  321. .status{
  322. font-size: 28rpx;
  323. line-height: 1;
  324. display: inline-block;
  325. border: 1px solid #13ce66;
  326. color: #13ce66;
  327. padding: 8rpx 10rpx;
  328. border-radius: 4rpx;
  329. }
  330. .level{
  331. line-height: 1;
  332. display: inline-block;
  333. font-size: 28rpx;
  334. color: #666666;
  335. margin-left: 10rpx;
  336. border: 1px solid transparent;
  337. padding: 8rpx 10rpx;
  338. border-radius: 4rpx;
  339. &-1{
  340. color:#13ce66 ;
  341. border-color: #13ce66;
  342. }
  343. &-2{
  344. color: red;
  345. border-color: red;
  346. }
  347. }
  348. }
  349. }
  350. &.basics{
  351. background-color: #F5F6F8;
  352. .basics-item{
  353. padding:30rpx 40rpx ;
  354. border-radius: 16rpx;
  355. margin-bottom: 20rpx;
  356. background-color: #fff;
  357. .basics-title{
  358. font-size: 32rpx;
  359. line-height: 48rpx;
  360. font-weight: 500;
  361. color: #212121;
  362. }
  363. .basics-body{
  364. display: flex;
  365. align-items: center;
  366. padding-top: 32rpx;
  367. .lf{
  368. flex: 1;
  369. .time{
  370. font-size: 24rpx;
  371. line-height: 48rpx;
  372. color: #999999;
  373. padding-left: 34rpx;
  374. background-position: center left;
  375. background-repeat: no-repeat;
  376. background-size: 24rpx 24rpx;
  377. background-image: url('/static/time.png');
  378. }
  379. .user{
  380. margin-left:24rpx ;
  381. font-size: 24rpx;
  382. line-height: 48rpx;
  383. color: #999999;
  384. padding-left: 34rpx;
  385. background-position: center left;
  386. background-repeat: no-repeat;
  387. background-size: 24rpx 24rpx;
  388. background-image: url('/static/user.png');
  389. }
  390. }
  391. .status{
  392. font-size: 28rpx;
  393. line-height: 48rpx;
  394. color: #4D73FF;
  395. }
  396. }
  397. }
  398. }
  399. &.satisfaction{
  400. padding: 10rpx 24rpx;
  401. &::v-deep{
  402. .uni-table-td,.uni-table-th{
  403. border: 0;
  404. }
  405. }
  406. }
  407. &.danger{
  408. .basics-item{
  409. display: flex;
  410. align-items: flex-start;
  411. .basics-item-sceneIcon{
  412. width:100rpx ;
  413. height: 100rpx;
  414. background-color: #f5f5f5;
  415. border-radius: 10rpx;
  416. overflow: hidden;
  417. .icon{
  418. display: block;
  419. width:100rpx ;
  420. height: 100rpx;
  421. }
  422. }
  423. .basics-item-info{
  424. flex: 1;
  425. padding-left: 16rpx;
  426. .basics-body{
  427. .lf{
  428. .user{
  429. margin-left: 0;
  430. }
  431. }
  432. }
  433. }
  434. }
  435. }
  436. }
  437. }
  438. .custom-item-footer{
  439. .name{
  440. font-size: 30rpx;
  441. color: #333;
  442. text-align: right;
  443. }
  444. .status{
  445. font-size: 26rpx;
  446. color: #666;
  447. text-align: right;
  448. padding-top: 10rpx;
  449. }
  450. }
  451. </style>