同步现场电网一张图代码代码

This commit is contained in:
GGJ
2024-05-22 16:54:54 +08:00
parent 42f8f36547
commit 7768bb3e67
14 changed files with 1185 additions and 627 deletions

View File

@@ -83,7 +83,7 @@
></el-input>
</div> -->
<template #footer v-if="title != '查看计划'">
<div class="dialog-footer ">
<div class="dialog-footer">
<el-button type="primary" @click="submitFn">提交</el-button>
<el-button @click="cancelFn">取消</el-button>
</div>
@@ -139,28 +139,20 @@ const submitFn = () => {
if (valid) {
let filePath = ''
formdata.value.subIds = treeRef.value.treeRef.getCheckedKeys(false)
for (let i = 0; i < formdata.value.fileList.length; i++) {
if (formdata.value.fileList[i].raw) {
await uploadFile(formdata.value.fileList[i].raw, 'supervision/').then(res => {
filePath = filePath + res.data.name + ','
})
} else {
filePath = filePath + formdata.value.fileList[i].supervision + ','
}
if (formdata.value.fileList.length == 0) {
audit(filePath)
} else {
for (let i = 0; i < formdata.value.fileList.length; i++) {
if (formdata.value.fileList[i].raw) {
await uploadFile(formdata.value.fileList[i].raw, 'supervision/').then(res => {
filePath = filePath + res.data.name + ','
})
} else {
filePath = filePath + formdata.value.fileList[i].supervision + ','
}
if (i == formdata.value.fileList.length - 1) {
if (title.value == '普测计划新增') {
await addSurvey({ ...formdata.value, filePath: filePath }).then((res: any) => {
ElMessage.success('新增成功!')
cancelFn()
emit('onsubmit')
})
} else if (title.value == '重新发起计划') {
await auditSurvey({ ...formdata.value, filePath: filePath }).then((res: any) => {
ElMessage.success('重新发起计划成功!')
cancelFn()
emit('onsubmit')
})
if (i == formdata.value.fileList.length - 1) {
audit(filePath)
}
}
}
@@ -168,6 +160,21 @@ const submitFn = () => {
})
}
const audit = (filePath: any) => {
if (title.value == '普测计划新增') {
addSurvey({ ...formdata.value, filePath: filePath }).then((res: any) => {
ElMessage.success('新增成功!')
cancelFn()
emit('onsubmit')
})
} else if (title.value == '重新发起计划') {
auditSurvey({ ...formdata.value, filePath: filePath }).then((res: any) => {
ElMessage.success('重新发起计划成功!')
cancelFn()
emit('onsubmit')
})
}
}
// 上传文件
// 文件数超出提示
const handleExceed: UploadProps['onExceed'] = (): void => {