Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mes-ui
Project
Project
Details
Activity
Releases
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
周远喜
mes-ui
Commits
9a37b655
Commit
9a37b655
authored
Sep 18, 2020
by
renjintao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
components/import
parent
be94ffb4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
638 additions
and
0 deletions
+638
-0
api.js
components/page/import/api.js
+37
-0
detailExcel.vue
components/page/import/detailExcel.vue
+121
-0
process.vue
components/page/import/process.vue
+480
-0
No files found.
components/page/import/api.js
0 → 100644
View file @
9a37b655
import
Api
from
'@/plugins/request'
import
{
getJSON
}
from
'js-cookie'
;
export
default
{
index
:
`
${
systemUrl
}
/importcenter/paged`
,
paged
(
params
)
{
return
Api
.
post
(
`
${
systemUrl
}
/importcenter/paged`
,
params
);
},
get
(
params
)
{
return
Api
.
get
(
`
${
systemUrl
}
/importcenter/get`
,
params
);
},
create
(
params
)
{
return
Api
.
post
(
`
${
systemUrl
}
/importcenter/create`
,
params
);
},
update
(
params
)
{
return
Api
.
post
(
`
${
systemUrl
}
/importcenter/update`
,
params
);
},
delete
(
id
)
{
return
Api
.
delete
(
`
${
systemUrl
}
/importcenter/delete`
,
{
params
:
{
id
:
id
}
});
},
deletes
(
params
)
{
return
Api
.
post
(
`
${
systemUrl
}
/importcenter/batchdelete`
,
params
);
},
openExcel
(
params
)
{
//处理时打开以前上传的excel返回数据
return
Api
.
post
(
`
${
systemUrl
}
/importcenter/open`
,
params
);
},
importUser
(
params
)
{
//用户管理导入
return
Api
.
post
(
`
${
systemUrl
}
/userimportservice/import`
,
params
);
},
updateimportstatus
(
params
)
{
//用户管理导入
return
Api
.
post
(
`
${
systemUrl
}
/importcenter/updateimportstatus`
,
params
);
},
}
components/page/import/detailExcel.vue
0 → 100644
View file @
9a37b655
<
template
>
<div
class=
"h100"
>
<Tabs
type=
"card"
width=
"100"
>
<TabPane
label=
"excel数据"
>
<TablePaste
hide-table
:input-props=
"inputProps"
@
on-success=
"handleSuccess"
@
on-error=
"handleError"
/>
</TabPane>
<TabPane
label=
"预览"
>
<Table
:border=
"true"
:columns=
"columnsImport"
:data=
"excelData"
:height=
"tableHeight"
ref=
"tableExcel"
class=
"tableCommon"
></Table>
</TabPane>
</Tabs>
</div>
</
template
>
<
script
>
import
Api
from
"./api"
;
export
default
{
name
:
"detailExcel"
,
data
()
{
return
{
entity
:
{},
downUrl
:
fileUrlDown
,
fileUrlPath
:
""
,
excelRows
:
100
,
tableHeight
:
''
,
inputProps
:
{
rows
:
10
,
placeholder
:
"请从Excel复制一段表格数据,粘贴在这里"
,
},
columnsImport
:
[],
excelData
:
[]
};
},
props
:
{
eid
:
Number
,
},
created
()
{
this
.
excelRows
=
parseInt
((
window
.
innerHeight
-
231
)
/
21
)
+
1
;
this
.
inputProps
.
rows
=
this
.
excelRows
this
.
tableHeight
=
window
.
innerHeight
-
200
},
mounted
()
{
window
.
onresize
=
()
=>
{
///浏览器窗口大小变化
return
(()
=>
{
window
.
screenHeight
=
window
.
innerHeight
;
this
.
excelRows
=
parseInt
((
window
.
screenHeight
-
231
)
/
21
)
+
1
;
this
.
inputProps
.
rows
=
this
.
excelRows
this
.
tableHeight
=
window
.
innerHeight
-
200
})();
};
},
methods
:
{
handleClose
()
{
this
.
$emit
(
"on-close"
);
},
downFile
(
path
)
{
//alert(path)
let
truePath
=
path
;
if
(
truePath
.
length
>
2
)
{
if
(
truePath
.
substring
(
0
,
7
).
toLowerCase
()
==
"http://"
||
truePath
.
substring
(
0
,
8
).
toLowerCase
()
==
"https://"
)
{
window
.
open
(
truePath
,
"_blank"
);
}
else
{
this
.
fileUrlPath
=
this
.
downUrl
+
path
;
window
.
open
(
this
.
fileUrlPath
,
"_blank"
);
}
}
},
//粘贴excel成功
handleSuccess
(
tableData
)
{
//初始化数据
this
.
excelData
=
[];
this
.
columnsImport
=
[];
//处理colum和data
let
tabColum
=
tableData
.
columns
let
tabData
=
tableData
.
data
let
arrData
=
[]
tabData
.
forEach
(
ele
=>
{
let
objData
=
{}
tabColum
.
forEach
(
el
=>
{
objData
[
el
.
title
]
=
ele
[
el
.
key
]
})
arrData
.
push
(
objData
)
})
//处理title和key一致
tabColum
.
forEach
(
el
=>
{
el
.
key
=
el
.
title
})
this
.
columnsImport
=
tabColum
;
this
.
columnsImport
.
unshift
({
type
:
'index'
,
width
:
80
,
align
:
'right'
,
title
:
'序号'
})
this
.
excelData
=
arrData
;
this
.
$emit
(
"on-datalength"
,
this
.
excelData
.
length
)
},
//粘贴excel失败
handleError
(
tableData
,
errorIndex
)
{
//console.log(tableData, errorIndex);
this
.
$Message
.
error
(
"表格数据有误"
);
},
//粘贴excel相关end
},
watch
:
{
eid
(
v
)
{
if
(
v
>
0
)
{
this
.
load
(
v
);
}
},
},
};
</
script
>
components/page/import/process.vue
0 → 100644
View file @
9a37b655
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