ADD: 报告生成选择检测数据源并更新监测点结果。

This commit is contained in:
贾同学
2025-09-15 10:38:14 +08:00
parent b27615baaf
commit 09b54a29ab
3 changed files with 13 additions and 9 deletions

View File

@@ -2,4 +2,6 @@ import http from '@/api'
export const getMonitorResult = (devId: string) => http.post(`/result/getMonitorResult?devId=${devId}`)
export const getMonitorDataSourceResult = (monitorId: string) =>
http.get(`/result/getMonitorDataSourceResult?monitorId=${monitorId}`)
http.get(`/result/getMonitorDataSourceResult?monitorId=${monitorId}`)
export const updateMonitorResult = (data: any) => http.post('/result/updateMonitorResult', data)

View File

@@ -104,7 +104,7 @@
</el-dialog>
</template>
<script setup lang="ts" name="reportPopup">
import { getMonitorDataSourceResult, getMonitorResult } from '@/api/result/result'
import { getMonitorDataSourceResult, getMonitorResult, updateMonitorResult } from '@/api/result/result'
import { type MonitorResult } from '@/api/result/interface'
const dialogVisible = ref(false)
@@ -117,6 +117,7 @@ const whichTimeData = ref<any>([])
const sourceData = ref<any>([])
const formRef = ref()
const submitSourceData = reactive({
monitorId: '',
whichTime: '',
resultType: '',
checkResult: -1
@@ -145,6 +146,7 @@ const handleTabClick = (tab: any) => {
const handleChooseClick = async () => {
const currentResult = resultData.value[activeName.value]
if (currentResult) {
submitSourceData.monitorId = currentResult.monitorId
submitSourceData.whichTime = currentResult.whichTime
submitSourceData.resultType = currentResult.resultType
submitSourceData.checkResult = currentResult.checkResult
@@ -169,8 +171,9 @@ const handleSourceChange = (value: any) => {
).checkResult
}
const handleSureChoose = () => {
formRef.value.validate().then(() => {
console.log(submitSourceData)
formRef.value.validate().then(async () => {
await updateMonitorResult(submitSourceData)
await getResultData()
dialogSourceVisible.value = false
})
}

View File

@@ -98,12 +98,11 @@
:key="item.id"
:label="item.name"
:value="item.code || ''"
:disabled="(selectByMode && planType == 0) || allDisabled">
</el-option>
/>
:disabled="(selectByMode && planType == 0) || allDisabled"
></el-option>
</el-select>
</el-form-item>
<el-form-item v-if="!selectByMode" :label-width="110" label="检测脚本" prop="scriptId">
<el-select
v-model="formContent.scriptId"
@@ -885,7 +884,7 @@ const open = async (sign: string, data: Plan.ReqPlan, currentMode: string, plan:
if (Array.isArray(user_Result.data)) {
if (user_Result.data.length > 0) {
// 为leaderData和memberData分别创建独立的对象数组
leaderData.value = user_Result.data
.filter((user: any) => !user.roleCodes.includes('root'))
.map((user: any) => ({