|
@@ -80,17 +80,24 @@
|
|
|
style="min-height: 400px; width: 100%"
|
|
|
vertical
|
|
|
>
|
|
|
- <template v-if="panos.length > 0">
|
|
|
+ <template v-if="dataList[currentPanoEditing].panos.length > 0">
|
|
|
<n-list
|
|
|
hoverable
|
|
|
clickable
|
|
|
style="--n-color-modal: none; width: 100%"
|
|
|
:show-divider="false"
|
|
|
>
|
|
|
- <n-list-item v-for="(pano, index) in panos" :key="index">
|
|
|
+ <n-list-item
|
|
|
+ v-for="(pano, index) in dataList[currentPanoEditing].panos"
|
|
|
+ :key="index"
|
|
|
+ >
|
|
|
<n-flex justify="space-between">
|
|
|
{{ pano }}
|
|
|
- <n-icon :size="20" @click="handlePanoDel">
|
|
|
+ <n-icon
|
|
|
+ :size="20"
|
|
|
+ @click="handlePanoDel(index)"
|
|
|
+ :color="'red'"
|
|
|
+ >
|
|
|
<TrashOutline />
|
|
|
</n-icon>
|
|
|
</n-flex>
|
|
@@ -116,7 +123,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { computed, ref } from 'vue'
|
|
|
+import { computed, ref, watch } from 'vue'
|
|
|
import { sdk, clearScreen } from '@/sdk'
|
|
|
import { onMounted, onUnmounted } from 'vue'
|
|
|
import {
|
|
@@ -151,17 +158,12 @@ sdk.then((sdk) => {
|
|
|
})
|
|
|
|
|
|
const handleAdd = () => {
|
|
|
- sdk.then((sdk) => {
|
|
|
- sdk.Scene.whenLoaded(() => {
|
|
|
- sdk.PanoCheckManager.enter()
|
|
|
- clearScreen(true)
|
|
|
- })
|
|
|
+ dataList.value.push({
|
|
|
+ title: '新增路线',
|
|
|
+ panos: []
|
|
|
})
|
|
|
+
|
|
|
if (panos.value.length === 0) {
|
|
|
- dataList.value.push({
|
|
|
- title: '新增路线',
|
|
|
- panos: []
|
|
|
- })
|
|
|
} else {
|
|
|
// message.warning('请先保存数据!')
|
|
|
}
|
|
@@ -234,10 +236,28 @@ const handleItem = (index: number) => {
|
|
|
|
|
|
const handleItemSubmit = () => {
|
|
|
isPanoEditing.value = false
|
|
|
+
|
|
|
+ sdk.then((sdk) => {})
|
|
|
}
|
|
|
-const handlePanoDel = () => {
|
|
|
- isPanoEditing.value = false
|
|
|
+const handlePanoDel = (index: number) => {
|
|
|
+ const origin = dataList.value[currentPanoEditing.value].panos
|
|
|
+ origin && origin.splice(index, 1)
|
|
|
}
|
|
|
+watch(
|
|
|
+ [panos, isPanoEditing],
|
|
|
+ () => {
|
|
|
+ if (isPanoEditing.value && typeof currentPanoEditing.value === 'number') {
|
|
|
+ const origin = dataList.value[currentPanoEditing.value]
|
|
|
+ if (origin) {
|
|
|
+ origin.panos = panos.value || []
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ deep: true,
|
|
|
+ immediate: true
|
|
|
+ }
|
|
|
+)
|
|
|
</script>
|
|
|
|
|
|
<style lang="sass" scoped>
|