index.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. <script setup>
  2. import {
  3. ref
  4. } from "vue";
  5. import {
  6. onLoad,
  7. onPullDownRefresh,
  8. onReachBottom,
  9. onPageScroll,
  10. } from "@dcloudio/uni-app";
  11. import {
  12. getImportantKind,
  13. getImportantList
  14. } from "@/api/work/important.js";
  15. import {
  16. timeFormat
  17. } from "@/utils/timeFormatter.js";
  18. // ====================================选择开始时间
  19. let beginDateStart = ref(null)
  20. let beginTimeShow = ref(false)
  21. function showBeginTimeChoose() {
  22. beginTimeShow.value = true
  23. }
  24. function beginTimeClose(e) {
  25. if (e) {
  26. let time = timeFormat(e.value)
  27. searchInfo.value.beginDate = time
  28. }
  29. beginTimeShow.value = false
  30. }
  31. // ====================================选择结束时间
  32. let beginDateEnd = ref(null)
  33. let endTimeShow = ref(false)
  34. function showEndTimeChoose() {
  35. endTimeShow.value = true
  36. }
  37. function endTimeClose(e) {
  38. if (e) {
  39. let time = timeFormat(e.value)
  40. searchInfo.value.endDate = time
  41. }
  42. endTimeShow.value = false
  43. }
  44. // ====================================选择专题类型
  45. let kindList = ref([]);
  46. let kindListFull = ([]);
  47. function getKindList() {
  48. getImportantKind().then(res => {
  49. kindList.value = [res.data.type.map(item => item.title)];
  50. kindListFull = res.data.type;
  51. })
  52. };
  53. let kindShow = ref(false)
  54. function showKindChoose() {
  55. kindShow.value = true
  56. }
  57. function kindClose(e) {
  58. if (e) searchInfo.value.kind = e.value[0];
  59. kindShow.value = false;
  60. }
  61. // =========================================搜索
  62. let scrollTop = ref(0);
  63. let moreListFlag = true; // 触底加载flag
  64. let searchInfo = ref({
  65. pageNo: 1,
  66. pageSize: 10,
  67. kind: null, //当前页面
  68. host: null, //主持人姓名
  69. title: null, //会议主题
  70. beginDate: null, //会议时间段_开始时间
  71. endDate: null, //会议时间段_结束时间
  72. });
  73. let projectList = ref([]);
  74. let listTotal = ref(0);
  75. function reSearch() {
  76. searchInfo.value.pageNo = 1;
  77. projectList.value = [];
  78. moreListFlag = true;
  79. getList();
  80. };
  81. function getList() {
  82. let params = Object.assign({}, searchInfo.value);
  83. if (params.beginDate) {
  84. params.beginDate = params.beginDate.replace('/', '-');
  85. params.beginDate = params.beginDate.replace('/', '-');
  86. }
  87. if (params.endDate) {
  88. params.endDate = params.endDate.replace('/', '-');
  89. params.endDate = params.endDate.replace('/', '-');
  90. }
  91. getImportantList(params).then(res => {
  92. projectList.value = projectList.value.concat(res.data.list);
  93. listTotal.value = res.data.total;
  94. if (res.data.total == searchInfo.value.pageNo*searchInfo.value.pageSize-(10 - res.data.list.length)) moreListFlag = false;
  95. })
  96. };
  97. function goToPage(id) {
  98. uni.navigateTo({
  99. url: `/pages/important/detail/index?id=${id}`
  100. })
  101. }
  102. onLoad(() => {
  103. let now = new Date();
  104. let year = now.getFullYear();
  105. let month = now.getMonth() + 1 < 10 ? `0${now.getMonth() + 1< 10}` : now.getMonth() + 1;
  106. let day = now.getDate() < 10 ? `0${now.getDate()}` : now.getDate();
  107. beginDateStart.value = `${year}/${month}/${day}`; // 开始时间
  108. beginDateEnd.value = `${year}/${month}/${day}`; // 结束时间
  109. getKindList();
  110. getList();
  111. })
  112. onPullDownRefresh(() => {
  113. try {
  114. searchInfo.value = {
  115. pageNo: 1,
  116. pageSize: 10,
  117. kind: null, //当前页面
  118. host: null, //主持人姓名
  119. title: null, //会议主题
  120. beginDate: null, //会议时间段_开始时间
  121. endDate: null, //会议时间段_结束时间
  122. };
  123. reSearch();
  124. } finally {
  125. uni.stopPullDownRefresh()
  126. }
  127. })
  128. onReachBottom(() => {
  129. if (!moreListFlag) {
  130. return uni.showToast({
  131. title: "已经到底了。",
  132. icon: "none",
  133. duration: 2000
  134. })
  135. }
  136. searchInfo.value.pageNo++;
  137. getList();
  138. });
  139. onPageScroll((e) => {
  140. scrollTop.value = e.scrollTop;
  141. });
  142. </script>
  143. <template>
  144. <view class="container">
  145. <page-title>重大事项</page-title>
  146. <view class="cards-list">
  147. <view class="card only-card">
  148. <!-- 计划开始日期 -->
  149. <view class="card-item first-card-item" @click="showBeginTimeChoose()">
  150. <view class="card-item-name">开始日期</view>
  151. <view class="card-item-description">
  152. <view v-if="searchInfo.beginDate">{{searchInfo.beginDate}}</view>
  153. <view v-else class="remind-text">请选择开始日期</view>
  154. <u-icon name="arrow-right" color="#343437" size="16" customStyle="margin-left:10rpx"></u-icon>
  155. </view>
  156. </view>
  157. <!-- 计划结束日期 -->
  158. <view class="card-item" @click="showEndTimeChoose()">
  159. <view class="card-item-name">结束日期</view>
  160. <view class="card-item-description">
  161. <view v-if="searchInfo.endDate">{{searchInfo.endDate}}</view>
  162. <view v-else class="remind-text">请选择结束日期</view>
  163. <u-icon name="arrow-right" color="#343437" size="16" customStyle="margin-left:10rpx"></u-icon>
  164. </view>
  165. </view>
  166. <!-- 事项 -->
  167. <view class="card-item">
  168. <view class="card-item-name">事项</view>
  169. <input v-model="searchInfo.xxx" class="card-item-input" placeholder="请填写事项" placeholder-style="color: #D8D8D8"
  170. maxlength="20" />
  171. </view>
  172. <!-- 专题类型 -->
  173. <view class="card-item" @click="showKindChoose()">
  174. <view class="card-item-name">专题类型</view>
  175. <view class="card-item-description">
  176. <view v-if="searchInfo.kind">{{searchInfo.kind}}</view>
  177. <view v-else class="remind-text">请选择状态</view>
  178. <u-icon name="arrow-right" color="#343437" size="16" customStyle="margin-left:10rpx"></u-icon>
  179. </view>
  180. </view>
  181. </view>
  182. <view class="search-btn" @click="reSearch()">确定</view>
  183. <view class="card" v-for="(item,index) in projectList" :key="index">
  184. <card-title :numerator="index+1" :denominator="listTotal"></card-title>
  185. <view class="card-item">
  186. <view class="card-item-name">专题类型</view>
  187. <view class="card-item-content">{{item.kindName || "--"}}</view>
  188. </view>
  189. <view class="card-item">
  190. <view class="card-item-name">日期</view>
  191. <view class="card-item-content">{{item.meetingDate || "--"}}</view>
  192. </view>
  193. <view class="card-item">
  194. <view class="card-item-name">主题</view>
  195. <view class="card-item-content zrrTel">{{item.meetingTitle || "--"}}</view>
  196. </view>
  197. <view class="card-item">
  198. <view class="card-item-name">主持人</view>
  199. <view class="card-item-content">{{item.host || "--"}}</view>
  200. </view>
  201. <view class="card-item" @click="goToPage(item.id)">
  202. <view class="card-btn fat-btn empty-btn">查看详情</view>
  203. </view>
  204. </view>
  205. <empty-show v-if="projectList.length===0"></empty-show>
  206. </view>
  207. <!-- 开始时间 -->
  208. <u-datetime-picker :show="beginTimeShow" @confirm="beginTimeClose" @cancel="beginTimeClose" @close="beginTimeClose"
  209. v-model="beginDateStart" mode="date" closeOnClickOverlay></u-datetime-picker>
  210. <!-- 结束时间 -->
  211. <u-datetime-picker :show="endTimeShow" @confirm="endTimeClose" @cancel="endTimeClose" @close="endTimeClose"
  212. v-model="beginDateEnd" mode="date" closeOnClickOverlay></u-datetime-picker>
  213. <!-- 专题类型 -->
  214. <u-picker :show="kindShow" :columns="kindList" @confirm="kindClose" @cancel="kindClose" @close="kindClose"
  215. closeOnClickOverlay></u-picker>
  216. <u-back-top :scroll-top="scrollTop"></u-back-top>
  217. </view>
  218. </template>
  219. <style lang="scss" scoped>
  220. .search-btn {
  221. width: 98%;
  222. height: 84rpx;
  223. margin: 40rpx auto 56rpx;
  224. line-height: 84rpx;
  225. text-align: center;
  226. color: #FFFFFF;
  227. font-size: 36rpx;
  228. background: #1763E7;
  229. border-radius: 16rpx;
  230. }
  231. </style>