Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZiBoYingJI
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Kimber
ZiBoYingJI
Commits
bcd6b81e
Commit
bcd6b81e
authored
Aug 02, 2024
by
xinzhedeai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
电子档案 文件夹列表、文件夹新增、上传文件、文件删除 、文件列表
parent
bb311e6e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
265 additions
and
76 deletions
+265
-76
edoc.js
src/api/kd/edoc.js
+34
-21
index.vue
src/views/edoc/index.vue
+231
-55
No files found.
src/api/kd/edoc.js
View file @
bcd6b81e
import
request
from
'
@/utils/request
'
export
default
{
// ID查询
getfileByFolderId
:
(
catalogueId
)
=>
{
return
request
({
url
:
'
api/document
'
,
method
:
'
get
'
,
params
:
{
catalogueId
}
})
},
// page查询
// 获取所有目录
getDataList
:
(
pageParam
)
=>
{
return
request
({
url
:
'
api/document-catalogue/all
'
,
...
...
@@ -17,31 +9,52 @@ export default {
params
:
pageParam
})
},
// 新增
addFileByFolderId
:
(
data
)
=>
{
// 新增目录
addFolder
:
(
data
)
=>
{
return
request
({
url
:
'
api/
video-min
e
'
,
url
:
'
api/
document-catalogu
e
'
,
method
:
'
post
'
,
data
})
},
// 修改
set
:
(
iotNormalMachine
)
=>
{
// 新增目录
delFolder
:
(
ids
)
=>
{
return
request
({
url
:
'
api/document-catalogue
'
,
method
:
'
delete
'
,
data
:
ids
})
},
// 修改文件夹名称: (iotNormalMachine) => {
updateFolder
:
(
data
)
=>
{
return
request
({
url
:
'
api/
video-min
e
'
,
url
:
'
api/
document-catalogu
e
'
,
method
:
'
put
'
,
data
:
iotNormalMachine
data
})
},
// 查看目录文件列表
getfileByFolderId
:
(
params
)
=>
{
return
request
({
url
:
'
api/document/catalogueId
'
,
method
:
'
get
'
,
params
})
},
// 新增目录-文件
addFileByFolderId
:
(
data
)
=>
{
return
request
({
url
:
'
api/document
'
,
method
:
'
post
'
,
data
})
},
// 删除
del
fileById
:
(
id
)
=>
{
del
FileById
:
(
ids
)
=>
{
return
request
({
url
:
'
api/document
'
,
method
:
'
delete
'
,
data
:
{
id
}
data
:
ids
})
},
// 根据企业查询所属矿山(含停产)enterpriseId
...
...
src/views/edoc/index.vue
View file @
bcd6b81e
...
...
@@ -29,6 +29,25 @@
<el-button
:loading=
"crud.status.cu === 2"
type=
"primary"
@
click=
"crud.submitCU"
>
确认
</el-button>
</div>
</el-dialog>
<el-dialog
title=
"文件夹"
:visible.sync=
"folderModal"
:close-on-click-modal=
"false"
width=
"500px"
>
<el-form
ref=
"folderForm"
label-width=
"120px"
:model=
"folderForm"
:rules=
"folderRules"
>
<el-form-item
label=
"名称"
prop=
"name"
>
<el-input
v-model=
"folderForm.name"
size=
"small"
clearable
placeholder=
"请输入名称"
style=
"width: 200px;"
class=
"filter-item"
/>
</el-form-item>
<el-form-item
label=
"顺序"
prop=
"order"
>
<el-input
v-model=
"folderForm.order"
size=
"small"
clearable
placeholder=
"请输入顺序"
style=
"width: 200px;"
class=
"filter-item"
/>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"folderModal = false"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"confirmFolder"
>
确定
</el-button>
</div>
</el-dialog>
<!-- 新增窗口 -->
<el-dialog
title=
"文件上传"
...
...
@@ -65,7 +84,7 @@
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"
adddialogform
= false"
>
取消
</el-button>
<el-button
@
click=
"
fileUploadModal
= false"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"confirmUploadFile"
>
确定
</el-button>
</div>
</el-dialog>
...
...
@@ -79,18 +98,36 @@
size=
"mini"
style=
"float: right; margin-left:6px;"
type=
"danger"
@
click=
"
saveMenu
"
>
@
click=
"
delFolder
"
>
删除
</el-button>
<el-button
icon=
"el-icon-plus"
size=
"mini"
style=
"float: right;"
type=
"primary"
@
click=
"updateFolder"
>
修改
</el-button>
<el-button
icon=
"el-icon-plus"
size=
"mini"
style=
"float: right;"
type=
"primary"
@
click=
"
saveMenu
"
>
新建
</el-button>
@
click=
"
addFolder
"
>
添加
</el-button>
</div>
<el-tree
ref=
"menu"
:data=
"menus"
:props=
"defaultProps"
check-strictly
accordion
show-checkbox
node-key=
"id"
@
check=
"menuChange"
@
node-click=
"menuClick"
/>
<!--
<el-tree
ref=
"menu"
lazy
:data=
"menus"
...
...
@@ -103,7 +140,7 @@
node-key=
"id"
@
check=
"menuChange"
@
node-click=
"menuClick"
/>
/>
-->
</el-card>
</el-col>
...
...
@@ -117,15 +154,15 @@
<el-input
v-model=
"query.blurry"
size=
"small"
clearable
placeholder=
"查询文件名称"
style=
"width: 200px;"
class=
"filter-item"
@
keyup.enter.native=
"crud.toQuery"
/>
<el-button
type=
"primary"
size=
"mini"
>
查询
</el-button>
</div>
<el-table
ref=
"table"
style=
"width: 100%;"
:data=
"
crud.data
"
>
<el-table
ref=
"table"
style=
"width: 100%;"
:data=
"
fileDataList
"
>
<el-table-column
type=
""
width=
"55"
/>
<el-table-column
prop=
"
n
ame"
label=
"文件名称"
/>
<el-table-column
label=
"文件分类"
prop=
"
level
"
width=
"100"
/>
<el-table-column
:show-overflow-tooltip=
"true"
width=
"200px"
prop=
"createTime"
label=
"录入时间"
/>
<el-table-column
v-if=
"checkPer(['admin','roles:edit','roles:del'])"
label=
"操作"
width=
"230px"
align=
"center"
>
<el-table-column
prop=
"
originallyN
ame"
label=
"文件名称"
/>
<el-table-column
label=
"文件分类"
prop=
"
classification
"
width=
"100"
/>
<el-table-column
width=
"200px"
prop=
"createTime"
label=
"录入时间"
/>
<el-table-column
label=
"操作"
width=
"230px"
align=
"center"
>
<template
slot-scope=
"scope"
>
<el-button
type=
"success"
size=
"mini"
>
下载
</el-button>
<el-button
type=
"danger"
size=
"mini"
>
删除
</el-button>
<el-button
type=
"success"
size=
"mini"
@
click=
"downFileById(scope.row)"
>
下载
</el-button>
<el-button
type=
"danger"
size=
"mini"
@
click=
"delFileById(scope.row)"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
...
...
@@ -147,7 +184,9 @@
<
script
>
import
crudRoles
from
'
@/api/system/role
'
import
{
getfileByFolderId
,
getFolderList
,
addFileByFolderId
,
delfileById
}
from
'
@/api/kd/edoc
'
// import edoc{ getfileByFolderId, getFolderList, addFileByFolderId, delfileById } from '@/api/kd/edoc'
import
edocApi
from
'
@/api/kd/edoc
'
import
{
getMenusTree
,
getChild
}
from
'
@/api/system/menu
'
import
CRUD
,
{
presenter
,
header
,
form
,
crud
}
from
'
@crud/crud
'
import
rrOperation
from
'
@crud/RR.operation
'
...
...
@@ -159,10 +198,11 @@
import
{
LOAD_CHILDREN_OPTIONS
}
from
'
@riophae/vue-treeselect
'
import
DateRangePicker
from
'
@/components/DateRangePicker
'
import
{
mapGetters
}
from
'
vuex
'
import
{
getToken
}
from
'
@/utils/auth
'
const
defaultForm
=
{
id
:
null
,
name
:
null
,
depts
:
[],
description
:
null
,
dataScope
:
'
全部
'
,
level
:
3
}
export
default
{
name
:
'
Role
'
,
name
:
'
Folder
'
,
components
:
{
Treeselect
,
pagination
,
crudOperation
,
rrOperation
,
udOperation
,
DateRangePicker
},
cruds
()
{
return
CRUD
({
title
:
'
角色
'
,
url
:
'
api/roles
'
,
sort
:
'
level,asc
'
,
crudMethod
:
{
...
crudRoles
}})
...
...
@@ -170,16 +210,22 @@
mixins
:
[
presenter
(),
header
(),
form
(
defaultForm
),
crud
()],
data
()
{
return
{
folderModal
:
false
,
folderForm
:
{
name
:
''
,
order
:
0
,
},
fileType
:
''
,
fileUploadModal
:
false
,
addEnterhdPics
:
[],
currentFolderId
:
''
,
currentCheckedFolderId
:
''
,
fileDataList
:
[],
totalElement
:
0
,
currentPage
:
0
,
currenetPageDegree
:
10
,
dateScopes
:
[
"
全部
"
,
"
本级及以下
"
,
"
自定义
"
,],
defaultProps
:
{
children
:
'
children
'
,
label
:
'
label
'
,
isLeaf
:
'
leaf
'
},
defaultProps
:
{
children
:
'
children
'
,
label
:
'
name
'
,
isLeaf
:
'
leaf
'
},
level
:
3
,
currentId
:
0
,
currentName
:
''
,
menuLoading
:
false
,
showButton
:
false
,
menus
:
[],
menuIds
:
[],
depts
:
[],
deptDatas
:
[],
// 多选时使用
...
...
@@ -188,52 +234,176 @@
edit
:
[
'
admin
'
,
'
roles:edit
'
],
del
:
[
'
admin
'
,
'
roles:del
'
]
},
rules
:
{
folderRules
:
{
order
:
[
{
required
:
true
,
message
:
'
请输入顺序
'
,
trigger
:
'
blur
'
}
],
name
:
[
{
required
:
true
,
message
:
'
请输入名称
'
,
trigger
:
'
blur
'
}
],
permission
:
[
{
required
:
true
,
message
:
'
请输入权限
'
,
trigger
:
'
blur
'
}
]
}
}
},
computed
:
{
},
mounted
(){
this
.
getDataList
()
// 获取所有文件夹
},
created
()
{
crudRoles
.
getLevel
().
then
(
data
=>
{
this
.
level
=
data
.
level
})
//
crudRoles.getLevel().then(data => {
//
this.level = data.level
//
})
},
methods
:
{
// 当前页的条数变化
handleSizeChange
(
val
)
{
this
.
currenetPageDegree
=
val
;
this
.
getfileByFolderId
();
},
// 当前第几页
handleCurrentChange
(
val
)
{
this
.
currentPage
=
val
;
this
.
getfileByFolderId
();
},
getDataList
(){
edocApi
.
getDataList
({
}).
then
((
res
)
=>
{
this
.
menus
=
res
.
body
})
},
confirmFolder
(){
if
(
!
this
.
currentFolderId
){
this
.
$message
.
warning
(
'
请选择文件夹
'
)
return
}
this
.
$refs
[
'
folderForm
'
].
validate
(
valid
=>
{
if
(
valid
)
{
edocApi
.
addFolder
({
...
this
.
folderForm
,
pid
:
this
.
currentFolderId
,
}).
then
((
res
)
=>
{
this
.
$message
.
success
(
'
操作成功
'
)
this
.
getDataList
()
})
}
})
},
addFolder
(){
this
.
folderModal
=
true
this
.
folderForm
=
{
name
:
''
,
order
:
''
}
},
delFolder
(){
if
(
!
this
.
currentCheckedFolderId
){
this
.
$message
.
warning
(
'
请勾选要操作的文件夹
'
)
return
}
this
.
$confirm
(
"
确定要删除吗?
"
,
"
提示
"
,
{
confirmButtonText
:
"
确定
"
,
cancelButtonText
:
"
取消
"
,
type
:
"
warning
"
,
}).
then
(
()
=>
{
edocApi
.
delFolder
([
this
.
currentCheckedFolderId
]).
then
((
res
)
=>
{
this
.
$message
.
success
(
'
操作成功
'
)
this
.
getDataList
()
})
},
()
=>
{
this
.
$message
({
type
:
"
info
"
,
message
:
"
已取消删除
"
,
});
}
);
},
downFileById
(
row
)
{
this
.
isExportLoading
=
true
;
// 导出信息
axios
.
defaults
.
headers
.
common
[
"
Authorization
"
]
=
getToken
();
axios
({
url
:
process
.
env
.
VUE_APP_BASE_API
+
"
/api/thCompany/export
"
,
responseType
:
"
blob
"
,
method
:
"
get
"
,
params
:
{
county
:
localStorage
.
getItem
(
"
county
"
)
},
}).
then
((
res
)
=>
{
console
.
log
(
res
,
"
export
"
);
let
data
=
res
.
data
;
let
dis
=
res
.
headers
[
"
content-disposition
"
];
let
url
=
URL
.
createObjectURL
(
data
);
let
fileName
=
dis
.
split
(
"
attachment;filename*=utf-8''
"
)[
1
];
this
.
down
(
url
,
fileName
);
this
.
isExportLoading
=
false
;
});
},
down
(
fileUrl
,
fileName
)
{
// 下载模板
fileName
=
decodeURIComponent
(
fileName
);
let
a
=
document
.
createElement
(
"
a
"
);
a
.
setAttribute
(
"
href
"
,
fileUrl
);
a
.
setAttribute
(
"
download
"
,
fileName
);
document
.
body
.
appendChild
(
a
);
a
.
click
();
document
.
body
.
removeChild
(
a
);
},
delFileById
(
row
){
this
.
$confirm
(
"
确定要删除吗?
"
,
"
提示
"
,
{
confirmButtonText
:
"
确定
"
,
cancelButtonText
:
"
取消
"
,
type
:
"
warning
"
,
}).
then
(
()
=>
{
edocApi
.
delFileById
([
row
.
id
]).
then
((
res
)
=>
{
this
.
$message
.
success
(
'
操作成功
'
)
this
.
getfileByFolderId
(
this
.
currentFolderId
)
})
},
()
=>
{
this
.
$message
({
type
:
"
info
"
,
message
:
"
已取消删除
"
,
});
}
);
},
updateFolder
(){
},
getfileByFolderId
(){
getfileByFolderId
({
edocApi
.
getfileByFolderId
({
catalogueId
:
this
.
currentFolderId
,
page
:
this
.
currentPage
,
size
:
currenetPageDegree
size
:
this
.
currenetPageDegree
}).
then
((
res
)
=>
{
this
.
fileDataList
=
res
.
body
.
results
this
.
totalElement
=
res
.
body
.
total
})
},
confirmUploadFile
(){
addFileByFolderId
({
fileList
:
this
.
addEnterhdPics
,
catalogueId
:
this
.
currentFolderId
,
classification
:
this
.
fileType
}).
then
((
res
)
=>
{
if
(
!
this
.
currentFolderId
){
this
.
$message
.
warning
(
'
请选择文件夹
'
)
return
}
if
(
!
this
.
addEnterhdPics
.
length
){
this
.
$message
.
warning
(
'
请上传文件
'
)
return
}
const
formData
=
new
FormData
();
// console.log(this.formInfo.hdstatus1, "haStatus");
formData
.
append
(
'
fileList
'
,
this
.
addEnterhdPics
[
0
]);
formData
.
append
(
'
catalogueId
'
,
this
.
currentFolderId
);
formData
.
append
(
'
classification
'
,
this
.
fileType
);
edocApi
.
addFileByFolderId
(
formData
).
then
((
res
)
=>
{
this
.
$message
.
success
(
'
操作成功
'
)
this
.
getfileByFolderId
()
this
.
fileUploadModal
=
false
})
},
addhdPicChange
(
event
)
{
...
...
@@ -247,7 +417,8 @@
console
.
log
(
`文件大小:
${
file
.
size
}
bytes`
);
console
.
log
(
`文件类型:
${
file
.
type
}
`
);
}
this
.
addEnterhdPics
=
this
.
$refs
[
"
addhdpic
"
].
files
;
this
.
addEnterhdPics
=
[
files
[
0
]]
},
getMenuDatas
(
node
,
resolve
)
{
setTimeout
(()
=>
{
...
...
@@ -282,35 +453,40 @@
console
.
log
(
'
menuClick
'
,
data
,
node
,
target
)
// 传递文件夹ID,获取对应文件夹下的文件数据
this
.
currentFolderId
=
data
.
id
this
.
getfileByFolderId
()
},
menuChange
(
menu
)
{
// 获取该节点的所有子节点,id 包含自身
getChild
(
menu
.
id
).
then
(
childIds
=>
{
// 判断是否在 menuIds 中,如果存在则删除,否则添加
if
(
this
.
menuIds
.
indexOf
(
menu
.
id
)
!==
-
1
)
{
for
(
let
i
=
0
;
i
<
childIds
.
length
;
i
++
)
{
const
index
=
this
.
menuIds
.
indexOf
(
childIds
[
i
])
if
(
index
!==
-
1
)
{
this
.
menuIds
.
splice
(
index
,
1
)
}
}
}
else
{
for
(
let
i
=
0
;
i
<
childIds
.
length
;
i
++
)
{
const
index
=
this
.
menuIds
.
indexOf
(
childIds
[
i
])
if
(
index
===
-
1
)
{
this
.
menuIds
.
push
(
childIds
[
i
])
}
}
}
this
.
$refs
.
menu
.
setCheckedKeys
(
this
.
menuIds
)
menuChange
(
data
,
node
,
target
)
{
console
.
log
(
'
menuChange
'
,
data
,
node
,
target
)
const
menu
=
data
this
.
currentCheckedFolderId
=
node
.
checkedKeys
.
length
?
node
.
checkedKeys
[
0
]
:
''
// // 获取该节点的所有子节点,id 包含自身
// getChild(menu.id).then(childIds => {
// // 判断是否在 menuIds 中,如果存在则删除,否则添加
// if (this.menuIds.indexOf(menu.id) !== -1) {
// for (let i = 0; i
<
childIds
.
length
;
i
++
)
{
// const index = this.menuIds.indexOf(childIds[i])
// if (index !== -1) {
// this.menuIds.splice(index, 1)
// }
// }
// } else {
// for (let i = 0; i
<
childIds
.
length
;
i
++
)
{
// const index = this.menuIds.indexOf(childIds[i])
// if (index === -1) {
// this.menuIds.push(childIds[i])
// }
// }
// }
// this.$refs.menu.setCheckedKeys(this.menuIds)
/**
* 1 勾选菜单后
*
*/
//
/**
//
* 1 勾选菜单后
//
*
//
*/
})
//
})
},
// 保存菜单
saveMenu
()
{
...
...
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