123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379 |
- <template>
- <van-nav-bar
- fixed
- title="安防设施异常"
- left-text=""
- left-arrow
- @click-left="onClickLeft"
- @click-right="onClickRight"
- >
- <template #right>
- <van-icon name="plus" size="18" />
- </template>
- </van-nav-bar>
- <div class="main">
- <van-search
- v-model="searchVal"
- readonly="true"
- clearable
- show-action
- shape="round"
- placeholder="请选择"
- label="场所名称"
- input-align="center"
- @search="onSearch"
- @cancel="onCancel"
- @click-input="showPlace = true"
- />
- <van-popup v-model:show="showPlace" round position="bottom">
- <van-picker
- title="场所选择"
- :columns="places"
- :columns-field-names="customFieldName"
- @cancel="showPlace = false"
- @confirm="getPlace"
- />
- </van-popup>
- <van-tabs
- v-show="!searchShow"
- v-model:active="active"
- title-inactive-color="#bdbdbd"
- title-active-color="#36a7f3"
- @click-tab="onClickTab"
- >
- <van-tab title="未审核" name="0">
- <van-list
- v-model:loading="loading"
- :finished="finished"
- finished-text="没有更多了"
- @load="onLoad"
- >
- <van-swipe-cell v-for="item in list" :key="item">
- <div class="list_item" @click="goInfo(item.id)">
- <div class="item-left">
- <p style="color: #c4c4c4">
- {{ item.updateDate }}
- </p>
- <p style="color: red">待审核</p>
- </div>
- <van-cell is-link v-if="item.facilityType==0">
- <template #title >
- {{ item.siteName.name }}({{ item.videoAudioPoint.name }})
- </template>
- <template #label>
- {{ item.abnormalContent }}
- </template>
- </van-cell>
- <van-cell is-link v-if="item.facilityType==1">
- <template #title >
- {{ item.siteName.name }}({{ item.siteFireProtection.name }})
- </template>
- <template #label>
- {{ item.abnormalContent }}
- </template>
- </van-cell>
- </div>
- <template #right>
- <van-button
- square
- type="danger"
- text="删除"
- class="button"
- @click="deleteItem(item.id)"
- />
- <van-button
- square
- type="primary"
- text="修改"
- class="button"
- @click="updateItem(item)"
- />
- </template>
- </van-swipe-cell>
- </van-list>
- </van-tab>
- <van-tab title="已审核" name="1">
- <van-list
- v-model:loading="loading"
- :finished="finished"
- finished-text="没有更多了"
- @load="onLoad"
- >
- <van-swipe-cell v-for="item in list" :key="item">
- <div class="list_item" @click="goInfo(item.id)">
- <div class="item-left">
- <p style="color: #c4c4c4">
- {{ item.updateDate }}
- </p>
- <p style="color: gray">已审核</p>
- </div>
- <van-cell is-link v-if="item.facilityType==0">
- <template #title >
- {{ item.siteName.name }}({{ item.videoAudioPoint.name }})
- </template>
- <template #label>
- {{ item.abnormalContent }}
- </template>
- </van-cell>
- <van-cell is-link v-if="item.facilityType==1">
- <template #title >
- {{ item.siteName.name }}({{ item.siteFireProtection.name }})
- </template>
- <template #label>
- {{ item.abnormalContent }}
- </template>
- </van-cell>
- </div>
- </van-swipe-cell>
- </van-list>
- </van-tab>
- </van-tabs>
- <!-- 搜索结果 -->
- <van-list
- v-show="searchShow"
- v-model:loading="loading"
- :finished="finished"
- finished-text="没有更多了"
- @load="onLoad"
- >
- <van-swipe-cell v-for="item in searchList" :key="item">
- <div class="list_item" @click="goInfo(item.id)">
- <div class="item-left">
- <p style="color: #c4c4c4">
- {{ item.updateDate }}
- </p>
- <p style="color: red">
- <span v-if="item.assessment == 1">已审核</span>
- <span v-else>待审核</span>
- </p>
- </div>
- <van-cell is-link v-if="item.facilityType==0">
- <template #title >
- {{ item.siteName.name }}({{ item.videoAudioPoint.name }})
- </template>
- <template #label>
- {{ item.abnormalContent }}
- </template>
- </van-cell>
- <van-cell is-link v-if="item.facilityType==1">
- <template #title >
- {{ item.siteName.name }}({{ item.siteFireProtection.name }})
- </template>
- <template #label>
- {{ item.abnormalContent }}
- </template>
- </van-cell>
- </div>
- </van-swipe-cell>
- </van-list>
- <van-dialog
- v-model:show="showDel"
- show-cancel-button
- confirmButtonText="删除"
- message="请确认删除该记录"
- @confirm="Itemdel"
- >
- </van-dialog>
- </div>
-
- </template>
- <script>
- import { ref } from "vue";
- import router from "@/router";
- import securityFacilitiesErrService from "@/api/securityFacilitiesErr/securityFacilitiesErrService";
- import tools from "@/api/sys/tools";
- export default {
- name: "securityFacilitiesErrList",
- setup() {
- const onClickLeft = () => {
- history.back();
- };
- const onClickRight = () => {
- router.push("/securityFacilitiesErrView");
- };
- let active = ref(0);
- let list = ref([]);
- const loading = ref(false);
- const finished = ref(false);
- let index = 0;
- //tab切换
- const onClickTab = ({name}) => {
- // 清空列表数据
- finished.value = false;
- list.value = [];
- loading.value = true;
- index = 0;
- onLoad();
- };
- const onLoad = () => {
- loading.value = true;
- finished.value = false;
- // 异步更新数据active绑定的是标签中的name值
- new securityFacilitiesErrService()
- .list({
- current: index + 1,
- size: 10,
- assessment:active.value,
- siteName:{id:searchValId.value}
- })
- .then((res) => {
- list.value.push(...res.records) ;
- // 加载状态结束
- loading.value = false;
- // 数据全部加载完成
- if (res.pages <= index + 1) {
- finished.value = true;
- }
- index++;
- });
- };
- // 搜索
- const onSerchClick= () => {
- searchShow.value = true;
- searchList.value = [];
- new siteInspectionService()
- .list(qs.stringify({
- current: 1,
- size: 10000,
- activityName: searchValId.value,
- }))
- .then(({ records }) => {
- searchList.value.push(...records);
- // 加载状态结束
- loading.value = false;
- });
- };
- let searchShow = ref(false);
- let searchList = ref([]);
- const searchVal = ref("");
- const searchValId = ref("");
- const onSearch = () => {
- searchShow.value = true;
- searchList.value = [];
- new siteInspectionService()
- .list({
- current: 1,
- size: 10000,
- activityName: searchVal.value,
- })
- .then(({ records }) => {
- searchList.value.push(...records);
- // 加载状态结束
- loading.value = false;
- });
- };
- const onCancel = () => {
- searchVal.value = "";
- searchValId.value = "";
- searchShow.value = false;
- finished.value = false;
- list.value = [];
- loading.value = true;
- index = 0;
- onLoad();
- };
- // 场所名称
- let places = ref([]);
- const customFieldName = {
- text: "name",
- value: "id",
- };
- new tools()
- .placeList({
- current: 1,
- size: 10000,
- })
- .then(({ records }) => {
- places.value.push(...records);
- });
- let showPlace = ref(false);
- const getPlace = ({ selectedOptions }) => {
- if(selectedOptions[0]!=undefined&&selectedOptions[0]!=null){
- showPlace.value = false;
- searchVal.value=selectedOptions[0].name;
- searchValId.value=selectedOptions[0].id;
- finished.value = false;
- list.value = [];
- loading.value = true;
- index = 0;
- onLoad();
- }
- };
- // 删除确认
- let showDel = ref(false);
- let ids = ref("");
- const deleteItem = (val) => {
- showDel.value = true;
- ids.value = val;
- };
- // 删除
- const Itemdel = () => {
- new securityFacilitiesErrService().delete(ids.value).then((res) => {
- index = 0;
- loading.value = true;
- list.value = [];
- onLoad();
- });
- };
- // 修改跳转
- const updateItem = (val) => {
- router.push({
- path: "/securityFacilitiesErrView",
- query: { id: val.id },
- });
- };
- // 详情跳转
- const goInfo = (val) => {
- router.push({
- path: "/securityFacilitiesErrInfo",
- query: { id: val },
- });
- };
- return {
- active,
- onClickTab,
- onClickLeft,
- onClickRight,
- //列表
- list,
- onLoad,
- loading,
- finished,
- //搜索
- onSerchClick,
- searchShow,
- searchVal,
- searchValId,
- searchList,
- onSearch,
- onCancel,
- // 场所
- customFieldName,
- showPlace,
- places,
- getPlace,
- deleteItem,
- updateItem,
- goInfo,
- showDel,
- Itemdel,
- };
- },
- };
- </script>
- <style scoped>
- </style>
|