Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
K
klck
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
位宇华
klck
Commits
3a7793ef
Commit
3a7793ef
authored
Aug 29, 2023
by
xiangjiaojunxp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
六矿汇总表导出文件和保存文件修改
parent
a03f1bbc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
13 deletions
+29
-13
ruoyi-ui/public/exportExcel.js
ruoyi-ui/public/exportExcel.js
+8
-3
ruoyi-ui/src/views/system/supplies/index.vue
ruoyi-ui/src/views/system/supplies/index.vue
+21
-10
No files found.
ruoyi-ui/public/exportExcel.js
View file @
3a7793ef
...
@@ -3,7 +3,7 @@ import Excel from 'exceljs';
...
@@ -3,7 +3,7 @@ import Excel from 'exceljs';
import
FileSaver
from
'
file-saver
'
;
import
FileSaver
from
'
file-saver
'
;
const
exportExcel
=
function
(
luckysheet
,
value
)
{
const
exportExcel
=
function
(
luckysheet
,
value
,
contrast
)
{
// 参数为luckysheet.getluckysheetfile()获取的对象
// 参数为luckysheet.getluckysheetfile()获取的对象
// 1.创建工作簿,可以为工作簿添加属性
// 1.创建工作簿,可以为工作簿添加属性
const
workbook
=
new
Excel
.
Workbook
();
const
workbook
=
new
Excel
.
Workbook
();
...
@@ -18,7 +18,7 @@ const exportExcel = function(luckysheet, value) {
...
@@ -18,7 +18,7 @@ const exportExcel = function(luckysheet, value) {
const
merge
=
(
table
.
config
&&
table
.
config
.
merge
)
||
{};
const
merge
=
(
table
.
config
&&
table
.
config
.
merge
)
||
{};
const
borderInfo
=
(
table
.
config
&&
table
.
config
.
borderInfo
)
||
{};
const
borderInfo
=
(
table
.
config
&&
table
.
config
.
borderInfo
)
||
{};
// 3.设置单元格合并,设置单元格边框,设置单元格样式,设置值
// 3.设置单元格合并,设置单元格边框,设置单元格样式,设置值
setStyleAndValue
(
table
.
data
,
worksheet
);
setStyleAndValue
(
table
.
data
,
worksheet
,
contrast
);
setMerge
(
merge
,
worksheet
);
setMerge
(
merge
,
worksheet
);
setBorder
(
borderInfo
,
worksheet
);
setBorder
(
borderInfo
,
worksheet
);
return
true
;
return
true
;
...
@@ -88,7 +88,7 @@ var setBorder = function(luckyBorderInfo, worksheet) {
...
@@ -88,7 +88,7 @@ var setBorder = function(luckyBorderInfo, worksheet) {
// worksheet.getCell(rang.row_focus + 1, rang.column_focus + 1).border = border
// worksheet.getCell(rang.row_focus + 1, rang.column_focus + 1).border = border
});
});
};
};
var
setStyleAndValue
=
function
(
cellArr
,
worksheet
)
{
var
setStyleAndValue
=
function
(
cellArr
,
worksheet
,
contrast
)
{
if
(
!
Array
.
isArray
(
cellArr
))
{
return
;
}
if
(
!
Array
.
isArray
(
cellArr
))
{
return
;
}
cellArr
.
forEach
(
function
(
row
,
rowid
)
{
cellArr
.
forEach
(
function
(
row
,
rowid
)
{
row
.
every
(
function
(
cell
,
columnid
)
{
row
.
every
(
function
(
cell
,
columnid
)
{
...
@@ -122,6 +122,11 @@ var setStyleAndValue = function(cellArr, worksheet) {
...
@@ -122,6 +122,11 @@ var setStyleAndValue = function(cellArr, worksheet) {
// style 填入到_value中可以实现填充色
// style 填入到_value中可以实现填充色
let
letter
=
createCellPos
(
columnid
);
let
letter
=
createCellPos
(
columnid
);
let
target
=
worksheet
.
getCell
(
letter
+
(
rowid
+
1
));
let
target
=
worksheet
.
getCell
(
letter
+
(
rowid
+
1
));
if
(
contrast
){
const
column
=
worksheet
.
getColumn
(
1
);
column
.
hidden
=
true
;
}
// console.log('1233', letter + (rowid + 1))
// console.log('1233', letter + (rowid + 1))
for
(
const
key
in
fill
)
{
for
(
const
key
in
fill
)
{
target
.
fill
=
fill
;
target
.
fill
=
fill
;
...
...
ruoyi-ui/src/views/system/supplies/index.vue
View file @
3a7793ef
...
@@ -77,6 +77,7 @@ var rule=[];
...
@@ -77,6 +77,7 @@ var rule=[];
var
tempId
;
var
tempId
;
var
roleId
;
var
roleId
;
var
uuid1
;
var
uuid1
;
var
trueORfalse
=
false
;
export
default
{
export
default
{
name
:
"
Mymodule
"
,
name
:
"
Mymodule
"
,
data
()
{
data
()
{
...
@@ -106,7 +107,6 @@ export default {
...
@@ -106,7 +107,6 @@ export default {
created
()
{
created
()
{
//刷新页面时进行的操作
//刷新页面时进行的操作
this
.
getList
();
this
.
getList
();
},
},
mounted
()
{
mounted
()
{
...
@@ -127,6 +127,11 @@ export default {
...
@@ -127,6 +127,11 @@ export default {
this
.
disableNextButton
=
this
.
selectedRule
===
''
;
this
.
disableNextButton
=
this
.
selectedRule
===
''
;
//根据选中的下拉选项值获取相应的信息
//根据选中的下拉选项值获取相应的信息
getSuppliesTemplate
(
this
.
selectedOption
).
then
(
response
=>
{
getSuppliesTemplate
(
this
.
selectedOption
).
then
(
response
=>
{
if
(
this
.
selectedOption
===
7
){
trueORfalse
=
true
;
}
else
{
trueORfalse
=
false
;
}
tempId
=
this
.
selectedOption
;
tempId
=
this
.
selectedOption
;
uuid1
=
this
.
uuid
=
uuidv4
().
substring
(
0
,
8
);
uuid1
=
this
.
uuid
=
uuidv4
().
substring
(
0
,
8
);
console
.
log
(
this
.
uuid
);
console
.
log
(
this
.
uuid
);
...
@@ -168,7 +173,15 @@ export default {
...
@@ -168,7 +173,15 @@ export default {
if
(
tempId
===
7
){
if
(
tempId
===
7
){
getSuppliesTemplate
(
7
).
then
(
response
=>
{
getSuppliesTemplate
(
7
).
then
(
response
=>
{
uuid1
=
this
.
uuid
=
uuidv4
().
substring
(
0
,
8
);
uuid1
=
this
.
uuid
=
uuidv4
().
substring
(
0
,
8
);
console
.
log
(
this
.
uuid
);
//console.log(this.uuid);
// 通过遍历this.luckyrule找到对应的iem.roleName
for
(
let
i
=
0
;
i
<
this
.
luckyrule
.
length
;
i
++
)
{
if
(
this
.
luckyrule
[
i
].
id
===
this
.
selectedRule
)
{
let
name
=
this
.
luckyrule
[
i
].
roleName
;
fileName
=
name
.
slice
(
0
,
-
2
);
break
;
}
}
const
sysSupplies
=
response
.
rows
;
const
sysSupplies
=
response
.
rows
;
this
.
luckysheetData
=
sysSupplies
[
0
].
templateContent
;
this
.
luckysheetData
=
sysSupplies
[
0
].
templateContent
;
//将接收到的json存到json_data中
//将接收到的json存到json_data中
...
@@ -206,6 +219,7 @@ export default {
...
@@ -206,6 +219,7 @@ export default {
this
.
disableNextButton
=
''
;
this
.
disableNextButton
=
''
;
this
.
selectedRule
=
''
;
this
.
selectedRule
=
''
;
this
.
luckyrule
=
[];
this
.
luckyrule
=
[];
trueORfalse
=
false
;
uuid1
=
''
;
uuid1
=
''
;
//刷新luckysheet表格
//刷新luckysheet表格
this
.
init
();
this
.
init
();
...
@@ -284,8 +298,8 @@ export default {
...
@@ -284,8 +298,8 @@ export default {
try
{
try
{
const
exportJson
=
await
cons
;
const
exportJson
=
await
cons
;
await
this
.
summary
(
exportJson
);
await
this
.
summary
(
exportJson
);
console
.
log
(
'
summary 执行完毕
'
);
//
console.log('summary 执行完毕');
//
this.submit(exportJson);
this
.
submit
(
exportJson
);
}
catch
(
Error
)
{
}
catch
(
Error
)
{
this
.
$message
({
this
.
$message
({
...
@@ -875,9 +889,6 @@ export default {
...
@@ -875,9 +889,6 @@ export default {
"
color
"
:
"
#000000
"
,
"
color
"
:
"
#000000
"
,
"
range
"
:
[{
"
range
"
:
[{
"
row
"
:
[
0
,
0
],
"
row
"
:
[
0
,
0
],
"
column
"
:
[
0
,
0
]
"
column
"
:
[
0
,
0
]
}]
}]
}
}
...
@@ -912,7 +923,7 @@ export default {
...
@@ -912,7 +923,7 @@ export default {
});*/
});*/
config
=
luckysheet
.
getConfig
(
0
);
config
=
luckysheet
.
getConfig
(
0
);
bord
.
range
[
0
].
row
=
[
rowws
+
1
,
rowws
+
1
];
bord
.
range
[
0
].
row
=
[
rowws
+
1
,
rowws
+
1
];
bord
.
range
[
0
].
column
=
[
0
,
sysRules
[
sysRules
.
length
-
1
].
ct
];
bord
.
range
[
0
].
column
=
[
0
,
parseInt
(
sysRules
[
sysRules
.
length
-
1
].
ct
)
];
config
.
borderInfo
.
push
(
bord
);
config
.
borderInfo
.
push
(
bord
);
luckysheet
.
setConfig
(
config
);
luckysheet
.
setConfig
(
config
);
}
else
{
}
else
{
...
@@ -1062,7 +1073,7 @@ export default {
...
@@ -1062,7 +1073,7 @@ export default {
this
.
from
.
templateId
=
this
.
dfrom
.
templateId
=
tempId
;
this
.
from
.
templateId
=
this
.
dfrom
.
templateId
=
tempId
;
this
.
from
.
importUuid
=
this
.
dfrom
.
importUuid
=
uuid1
;
this
.
from
.
importUuid
=
this
.
dfrom
.
importUuid
=
uuid1
;
this
.
from
.
roleId
=
this
.
dfrom
.
roleId
=
roleId
;
this
.
from
.
roleId
=
this
.
dfrom
.
roleId
=
roleId
;
this
.
dfrom
.
historyName
=
name
;
this
.
dfrom
.
historyName
=
name
+
'
(导入文件)
'
;
this
.
dfrom
.
historyContent
=
str
;
this
.
dfrom
.
historyContent
=
str
;
this
.
dfrom
.
identifyingCode
=
0
;
this
.
dfrom
.
identifyingCode
=
0
;
this
.
from
.
status
=
this
.
dfrom
.
status
=
0
;
this
.
from
.
status
=
this
.
dfrom
.
status
=
0
;
...
@@ -1085,7 +1096,7 @@ export default {
...
@@ -1085,7 +1096,7 @@ export default {
/** 导出设置 */
/** 导出设置 */
handleExport
:
debounce
(
function
()
{
handleExport
:
debounce
(
function
()
{
// 处理点击事件
// 处理点击事件
exportExcel
(
luckysheet
.
getAllSheets
(),
fileName
)
exportExcel
(
luckysheet
.
getAllSheets
(),
fileName
,
trueORfalse
)
},
500
),
// 设置延迟时间,单位为毫秒
},
500
),
// 设置延迟时间,单位为毫秒
}
}
// 配置项111
// 配置项111
...
...
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