|
|
@@ -114,7 +114,8 @@
|
|
|
</template>
|
|
|
</div>
|
|
|
<!-- 地图弹窗仅 fire 使用 -->
|
|
|
- <creatMap v-if="props.fromRoute !== 'criminal'" v-model="showMapDialog" :caseId="caseId" @confirm="handleMapConfirm" />
|
|
|
+ <!-- 地图弹窗改为统一使用,无论路由来源 -->
|
|
|
+ <creatMap v-model="showMapDialog" :caseId="caseId" @confirm="handleMapConfirm" />
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
@@ -128,14 +129,14 @@ import { genCascaderValue, getCode } from "@/helper/cascader";
|
|
|
import { QuiskExpose } from "@/helper/mount";
|
|
|
import { user } from "@/store/user";
|
|
|
import { Search } from "@element-plus/icons-vue";
|
|
|
-import { selectMapImage } from "@/view/case/quisk";
|
|
|
+// 旧的选择地图逻辑已统一为 creatMap 弹窗,移除 selectMapImage
|
|
|
import { Example, setExample as setCriminalExample, addExample as addCriminalExample } from "@/app/criminal/store/example";
|
|
|
import { getCaseInfo } from "@/store/case";
|
|
|
import creatMap from "./creatMap.vue";
|
|
|
|
|
|
const props = defineProps<{ fire?: Fire, caseId?: number, editOrShow?: string, fromRoute?: string }>();
|
|
|
const caseId = toRef(props, 'caseId');
|
|
|
-console.log(props.fromRoute, 'props.fromRoute')
|
|
|
+
|
|
|
let bindFire = ref<Fire>( props.fire ? { ...props.fire } : ({ deptId: user.value.info.deptId} as Fire));
|
|
|
const accidentDate = ref(
|
|
|
bindFire.value.accidentDate ? new Date(bindFire.value.accidentDate) : new Date()
|
|
|
@@ -204,7 +205,11 @@ const autoSave = async () => {
|
|
|
// 保存成功后派发标题更新事件,供父组件同步 currentRecord
|
|
|
try {
|
|
|
const title = props.fromRoute === 'criminal' ? (bindFire.value as any).caseTitle : (bindFire.value as any).projectName;
|
|
|
- window.dispatchEvent(new CustomEvent('fireDetails:updateTitle', { detail: { title } }));
|
|
|
+ const mapUrl = (bindFire.value as any).mapUrl;
|
|
|
+ const latAndLong = (bindFire.value as any).latAndLong;
|
|
|
+ window.dispatchEvent(
|
|
|
+ new CustomEvent('fireDetails:updateTitle', { detail: { title, mapUrl, latAndLong } })
|
|
|
+ );
|
|
|
} catch (e) {}
|
|
|
// 自动保存成功后不刷新页面,也不打扰用户
|
|
|
} catch (e) {
|
|
|
@@ -247,10 +252,14 @@ const autoSaveCriminal = async () => {
|
|
|
await addCriminalExample(bindFire.value as any);
|
|
|
}
|
|
|
lastSavedSnapshotCriminal = snapshot;
|
|
|
- // 保存成功后派发标题更新事件,供父组件同步 currentRecord
|
|
|
+ // 保存成功后派发标题更新事件,附带地图信息,供父组件同步 currentRecord
|
|
|
try {
|
|
|
const title = (bindFire.value as any).caseTitle;
|
|
|
- window.dispatchEvent(new CustomEvent('fireDetails:updateTitle', { detail: { title } }));
|
|
|
+ const mapUrl = (bindFire.value as any).mapUrl;
|
|
|
+ const latAndLong = (bindFire.value as any).latAndLong;
|
|
|
+ window.dispatchEvent(
|
|
|
+ new CustomEvent('fireDetails:updateTitle', { detail: { title, mapUrl, latAndLong } })
|
|
|
+ );
|
|
|
} catch (e) {}
|
|
|
} catch (e) {
|
|
|
console.error('criminal auto-save error', e);
|
|
|
@@ -302,9 +311,9 @@ defineExpose<QuiskExpose>({
|
|
|
ElMessage.error("详细地址不能为空");
|
|
|
throw "详细地址不能为空!";
|
|
|
}
|
|
|
- await (bindFire.value.caseId
|
|
|
- ? setCriminalExample(bindFire.value)
|
|
|
- : addCriminalExample(bindFire.value as any));
|
|
|
+ await (bindFire.value.caseId ? setCriminalExample(bindFire.value as any) : addCriminalExample(bindFire.value as any));
|
|
|
+ // 保存成功后刷新页面数据
|
|
|
+ window.location.reload()
|
|
|
} else {
|
|
|
if (!bindFire.value.latAndLong || !bindFire.value.latAndLong.trim()) {
|
|
|
ElMessage.error("详细地址不能为空");
|
|
|
@@ -344,7 +353,6 @@ defineExpose<QuiskExpose>({
|
|
|
} else {
|
|
|
await addFire(bindFire.value as any);
|
|
|
}
|
|
|
-
|
|
|
// 保存成功后,刷新fireDetails页面的数据
|
|
|
window.location.reload()
|
|
|
}
|
|
|
@@ -353,22 +361,12 @@ defineExpose<QuiskExpose>({
|
|
|
|
|
|
// 打开地图/选择地址
|
|
|
const searchAMapAddress = async () => {
|
|
|
- if (props.fromRoute === 'criminal') {
|
|
|
- const data = await selectMapImage({});
|
|
|
- if (!data?.search) return;
|
|
|
-
|
|
|
- bindFire.value.mapUrl = data.search.text;
|
|
|
- bindFire.value.latlng = bindFire.value.latAndLong = `${data.search.lat},${data.search.lng}`;
|
|
|
- if (!data.search.text) {
|
|
|
- bindFire.value.mapUrl = bindFire.value.latAndLong;
|
|
|
- }
|
|
|
- } else {
|
|
|
- showMapDialog.value = true
|
|
|
- }
|
|
|
+ // 统一使用 creatMap 弹窗进行位置选择
|
|
|
+ showMapDialog.value = true;
|
|
|
};
|
|
|
// 处理地图确认选择
|
|
|
const handleMapConfirm = (LocationInfo: any) => {
|
|
|
- // console.log(LocationInfo, 666)
|
|
|
+ console.log(LocationInfo, 666)
|
|
|
const {cityname, adname, address, name, location} = LocationInfo;
|
|
|
bindFire.value.mapUrl = cityname + adname + address + name;
|
|
|
bindFire.value.latlng = bindFire.value.latAndLong = `${location.lat},${location.lng}`;
|