Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
template_vue
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
胡宝山
template_vue
Commits
872e65f2
Commit
872e65f2
authored
Mar 06, 2024
by
YLKCNK
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
库存导出(测试)
parent
da368512
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
119 additions
and
1 deletion
+119
-1
magnagement.js
src/api/magnagement.js
+12
-0
index.vue
src/views/equipment/inventoryManagement/index.vue
+107
-0
index.vue
src/views/system/user/index.vue
+0
-1
No files found.
src/api/magnagement.js
View file @
872e65f2
import
request
from
'@/utils/request'
/* 分页查询 */
export
function
listdevice_t
(
query
)
{
return
request
({
...
...
@@ -8,12 +9,14 @@ export function listdevice_t(query) {
params
:
query
})
}
/* 通过id查询详细 */
export
function
getDetailById_t
(
id
)
{
return
request
({
url
:
'/wbwarehouse-test/detail/'
+
id
,
method
:
'get'
})
}
/* 更新*/
export
function
updatadevice_t
(
data
)
{
return
request
({
url
:
'/wbwarehouse-test/update'
,
...
...
@@ -24,6 +27,15 @@ export function updatadevice_t(data) {
}
})
}
/* 导出库存信息*/
export
function
exportWarehouse
(
query
)
{
return
request
({
// url: '/system/user/export',
method
:
'get'
,
params
:
query
,
responseType
:
'blob'
})
}
// 查询设备列表
export
function
listdevice
(
query
)
{
return
request
({
...
...
src/views/equipment/inventoryManagement/index.vue
View file @
872e65f2
...
...
@@ -32,6 +32,19 @@
<el-button
type=
"primary"
icon=
"el-icon-search"
@
click=
"handleQuery"
>
查询
</el-button>
<el-button
icon=
"el-icon-refresh"
@
click=
"resetQuery"
>
重置
</el-button>
</el-form-item>
<el-form-item
style=
"float: right"
>
<el-button
type=
"warning"
icon=
"el-icon-upload"
@
click=
"handleImport"
>
导入
</el-button>
<el-button
type=
"success"
icon=
"el-icon-download"
@
click=
"handleExport"
>
导出
</el-button>
</el-form-item>
</el-form>
<div
class=
"placeholder"
/>
<div
style=
"padding:5px 10px"
>
...
...
@@ -178,6 +191,40 @@
<el-button
type=
"primary"
@
click=
"submitForm"
>
确 定
</el-button>
</div>
</el-dialog>
<!-- 库存导入对话框 -->
<el-dialog
:title=
"upload.title"
:visible
.
sync=
"upload.open"
width=
"400px"
append-to-body
>
<el-upload
accept=
".xlsx, .xls"
:headers=
"upload.headers"
:action=
"upload.url + '?updateSupport=' + upload.updateSupport"
:disabled=
"upload.isUploading"
:on-progress=
"handleFileUploadProgress"
:on-success=
"handleFileSuccess"
:auto-upload=
"false"
:on-change=
"employeeUpload"
:on-remove=
"handleRemove"
:before-remove=
"beforeRemove"
:on-preview=
"handlePreview"
:file-list=
"fileList"
drag
>
<i
class=
"el-icon-upload"
/>
<div
class=
"el-upload__text"
>
将文件拖到此处,或
<em>
点击上传
</em>
</div>
<div
slot=
"tip"
class=
"el-upload__tip"
>
<el-checkbox
v-model=
"upload.updateSupport"
/>
是否更新已经存在的用户数据
<el-link
type=
"info"
style=
"font-size:12px"
@
click=
"importTemplate"
>
下载模板
</el-link>
</div>
<div
slot=
"tip"
class=
"el-upload__tip"
style=
"color:red"
>
提示:仅允许导入“xls”或“xlsx”格式文件!
</div>
</el-upload>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"upload.open = false"
>
取 消
</el-button>
<el-button
:loading=
"importLoading"
type=
"primary"
@
click=
"submitFileForm"
>
确 定
</el-button>
</div>
</el-dialog>
</div>
</template>
...
...
@@ -185,6 +232,8 @@
import
{
listdevice_t
,
getDetailById_t
,
updatadevice_t
}
from
'@/api/magnagement'
import
{
resetForm
}
from
'@/utils/common'
import
{
getToken
}
from
'@/utils/auth'
export
default
{
data
()
{
return
{
...
...
@@ -232,6 +281,22 @@ export default {
openDetails
:
false
,
// 是否显示弹出层(修改)
open
:
false
,
// 用户导入参数
upload
:
{
// 是否显示弹出层(库存导入)
open
:
false
,
// 弹出层标题(库存导入)
title
:
''
,
// 是否禁用上传
isUploading
:
false
,
// 是否更新已经存在的库存数据
updateSupport
:
0
,
// 设置上传的请求头部
headers
:
{
Authorization
:
'Bearer '
+
getToken
()
},
// 上传的地址
url
:
process
.
env
.
VUE_APP_BASE_API
+
'导入接口'
},
// 表单校验
rules
:
{
pn
:
[
...
...
@@ -345,6 +410,48 @@ export default {
// 校验失败,显示错误信息或进行其他操作
}
})
},
/** 导出按钮操作 */
handleExport
()
{
const
queryParams
=
this
.
queryParams
this
.
$confirm
(
'是否确认导出所有库存信息?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(
function
()
{
console
.
log
(
'导出'
,
queryParams
)
// return exportUser(queryParams).then(response => {
// const blob = new Blob([response])
// const downloadElement = document.createElement('a')
// const href = window.URL.createObjectURL(blob)// 创建下载的链接
// downloadElement.href = href
// downloadElement.download = '用户信息' + '.xls' // 下载后文件名
// document.body.appendChild(downloadElement)
// downloadElement.click()// 点击下载
// document.body.removeChild(downloadElement)// 下载完成移除元素
// window.URL.revokeObjectURL(href)// 释放掉blob对象
// // this.download(response.msg);
// })
})
},
/** 导入按钮操作 */
handleImport
()
{
this
.
upload
.
title
=
'库存信息导入'
this
.
upload
.
open
=
true
},
// 文件上传中处理
handleFileUploadProgress
(
event
,
file
,
fileList
)
{
this
.
upload
.
isUploading
=
true
},
// 文件上传成功处理
handleFileSuccess
(
response
,
file
,
fileList
)
{
this
.
upload
.
open
=
false
this
.
upload
.
isUploading
=
false
this
.
$refs
.
upload
.
clearFiles
()
this
.
$alert
(
response
.
msg
,
'导入结果'
,
{
dangerouslyUseHTMLString
:
true
})
this
.
getList
()
}
}
...
...
src/views/system/user/index.vue
View file @
872e65f2
...
...
@@ -840,7 +840,6 @@ export default {
downloadElement
.
click
()
// 点击下载
document
.
body
.
removeChild
(
downloadElement
)
// 下载完成移除元素
window
.
URL
.
revokeObjectURL
(
href
)
// 释放掉blob对象
// this.download(response.msg);
})
})
},
...
...
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