message.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <view>
  3. <cu-custom bgColor="bg-blue" backUrl="/pages/index/index?id=apps" :isBack="false">
  4. <block slot="content"> 消息</block>
  5. </cu-custom>
  6. <u-search :show-action="false" v-model="searchForm.title" @change="inputWord" margin="20rpx 50rpx"></u-search>
  7. <view>
  8. <u-swipe-action>
  9. <view
  10. v-for="(notify, index) in dataList"
  11. :key="index">
  12. <u-swipe-action-item @click="del(notify.id)" :key="notify.id" :threshold="60" duration="500"
  13. :options="[ {
  14. text: '删除',
  15. style: {
  16. backgroundColor: '#f56c6c'
  17. }
  18. }]">
  19. <u-cell-group>
  20. <u-cell @click="toDetail(notify)">
  21. <u-avatar slot="icon" icon="bell-fill" fontSize="22" randomBgColor></u-avatar>
  22. <view slot="title" class="content">
  23. <view class="text-bold text-grey">
  24. <view class="ellipsis-description">
  25. 标题:{{notify.title}}
  26. </view>
  27. </view>
  28. <view class="text-gray text-sm">
  29. <view class="ellipsis-description">
  30. 发布者:{{notify.createBy.name}}, {{notify.createTime}}
  31. </view>
  32. </view>
  33. <view class="text-sm">
  34. <view class="ellipsis-description">
  35. 内容:{{notify.content}}
  36. </view>
  37. </view>
  38. </view>
  39. <view slot="right-icon">
  40. <u-tag :text="$dictUtils.getDictLabel('oa_notify_read', notify.readFlag ,'')" v-if="notify.readFlag === '1'" plain shape="circle"></u-tag>
  41. <u-tag :text="$dictUtils.getDictLabel('oa_notify_read', notify.readFlag ,'')" v-else plain type="error" shape="circle"></u-tag>
  42. </view>
  43. </u-cell>
  44. </u-cell-group>
  45. </u-swipe-action-item>
  46. </view>
  47. </u-swipe-action>
  48. </view>
  49. <u-loadmore :status="status" @loadmore="loadmore" :line="true" />
  50. <u-gap height="100" bgColor="#fff"></u-gap>
  51. <u-back-top :scrollTop="0" mode="square"></u-back-top>
  52. </view>
  53. </template>
  54. <script>
  55. import taskService from "@/api/flowable/taskService"
  56. import noticeService from "@/api/flowable/NoticeService"
  57. import notifyService from "@/api/notify/notifyService";
  58. import pick from "lodash.pick";
  59. export default {
  60. data() {
  61. return {
  62. status: 'loadmore',
  63. searchForm: {
  64. title: ''
  65. },
  66. dataList: [],
  67. tablePage: {
  68. pages: 0,
  69. currentPage: 0,
  70. pageSize: 10,
  71. orders: [{ column: "a.create_time", asc: false }],
  72. },
  73. loading: false,
  74. }
  75. },
  76. created() {
  77. this.loadmore()
  78. },
  79. methods: {
  80. // 跳转到详细页面
  81. toDetail (notify) {
  82. if(notify.status === '1'){
  83. uni.navigateTo({
  84. url: '/pages/apps/notification/notificationDetail?id='+notify.id
  85. })
  86. }else{
  87. this.toEdit(notify)
  88. }
  89. },
  90. todo (row) {
  91. console.log('row', row)
  92. this.inputForm = {
  93. taskId: '',
  94. noticeId: '',
  95. taskName: ''
  96. }
  97. console.log('进来了+++', row.taskId)
  98. taskService.getTaskDef({
  99. procInsId: row.taskId,
  100. procDefId: row.defId
  101. }).then((data) => {
  102. this.inputForm.taskId = row.taskId
  103. this.inputForm.noticeId = row.noticeName
  104. this.inputForm.taskName = row.taskName
  105. // noticeService.update(this.inputForm)
  106. let query = {readOnly: true, title: `审批【${row.taskName || ''}】`, formTitle: `${row.title}`, ...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId')}
  107. uni.navigateTo({
  108. url: '/pages/workbench/task/TaskFormDetail?flow='+JSON.stringify(query)
  109. })
  110. })
  111. },
  112. toEdit (notify) {
  113. uni.navigateTo({
  114. url: '/pages/apps/notification/oaNotifyForm?id='+notify.id
  115. })
  116. },
  117. toAdd (){
  118. uni.navigateTo({
  119. url: '/pages/apps/notification/oaNotifyForm'
  120. })
  121. },
  122. // 输入监听
  123. inputWord(e){
  124. this.searchTimer && clearTimeout(this.searchTimer)
  125. this.searchTimer = setTimeout(()=>{
  126. this.doSearch()
  127. },300)
  128. },
  129. // 搜索
  130. doSearch(){
  131. this.dataList = [];
  132. this.tablePage.currentPage = 0;
  133. this.tablePage.pageSize = 10;
  134. this.tablePage.pages = 0;
  135. this.loadmore()
  136. },
  137. onReachBottom() {
  138. this.loadmore()
  139. },
  140. loadmore() {
  141. if(this.tablePage.currentPage!==0 && this.tablePage.pages <= this.tablePage.currentPage ) {
  142. this.status = 'nomore';
  143. return;
  144. }
  145. this.tablePage.currentPage = ++ this.tablePage.currentPage;
  146. //联网加载数据
  147. this.status = 'loading';
  148. notifyService.list({
  149. isSelf: true,
  150. current: this.tablePage.currentPage,
  151. size: this.tablePage.pageSize,
  152. orders: this.tablePage.orders,
  153. ...this.searchForm
  154. }).then((data)=>{
  155. //追加新数据
  156. this.dataList=this.dataList.concat(data.records);
  157. this.tablePage.pages = data.pages;
  158. if(this.tablePage.pages <= this.tablePage.currentPage){
  159. this.status = 'nomore'
  160. } else {
  161. this.status = 'loadmore'
  162. }
  163. })
  164. },
  165. del (id) {
  166. notifyService.delete(id).then((data)=>{
  167. this.doSearch()
  168. uni.showToast({
  169. title: data,
  170. icon:"success"
  171. })
  172. })
  173. },
  174. }
  175. }
  176. </script>