编辑按钮bug修复
This commit is contained in:
parent
104656affb
commit
3ab1ee41a1
@ -87,9 +87,7 @@ import { GraphicData, JlGraphic } from 'src/jl-graphic';
|
|||||||
import { saveAlertTypeData, showAlertTypeData } from './alarm/alarmInfoEnum';
|
import { saveAlertTypeData, showAlertTypeData } from './alarm/alarmInfoEnum';
|
||||||
import { Section } from 'src/graphics/section/Section';
|
import { Section } from 'src/graphics/section/Section';
|
||||||
|
|
||||||
const props = defineProps({
|
defineExpose({ searchById });
|
||||||
rangeConfigEdit: Number,
|
|
||||||
});
|
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const lineStore = useLineStore();
|
const lineStore = useLineStore();
|
||||||
@ -145,11 +143,6 @@ enum DeviceTypeShow {
|
|||||||
DEVICE_TYPE_PLATFORM = 'Platform',
|
DEVICE_TYPE_PLATFORM = 'Platform',
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(props, () => {
|
|
||||||
handleState.value = '编辑范围配置';
|
|
||||||
searchById();
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => lineStore.selectedGraphics,
|
() => lineStore.selectedGraphics,
|
||||||
(val) => {
|
(val) => {
|
||||||
@ -187,6 +180,7 @@ watch(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const myForm = ref<QForm | null>(null);
|
const myForm = ref<QForm | null>(null);
|
||||||
|
let editId: number;
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
myForm.value?.validate().then(async (res) => {
|
myForm.value?.validate().then(async (res) => {
|
||||||
if (res) {
|
if (res) {
|
||||||
@ -205,7 +199,7 @@ async function onSubmit() {
|
|||||||
if (handleState.value == '新建范围配置') {
|
if (handleState.value == '新建范围配置') {
|
||||||
await deviceRangeSet(params);
|
await deviceRangeSet(params);
|
||||||
} else {
|
} else {
|
||||||
params.id = props.rangeConfigEdit;
|
params.id = editId;
|
||||||
await deviceRangeSet(params);
|
await deviceRangeSet(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,9 +217,10 @@ async function onSubmit() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function searchById() {
|
async function searchById(id: number) {
|
||||||
try {
|
try {
|
||||||
const id = props.rangeConfigEdit as number;
|
handleState.value = '编辑范围配置';
|
||||||
|
editId = id;
|
||||||
const response = await queryDeviceRangeById(id);
|
const response = await queryDeviceRangeById(id);
|
||||||
const datas: GraphicData[] = [];
|
const datas: GraphicData[] = [];
|
||||||
if (response.data.data) {
|
if (response.data.data) {
|
||||||
|
@ -15,13 +15,13 @@
|
|||||||
<div id="line-app-container"></div>
|
<div id="line-app-container"></div>
|
||||||
</q-page-container>
|
</q-page-container>
|
||||||
<q-drawer side="right" v-model="drawerRight" show-if-above bordered>
|
<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-drawer>
|
||||||
</q-layout>
|
</q-layout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<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 { useLineStore } from 'src/stores/line-store';
|
||||||
import { useLineNetStore } from 'src/stores/line-net-store';
|
import { useLineNetStore } from 'src/stores/line-net-store';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
@ -42,7 +42,7 @@ const mapType = ref(route.params.type as string);
|
|||||||
const lineStore = useLineStore();
|
const lineStore = useLineStore();
|
||||||
const lineNetStore = useLineNetStore();
|
const lineNetStore = useLineNetStore();
|
||||||
const drawerRight = ref();
|
const drawerRight = ref();
|
||||||
const rangeConfigEdit = ref();
|
const rangeConfigEdit = ref<{ searchById: (id: number) => void } | null>(null);
|
||||||
|
|
||||||
const mapName = computed(() => lineStore.lineName || lineNetStore.lineNetName);
|
const mapName = computed(() => lineStore.lineName || lineNetStore.lineNetName);
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ function openRangeList() {
|
|||||||
componentProps: {
|
componentProps: {
|
||||||
onEditClick: (row: IAreaConfigListItem) => {
|
onEditClick: (row: IAreaConfigListItem) => {
|
||||||
dialog.hide();
|
dialog.hide();
|
||||||
rangeConfigEdit.value = row.id;
|
rangeConfigEdit.value?.searchById(row.id);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user