lisy před 3 měsíci
rodič
revize
dc1a7bbff4

+ 1 - 0
package.json

@@ -22,6 +22,7 @@
     "url": "https://gitee.com/JavaLionLi/plus-ui.git"
   },
   "dependencies": {
+    "@amap/amap-jsapi-loader": "^1.0.1",
     "@gausszhou/vue3-drag-resize-rotate": "^3.0.2",
     "@element-plus/icons-vue": "2.3.1",
     "@highlightjs/vue-plugin": "2.1.0",

+ 82 - 0
src/components/SelectWepArea/SelectWepArea.vue

@@ -0,0 +1,82 @@
+<template>
+    <el-select filterable remote v-model="keywords" reserve-keyword :placeholder="placeholder" :remote-method="remoteMethod" @change="searchKeywords" :loading="loading" clearable style="width: 440px">
+        <el-option v-for="item in options" :key="item.id" :label="item.district + item.address.toString()" :value="item.id" />
+    </el-select>
+</template>
+<script setup lang="ts">
+import { debounce } from 'lodash';
+import AMapLoader from '@amap/amap-jsapi-loader';
+const props = defineProps<{
+    modelValue: any;
+    placeholder?: string;
+}>();
+const emit = defineEmits<{
+    (e: 'update:modelValue', value: string): void;
+}>();
+import { httpRequests } from '@/utils/httpRequests';
+const keywords = ref<string>('');
+const options = ref<any[]>([]);
+const loading = ref<boolean>(false);
+const remoteMethod = debounce((keywords: string) => {
+    if (!keywords) {
+        return;
+    }
+    loading.value = true;
+    let autoComplete = new mapData.AMap.Autocomplete();
+    autoComplete.search(keywords, function (status: string, result: any) {
+        console.log(result.tips);
+        if (!result.tips?.length) {
+            options.value = [];
+            loading.value = false;
+            return;
+        }
+        const tips = result.tips?.filter((item: any) => item.id);
+        options.value = [...tips];
+        loading.value = false;
+    });
+}, 1000);
+const mapData: any = {
+    AMap: null,
+    map: null,
+    marker: null,
+    circle: null
+};
+const initMap = (positions: any[] = []) => {
+    window._AMapSecurityConfig = {
+        securityJsCode: '059c519d3546bc48566ecca0b38f22ae',
+    };
+    AMapLoader.load({
+        key: '26b919a68880ad60637f5cabd6c94a76', // 申请好的Web端开发者Key,首次调用 load 时必填
+        version: '2.0', // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
+        plugins: [
+            'AMap.PlaceSearch',
+            'AMap.AutoComplete'
+        ] // 需要使用的的插件列表,如比例尺'AMap.Scale'等
+    })
+        .then((AMap) => {
+            mapData.AMap = AMap;
+        })
+        .catch((e) => {
+            console.log(e);
+        });
+};
+const searchKeywords = (val: string) => {
+    console.log(val);
+    const item = options.value.find(i => i.id === val);
+    if (item) {
+        emit('update:modelValue', item);
+    } else {
+        emit('update:modelValue', '');
+    }
+};
+watch(() => props.modelValue, (val) => {
+    if (val && val.name) {
+        keywords.value = (val?.name || '') + (val?.district || '');
+    } else {
+        keywords.value = '';
+    }
+}, { immediate: true });
+onMounted(() => {
+    initMap();
+});
+</script>

+ 3 - 1
src/views/training/models/meeting-detail-attend.vue

@@ -353,7 +353,7 @@
                 </div>
             </div>
         </template>
-        <el-form :model="contactPersonData">
+        <el-form ref="ContactPerson" :model="contactPersonData">
             <el-form-item prop="contactName" :rules="[{ required: true, message: '请填写指定联系人名称' }]">
                 <div class="d-flex a-c">
                     <div class="pr-20">指定联系人名称</div>
@@ -478,6 +478,7 @@ const opencontactPerson = (id,data)=>{
 
 }
 const confirmContactPerson = async()=>{
+    await ContactPerson.value.validate()
     await signupContact({id:contactId.value,contactInfo:{specifyConcatTel:contactPersonData.value?.contactTel,specifyContact:contactPersonData.value?.contactName}})
     contactPerson.value = false
     getList()
@@ -510,6 +511,7 @@ const total = ref(0);
 const list = ref<any>([]);
 const tabs = ref([]);
 const formRef = ref()
+const ContactPerson = ref()
 const getExpertPersonCount = async () => {
     const res = await signupCount(query?.id);
     if (res?.code === 200) {