|
@@ -4,6 +4,11 @@ function addProject() {
|
|
inputs.forEach((input) => {
|
|
inputs.forEach((input) => {
|
|
input.value = ''
|
|
input.value = ''
|
|
})
|
|
})
|
|
|
|
+ // 移除已存在的delete_old_data复选框
|
|
|
|
+ const existingCheckbox = document.getElementById('delete_old_data')
|
|
|
|
+ if (existingCheckbox) {
|
|
|
|
+ existingCheckbox.parentNode.remove()
|
|
|
|
+ }
|
|
const file = document.getElementById('new_project_file').parentNode
|
|
const file = document.getElementById('new_project_file').parentNode
|
|
file.innerHTML = `<label for="new_project_file">项目数据:</label><input type="file" id="new_project_file" class="form-control" accept=".xlsx,.xls,.csv" multiple>`
|
|
file.innerHTML = `<label for="new_project_file">项目数据:</label><input type="file" id="new_project_file" class="form-control" accept=".xlsx,.xls,.csv" multiple>`
|
|
|
|
|
|
@@ -22,7 +27,7 @@ function updateProject(row, id) {
|
|
existingCheckbox.parentNode.remove()
|
|
existingCheckbox.parentNode.remove()
|
|
}
|
|
}
|
|
const checkboxDiv = document.createElement('div')
|
|
const checkboxDiv = document.createElement('div')
|
|
- checkboxDiv.innerHTML = `<label for="delete_old_data">删除原数据:</label><input type="checkbox" id="delete_old_data" class="form-control" style="width: auto;">`
|
|
|
|
|
|
+ checkboxDiv.innerHTML = `<label for="delete_old_data">删除原数据:</label><input type="checkbox" id="delete_old_data" class="form-control" style="width: auto;flex: 0;">`
|
|
file.parentNode.insertBefore(checkboxDiv, file.nextSibling)
|
|
file.parentNode.insertBefore(checkboxDiv, file.nextSibling)
|
|
document.getElementById('new_work_catalog').value = row.querySelector('.work_catalog .form-control').value
|
|
document.getElementById('new_work_catalog').value = row.querySelector('.work_catalog .form-control').value
|
|
document.getElementById('new_work_content').value = row.querySelector('.work_content .form-control').value
|
|
document.getElementById('new_work_content').value = row.querySelector('.work_content .form-control').value
|
|
@@ -70,7 +75,9 @@ function saveProject() {
|
|
formData.append('work_catalog', catalog)
|
|
formData.append('work_catalog', catalog)
|
|
formData.append('work_content', content)
|
|
formData.append('work_content', content)
|
|
formData.append('standard_version', version)
|
|
formData.append('standard_version', version)
|
|
- formData.append('delete_old_data', document.getElementById('delete_old_data').checked)
|
|
|
|
|
|
+ if (document.getElementById('delete_old_data')){
|
|
|
|
+ formData.append('delete_old_data', document.getElementById('delete_old_data').checked)
|
|
|
|
+ }
|
|
|
|
|
|
fetch('/save_project', {
|
|
fetch('/save_project', {
|
|
method: 'POST',
|
|
method: 'POST',
|
|
@@ -142,51 +149,25 @@ function saveProjectUpdate(row, id) {
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
-function confirmCollectData(id) {
|
|
|
|
- if (confirm('确定要开始采集数据吗?')) {
|
|
|
|
- fetch(`/collect_project/${id}`, {
|
|
|
|
- method: 'POST',
|
|
|
|
- headers: {
|
|
|
|
- 'Content-Type': 'application/json',
|
|
|
|
- },
|
|
|
|
- })
|
|
|
|
- .then((response) => response.json())
|
|
|
|
- .then((data) => {
|
|
|
|
- if (data.success) {
|
|
|
|
- alert('操作成功')
|
|
|
|
- window.location.reload()
|
|
|
|
- } else {
|
|
|
|
- alert('采集失败:' + data.error)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- .catch((error) => {})
|
|
|
|
- }
|
|
|
|
|
|
+function confirmStartTask(id){
|
|
|
|
+ _confirm('确定要开始任务吗?',`/start_project_task/${id}`)
|
|
}
|
|
}
|
|
|
|
|
|
-function confirmProcessData(id) {
|
|
|
|
- if (confirm('确定要开始分析处理数据吗?')) {
|
|
|
|
- fetch(`/process_project/${id}`, {
|
|
|
|
- method: 'POST',
|
|
|
|
- headers: {
|
|
|
|
- 'Content-Type': 'application/json',
|
|
|
|
- },
|
|
|
|
- })
|
|
|
|
- .then((response) => response.json())
|
|
|
|
- .then((data) => {
|
|
|
|
- if (data.success) {
|
|
|
|
- alert('操作成功')
|
|
|
|
- window.location.reload()
|
|
|
|
- } else {
|
|
|
|
- alert('分析处理失败:' + data.error)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- .catch((error) => {})
|
|
|
|
- }
|
|
|
|
|
|
+function confirmReStartTask(id){
|
|
|
|
+ _confirm('确定要重新采集数据吗?',`/start_project_task/${id}`)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function confirmReProcessData(id){
|
|
|
|
+ _confirm('确定要重新处理数据吗?',`/process_project/${id}`)
|
|
}
|
|
}
|
|
|
|
|
|
function confirmSendData(id) {
|
|
function confirmSendData(id) {
|
|
- if (confirm('确定要开始上传数据吗?')) {
|
|
|
|
- fetch(`/send_project/${id}`, {
|
|
|
|
|
|
+ _confirm('确定要开始上传数据吗?',`/send_project/${id}`)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+function _confirm(text,url){
|
|
|
|
+ if (confirm(text)) {
|
|
|
|
+ fetch(url, {
|
|
method: 'POST',
|
|
method: 'POST',
|
|
headers: {
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
'Content-Type': 'application/json',
|
|
@@ -198,13 +179,14 @@ function confirmSendData(id) {
|
|
alert('操作成功')
|
|
alert('操作成功')
|
|
window.location.reload()
|
|
window.location.reload()
|
|
} else {
|
|
} else {
|
|
- alert('分析处理失败:' + data.error)
|
|
|
|
|
|
+ alert('操作失败:' + data.error)
|
|
}
|
|
}
|
|
})
|
|
})
|
|
.catch((error) => {})
|
|
.catch((error) => {})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
function confirmProjectDelete(id) {
|
|
function confirmProjectDelete(id) {
|
|
if (confirm('确定要删除该项目吗?')) {
|
|
if (confirm('确定要删除该项目吗?')) {
|
|
fetch(`/delete_project/${id}`, {
|
|
fetch(`/delete_project/${id}`, {
|