Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
web-project
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
紫光云
web-project
Commits
d0b86e83
Commit
d0b86e83
authored
Jul 05, 2024
by
高滢
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(项目): 导入
parent
8e0179fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
22 deletions
+62
-22
project.ts
src/api/project/project.ts
+3
-0
index.vue
src/views/project/index.vue
+59
-22
No files found.
src/api/project/project.ts
View file @
d0b86e83
...
...
@@ -73,3 +73,6 @@ export const downImportT = (params?: any) =>
},
{
errorMessageMode
:
'none'
,
isTransformResponse
:
false
},
);
export
const
exportTemplate
=
(
params
?:
any
)
=>
defHttp
.
post
<
ProjectModel
>
({
url
:
Api
.
importDetails
,
params
});
src/views/project/index.vue
View file @
d0b86e83
...
...
@@ -53,7 +53,21 @@
<template
#
toolbar
>
<a-button
type=
"primary"
preIcon=
"mdi:plus"
@
click=
"handleCreate"
>
新增项目
</a-button>
<a-button
type=
"primary"
@
click=
"downloadTemplate"
>
下载模板
</a-button>
<a-button
type=
"primary"
@
click=
"exportProjectData"
>
导入数据
</a-button>
<a-button
type=
"primary"
@
click=
"exportTemplate"
>
导入数据
</a-button>
<BasicUpload
:maxSize=
"20"
:maxNumber=
"1"
@
change=
"handleChange"
:accept=
"['.xlsx','docx']"
:api=
"uploadApi"
name=
"multipartFile"
:value=
"fileList"
/>
<Upload
:action=
"uploadAction"
v-model:file-list=
"fileList"
name=
"file"
:multiple=
"false"
methods=
"post"
@
change=
"uploadFile"
>
<Button>
<upload-outlined></upload-outlined>
导入文件
</Button>
</Upload>
</
template
>
<
template
#
bodyCell=
"{ column, record }"
>
<template
v-if=
"column.key === 'projectName'"
>
...
...
@@ -90,24 +104,29 @@
</
template
>
</template>
</BasicTable>
<projectDrawer
@
register=
"registerDrawer"
@
success=
"handleSuccess"
/>
<upload
Modal
@
register=
"registerModal"
/>
<projectDrawer
@
register=
"registerDrawer"
@
success=
"handleSuccess"
/>
<upload
ContractModal
@
register=
"registerModal2"
/>
</div>
</template>
<
script
lang=
"ts"
setup
>
import
{
Tag
}
from
'ant-design-vue'
;
import
{
uploadApi
}
from
'@/api/sys/upload'
;
import
uploadContractModal
from
'./uploadContractModal.vue'
;
import
{
useModal
}
from
'@/components/Modal'
;
import
{
Tag
,
Row
,
Col
,
Upload
,
Button
}
from
'ant-design-vue'
;
import
{
BasicTable
,
useTable
,
TableAction
}
from
'@/components/Table'
;
import
{
getListByPage
,
deleteItem
,
getProjectCount
,
downImportT
}
from
'@/api/project/project'
;
import
{
getListByPage
,
deleteItem
,
getProjectCount
,
downImportT
}
from
'@/api/project/project'
;
import
{
columns
,
searchFormSchema
}
from
'./project.data'
;
import
{
Row
,
Col
}
from
'ant-design-vue'
;
import
projectDrawer
from
'./projectDrawer.vue'
;
import
{
useDrawer
}
from
'@/components/Drawer'
;
import
{
useModal
}
from
"@/components/Modal"
;
import
{
BasicUpload
}
from
'@/components/Upload'
;
import
{
useRouter
}
from
'vue-router'
;
import
{
onMounted
,
ref
,
computed
}
from
'vue'
;
import
{
downloadByData
}
from
'@/utils/file/download'
;
const
env
=
import
.
meta
.
env
.
MODE
;
const
uploadAction
=
"https://dev.unitj.cn/api/system/file/add"
const
[
registerModal2
,
{
openModal
:
openModal2
}]
=
useModal
();
const
{
push
}
=
useRouter
();
import
{
onMounted
,
ref
}
from
'vue'
;
import
{
downloadByData
}
from
"@/utils/file/download"
;
const
[
registerModal
,
{
openModal
:
openModal
}]
=
useModal
();
const
fileList
=
ref
([]);
const
countData
=
ref
({});
const
[
registerDrawer
,
{
openDrawer
}]
=
useDrawer
();
const
prefixCls
=
'list-basic'
;
...
...
@@ -130,19 +149,12 @@
fixed
:
undefined
,
},
});
function
downloadTemplate
(){
downImportT
().
then
((
data
)
=>
{
downloadByData
(
data
,
"项目库导入模板.xlsx"
);
})
function
downloadTemplate
()
{
downImportT
().
then
((
data
)
=>
{
downloadByData
(
data
,
'项目库导入模板.xlsx'
);
});
}
function
exportProjectData
(){
openModal
(
true
)
}
function
handleChange
(
file
){
console
.
log
(
'112'
,
file
)
}
function
handleCreate
()
{
openDrawer
(
true
,
{
isUpdate
:
false
,
...
...
@@ -181,8 +193,33 @@
let
res
=
await
getProjectCount
();
console
.
log
(
res
);
countData
.
value
=
res
;
});
console
.
log
(
'12132'
,
uploadAction
)
})
function
exportTemplate
(){
openModal2
(
true
);
};
function
handleChange
(
file
){
console
.
log
(
'21212'
,
file
)
};
function
uploadFile
(
info
)
{
console
.
log
(
'上传文件'
,
info
)
// ant design 框架中此回调会运行三次,上传中、完成、失败都会调用这个函数。
const
fileList
=
[...
info
.
fileList
]
this
.
fileList
=
fileList
.
slice
(
-
1
)
if
(
info
.
file
.
status
===
'uploading'
)
{
this
.
$loading
.
show
()
return
}
if
(
info
.
file
.
status
===
'done'
)
{
// 上传成功 可以在下面写自己也业务逻辑了
this
.
$loading
.
hide
()
}
};
</
script
>
<
style
lang=
"less"
scoped
>
.list-basic {
...
...
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