Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xform
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
田翔
xform
Commits
a9c60907
Commit
a9c60907
authored
Feb 04, 2024
by
彭俊龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 自定义导出单据模板
parent
0a982f46
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
165 additions
and
2 deletions
+165
-2
index.js
src/core/Account/components/ExportTemplate/index.js
+14
-0
receipt.js
src/core/Account/components/ExportTemplate/receipt.js
+99
-0
receipt.less
src/core/Account/components/ExportTemplate/receipt.less
+36
-0
index.js
src/core/Account/components/SearchGroup/index.js
+16
-2
index.js
src/core/Account/index.js
+0
-0
No files found.
src/core/Account/components/ExportTemplate/index.js
0 → 100644
View file @
a9c60907
/*
* @Author: ZengJing
* @Date: 2024-02-04 10:01:59
* @LastEditTime: 2024-02-04 10:10:35
* @LastEditors: ZengJing
* @Description:
* @FilePath: \xform\src\core\Account\components\ExportTemplate\index.js
*/
import
Receipt
from
'./receipt'
export
{
Receipt
}
\ No newline at end of file
src/core/Account/components/ExportTemplate/receipt.js
0 → 100644
View file @
a9c60907
/*
* @Author: ZengJing
* @Date: 2024-02-04 09:39:21
* @LastEditTime: 2024-02-04 17:27:27
* @LastEditors: ZengJing
* @Description:
* @FilePath: \xform\src\core\Account\components\ExportTemplate\Receipt.js
*/
import
React
,
{
useState
,
useImperativeHandle
,
forwardRef
,
useMemo
,
useRef
}
from
'react'
;
import
styles
from
'./receipt.less'
;
import
moment
from
'moment'
;
const
Receipt
=
props
=>
{
moment
.
locale
(
'zh-cn'
);
const
{
dataList
,
title
}
=
props
;
const
arr
=
[
'坐标'
,
'地址'
,
'图片'
];
const
dataSource
=
dataList
?.
length
>
0
?
dataList
.
map
((
x
,
index
)
=>
{
return
{
id
:
x
.
id
,
webRow
:
x
.
webRow
.
filter
((
v
,
i
)
=>
{
if
(
!
arr
.
some
(
n
=>
v
.
shape
.
includes
(
n
)))
{
return
v
;
}
}),
};
})
:
null
;
const
columnCount
=
dataSource
?.
length
>
0
?
dataSource
[
0
].
webRow
.
length
+
1
:
0
;
const
footRows
=
[
'记账'
,
'保管'
,
'验收'
,
'提货人'
,
'制单'
];
const
splitOddNumber
=
oddNumber
=>
{
if
(
oddNumber
%
2
!==
1
)
{
[
oddNumber
/
2
,
oddNumber
/
2
];
}
const
firstNumber
=
Math
.
floor
(
oddNumber
/
2
);
const
secondNumber
=
firstNumber
+
1
;
return
[
firstNumber
,
secondNumber
];
};
return
(
<>
<
div
className
=
{
styles
.
content
}
>
<
table
>
<
tr
>
<
th
colSpan
=
{
columnCount
}
className
=
{
styles
.
headerTxt
}
>
<
span
>
{
title
}
<
/span
>
<
/th
>
<
/tr
>
<
tr
>
<
th
colSpan
=
{
splitOddNumber
(
columnCount
)[
0
]}
className
=
{
styles
.
headerLeft
}
>
单位:
<
/th
>
<
th
colSpan
=
{
splitOddNumber
(
columnCount
)[
1
]}
className
=
{
styles
.
headerRight
}
>
日期:
{
moment
().
format
(
'LL'
)}
<
/th
>
<
/tr
>
<
tr
>
<
th
>
序号
<
/th
>
{
dataSource
?.
length
>
0
?
dataSource
[
0
].
webRow
.
map
((
x
,
index
)
=>
<
th
>
{
x
.
fieldName
}
<
/th>
)
: null
}
<
/tr
>
{
dataSource
?.
length
>
0
?
dataSource
.
map
((
x
,
index
)
=>
(
<
tr
>
<
td
>
{
index
+
1
}
<
/td
>
{
x
.
webRow
.
map
((
v
,
i
)
=>
(
<
td
>
{
v
.
fieldValue
}
<
/td
>
))}
<
/tr
>
))
:
null
}
<
tr
>
<
td
>
合计
<
/td
>
{
dataSource
?.
length
>
0
?
dataSource
[
0
].
webRow
.
map
((
x
,
index
)
=>
<
td
><
/td>
)
: null
}
<
/tr
>
<
tr
>
{
dataSource
?.
length
>
0
?
dataSource
[
0
].
webRow
.
map
((
x
,
i
)
=>
{
if
(
footRows
.
length
>=
i
+
1
)
{
return
<
td
>
{
footRows
[
i
]}
<
/td>
;
}
else
{
return
<
td
><
/td>
;
}
})
:
null
}
<
td
><
/td
>
<
/tr
>
<
/table
>
<
/div
>
<
/
>
);
};
export
default
Receipt
;
src/core/Account/components/ExportTemplate/receipt.less
0 → 100644
View file @
a9c60907
.content{
width: auto;
height: auto;
}
table {
border-collapse: collapse; /* 合并单元格边框 */
width: 100%;
}
th, td {
border-bottom: 1px solid #ddd; /* 添加底部边框 */
padding: 8px;
text-align: center;
font-size: 13px;
}
.headerLeft{
text-align: left !important;
font-weight: bold;
}
.headerRight{
text-align: right !important;
font-weight: bold;
}
.headerTxt{
padding: 5px;
text-align: center;
font-size: 13px;
border: none !important;
span{
border-bottom: 1px solid gray;
font-weight: bold;
width: auto;
}
}
\ No newline at end of file
src/core/Account/components/SearchGroup/index.js
View file @
a9c60907
...
...
@@ -18,7 +18,7 @@ const SearchGroup = forwardRef((props, ref) => {
}))
const
{
accountName
,
config
,
notUse
,
checkName
,
btnsClick
,
keys
}
=
props
const
{
enableBatchOperation
,
enableImportExport
,
enablePrint
,
enableQuickSearch
,
enableTimeFilter
,
parent
,
accountFieids
}
=
config
const
{
enableBatchOperation
,
enableImportExport
,
e
xportTemplateName
,
e
nablePrint
,
enableQuickSearch
,
enableTimeFilter
,
parent
,
accountFieids
}
=
config
const
[
form
]
=
Form
.
useForm
()
const
[
dateArray
,
setDateArray
]
=
useState
([])
const
[
formatterStr
,
setFormatterStr
]
=
useState
(
'YYYY-MM-DD HH:mm:ss'
)
...
...
@@ -265,7 +265,21 @@ const SearchGroup = forwardRef((props, ref) => {
<
/Button
>
),
key
:
'导出全字段数据'
,
}
},
exportTemplateName
?
{
label
:
(
<
Button
style
=
{{
width
:
'100%'
,
textAlign
:
'left'
}}
size
=
'middle'
type
=
'text'
onClick
=
{()
=>
btnsClick
({
type
:
'导出单据'
})}
icon
=
{
<
ExportOutlined
/>
}
>
导出单据
<
/Button
>
),
key
:
'导出单据'
,
}:
null
]
const
onSearch
=
e
=>
{
...
...
src/core/Account/index.js
View file @
a9c60907
This diff is collapsed.
Click to expand it.
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