Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
dj-car-life-system
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 2c0c6452
authored
Jan 21, 2026
by
Lin
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
feat: 策略分析页面接口对齐/补充日期筛选组件
1 parent
d74ffebc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
141 additions
and
37 deletions
src/views/earlyWarningManager/strategyAnalysis/index.vue
src/views/earlyWarningManager/strategyCentre/compoments/clendarCustom.vue
src/views/earlyWarningManager/strategyAnalysis/index.vue
View file @
2c0c645
<
template
>
<
template
>
<div
class=
"dashboard-page"
>
<div
class=
"dashboard-page"
>
<!-- 1. 顶部导航栏 -->
<!-- 1. 顶部导航栏 -->
<header-custom
<div
class=
"top-header-wrapper"
>
v-model=
"currentTab"
<header-custom
:tabs=
"tabs"
v-model=
"currentTab"
></header-custom>
:tabs=
"tabs"
></header-custom>
<calendar-custom
v-model=
"timeRangeType"
:time-range-options=
"timeRangeOptions"
:date-range
.
sync=
"dateRange"
:date-format=
"dateFormat"
@
time-range-change=
"handleTimeRangeChange"
@
date-range-change=
"handleDateRangeChange"
/>
</div>
<div
class=
"content-area"
>
<div
class=
"content-area"
>
<!-- 2. KPI 核心指标 -->
<!-- 2. KPI 核心指标 -->
<div
class=
"top-content"
>
<div
class=
"top-content"
>
...
@@ -188,16 +198,19 @@
...
@@ -188,16 +198,19 @@
<
script
>
<
script
>
import
HeaderCustom
from
'../strategyCentre/compoments/headerCustom.vue'
;
import
HeaderCustom
from
'../strategyCentre/compoments/headerCustom.vue'
;
import
SelectCustom
from
'../strategyCentre/compoments/selectCustom.vue'
;
import
SelectCustom
from
'../strategyCentre/compoments/selectCustom.vue'
;
import
calendarCustom
from
'../strategyCentre/compoments/clendarCustom.vue'
;
import
*
as
echarts
from
'echarts'
;
import
*
as
echarts
from
'echarts'
;
import
{
getBIMatterList
,
getStrategyTotal
,
getStrategyTypeDist
,
getStrategyOnlineDist
,
getMonitorList
,
getMonitorTypeDictList
}
from
"@/api/earlyWarningManager"
;
import
{
getBIMatterList
,
getStrategyTotal
,
getStrategyTypeDist
,
getStrategyOnlineDist
,
getMonitorList
,
getMonitorTypeDictList
}
from
"@/api/earlyWarningManager"
;
import
{
Util
,
deepClone
}
from
"@/common/util"
;
import
{
Util
,
deepClone
}
from
"@/common/util"
;
import
dayjs
from
'dayjs'
;
import
dayjs
from
'dayjs'
;
import
log
from
'../../../libs/util.log'
;
export
default
{
export
default
{
name
:
'strategyAnalysis'
,
name
:
'strategyAnalysis'
,
components
:
{
components
:
{
HeaderCustom
,
HeaderCustom
,
SelectCustom
SelectCustom
,
calendarCustom
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -205,25 +218,21 @@ export default {
...
@@ -205,25 +218,21 @@ export default {
tabs
:
[
tabs
:
[
{
label
:
'延保'
,
value
:
1
},
{
label
:
'延保'
,
value
:
1
},
],
],
// KPI 指标数据列表
// 时间范围类型
kpiList
:
[
timeRangeType
:
{
label
:
'周'
,
value
:
1
},
{
timeRangeOptions
:
[
label
:
'策略总数'
,
{
label
:
'周'
,
value
:
1
},
value
:
3456
,
{
label
:
'月'
,
value
:
2
},
unit
:
'个'
,
{
label
:
'自定义'
,
value
:
4
}
subLabel
:
'本月策略总数'
,
subValue
:
'200个'
,
trendClass
:
'trend-up'
},
{
label
:
'门店总数'
,
value
:
567
,
unit
:
'家'
,
subLabel
:
'本月门店总数'
,
subValue
:
'200个'
,
trendClass
:
'trend-up'
}
],
],
// 日期范围
dateRange
:
{
startDate
:
null
,
endDate
:
null
},
dateFormat
:
'YYYY-MM-DD'
,
// 日期格式化模式
// KPI 指标数据列表
kpiList
:
[],
operatorFilter
:
'all'
,
operatorFilter
:
'all'
,
myChart
:
null
,
myChart
:
null
,
// 日期范围
// 日期范围
...
@@ -652,6 +661,7 @@ export default {
...
@@ -652,6 +661,7 @@ export default {
value
:
item
.
value
!==
undefined
?
item
.
value
:
item
.
label
value
:
item
.
value
!==
undefined
?
item
.
value
:
item
.
label
};
};
// 这里可以触发数据更新逻辑
// 这里可以触发数据更新逻辑
this
.
getIndicatorTypeList
();
console
.
log
(
'选择指标类型:'
,
item
.
label
);
console
.
log
(
'选择指标类型:'
,
item
.
label
);
},
},
/**
/**
...
@@ -693,14 +703,32 @@ export default {
...
@@ -693,14 +703,32 @@ export default {
const
params
=
{
const
params
=
{
startDate
:
this
.
startDate
,
startDate
:
this
.
startDate
,
endDate
:
this
.
endDate
,
endDate
:
this
.
endDate
,
businessType
:
1
businessType
:
this
.
currentTab
.
value
};
};
const
res
=
await
getStrategyTotal
(
params
);
// const res = await getStrategyTotal(params);
if
(
res
&&
res
.
code
===
200
)
{
// if (res && res.code === 200) {
this
.
strategyTotalData
=
res
.
data
;
// this.strategyTotalData = res.data;
// 可以在这里处理返回的数据,更新页面显示
// // 可以在这里处理返回的数据,更新页面显示
console
.
log
(
'策略总数数据:'
,
this
.
strategyTotalData
);
// console.log('策略总数数据:', this.strategyTotalData);
// }
this
.
kpiList
=
[
{
label
:
'策略总数'
,
value
:
3555
,
unit
:
'个'
,
subLabel
:
'本月策略总数'
,
subValue
:
'200个'
,
trendClass
:
'trend-up'
},
{
label
:
'门店总数'
,
value
:
655
,
unit
:
'家'
,
subLabel
:
'本月门店总数'
,
subValue
:
'200个'
,
trendClass
:
'trend-up'
}
}
];
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
'获取策略总数失败:'
,
error
);
console
.
error
(
'获取策略总数失败:'
,
error
);
}
}
...
@@ -757,6 +785,61 @@ export default {
...
@@ -757,6 +785,61 @@ export default {
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
'获取线上运营分布失败:'
,
error
);
console
.
error
(
'获取线上运营分布失败:'
,
error
);
}
}
},
/**
* 更新日期范围并刷新数据(公共方法)
*/
_updateDateRangeAndRefresh
(
dateRange
)
{
if
(
!
dateRange
)
return
;
this
.
dateRange
=
{
...
dateRange
};
// 组件已根据 dateFormat 返回格式化后的字符串,直接使用即可
// 保留类型判断以兼容可能的 Date 对象(当 dateFormat 未传递时)
this
.
startDate
=
dateRange
.
startDate
?
(
typeof
dateRange
.
startDate
===
'string'
?
dateRange
.
startDate
:
dayjs
(
dateRange
.
startDate
).
format
(
'YYYY-MM-DD'
))
:
this
.
startDate
;
this
.
endDate
=
dateRange
.
endDate
?
(
typeof
dateRange
.
endDate
===
'string'
?
dateRange
.
endDate
:
dayjs
(
dateRange
.
endDate
).
format
(
'YYYY-MM-DD'
))
:
this
.
endDate
;
// 重新获取数据
this
.
fetchStrategyTotal
();
this
.
fetchStrategyTypeDist
();
this
.
fetchStrategyOnlineDist
();
},
/**
* 处理时间范围类型变化
*/
handleTimeRangeChange
(
type
,
dateRange
)
{
console
.
log
(
'时间范围类型变化:'
,
type
,
dateRange
);
// 更新时间范围类型
if
(
typeof
type
===
'string'
)
{
const
option
=
this
.
timeRangeOptions
.
find
(
opt
=>
opt
.
label
===
type
);
if
(
option
)
{
this
.
timeRangeType
=
{
label
:
option
.
label
,
value
:
option
.
value
};
}
else
{
console
.
warn
(
'未找到匹配的时间范围类型:'
,
type
);
}
}
else
if
(
typeof
type
===
'object'
&&
type
!==
null
)
{
this
.
timeRangeType
=
type
;
}
// 更新日期范围并刷新数据
this
.
_updateDateRangeAndRefresh
(
dateRange
);
},
/**
* 处理日期范围变化
*/
handleDateRangeChange
(
dateRange
)
{
console
.
log
(
'日期范围变化:'
,
dateRange
);
this
.
_updateDateRangeAndRefresh
(
dateRange
);
}
}
}
}
};
};
...
@@ -773,6 +856,13 @@ $bg-white: #fff;
...
@@ -773,6 +856,13 @@ $bg-white: #fff;
overflow
:
visible
;
overflow
:
visible
;
}
}
.top-header-wrapper
{
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
background-color
:
#fff
;
}
.content-area
{
.content-area
{
min-height
:
0
;
min-height
:
0
;
width
:
100%
;
width
:
100%
;
...
@@ -1002,6 +1092,7 @@ $bg-white: #fff;
...
@@ -1002,6 +1092,7 @@ $bg-white: #fff;
word-break
:
break-all
;
word-break
:
break-all
;
line-height
:
1.5
;
line-height
:
1.5
;
padding
:
0
10px
;
padding
:
0
10px
;
color
:
#2A58AD
;
}
}
.tool-left
{
.tool-left
{
...
...
src/views/earlyWarningManager/strategyCentre/compoments/clendarCustom.vue
View file @
2c0c645
...
@@ -291,13 +291,6 @@ export default {
...
@@ -291,13 +291,6 @@ export default {
endDate
:
null
endDate
:
null
})
})
},
},
// 日期格式化模式,支持以下格式:
// 'YYYY-MM-DD' - 默认格式,如:2024-01-15
// 'YYYY/MM/DD' - 斜杠分隔,如:2024/01/15
// 'YYYYMMDD' - 无分隔符,如:20240115
// 'YYYY-MM-DD HH:mm:ss' - 包含时间,如:2024-01-15 14:30:00
// 'YYYY/MM/DD HH:mm:ss' - 斜杠分隔含时间,如:2024/01/15 14:30:00
// 如果为 null 或空字符串,则返回 Date 对象
dateFormat
:
{
dateFormat
:
{
type
:
String
,
type
:
String
,
default
:
null
default
:
null
...
@@ -399,7 +392,27 @@ export default {
...
@@ -399,7 +392,27 @@ export default {
this
.
initDateRange
();
this
.
initDateRange
();
// emit 对象格式,与 value prop 类型一致
// emit 对象格式,与 value prop 类型一致
this
.
$emit
(
'input'
,
{
label
:
selectedOption
.
label
,
value
:
selectedOption
.
value
});
this
.
$emit
(
'input'
,
{
label
:
selectedOption
.
label
,
value
:
selectedOption
.
value
});
this
.
$emit
(
'time-range-change'
,
timeRangeLabel
,
{
...
this
.
internalDateRange
});
// 根据 dateFormat 格式化日期范围
let
formattedDateRange
;
if
(
this
.
dateFormat
&&
this
.
dateFormat
.
trim
()
!==
''
)
{
formattedDateRange
=
{
startDate
:
this
.
internalDateRange
.
startDate
?
DateUtils
.
formatDateByPattern
(
this
.
internalDateRange
.
startDate
,
this
.
dateFormat
)
:
null
,
endDate
:
this
.
internalDateRange
.
endDate
?
DateUtils
.
formatDateByPattern
(
this
.
internalDateRange
.
endDate
,
this
.
dateFormat
)
:
null
};
}
else
{
// 如果没有指定格式化模式,返回 Date 对象
formattedDateRange
=
{
startDate
:
this
.
internalDateRange
.
startDate
?
new
Date
(
this
.
internalDateRange
.
startDate
)
:
null
,
endDate
:
this
.
internalDateRange
.
endDate
?
new
Date
(
this
.
internalDateRange
.
endDate
)
:
null
};
}
this
.
$emit
(
'time-range-change'
,
timeRangeLabel
,
formattedDateRange
);
},
},
// 初始化日期范围
// 初始化日期范围
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment