复制-二次弹窗确认

This commit is contained in:
caozehui
2025-03-07 09:02:19 +08:00
parent d41707fcf9
commit 97100dfa63
2 changed files with 27 additions and 20 deletions

View File

@@ -45,7 +45,7 @@ export const updateDtls = (params: any) => {
}
// 根据通讯参数生成装置下发原始数据公式
export const scriptDtlsCheckDataList = (params: any) => {
return http.post(`/pqScript/scriptDtlsCheckDataList`, params)
return http.post(`/pqScript/scriptDtlsCheckDataList`, params,{loading: false})
}
// 通讯脚本回显
export const checkDataList = (params: any) => {

View File

@@ -200,7 +200,7 @@
import { type PropType, ref, nextTick } from 'vue'
import Tree from './tree.vue'
import Commun from './communication.vue'
import type { CascaderOption } from 'element-plus'
import {type CascaderOption, ElMessageBox} from 'element-plus'
import { getTreeData } from '@/api/check/test'
import { CirclePlus, Delete, Check, CopyDocument, View, EditPen } from '@element-plus/icons-vue'
import type { TestScript } from '@/api/device/interface/testScript'
@@ -355,33 +355,40 @@ const openDialog = (titleType: string, row: Partial<TestScript.ResTestScript> =
}
// 复制
const copyRow = async (row: any) => {
ElMessageBox.confirm('是否复制当前检测项目?', '提示', {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: 'warning',
draggable: true
}).then(async () => {
let checkDataList: any = []
await communRef.value[0]?.getData().forEach((item: any) => {
item.children.forEach((k: any) => {
if (k.enable != 0 || k.errorFlag != 0) {
checkDataList.push({
pid: k.pid,
valueType: k.id,
dataType: k.dataType,
enable: k.enable,
errorFlag: k.errorFlag
})
}
})
item.children.forEach((k: any) => {
if (k.enable != 0 || k.errorFlag != 0) {
checkDataList.push({
pid: k.pid,
valueType: k.id,
dataType: k.dataType,
enable: k.enable,
errorFlag: k.errorFlag
})
}
})
})
let { data } = await scriptDtlsCheckDataList({ checkDataList: checkDataList, ...row, retryCompute: true })
let copyRow = JSON.parse(JSON.stringify(row))
delete copyRow.index
await addScriptDtls({ ...copyRow, scriptType: activeName.value, checkDataList: data }).then(res => {
if (res.code === 'A0000') {
ElMessage.success({
message: '复制成功!',
type: 'success'
})
getTree()
}
if (res.code === 'A0000') {
ElMessage.success({
message: '复制成功!',
type: 'success'
})
getTree()
}
})
})
}
// 查看
const view = (row: Partial<TestScript.ResTestScript> = {}) => {