|
@@ -61,6 +61,8 @@ import UiButton from "@/components/base/components/button/index.vue";
|
|
|
import Photos from "@/components/photos/index.vue";
|
|
|
import Header from "@/components/photos/header.vue";
|
|
|
import ButtonPane from "@/components/button-pane/index.vue";
|
|
|
+import {useConfirm} from "@/hook";
|
|
|
+import {roadPhotos} from "@/store/roadPhotos";
|
|
|
|
|
|
const sortPhotos = computed(() => {
|
|
|
const photos = [...accidentPhotos.value]
|
|
@@ -123,19 +125,39 @@ watchEffect(() => {
|
|
|
}
|
|
|
})
|
|
|
|
|
|
-const delPhoto = (accidentPhoto = active.value) => {
|
|
|
+const delPhotoRaw = (accidentPhoto = active.value) => {
|
|
|
const index = accidentPhotos.value.indexOf(accidentPhoto)
|
|
|
+ const reset = active.value ? accidentPhotos.value.indexOf(active.value) : -1
|
|
|
if (~index) {
|
|
|
accidentPhotos.value.splice(index, 1)
|
|
|
}
|
|
|
-}
|
|
|
-const delSelects = () => {
|
|
|
- while (selects.value.length) {
|
|
|
- delPhoto(selects.value[0])
|
|
|
- selects.value.shift()
|
|
|
+ if (~reset) {
|
|
|
+ console.log(reset)
|
|
|
+ if (reset >= accidentPhotos.value.length) {
|
|
|
+ if (accidentPhotos.value.length) {
|
|
|
+ active.value = accidentPhotos.value[accidentPhotos.value.length - 1]
|
|
|
+ } else {
|
|
|
+ active.value = null
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ active.value = accidentPhotos.value[reset]
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+const delPhoto = async (photo = active.value) => {
|
|
|
+ if (await useConfirm(`确定要删除此数据?`)) {
|
|
|
+ delPhotoRaw(photo)
|
|
|
+ }
|
|
|
+}
|
|
|
+const delSelects = async () => {
|
|
|
+ if (await useConfirm(`确定要删除这${selects.value.length}项数据?`)) {
|
|
|
+ while (selects.value.length) {
|
|
|
+ delPhotoRaw(selects.value[0])
|
|
|
+ selects.value.shift()
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
const gotoDraw = () => {
|
|
|
router.push({
|
|
|
name: writeRouteName.graphic,
|