Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wisdom-components
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ReactWeb5
wisdom-components
Commits
fa63f244
Commit
fa63f244
authored
Sep 13, 2022
by
陈龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 更新baiscreport版本
parent
bb815022
Pipeline
#59829
failed with stages
in 17 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
80 additions
and
45 deletions
+80
-45
ReportEditForm.js
...omponents/BasicReport/src/ReportsManage/ReportEditForm.js
+19
-6
ReportsManage.js
...components/BasicReport/src/ReportsManage/ReportsManage.js
+24
-7
utils.js
...e-components/BasicReport/src/ReportsManage/utils/utils.js
+37
-32
No files found.
packages/base-components/BasicReport/src/ReportsManage/ReportEditForm.js
View file @
fa63f244
...
...
@@ -5,7 +5,18 @@
** 菜单参数列表:*变量名*(变量说明,数据类型,是否必填,取值范围)
**/
import
React
,
{
useEffect
,
useState
}
from
'react'
;
import
{
Form
,
Input
,
DatePicker
,
InputNumber
,
Space
,
Row
,
Col
,
Button
,
message
,
Select
}
from
'antd'
;
import
{
Form
,
Input
,
DatePicker
,
InputNumber
,
Space
,
Row
,
Col
,
Button
,
message
,
Select
,
}
from
'antd'
;
import
moment
from
'moment'
;
import
{
submitReportData
}
from
'../api/service/report'
;
import
FileUpload
from
'./Components/fileUpload/fileUpload'
;
...
...
@@ -67,11 +78,13 @@ const ReportEditForm = ({ reportDetails, reportData, onCancel, reportName, modal
if
(
isSelect
(
config
.
configItems
))
{
let
options
=
returnOptions
(
config
.
configItems
);
if
(
options
)
{
return
<
Select
>
{
options
.
map
(
item
=>
<
Option
value
=
{
item
}
>
{
item
}
<
/Option>
)
}
<
/Select>
;
return
(
<
Select
>
{
options
.
map
((
item
)
=>
(
<
Option
value
=
{
item
}
>
{
item
}
<
/Option
>
))}
<
/Select
>
);
}
}
return
<
Input
/>
;
...
...
packages/base-components/BasicReport/src/ReportsManage/ReportsManage.js
View file @
fa63f244
...
...
@@ -12,32 +12,44 @@
* @params: <ReportManage
* params={{reportName,pageSize,filterFields,filterValues,state,customerState}}>
*
*
* reportName: 报表名称;
* pageSize: 按需配置,默认加载100;
*
*
* ***************filterFields/filterValues多用于以组件的形式嵌入,将需要过滤的条件传入********************
*
*
* filterFields: 需要默认加载的过滤条件的field,英文逗号分割,与filterValues一一对应;
* filterValues:
*
* 需要默认加载的过滤条件的value,英文逗号分割,与filterFields一一对应;
*
*
* *************************************************************************************************
*
* state: delete|edit|scan 各种权限;
*
* state: delete|edit|scan 各种权限;
* customerState:
*
* ['filters','sortBtn','exportBtn','editBtn','deleteBtn','pagination'];
* sortFields:
* '排序字段1,排序字段2,排序字段3'
*
* '排序字段1,排序字段2,排序字段3'
*
*
* ---------------------------------------权限过滤-----------------------------------------
*
* permissionType: 部门|站点|用户
*
* permissionType: 部门|站点|用户
* permissionField: 【字段名】
*
*
* ---------------------------------------------------------------------------------------
* @config:
* 【数值】 [prefix]_d%|0.00|_d%[suffix]|金额 = 前缀|精度|后缀|金额类的数据(千分位),可分别设置。
* 【标签】 split=, 分隔符。
* 【标签】 split=,
* 分隔符。
*
* 【功能】 功能配置框内,配置需要跳转功能所需参数,type、url是必须功能,需要type判断类型,需要通过url去解析加载组件。
* @type:
...
...
@@ -45,13 +57,16 @@
* 【数值】数值类型的文本
* 【标签】文本渲染成标签,具有不同颜色;
* 【功能】“功能”会在当前页内去展示,会卸载掉列表页,加载功能组件。配置 type +
* url + 自定义字段 的配置项,自行解析加载即可;
*
* url + 自定义字段 的配置项,自行解析加载即可;
* -------------------- 待需求提出后开发 -----------------
*
*
* 【链接】内链外链,点击可跳转;配置规则:配置链接即可;
* 【弹窗】modal弹窗弹出,弹窗内的具体业务自行配置;配置规则:[function_name];[...params];
*
* ------------------------------------------------------
*
* ------------------------------------------------------
* 【附件】
* @table:
* 表头:表头需要支持多级表头、合并;
...
...
@@ -60,9 +75,11 @@
* @control:
* 固定筛选:拥有固定筛选框,根据配置显示可搜索字段;
*
*
* 可配置筛选框:根据字段配置,将字段设置成筛选条件,枚举出该字段所有值,提供用户进行选择,然后进行筛选;筛选框具体形态可根据配置字段来渲染;
* 导出功能:各类导出功能按钮;
*
*
* 时间筛选框:单表唯一;需要变更,支持多时间参数的筛选
* @state: 参考台账权限 delete 全部权限
* edit 除删除外的权限
...
...
@@ -966,7 +983,7 @@ const ReportsManage = (props) => {
},
[
tableHeaderLevel
]);
useEffect
(()
=>
{
if
(
!
isInit
)
getData
(
pagination
);
},
[
timeFrom
,
timeTo
,
sorterObject
,
filterObject
,
getNewData
]);
},
[
timeFrom
,
timeTo
,
sorterObject
,
filterObject
,
getNewData
]);
useEffect
(()
=>
{
function
getRefHeight
()
{
if
(
timer
)
clearTimeout
(
timer
);
...
...
packages/base-components/BasicReport/src/ReportsManage/utils/utils.js
View file @
fa63f244
...
...
@@ -13,27 +13,27 @@ const isArray = (arr) => {
const
hasMoney
=
(
configItems
)
=>
{
if
(
!
configItems
)
return
false
;
let
_items
=
configItems
.
split
(
'|'
);
return
!!
_items
.
find
(
item
=>
item
===
'金额'
);
return
!!
_items
.
find
(
(
item
)
=>
item
===
'金额'
);
};
const
isSelect
=
(
configItems
)
=>
{
if
(
!
configItems
)
return
false
;
let
_items
=
configItems
.
split
(
'|'
);
return
!!
_items
.
find
(
item
=>
item
===
'renderAsSelect'
);
return
!!
_items
.
find
(
(
item
)
=>
item
===
'renderAsSelect'
);
};
// options=name1[.value1],name2[.value2],name3[.value3];
const
returnOptions
=
(
configItems
)
=>
{
if
(
!
configItems
)
return
false
;
let
_items
=
configItems
.
split
(
'|'
);
let
_options
=
_items
.
find
(
item
=>
item
.
includes
(
'options='
));
let
_options
=
_items
.
find
(
(
item
)
=>
item
.
includes
(
'options='
));
if
(
!
_options
)
return
false
;
return
_options
.
replace
(
'options='
,
''
).
split
(
','
);
};
/**
*
@D
escription: 用来在summary中处理数值的配置
*
@P
arams: 参数描述
*
@D
ate: 2022/8/10
*
@A
uthor: ChenLong
*
*
/
*
@d
escription: 用来在summary中处理数值的配置
*
@p
arams: 参数描述
*
@d
ate: 2022/8/10
*
@a
uthor: ChenLong
*/
const
returnHandledNumber
=
(
configItems
,
num
)
=>
{
// 精度、前缀、后缀、倍率
// $_d|_d%|_d*0.0001|金额|0.00
...
...
@@ -46,7 +46,7 @@ const returnHandledNumber = (configItems, num) => {
let
template
=
'_d'
;
let
precision
=
0
;
let
rate
=
1
;
_items
.
forEach
(
item
=>
{
_items
.
forEach
(
(
item
)
=>
{
let
_arr
=
[];
if
(
item
.
match
(
/_d
[^\*]
/
))
{
// 后缀
...
...
@@ -61,27 +61,31 @@ const returnHandledNumber = (configItems, num) => {
}
});
// 可能存在NaN的问题
let
final
=
_items
.
includes
(
'金额'
)
?
Number
((
num
*
rate
).
toFixed
(
precision
)).
toLocaleString
()
:
Number
((
num
*
rate
).
toFixed
(
precision
));
let
final
=
_items
.
includes
(
'金额'
)
?
Number
((
num
*
rate
).
toFixed
(
precision
)).
toLocaleString
()
:
Number
((
num
*
rate
).
toFixed
(
precision
));
return
template
.
replace
(
/_d/
,
isString
(
final
)
?
final
:
'-'
);
};
/**
* @Description: 返回configItems内配置的默认值、默认模式等等
* @Params: 参数描述
* @Date: 2022/8/12
* @Author: ChenLong
* @params:
* configItems 报表字段的配置 例如 defaultValue=智慧水务 defaultDateModel=customer|defaultDateValue=2022-01-01,2022-12-31;
* keysArray 所需要返回的值的key的集合,比如你需要获取configItems中的’defaultValue‘,那么keysArray=['defaultValue'];
* @Returns:
* defaultValue 通用参数 默认值
* @description: 返回configItems内配置的默认值、默认模式等等
* @params: 参数描述
* @date: 2022/8/12
* @author: ChenLong
* @params:
* configItems 报表字段的配置 例如 defaultValue=智慧水务
* defaultDateModel=customer|defaultDateValue=2022-01-01,2022-12-31;
* keysArray
* 所需要返回的值的key的集合,比如你需要获取configItems中的’defaultValue‘,那么keysArray=['defaultValue'];
* @returns:
* defaultValue 通用参数 默认值
* defaultDateModel 时间参数 默认模式
* defaultDateValue 时间参数 默认时间
*
*
/
*/
const
returnDefaultValueOrConfigs
=
(
configItems
=
''
,
keysArray
=
[])
=>
{
let
_map
=
{};
let
_configItemsArray
=
configItems
.
split
(
'|'
);
keysArray
.
forEach
(
key
=>
{
_map
[
key
]
=
_configItemsArray
.
find
(
item
=>
item
.
includes
(
`
${
key
}
=`
))?.
replace
(
`
${
key
}
=`
,
''
);
keysArray
.
forEach
(
(
key
)
=>
{
_map
[
key
]
=
_configItemsArray
.
find
(
(
item
)
=>
item
.
includes
(
`
${
key
}
=`
))?.
replace
(
`
${
key
}
=`
,
''
);
});
return
_map
;
};
...
...
@@ -96,20 +100,22 @@ function downloadFunc(url, name, target = '_self') {
}
/**
*
@D
escription: 校验文件的名称是否包含特殊字符
*
@P
arams: {Object: File} file file对象 { special:Boolean } 是否去除/的匹配
*
@D
ate: 2021/12/8
*
@A
uthor: ChenLong
*
@Return
{Object} {type: error | success ,content: 提示...}
*
*
/
*
@d
escription: 校验文件的名称是否包含特殊字符
*
@p
arams: {Object: File} file file对象 { special:Boolean } 是否去除/的匹配
*
@d
ate: 2021/12/8
*
@a
uthor: ChenLong
*
@returns
{Object} {type: error | success ,content: 提示...}
*/
function
filenameVerification
(
file
,
special
)
{
// 文件名含有特殊字符 提示不能上传 {+,:/?#[]@!$&\\*+;=}
// 规则对象(flag)
var
flag
=
!
special
?
new
RegExp
(
'[`~!@#$^&*=|{}
\'
:;
\'
,
\\
[
\\
]/?~!@#¥&*——|{}【】‘;:”“
\'
。,、?]'
)
:
new
RegExp
(
'[`~!@#$^&*=|{}
\'
:;
\'
,[
\\
]?~!@#¥&*——|{}【】‘;:”“
\'
。,、?]'
);
var
flag
=
!
special
?
new
RegExp
(
"[`~!@#$^&*=|{}':;',
\\
[
\\
]/?~!@#¥&*——|{}【】‘;:”“'。,、?]"
)
:
new
RegExp
(
"[`~!@#$^&*=|{}':;',[
\\
]?~!@#¥&*——|{}【】‘;:”“'。,、?]"
);
if
(
flag
.
test
(
file
.
name
))
{
return
{
type
:
'error'
,
content
:
`文件名格式错误,请检查文件名是否含有特殊字符
${
'~!@#$^&*=|{}
\'
:;
\'
,
\\
[
\\
]/?~!@#¥&*——|{}【】‘;:”“
\'
。,、?'
}
`
,
content
:
`文件名格式错误,请检查文件名是否含有特殊字符
${
"~!@#$^&*=|{}':;',
\\
[
\\
]/?~!@#¥&*——|{}【】‘;:”“'。,、?"
}
`
,
};
}
return
{
...
...
@@ -130,4 +136,4 @@ export {
filenameVerification
,
isSelect
,
returnOptions
,
};
\ No newline at end of file
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment