diff --git a/src/api/admin/laboratory/achievement.js b/src/api/admin/laboratory/achievement.js index ff739d3..5b5ef5b 100644 --- a/src/api/admin/laboratory/achievement.js +++ b/src/api/admin/laboratory/achievement.js @@ -51,3 +51,11 @@ export const updateAchievement = (data) => { data, }); }; + +// /app/laboratory/importTemplate +export const labAchievementTemplate = () => + request({ + url: "/app/laboratory/importTemplate", + method: "GET", + responseType: "blob", + }); diff --git a/src/api/admin/laboratory/research-project.js b/src/api/admin/laboratory/research-project.js index d45978b..9528683 100644 --- a/src/api/admin/laboratory/research-project.js +++ b/src/api/admin/laboratory/research-project.js @@ -15,3 +15,10 @@ export const deleteTechnologyProject = (ids) => { method: "DELETE", }); }; + +export const researchArchievementTemplate = () => + request({ + url: "/app/research/importTemplate", + method: "GET", + responseType: "blob", + }); diff --git a/src/api/website/home/index.js b/src/api/website/home/index.js index 320e538..9540089 100644 --- a/src/api/website/home/index.js +++ b/src/api/website/home/index.js @@ -264,3 +264,24 @@ export function getCasNavigation() { method: "get", }); } + +// /app/map/expertMap +export const getExpertMap = () => + request({ + url: "/app/map/expertMap", + method: "get", + }); + +// /app/map/enterpriseMap +export const getEnterpriseMap = () => + request({ + url: "/app/map/enterpriseMap", + method: "get", + }); + +// /app/map/achievementMap +export const getAchievementMap = () => + request({ + url: "/app/map/achievementMap", + method: "get", + }); \ No newline at end of file diff --git a/src/i18n/message/tips/ru.js b/src/i18n/message/tips/ru.js index 78338f7..f4c85ac 100644 --- a/src/i18n/message/tips/ru.js +++ b/src/i18n/message/tips/ru.js @@ -31,6 +31,13 @@ const tips = { // 下载文件出现错误,请联系管理员! downloadFileError: "Ошибка загрузки файла, пожалуйста, свяжитесь с администратором!", + importTip:"Инструкция по импорту", + keywordsImportTip: + "Ключевые слова/Приложения клиентов, разделенные символом | (искусственный интеллект|квантовые вычисления)", + industryImportTip: + "Область принадлежности (>соединение уровней снизу вверх, разделенных символом |)", + industryImportExample: + 'На примере: "Авиация и космонавтика>Космическая технология>Технология разработки носителей ракет|Биотехнологии и новая медицина>Традиционная медицина и природные лекарства>Технология разработки инновационных лекарств"', }; export default tips; diff --git a/src/i18n/message/tips/zh.js b/src/i18n/message/tips/zh.js index 6b9b12c..fd12df1 100644 --- a/src/i18n/message/tips/zh.js +++ b/src/i18n/message/tips/zh.js @@ -26,6 +26,11 @@ const tips = { backendInterfaceConnectionException: "后端接口连接异常", // 下载文件出现错误,请联系管理员! downloadFileError: "下载文件出现错误,请联系管理员!", + importTip:"导入说明", + keywordsImportTip: "关键词/应用客户 多个用{'|'}隔开 (人工智能{'|'}量子计算)", + industryImportTip: "所属领域 (>拼接上下级 多个用{'|'}隔开) ", + industryImportExample: + "例如 : 航空航天>航天技术>运载火箭技术{'|'}生物与新医药>中药、天然药物>创新药物研发技术", }; export default tips; diff --git a/src/utils/parameter.js b/src/utils/parameter.js index eeaf5dc..8f053e4 100644 --- a/src/utils/parameter.js +++ b/src/utils/parameter.js @@ -368,35 +368,42 @@ export const countryOptions = [ key: "zh", zh: "中国", ru: "Китай", + en: "China", }, { key: "ru", zh: "俄罗斯", ru: "Россия", + en: "Russia", }, { key: "tj", zh: "塔吉克斯坦", ru: "Таджикистан", + en: "Tajikistan", }, { key: "tm", zh: "土库曼斯坦", ru: "Туркменистан", + en: "Turkmenistan", }, { key: "uz", zh: "乌兹别克斯坦", ru: "Узбекистан", + en: "Uzbekistan", }, { key: "kz", zh: "哈萨克斯坦", ru: "Казахстан", + en: "Kazakhstan", }, { key: "kg", zh: "吉尔吉斯斯坦", ru: "Кыргызстан", - } + en: "Kyrgyzstan", + }, ]; diff --git a/src/views/admin/laboratory/research/achievement/index.vue b/src/views/admin/laboratory/research/achievement/index.vue index d339849..bebf4f5 100644 --- a/src/views/admin/laboratory/research/achievement/index.vue +++ b/src/views/admin/laboratory/research/achievement/index.vue @@ -40,24 +40,27 @@ - - - - - - - - - - - {{ - t("admin.form.add", { - type: t("admin.common.achievement"), - }) - }} + + {{ t("admin.form.importAchievement") }} + {{ t("tips.downloadTemplate") }} +
+ {{ t('tips.importTip') }} +
    +
  1. {{ t("tips.keywordsImportTip") }}
  2. +
  3. + {{ t("tips.industryImportTip") }} +
    + {{ t("tips.industryImportExample") }} +
  4. +
