Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
data_report
/
daw
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 fcb97ad0
authored
Jul 08, 2026
by
江名洋
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: 使用动态API_BASE替换硬编码相对路径
1 parent
8b0e6616
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
4 deletions
app/templates/analysis.html
app/templates/dw.html
app/templates/ods.html
app/templates/analysis.html
View file @
fcb97ad
...
@@ -97,6 +97,7 @@
...
@@ -97,6 +97,7 @@
</main>
</main>
<script>
<script>
(
function
(){
var
p
=
window
.
location
.
pathname
;
if
(
p
.
endsWith
(
'/'
))
p
=
p
.
slice
(
0
,
-
1
);
var
i
=
p
.
lastIndexOf
(
'/'
);
window
.
API_BASE
=
p
.
substring
(
0
,
i
)
+
'/api'
;})();
document
.
addEventListener
(
'DOMContentLoaded'
,
()
=>
{
document
.
addEventListener
(
'DOMContentLoaded'
,
()
=>
{
const
fmt
=
d
=>
`
${
d
.
getFullYear
()}
-
${
String
(
d
.
getMonth
()
+
1
).
padStart
(
2
,
'0'
)}
-
${
String
(
d
.
getDate
()).
padStart
(
2
,
'0'
)}
`
;
const
fmt
=
d
=>
`
${
d
.
getFullYear
()}
-
${
String
(
d
.
getMonth
()
+
1
).
padStart
(
2
,
'0'
)}
-
${
String
(
d
.
getDate
()).
padStart
(
2
,
'0'
)}
`
;
const
now
=
new
Date
();
const
now
=
new
Date
();
...
@@ -179,7 +180,7 @@
...
@@ -179,7 +180,7 @@
if
(
hasEcology
)
uploadForm
.
append
(
'ecology_factory_file'
,
ecologyFactoryInput
.
files
[
0
]);
if
(
hasEcology
)
uploadForm
.
append
(
'ecology_factory_file'
,
ecologyFactoryInput
.
files
[
0
]);
if
(
hasNature
)
uploadForm
.
append
(
'nature_factory_file'
,
natureFactoryInput
.
files
[
0
]);
if
(
hasNature
)
uploadForm
.
append
(
'nature_factory_file'
,
natureFactoryInput
.
files
[
0
]);
const
uploadRes
=
await
fetch
(
'../api
/analysis/upload'
,
{
method
:
'POST'
,
body
:
uploadForm
});
const
uploadRes
=
await
fetch
(
window
.
API_BASE
+
'
/analysis/upload'
,
{
method
:
'POST'
,
body
:
uploadForm
});
const
uploadData
=
await
uploadRes
.
json
();
const
uploadData
=
await
uploadRes
.
json
();
if
(
uploadData
.
status
!==
'success'
)
{
if
(
uploadData
.
status
!==
'success'
)
{
throw
new
Error
(
uploadData
.
detail
||
'文件上传失败'
);
throw
new
Error
(
uploadData
.
detail
||
'文件上传失败'
);
...
...
app/templates/dw.html
View file @
fcb97ad
...
@@ -128,7 +128,7 @@
...
@@ -128,7 +128,7 @@
btn
.
disabled
=
true
;
btn
.
disabled
=
true
;
btn
.
textContent
=
'加工中...'
;
btn
.
textContent
=
'加工中...'
;
try
{
try
{
const
res
=
await
fetch
(
'../api
/etl/run-dw'
,
{
method
:
'POST'
,
body
:
formData
});
const
res
=
await
fetch
(
window
.
API_BASE
+
'
/etl/run-dw'
,
{
method
:
'POST'
,
body
:
formData
});
const
data
=
await
res
.
json
();
const
data
=
await
res
.
json
();
if
(
data
.
status
===
'success'
)
{
if
(
data
.
status
===
'success'
)
{
setTimeout
(()
=>
{
btn
.
disabled
=
false
;
btn
.
textContent
=
'开始加工'
;
},
2000
);
setTimeout
(()
=>
{
btn
.
disabled
=
false
;
btn
.
textContent
=
'开始加工'
;
},
2000
);
...
...
app/templates/ods.html
View file @
fcb97ad
...
@@ -84,7 +84,7 @@
...
@@ -84,7 +84,7 @@
document
.
addEventListener
(
'DOMContentLoaded'
,
async
()
=>
{
document
.
addEventListener
(
'DOMContentLoaded'
,
async
()
=>
{
try
{
try
{
const
res
=
await
fetch
(
'../api
/etl/scheduler-config?task_id=sync_ods_data'
);
const
res
=
await
fetch
(
window
.
API_BASE
+
'
/etl/scheduler-config?task_id=sync_ods_data'
);
const
config
=
await
res
.
json
();
const
config
=
await
res
.
json
();
document
.
getElementById
(
'conf-task-id'
).
textContent
=
config
.
task_id
||
'-'
;
document
.
getElementById
(
'conf-task-id'
).
textContent
=
config
.
task_id
||
'-'
;
document
.
getElementById
(
'conf-status'
).
textContent
=
config
.
status
||
'-'
;
document
.
getElementById
(
'conf-status'
).
textContent
=
config
.
status
||
'-'
;
...
@@ -101,7 +101,7 @@
...
@@ -101,7 +101,7 @@
btn
.
disabled
=
true
;
btn
.
disabled
=
true
;
btn
.
textContent
=
'任务已启动...'
;
btn
.
textContent
=
'任务已启动...'
;
try
{
try
{
const
res
=
await
fetch
(
'../api
/etl/run-ods'
,
{
method
:
'POST'
});
const
res
=
await
fetch
(
window
.
API_BASE
+
'
/etl/run-ods'
,
{
method
:
'POST'
});
const
data
=
await
res
.
json
();
const
data
=
await
res
.
json
();
if
(
data
.
status
===
'success'
)
{
if
(
data
.
status
===
'success'
)
{
setTimeout
(()
=>
{
btn
.
disabled
=
false
;
btn
.
textContent
=
'立即同步 ODS'
;
},
2000
);
setTimeout
(()
=>
{
btn
.
disabled
=
false
;
btn
.
textContent
=
'立即同步 ODS'
;
},
2000
);
...
...
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