ReligiousPeopleReportList.vue 7.9 KB

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