history.vue 12 KB

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