| | |
| | | <el-button class="ztzf-button"> 上传 </el-button> |
| | | </el-upload> |
| | | |
| | | <template v-if="activeName === '自定义禁飞区'"> |
| | | <template v-if="failuresInfo.length"> |
| | | <el-button class="ztzf-button" @click="synchronize"> |
| | | 继续同步 |
| | | </el-button> |
| | | <el-button class="ztzf-button" @click="failuresDel"> |
| | | 取消同步 |
| | | </el-button> |
| | | </template> |
| | | <el-button v-else class="ztzf-button" @click="synchronize"> |
| | | 同步 |
| | | </el-button> |
| | | </template> |
| | | |
| | | |
| | | <el-button class="ztzf-button" @click="selectAll">全选</el-button> |
| | | </div> |
| | | <div class="tableListBox"> |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { ElMessage } from 'element-plus'; |
| | | import { treeDataApi, deleteFenceApi, deleteFolderApi, spatialPlanningApi } from '@/api/layer/index'; |
| | | import { ElMessage, ElMessageBox } from 'element-plus'; |
| | | import { |
| | | treeDataApi, |
| | | deleteFenceApi, |
| | | deleteFolderApi, |
| | | spatialPlanningApi, |
| | | failuresListApi, |
| | | failuresDelApi, areasUpdateApi |
| | | } from '@/api/layer/index'; |
| | | import { inject, nextTick, onMounted, watch } from 'vue'; |
| | | const emit = defineEmits(['update:coverData', 'update:deitData', 'newFencesMethods']); |
| | | import EventBus from '@/utils/eventBus'; |
| | |
| | | return data.name.includes(value) |
| | | } |
| | | |
| | | // 同步信息 |
| | | const failuresInfo = ref([]) |
| | | function failuresList() { |
| | | failuresListApi().then(res => { |
| | | failuresInfo.value = res.data.data || [] |
| | | }) |
| | | } |
| | | |
| | | // 同步 |
| | | function synchronize() { |
| | | const data = failuresInfo.value.map(item => item.device_sn) |
| | | areasUpdateApi(data).then(res => { |
| | | if (res.data.data.length){ |
| | | let stringVal = res.data.data.reduce((acc, cur) => { |
| | | return acc + cur.nickname + '(' + cur.reason + ')' + ',' |
| | | }, '') |
| | | stringVal = stringVal.slice(0, -1) |
| | | ElMessageBox.alert(stringVal, '同步失败', { |
| | | confirmButtonText: '确定', |
| | | }) |
| | | }else{ |
| | | ElMessage.success('同步成功'); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | // 取消同步 |
| | | function failuresDel() { |
| | | failuresDelApi().then(res => { |
| | | ElMessage.success('取消同步成功'); |
| | | }) |
| | | } |
| | | |
| | | onMounted(() => { |
| | | failuresList() |
| | | gettreeDataApi(); |
| | | EventBus.on('gettreeDataApi', gettreeDataApi); |
| | | }); |