information.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <!-- 消息 -->
  2. <template>
  3. <view id="information">
  4. <scroll-view scroll-y @scrolltolower="scrollGet" class="info-max-box">
  5. <view class="for-info-box" v-for="(item,index) in infoList" :key="index" @click="goInfoPage(item)">
  6. <img v-if='item.isApply==1' src="@/images/icon_xx_tz.png">
  7. <img v-if='item.isApply==2' src="@/images/icon_xx_tz.png">
  8. <img v-if='item.isApply!=1 && item.isApply!=2' src="@/images/icon_01.png">
  9. <view class="right-box">
  10. <view class="top-box">
  11. <view>{{item.isApply==1?'准入驳回':(item.isApply==2?item.remark:
  12. (item.isApply==3||item.isApply==-1?item.sendName:(item.isApply==4||item.isApply==5?item.remark:'')))}}</view>
  13. <!-- <view v-if='item.isApply==2'>{{item.remark}}</view>
  14. <view v-if='item.isApply==3 || item.isApply==-1'>{{item.sendName}}</view> -->
  15. <view>{{item.isApply==1?item.subName:(item.isApply==2?'':
  16. (item.isApply==3||item.isApply==-1?item.deptName:(item.isApply==4||item.isApply==5?'':'')))}}</view>
  17. <!-- <view v-if='item.isApply==1'>{{item.subName}}</view>
  18. <view v-if='item.isApply==2'></view>
  19. <view v-if='item.isApply==3 && item.isApply==-1'>{{item.deptName}}</view> -->
  20. <view>{{item.newMessageDate}}</view>
  21. </view>
  22. <view class="bottom">{{item.newMessage}}</view>
  23. </view>
  24. </view>
  25. <view class="get-null-box" v-if="getData.nullDataType">暂无更多数据</view>
  26. </scroll-view>
  27. <tab-bar ref='infoAll'></tab-bar>
  28. </view>
  29. </template>
  30. <script>
  31. import { groupList,queryByMessage } from '@/api/index.js'
  32. import { tabBar } from '@/component/tabBar.vue'
  33. export default {
  34. components: {
  35. tabBar
  36. },
  37. data() {
  38. return {
  39. infoList:[],
  40. //列表请求参数
  41. getData:{
  42. page:1,
  43. pageSize:20,
  44. getType:true,
  45. nullDataType:true,
  46. }
  47. }
  48. },
  49. onLoad() {
  50. },
  51. onShow(){
  52. this.clearData();
  53. this.getList();
  54. this.$refs.infoAll.getTotalList();
  55. },
  56. methods: {
  57. //清除
  58. clearData(){
  59. this.infoList = [];
  60. this.getData.page = 1;
  61. this.getData.getType = true;
  62. this.getData.nullDataType = true;
  63. },
  64. //去消息详情页面
  65. goInfoPage(item){
  66. if(item.isApply==1){
  67. uni.navigateTo({
  68. url:'/pages/information/notPassInfo?item='+encodeURIComponent(JSON.stringify(item))
  69. })
  70. }else if(item.isApply==2){
  71. uni.navigateTo({
  72. url: '/pages_manage/workbench/receiveCasuallyPat/casuallyPatInfo?item='+encodeURIComponent(JSON.stringify(item))
  73. });
  74. }else if(item.isApply==3 || item.isApply == -1){
  75. uni.navigateTo({
  76. url:'/pages/information/informationInfo?item='+encodeURIComponent(JSON.stringify(item))
  77. })
  78. }else if(item.isApply==4){
  79. //记录详情-未执行 dynamicId 4
  80. let obj = {
  81. messageUserId:item.messageUserId,
  82. recordId:item.dynamicId
  83. }
  84. uni.navigateTo({
  85. url:'/pages_manage/gradingControl/gradingControlDetail?item='+encodeURIComponent(JSON.stringify(obj))
  86. })
  87. }else if(item.isApply==5){
  88. //完成控制-页面 messageContext 5
  89. let obj = JSON.parse(item.messageContext);
  90. this.queryByMessage(obj,item.messageUserId)
  91. // obj.messageUserId = item.messageUserId
  92. // uni.navigateTo({
  93. // url:'/pages/gradingControl/gradingControlAdd?obj='+encodeURIComponent(JSON.stringify(obj))
  94. // })
  95. }
  96. },
  97. async queryByMessage(obj,messageUserId){
  98. const {data} = await queryByMessage(obj);
  99. if(data.code == 200){
  100. uni.navigateTo({
  101. url:'/pages_manage/gradingControl/gradingControlAdd?item='+encodeURIComponent(JSON.stringify(data.data))+'&item2='+encodeURIComponent(JSON.stringify(data.data.detailList[0]))+'&messageUserId='+messageUserId
  102. })
  103. }
  104. },
  105. //滚动事件
  106. scrollGet(){
  107. if(this.getData.getType){
  108. this.getData.page += 1;
  109. this.getList();
  110. }
  111. },
  112. //获取列表数据
  113. async getList(){
  114. let self = this;
  115. let obj = {
  116. pageNum:this.getData.page,
  117. pageSize:this.getData.pageSize,
  118. };
  119. const {data} = await groupList(obj);
  120. if(data.code==200){
  121. let newDataList = data.rows;
  122. for(let i=0;i<newDataList.length;i++){
  123. if(!newDataList[i].newMessageDate || newDataList[i].newMessageDate == null){
  124. newDataList[i].newMessageDate = '';
  125. }else{
  126. let timeOne = (new Date(newDataList[i].newMessageDate)).getTime();
  127. newDataList[i].newMessageDate = self.formatDate(timeOne);
  128. newDataList[i].newMessage = unescape(newDataList[i].newMessage);
  129. let reg1 = RegExp(/<img/);
  130. let reg2 = RegExp(/<iframe/);
  131. if(newDataList[i].newMessage.match(reg1)){
  132. newDataList[i].newMessage = "[图片]"
  133. }if(newDataList[i].newMessage.match(reg2)){
  134. newDataList[i].newMessage = "[视频]"
  135. }else{
  136. newDataList[i].newMessage=newDataList[i].newMessage.replace(/<\/?.+?>/g,"");
  137. }
  138. }
  139. }
  140. if(self.page==1){
  141. if(data.rows.length > 0 && data.rows.length == self.getData.pageSize){
  142. self.infoList = data.rows;
  143. }else if(data.rows.length > 0 && data.rows.length != self.getData.pageSize){
  144. self.infoList = data.rows;
  145. self.getData.getType = false;
  146. self.getData.nullDataType = true;
  147. }else{
  148. self.getData.getType = false;
  149. self.getData.nullDataType = true;
  150. }
  151. }else{
  152. if(data.rows.length > 0 && data.rows.length == self.getData.pageSize){
  153. self.infoList = self.infoList.concat(data.rows)
  154. }else if(data.rows.length > 0 && data.rows.length != self.getData.pageSize){
  155. self.infoList = self.infoList.concat(data.rows);
  156. self.getData.getType = false;
  157. self.getData.nullDataType = true;
  158. }else{
  159. self.getData.getType = false;
  160. self.getData.nullDataType = true;
  161. }
  162. }
  163. }
  164. },
  165. formatDate(date) {
  166. let newDate = new Date(date);
  167. let YY = newDate.getFullYear() + '-';
  168. let MM = (newDate.getMonth() + 1 < 10 ? '0' + (newDate.getMonth() + 1) : newDate.getMonth() + 1) + '-';
  169. let DD = (newDate.getDate() < 10 ? '0' + (newDate.getDate()) : newDate.getDate());
  170. return YY + MM + DD;
  171. },
  172. }
  173. }
  174. </script>
  175. <style lang="stylus" scoped>
  176. #information{
  177. height:100%;
  178. display flex
  179. background #fff
  180. .info-max-box{
  181. flex:1;
  182. overflow: scroll
  183. padding-bottom:100rpx;
  184. background #fff
  185. margin:0 20rpx;
  186. .for-info-box:nth-child(1){
  187. border:none;
  188. }
  189. .for-info-box{
  190. height:150rpx;
  191. border-top:1rpx solid #F5F5F5;
  192. display flex
  193. img{
  194. border-radius:50%;
  195. margin:25rpx 28rpx 25rpx 20rpx;
  196. width:100rpx;
  197. height:100rpx;
  198. }
  199. .right-box{
  200. flex:1;
  201. .top-box{
  202. display flex
  203. line-height:67rpx;
  204. margin-top:7rpx;
  205. view:nth-child(1){
  206. font-size:30rpx;
  207. color:#333333;
  208. margin-right:28rpx;
  209. }
  210. view:nth-child(2){
  211. font-size:24rpx;
  212. color:#CCCCCC;
  213. flex:1;
  214. white-space:nowrap;
  215. overflow:hidden;
  216. text-overflow:ellipsis;
  217. }
  218. view:nth-child(3){
  219. font-size:20rpx;
  220. color:#CCCCCC;
  221. text-align right;
  222. }
  223. }
  224. .bottom{
  225. width:530rpx;
  226. line-height:62rpx;
  227. font-size:25rpx;
  228. color: #666666;
  229. display block
  230. overflow:hidden;
  231. text-overflow:ellipsis;
  232. white-space:nowrap;
  233. }
  234. }
  235. }
  236. .get-null-box{
  237. height:100rpx;
  238. line-height:100rpx;
  239. color:#999;
  240. text-align center
  241. }
  242. }
  243. }
  244. </style>