Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
wangxiaolu-sfa-ui
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
sfa
wangxiaolu-sfa-ui
Commits
0ec288fd
提交
0ec288fd
authored
1月 16, 2025
作者:
lidongxu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor(all): 取消全选-选项使用
格式化金额千分位,接入列表查询接口
上级
db1c71b2
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
76 行增加
和
36 行删除
+76
-36
finance.js
src/api/bi/finance.js
+8
-1
index.vue
src/components/XLSelect/index.vue
+25
-7
math.js
src/utils/math.js
+6
-2
index.vue
src/views/bi/finance/index.vue
+37
-26
没有找到文件。
src/api/bi/finance.js
浏览文件 @
0ec288fd
...
@@ -9,6 +9,12 @@ export const getFinanceListAPI = (data) => {
...
@@ -9,6 +9,12 @@ export const getFinanceListAPI = (data) => {
return
request
({
return
request
({
url
:
'/bi/finance/cost/list'
,
url
:
'/bi/finance/cost/list'
,
method
:
'POST'
,
method
:
'POST'
,
data
data
:
{
zbjQdType
:
data
.
brand
,
flavor
:
data
.
taste
,
specName
:
data
.
spec
,
series
:
data
.
series
,
goodsName
:
data
.
goods
}
})
})
}
}
\ No newline at end of file
src/components/XLSelect/index.vue
浏览文件 @
0ec288fd
...
@@ -2,15 +2,17 @@
...
@@ -2,15 +2,17 @@
<el-select
v-bind=
"$attrs"
<el-select
v-bind=
"$attrs"
v-model=
"selectedOptions"
v-model=
"selectedOptions"
@
change=
"handleChange"
>
@
change=
"handleChange"
>
<li
class=
"el-select-dropdown__item all_item "
:class=
"
{ 'is-selected': isAll }"
@click="selectAll">
<span>
全选
</span>
</li>
<el-option
v-for=
"str in options"
<el-option
v-for=
"str in options"
:label=
"str"
:label=
"str"
:value=
"str"
>
:value=
"str"
>
</el-option>
</el-option>
<li
class=
"el-select-dropdown__item all_item"
:class=
"
{ 'is-selected': isAll }"
@click.stop="selectAll"
@mouseenter.stop="over"
@mouseleave.stop="out">
<span>
全选
</span>
</li>
</el-select>
</el-select>
</
template
>
</
template
>
...
@@ -26,7 +28,7 @@ const props = defineProps({
...
@@ -26,7 +28,7 @@ const props = defineProps({
default
:
()
=>
[],
default
:
()
=>
[],
},
},
modelValue
:
{
modelValue
:
{
type
:
Array
,
type
:
[
Array
,
String
]
,
default
:
()
=>
[]
default
:
()
=>
[]
}
}
})
})
...
@@ -38,6 +40,12 @@ watch(() => props.modelValue, val => {
...
@@ -38,6 +40,12 @@ watch(() => props.modelValue, val => {
deep
:
true
,
deep
:
true
,
immediate
:
true
immediate
:
true
})
})
// 设置样式
const
noHover
=
()
=>
{
const
list
=
document
.
querySelectorAll
(
'.el-select-dropdown .el-select-dropdown__item'
)
list
.
forEach
(
el
=>
el
.
classList
.
add
(
'no-hovering'
))
}
// 全选点击
// 全选点击
const
selectAll
=
()
=>
{
const
selectAll
=
()
=>
{
...
@@ -49,12 +57,22 @@ const selectAll = () => {
...
@@ -49,12 +57,22 @@ const selectAll = () => {
selectedOptions
.
value
=
[];
selectedOptions
.
value
=
[];
emits
(
'update:modelValue'
,
selectedOptions
.
value
);
emits
(
'update:modelValue'
,
selectedOptions
.
value
);
}
}
nextTick
(()
=>
{
noHover
()
})
}
}
const
handleChange
=
(
val
)
=>
{
const
handleChange
=
(
val
)
=>
{
isAll
.
value
=
val
.
length
===
props
.
options
.
length
isAll
.
value
=
val
.
length
===
props
.
options
.
length
emits
(
'update:modelValue'
,
val
)
emits
(
'update:modelValue'
,
val
)
}
}
const
over
=
()
=>
{
noHover
()
}
const
out
=
()
=>
{
noHover
()
}
</
script
>
</
script
>
<
style
scoped
<
style
scoped
...
@@ -68,7 +86,7 @@ const handleChange = (val) => {
...
@@ -68,7 +86,7 @@ const handleChange = (val) => {
background-color
:
var
(
--
el-fill-color-light
);
background-color
:
var
(
--
el-fill-color-light
);
}
}
.
all_item
:hover
+
.is
-hovering
{
.
no
-hovering
{
background-color
:
transparent
;
background-color
:
transparent
;
}
}
...
...
src/utils/math.js
浏览文件 @
0ec288fd
...
@@ -77,8 +77,12 @@ export function formatNumberWithUnit({ value, carry = true, fixed = 2, round = t
...
@@ -77,8 +77,12 @@ export function formatNumberWithUnit({ value, carry = true, fixed = 2, round = t
resultNum
=
Math
.
abs
(
resultNum
);
resultNum
=
Math
.
abs
(
resultNum
);
}
}
if
(
comma
)
{
if
(
comma
)
{
// 是否添加千分位符号
// 将整数部分和小数部分分开
resultNum
=
resultNum
.
toString
().
replace
(
/
\B(?=(\d{3})
+
(?!\d))
/g
,
','
);
const
parts
=
resultNum
.
toString
().
split
(
'.'
);
// 只在整数部分添加逗号
parts
[
0
]
=
parts
[
0
].
replace
(
/
\B(?=(\d{3})
+
(?!\d))
/g
,
','
);
// 重新组合整数部分和小数部分
resultNum
=
parts
.
join
(
'.'
);
}
}
return
`
${
resultNum
}
${
unit
}${
des
}
`
;
return
`
${
resultNum
}
${
unit
}${
des
}
`
;
}
}
...
...
src/views/bi/finance/index.vue
浏览文件 @
0ec288fd
...
@@ -6,15 +6,18 @@
...
@@ -6,15 +6,18 @@
label-position=
"right"
label-position=
"right"
label-width=
"68px"
label-width=
"68px"
inline
>
inline
>
<el-form-item
label=
"直播间"
ref=
"ab"
>
<el-form-item
label=
"直播间"
>
<xl-select
v-model=
"queryParams.brand"
<el-select
v-model=
"queryParams.brand"
:options=
"brandList"
multiple
multiple
clearable
clearable
collapse-tags
collapse-tags
collapse-tags-tooltip
collapse-tags-tooltip
@
change=
"getList"
>
@
change=
"getList"
>
</xl-select>
<el-option
v-for=
"str in brandList"
:label=
"str"
:value=
"str"
>
</el-option>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item
label=
"口味"
>
<el-form-item
label=
"口味"
>
<el-select
v-model=
"queryParams.taste"
<el-select
v-model=
"queryParams.taste"
...
@@ -87,10 +90,8 @@
...
@@ -87,10 +90,8 @@
<el-table-column
v-for=
"item in columns"
<el-table-column
v-for=
"item in columns"
:key=
"item.prop"
:key=
"item.prop"
:label=
"item.label"
:label=
"item.label"
:prop=
"item.prop"
>
:prop=
"item.prop"
<template
v-slot=
"scope"
>
:formatter=
"formatter"
>
{{
scope
.
row
[
item
.
prop
]
}}
</
template
>
</el-table-column>
</el-table-column>
</el-table>
</el-table>
</div>
</div>
...
@@ -116,22 +117,23 @@
...
@@ -116,22 +117,23 @@
<
script
setup
>
<
script
setup
>
import
{
getFinanceListAPI
}
from
'@/api'
import
{
getFinanceListAPI
}
from
'@/api'
import
{
useDatePickerOptions
}
from
'@/hooks'
import
{
useDatePickerOptions
}
from
'@/hooks'
import
{
formatNumberWithUnit
}
from
'@/utils'
const
{
pickerOptions
}
=
useDatePickerOptions
()
const
{
pickerOptions
}
=
useDatePickerOptions
()
const
detailVisible
=
ref
(
false
)
// 详情
const
detailVisible
=
ref
(
false
)
// 详情
const
brandList
=
ref
([
'a'
,
'b'
,
'c'
])
// 直播间
const
brandList
=
ref
([
"虎皮01"
,
"IP礼盒直播间"
,
"礼盒直播间"
,
"去骨直播间"
])
// 直播间
const
tasteList
=
ref
([])
// 口味
const
tasteList
=
ref
([
"香辣"
,
"原味"
,
"椒麻"
,
"混合"
])
// 口味
const
specList
=
ref
([])
// 规则
const
specList
=
ref
([])
// 规则
const
seriesList
=
ref
([])
// 系列
const
seriesList
=
ref
([])
// 系列
const
goodsList
=
ref
([])
// 商品
const
goodsList
=
ref
([])
// 商品
const
data
=
reactive
({
const
data
=
reactive
({
queryParams
:
{
queryParams
:
{
brand
:
[
'a'
,
'b'
,
'c'
],
// 直播间
brand
:
[
"虎皮01"
,
"IP礼盒直播间"
,
"礼盒直播间"
,
"去骨直播间"
],
// 直播间
taste
:
''
,
// 口味
taste
:
[
"香辣"
,
"原味"
,
"椒麻"
,
"混合"
]
,
// 口味
spec
:
''
,
// 规格
spec
:
[]
,
// 规格
series
:
''
,
// 系列
series
:
[]
,
// 系列
goods
:
''
,
// 商品
goods
:
[]
,
// 商品
date
:
[]
// 日期
date
:
[]
// 日期
}
}
})
})
...
@@ -142,27 +144,27 @@ const queryChange = () => {
...
@@ -142,27 +144,27 @@ const queryChange = () => {
}
}
//
获取
数据
//
表格
数据
const
columns
=
ref
([
const
columns
=
ref
([
{
{
label
:
'直播间'
,
label
:
'直播间'
,
prop
:
'
query
Type'
prop
:
'
zbjQd
Type'
},
},
{
{
label
:
'口味'
,
label
:
'口味'
,
prop
:
'
queryType
'
prop
:
'
flavorErp
'
},
},
{
{
label
:
'规格'
,
label
:
'规格'
,
prop
:
'
queryType
'
prop
:
'
specNameErp
'
},
},
{
{
label
:
'系列'
,
label
:
'系列'
,
prop
:
'
queryType
'
prop
:
''
},
},
{
{
label
:
'商品'
,
label
:
'商品'
,
prop
:
'
queryTyp
e'
prop
:
'
goodsNam
e'
},
},
{
{
label
:
'分摊后总价'
,
label
:
'分摊后总价'
,
...
@@ -173,16 +175,16 @@ const columns = ref([
...
@@ -173,16 +175,16 @@ const columns = ref([
prop
:
'actualCostSum'
prop
:
'actualCostSum'
},
},
{
{
label
:
'
标准成本
'
,
label
:
'
实际成本毛利
'
,
prop
:
'
standardCos
tSum'
prop
:
'
actualCostGrossProfi
tSum'
},
},
{
{
label
:
'
实际成本毛利
'
,
label
:
'
标准成本
'
,
prop
:
'standardCostSum'
prop
:
'standardCostSum'
},
},
{
{
label
:
'标准成本毛利'
,
label
:
'标准成本毛利'
,
prop
:
'standardCostSum'
prop
:
'standardCost
GrossProfit
Sum'
}
}
])
])
const
tableData
=
ref
([
const
tableData
=
ref
([
...
@@ -193,6 +195,16 @@ const getList = async () => {
...
@@ -193,6 +195,16 @@ const getList = async () => {
}
}
getList
()
getList
()
const
formatter
=
(
row
,
column
,
value
)
=>
{
if
([
'shareAmountSum'
,
'actualCostSum'
,
'actualCostGrossProfitSum'
,
'standardCostSum'
,
'standardCostGrossProfitSum'
].
includes
(
column
.
property
))
{
console
.
log
(
value
)
return
formatNumberWithUnit
({
value
,
carry
:
false
,
fixed
:
4
,
round
:
false
,
post
:
false
,
comma
:
true
,
des
:
''
})
}
else
{
return
value
}
}
// 详情数据
const
detailTableData
=
ref
([])
const
detailTableData
=
ref
([])
const
detailColumns
=
ref
([
const
detailColumns
=
ref
([
{
{
...
@@ -273,7 +285,6 @@ const detailColumns = ref([
...
@@ -273,7 +285,6 @@ const detailColumns = ref([
prop
:
''
prop
:
''
}
}
])
])
const
ab
=
ref
(
null
)
</
script
>
</
script
>
<
style
scoped
<
style
scoped
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论