编辑按钮bug修复

This commit is contained in:
joylink_zhaoerwei 2023-08-23 13:26:53 +08:00
parent 104656affb
commit 3ab1ee41a1
2 changed files with 10 additions and 15 deletions

View File

@ -87,9 +87,7 @@ import { GraphicData, JlGraphic } from 'src/jl-graphic';
import { saveAlertTypeData, showAlertTypeData } from './alarm/alarmInfoEnum';
import { Section } from 'src/graphics/section/Section';
const props = defineProps({
rangeConfigEdit: Number,
});
defineExpose({ searchById });
const route = useRoute();
const lineStore = useLineStore();
@ -145,11 +143,6 @@ enum DeviceTypeShow {
DEVICE_TYPE_PLATFORM = 'Platform',
}
watch(props, () => {
handleState.value = '编辑范围配置';
searchById();
});
watch(
() => lineStore.selectedGraphics,
(val) => {
@ -187,6 +180,7 @@ watch(
);
const myForm = ref<QForm | null>(null);
let editId: number;
async function onSubmit() {
myForm.value?.validate().then(async (res) => {
if (res) {
@ -205,7 +199,7 @@ async function onSubmit() {
if (handleState.value == '新建范围配置') {
await deviceRangeSet(params);
} else {
params.id = props.rangeConfigEdit;
params.id = editId;
await deviceRangeSet(params);
}
@ -223,9 +217,10 @@ async function onSubmit() {
});
}
async function searchById() {
async function searchById(id: number) {
try {
const id = props.rangeConfigEdit as number;
handleState.value = '编辑范围配置';
editId = id;
const response = await queryDeviceRangeById(id);
const datas: GraphicData[] = [];
if (response.data.data) {

View File

@ -15,13 +15,13 @@
<div id="line-app-container"></div>
</q-page-container>
<q-drawer side="right" v-model="drawerRight" show-if-above bordered>
<range-config :rangeConfigEdit="rangeConfigEdit"></range-config>
<range-config ref="rangeConfigEdit"></range-config>
</q-drawer>
</q-layout>
</template>
<script setup lang="ts">
import { onMounted, ref, computed, reactive } from 'vue';
import { onMounted, ref, computed } from 'vue';
import { useLineStore } from 'src/stores/line-store';
import { useLineNetStore } from 'src/stores/line-net-store';
import { useRoute, useRouter } from 'vue-router';
@ -42,7 +42,7 @@ const mapType = ref(route.params.type as string);
const lineStore = useLineStore();
const lineNetStore = useLineNetStore();
const drawerRight = ref();
const rangeConfigEdit = ref();
const rangeConfigEdit = ref<{ searchById: (id: number) => void } | null>(null);
const mapName = computed(() => lineStore.lineName || lineNetStore.lineNetName);
@ -100,7 +100,7 @@ function openRangeList() {
componentProps: {
onEditClick: (row: IAreaConfigListItem) => {
dialog.hide();
rangeConfigEdit.value = row.id;
rangeConfigEdit.value?.searchById(row.id);
},
},
});