| | |
| | | <template> |
| | | <div class="rightContainer"> |
| | | <div class="rightContainer" > |
| | | <div class="contenttitle">{{ layerParams.fenceType === 1 ? '识别区' : '禁飞区' }}信息</div> |
| | | <div class="centerBox"> |
| | | <div class="itemRow"> |
| | |
| | | import dayjs from 'dayjs'; |
| | | import { deitFenceApi, addFenceApi } from '@/api/layer/index'; |
| | | import EventBus from '@/utils/eventBus'; |
| | | const emit = defineEmits(['callParentMethod']); |
| | | const emit = defineEmits(['callParentMethod','update:loading']); |
| | | const layerParams = inject('layerParams'); |
| | | const options = ref([]); |
| | | const timeValue = ref(''); |
| | |
| | | geo_data: '', |
| | | |
| | | }); |
| | | const loading = ref(false); |
| | | const detailData = ref(null); |
| | | const fenceArea = ref(0); |
| | | detailData.value = layerParams.value.editDetailData; |
| | |
| | | layerParams.value.editingIsProhibited = false; |
| | | }; |
| | | const cancelHandel = () => { |
| | | loading.value = false |
| | | emit('update:loading', false); |
| | | clearAllData(); |
| | | emit('callParentMethod'); |
| | | EventBus.emit('gettreeDataApi'); |
| | |
| | | ElMessage.error('请绘制区域'); |
| | | return; |
| | | } |
| | | loading.value = true |
| | | emit('update:loading', true); |
| | | const params = { |
| | | folder_id: formData.value.folder_id, |
| | | name: formData.value.name, |
| | |
| | | if (layerParams.value.decideWhetherToAddOrEdit === 2) { |
| | | params.id = detailData.value.id; |
| | | } |
| | | |
| | | if (layerParams.value.decideWhetherToAddOrEdit === 1) { |
| | | //围栏新增 |
| | | addFenceApi(params).then(res => { |
| | | ElMessage.success('新增成功'); |
| | | EventBus.emit('gettreeDataApi'); |
| | | clearAllData(); |
| | | emit('callParentMethod'); |
| | | }); |
| | | addFenceApi(params) |
| | | .then(res => { |
| | | ElMessage.success('新增成功'); |
| | | EventBus.emit('gettreeDataApi'); |
| | | clearAllData(); |
| | | emit('callParentMethod'); |
| | | }) |
| | | .catch(err => { |
| | | ElMessage.error('新增失败,请重试'); |
| | | console.error('新增失败:', err); |
| | | }) |
| | | .finally(() => { |
| | | loading.value = false; |
| | | emit('update:loading', false); |
| | | }); |
| | | } else if (layerParams.value.decideWhetherToAddOrEdit === 2) { |
| | | //围栏编辑 |
| | | deitFenceApi(params).then(res => { |
| | | ElMessage.success('编辑成功'); |
| | | EventBus.emit('gettreeDataApi'); |
| | | |
| | | clearAllData(); |
| | | emit('callParentMethod'); |
| | | }); |
| | | } |
| | | deitFenceApi(params) |
| | | .then(res => { |
| | | ElMessage.success('编辑成功'); |
| | | EventBus.emit('gettreeDataApi'); |
| | | clearAllData(); |
| | | emit('callParentMethod'); |
| | | }) |
| | | .catch(err => { |
| | | ElMessage.error('编辑失败,请重试'); |
| | | console.error('编辑失败:', err); |
| | | }) |
| | | .finally(() => { |
| | | loading.value = false; |
| | | emit('update:loading', false); |
| | | }); |
| | | } |
| | | }; |
| | | onMounted(() => { |
| | | // 获取判断状态(默认设为 1) |
| | |
| | | height: 39px; |
| | | cursor: pointer; |
| | | } |
| | | |
| | | } |
| | | } |
| | | </style> |