Commit de2ecc49 by Lin

feat: 策略中心API完善/策略中心预警指标树接口联调

1 parent c3bf8102
......@@ -374,7 +374,7 @@ export function biMatterDelete(data) {
return request(data, RequestMethods.POST)
}
// 策略中心模块接口
/**
* 策略中心区域选择列表
*/
......@@ -397,3 +397,51 @@ export function getCarBrandList(data = {}) {
data.method = "dj.api.smartcarlife.common.car.brand.list"
return request(data, RequestMethods.POST)
}
/**
* 获取策略中心列表
*/
export function getMonitorList(data = {}) {
data.method = "dj.api.strategy.monitor.findMonitorListPage"
return request(data, RequestMethods.POST)
}
/**
* 策略中心-预警指标树
*/
export function getMonitorTypeDictList(data = {}) {
data.method = "dj.api.strategy.monitor.findMonitorTypeDictList"
return request(data, RequestMethods.POST)
}
// 策略分析模块
/**
* 策略分析-总数统计
*/
export function getStrategyTotal(data = {}) {
data.method = "dj.api.strategy.find.strategy.total.statistics"
return request(data, RequestMethods.POST)
}
/**
* 策略分析-策略类型分布
*/
export function getStrategyTypeDist(data = {}) {
data.method = "dj.api.strategy.find.strategy.type.distribution"
return request(data, RequestMethods.POST)
}
/**
* 策略分析-线上运营分布
*/
export function getStrategyOnlineDist(data = {}) {
data.method = "dj.api.strategy.find.strategy.online.distribution"
return request(data, RequestMethods.POST)
}
/**
* 策略分析-效果分析
*/
export function getStrategyEffectList(data = {}) {
data.method = "dj.api.strategy.find.strategy.effect.analysis"
return request(data, RequestMethods.POST)
}
\ No newline at end of file
......@@ -233,7 +233,7 @@ const DateRangeStrategies = {
}
}
};
// 日期类型:0,按日;1,按周;2,按月;3,按年;4,自定义;
export default {
name: 'CalendarCustom',
props: {
......@@ -241,9 +241,9 @@ export default {
timeRangeOptions: {
type: Array,
default: () => [
{ label: '周', value: '周' },
{ label: '月', value: '月' },
{ label: '自定义', value: '自定义' }
{ label: '周', value: 1 },
{ label: '月', value: 2 },
{ label: '自定义', value: 4 }
]
},
// 当前选中的时间范围类型
......
......@@ -74,7 +74,6 @@
></el-option>
</el-select>
</div>
<!-- 按钮组 -->
<div class="btn-group">
<el-button type="primary" size="small" class="btn-search" @click="handleSearch">查询</el-button>
......
......@@ -90,7 +90,7 @@ import MonitorCard from './compoments/monitorCard.vue';
import HeaderCustom from './compoments/headerCustom.vue';
import SelectCustom from './compoments/selectCustom.vue';
import CalendarCustom from './compoments/clendarCustom.vue';
import { getDistrictDetail,getCarBrandList } from '@/api/earlyWarningManager';
import { getDistrictDetail,getCarBrandList,getMonitorTypeDictList,getMonitorList } from '@/api/earlyWarningManager';
import { merchantStaffByRoleList } from '@api/index'
export default {
name: 'DashboardExact',
......@@ -117,9 +117,9 @@ export default {
brandOptions: [],
timeRangeType: '周', // 当前选中的时间范围类型
timeRangeOptions: [
{ label: '周', value: '周' },
{ label: '月', value: '月' },
{ label: '自定义', value: '自定义' }
{ label: '周', value: 1 },
{ label: '月', value: 2 },
{ label: '自定义', value: 4 }
],
// 日期范围
dateRange: {
......@@ -128,10 +128,10 @@ export default {
},
// 盯防类型选项
watchTypeOptions: [
{ label: '兜底指标', icon: 'el-icon-warning-outline',iconUrl:require('@/assets/strategy/icon-strategy-type01.png') },
{ label: '生态系数', icon: 'el-icon-data-line',iconUrl:require('@/assets/strategy/icon-strategy-type02.png') }
{ label: '兜底指标', icon: 'el-icon-warning-outline',iconUrl:require('@/assets/strategy/icon-strategy-type01.png'),value: 1 },
{ label: '生态系数', icon: 'el-icon-data-line',iconUrl:require('@/assets/strategy/icon-strategy-type02.png'),value: 2 }
],
currentWatchType: '兜底指标', // 当前选中的盯防类型
currentWatchType: 1, // 当前选中的盯防类型
// 指标类型选项
indicatorTypeOptions: [
{ label: '全部' },
......@@ -261,6 +261,8 @@ export default {
this.getOnlineOpsList();
// 获取车品牌列表
this.getCarBrandList();
// 获取指标类型列表
this.getIndicatorTypeList();
},
beforeDestroy() {
// 组件销毁时移除样式,避免影响其他页面
......@@ -315,8 +317,9 @@ export default {
},
// 选择盯防类型
selectWatchType(item) {
this.currentWatchType = item.label;
// 这里可以触发数据更新逻辑
this.currentWatchType = item.value;
// 当盯防类型改变时,重新获取指标类型列表
this.getIndicatorTypeList();
console.log('选择盯防类型:', item.label);
},
// 选择指标类型
......@@ -428,6 +431,32 @@ export default {
}
}
});
},
// 获取指标类型列表
async getIndicatorTypeList() {
try {
const res = await getMonitorTypeDictList({ monitorType: this.currentWatchType });
if (res) {
// 将接口返回的数据转换为选择器需要的格式
const apiOptions = res.map(item => ({
label: item.label || item.name || item.text || item.value
}));
// 合并接口数据和硬编码数据,接口数据优先
// 如果接口返回的数据包含"全部",则使用接口数据;否则在开头添加"全部"
const hasAllOption = apiOptions.some(item => item.label === '全部');
if (!hasAllOption) {
apiOptions.unshift({ label: '全部' });
}
// 更新指标类型选项,保留硬编码作为备用(如果接口数据为空则使用硬编码)
this.indicatorTypeOptions = apiOptions.length > 0 ? apiOptions : this.indicatorTypeOptions;
} else {
// 如果接口返回为空,保持原有的硬编码数据
console.warn('指标类型列表接口返回为空,使用默认硬编码数据');
}
} catch (error) {
console.error('获取指标类型列表失败:', error);
// 接口调用失败时,保持原有的硬编码数据
}
}
}
};
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!