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
ac230c33
Commit
ac230c33
authored
Aug 29, 2023
by
xiangjiaojunxp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
物料转换数据添加和导出修改
parent
c17d93aa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
21 deletions
+92
-21
ruoyi-ui/public/exportExcel.js
ruoyi-ui/public/exportExcel.js
+2
-0
ruoyi-ui/src/views/system/supplies/index.vue
ruoyi-ui/src/views/system/supplies/index.vue
+90
-21
No files found.
ruoyi-ui/public/exportExcel.js
View file @
ac230c33
...
...
@@ -125,7 +125,9 @@ var setStyleAndValue = function(cellArr, worksheet,contrast) {
if
(
contrast
){
const
column
=
worksheet
.
getColumn
(
1
);
const
column2
=
worksheet
.
getColumn
(
2
);
column
.
hidden
=
true
;
column2
.
hidden
=
true
;
}
// console.log('1233', letter + (rowid + 1))
for
(
const
key
in
fill
)
{
...
...
ruoyi-ui/src/views/system/supplies/index.vue
View file @
ac230c33
...
...
@@ -78,6 +78,7 @@ var tempId;
var
roleId
;
var
uuid1
;
var
trueORfalse
=
false
;
var
modify
=
false
;
export
default
{
name
:
"
Mymodule
"
,
data
()
{
...
...
@@ -132,6 +133,7 @@ export default {
}
else
{
trueORfalse
=
false
;
}
modify
=
false
;
tempId
=
this
.
selectedOption
;
uuid1
=
this
.
uuid
=
uuidv4
().
substring
(
0
,
8
);
console
.
log
(
this
.
uuid
);
...
...
@@ -182,10 +184,9 @@ export default {
break
;
}
}
modify
=
false
;
const
sysSupplies
=
response
.
rows
;
this
.
luckysheetData
=
sysSupplies
[
0
].
templateContent
;
//将接收到的json存到json_data中
//const json_data = response.data;
let
json_data
=
JSON
.
parse
(
sysSupplies
[
0
].
templateContent
);
//luckysheet.destroy()
luckysheet
.
create
({
...
...
@@ -220,6 +221,7 @@ export default {
this
.
selectedRule
=
''
;
this
.
luckyrule
=
[];
trueORfalse
=
false
;
modify
=
false
;
uuid1
=
''
;
//刷新luckysheet表格
this
.
init
();
...
...
@@ -286,31 +288,87 @@ export default {
},
/** 导入事件*/
async
handleFileChange
(
evt
)
{
let
exx
;
this
.
showMask
=
true
;
const
cons
=
new
Promise
((
resolve
,
reject
)
=>
{
LuckyExcel
.
transformExcelToLucky
(
evt
,
exportJson
=>
{
exx
=
exportJson
;
resolve
(
exx
);
});
});
if
(
modify
){
this
.
$confirm
(
'
再次导入将会清空表内数据,是否继续操作?
'
,
'
注意!!!
'
,
{
confirmButtonText
:
'
确定
'
,
cancelButtonText
:
'
取消
'
,
type
:
'
warning
'
}).
then
(
async
()
=>
{
// 确认继续后刷新页面返回模板
getSuppliesTemplate
(
7
).
then
(
response
=>
{
const
sysSupplies
=
response
.
rows
;
this
.
luckysheetData
=
sysSupplies
[
0
].
templateContent
;
let
json_data
=
JSON
.
parse
(
sysSupplies
[
0
].
templateContent
);
//luckysheet.destroy()
luckysheet
.
create
({
container
:
"
luckysheet
"
,
// Luckysheet 的容器元素 ID
title
:
fileName
,
// Excel 文件名
data
:
json_data
,
// Excel 数据
showinfobar
:
false
,
//是否显示顶部名称栏
lang
:
'
zh
'
,
});
modify
=
false
;
}).
then
(
async
()
=>
{
//将导入数据替换保存
let
exx
;
this
.
showMask
=
true
;
const
cons
=
new
Promise
((
resolve
,
reject
)
=>
{
LuckyExcel
.
transformExcelToLucky
(
evt
,
exportJson
=>
{
exx
=
exportJson
;
resolve
(
exx
);
});
});
try
{
const
exportJson
=
await
cons
;
await
this
.
summary
(
exportJson
);
//console.log('summary 执行完毕');
//this.submit(exportJson);
}
catch
(
Error
)
{
this
.
$message
({
message
:
Error
.
message
,
type
:
"
error
"
});
console
.
log
(
Error
.
message
);
console
.
log
(
"
这里是最外面的地方
"
);
}
finally
{
// 导入完成后关闭遮罩层
this
.
showMask
=
false
;
}
try
{
const
exportJson
=
await
cons
;
await
this
.
summary
(
exportJson
);
//console.log('summary 执行完毕');
this
.
submit
(
exportJson
);
}).
catch
(()
=>
{
// 处理错误逻辑,这里是一个空的错误处理函数
this
.
$message
.
error
(
'
查询失败,模板未找到,请联系管理员进行处理!
'
);
});
}).
catch
(()
=>
{
// 用户点击了取消按钮
//this.$message({type: 'info', message: '操作已取消'});
});
}
else
{
let
exx
;
this
.
showMask
=
true
;
const
cons
=
new
Promise
((
resolve
,
reject
)
=>
{
LuckyExcel
.
transformExcelToLucky
(
evt
,
exportJson
=>
{
exx
=
exportJson
;
resolve
(
exx
);
});
});
try
{
const
exportJson
=
await
cons
;
await
this
.
summary
(
exportJson
);
//console.log('summary 执行完毕');
//this.submit(exportJson);
}
catch
(
Error
)
{
}
catch
(
Error
)
{
this
.
$message
({
message
:
Error
.
message
,
type
:
"
error
"
});
console
.
log
(
Error
.
message
);
console
.
log
(
"
这里是最外面的地方
"
);
}
finally
{
// 导入完成后关闭遮罩层
this
.
showMask
=
false
;
console
.
log
(
Error
.
message
);
console
.
log
(
"
这里是最外面的地方
"
);
}
finally
{
// 导入完成后关闭遮罩层
this
.
showMask
=
false
;}
}
},
/** 物料转换汇总到页面*/
summary
(
exportJson
){
...
...
@@ -900,6 +958,16 @@ export default {
if
(
searchResult
.
length
!=
0
&&
key
!=
null
)
{
rowws
=
searchResult
[
0
].
row
;
luckysheet
.
insertRow
(
rowws
+
1
);
let
vll1
=
luckysheet
.
getCellValue
(
rowws
,
sysRulez
[
0
].
ct
);
luckysheet
.
setCellValue
(
rowws
+
1
,
sysRulez
[
0
].
ct
,
{
"
ct
"
:
{
"
fa
"
:
"
@
"
,
"
t
"
:
"
n
"
}
});
luckysheet
.
setCellValue
(
rowws
+
1
,
sysRulez
[
0
].
ct
,
vll1
);
let
vll2
=
luckysheet
.
getCellValue
(
rowws
,
parseInt
(
sysRulez
[
0
].
ct
)
+
1
);
luckysheet
.
setCellValue
(
rowws
+
1
,
parseInt
(
sysRulez
[
0
].
ct
)
+
1
,
vll2
);
//输出部门数量金额
luckysheet
.
setCellValue
(
rowws
+
1
,
sysRulez
[
1
].
ct
,
depp
);
for
(
let
i
=
0
;
i
<
sysRules
.
length
;
i
++
)
{
...
...
@@ -926,6 +994,7 @@ export default {
bord
.
range
[
0
].
column
=
[
0
,
parseInt
(
sysRules
[
sysRules
.
length
-
1
].
ct
)];
config
.
borderInfo
.
push
(
bord
);
luckysheet
.
setConfig
(
config
);
modify
=
true
;
}
else
{
warn
++
;
}
...
...
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