securityFacilitiesErrList.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. <template>
  2. <van-nav-bar
  3. fixed
  4. title="安防设施异常"
  5. left-text=""
  6. left-arrow
  7. @click-left="onClickLeft"
  8. @click-right="onClickRight"
  9. >
  10. <template #right>
  11. <van-icon name="plus" size="18" />
  12. </template>
  13. </van-nav-bar>
  14. <div class="main">
  15. <van-search
  16. v-model="searchVal"
  17. readonly="true"
  18. clearable
  19. show-action
  20. shape="round"
  21. placeholder="请选择"
  22. label="场所名称"
  23. input-align="center"
  24. @search="onSearch"
  25. @cancel="onCancel"
  26. @click-input="showPlace = true"
  27. />
  28. <van-popup v-model:show="showPlace" round position="bottom">
  29. <van-picker
  30. title="场所选择"
  31. :columns="places"
  32. :columns-field-names="customFieldName"
  33. @cancel="showPlace = false"
  34. @confirm="getPlace"
  35. />
  36. </van-popup>
  37. <van-tabs
  38. v-show="!searchShow"
  39. v-model:active="active"
  40. title-inactive-color="#bdbdbd"
  41. title-active-color="#36a7f3"
  42. @click-tab="onClickTab"
  43. >
  44. <van-tab title="未审核" name="0">
  45. <van-list
  46. v-model:loading="loading"
  47. :finished="finished"
  48. finished-text="没有更多了"
  49. @load="onLoad"
  50. >
  51. <van-swipe-cell v-for="item in list" :key="item">
  52. <div class="list_item" @click="goInfo(item.id)">
  53. <div class="item-left">
  54. <p style="color: #c4c4c4">
  55. {{ item.updateDate }}
  56. </p>
  57. <p style="color: red">待审核</p>
  58. </div>
  59. <van-cell is-link v-if="item.facilityType==0">
  60. <template #title >
  61. {{ item.siteName.name }}({{ item.videoAudioPoint.name }})
  62. </template>
  63. <template #label>
  64. {{ item.abnormalContent }}
  65. </template>
  66. </van-cell>
  67. <van-cell is-link v-if="item.facilityType==1">
  68. <template #title >
  69. {{ item.siteName.name }}({{ item.siteFireProtection.name }})
  70. </template>
  71. <template #label>
  72. {{ item.abnormalContent }}
  73. </template>
  74. </van-cell>
  75. </div>
  76. <template #right>
  77. <van-button
  78. square
  79. type="danger"
  80. text="删除"
  81. class="button"
  82. @click="deleteItem(item.id)"
  83. />
  84. <van-button
  85. square
  86. type="primary"
  87. text="修改"
  88. class="button"
  89. @click="updateItem(item)"
  90. />
  91. </template>
  92. </van-swipe-cell>
  93. </van-list>
  94. </van-tab>
  95. <van-tab title="已审核" name="1">
  96. <van-list
  97. v-model:loading="loading"
  98. :finished="finished"
  99. finished-text="没有更多了"
  100. @load="onLoad"
  101. >
  102. <van-swipe-cell v-for="item in list" :key="item">
  103. <div class="list_item" @click="goInfo(item.id)">
  104. <div class="item-left">
  105. <p style="color: #c4c4c4">
  106. {{ item.updateDate }}
  107. </p>
  108. <p style="color: gray">已审核</p>
  109. </div>
  110. <van-cell is-link v-if="item.facilityType==0">
  111. <template #title >
  112. {{ item.siteName.name }}({{ item.videoAudioPoint.name }})
  113. </template>
  114. <template #label>
  115. {{ item.abnormalContent }}
  116. </template>
  117. </van-cell>
  118. <van-cell is-link v-if="item.facilityType==1">
  119. <template #title >
  120. {{ item.siteName.name }}({{ item.siteFireProtection.name }})
  121. </template>
  122. <template #label>
  123. {{ item.abnormalContent }}
  124. </template>
  125. </van-cell>
  126. </div>
  127. </van-swipe-cell>
  128. </van-list>
  129. </van-tab>
  130. </van-tabs>
  131. <!-- 搜索结果 -->
  132. <van-list
  133. v-show="searchShow"
  134. v-model:loading="loading"
  135. :finished="finished"
  136. finished-text="没有更多了"
  137. @load="onLoad"
  138. >
  139. <van-swipe-cell v-for="item in searchList" :key="item">
  140. <div class="list_item" @click="goInfo(item.id)">
  141. <div class="item-left">
  142. <p style="color: #c4c4c4">
  143. {{ item.updateDate }}
  144. </p>
  145. <p style="color: red">
  146. <span v-if="item.assessment == 1">已审核</span>
  147. <span v-else>待审核</span>
  148. </p>
  149. </div>
  150. <van-cell is-link v-if="item.facilityType==0">
  151. <template #title >
  152. {{ item.siteName.name }}({{ item.videoAudioPoint.name }})
  153. </template>
  154. <template #label>
  155. {{ item.abnormalContent }}
  156. </template>
  157. </van-cell>
  158. <van-cell is-link v-if="item.facilityType==1">
  159. <template #title >
  160. {{ item.siteName.name }}({{ item.siteFireProtection.name }})
  161. </template>
  162. <template #label>
  163. {{ item.abnormalContent }}
  164. </template>
  165. </van-cell>
  166. </div>
  167. </van-swipe-cell>
  168. </van-list>
  169. <van-dialog
  170. v-model:show="showDel"
  171. show-cancel-button
  172. confirmButtonText="删除"
  173. message="请确认删除该记录"
  174. @confirm="Itemdel"
  175. >
  176. </van-dialog>
  177. </div>
  178. </template>
  179. <script>
  180. import { ref } from "vue";
  181. import router from "@/router";
  182. import securityFacilitiesErrService from "@/api/securityFacilitiesErr/securityFacilitiesErrService";
  183. import tools from "@/api/sys/tools";
  184. export default {
  185. name: "securityFacilitiesErrList",
  186. setup() {
  187. const onClickLeft = () => {
  188. history.back();
  189. };
  190. const onClickRight = () => {
  191. router.push("/securityFacilitiesErrView");
  192. };
  193. let active = ref(0);
  194. let list = ref([]);
  195. const loading = ref(false);
  196. const finished = ref(false);
  197. let index = 0;
  198. //tab切换
  199. const onClickTab = ({name}) => {
  200. // 清空列表数据
  201. finished.value = false;
  202. list.value = [];
  203. loading.value = true;
  204. index = 0;
  205. onLoad();
  206. };
  207. const onLoad = () => {
  208. loading.value = true;
  209. finished.value = false;
  210. // 异步更新数据active绑定的是标签中的name值
  211. new securityFacilitiesErrService()
  212. .list({
  213. current: index + 1,
  214. size: 10,
  215. assessment:active.value,
  216. siteName:{id:searchValId.value}
  217. })
  218. .then((res) => {
  219. list.value.push(...res.records) ;
  220. // 加载状态结束
  221. loading.value = false;
  222. // 数据全部加载完成
  223. if (res.pages <= index + 1) {
  224. finished.value = true;
  225. }
  226. index++;
  227. });
  228. };
  229. // 搜索
  230. const onSerchClick= () => {
  231. searchShow.value = true;
  232. searchList.value = [];
  233. new siteInspectionService()
  234. .list(qs.stringify({
  235. current: 1,
  236. size: 10000,
  237. activityName: searchValId.value,
  238. }))
  239. .then(({ records }) => {
  240. searchList.value.push(...records);
  241. // 加载状态结束
  242. loading.value = false;
  243. });
  244. };
  245. let searchShow = ref(false);
  246. let searchList = ref([]);
  247. const searchVal = ref("");
  248. const searchValId = ref("");
  249. const onSearch = () => {
  250. searchShow.value = true;
  251. searchList.value = [];
  252. new siteInspectionService()
  253. .list({
  254. current: 1,
  255. size: 10000,
  256. activityName: searchVal.value,
  257. })
  258. .then(({ records }) => {
  259. searchList.value.push(...records);
  260. // 加载状态结束
  261. loading.value = false;
  262. });
  263. };
  264. const onCancel = () => {
  265. searchVal.value = "";
  266. searchValId.value = "";
  267. searchShow.value = false;
  268. finished.value = false;
  269. list.value = [];
  270. loading.value = true;
  271. index = 0;
  272. onLoad();
  273. };
  274. // 场所名称
  275. let places = ref([]);
  276. const customFieldName = {
  277. text: "name",
  278. value: "id",
  279. };
  280. new tools()
  281. .placeList({
  282. current: 1,
  283. size: 10000,
  284. })
  285. .then(({ records }) => {
  286. places.value.push(...records);
  287. });
  288. let showPlace = ref(false);
  289. const getPlace = ({ selectedOptions }) => {
  290. if(selectedOptions[0]!=undefined&&selectedOptions[0]!=null){
  291. showPlace.value = false;
  292. searchVal.value=selectedOptions[0].name;
  293. searchValId.value=selectedOptions[0].id;
  294. finished.value = false;
  295. list.value = [];
  296. loading.value = true;
  297. index = 0;
  298. onLoad();
  299. }
  300. };
  301. // 删除确认
  302. let showDel = ref(false);
  303. let ids = ref("");
  304. const deleteItem = (val) => {
  305. showDel.value = true;
  306. ids.value = val;
  307. };
  308. // 删除
  309. const Itemdel = () => {
  310. new securityFacilitiesErrService().delete(ids.value).then((res) => {
  311. index = 0;
  312. loading.value = true;
  313. list.value = [];
  314. onLoad();
  315. });
  316. };
  317. // 修改跳转
  318. const updateItem = (val) => {
  319. router.push({
  320. path: "/securityFacilitiesErrView",
  321. query: { id: val.id },
  322. });
  323. };
  324. // 详情跳转
  325. const goInfo = (val) => {
  326. router.push({
  327. path: "/securityFacilitiesErrInfo",
  328. query: { id: val },
  329. });
  330. };
  331. return {
  332. active,
  333. onClickTab,
  334. onClickLeft,
  335. onClickRight,
  336. //列表
  337. list,
  338. onLoad,
  339. loading,
  340. finished,
  341. //搜索
  342. onSerchClick,
  343. searchShow,
  344. searchVal,
  345. searchValId,
  346. searchList,
  347. onSearch,
  348. onCancel,
  349. // 场所
  350. customFieldName,
  351. showPlace,
  352. places,
  353. getPlace,
  354. deleteItem,
  355. updateItem,
  356. goInfo,
  357. showDel,
  358. Itemdel,
  359. };
  360. },
  361. };
  362. </script>
  363. <style scoped>
  364. </style>