ReligiousPeopleReportList.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <template>
  2. <van-nav-bar
  3. fixed
  4. title="信教群众异常"
  5. right-text="上报"
  6. left-arrow
  7. @click-left="onClickLeft"
  8. @click-right="onClickRight"
  9. />
  10. <div class="main">
  11. <van-search
  12. v-model="searchVal"
  13. clearable
  14. show-action
  15. shape="round"
  16. placeholder="请输入搜索关键词"
  17. label="姓名"
  18. input-align="center"
  19. @search="onSearch"
  20. @cancel="onCancel"
  21. />
  22. <van-tabs
  23. v-show="!searchShow"
  24. v-model:active="active"
  25. title-inactive-color="#bdbdbd"
  26. title-active-color="#36a7f3"
  27. >
  28. <van-tab title="未审核" name="0">
  29. <van-list
  30. v-model:loading="loading"
  31. :finished="finished"
  32. finished-text="没有更多了"
  33. @load="onLoad"
  34. >
  35. <van-swipe-cell
  36. v-for="item in list"
  37. :key="item"
  38. :before-close="beforeClose"
  39. >
  40. <div class="list_item" @click="goInfo(item.id)">
  41. <div class="item-left">
  42. <p style="color: #c4c4c4">{{ item.partyTime }}</p>
  43. <p style="color: red">待审核</p>
  44. </div>
  45. <van-cell is-link>
  46. <template #title>
  47. <p>异常人员:{{ item.abnormalName }}</p>
  48. <p>身份证号:{{ item.abnormalIdcar }}</p>
  49. <p>异常行为:{{ item.abnormalBehavior }}</p>
  50. </template>
  51. </van-cell>
  52. </div>
  53. <template #right>
  54. <van-button
  55. square
  56. type="danger"
  57. text="删除"
  58. class="button"
  59. @click="beforeClose(item.id)"
  60. />
  61. <van-button
  62. square
  63. type="primary"
  64. text="修改"
  65. class="button"
  66. @click="updateItem(item)"
  67. />
  68. </template>
  69. </van-swipe-cell>
  70. </van-list>
  71. </van-tab>
  72. <van-tab title="已审核" name="1">
  73. <van-list
  74. v-model:loading="loading"
  75. :finished="finished"
  76. finished-text="没有更多了"
  77. @load="onLoad"
  78. >
  79. <van-swipe-cell v-for="item in readList" :key="item">
  80. <div class="list_item" @click="goInfo(item.id)">
  81. <div class="item-left">
  82. <p style="color: #c4c4c4">{{ item.partyTime }}</p>
  83. <p style="color: red">已审核</p>
  84. </div>
  85. <van-cell is-link>
  86. <template #title>
  87. <p>异常人员:{{ item.abnormalName }}</p>
  88. <p>身份证号:{{ item.abnormalIdcar }}</p>
  89. <p>异常行为:{{ item.abnormalBehavior }}</p>
  90. </template>
  91. </van-cell>
  92. </div>
  93. </van-swipe-cell>
  94. </van-list>
  95. </van-tab>
  96. </van-tabs>
  97. <!-- 搜索结果 -->
  98. <van-list
  99. v-show="searchShow"
  100. v-model:loading="loading"
  101. :finished="finished"
  102. finished-text="没有更多了"
  103. @load="onLoad"
  104. >
  105. <van-swipe-cell v-for="item in searchList" :key="item">
  106. <div class="list_item" @click="goInfo(item.id)">
  107. <div class="item-left">
  108. <p style="color: #c4c4c4">{{ item.partyTime }}</p>
  109. <p style="color: red">已审核</p>
  110. </div>
  111. <van-cell is-link>
  112. <template #title>
  113. <p>异常人员:{{ item.abnormalName }}</p>
  114. <p>身份证号:{{ item.abnormalIdcar }}</p>
  115. <p>异常行为:{{ item.abnormalBehavior }}</p>
  116. </template>
  117. </van-cell>
  118. </div>
  119. </van-swipe-cell>
  120. </van-list>
  121. <van-dialog
  122. v-model:show="showDel"
  123. show-cancel-button
  124. confirmButtonText="删除"
  125. message="请确认删除该记录"
  126. @confirm="Itemdel"
  127. >
  128. </van-dialog>
  129. </div>
  130. </template>
  131. <script>
  132. import { ref } from "vue";
  133. import ReligiousPeopleReportService from "@/api/differentbelievers/ReligiousPeopleReportService";
  134. import { useRouter } from "vue-router";
  135. export default {
  136. name: "ReligiousPeopleReportList",
  137. setup() {
  138. const onClickLeft = () => {
  139. history.back();
  140. };
  141. // 上报
  142. const onClickRight = () => {
  143. router.push("/differentbelievers");
  144. };
  145. // 切换
  146. let active = ref(0);
  147. // 未审核列表
  148. let list = ref([]);
  149. // 已审核列表
  150. let readList = ref([]);
  151. const loading = ref(false);
  152. const finished = ref(false);
  153. let index = 0;
  154. const onLoad = () => {
  155. loading.value = true;
  156. finished.value = false;
  157. // 异步更新数据
  158. new ReligiousPeopleReportService()
  159. .list({
  160. current: index + 1,
  161. size: 10,
  162. })
  163. .then(({ records, total }) => {
  164. records.forEach((item) => {
  165. if (item.assessment == 0) {
  166. list.value.push(item);
  167. } else {
  168. readList.value.push(item);
  169. }
  170. });
  171. // 加载状态结束
  172. loading.value = false;
  173. let page = parseInt(total / 10);
  174. // 数据全部加载完成
  175. if (index >= page || total < 10) {
  176. finished.value = true;
  177. } else {
  178. index++;
  179. }
  180. });
  181. };
  182. // 搜索
  183. let searchShow = ref(false);
  184. let searchList = ref([]);
  185. const searchVal = ref("");
  186. const onSearch = () => {
  187. searchShow.value = true;
  188. searchList.value = [];
  189. new ReligiousPeopleReportService()
  190. .list({
  191. current: 1,
  192. size: 10000,
  193. abnormalName: searchVal.value,
  194. })
  195. .then(({ records }) => {
  196. searchList.value.push(...records);
  197. // 加载状态结束
  198. loading.value = false;
  199. });
  200. };
  201. const onCancel = () => {
  202. searchVal.value = "";
  203. searchShow.value = false;
  204. };
  205. // 删除确认
  206. let showDel = ref(false);
  207. let ids = ref("");
  208. const beforeClose = (val) => {
  209. showDel.value = true;
  210. ids.value = val;
  211. };
  212. // 删除
  213. const Itemdel = () => {
  214. new ReligiousPeopleReportService().delete(ids.value).then((res) => {
  215. console.log("删除", res);
  216. index = 0;
  217. loading.value = true;
  218. list.value = [];
  219. readList.value = [];
  220. onLoad();
  221. });
  222. };
  223. let router = useRouter();
  224. // 修改跳转
  225. const updateItem = (val) => {
  226. router.push({
  227. path: "/differentbelievers",
  228. query: { id: val.id },
  229. });
  230. };
  231. // 详情跳转
  232. const goInfo = (val) => {
  233. router.push({
  234. path: "/differentbelieversInfo",
  235. query: { id: val },
  236. });
  237. };
  238. return {
  239. active,
  240. onClickLeft,
  241. list,
  242. readList,
  243. onLoad,
  244. loading,
  245. finished,
  246. searchShow,
  247. searchVal,
  248. searchList,
  249. onSearch,
  250. onCancel,
  251. onClickRight,
  252. updateItem,
  253. goInfo,
  254. showDel,
  255. beforeClose,
  256. Itemdel,
  257. };
  258. },
  259. };
  260. </script >
  261. <style scope>
  262. .main {
  263. background: #fff;
  264. position: relative;
  265. top: 40px;
  266. }
  267. .van-list {
  268. height: 80%;
  269. margin-top: 5px;
  270. }
  271. .list_item {
  272. display: flex;
  273. background: #fff;
  274. }
  275. .item-left {
  276. text-align: center;
  277. width: 30%;
  278. font-size: 12px;
  279. border-right: 1px solid #eee;
  280. }
  281. .button {
  282. height: 100%;
  283. }
  284. </style>