-
- {{ t("tips.importInstructions") }} - {{ t("common.download") }} - -
+ + + + + + + + + + @@ -198,9 +203,10 @@ import importTip from "@/assets/achievement_import_description.txt?url"; import { saveAs } from "file-saver"; import { useI18n } from "vue-i18n"; import dayjs from "dayjs"; -import {UploadFilled} from "@element-plus/icons-vue"; +import { UploadFilled } from "@element-plus/icons-vue"; +import { researchArchievementTemplate } from "@/api/admin/laboratory/research-project"; -const { t } = useI18n(); +const { t, locale } = useI18n(); const router = useRouter(); const dataList = ref([]); @@ -320,5 +326,10 @@ function submitFileForm() { uploadRef.value.submit(); } +const downloadImportTemplate = async () => { + const blob = await researchArchievementTemplate(); + saveAs(blob, `${t("admin.common.achievementImportTemplate")}.xlsx`); +}; + getList(); - + \ No newline at end of file diff --git a/src/views/website/home/comp/index0.vue b/src/views/website/home/comp/index0.vue index c8c53d2..e569058 100644 --- a/src/views/website/home/comp/index0.vue +++ b/src/views/website/home/comp/index0.vue @@ -15,6 +15,9 @@ import { countExpertByArea, countExpertByCity, countExpertByProvince, + getAchievementMap, + getEnterpriseMap, + getExpertMap, } from "@/api/website/home"; import backBtnPng from "@/assets/images/map_back.png"; import RegionPagine from "@/views/website/home/comp/RegionPagine.vue"; @@ -22,6 +25,7 @@ import html2canvas from "html2canvas"; import anime from "animejs"; import { useI18n } from "vue-i18n"; import geoJSONRU from "@/assets/world.json"; +import { countryOptions } from "@/utils/parameter"; const { t, locale } = useI18n(); const leftBoxPageNum = ref(1); @@ -43,6 +47,7 @@ const methods = [ { name: "expert", title: computed(() => t("map.expertMap")), + method: getExpertMap, byProvince: countExpertByProvince, byCity: countExpertByCity, byArea: countExpertByArea, @@ -51,6 +56,7 @@ const methods = [ name: "technology", // title: "技术分布地图", title: computed(() => t("map.technologyMap")), + method: getAchievementMap, byProvince: countAchievementByProvince, byCity: countAchievementByCity, byArea: countAchievementByArea, @@ -67,6 +73,7 @@ const methods = [ name: "enterprise", // title: "企业分布地图", title: computed(() => t("map.companyMap")), + method: getEnterpriseMap, byProvince: countEnterpriseByProvince, byCity: countEnterpriseByCity, byArea: countEnterpriseByArea, @@ -109,7 +116,8 @@ const options = { tooltip: { //提示框信息 trigger: "item", - formatter: "{b}\n{c}人", + formatter: "{b}\n{c}", + valueFormatter: (value) => (value + locale.value === "zh" ? "人" : "людей"), }, series: [ { @@ -204,7 +212,7 @@ const loadChinaDistrict = (adcode) => { }); }; -const loadRussiaDistrict = () => { +const loadI18nDistrict = async () => { mapData.value = geoJSONRU.features.map((el) => { const areaProp = el.properties; return { @@ -213,6 +221,40 @@ const loadRussiaDistrict = () => { }; }); registerMap("map", { geoJSON: geoJSONRU, specialAreas: {} }); + myEcharts.value.setOption(options); + let result; + try { + result = await methods[mapIndex.value]["method"](); + } catch (e) { + result = { data: {} }; + } + areaCount.value = + result?.data?.count?.map((el) => { + return { + name: countryOptions.find((ct) => el.country === ct.key)?.[ + locale.value + ], + count: el.count, + }; + }) ?? []; + industryCount.value = Object.keys(result.data?.industry ?? {}).map( + (key) => ({ + name: key, + count: result.data.industry[key], + }) + ); + mapData.value = geoJSONRU.features.map((el) => { + const areaProp = el.properties; + return { + name: areaProp.name, + value: + result.data?.count?.find( + (el) => + countryOptions.find((ct) => ct.key === el.country)?.en === + areaProp.name + )?.count ?? 0, + }; + }); options.series[0].data = mapData.value; myEcharts.value.setOption(options); // TODO:get count @@ -231,7 +273,7 @@ onMounted(async () => { // loadChinaDistrict("100000"); // } else { // } - loadRussiaDistrict(); + loadI18nDistrict(); }); /** @@ -267,7 +309,10 @@ const playScrollAnimation = (direction, start) => { html2canvas(pageWrap, { // width: pageWrap.offsetWidth / 5, // height: pageWrap.offsetHeight / 5, + scale: 1 / 5, }).then((canvas) => { + canvas.style.width = "100%"; + canvas.style.height = "100%"; canvas.addEventListener("wheel", (ev) => { ev.stopPropagation(); ev.preventDefault(); @@ -328,7 +373,7 @@ watch(mapIndex, (newVal, oldVal) => { // if (locale.value === "zh") { // loadChinaDistrict("100000"); // } else { - loadRussiaDistrict(); + loadI18nDistrict(); // } }); @@ -349,9 +394,9 @@ watch(mapIndex, (newVal, oldVal) => {
{{ methods[mapIndex].title.value }}
-
- back -
+
@@ -529,7 +574,9 @@ watch(mapIndex, (newVal, oldVal) => { } .title { + width: 160px; border-right: 1px solid #0054ff; + word-break: break-all; } }