|
@@ -32,12 +32,14 @@
|
|
|
import { QuiskExpose } from "@/helper/mount";
|
|
|
import { Relics, relicsLevelDesc, relicsTypeDesc } from "@/store/relics";
|
|
|
import { ElMessage } from "element-plus";
|
|
|
-import { computed, ref, watchEffect } from "vue";
|
|
|
-import { getProvinces, getCities, getAreas } from '@/request/organization';
|
|
|
+import { computed, onMounted, ref, watchEffect } from "vue";
|
|
|
+import { getProvinces, getCities, getAreas, getUserOrg } from '@/request/organization';
|
|
|
import type { CascaderProps, CascaderOption } from 'element-plus'
|
|
|
-import { ElMessageBox } from "element-plus";
|
|
|
+// import { ElMessageBox } from "element-plus";
|
|
|
const selectedValue = ref([])
|
|
|
|
|
|
+
|
|
|
+
|
|
|
const props = defineProps<{
|
|
|
relics?: Relics;
|
|
|
submit: (relics: Relics) => Promise<void>;
|
|
@@ -60,8 +62,9 @@ watchEffect(() => {
|
|
|
} else {
|
|
|
selectedValue.value = [data.value.provinceId, data.value.cityId, data.value.areaId]
|
|
|
}
|
|
|
-
|
|
|
})
|
|
|
+
|
|
|
+
|
|
|
// 动态加载配置
|
|
|
const lazyProps = ref<CascaderProps>({
|
|
|
lazy: true,
|
|
@@ -128,6 +131,20 @@ const handleChange = (value: string) => {
|
|
|
console.log('选中的省市区编码:', value);
|
|
|
};
|
|
|
|
|
|
+const getDefaultUserOrg = async () => {
|
|
|
+ const res = await getUserOrg();
|
|
|
+ if (res) {
|
|
|
+ console.log('存在org的地址')
|
|
|
+ if (res.zx) {
|
|
|
+ selectedValue.value = [res.cityId, res.areaId]
|
|
|
+ } else {
|
|
|
+ selectedValue.value = [res.provinceId, res.cityId, res.areaId]
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+onMounted(() => {
|
|
|
+ getDefaultUserOrg()
|
|
|
+})
|
|
|
|
|
|
defineExpose<QuiskExpose>({
|
|
|
title: computed(() => `${props.relics ? "修改" : "添加"}文物`),
|