|
@@ -27,7 +27,10 @@
|
|
|
v-if="options"
|
|
|
/>
|
|
|
<ui-button width="100px" type="primary" class="save" @click="saveHandler">
|
|
|
- {{ isRoad ? '制表' : '保存' }}
|
|
|
+ 保存
|
|
|
+ </ui-button>
|
|
|
+ <ui-button width="100px" type="primary" class="save" @click="createTable" v-if="isRoad">
|
|
|
+ 制表
|
|
|
</ui-button>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -36,13 +39,14 @@
|
|
|
import UiIcon from "@/components/base/components/icon/index.vue";
|
|
|
import UiButton from "@/components/base/components/button/index.vue";
|
|
|
import {Mode} from './menus'
|
|
|
-import {drawRef, graphicState, changeStore} from '@/hook/useGraphic'
|
|
|
-import {computed, watchEffect} from "vue";
|
|
|
+import {changeStore, drawRef, graphicState} from '@/hook/useGraphic'
|
|
|
+import {computed} from "vue";
|
|
|
import {router, writeRouteName} from '@/router'
|
|
|
-import {types, AccidentPhoto, accidentPhotos} from '@/store/accidentPhotos'
|
|
|
+import {AccidentPhoto, accidentPhotos, types} from '@/store/accidentPhotos'
|
|
|
import {useData} from './data'
|
|
|
import UiInput from "@/components/base/components/input/index.vue";
|
|
|
import {roadPhotos} from "@/store/roadPhotos";
|
|
|
+import {uploadImage} from '@/store/sync'
|
|
|
|
|
|
const data = useData()
|
|
|
const mode = computed(() => Number(router.currentRoute.value.params.mode) as Mode)
|
|
@@ -93,12 +97,13 @@ const menus = computed<{disable?: boolean, text: string, onClick: () => void}[]>
|
|
|
return menus
|
|
|
})
|
|
|
|
|
|
-const saveHandler = () => {
|
|
|
+const saveStore = async () => {
|
|
|
const newData = {
|
|
|
...data.value,
|
|
|
data: JSON.parse(JSON.stringify(drawRef.value.load.save()))
|
|
|
}
|
|
|
- console.log("screenShot", drawRef.value.uiControl.screenShot())
|
|
|
+ const blob = await drawRef.value.uiControl.screenShot()
|
|
|
+ newData.url = await uploadImage(blob)
|
|
|
const origin = isRoad.value ? roadPhotos.value : accidentPhotos.value
|
|
|
const index = origin.indexOf(data.value)
|
|
|
if (~index) {
|
|
@@ -106,7 +111,17 @@ const saveHandler = () => {
|
|
|
} else {
|
|
|
origin.push(newData)
|
|
|
}
|
|
|
- router.replace({name: isRoad.value ? writeRouteName.roads : writeRouteName.accidents})
|
|
|
+}
|
|
|
+
|
|
|
+const saveHandler = async () => {
|
|
|
+ await saveStore()
|
|
|
+ await router.replace({name: isRoad.value ? writeRouteName.roads : writeRouteName.accidents})
|
|
|
+}
|
|
|
+
|
|
|
+const createTable = async () => {
|
|
|
+ console.log("createTable")
|
|
|
+ await saveStore()
|
|
|
+ await router.replace({name: writeRouteName.tabulation, params: {id: data.value.id} })
|
|
|
}
|
|
|
|
|
|
|