religiousConferenceList.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <van-nav-bar
  3. title="负责人会议"
  4. left-text=""
  5. right-text="上报"
  6. left-arrow
  7. @click-left="onClickLeft"
  8. @click-right="onClickRight"
  9. />
  10. <van-search v-model="value" shape="round" placeholder="请输入搜索关键词" />
  11. <van-tabs
  12. v-model:active="active"
  13. title-inactive-color="#bdbdbd"
  14. title-active-color="#36a7f3"
  15. @click-tab="onClickTab"
  16. >
  17. <van-tab title="未审核" name="0">
  18. <van-list
  19. v-model:loading="loading"
  20. :finished="finished"
  21. finished-text="没有更多了"
  22. @load="onLoad"
  23. >
  24. <van-swipe-cell
  25. v-for="item in list"
  26. :key="item"
  27. :before-close="beforeClose"
  28. >
  29. <div class="list_item" @click="goInfo(item.id)">
  30. <div class="item-left">
  31. <p style="color: #c4c4c4">{{ item.updateDate }}</p>
  32. <p style="color: red">待审核</p>
  33. </div>
  34. <van-cell is-link>
  35. <template #title >
  36. {{ item.siteName.name }}({{ item.meetingTime }})
  37. </template>
  38. <template #label>
  39. {{ item.participants.name }}
  40. </template>
  41. </van-cell>
  42. </div>
  43. <template #right>
  44. <van-button square type="danger" text="删除" class="button" />
  45. <van-button
  46. square
  47. type="primary"
  48. text="修改"
  49. class="button"
  50. @click="updateItem(item)"
  51. />
  52. </template>
  53. </van-swipe-cell>
  54. </van-list>
  55. </van-tab>
  56. <van-tab title="已审核" name="1">
  57. <van-list
  58. v-model:loading="loading"
  59. :finished="finished"
  60. finished-text="没有更多了"
  61. @load="onLoad"
  62. >
  63. <van-swipe-cell
  64. v-for="item in list"
  65. :key="item"
  66. :before-close="beforeClose"
  67. >
  68. <div class="list_item" @click="goInfo(item.id)">
  69. <div class="item-left">
  70. <p style="color: #c4c4c4">{{ item.updateDate }}</p>
  71. <p style="color: gray">已审核</p>
  72. </div>
  73. <van-cell is-link>
  74. <template #title >
  75. {{ item.siteName.name }}({{ item.meetingTime }})
  76. </template>
  77. <template #label>
  78. {{ item.participants.name }}
  79. </template>
  80. </van-cell>
  81. </div>
  82. </van-swipe-cell>
  83. </van-list>
  84. </van-tab>
  85. </van-tabs>
  86. </template>
  87. <script>
  88. import { ref } from "vue";
  89. import router from "@/router";
  90. import religiousConferenceService from "@/api/religiousConference/religiousConferenceService";
  91. export default {
  92. name: "religiousConferenceList",
  93. setup() {
  94. const onClickLeft = () => {
  95. history.back();
  96. };
  97. const onClickRight = () => {
  98. router.push("/religiousConferenceView");
  99. };
  100. let tabIndex = ref(0);
  101. //tab切换
  102. let active = ref(0);
  103. const onClickTab = (val) => {
  104. // 清空列表数据
  105. finished.value = false;
  106. list.value = [];
  107. // 重新加载数据
  108. // 将 loading 设置为 true,表示处于加载状态
  109. loading.value = true;
  110. index = 0;
  111. if (val.name == 0) {
  112. onLoad(0);
  113. } else {
  114. onLoad(1);
  115. }
  116. };
  117. // 列表
  118. let list = ref([]);
  119. const loading = ref(false);
  120. const finished = ref(false);
  121. let index = 0;
  122. const onLoad = (val) => {
  123. // 异步更新数据
  124. console.log(val);
  125. new religiousConferenceService()
  126. .list({
  127. current: index + 1,
  128. size: 10,
  129. assessment:val ? val : 0,
  130. })
  131. .then((res) => {
  132. list.value.push(...res.records) ;
  133. // 加载状态结束
  134. loading.value = false;
  135. // 数据全部加载完成
  136. if (res.records.length < 10) {
  137. finished.value = true;
  138. }
  139. index++;
  140. });
  141. };
  142. // 搜索
  143. let value = ref("");
  144. // 删除确认
  145. const beforeClose = ({ position }) => {
  146. switch (position) {
  147. case "left":
  148. case "cell":
  149. case "outside":
  150. return true;
  151. case "right":
  152. return new Promise((resolve) => {
  153. showConfirmDialog({
  154. title: "确定删除吗?",
  155. }).then(resolve);
  156. });
  157. }
  158. };
  159. // 详情跳转
  160. const goInfo = (val) => {
  161. router.push({
  162. path: "/religiousConferenceInfo",
  163. query: { id: val },
  164. });
  165. };
  166. return {
  167. onClickLeft,
  168. onClickTab,
  169. list,
  170. onLoad,
  171. loading,
  172. finished,
  173. value,
  174. onClickRight,
  175. tabIndex,
  176. goInfo,
  177. beforeClose,
  178. };
  179. },
  180. };
  181. </script>
  182. <style>
  183. body {
  184. background: #f5f5f5;
  185. }
  186. .nav_tab {
  187. width: 100vw;
  188. display: flex;
  189. text-align: center;
  190. background: #fff;
  191. margin: 10px 0;
  192. }
  193. .tab {
  194. flex: 1;
  195. line-height: 40px;
  196. font-size: 14px;
  197. }
  198. .active {
  199. background: #36a7f3;
  200. color: #fff;
  201. }
  202. .van-list {
  203. height: 80%;
  204. margin-top: 5px;
  205. }
  206. .list_item {
  207. display: flex;
  208. background: #fff;
  209. }
  210. .item-left {
  211. text-align: center;
  212. width: 30%;
  213. font-size: 12px;
  214. border-right: 1px solid #eee;
  215. }
  216. .button {
  217. height: 100%;
  218. }
  219. </style>