commonList.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <view>
  3. <view class="list_search card_banner flex">
  4. <uni-datetime-picker class="list_search_date" v-model="searchForm.createTime" type="daterange" />
  5. <u-icon class="list_search_icon" name="search" color="#fff" size="28" @click="doSearch"></u-icon>
  6. </view>
  7. <view class="list_content">
  8. <u-cell-group>
  9. <u-cell v-for="item in dataList" @click="toInfo(item)">
  10. <view slot="title">
  11. <view class="text-bold text-black">
  12. <view class="ellipsis-description">
  13. {{item.name}}
  14. </view>
  15. </view>
  16. </view>
  17. <view slot="value">
  18. <view>
  19. <u-tag v-if="type==1 || type==4" text="点击中止" type="warning" @click="suspend(item)">
  20. </u-tag>
  21. </view>
  22. <view class="text-grey text-sm list_label margin-top">
  23. {{item.createTime}}
  24. </view>
  25. </view>
  26. <view slot="label">
  27. <view class="text-grey margin-top">
  28. {{item.authorPerson}}
  29. </view>
  30. </view>
  31. </u-cell>
  32. </u-cell-group>
  33. </view>
  34. <u-loadmore :status="status" />
  35. </view>
  36. </template>
  37. <script>
  38. import yzCirculationCardService from '@/api/commonseal/yzCirculationCardService.js'
  39. import yzFlowService from '@/api/commonseal/yzFlowService.js'
  40. import * as $auth from "@/common/auth.js"
  41. export default {
  42. onShow() {
  43. // 先获取页面栈
  44. let pages = getCurrentPages();
  45. // 当前页面的前一个页面
  46. let prevPage = pages[pages.length - 1];
  47. if (prevPage.options.type) {
  48. this.dataList = []
  49. this.type = prevPage.options.type
  50. switch (prevPage.options.type) {
  51. case "1":
  52. uni.setNavigationBarTitle({
  53. title: '待办列表' // 设置为你想要显示的标题文本
  54. });
  55. break;
  56. case "3":
  57. uni.setNavigationBarTitle({
  58. title: '归档列表' // 设置为你想要显示的标题文本
  59. });
  60. break;
  61. case "4":
  62. uni.setNavigationBarTitle({
  63. title: '已办列表' // 设置为你想要显示的标题文本
  64. });
  65. break;
  66. case "5":
  67. uni.setNavigationBarTitle({
  68. title: '公文列表' // 设置为你想要显示的标题文本
  69. });
  70. break;
  71. }
  72. this.searchForm.state = prevPage.options.type
  73. this.tablePage.currentPage = 0
  74. this.status = 'loading';
  75. this.loadmore()
  76. }
  77. },
  78. data() {
  79. return {
  80. status: 'loadmore',
  81. type: "",
  82. time: "",
  83. value: "",
  84. range: [],
  85. dataList: [],
  86. searchForm: {
  87. yearNum: '',
  88. cardNum: '',
  89. state: '',
  90. createTime: ""
  91. },
  92. tablePage: {
  93. pages: 0,
  94. currentPage: 0,
  95. pageSize: 10,
  96. orders: [{
  97. column: "a.create_time",
  98. asc: false
  99. }],
  100. },
  101. loading: false,
  102. }
  103. },
  104. methods: {
  105. // 中止
  106. suspend(row) {
  107. let that = this
  108. uni.showModal({
  109. title: '中止原因',
  110. placeholderText: '输入中止原因',
  111. editable: true,
  112. success: function(res) {
  113. if (res.confirm) {
  114. that.status = 'loading';
  115. row.suspend = res.content;
  116. row.state = 2;
  117. row.authorPerson = row.authorId;
  118. row.proofreader = row.proofreaderId;
  119. yzCirculationCardService.save(row).then((data) => {
  120. uni.showToast({
  121. title: "已中止",
  122. })
  123. that.status = 'loadmore'
  124. that.dataList = [];
  125. that.tablePage.currentPage = 0;
  126. that.tablePage.pageSize = 10;
  127. that.tablePage.pages = 0;
  128. that.loadmore()
  129. });
  130. } else if (res.cancel) {
  131. console.log('用户点击取消');
  132. }
  133. }
  134. });
  135. },
  136. // 查看详情
  137. toInfo(item) {
  138. if (this.type == 3 || this.type == 5 || this.type == 4) {
  139. uni.navigateTo({
  140. url: '/pages/commonseal/commonInfo?id=' + item.id
  141. })
  142. } else {
  143. uni.navigateTo({
  144. url: '/pages/commonseal/examineCommon?id=' + item.id
  145. })
  146. }
  147. },
  148. // 搜索
  149. doSearch() {
  150. this.dataList = [];
  151. this.tablePage.currentPage = 0;
  152. this.tablePage.pageSize = 10;
  153. this.tablePage.pages = 0;
  154. this.loadmore()
  155. },
  156. onReachBottom() {
  157. this.loadmore()
  158. },
  159. loadmore() {
  160. if (this.tablePage.currentPage !== 0 && this.tablePage.pages <= this.tablePage.currentPage) {
  161. this.status = 'nomore';
  162. return;
  163. }
  164. this.tablePage.currentPage = ++this.tablePage.currentPage;
  165. //联网加载数据
  166. this.status = 'loading';
  167. let {
  168. createTime,
  169. ...newForm
  170. } = this.searchForm
  171. yzCirculationCardService.list({
  172. current: this.tablePage.currentPage,
  173. size: this.tablePage.pageSize,
  174. orders: this.tablePage.orders,
  175. beginCreateDate: this.searchForm.createTime ? this.searchForm.createTime[0] : '',
  176. endCreateDate: this.searchForm.createTime ? this.searchForm.createTime[1] : '',
  177. ...newForm
  178. }).then((data) => {
  179. //追加新数据
  180. this.dataList = this.dataList.concat(data.records);
  181. this.tablePage.pages = data.pages;
  182. if (this.tablePage.pages <= this.tablePage.currentPage) {
  183. this.status = 'nomore'
  184. } else {
  185. this.status = 'loadmore'
  186. }
  187. })
  188. }
  189. }
  190. }
  191. </script>
  192. <style>
  193. .card_banner {
  194. width: 100%;
  195. height: 60px;
  196. background-color: #36a7f3;
  197. }
  198. .ellipsis-description {
  199. font-size: 18px;
  200. }
  201. .u-transition {
  202. align-items: flex-end;
  203. }
  204. .list_search_icon {
  205. line-height: 60px;
  206. }
  207. .list_search_select {
  208. width: 200px;
  209. background-color: #fff;
  210. height: 30px;
  211. border-radius: 10px;
  212. margin: 15px 5px 0;
  213. }
  214. .list_search_date {
  215. margin: 8px 5px 0;
  216. }
  217. .t-c {
  218. height: 34px;
  219. line-height: 34px;
  220. }
  221. .list_content {
  222. background-color: #fff;
  223. }
  224. .list_label {
  225. margin-top: 33px;
  226. }
  227. </style>