detail.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. <template>
  2. <view class="index-detail-page">
  3. <view class="container">
  4. <view class="tab-cont">
  5. <view class="part" v-if="type==='task'">
  6. <view class="tab">
  7. <view class="tab-item" :class="activeTab===1?'active':''" @click="tabChange(0,1)">待处理</view>
  8. <view class="tab-item" :class="activeTab===2?'active':''" @click="tabChange(1,2)">已完成</view>
  9. <view class="tab-item" :class="activeTab===3?'active':''" @click="tabChange(-1,3)">已撤销</view>
  10. </view>
  11. <view class="part-cont">
  12. <view class="item" v-for="item in taskList" :key="item.taskId">
  13. <view class="title">
  14. <view class="name">{{item.taskTitle}}</view>
  15. <view class="state">{{taskStatus(item.status)}}</view>
  16. </view>
  17. <view class="tags">
  18. <text class="tag">{{taskPriority(item.taskPriority)}}</text>
  19. <text class="tag">{{item.taskCatTitle}}</text>
  20. <text class="tag">{{taskType(item.taskTypeId)}}</text>
  21. </view>
  22. <view class="time">
  23. 预期结束时间:{{item.expectedEndTime}}
  24. </view>
  25. <view class="bottom">
  26. <view class="user">
  27. <image class="avatar" src="/static/index/user.png" mode="widthFix"></image>
  28. 处理人:{{item.handleAccountName}}
  29. </view>
  30. <view class="hand-time">
  31. {{item.launchTime}}
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="part" v-if="type==='alert'">
  38. <view class="tab">
  39. <view class="tab-item" :class="activeTab===1?'active':''" @click="tabChange(0,1)">待处理</view>
  40. <view class="tab-item" :class="activeTab===2?'active':''" @click="tabChange(1,2)">已处理</view>
  41. <view class="tab-item" :class="activeTab===3?'active':''" @click="tabChange(-1,3)">已撤销</view>
  42. </view>
  43. <view class="part-cont">
  44. <view class="item" v-for="item in alertList" :key="item.alertId">
  45. <view class="title">
  46. <view class="name">{{item.alertTitle}}</view>
  47. <view class="state">{{alertStatus(item.status)}}</view>
  48. </view>
  49. <view class="tags">
  50. <text class="tag">{{alertLevel(item.alertLevel)}}</text>
  51. </view>
  52. <view class="time">
  53. 发生时间:{{item.alertTime}}
  54. </view>
  55. <view class="bottom">
  56. <view class="user">
  57. <image class="avatar" src="/static/index/user.png" mode="widthFix"></image>
  58. 处理人:{{item.handleAccountName}}
  59. </view>
  60. <view class="hand-time">
  61. {{item.handleTime}}
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. <view class="part" v-if="type==='danger'">
  68. <view class="tab">
  69. <view class="tab-item" :class="activeTab===1?'active':''" @click="tabChange(0,1)">待处理</view>
  70. <view class="tab-item" :class="activeTab===2?'active':''" @click="tabChange(1,2)">我提交</view>
  71. <view class="tab-item" :class="activeTab===3?'active':''" @click="tabChange(1,3)">我处理</view>
  72. <view class="tab-item" :class="activeTab===4?'active':''" @click="tabChange(-1,4)">我撤销</view>
  73. </view>
  74. <view class="part-cont">
  75. <view class="item" v-for="item in dangerList" :key="item.dangerId">
  76. <view class="title">
  77. <view class="name">{{item.dangerTitle}}</view>
  78. <view class="state">{{dangerStatus(item.status)}}</view>
  79. </view>
  80. <view class="tags">
  81. <text class="tag">{{dangerLevel(item.dangerLevel)}}</text>
  82. <text class="tag">{{item.dangerCatTitle}}</text>
  83. </view>
  84. <view class="time">
  85. 预期结束时间:{{item.dangerDeadLine}}
  86. </view>
  87. <view class="bottom">
  88. <view class="user">
  89. <image class="avatar" src="/static/index/user.png" mode="widthFix"></image>
  90. 处理人:{{item.curAccountName}}
  91. </view>
  92. <view class="hand-time">
  93. {{item.submitTime}}
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. <template v-if="total<1">
  102. <view class="isEmpty" >
  103. <p class="word">没有数据 ^_^ </p>
  104. </view>
  105. </template>
  106. </view>
  107. </template>
  108. <script>
  109. import { getAlertByPage } from '@/api/aqpt/alertApi.js';
  110. import { getDangerByPage } from '@/api/aqpt/dangerApi.js';
  111. import { getTaskByPage } from '@/api/aqpt/taskApi.js';
  112. import{
  113. taskStatus,taskPriority,taskType,
  114. alertLevel,alertStatus,
  115. dangerStatus,dangerLevel,
  116. } from '@/libs/enum.js';
  117. export default {
  118. data() {
  119. return {
  120. type:undefined,
  121. activeTab:1,
  122. user:{},
  123. conditions: {
  124. page: 1,
  125. limit: 10,
  126. status:0
  127. },
  128. total:0,
  129. alertList:[],
  130. dangerList:[],
  131. taskList:[]
  132. }
  133. },
  134. onLoad({type,name}) {
  135. this.type=type
  136. let user=uni.getStorageSync('accountInfo');
  137. this.user=user
  138. uni.setNavigationBarTitle({
  139. title:`${name||'详情'}`
  140. })
  141. this.getData()
  142. },
  143. methods: {
  144. taskStatus,taskPriority,taskType,
  145. alertLevel,alertStatus,
  146. dangerStatus,dangerLevel,
  147. getData(){
  148. if(this.type==='task'){
  149. this.getTaskByPage()
  150. }
  151. if(this.type==='danger'){
  152. delete this.conditions.status
  153. this.getDangerByPage()
  154. }
  155. if(this.type==='alert'){
  156. this.getAlertByPage()
  157. }
  158. },
  159. getAlertByPage(){
  160. getAlertByPage(this.conditions).then((res)=>{
  161. this.alertList=res.data
  162. this.total=res.total
  163. })
  164. },
  165. getDangerByPage(){
  166. getDangerByPage(this.conditions).then((res)=>{
  167. this.dangerList=res.data
  168. this.total=res.total
  169. })
  170. },
  171. getTaskByPage(){
  172. getTaskByPage(this.conditions).then((res)=>{
  173. this.taskList=res.data
  174. this.total=res.total
  175. })
  176. },
  177. tabChange(value,index){
  178. this.activeTab=index
  179. if(this.type==='task'){
  180. this.conditions.status=value
  181. }
  182. if(this.type==='danger'){
  183. if (value === 1) {
  184. this.conditions.curAccountId = this.user.userId
  185. } else if (value === 2) {
  186. this.conditions.submitAccountId = this.user.userId
  187. } else if (value === 3) {
  188. this.conditions.handleAccountId = this.user.userId
  189. } else if (value === 4) {
  190. this.conditions.submitAccountId = this.user.userId
  191. this.conditions.status = -1
  192. }
  193. }
  194. if(this.type==='alert'){
  195. this.conditions.status=value
  196. }
  197. this.getData()
  198. },
  199. onPullDownRefresh() {
  200. this.activeTab=1,
  201. this.conditions= {page: 1,limit: 10},
  202. this.total=0,
  203. this.alertList=[]
  204. this.dangerList=[]
  205. this.taskList=[]
  206. this.getData()
  207. },
  208. onReachBottom() {
  209. if(this.total>=this.conditions.page*this.conditions.limit){
  210. this.conditions.page++
  211. this.getData()
  212. }
  213. }
  214. }
  215. }
  216. </script>
  217. <style lang="scss" scoped>
  218. .index-detail-page {
  219. min-height: 100vh;
  220. padding-bottom: 100rpx;
  221. background-color: rgba(245, 246, 248, 1);
  222. .container{
  223. padding: 0 32rpx;
  224. .tab-cont{
  225. .part{
  226. .tab{
  227. display: flex;
  228. align-items: center;
  229. padding-bottom: 10rpx;
  230. overflow-x: auto;
  231. .tab-item{
  232. display: inline-block;
  233. padding: 16rpx 20rpx;
  234. background-color: #fff;
  235. text-align: center;
  236. flex-shrink: 0;
  237. line-height: 1;
  238. font-size: 32rpx;
  239. color: #333;
  240. border: 1px solid #eaeaea;
  241. box-sizing: border-box;
  242. border-left: 0;
  243. &.active{
  244. background-color: #1e80ff;
  245. color: #fff;
  246. border-color: #1e80ff;
  247. }
  248. }
  249. }
  250. .part-cont{
  251. .item{
  252. background-color: #fff;
  253. border-radius: 12rpx;
  254. margin-top: 16rpx;
  255. padding: 24rpx 20rpx;
  256. .title{
  257. display: flex;
  258. justify-content: space-between;
  259. align-items: center;
  260. .name{
  261. font-size: 36rpx;
  262. color: rgba(0, 0, 0, 0.8);
  263. }
  264. .state{
  265. font-size: 32rpx;
  266. color: rgba(250, 139, 55, 1);
  267. }
  268. }
  269. .tags{
  270. padding-top: 24rpx;
  271. .tag{
  272. background: rgba(245, 246, 248, 1);
  273. font-size: 20rpx;
  274. margin-left: 10rpx;
  275. padding: 10rpx 20rpx;
  276. &:nth-child(1){
  277. color: rgba(234, 130, 89, 1);
  278. background: rgba(251, 241, 237, 1);
  279. }
  280. }
  281. }
  282. .time{
  283. padding-top: 20rpx;
  284. font-size: 28rpx;
  285. color:rgba(241, 57, 57, 0.8);
  286. }
  287. .bottom{
  288. display: flex;
  289. justify-content: space-between;
  290. align-items: center;
  291. padding-top: 20rpx;
  292. .user{
  293. display: flex;
  294. align-items: center;
  295. font-size: 24rpx;
  296. color: rgba(0, 0, 0, 1);
  297. .avatar{
  298. width: 44rpx;
  299. margin-right: 10rpx;
  300. }
  301. }
  302. .hand-time{
  303. font-size: 24rpx;
  304. color: rgba(0, 0, 0, 1);
  305. }
  306. }
  307. }
  308. }
  309. }
  310. }
  311. }
  312. .isEmpty{
  313. width: 100%;
  314. height: 100vh;
  315. background-image: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNzkgODYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPjxkZWZzPjxsaW5lYXJHcmFkaWVudCBpZD0iYSIgeDE9IjM4Ljg1JSIgeTE9IjAlIiB4Mj0iNjEuMTUlIiB5Mj0iMTAwJSI+PHN0b3Agc3RvcC1jb2xvcj0iI0ZDRkNGRCIgb2Zmc2V0PSIwJSIvPjxzdG9wIHN0b3AtY29sb3I9IiNFRUVGRjMiIG9mZnNldD0iMTAwJSIvPjwvbGluZWFyR3JhZGllbnQ+PGxpbmVhckdyYWRpZW50IGlkPSJiIiB4MT0iMCUiIHkxPSI5LjUlIiB5Mj0iOTAuNSUiPjxzdG9wIHN0b3AtY29sb3I9IiNGQ0ZDRkQiIG9mZnNldD0iMCUiLz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HhsaW5rOmhyZWY9IiNjIi8+PHBhdGggZmlsbD0iI0Q1RDdERSIgbWFzaz0idXJsKCNkKSIgdHJhbnNmb3JtPSJtYXRyaXgoLTEgMCAwIDEgMjQgMCkiIGQ9Ik03IDBoMTdsLTQgMTgtMjAtMnoiLz48L2c+PHBhdGggZmlsbD0iI0Y4RjlGQiIgZD0iTTcwIDQ1SDUzbDkgMTNoMTd6Ii8+PC9nPjwvc3ZnPg==);
  316. background-size: contain;
  317. background-repeat: no-repeat;
  318. position: relative;
  319. background-color: #fff;
  320. /* #ifndef MP-WEIXIN */
  321. height: calc( 100vh - 100px);
  322. /* #endif */
  323. .word{
  324. width: 100%;
  325. text-align: center;
  326. position: absolute;
  327. top: 80vh;
  328. left: 0;
  329. color: #999;
  330. font-size: 28rpx;
  331. letter-spacing: 2rpx;
  332. }
  333. }
  334. }
  335. </style>