Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx-business
/
develop-platform
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a81c8954
authored
Jan 04, 2021
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
设备管理-导入,字段修改
1 parent
7e06632e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
164 additions
and
10 deletions
src/router/routes.js
src/views/device/device.vue
src/router/routes.js
View file @
a81c895
...
@@ -69,15 +69,18 @@ export const resources = {
...
@@ -69,15 +69,18 @@ export const resources = {
parentId
:
'0'
,
parentId
:
'0'
,
cache
:
true
cache
:
true
},
},
auth
:
[
auth
:
[{
{
authId
:
'10201'
,
authId
:
'10201'
,
parentId
:
'102'
,
parentId
:
'102'
,
label
:
'重置密码'
,
label
:
'重置密码'
,
handle
:
'handleResetPassword'
,
handle
:
'handleResetPassword'
,
ruleObj
:
{
ruleObj
:
{
attr
:
'status'
,
attr
:
'status'
,
rule
:
{
0
:
'重置密码'
,
1
:
'重置密码'
,
2
:
''
}
rule
:
{
0
:
'重置密码'
,
1
:
'重置密码'
,
2
:
''
}
}
}
},
{
},
{
authId
:
'10202'
,
authId
:
'10202'
,
...
@@ -86,7 +89,11 @@ export const resources = {
...
@@ -86,7 +89,11 @@ export const resources = {
handle
:
'handleUpOrDown'
,
handle
:
'handleUpOrDown'
,
ruleObj
:
{
ruleObj
:
{
attr
:
'status'
,
attr
:
'status'
,
rule
:
{
0
:
'启用'
,
1
:
'停用'
,
2
:
''
}
rule
:
{
0
:
'启用'
,
1
:
'停用'
,
2
:
''
}
}
}
},
{
},
{
authId
:
'10203'
,
authId
:
'10203'
,
...
@@ -95,10 +102,13 @@ export const resources = {
...
@@ -95,10 +102,13 @@ export const resources = {
handle
:
'handleExamine'
,
handle
:
'handleExamine'
,
ruleObj
:
{
ruleObj
:
{
attr
:
'status'
,
attr
:
'status'
,
rule
:
{
0
:
''
,
1
:
''
,
2
:
'审核通过'
}
rule
:
{
0
:
''
,
1
:
''
,
2
:
'审核通过'
}
}
}
}
],
}
],
component
:
_import
(
'customer/customer'
)
component
:
_import
(
'customer/customer'
)
},
},
'103'
:
{
'103'
:
{
...
@@ -111,6 +121,13 @@ export const resources = {
...
@@ -111,6 +121,13 @@ export const resources = {
parentId
:
'0'
,
parentId
:
'0'
,
cache
:
true
cache
:
true
},
},
auth
:
[{
authId
:
'10301'
,
parentId
:
'103'
,
label
:
'导出'
,
category
:
'Button'
,
handle
:
'handleImport'
}],
component
:
_import
(
'device/device'
)
component
:
_import
(
'device/device'
)
}
}
// '104': {
// '104': {
...
...
src/views/device/device.vue
View file @
a81c895
<!-- 设备管理 -->
<!-- 设备管理 -->
<
template
>
<
template
>
<d2-container>
<d2-container
class=
"device-list"
>
<el-form
<el-form
slot=
"header"
slot=
"header"
inline=
"true"
inline=
"true"
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
></el-option>
></el-option>
</el-select>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item
label=
"
发货
时间:"
>
<el-form-item
label=
"
导入
时间:"
>
<el-date-picker
<el-date-picker
v-model=
"createTime"
v-model=
"createTime"
:size=
"$store.state.d2admin.size.value"
:size=
"$store.state.d2admin.size.value"
...
@@ -64,12 +64,65 @@
...
@@ -64,12 +64,65 @@
>
重置
</el-button>
>
重置
</el-button>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
<d2-table-header
title=
"设备列表"
>
<auth-button
category=
"Button"
></auth-button>
</d2-table-header>
<d2-table
<d2-table
:beforeSearchFn=
"beforeSearchFn"
:beforeSearchFn=
"beforeSearchFn"
:searchForm=
"searchForm"
:searchForm=
"searchForm"
:tableParams=
"tableParams"
:tableParams=
"tableParams"
:getListApi=
"getListApi"
:getListApi=
"getListApi"
></d2-table>
></d2-table>
<d2-dialog
:title=
"'导入'"
:isVisible=
"fileVisible"
@
closeDialog=
"handleImport"
@
confirmDialog=
"handleConfirmImport"
>
<slot>
<el-form
:model=
"fileForm"
ref=
"fileRuleForm"
:rules=
"fileRules"
label-width=
"120px"
>
<el-form-item
label=
"导入文件:"
prop=
"fileName"
>
<el-col
:span=
"16"
>
<el-input
readonly
v-model=
"fileForm.fileName"
></el-input>
</el-col>
<el-col
:span=
"4"
class=
"m-l-md"
>
<el-button
class=
"import-btn"
>
导入文件
<input
type=
"file"
id=
"fileUpload"
class=
"import-input"
accept=
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
@
change=
"importFile($event)"
/>
<el-link
href=
"http://img01.glsx.com.cn/upload/salesexcel/预录订单导入模板.xlsx"
type=
"primary"
class=
"import-template"
icon=
"el-icon-link"
>
模版下载
</el-link>
</el-button>
</el-col>
</el-form-item>
<el-form-item
v-show=
"showNum"
>
<span>
导入成功
{{
importNum
.
succNum
}}
条,导入失败
{{
importNum
.
failNum
}}
条
</span>
</el-form-item>
</el-form>
</slot>
</d2-dialog>
</d2-container>
</d2-container>
</
template
>
</
template
>
...
@@ -81,6 +134,19 @@ export default {
...
@@ -81,6 +134,19 @@ export default {
data
()
{
data
()
{
return
{
return
{
rangePickerOptions
:
rangePickerOptions
,
rangePickerOptions
:
rangePickerOptions
,
fileVisible
:
false
,
fileForm
:
{
sellerUserId
:
''
},
total
:
0
,
showNum
:
false
,
importNum
:
{
succNum
:
0
,
failNum
:
0
},
fileRules
:
{
fileName
:
[{
required
:
true
,
message
:
'请上传文件'
,
trigger
:
'change'
}]
},
searchForm
:
{
searchForm
:
{
customerName
:
''
customerName
:
''
},
},
...
@@ -103,7 +169,7 @@ export default {
...
@@ -103,7 +169,7 @@ export default {
label
:
'客户'
,
label
:
'客户'
,
prop
:
'customerName'
prop
:
'customerName'
},
{
},
{
label
:
'
发货
时间'
,
label
:
'
导入
时间'
,
prop
:
'createTime'
,
prop
:
'createTime'
,
formatter
:
(
cellValue
)
=>
{
formatter
:
(
cellValue
)
=>
{
return
cellValue
.
createTime
.
split
(
' '
)[
0
]
return
cellValue
.
createTime
.
split
(
' '
)[
0
]
...
@@ -139,6 +205,58 @@ export default {
...
@@ -139,6 +205,58 @@ export default {
resolve
()
resolve
()
})
})
},
},
handleImport
()
{
this
.
fileForm
=
{
fileName
:
''
}
this
.
showNum
=
false
this
.
importNum
=
{
succNum
:
0
,
failNum
:
0
}
this
.
$refs
.
fileRuleForm
&&
this
.
$refs
.
fileRuleForm
.
resetFields
()
this
.
fileVisible
=
!
this
.
fileVisible
},
// 上传文件,转码为base64
importFile
(
e
)
{
const
size
=
e
.
target
.
files
[
0
].
size
/
1024
/
1024
if
(
size
<
9
)
{
this
.
$set
(
this
.
fileForm
,
'fileName'
,
e
.
target
.
files
[
0
].
name
)
// // 转码base64
const
reader
=
new
FileReader
()
reader
.
readAsDataURL
(
e
.
target
.
files
[
0
])
reader
.
onload
=
event
=>
{
const
imgFile
=
event
.
target
.
result
const
arrBase64
=
imgFile
.
split
(
','
)
this
.
fileInfo
=
e
.
target
.
files
[
0
].
name
.
split
(
'.'
)[
1
]
+
'@'
+
arrBase64
[
1
]
document
.
getElementById
(
'fileUpload'
).
value
=
''
}
}
else
{
this
.
notice
.
errorTips
(
'上传文件不可超过9M'
)
}
},
handleConfirmImport
()
{
this
.
$refs
.
fileRuleForm
.
validate
(
valid
=>
{
console
.
log
(
valid
)
if
(
valid
)
{
this
.
notice
.
okTips
()
this
.
handleImport
()
// recordUpload(params).then(res => {
// this.showNum = !!res.failNum
// if (res.failNum) {
// this.importNum = {
// succNum: res.succNum,
// failNum: res.failNum
// }
// this.exportFailList(res.errorList)
// return true
// }
// this.notice.okTips('导入成功')
// this.$refs.recordTable.refreshTable()
// })
}
})
},
handleRest
()
{
handleRest
()
{
this
.
createTime
=
[]
this
.
createTime
=
[]
this
.
searchForm
=
{
this
.
searchForm
=
{
...
@@ -155,5 +273,24 @@ export default {
...
@@ -155,5 +273,24 @@ export default {
}
}
</
script
>
</
script
>
<
style
scoped
>
<
style
>
.device-list
.import-btn
{
position
:
relative
;
}
.device-list
.import-input
{
opacity
:
0
;
position
:
absolute
;
right
:
0
;
top
:
0
;
width
:
98px
;
height
:
36px
;
cursor
:
pointer
;
font-size
:
0
;
}
.device-list
.import-template
{
position
:
absolute
;
height
:
20px
;
top
:
50px
;
left
:
0
;
}
</
style
>
</
style
>
Write
Preview
Markdown
is supported
Attach a file
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 post a comment