Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
Y
yn-science-front
Project
Project
Details
Activity
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
徐俊
yn-science-front
Commits
6c26da42
Commit
6c26da42
authored
Feb 18, 2025
by
徐俊
Browse files
Options
Browse Files
Download
Plain Diff
xujun
parents
62e338b1
d7019964
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
337 additions
and
50 deletions
+337
-50
file.vue
src/views/manager/project/components/file.vue
+99
-0
index.vue
src/views/manager/project/index.vue
+6
-1
projectView.vue
src/views/report/project/components/projectView.vue
+19
-47
taskView.vue
src/views/report/project/components/taskView.vue
+210
-0
tmp-task.html
src/views/report/project/components/tmp-task.html
+0
-0
taskView.vue
src/views/report/task/components/taskView.vue
+3
-2
tmp-task.html
src/views/report/task/components/tmp-task.html
+0
-0
No files found.
src/views/manager/project/components/file.vue
0 → 100644
View file @
6c26da42
<
template
>
<div
class=
"upload-container"
>
<el-button
type=
"primary"
@
click=
"handleClick"
>
选择文件
</el-button>
<input
type=
"file"
ref=
"fileInput"
multiple
style=
"display: none"
@
change=
"handleFileChange"
/>
<div
class=
"file-list"
v-if=
"fileList.length"
>
<div
v-for=
"(file, index) in fileList"
:key=
"index"
class=
"file-item"
>
<span>
{{
file
.
name
}}
</span>
<span>
{{
(
file
.
size
/
1024
/
1024
).
toFixed
(
2
)
}}
MB
</span>
<el-progress
:percentage=
"file.progress || 0"
/>
</div>
</div>
</div>
</
template
>
<
script
>
export
default
{
name
:
'FileUpload'
,
data
()
{
return
{
fileList
:
[]
}
},
methods
:
{
handleClick
()
{
this
.
$refs
.
fileInput
.
click
()
},
handleFileChange
(
e
)
{
const
files
=
Array
.
from
(
e
.
target
.
files
)
this
.
fileList
=
files
.
map
(
file
=>
({
file
,
name
:
file
.
name
,
size
:
file
.
size
,
progress
:
0
}))
this
.
uploadFiles
()
},
async
uploadFiles
()
{
for
(
let
i
=
0
;
i
<
this
.
fileList
.
length
;
i
++
)
{
const
fileItem
=
this
.
fileList
[
i
]
try
{
await
this
.
uploadFile
(
fileItem
,
i
)
// 添加2秒延时,除非是最后一个文件
if
(
i
<
this
.
fileList
.
length
-
1
)
{
await
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
2000
))
}
}
catch
(
error
)
{
console
.
error
(
'上传失败:'
,
error
)
}
}
},
uploadFile
(
fileItem
,
index
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
const
formData
=
new
FormData
()
formData
.
append
(
'file'
,
fileItem
.
file
)
// 这里替换成您的实际上传API
const
xhr
=
new
XMLHttpRequest
()
xhr
.
upload
.
onprogress
=
(
event
)
=>
{
if
(
event
.
lengthComputable
)
{
this
.
$set
(
this
.
fileList
[
index
],
'progress'
,
Math
.
round
((
event
.
loaded
/
event
.
total
)
*
100
))
}
}
xhr
.
onload
=
()
=>
{
if
(
xhr
.
status
===
200
)
{
resolve
()
}
else
{
reject
(
new
Error
(
'上传失败'
))
}
}
xhr
.
onerror
=
()
=>
reject
(
new
Error
(
'上传失败'
))
// 替换成实际的上传地址
xhr
.
open
(
'POST'
,
'/api/upload'
)
xhr
.
send
(
formData
)
})
}
}
}
</
script
>
<
style
scoped
>
.upload-container
{
padding
:
20px
;
}
.file-list
{
margin-top
:
20px
;
}
.file-item
{
margin-bottom
:
10px
;
padding
:
10px
;
border
:
1px
solid
#eee
;
border-radius
:
4px
;
}
</
style
>
src/views/manager/project/index.vue
View file @
6c26da42
...
...
@@ -58,6 +58,9 @@
<a-modal
v-model=
"visibleRecord"
title=
"审核记录"
width=
"80%"
:dialog-style=
"{ top: '8%' }"
:footer=
"null"
destroyOnClose
>
<audit-record
v-model=
"id"
@
close=
"() => this.visibleRecord = false"
/>
</a-modal>
<a-modal
v-model=
"visibleFile"
title=
"文件上传"
width=
"80%"
:dialog-style=
"{ top: '8%' }"
:footer=
"null"
destroyOnClose
>
<file-edit
v-model=
"id"
@
close=
"() => this.visibleFile = false"
/>
</a-modal>
</div>
</template>
...
...
@@ -70,10 +73,11 @@ import paraSelect from '@/views/components/common/paraSelect'
import
baseSelect
from
'@/views/components/common/baseSelect'
import
projectImport
from
'@/views/manager/project/components/projectImport'
;
import
auditRecord
from
'@/views/manager/project/components/auditRecord'
;
import
fileEdit
from
'@/views/manager/project/components/file'
;
export
default
{
name
:
'managerProject'
,
components
:
{
projectView
,
projectCreate
,
paraSelect
,
baseSelect
,
projectImport
,
auditRecord
projectView
,
projectCreate
,
paraSelect
,
baseSelect
,
projectImport
,
auditRecord
,
fileEdit
},
data
()
{
return
{
...
...
@@ -99,6 +103,7 @@ export default {
id
:
null
,
visibleImport
:
false
,
visibleRecord
:
false
,
visibleFile
:
false
,
loadState
:
false
,
selectedRowKeys
:
[],
}
...
...
src/views/report/project/components/projectView.vue
View file @
6c26da42
...
...
@@ -53,8 +53,9 @@ const projectKPI = {
kpiList
:
[],
};
import
axios
from
'axios'
import
{
getType
,
getToken
}
from
'@/views/utils/auth'
import
{
budgetList
}
from
'@/views/report/project/config'
import
{
getType
}
from
'@/views/utils/auth'
import
projectInfo
from
'@/views/report/project/components/projectInfo'
import
projectInfoKey
from
"@/views/report/project/components/keyProject/projectInfo"
export
default
{
...
...
@@ -69,11 +70,11 @@ export default {
{
title
:
'项目基本信息'
,
key
:
'1'
,
isShow
:
true
},
{
title
:
'项目组主要成员'
,
key
:
'2'
,
isShow
:
true
},
{
title
:
'项目主要实施内容和目标'
,
key
:
'3'
,
isShow
:
true
},
{
title
:
'申请书正文'
,
key
:
'4'
,
isShow
:
true
},
{
title
:
'申请书正文'
,
key
:
'4'
,
isShow
:
true
},
{
title
:
'经费预算及设备明细'
,
key
:
'5'
,
isShow
:
true
},
{
title
:
'项目实施阶段及任务'
,
key
:
'6'
,
isShow
:
true
},
{
title
:
'项目课题设置'
,
key
:
'7'
,
isShow
:
true
},
{
title
:
'绩效目标表'
,
key
:
'8'
,
isShow
:
true
},
{
title
:
'绩效目标表'
,
key
:
'8'
,
isShow
:
true
},
{
title
:
'附件信息'
,
key
:
'9'
,
isShow
:
true
},
{
title
:
'项目审核记录'
,
key
:
'10'
,
isShow
:
true
},
],
...
...
@@ -147,53 +148,24 @@ export default {
}).
catch
(()
=>
{
this
.
$emit
(
'close'
,
'error'
)
})
}
},
onExport
()
{
this
.
$api
.
project
.
export
({
id
:
this
.
value
}).
then
((
res
)
=>
{
let
blob
=
new
Blob
([
res
],
{
type
:
"application/vnd.openxmlformats-officedocument.wordprocessingml.document;charset=utf-8"
,
});
const
fileName
=
this
.
formData
.
projName
+
'.doc'
;
let
downloadElement
=
document
.
createElement
(
'a'
)
let
href
=
window
.
URL
.
createObjectURL
(
blob
);
//创建下载的链接
downloadElement
.
href
=
href
;
downloadElement
.
download
=
fileName
;
//下载后文件名
document
.
body
.
appendChild
(
downloadElement
);
downloadElement
.
click
();
//点击下载
document
.
body
.
removeChild
(
downloadElement
);
//下载完成移除元素
window
.
URL
.
revokeObjectURL
(
href
);
//释放blob
})
},
onProjectExport
()
{
this
.
loading
=
true
this
.
$api
.
project
.
projectExport
({
id
:
this
.
value
},
{
responseType
:
'blob'
,
headers
:
{
'Accept'
:
'application/pdf'
}
}).
then
((
res
)
=>
{
const
contentType
=
res
.
headers
[
'content-type'
]
if
(
contentType
&&
contentType
.
includes
(
'application/pdf'
))
{
let
blob
=
new
Blob
([
res
.
data
],
{
type
:
'application/pdf'
});
const
fileName
=
this
.
formData
.
projName
+
'.pdf'
;
let
downloadElement
=
document
.
createElement
(
'a'
)
let
href
=
window
.
URL
.
createObjectURL
(
blob
);
downloadElement
.
href
=
href
;
downloadElement
.
download
=
fileName
;
document
.
body
.
appendChild
(
downloadElement
);
downloadElement
.
click
();
document
.
body
.
removeChild
(
downloadElement
);
window
.
URL
.
revokeObjectURL
(
href
);
this
.
$message
.
success
(
'导出成功'
)
}
else
{
this
.
$message
.
error
(
'导出失败:返回格式错误'
)
}
let
headers
=
{
Authorization
:
'Bearer '
+
getToken
()
}
axios
({
url
:
"/v1/science-admin/com-project/projectExport/"
+
this
.
value
,
// 替换为实际文件的URL
method
:
'GET'
,
responseType
:
"arraybuffer"
,
// 告诉axios返回的数据类型为Blob
headers
:
headers
}).
then
(
response
=>
{
const
url
=
window
.
URL
.
createObjectURL
(
new
Blob
([
response
.
data
]))
const
link
=
document
.
createElement
(
'a'
)
link
.
href
=
url
link
.
setAttribute
(
"download"
,
this
.
formData
.
projName
+
".pdf"
);
// 下载文件的名称
document
.
body
.
appendChild
(
link
)
link
.
click
()
this
.
loading
=
false
}).
catch
((
error
)
=>
{
console
.
error
(
'导出错误:'
,
error
)
this
.
$message
.
error
(
'导出失败,请稍后重试'
)
this
.
loading
=
false
})
},
callback
(
key
)
{
...
...
src/views/report/project/components/taskView.vue
0 → 100644
View file @
6c26da42
<
template
>
<div
class=
"app-content layoutEmbedded"
style=
"height: 76vh;overflow: auto;"
>
<a-spin
:spinning=
"loading"
style=
"width: 100%;height: 100%;"
>
<div
class=
"page-content"
>
<a-tabs
type=
"card"
hideAdd
size=
"small"
@
change=
"callback"
>
<a-tab-pane
:key=
"item.key"
:tab=
"item.title"
v-for=
"(item) in tabsData"
>
</a-tab-pane>
</a-tabs>
</div>
<div
class=
"page-footer"
>
<!-- 申报项目详情 -->
<a-button
type=
"primary"
@
click=
"onExport"
>
导出
</a-button>
<task-info
v-model=
"formData"
:tabsData
.
sync=
"tabsData"
/>
</div>
</a-spin>
</div>
</
template
>
<
script
>
const
projectKPI
=
{
reportYear
:
""
,
projName
:
""
,
appUnitName
:
""
,
managerDept
:
""
,
projAttribute
:
""
,
projDeadline
:
""
,
startDate
:
""
,
endData
:
""
,
yearTarget
:
""
,
year1Goal
:
""
,
year2Goal
:
""
,
year3Goal
:
""
,
totalBudget
:
0.00
,
applyFunds
:
0.00
,
selfFunds
:
0.00
,
yearTotal
:
0.00
,
yearApply
:
0.00
,
yearSelf
:
0.00
,
totalRowSpan
:
0
,
//总合并行数
outTarget
:
0
,
//一级指标(产出指标)
benefitTarget
:
0
,
//一级指标(效益指标)
satisfactionDegree
:
0
,
//一级指标(满意度指标)
quantityTarget
:
0
,
//二级指标(数量指标)
qualityTarget
:
0
,
//二级指标(质量指标)
validityTarget
:
0
,
//二级指标(时效指标)
costTarget
:
0
,
//二级指标(成本指标)
economicTarget
:
0
,
//二级指标(经济效益指标)
socialTarget
:
0
,
//二级指标(社会效益指标)
ecologicalTarget
:
0
,
//二级指标(生态效益指标)
sustainableTarget
:
0
,
//二级指标(可持续影响指标)
serviceTarget
:
0
,
//二级指标(服务对象满意度指标)
threeLevel
:
[],
kpiList
:
[],
};
import
axios
from
'axios'
import
{
getToken
,
removeToken
,
getType
}
from
'@/views/utils/auth'
import
{
budgetList
}
from
'@/views/report/project/config'
import
taskInfo
from
"@/views/report/task/components/taskInfo"
export
default
{
name
:
"projectView"
,
components
:
{
taskInfo
},
data
()
{
return
{
tabsData
:
[
{
title
:
'全部'
,
key
:
'0'
,
isShow
:
true
},
{
title
:
'项目基本信息'
,
key
:
'1'
,
isShow
:
true
},
{
title
:
'项目人员情况'
,
key
:
'2'
,
isShow
:
true
},
{
title
:
'项目主要实施内容和目标'
,
key
:
'3'
,
isShow
:
true
},
{
title
:
'申请书正文'
,
key
:
'4'
,
isShow
:
true
},
{
title
:
'经费预算及设备明细'
,
key
:
'5'
,
isShow
:
true
},
{
title
:
'项目实施阶段及任务'
,
key
:
'6'
,
isShow
:
true
},
{
title
:
'项目课题设置'
,
key
:
'7'
,
isShow
:
true
},
{
title
:
'绩效目标表'
,
key
:
'8'
,
isShow
:
true
},
{
title
:
'附件信息'
,
key
:
'9'
,
isShow
:
true
},
{
title
:
'审核记录'
,
key
:
'10'
,
isShow
:
true
},
],
formData
:
{
id
:
null
,
appPersonName
:
null
,
sex
:
null
,
birthday
:
null
,
nationName
:
null
,
degreeName
:
null
,
titleName
:
null
,
mobile
:
null
,
email
:
null
,
jobTime
:
null
,
address
:
null
,
appUnitName
:
null
,
mainResearchAreas
:
null
,
unitLinkName
:
null
,
unitLinkMobile
:
null
,
unitLinkEmail
:
null
,
unitLinkFax
:
null
,
projName
:
null
,
knowledgeId
:
null
,
subjectScope
:
null
,
projClass
:
null
,
remark
:
null
,
startDate
:
null
,
endDate
:
null
,
totalFunding
:
null
,
govFunding
:
null
,
projAbstract
:
null
,
projKeywords
:
null
,
yearTarget
:
null
,
year1Goal
:
null
,
year2Goal
:
null
,
year3Goal
:
null
,
projectKPI
:
projectKPI
,
cooperativeUnits
:
[],
members
:
[],
budget
:
[],
fundPlan
:
[],
fileList
:
[],
auditList
:
[],
managerDept
:
""
,
},
loading
:
false
,
projType
:
getType
()
};
},
props
:
{
value
:
{
type
:
String
,
default
:
()
=>
{
return
null
}
},
},
created
()
{
this
.
getTaskByProjId
()
},
methods
:
{
getTaskByProjId
()
{
if
(
this
.
value
!=
null
)
{
this
.
loading
=
true
this
.
$api
.
task
.
getTaskByProjId
({
id
:
this
.
value
}).
then
(({
data
=
{}
})
=>
{
if
(
data
)
{
this
.
formData
=
data
this
.
loading
=
false
}
else
this
.
$emit
(
'close'
,
'error'
)
}).
catch
(()
=>
{
this
.
$emit
(
'close'
,
'error'
)
})
}
},
onExport
()
{
axios
({
url
:
"/v1/science-admin/com-project-task/export/"
+
this
.
value
,
method
:
'GET'
,
responseType
:
"blob"
,
headers
:
{
Authorization
:
'Bearer '
+
getToken
(),
'Content-Type'
:
'application/pdf;charset=utf-8'
}
}).
then
(
response
=>
{
console
.
log
(
response
)
const
blob
=
new
Blob
([
response
.
data
],
{
type
:
'application/pdf'
});
const
url
=
window
.
URL
.
createObjectURL
(
blob
);
const
link
=
document
.
createElement
(
'a'
);
link
.
href
=
url
;
const
filename
=
response
.
headers
[
'content-disposition'
]
?
decodeURIComponent
(
response
.
headers
[
'content-disposition'
].
split
(
'filename='
)[
1
])
:
'项目报告.pdf'
;
link
.
setAttribute
(
"download"
,
filename
);
document
.
body
.
appendChild
(
link
);
link
.
click
();
document
.
body
.
removeChild
(
link
);
window
.
URL
.
revokeObjectURL
(
url
);
}).
catch
(
error
=>
{
console
.
error
(
'下载文件出错:'
,
error
);
this
.
$message
.
error
(
'下载文件失败'
);
});
},
callback
(
key
)
{
var
index
=
parseInt
(
key
)
this
.
tabsData
.
forEach
(
e
=>
{
if
(
key
==
'0'
)
e
.
isShow
=
true
else
e
.
isShow
=
false
})
this
.
tabsData
[
0
].
isShow
=
true
;
this
.
tabsData
[
index
].
isShow
=
true
;
},
},
}
</
script
>
<
style
scoped
lang=
"less"
>
::v-deep .ant-spin-container {
width: 100%;
height: 100%;
}
::-webkit-scrollbar {
width: 8px;
height: 6px;
}
.page-content {
width: 100%;
height: 50px;
}
.page-footer {
width: 100%;
height: calc(100% - 50px);
overflow: auto;
}
</
style
>
src/views/report/project/components/tmp-task.html
View file @
6c26da42
This diff is collapsed.
Click to expand it.
src/views/report/task/components/taskView.vue
View file @
6c26da42
...
...
@@ -53,8 +53,9 @@ const projectKPI = {
kpiList
:
[],
};
import
axios
from
'axios'
import
{
getToken
,
removeToken
,
getType
}
from
'@/views/utils/auth'
import
{
budgetList
}
from
'@/views/report/project/config'
import
{
getType
}
from
'@/views/utils/auth'
import
taskInfo
from
"@/views/report/task/components/taskInfo"
export
default
{
name
:
"projectView"
,
...
...
@@ -148,7 +149,7 @@ export default {
},
onExport
()
{
axios
({
url
:
"/v1/science-admin/com-project
/export1
/"
+
this
.
value
,
url
:
"/v1/science-admin/com-project
-task/export
/"
+
this
.
value
,
method
:
'GET'
,
responseType
:
"blob"
,
headers
:
{
...
...
src/views/report/task/components/tmp-task.html
0 → 100644
View file @
6c26da42
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